Abacus Module
This module implements functions for simulating Abacus assembler programs. The core is thereby the definition of the computer system's state, and the instruction set semantics in terms of operationally changing the system's state when executing an instruction.
Types
Type | Description |
AbacusState holds the information of the memory contents of an Abacus system after executing an instruction, i.e.,
|
|
a SimulationRun holds the result of a complete simulation of an Abacus program, i.e.,
|
|
|
|
|
|
a cache block consists of the following components:
|
Functions and values
Function or value | Description |
Full Usage:
AbacusConflictAnalysis p
Parameters:
AbacusInstr[]
Returns: AbacusInstr[] * Set<int * int> * Set<int * int * int>
|
compute the control flow graph with RAW conflicts of an Abacus program
|
Full Usage:
AbacusConflicts2Dot ostr (p, nextInstr, rawConfl)
Parameters:
TextWriter
p : AbacusInstr[]
nextInstr : (int * int) seq
rawConfl : (int * int * int) seq
|
write control flow graph with conflicts to a dot file
|
|
ExecuteInstr implements the semantics of the Abacus instruction set in that it updates the given AbacusState with the changes made by executing the Abacus instruction instr. Note that it changes the contents of the given AbacusState directly, and therefore, there is no return value.
|
Full Usage:
ExecuteProgram maxSteps p
Parameters:
int
p : AbacusInstr[]
Returns: SimulationRun
|
ExecuteProgram repeatedly applies function ExecuteInstr to run a Abacus program p. If maxSteps is negative, the program is run until it finally terminates (which is the case when the program counter is outside the the range of the program's indices), and otherwise, the number of execution steps is limited to maxSteps. The result is a SimulationRun. In case of pipeline conflicts, a nop instruction is inserted instead of the next instruction where AbcJ(1) is used as nop instruction.
|
|
PrintAbacusState prints the contents of memory, cache and registers to the output stream ostr in a tabular notation.
|
Full Usage:
PrintSimResult ostr p simResult
Parameters:
TextWriter
p : AbacusInstr[]
simResult : SimulationRun
|
PrintSimResult prints a SimulationRun generated for the Abacus program p to output stream ostr. Additional information like the instruction counts (with taken branches) and data conflicts that need stalling in a pipelined execution are printed first, and then the AbacusStates of the SimulationRun follow.
|
Full Usage:
RandomAbacusProg rand (aluP, memP, brcP, jmpP) pLen
Parameters:
Random
aluP : float
memP : float
brcP : float
jmpP : 'a
pLen : int
Returns: AbacusInstr array
|
generate a random Abacus program with random number generator rand and probabilities aluP,memP,brcP,jmpP for ALU, memory,branch, and jump instructions, respectively with pLen many instructions in total.
|
Full Usage:
SimulFile toLogFile maxSteps progfile saveXmlTrace
Parameters:
bool
maxSteps : int
progfile : string
saveXmlTrace : bool
|
SimulFile first parses an Abacus program from the file progfile, then simulates it using function ExecuteProgram and the parameter maxSteps as explained there. After this, the obtained SimulationRun is either printed to Console.Out or alternatively to a log-file with the same name as progfile (just with suffix log instead). If saveXmlTrace is true, then the SimulationRun is additionally written to an xml file (again with the same name and suffix xml).
|
Full Usage:
getSvgGraph dotExe dotGraphWriter
Parameters:
string
dotGraphWriter : StreamWriter -> unit
Returns: string
|
getSvgGraph converts dot graphs to a svg graphic which is returned as a string. Expected arguments are dotExe which is the path of the executable of dot like "/usr/bin/dot" and dotGraphWriter which is a function that will write a dot graph to a stream.
|
|
The global variable param holds all parameters of the Abacus system, and is initialized with default values by the parser if no parameters were listed in the Abacus file.
|
|
print a simulation run in form of a Latex table where the pipeline stages are shown in each step
|