Header menu logo issie

SimGraphTypes 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.

BinaryOp

Bit

Binary data used in simulation

ComparisonOp

FSInterface

FastAlgExp

FastBits

FastData

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?

PortRmInfo

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.

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.

UnaryOp

WireData

Fixed width bus data used in simulation TODO: refactor as 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

``doval@12``

Full Usage: ``doval@12``

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: BigInteger

single bit 1 (2 ** pos)

pos : int
Returns: BigInteger

bigIntBitMaskA

Full Usage: bigIntBitMaskA

Returns: BigInteger[]
Returns: BigInteger[]

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[]

bitsToBig lst

Full Usage: bitsToBig lst

Parameters:
    lst : Bit list

Returns: BigInteger
lst : Bit list
Returns: BigInteger

bitsToInt lst

Full Usage: bitsToInt lst

Parameters:
    lst : Bit list

Returns: uint32
lst : Bit list
Returns: uint32

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

expToKatex exp

Full Usage: expToKatex exp

Parameters:
Returns: string

Converts an Algebraic Expression to a string for pretty printing This function is now used for debugging purposes, if Katex doesn't work as expected, we can use this function again by changing the name to expToKatex. -- 13/1/2025

exp : FastAlgExp
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

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

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

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

katex

Full Usage: katex

Returns: obj
Returns: obj

reduceArithmetic expression

Full Usage: reduceArithmetic expression

Parameters:
Returns: FastAlgExp
expression : FastAlgExp
Returns: FastAlgExp

tryBitwiseOperation expressions

Full Usage: tryBitwiseOperation expressions

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

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.