Header menu logo issie

SimulatorTypes Module

Types

Type Description

AlgebraNotImplemented

Raised when an Algebraic case is found in FastSim which has not been implemented, or does not make sense to implement.

BigIntState

Used for efficiency reasons. For a given normal simulation these arrays show whether the corresponding component input or output is a bigint or a unint32 type bus, and therefore show IOArray array is used for the data.

BinaryOp

Bit

Binary data used in simulation

BitInt

ComparisonOp

Driver

Convenience array used so that waveform simulation can access component outputs (drivers) without a Map lookup

FData

FSInterface

FastAlgExp

FastBits

FastComponent

FastComponent represents a physical component in a simulation. Because sheets can be instantiated in multiple places a given sheet component can have multiple FastComponents in the simulation. Arrays on FastComponent are filled up with simulation data per clock step as a clocked simulation progresses.

FastData

FastSimulation

GatherData

GatherTemp

GatherTemp is the output type used to accumulate lists of data links when recursively exploring SimulationGraph as first step in flattening it. Each list of pairs is converted into a map at the end in the final GatherData structure The cost of creating maps makes it important to use lists here as the intermediate structures

IOArray

This type represents an array of time steps of simulation data. In any simulation, for a given IOArray, only one of the three 'Step' arrays will be used. For (very strong) efficiency reasons this cannot be implemented as a disjoint union: the code that reads and writes IOArray array elements will access the appropriate array. Truthtable simulations use FDataStep everywhere. Normal simulations use UInt32step or BigIntStep according to the size of the relevant bus.

IsClockTick

Message used to feed forward evaluation. Clock tick => state changes to that in next cycle

JSCanvasState

State retrieves directly from Diagram has Javascript objects

JSComponent

Wrapper for Javascript (Diagram) component. Why here?

JSConnection

Wrapper for Javascript (Diagram) connection. Why here?

OutputChange

contains info needed to propagate wire value changes through a simulation.

PortRmInfo

ReducerInput

This drives the generation of component outputs it is processed by the Reducer function.

ReducerOutput

When all inputs are available the reducer function will generate these outputs. For custom components the SimulationGraph contains embedded state.

SheetPort

Type used to tie component ports to simulation data for advanved wavefor simulation features.

SimulationComponent

Like Component but with additional dynamic info used by simulator Clocked components have state data. All components have optional data on inputs that propagates During evaluation of combinational logic Components require all inputs to have data before they can generate output data Note that reducer is a function that generates the outputs TODO: make this equatable data?

SimulationComponentState

State (possibly none) remembered by component from previous clock cycle. Combinational components have no state.

SimulationData

- Top level data tracking a simulation

SimulationError

- Documents an error found while simulating. - Should never happen

SimulationErrorType

SimulationGraph

Map every ComponentId to its SimulationComponent.

SimulationIO

For every IO node, keep track of its Id, Label and wire width. - Id: to feed values into the simulationGraph. - Label: to display a nice form to the user. - Width: to feed the right values into the simulation.

SimulationRunStatus

document current status of a simulation as used by waveform simulator

StepArray<'T>

Wrapper to allow arrays to be resized for longer simulations while keeping the links between inputs and outputs

UnaryOp

WireData

Fixed width bus data used in simulation TODO: refactor as int64 or bigint for efficiency The list is little-endian: the LSB is at index 0, and the MSB is at index N-1, where N is the length of the list.

Functions and values

Function or value Description

addBIBits bits1 bits2 cin

Full Usage: addBIBits bits1 bits2 cin

Parameters:
Returns: BitInt * uint32
bits1 : BitInt
bits2 : BitInt
cin : uint32
Returns: BitInt * uint32

appendBIBits (arg1, arg2) (arg3, arg4)

Full Usage: appendBIBits (arg1, arg2) (arg3, arg4)

Parameters:
Returns: uint32[]

append bits2 on MSB side of bits1

arg0 : BitInt
arg1 : int
arg2 : BitInt
arg3 : int
Returns: uint32[]

assembleArithmetic width expLst

Full Usage: assembleArithmetic width expLst

Parameters:
Returns: FastAlgExp
width : int
expLst : FastAlgExp list
Returns: FastAlgExp

b2s b

Full Usage: b2s b

Parameters:
    b : bigint

