Next: Simulation procedures, Previous: Session management procedures, Up: Procedures and variables
These procedures deal with data, either THUD's internal structures or that data which represents your design.
Reset THUD internal state as if rebooting. Another way to say internal state is "workspace".
Read each TH file into the workspace. Each file can be a symbol or a string (whatever guile recognizes as a filename). [TODO: Systematize file-reading errors.]
Reset internal state, load each file and prepare system for simulation. All values (wires and registers) are reset to the "undefined" state.
Optionally display msg, then display the values obarray. In the output, the first column is the bit width; the second the value and the last the name.
This procedure obeys the
scopevariable. See Variables.
Optionally display msg, then display signal values in order. Each column shows the bit values of a signal, either 0, 1 or x.
The left-to-right order of the display reflects exactly the order of evaluation during simulation. See also
display-todo-list-repsfor a vertical view of the same data.This procedure obeys the
scopevariable. See Variables.
Optionally display msg, then display all the blocks in the block pool. In the output, the first line says
block: NAME, while the rest of the lines show the ports, nets, flops and irefs.For each of the ports, nets and flops, the name, bit-width, direction (for ports), and dependencies are shown. If the bit-width is 1, it is omitted from the output.
Lastly, if the block is a referenced (by another block's iref), you will see
iref?: #t. "Top-level blocks" are those where this field is#f.
Optionally display msg, then display summaries of all the blocks in the block pool. Each line of the output has the form num-ports, num-nets, num-flops, num-irefs blk-name.
Optionally display msg, then display summaries of all the instances in the instance pool. The output is unordered, but grouped by blocks.
Optionally display msg, then display scopes (instance names), one per line.
Evaluate expr, a string, and display its value. expr can be the full-path name of a signal or flop, a partial-path name that is resolved using the current scope, or a Scheme expression that is passed to Guile using
eval. All exceptions are caught in the last case. If the value of expr is unspecified, nothing is written.
Parse details, a string, and deposit value accordingly. details should be something like "/path/to/sig scheme-expression". Interactively, you do not need to use quotes:
deposit /path/to/sig scheme-expressionWARNING: At this time the parsing is rather unintelligent; you must specify full paths for all signals (current
scopeis ignored). Also, there is no bit-width (or even type) check on the value ofscheme-expression. You probably should not use this from a Scheme program.
Compile the current design, writing output to file. The output file can be executed like so:
./FILE [OPTIONS...]. The filename extension is conventionally ".thc", but that is not required. These options control various aspects of the simulation:
-M cycle- Stop simulation after cycle (an integer). This option may be required if the design does not specify any mechanism for stopping.
--peek [signals]- Display values of signals (comma-separated list of signal names) after each cycle. If signals is unspecified, display values for all signals. (Note: This can result in a lot of output!)
--peekfile filename- Similar to
--peek, except that filename contains a list of the signals to display, one per line. Blank lines, or lines beginning with a semicolon, are ignored.In the distribution, if you invoke
make checklike so:make check THUD_DEBUG_KEEP_018=1then if all goes well, there should be a file tests/018.out that demonstrates
compile-tooutput you can play with.