Header menu logo issie

ErrorCheckHelpers Module

Types

Type Description

ExpressionNode

Functions and values

Function or value Description

RHSUnaryAnalysis assignmentRHS inputWireSizeMap paramMap

Full Usage: RHSUnaryAnalysis assignmentRHS inputWireSizeMap paramMap

Parameters:
    assignmentRHS : ExpressionDU
    inputWireSizeMap : Map<string, int>
    paramMap : Map<string, int>

Returns: OneUnary

Helper function used by checkWidthOfAssignment with 3 recursive subfunctions Returns the RHS Unary Size tree of type OneUnary where OneUnary = {Name:string;ResultWidth:int;Head:OneUnary option;Tail:OneUnary option;Elements:OneUnary list} Seems unused currently?

assignmentRHS : ExpressionDU
inputWireSizeMap : Map<string, int>
paramMap : Map<string, int>
Returns: OneUnary

checkExpr linesLocations currentInputWireSizeMap arraySizeMap paramMap localErrors expr

Full Usage: checkExpr linesLocations currentInputWireSizeMap arraySizeMap paramMap localErrors expr

Parameters:
    linesLocations : int list
    currentInputWireSizeMap : Map<string, int>
    arraySizeMap : Map<string, (int * int array)>
    paramMap : Map<string, int>
    localErrors : ErrorInfo list
    expr : ExpressionDU

Returns: ErrorInfo list
linesLocations : int list
currentInputWireSizeMap : Map<string, int>
arraySizeMap : Map<string, (int * int array)>
paramMap : Map<string, int>
localErrors : ErrorInfo list
expr : ExpressionDU
Returns: ErrorInfo list

checkNumber linesLocations num

Full Usage: checkNumber linesLocations num

Parameters:
    linesLocations : int list
    num : NumberT

Returns: ErrorInfo list
linesLocations : int list
num : NumberT
Returns: ErrorInfo list

checkPrimariesWidths linesLocations currentInputWireSizeMap arraySizeMap paramMap localErrors primariesRHS numbersRHS

Full Usage: checkPrimariesWidths linesLocations currentInputWireSizeMap arraySizeMap paramMap localErrors primariesRHS numbersRHS

Parameters:
    linesLocations : int list
    currentInputWireSizeMap : Map<string, int>
    arraySizeMap : Map<string, (int * int array)>
    paramMap : Map<string, int>
    localErrors : ErrorInfo list
    primariesRHS : PrimaryDU list
    numbersRHS : Number list

Returns: ErrorInfo list

Check if the width of each wire/input used is within the correct range (defined range)

linesLocations : int list
currentInputWireSizeMap : Map<string, int>
arraySizeMap : Map<string, (int * int array)>
paramMap : Map<string, int>
localErrors : ErrorInfo list
primariesRHS : PrimaryDU list
numbersRHS : Number list
Returns: ErrorInfo list

createErrorMessage newLinesLocations currLocation message extraMessages name

Full Usage: createErrorMessage newLinesLocations currLocation message extraMessages name

Parameters:
    newLinesLocations : int list
    currLocation : int
    message : string
    extraMessages : ExtraErrorInfo array
    name : string

Returns: ErrorInfo list

Helper function to create an ErrorInfo-type Error Message given the location, the variable name, and the message

newLinesLocations : int list
currLocation : int
message : string
extraMessages : ExtraErrorInfo array
name : string
Returns: ErrorInfo list

estimateArraySelCost a

Full Usage: estimateArraySelCost a

Parameters:
Returns: int
a : ArraySelect
Returns: int

estimateAssignmentCost a

Full Usage: estimateAssignmentCost a

Parameters:
Returns: int
a : Assignment
Returns: int

estimateExprCost expr

Full Usage: estimateExprCost expr

Parameters:
Returns: int

Helper functions to estimate size of memory to set limits Counts assignment, expression nodes, and primaries, as well as indices and ranges

