Issie logo Issie

CommonTypes Module

Types and nested modules

Type/Module Description

Constants

JSONComponent

JSONWave

LegacyCanvas

ArrayInfo

Reduced version of Component: id, type and label are all a simulation needs. A custom component's port names and instance parameter bindings ride inside TypeS (CustomComponentType.InputLabels/OutputLabels/ParameterBindings), where port number n is by definition index n of the label list - so port names are never duplicated here. The array settings of an ARRAY COMPONENT; absent on an ordinary sheet. An array component is a sheet whose hardware is `Copies` copies of what is drawn on it, one per value of the loop variable. What joins the copies to each other and to the outside is the array IO components - see ComponentType's BusOut, MuxOut, JoinOut and JoinIn. Copies is a plain integer and deliberately NOT a parameter expression. It fixes how many copies there are, and so fixes the ports of every instance of this sheet: an array component has ONE signature per set of bindings, exactly as any other sheet does. Making it an expression would make a sheet's port LIST depend on who instantiated it, which nothing else in Issie has to cope with. Widths remain parameterisable as they are everywhere else.

BoundingBox

CCForm

Type to specify the origin of a custom component

CanvasState

F# data describing the contents of a single schematic sheet.

Component

JSComponent mapped to F# record. Id uniquely identifies the component within a sheet. Label is optional descriptor displayed on schematic.

ComponentType

Connection

JSConnection mapped to F# record. Id uniquely identifies connection globally and is used by library.

ConnectionsWidth

Value set to None if the connection width could not be inferred.

CursorType

Keeps track of what cursor to show

CustomComponentType

Name identifies the LoadedComponent used. The labels define legends on symbol designating inputs or outputs: and are the names of the Input or Output components of the CC sheet. Label strings are unique per CustomComponent. Label position in list determines inputPortNumber or outputPortNumber of label. Multiple CustomComponent instances are differentiated by Component data.

Direction

Holds possible directions to sort ports. HLP23: AUTHOR dgs119

Edge

Represents the sides of a component

GateComponentType

HighLightColor

Colors to highlight components Case name is used as HTML color name. See JSHelpers.getColorString lots of colors can be added, see https://www.w3schools.com/colors/colors_names.asp The Text() method converts it to the correct HTML string Where speed matters the color must be added as a case in the match statement

InitMemData

JSDiagramMsg

Messages sent from draw block

KeyPressInfo

Type capturing global key press information TODO: use this consistently, with global key listener, throughout Issie.

LoadedComponent

Static data describing a schematic sheet loaded as a custom component. Every sheet is always identified with a file from which it is loaded/saved. Name is human readable (and is the filename - without extension) and identifies sheet. File path is the sheet directory and name (with extension). InputLabels, OutputLabels are the I/O connections. The I/O connection integers are bus widths. The I/O connection strings are human readable. The strings are guaranteed to be unique in the I/O connection list. I.e. An input label may be the same as an output label, but two input (or output) labels cannot be the same. The position in the I/O connections list is important as it implicitly indicates the port number. For example, the first element in the InputLabels list is related to the Component's Port with PortNumber 0. Two instances of a loaded component have the same LoadedComponent data.

Memory

Note that any memory addresses which have not been explicitly set when printing out memory data.

Memory1

NBitsArithmetic

 Option of this qualifies NBitsXOr to allow many different components
 None => Xor
 TODO to reduce technical debt: 
     Rename NbitsXor as NBitsCustom, put all the Nbits ops into this D.U.
     Change catalog entries for all NBits ops to use NBitsCustom, alter load to remain compatibility.

NumberBase

Port

PortType

Specify the type of a port in a Component.

Project

Type for an open project which represents a complete design. ProjectPath is directory containing project files. OpenFileName is name of file from which current schematic sheet is loaded/saved, without extension or path LoadedComponents contains the list of schematic sheets, each as a component, one per sheet.

ReducedCanvasState

reduced version of CanvasState for electrical comparison, all geometry removed, components ordered

Rotation

Represents the rotation of a symbol in degrees, Degree0 is the default symbol rotation. Angle is anticlockwise

STransform

Stores the rotation and the flip of the symbol, flipped false by default

SavedWaveInfo

Info saved by Wave Sim. This info is not necessarilu uptodate with deletions or additions in the Diagram. The wavesim code processing this will not fail if non-existent nets are referenced.

