Header menu logo issie

WaveSimSVGs Module

Functions to make SVGs of waveforms from FastSimulation data

Types and nested modules

Type/Module Description

Constants

BinaryTransition

Determines whether a clock cycle is generated with a vertical bar at the beginning, denoting that a waveform changes value at the start of that clock cycle. NB this does not determine whether a waveform changes value at the end of that clock cycle. TODO: Remove this since it is unnecessary. Can use WaveValues instead.

NonBinaryTransition

Determines whether a non-binary waveform changes value at the beginning of that clock cycle.

Transition

Waveforms can be either binary or non-binary; these have different properties.

Functions and values

Function or value Description

binaryWavePoints clkCycleWidth startCycle index transition

Full Usage: binaryWavePoints clkCycleWidth startCycle index transition

Parameters:
    clkCycleWidth : float
    startCycle : int
    index : int
    transition : BinaryTransition

Returns: XYPos array

Generate points for a binary waveform

clkCycleWidth : float
startCycle : int
index : int
transition : BinaryTransition
Returns: XYPos array

calculateBinaryTransitionsUInt32 waveValues startCycle shownCycles multiplier

Full Usage: calculateBinaryTransitionsUInt32 waveValues startCycle shownCycles multiplier

Parameters:
    waveValues : uint32 array
    startCycle : int
    shownCycles : int
    multiplier : int

Returns: BinaryTransition array

Find transitions for each clock cycle of a binary waveform.

waveValues : uint32 array
startCycle : int
shownCycles : int
multiplier : int
Returns: BinaryTransition array

calculateNonBinaryTransitions waveValues startCycle shownCycles multiplier

Full Usage: calculateNonBinaryTransitions waveValues startCycle shownCycles multiplier

Parameters:
    waveValues : 'a array
    startCycle : int
    shownCycles : int
    multiplier : int

Returns: NonBinaryTransition array * 'a array

Find transitions for each clock cycle of a non-binary waveform.

waveValues : 'a array
startCycle : int
shownCycles : int
multiplier : int
Returns: NonBinaryTransition array * 'a array

displayBigIntOnWave wsModel width waveValues transitions gapCache

Full Usage: displayBigIntOnWave wsModel width waveValues transitions gapCache

Parameters:
Returns: ReactElement list

Generates SVG to display bigint values on waveforms.

Should be refactored together with displayUInt32OnWave.

wsModel : WaveSimModel
width : int
waveValues : bigint array
transitions : NonBinaryTransition array
gapCache : GapStore
Returns: ReactElement list

displayUInt32OnWave wsModel width waveValues transitions gapCache

Full Usage: displayUInt32OnWave wsModel width waveValues transitions gapCache

Parameters:
Returns: ReactElement list

Generates SVG to display non-binary values on waveforms.

Should be refactored together with displayBigIntOnWave.

wsModel : WaveSimModel
width : int
waveValues : uint32 array
transitions : NonBinaryTransition array
gapCache : GapStore
Returns: ReactElement list

generateWaveform ws index wave

Full Usage: generateWaveform ws index wave

Parameters:
Returns: Wave

Called when InitiateWaveSimulation message is dispatched and when wave simulator is refreshed. Generates or updates the SVG for a specific waveform whether needed or not. The SVG depends on cycle width as well as start/stop clocks and design. Assumes that the fast simulation data has not changed and has enough cycles.

ws : WaveSimModel
index : WaveIndexT
wave : Wave
Returns: Wave

getWaveValue clkCycleDetail wave width

Full Usage: getWaveValue clkCycleDetail wave width

Parameters:
    clkCycleDetail : int
    wave : Wave
    width : int

Returns: FastData

Retrieve value of wave at given clock cycle as an int. At extra (sampling) zoom this allows detail clock cycles within one sample therefore clkCycleDetail IS NOT scaled the same as the sample numbers used everywhere else.

clkCycleDetail : int
wave : Wave
width : int
Returns: FastData

getWaves ws fs

Full Usage: getWaves ws fs

Parameters:
Returns: Map<WaveIndexT, Wave>