expr : ExpressionDU
Returns: int

estimatePrimaryCost p

Full Usage: estimatePrimaryCost p

Parameters:
Returns: int
p : PrimaryDU
Returns: int

estimateStatementCost stmt

Full Usage: estimateStatementCost stmt

Parameters:
Returns: int
stmt : StatementDU
Returns: int

estimateUnaryCost u

Full Usage: estimateUnaryCost u

Parameters:
Returns: int
u : UnaryDU
Returns: int

evalNumber num

Full Usage: evalNumber num

Parameters:
    num : string

Returns: int

Helper function to evaluate numeric bit-select bounds

num : string
Returns: int

findCloseVariable variable portAndWireNames

Full Usage: findCloseVariable variable portAndWireNames

Parameters:
    variable : char seq
    portAndWireNames : string list

Returns: string list

Helper function to find the closest port or wire name Used by checkNamesOnRHSOfAssignment Gives an appropriate suggestion if the wrong name is close to a name in the list

variable : char seq
portAndWireNames : string list
Returns: string list

getAlwaysBlocksWithLocations alwaysBlocks node

Full Usage: getAlwaysBlocksWithLocations alwaysBlocks node

Parameters:
Returns: (AlwaysConstruct * int) list
alwaysBlocks : (AlwaysConstruct * int) list
node : ASTNode
Returns: (AlwaysConstruct * int) list

getCaseItemNums nums node

Full Usage: getCaseItemNums nums node

Parameters:
Returns: Number list
nums : Number list
node : ASTNode
Returns: Number list

getCaseStatements caseStatements node

Full Usage: getCaseStatements caseStatements node

Parameters:
Returns: CaseStatement list
caseStatements : CaseStatement list
node : ASTNode
Returns: CaseStatement list

getCaseStatementsWithLoc caseStatements node

Full Usage: getCaseStatementsWithLoc caseStatements node

Parameters:
Returns: (CaseStatement * int) list
caseStatements : (CaseStatement * int) list
node : ASTNode
Returns: (CaseStatement * int) list

getCondAndCaseExpressions expressions node

Full Usage: getCondAndCaseExpressions expressions node

Parameters:
Returns: (ExpressionDU * int) list
expressions : (ExpressionDU * int) list
node : ASTNode
Returns: (ExpressionDU * int) list

getDeclarations declarations node

Full Usage: getDeclarations declarations node

Parameters:
Returns: Declaration list
declarations : Declaration list
node : ASTNode
Returns: Declaration list

getForStatementsWithLoc forStatements node

Full Usage: getForStatementsWithLoc forStatements node

Parameters:
Returns: (ForStatement * int) list
forStatements : (ForStatement * int) list
node : ASTNode
Returns: (ForStatement * int) list

getLHSBits portSizeMap assignment

Full Usage: getLHSBits portSizeMap assignment

Parameters:
Returns: (string * string) list

replace this later with getLHSBits'!

portSizeMap : Map<string, int>
assignment : Assignment
Returns: (string * string) list

getLHSBits' portSizeMap assignment

Full Usage: getLHSBits' portSizeMap assignment

Parameters:
Returns: string list

returns all the bits of the lhs of an assignment the strings returned are unique, index surrounded by "[]" is appended to the name of the variable

portSizeMap : Map<string, int>
assignment : Assignment
Returns: string list

getLHSBitsAssignedCertainly portSizeMap paramMap assignment

Full Usage: getLHSBitsAssignedCertainly portSizeMap paramMap assignment

Parameters:
    portSizeMap : Map<string, int>
    paramMap : 'a
    assignment : Assignment

Returns: string list

returns each bit of an assignment LHS. In the case of variable indexing, no bits are returned

portSizeMap : Map<string, int>
paramMap : 'a
assignment : Assignment
Returns: string list

getLHSWidth assign varSizeMap arraySizeMap

Full Usage: getLHSWidth assign varSizeMap arraySizeMap