ScaleAdjustment

SheetInfo

Info regarding sheet saved in the .dgm file

ShiftComponentType

SignalHandle

A simulator's handle for reading one signal: dense within one build, meaningless outside it, and issued by whichever simulator is running. Never stored in the model. The renderer asks the simulator to turn SignalIds into handles after each build and quotes handles back when reading data. Keeping it distinct from SignalId is what stops a handle from one simulation being used to read another - which is exactly the mistake an exposed SimArrayIndex makes possible.

SignalId

The stable NAME of a signal: which port of which component of which instance. This is WaveIndexT without SimArrayIndex, and that omission is the point. SimArrayIndex is a step-array index handed out by one build of one simulation and means nothing outside it, which is why a selection has to be re-resolved by the other three fields whenever the simulation is rebuilt. A SignalId survives a rebuild by construction, so it is what the model should hold.

SimEpoch

Bumped by every simulation build. Every cached entry and every reply in flight carries the epoch it belongs to, so an answer from a superseded build is discarded rather than displayed.

SimpleComponent

SimpleConnection

Reduced version of Connection: two endpoints, each a component id and a port NUMBER (output-side number at the source, input-side number at the destination).

SimpleDesign

A whole design: the sheets and which one is the top.

SimpleSheet

One sheet of a design. Sheet IO *order* is not carried (in Issie it derives from component geometry, which is gone): the receiving side recovers ordering from any instance's TypeS labels, and the top sheet needs none.

SymbolInfo

WSConfig

WaveIndexT

Uniquely identifies a wave by the component it comes from, and the port on which that wave is from. Two waves can be identical but have a different index (e.g. a wave with PortType Input must be driven by another wave of PortType Output).

WavePath

One saved waveform: a component named by the LABELS of the custom component instances entered to reach it, then its own label, and which of its ports. Not ids and not array indices, because this is written to a file and read back against a design that has been edited since. See `WavePath.fs`, which resolves it both ways. The field names are prefixed because F# resolves an unannotated record field to the last type declaring it, and `PortType`/`PortNumber` are `WaveIndexT`'s.

Width

This width is for wire displaying, >8 buswires displayed with 8px thickness. Actual size stored in Port type

WidthInferError

Documents user circuit error found during connection width inference

WireWidth

unconfigured replaces Some -1, Error replaces None, Configured of int replaces Some (positive int)

XYPos

Position on SVG canvas Positions can be added, subtracted, scaled using overloaded +,-, * operators currently these custom operators are not used in Issie - they should be!

Functions and values

Function or value Description

arrayInfo_

Full Usage: arrayInfo_

Returns: Lens<LoadedComponent, ArrayInfo option>

A sheet's array settings, where it has any.

Returns: Lens<LoadedComponent, ArrayInfo option>

canvasState_

Full Usage: canvasState_

Returns: Lens<LoadedComponent, CanvasState>
Returns: Lens<LoadedComponent, CanvasState>

clockedSheets ldcs

Full Usage: clockedSheets ldcs

Parameters:
Returns: Set<string>

Which SHEETS of a design hold something clocked, at any depth. A fact about a sheet and not about any instance of it: a sheet's components are the same wherever it is placed, and parameters change widths rather than kinds. So it is worked out once for a design, and every symbol drawn on it is then a set lookup. Settled in one pass over sheets ordered so that each comes after everything inside it. Working it out per component instead re-walked the whole subtree for every custom component drawn - twice, since a symbol asks once for its colour and once for its own record - and that walk follows every ROUTE through the design rather than every sheet, so a design whose sheets instantiate one another costs paths rather than sheets.

ldcs : LoadedComponent list
Returns: Set<string>

componentIdDecoder

Full Usage: componentIdDecoder

Returns: Decoder<ComponentId>
Returns: Decoder<ComponentId>

componentIdEncoder cid

Full Usage: componentIdEncoder cid

Parameters:
Returns: JsonValue

A component I/O. Id (like any other Id) is a string generated with 32 random hex charactes, so it is (practically) globally unique. These Ids are used to uniquely refer to ports and components. They are generated via uuid(). PortNumber is used to identify which port is which on a component, contiguous from 0 separately for inputs and outputs. See comments above type definition for details HostId is the unique Id of the component where the port is. For example, all three ports on the same And component will have the same HostId.

