Issie logo Issie

WaveSimHelpers Module

Miscellaneous helpers used tby waveform simulator

Types

Type Description

WaveSimButtonOptions

Functions and values

Function or value Description

allConnectedPorts fs sp

Full Usage: allConnectedPorts fs sp

Parameters:
Returns: SheetPort list

Given a list of ports, get all ports connected to any port in it. used by connsOfWave

fs : FastSimulation
sp : SheetPort list
Returns: SheetPort list

button options func label

Full Usage: button options func label

Parameters:
Returns: ReactElement

Helper function to create Bulma buttons

options : Option list
func : MouseEvent -> unit
label : ReactElement
Returns: ReactElement

connectedIOs fs sp

Full Usage: connectedIOs fs sp

Parameters:
Returns: SheetPort list

given an IOlabel port, get all same-name IOLabels on the same sheet

fs : FastSimulation
sp : SheetPort
Returns: SheetPort list

connectedPorts fs sheetPort

Full Usage: connectedPorts fs sheetPort

Parameters:
Returns: SheetPort list

given a SheetPort, get all directly connected SheetPorts

fs : FastSimulation
sheetPort : SheetPort
Returns: SheetPort list

connsOfWave fs wi

Full Usage: connsOfWave fs wi

Parameters:
Returns: ConnectionId list

Get all the connections of a given wave signal

fs : FastSimulation
wi : WaveIndexT
Returns: ConnectionId list

endButtonAction canvasState model dispatch ev

Full Usage: endButtonAction canvasState model dispatch ev

Parameters:
    canvasState : 'a
    model : 'b
    dispatch : Msg -> 'c
    ev : 'd

Returns: 'c

end the current simulation Nothing here clears the schematic. It used to reset the sheet's selection, because that is where the hover highlight had put itself; the highlight is now derived from the viewer's own state and goes with it, and the user's selection is the user's.

canvasState : 'a
model : 'b
dispatch : Msg -> 'c
ev : 'd
Returns: 'c

getCompGroup compType

Full Usage: getCompGroup compType

Parameters:
Returns: ComponentGroup

Which group (for selector classification) is a component of this type in? A function of the component TYPE alone, which is all it ever needed: it took a whole FastSimulation only to look the type up. Callers pass the type, so that when a port carries its own type there is nothing here left to change - and so that this says nothing about where the simulation ran.

compType : ComponentType
Returns: ComponentGroup

getWaveSimButtonOptions (arg1, arg2) model ws dispatch

Full Usage: getWaveSimButtonOptions (arg1, arg2) model ws dispatch

Parameters:
Returns: WaveSimButtonOptions

Return info about current state of waveform simulator which is used to switch buttons on/off etc. Runs on every render of the wave sim panel, so nothing here works out anything about the design that the model has already been told.

arg0 : Component list
arg1 : Connection list
model : Model
ws : WaveSimModel
dispatch : Msg -> unit
Returns: WaveSimButtonOptions

groupHeading compGroup

Full Usage: groupHeading compGroup

Parameters:
Returns: ReactElement

The heading over a group of components within one sheet of the wave selector. Every case of ComponentGroup, so that adding one is a compile error rather than a row headed "What? Not used!" - which is what the wildcard this replaces would have given. Three of them, WireLabel, Viewers and Component, are not produced by getCompGroup: they are there for grouping components by type rather than by name, which the selector does not currently do.

compGroup : ComponentGroup
Returns: ReactElement

isInsideLibraryComponent fs arg2

Full Usage: isInsideLibraryComponent fs arg2

Parameters:
Returns: bool

True when the component sits inside an instance of a library sheet. A library component is opaque: its innards are no more offered here than its sheet is offered in the Sheets menu. The instance's own ports are unaffected - they belong to the sheet it was placed on, and appear like any other custom component's, as sheet.L_Comp1.port. AccessPath is the chain of custom component instances the component sits within, so the test is whether any of them is an instance of a library sheet. The selector does not need this: the hierarchy it draws already makes a library component opaque, so no instance inside one is ever on show. It is for the two places that reach a component without going through the hierarchy - the default selection, which looks for Viewers anywhere in the design, and the schematic's right-click menu.

fs : FastSimulation
arg1 : InstancePath
Returns: bool

isRamSelected (arg1, arg2) wsModel

Full Usage: isRamSelected (arg1, arg2) wsModel

Parameters:
Returns: bool
arg0 : ComponentId
arg1 : ComponentId list
wsModel : WaveSimModel
Returns: bool

isWaveSelected index wsModel

Full Usage: isWaveSelected index wsModel

Parameters:
Returns: bool

convenience functions

index : WaveIndexT
wsModel : WaveSimModel
Returns: bool

librarySheetsOf

Full Usage: librarySheetsOf

Returns: FastSimulation -> Set<string>

The sheets of the simulated design that came from a component library. Read off the design the simulation was built from, so nothing has to thread it down from the project. It was recomputed from Model.CurrentProj on every refresh, which is every tick of a checkbox.