Parameters:
    assign : Assignment
    varSizeMap : Map<string, int>
    arraySizeMap : Map<string, (int * int array)>

Returns: int
assign : Assignment
varSizeMap : Map<string, int>
arraySizeMap : Map<string, (int * int array)>
Returns: int

getLineNumber linesLocations location

Full Usage: getLineNumber linesLocations location

Parameters:
    linesLocations : int list
    location : int

Returns: int

return line number based on location

linesLocations : int list
location : int
Returns: int

getModuleInstantiationInputPrimaries modInst project

Full Usage: getModuleInstantiationInputPrimaries modInst project

Parameters:
Returns: PrimaryDU list

Input primaries

modInst : ModuleInstantiation
project : Project
Returns: PrimaryDU list

getModuleInstantiationOutputPrimaries modInst project

Full Usage: getModuleInstantiationOutputPrimaries modInst project

Parameters:
Returns: PrimaryDU list

Output primaries

modInst : ModuleInstantiation
project : Project
Returns: PrimaryDU list

getModuleInstantiationStatements moduleInstantiations node

Full Usage: getModuleInstantiationStatements moduleInstantiations node

Parameters:
Returns: ModuleInstantiation list
moduleInstantiations : ModuleInstantiation list
node : ASTNode
Returns: ModuleInstantiation list

getPrimaryBits portSizeMap primary

Full Usage: getPrimaryBits portSizeMap primary

Parameters:
Returns: string list
portSizeMap : Map<string, int>
primary : PrimaryDU
Returns: string list

getPrimaryWidth portSizeMap primary

Full Usage: getPrimaryWidth portSizeMap primary

Parameters:
Returns: int
portSizeMap : Map<string, int>
primary : PrimaryDU
Returns: int

getRHSBits portSizeMap expression

Full Usage: getRHSBits portSizeMap expression

Parameters:
Returns: Set<string>

make sure to include variables AND ports in portSizeMap

portSizeMap : Map<string, int>
expression : ExpressionDU
Returns: Set<string>

getWidthOfExpr assignmentRHS inputWireSizeMap arraySizeMap paramMap

Full Usage: getWidthOfExpr assignmentRHS inputWireSizeMap arraySizeMap paramMap

Parameters:
    assignmentRHS : ExpressionDU
    inputWireSizeMap : Map<string, int>
    arraySizeMap : Map<string, (int * int array)>
    paramMap : Map<string, int>

Returns: int
assignmentRHS : ExpressionDU
inputWireSizeMap : Map<string, int>
arraySizeMap : Map<string, (int * int array)>
paramMap : Map<string, int>
Returns: int

getWireSizeMap items paramMap

Full Usage: getWireSizeMap items paramMap

Parameters:
    items : ItemDU list
    paramMap : Map<string, int>

Returns: Map<string, int>

Returns the names of the declared WIRES

items : ItemDU list
paramMap : Map<string, int>
Returns: Map<string, int>

lhsLocation lhs

Full Usage: lhsLocation lhs

Parameters:
Returns: int
lhs : AssignmentLHS
Returns: int

lhsName lhs

Full Usage: lhsName lhs

Parameters:
Returns: string

Helper functions to extract the name and location of the LHS of an assignment

lhs : AssignmentLHS
Returns: string

numbersUsedInAssignment inLst tree

Full Usage: numbersUsedInAssignment inLst tree

Parameters:
Returns: Number list
inLst : Number list
tree : ExpressionDU
Returns: Number list

primariesUsedInAssignment inLst tree

Full Usage: primariesUsedInAssignment inLst tree

Parameters:
Returns: PrimaryDU list

Recursive function to get all the primaries used in the RHS of an assignment Used by checkNamesOnRHSOfAssignment and checkSizesOnRHSOfAssignment

inLst : PrimaryDU list
tree : ExpressionDU
Returns: PrimaryDU list

Type something to start searching.