ScadSim Module
This module implements functions for simulating a universal SCAD machine.
Types
Type | Description |
Type of the control unit of a SCAD machine. |
|
this execption is thrown when enqueuing an entry to a full buffer |
|
MoveUniInstr defines the type for move instructions. There are four types of move instructions:
|
|
|
|
Processing units generally consist of an input and an output buffer having possibly different numbers of lanes. In contrast to the output buffer, the input buffer may have an optional lane. |
|
A SCAD machine consists of the following components:
|
|
address denotes addresses of buffers (processing unit + buffer) |
|
addressBuf denotes addresses of buffers within a processing unit |
|
addressPU denotes addresses of processing units |
|
This buffer class implements the buffers of the processing units inside a SCAD machine where each processing unit has at most one input and at most one output buffer, since each buffer itself can have several lanes for input/output values and even an optional lane having another type of values. Each entry i in an input/output lane bf is a pair valEntry[i][bf]=(adr,v) consisting of an optional address adr and an optional value v, while the optional lanes entries optEntry[i] can store any optional values. The overall buffer works as a FIFO queue and each lanes behave as such in a special was as well: At any time, the entries from head to tail are in use where head and tail are the indices of the first and last entry in use. Since both the empty and the full buffer satisfy tail+1=head, additional flags isEmpty and isFull are used to check whether the buffer is empty or full (it can have at most numRows entries). Enqueue operations work as follows:
|
|
type value abbreviates values of operands and results |
Functions and values
Function or value | Description |
|
check whether a move instruction has reasonable arguments; if the move instruction is okay, it returns None, and otherwise Some(failure) with an error message failure.
|
|
|
|
|
Full Usage:
CreateNewBuffer numRows numLanes
Parameters:
int
numLanes : int
Returns: 'a buffer
|
CreateNewBuffer constructs a new empty buffer with numLanes lanes (i.e., input/output lanes) and numRows entries
|
Full Usage:
CreateNewScadMachine numPU bfSize memSize prog
Parameters:
int
bfSize : int
memSize : int
prog : MoveInstr[]
Returns: ScadMachine
|
create a new SCAD machine with numPU universal processing units, buffer sizes bfSize, data memory size memSize for running the SCAD program prog
|
|
This function writes a data dependency graph for a move program as a graph in graphviz (dot) format.
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
ScadExec fastCU bfSize memSize maxSteps prog
Parameters:
bool
bfSize : int
memSize : int
maxSteps : int option
prog : MoveInstr array
Returns: int array * int array * int * (int * int * int[] * int[] * ScadMachine) array
|
This function is used to generate a simulation trace for a given SCAD program. The inputs have the following meaning: fastCU holds if the CU should fire as often as possible in one step before the other FUs are checked for firing (otherwise the CU fires at most once in a step), bfSize is the size of buffers in the SCAD machine's FUs, memSize is the size of the data memory, and maxSteps may denote an upper bound of simulation steps to avoid nontermination. The function returns then a tuple (numFirings,numSenders,steps,statesL) where numFirings and numSenders are array that store for each FU the number of its firings and data transmissions, steps is the number of simulation steps, and stateL is an array of tuples (step,stepsCU,firedUnits,sendUnits,sc) that provides for each step the following information: step is the number of the step, stepsCU is the number of steps the CU has fired in fast mode to reach this step, firedUnits and sendUnits are the addresses of FUs that have fired or sent values to reach this step, and sc is the SCAD machine state finally reached.
|
Full Usage:
ScadExecSymbolic prog
Parameters:
MoveInstr array
Returns: int list[] array * int list array
|
This function performs a symbolic execution of a given SCAD program to generate a dataflow graph from it for scheduling the instructions. It can moreover determine whether some FU will be blocked because it will not receive sufficiently many operands. The symbolic execution ignores limitations due to buffer sizes, and assumes an immediate firing of FUs.
|
Full Usage:
printScadSimTraceToHtml fastCU (numFires, numSends, steps, statesL)
Parameters:
bool
numFires : int[]
numSends : int[]
steps : 'a
statesL : (int * int * int[] * int[] * ScadMachine)[]
|
This function prints a SCAD machine simulation trace as generated by ScadExec in html output format.
|