cid : ComponentId
Returns: JsonValue

componentsState_

Full Usage: componentsState_

Returns: Lens<LoadedComponent, Component list>
Returns: Lens<LoadedComponent, Component list>

convertFromJSONComponent mapCompId mapPortId comp

Full Usage: convertFromJSONComponent mapCompId mapPortId comp

Parameters:
Returns: Component

Transforms JSON components (parsed from JSON) to current components: legacy ComponentType cases are upgraded, and the file's string ids become integers through the mapping functions the loader supplies - which is where a uuid in an old file gets its integer allocated.

mapCompId : string -> ComponentId
mapPortId : string -> PortId
comp : Component
Returns: Component

convertFromJSONConnection mapConnId mapCompId mapPortId conn

Full Usage: convertFromJSONConnection mapConnId mapCompId mapPortId conn

Parameters:
Returns: Connection

A file connection to a live one, through the same id mappings.

mapConnId : string -> ConnectionId
mapCompId : string -> ComponentId
mapPortId : string -> PortId
conn : Connection
Returns: Connection

convertToJSONComponent comp

Full Usage: convertToJSONComponent comp

Parameters:
Returns: Component

Transforms normal Components into JSON Components which can be saved. This is always an identity transformation since the normal ComponentType muts be strict subset of teh JSON ComponentType. unboxing is ok here because we do not use equality in the conversion to JSON.

comp : Component
Returns: Component

convertToJSONConnection conn

Full Usage: convertToJSONConnection conn

Parameters:
Returns: Connection

A live connection to its file form, ids written as decimal strings.

conn : Connection
Returns: Connection

copiesOfArray info

Full Usage: copiesOfArray info

Parameters:
Returns: int

How many copies an array component has.

info : ArrayInfo
Returns: int

copies_

Full Usage: copies_

Returns: Lens<ArrayInfo, int>
Returns: Lens<ArrayInfo, int>

euclideanDistance pos1 pos2

Full Usage: euclideanDistance pos1 pos2

Parameters:
Returns: float
Modifiers: inline
pos1 : XYPos
pos2 : XYPos
Returns: float

formOpt_

Full Usage: formOpt_

Returns: Lens<LoadedComponent, CCForm option>
Returns: Lens<LoadedComponent, CCForm option>

getMemType cType

Full Usage: getMemType cType

Parameters:
Returns: Memory1 -> ComponentType

get memory component type constructor NB only works with new-style memory components

cType : ComponentType
Returns: Memory1 -> ComponentType

getSTransformWithDefault infoOpt

Full Usage: getSTransformWithDefault infoOpt

Parameters:
Returns: STransform
infoOpt : SymbolInfo option
Returns: STransform

h_

Full Usage: h_

Returns: Lens<Component, float>
Returns: Lens<Component, float>

inputPorts_

Full Usage: inputPorts_

Returns: Lens<Component, Port list>
Returns: Lens<Component, Port list>

isArraySheet ldc

Full Usage: isArraySheet ldc

Parameters:
Returns: bool

Whether a sheet is an array design sheet.

ldc : LoadedComponent
Returns: bool

isClocked _visitedSheets ldcs comp

Full Usage: isClocked _visitedSheets ldcs comp

Parameters:
Returns: bool

Returns true if a component is clocked. For ONE component. Anything asking about many should work out `clockedSheets` once and use `isClockedGiven` - which is what the draw block does, since it asks about every symbol on a sheet twice over.

_visitedSheets : string list
ldcs : LoadedComponent list
comp : Component
Returns: bool

isClockedGiven clocked comp

Full Usage: isClockedGiven clocked comp

Parameters:
Returns: bool

Whether a component is clocked, given which sheets of the design are.

clocked : Set<string>
comp : Component
Returns: bool

isClockedPrimitive compType

Full Usage: isClockedPrimitive compType

Parameters:
Returns: bool

Whether a component is clocked in itself - without looking inside a custom component, which is a question about the sheet it names rather than about the component. The same set as `SynchronousUtils.couldBeSynchronousComponent` minus `Custom`, which that one has to assume is clocked and this one answers properly. They are two lists because this is in CommonTypes, which the simulator is compiled after; `Properties.fs` holds them to agreeing. AsyncROM1 is absent deliberately: an asynchronous ROM presents its data in the same cycle as its address, so it is combinational. The three legacy memory types are absent because they never occur - every loaded design has the `1` forms, and the evaluators raise on the others - which is what this used to match, so a sheet whose only clocked component was a memory was reported combinational and drawn as if it were.

