Header menu logo issie

CanvasStateAnalyser Module

Types

Type Description

CustomComponentError

MapData

Return all the Ids of all input ports across all components. Return also the ComponentId which may be used in error messages.

Functions and values

Function or value Description

analyseState (arg1, arg2) ldComps

Full Usage: analyseState (arg1, arg2) ldComps

Parameters:
Returns: SimulationError option * ConnectionsWidth option

Analyse a CanvasState and return any error (or None).

arg0 : Component list
arg1 : Connection list
ldComps : LoadedComponent list
Returns: SimulationError option * ConnectionsWidth option

checkAdderUnnecessaryNC (arg1, arg2)

Full Usage: checkAdderUnnecessaryNC (arg1, arg2)

Parameters:
Returns: SimulationError option

Check whether Adders have a NotConnected component connected to their COUT this is unnecessary since it can be disabled via its options

arg0 : Component list
arg1 : Connection list
Returns: SimulationError option

checkComponentNamesAreOk (arg1, arg2)

Full Usage: checkComponentNamesAreOk (arg1, arg2)

Parameters:
Returns: SimulationError option

check component labels are all unique and do not include protected values (CLK)

arg0 : Component list
arg1 : Connection list
Returns: SimulationError option

checkCustomComponentForOkIOs c args sheets

Full Usage: checkCustomComponentForOkIOs c args sheets

Parameters:
    c : Component - The custom component instance to check
    args : CustomComponentType - The custom component type containing parameter bindings and expected I/O labels
    sheets : LoadedComponent list - List of loaded component sheets to check against

Returns: Result<unit, (Component * CustomComponentError)> Ok() if the component's I/Os match the sheet definition Error with details if there's a mismatch or missing sheet

Check a single custom component for correct I/Os, resolving parameters if necessary.

Parameter Resolution Process: 1. If the component has parameter bindings AND the sheet has parameter slots: - Iterate through all components in the sheet - For each component, check if it has a parameter slot definition - If it's an Input1 or Output component with a matching IO label slot: * Evaluate the parameter expression using a simple recursive evaluator * The evaluator only handles PInt (constants) and PParameter (lookups) * Update the component's width with the resolved value 2. Use the resolved components to extract the actual I/O labels 3. Compare against expected labels from the custom component instance This simplified parameter resolution is sufficient for validation purposes, as it only needs to resolve I/O port widths to determine port labels. PARAMETER RESOLUTION ARCHITECTURE: The codebase implements parameter resolution at three different levels: 1. Full Resolution (ParameterTypes.evaluateParamExpression): - Supports all arithmetic operations (+, -, *, /, %) - Returns Result with detailed error messages - Used in UI for user feedback when editing parameters 2. Graph Resolution (GraphMerger.resolveParametersInSimulationGraph): - Uses internal evalExpr that returns Option - Supports all arithmetic operations - Applies resolved values via applySlotValue - Used during simulation graph construction 3. Validation Resolution (this function): - Minimal evaluator supporting only PInt and PParameter - Only resolves I/O port widths for label extraction - Optimized for fast validation checks This three-tier approach ensures efficient processing while maintaining full parameter functionality where needed.

c : Component

The custom component instance to check

args : CustomComponentType

The custom component type containing parameter bindings and expected I/O labels

sheets : LoadedComponent list

List of loaded component sheets to check against

Returns: Result<unit, (Component * CustomComponentError)>

Ok() if the component's I/Os match the sheet definition Error with details if there's a mismatch or missing sheet

checkCustomComponentsOk (arg1, arg2) sheets

Full Usage: checkCustomComponentsOk (arg1, arg2) sheets

Parameters:
Returns: SimulationError option

Custom components have I/Os which are the same (names) as the I/Os in the corresponding sheet This can change if a sheet made into a custom component is edited We do this check whenever a new sheet is opened

arg0 : Component list
arg1 : Connection list
sheets : LoadedComponent list
Returns: SimulationError option

getOutErrType count port rmInfo

Full Usage: getOutErrType count port rmInfo

Parameters:
Returns: SimulationErrorType
count : int
port : Port
rmInfo : PortRmInfo
Returns: SimulationErrorType

getPortName comp port

Full Usage: getPortName comp port

Parameters:
Returns: string
comp : Component
port : Port
Returns: string

getPortNum pList port

Full Usage: getPortNum pList port

Parameters:
Returns: int option
pList : Port list
port : Port
Returns: int option

getRmInfoData m port

Full Usage: getRmInfoData m port

Parameters:
Returns: Component * string
m : MapData
port : Port
Returns: Component * string

portNames componentType

Full Usage: portNames componentType

Parameters:
Returns: string list * string list

Input and Output names of the ports depending on their ComponentType

componentType : ComponentType
Returns: string list * string list

Type something to start searching.