WaveSimHelpers Module
Miscellaneous helpers used tby waveform simulator
Types
| Type | Description |
Functions and values
| Function or value | Description |
Full Usage:
allConnectedPorts fs sp
Parameters:
FastSimulation
sp : SheetPort list
Returns: SheetPort list
|
|
Full Usage:
button options func label
Parameters:
Option list
func : MouseEvent -> unit
label : ReactElement
Returns: ReactElement
|
|
Full Usage:
connectedIOs fs sp
Parameters:
FastSimulation
sp : SheetPort
Returns: SheetPort list
|
|
Full Usage:
connectedPorts fs sheetPort
Parameters:
FastSimulation
sheetPort : SheetPort
Returns: SheetPort list
|
|
Full Usage:
connsOfWave fs wi
Parameters:
FastSimulation
wi : WaveIndexT
Returns: ConnectionId list
|
|
Full Usage:
endButtonAction canvasState model dispatch ev
Parameters:
'a
model : 'b
dispatch : Msg -> 'c
ev : 'd
Returns: 'c
|
|
|
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.
|
Full Usage:
getWaveSimButtonOptions (arg1, arg2) model ws dispatch
Parameters:
Component list
arg1 : Connection list
model : Model
ws : WaveSimModel
dispatch : Msg -> unit
Returns: WaveSimButtonOptions
|
|
|
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.
|
Full Usage:
isInsideLibraryComponent fs arg2
Parameters:
FastSimulation
arg1 : InstancePath
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
|
Full Usage:
isRamSelected (arg1, arg2) wsModel
Parameters:
ComponentId
arg1 : ComponentId list
wsModel : WaveSimModel
Returns: bool
|
|
Full Usage:
isWaveSelected index wsModel
Parameters:
WaveIndexT
wsModel : WaveSimModel
Returns: bool
|
|
|
|
Full Usage:
makeWave ws fastSim wi
Parameters:
WaveSimModel
fastSim : FastSimulation
wi : WaveIndexT
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.
|
Full Usage:
makeWaveMap pairs
Parameters:
(WaveIndexT * Wave) list
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.
|
Full Usage:
portBits n
Parameters:
int
Returns: string
|
|
Full Usage:
reResolveWave fs wi
Parameters:
FastSimulation
wi : WaveIndexT
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.
|
Full Usage:
sheetOfWave fs wi
Parameters:
FastSimulation
wi : WaveIndexT
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.
|
Full Usage:
waveIndicesOfFComp fs (arg2, arg3)
Parameters:
FastSimulation
arg1 : ComponentId
arg2 : ComponentId list
Returns: WaveIndexT list
|
|
|
|
Full Usage:
waveToSheetPort fs wi
Parameters:
FastSimulation
wi : WaveIndexT
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.
|
|