compType : ComponentType
Returns: bool

isGeneratedSheetName sheetName

Full Usage: isGeneratedSheetName sheetName

Parameters:
    sheetName : string

Returns: bool

Is this the name of a sheet the EXPANSION made, rather than one somebody drew? A sheet name is a file name, so a path separator can never be typed into one - which is what ArrayElaborate builds its generated names out of, and what makes this test exact rather than a guess about naming. What it is asked for: such a sheet and the instances of it were made together in one pass, so the checks that catch an instance drifting from a sheet somebody edited have nothing to say about them.

sheetName : string
Returns: bool

isNegated gateType

Full Usage: isNegated gateType

Parameters:
Returns: bool
Modifiers: inline
gateType : GateComponentType
Returns: bool

isTopSheet_

Full Usage: isTopSheet_

Returns: Lens<LoadedComponent, bool>
Returns: Lens<LoadedComponent, bool>

lcParameterDefs_

Full Usage: lcParameterDefs_

Returns: Lens<LoadedComponent, ParameterDefs>

A sheet's parameter data as though it were always there: a sheet that declares none reads as empty declarations and no slots, and writing to it creates the record. A LENS, where lcParameterSlots_ above is a prism, and that is the whole point. Composing a prism onto a prism gives an optic whose SETTER does nothing when the outer get returns None (Optics.fs), so `Optic.set` through lcParameterSlots_ silently dropped every write to a sheet that had no parameter data yet - which is exactly the sheet a first declaration is being written to. That hole is why ParameterView grew a second, hand-written path for the None case.

Returns: Lens<LoadedComponent, ParameterDefs>

lcParameterSlots_

Full Usage: lcParameterSlots_

Returns: Prism<LoadedComponent, ParameterDefs>
Returns: Prism<LoadedComponent, ParameterDefs>

legacyTypesConvert (lComps, lConns)

Full Usage: legacyTypesConvert (lComps, lConns)

Parameters:
Returns: Component list * Connection list
lComps : LegacyComponent list
lConns : LegacyConnection list
Returns: Component list * Connection list

loadedComponentIsOutOfDate_

Full Usage: loadedComponentIsOutOfDate_

Returns: Lens<LoadedComponent, bool>
Returns: Lens<LoadedComponent, bool>

loadedComponentOf_ name

Full Usage: loadedComponentOf_ name

Parameters:
    name : string

Returns: Lens<Project, LoadedComponent>
name : string
Returns: Lens<Project, LoadedComponent>

loadedComponents_

Full Usage: loadedComponents_

Returns: Lens<Project, LoadedComponent list>
Returns: Lens<Project, LoadedComponent list>

loopParam_

Full Usage: loopParam_

Returns: Lens<ArrayInfo, ParamName>

Lenses for ArrayInfo

Returns: Lens<ArrayInfo, ParamName>

openFileName_

Full Usage: openFileName_

Returns: Lens<Project, string>
Returns: Lens<Project, string>

openLoadedComponent_

Full Usage: openLoadedComponent_

Returns: Lens<Project, LoadedComponent>
Returns: Lens<Project, LoadedComponent>

outputPorts_

Full Usage: outputPorts_

Returns: Lens<Component, Port list>
Returns: Lens<Component, Port list>

pXY arg1

Full Usage: pXY arg1

Parameters:
Returns: string

display XYPos as string nicely for debugging

arg0 : XYPos
Returns: string

portOrder_

Full Usage: portOrder_

Returns: Lens<SymbolInfo, Map<Edge, PortId list>>
Returns: Lens<SymbolInfo, Map<Edge, PortId list>>

portOrientation_

Full Usage: portOrientation_

Returns: Lens<SymbolInfo, Map<PortId, Edge>>
Returns: Lens<SymbolInfo, Map<PortId, Edge>>

sheetInfoOfJson mapCompId si

Full Usage: sheetInfoOfJson mapCompId si

Parameters:
Returns: SheetInfo
mapCompId : string -> ComponentId
si : SheetInfo
Returns: SheetInfo