Returns: string
b : bigint
Returns: string

bigIntBitMask pos

Full Usage: bigIntBitMask pos

Parameters:
    pos : int

Returns: bigint

single bit 1 (2 ** pos)

pos : int
Returns: bigint

bigIntBitMaskA

Full Usage: bigIntBitMaskA

Returns: bigint[]
Returns: bigint[]

bigIntMask width

Full Usage: bigIntMask width

Parameters:
    width : int

Returns: BigInteger

all bits with numbers < width = 1

width : int
Returns: BigInteger

bigIntMaskA

Full Usage: bigIntMaskA

Returns: BigInteger[]
Returns: BigInteger[]

binopBIBits op bits1 bits2

Full Usage: binopBIBits op bits1 bits2

Parameters:
    op : uint32 -> uint32 -> uint32
    bits1 : BitInt
    bits2 : BitInt

Returns: BitInt
op : uint32 -> uint32 -> uint32
bits1 : BitInt
bits2 : BitInt
Returns: BitInt

bitsToBig lst

Full Usage: bitsToBig lst

Parameters:
    lst : Bit list

Returns: bigint
lst : Bit list
Returns: bigint

bitsToInt lst

Full Usage: bitsToInt lst

Parameters:
    lst : Bit list

Returns: uint32
lst : Bit list
Returns: uint32

clockTickNumber_

Full Usage: clockTickNumber_

Returns: Lens<SimulationData, int>
Returns: Lens<SimulationData, int>

errMsg errType

Full Usage: errMsg errType

Parameters:
Returns: string
errType : SimulationErrorType
Returns: string

evalExp exp

Full Usage: evalExp exp

Parameters:
Returns: FastAlgExp

Recursively evaluates an expression to reduce it to its simplest form

exp : FastAlgExp
Returns: FastAlgExp

expToString exp

Full Usage: expToString exp

Parameters:
Returns: string

Converts an Algebraic Expression to a string for pretty printing

exp : FastAlgExp
Returns: string

extractLabel label

Full Usage: extractLabel label

Parameters:
Returns: string
label : ComponentLabel
Returns: string

fastBit n

Full Usage: fastBit n

Parameters:
    n : uint32

Returns: FastData
n : uint32
Returns: FastData

fastDataOne

Full Usage: fastDataOne

Returns: FastData
Returns: FastData

fastDataZero

Full Usage: fastDataZero

Returns: FastData
Returns: FastData

fastSim_

Full Usage: fastSim_

Returns: Lens<SimulationData, FastSimulation>
Returns: Lens<SimulationData, FastSimulation>

fastToWire f

Full Usage: fastToWire f

Parameters:
Returns: Bit list

convert FastData to WireData equivalent

f : FastData
Returns: Bit list

flattenNestedArithmetic exp

Full Usage: flattenNestedArithmetic exp

Parameters:
Returns: FastAlgExp list
exp : FastAlgExp
Returns: FastAlgExp list

floatCarryBit

Full Usage: floatCarryBit

Returns: float
Returns: float

foldAppends expressions

Full Usage: foldAppends expressions

Parameters:
Returns: FastAlgExp list
expressions : FastAlgExp list
Returns: FastAlgExp list

getAlgExpWidth exp

Full Usage: getAlgExpWidth exp

Parameters:
Returns: int

Calculates and returns the expected width of an Algebraic Expression

exp : FastAlgExp
Returns: int

getBIBit bits pos

Full Usage: getBIBit bits pos

Parameters:
Returns: uint32
bits : BitInt
pos : int
Returns: uint32

getBIBits bits msb lsb

Full Usage: getBIBits bits msb lsb

Parameters:
    bits : BitInt
    msb : int
    lsb : int

Returns: BitInt
bits : BitInt
msb : int
lsb : int
Returns: BitInt

getBIBitsInt bits msb lsb

Full Usage: getBIBitsInt bits msb lsb

Parameters:
    bits : BitInt
    msb : int
    lsb : int

Returns: uint32
bits : BitInt
msb : int
lsb : int
Returns: uint32

getBits msb lsb f

Full Usage: getBits msb lsb f

Parameters:
Returns: FastData

Extract bit field (msb:lsb) from f. Bits are numbered little-endian from 0. Note that for a single bit result the un-normalised version is used, so it will be compatible with fast implementation of boolean logic.