Returns: FastSimulation -> Set<string>

makeWave ws fastSim wi

Full Usage: makeWave ws fastSim wi

Parameters:
Returns: Wave

The Wave record for one selected wave: its name, its width, and where its data lies. Built from the ports of the wave's own INSTANCE - `PortView.ofInstance`, which costs one sheet - and from the design, which supplies everything about where the wave sits. What the simulation is asked for is the two things only it knows: the port's width, and its driver. A wave whose port the simulation no longer offers gets a record saying so rather than throwing. It is what a selection saved against an older version of the design resolves to, and reconcileWaves drops it moments later; failing here instead took the whole viewer down.

ws : WaveSimModel
fastSim : FastSimulation
wi : WaveIndexT
Returns: Wave

makeWaveMap pairs

Full Usage: makeWaveMap pairs

Parameters:
Returns: Map<WaveIndexT, Wave>

Build a wave map in a scope that holds nothing. This exists because a Fable map carries the comparer it was built with, and Fable creates that comparer - an object holding a Compare closure - at the construction site. V8 gives all the closures of a function one shared context holding every variable any of them captures, so a comparer made where a FastSimulation is in scope shares a context with it - and the map then pins the whole simulation, step arrays and all, for as long as the map lives. WaveDetails lives in the WaveSimModel, which outlives its simulation by design, and a copy of it sits in every model generation React retains - which is how an ended simulation's memory survived every explicit release. Built here, where no closure can capture anything, the comparer retains nothing. Do not inline this into a caller that has a simulation in scope.

pairs : (WaveIndexT * Wave) list
Returns: Map<WaveIndexT, Wave>

portBits n

Full Usage: portBits n

Parameters:
    n : int

Returns: string
n : int
Returns: string

reResolveWave fs wi

Full Usage: reResolveWave fs wi

Parameters:
Returns: WaveIndexT option

The wave one index names, in the simulation as it is NOW - or None if that simulation does not offer it any more. A WaveIndexT says where its data lies (SimArrayIndex) as well as which port it is. The first is true only of the build it came from, so a selection made before a rebuild has to be resolved against the new one. The other three fields are the stable name and are what this looks up. It used to be answered by indexing a map of every wave in the simulation, built by inverting that map's 208,896 keys. The component knows where its own ports are, so a selection of a hundred waves is a hundred lookups. None drops the wave. That is said only by an instance that HAS been described and does not offer the port - a component renamed or deleted. An instance not yet described (the sidecar has not answered for it) keeps the wave, unresolved: SimArrayIndex = DriverIndex -1, which nothing draws and nothing fetches, until the slice lands and the next refresh resolves it - or drops it then, knowing.

fs : FastSimulation
wi : WaveIndexT
Returns: WaveIndexT option

sheetOfWave fs wi

Full Usage: sheetOfWave fs wi

Parameters:
Returns: string option

The name of the sheet a wave's component sits on, which is how ComponentsById and ConnectionsByPort are both keyed. A component's access path names the custom component instances it sits inside, innermost first, so its head is an instance of the sheet wanted. It is that instance's TYPE which names the sheet: its LABEL is chosen by whoever placed it, and only happens to be the sheet's name until someone renames the instance. Asking the label instead left every wave in a renamed subsheet - REGFILE for reg16x8, say - with no connections found, and so no wires highlighted on hover.

fs : FastSimulation
wi : WaveIndexT
Returns: string option

waveIndicesOfFComp fs (arg2, arg3)

Full Usage: waveIndicesOfFComp fs (arg2, arg3)

Parameters:
Returns: WaveIndexT list

The ports of one elaborated component that carry a waveform, as wave indices into the simulation as it is now. Read off the instance's port view - the one derivation of what carries a wave - rather than deciding again from a FastComponent.

fs : FastSimulation
arg1 : ComponentId
arg2 : ComponentId list
Returns: WaveIndexT list

waveInfoButton name dispatch

Full Usage: waveInfoButton name dispatch

Parameters:
    name : string
    dispatch : Msg -> Unit

Returns: ReactElement

button driving a popup with a page of info about waveform simulator

name : string
dispatch : Msg -> Unit
Returns: ReactElement

waveToSheetPort fs wi

Full Usage: waveToSheetPort fs wi

Parameters:
Returns: SheetPort list

Work out a SheetPort from a wave, if one exists SheetPorts may not exist in some corner cases when simulation is ending etc. Every step is best effort and gives nothing rather than throwing. The link between a wave and the schematic is only as good as the schematic still being the one that was simulated, and this runs from the mouse handlers on a waveform's name - where an exception is not caught by showWaveforms' error boundary, which has already returned by then.

fs : FastSimulation
wi : WaveIndexT
Returns: SheetPort list

wavesToIds waves

Full Usage: wavesToIds waves

Parameters:
Returns: WaveIndexT list

Convert Wave list to list of WaveIndexT

waves : Wave list
Returns: WaveIndexT list

Type something to start searching.