Next: , Previous: Session management procedures, Up: Procedures and variables


2.4.2 Data procedures

These procedures deal with data, either THUD's internal structures or that data which represents your design.

— Procedure: reset-internals

Reset THUD internal state as if rebooting. Another way to say internal state is "workspace".

— Procedure: add file ...

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

— Procedure: add-only file ...

Reset internal state, load each file and prepare system for simulation. All values (wires and registers) are reset to the "undefined" state.

— Procedure: display-vob [msg]

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 scope variable. See Variables.

— Procedure: display-scheduled-values [msg]

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-reps for a vertical view of the same data.

This procedure obeys the scope variable. See Variables.

— Procedure: display-blks [msg]

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.

— Procedure: display-blks-summary [msg]

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.

— Procedure: display-instances-summary [msg]

Optionally display msg, then display summaries of all the instances in the instance pool. The output is unordered, but grouped by blocks.

— Procedure: display-scopes [msg]

Optionally display msg, then display scopes (instance names), one per line.

— Procedure: eval-print expr

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.

— Procedure: deposit details

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-expression

WARNING: At this time the parsing is rather unintelligent; you must specify full paths for all signals (current scope is ignored). Also, there is no bit-width (or even type) check on the value of scheme-expression. You probably should not use this from a Scheme program.

— Procedure: compile-to file

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 check like so:

          make check THUD_DEBUG_KEEP_018=1

then if all goes well, there should be a file tests/018.out that demonstrates compile-to output you can play with.