msb : int
lsb : int
f : FastData
Returns: FastData

getBitsFromBigInt msb lsb x

Full Usage: getBitsFromBigInt msb lsb x

Parameters:
    msb : int
    lsb : int
    x : bigint

Returns: bigint
msb : int
lsb : int
x : bigint
Returns: bigint

getBitsFromBigIntToUInt32 msb lsb x

Full Usage: getBitsFromBigIntToUInt32 msb lsb x

Parameters:
    msb : int
    lsb : int
    x : bigint

Returns: uint32
msb : int
lsb : int
x : bigint
Returns: uint32

getBitsFromUInt32 msb lsb x

Full Usage: getBitsFromUInt32 msb lsb x

Parameters:
    msb : int
    lsb : int
    x : uint32

Returns: uint32
msb : int
lsb : int
x : uint32
Returns: uint32

getLowerField x width offset

Full Usage: getLowerField x width offset

Parameters:
    x : uint32
    width : int
    offset : int

Returns: uint32
Modifiers: inline

get the lower 'width' bits, return then offset by 'offset' bits

x : uint32
width : int
offset : int
Returns: uint32

getUpperField x width offset

Full Usage: getUpperField x width offset

Parameters:
    x : uint32
    width : int
    offset : int

Returns: uint32
Modifiers: inline

get a field of bits width 'width' offset by 'offset', return the field with 0 offset

x : uint32
width : int
offset : int
Returns: uint32

graph_

Full Usage: graph_

Returns: Lens<SimulationData, SimulationGraph>
Returns: Lens<SimulationData, SimulationGraph>

invertBIBits bits width

Full Usage: invertBIBits bits width

Parameters:
Returns: uint32[]

invert bits1: assuming that width is the bit width of bits1 MS bits not used by bits1 are not inverted.

bits : BitInt
width : int
Returns: uint32[]

mapItems map

Full Usage: mapItems map

Parameters:
    map : Map<'a, 'b>

Returns: ('a * 'b)[]
map : Map<'a, 'b>
Returns: ('a * 'b)[]

mapKeys map

Full Usage: mapKeys map

Parameters:
    map : Map<'a, 'b>

Returns: 'a[]
map : Map<'a, 'b>
Returns: 'a[]

mapValues map

Full Usage: mapValues map

Parameters:
    map : Map<'a, 'b>

Returns: 'b[]
map : Map<'a, 'b>
Returns: 'b[]

numberBase_

Full Usage: numberBase_

Returns: Lens<SimulationData, NumberBase>
Returns: Lens<SimulationData, NumberBase>

printSimGraph sg

Full Usage: printSimGraph sg

Parameters:
sg : SimulationGraph

reduceArithmetic expression

Full Usage: reduceArithmetic expression

Parameters:
Returns: FastAlgExp
expression : FastAlgExp
Returns: FastAlgExp

shortPSComp comp

Full Usage: shortPSComp comp

Parameters:
Returns: string
comp : SimulationComponent
Returns: string

sprintSimComponent sComp

Full Usage: sprintSimComponent sComp

Parameters:
Returns: string
sComp : SimulationComponent
Returns: string

tryBitwiseOperation expressions

Full Usage: tryBitwiseOperation expressions

Parameters:
Returns: FastAlgExp option
expressions : FastAlgExp list
Returns: FastAlgExp option

tryGetCompLabel compId sg

Full Usage: tryGetCompLabel compId sg

Parameters:
Returns: string
compId : ComponentId
sg : SimulationGraph
Returns: string

tryMergeBitRanges (l1, u1, exp1) (l2, u2, exp2)

Full Usage: tryMergeBitRanges (l1, u1, exp1) (l2, u2, exp2)

Parameters:
Returns: FastAlgExp option

Check the Bit Ranges for two expressions, and check if they can be merged. If they can, return the merged expression, otherwise return None.

l1 : int
u1 : int
exp1 : FastAlgExp
l2 : int
u2 : int
exp2 : FastAlgExp
Returns: FastAlgExp option

wireToFast wd

Full Usage: wireToFast wd

Parameters:
Returns: FastData

convert Wiredata to FastData equivalent

wd : WireData
Returns: FastData

Type something to start searching.