sheetInfoToJson si

Full Usage: sheetInfoToJson si

Parameters:
Returns: SheetInfo
si : SheetInfo
Returns: SheetInfo

shifterWidthFor busWidth

Full Usage: shifterWidthFor busWidth

Parameters:
    busWidth : int

Returns: int

Number of bits needed on a shifter's SHIFT input to express every shift amount 0 .. busWidth-1. Must be recomputed whenever the bus width changes. This is ceil(log2 busWidth), clamped to 1 so that a one-bit bus still has a shift input. It used to count the bits of busWidth-1 itself; ParameterTypes.clog2 is the same count, exported because `clog2` in a parameter expression must mean exactly what the SHIFT input does. The one difference is at busWidth <= 0, where counting the bits of -1 shifted for ever.

busWidth : int
Returns: int

slotInfo_

Full Usage: slotInfo_

Returns: Lens<Component, ComponentSlotExpr option>
Returns: Lens<Component, ComponentSlotExpr option>

topLeft_

Full Usage: topLeft_

Returns: Lens<BoundingBox, XYPos>
Returns: Lens<BoundingBox, XYPos>

type_

Full Usage: type_

Returns: Lens<Component, ComponentType>
Returns: Lens<Component, ComponentType>

unreduced arg1

Full Usage: unreduced arg1

Parameters:
Returns: Component list * Connection list
arg0 : ReducedCanvasState
Returns: Component list * Connection list

w_

Full Usage: w_

Returns: Lens<Component, float>
Returns: Lens<Component, float>

waveInfoOfJson mapCompId wi

Full Usage: waveInfoOfJson mapCompId wi

Parameters:
Returns: SavedWaveInfo
mapCompId : string -> ComponentId
wi : SavedWaveInfo
Returns: SavedWaveInfo

waveInfoToJson wi

Full Usage: waveInfoToJson wi

Parameters:
Returns: SavedWaveInfo
wi : SavedWaveInfo
Returns: SavedWaveInfo

waveSimMaxArrayMargin

Full Usage: waveSimMaxArrayMargin

Returns: int

The most step-array cycles a WSConfig.LastClock can imply beyond LastClock itself: the worst-case zoom margin plus the overflow steps. The largest configurable last clock and the largest array that fits differ by exactly this.

Returns: int

waveSimMultipliers

Full Usage: waveSimMultipliers

Returns: int list

The zoom multipliers the waveform viewer can sample at. Zooming out samples every Nth cycle, so the step arrays carry a margin past WSConfig.LastClock of up to the largest multiplier, plus a few overflow steps - ModelHelpers.waveSimRequiredArraySize computes the exact size a configuration implies. These live here, beside WSConfig, because the simulator's memory check (FastCreate) and the configuration dialog sit on opposite sides of the UI boundary and must agree about what a configuration costs: each once had its own idea of the margin, so a last clock the dialog allowed could be refused the moment the simulation was built.

Returns: int list

waveSimStepsOverflow

Full Usage: waveSimStepsOverflow

Returns: int

Extra simulation steps the waveform viewer may run past the last sampled cycle.

Returns: int

workingFileName_

Full Usage: workingFileName_

Returns: Lens<Project, string option>
Returns: Lens<Project, string option>

Active patterns

Active pattern Description

(|IsBinaryGate|NotBinaryGate|) cType

Full Usage: (|IsBinaryGate|NotBinaryGate|) cType

Parameters:
Returns: Choice<unit, unit>

Active pattern which matches 2-input gate component types. NB - NOT gates are not included here.

cType : ComponentType
Returns: Choice<unit, unit>

(|IsGate|NoGate|) cType

Full Usage: (|IsGate|NoGate|) cType

Parameters:
Returns: Choice<unit, unit>
cType : ComponentType
Returns: Choice<unit, unit>

(|MemoryAndType|_|) typ

Full Usage: (|MemoryAndType|_|) typ

Parameters:
Returns: ((Memory1 -> ComponentType) * Memory1) option
typ : ComponentType
Returns: ((Memory1 -> ComponentType) * Memory1) option

(|Memory|_|) typ

Full Usage: (|Memory|_|) typ

Parameters:
Returns: Memory1 option
typ : ComponentType
Returns: Memory1 option

Type something to start searching.