Get all simulatable waves from CanvasState. Includes top-level Input and Output ports. Waves contain info which will be used later to create the SVGs for those waves actually selected. Init value of these from this function is None.

ws : WaveSimModel
fs : FastSimulation
Returns: Map<WaveIndexT, Wave>

highZoom clkCycleWidth

Full Usage: highZoom clkCycleWidth

Parameters:
    clkCycleWidth : float

Returns: bool

If true, then show cross-hatch only for non-binary waves when wave is changing value very fast.

clkCycleWidth : float
Returns: bool

makeCoords clkCycleWidth clkCycle transition

Full Usage: makeCoords clkCycleWidth clkCycle transition

Parameters:
    clkCycleWidth : float
    clkCycle : int
    transition : Transition

Returns: XYPos * XYPos * XYPos * XYPos

Make top-left, top-right, bottom-left, bottom-right coordinates for a clock cycle.

clkCycleWidth : float
clkCycle : int
transition : Transition
Returns: XYPos * XYPos * XYPos * XYPos

makeWaveformsWithTimeOut timeOut ws wavesToBeMade

Full Usage: makeWaveformsWithTimeOut timeOut ws wavesToBeMade

Parameters:
Returns: (type) An anonymous record with the following information:
a) WSM (WaveSimModel with updated waveforms),
b) NumberDone (no of waveforms made), and
c) TimeTaken (Some timeTaken when greater than timeOut or None if completed with no time out).

This function regenerates all the waveforms listed on wavesToBeMade. Generation is subject to timeout, so may not complete.

This function has been augmented with performance monitoring function, turn Constants.showPerfLogs to print performance information to console.

timeOut : float option
ws : WaveSimModel
wavesToBeMade : WaveIndexT list
Returns: (type)

An anonymous record with the following information:
a) WSM (WaveSimModel with updated waveforms),
b) NumberDone (no of waveforms made), and
c) TimeTaken (Some timeTaken when greater than timeOut or None if completed with no time out).

makeXCoords clkCycleWidth clkCycle transition

Full Usage: makeXCoords clkCycleWidth clkCycle transition

Parameters:
    clkCycleWidth : float
    clkCycle : int
    transition : Transition

Returns: float * float

Make left and right x-coordinates for a clock cycle.

clkCycleWidth : float
clkCycle : int
transition : Transition
Returns: float * float

nonBinaryFillPoints startCycle clkCycleWidth gap

Full Usage: nonBinaryFillPoints startCycle clkCycleWidth gap

Parameters:
    startCycle : int
    clkCycleWidth : float
    gap : Gap

Returns: XYPos array

Generate polyfill points for a non-binary gap via gap info.

startCycle : int
clkCycleWidth : float
gap : Gap
Returns: XYPos array

nonBinaryWavePoints clkCycleWidth startCycle index transition

Full Usage: nonBinaryWavePoints clkCycleWidth startCycle index transition

Parameters:
Returns: XYPos array * XYPos array

Generate polyline points for a non-binary waveform via transition info.

clkCycleWidth : float
startCycle : int
index : int
transition : NonBinaryTransition
Returns: XYPos array * XYPos array

subSamp arr start count mult

Full Usage: subSamp arr start count mult

Parameters:
    arr : 'T array
    start : int
    count : int
    mult : int

Returns: 'T[]

create a new array which samples the old one every mult cycles. start: index of first cycle. count: number of samples.

arr : 'T array
start : int
count : int
mult : int
Returns: 'T[]

waveformIsUptodate ws wave

Full Usage: waveformIsUptodate ws wave

Parameters:
Returns: bool

Check if generated SVG is correct, based on existence, position, and zoom. Fast simulation data is assumed unchanged. Used to determine if generateWaveform is run.

ws : WaveSimModel
wave : Wave
Returns: bool

xShift clkCycleWidth

Full Usage: xShift clkCycleWidth

Parameters:
    clkCycleWidth : float

Returns: float

Left-shift non-binary waveforms by this much.

clkCycleWidth : float
Returns: float

Type something to start searching.