Both sides previous revision
Previous revision
Next revision
|
Previous revision
Next revision
Both sides next revision
|
sim:start [2022/07/17 06:02] rajit |
sim:start [2022/07/17 06:10] rajit [Exported processes] |
====== Namespace sim ====== | ====== Namespace sim ====== |
| |
The ''sim'' namespace contains a collection of process definitions that can be used to create simple test environments for simulation purposes. | The ''sim'' namespace contains a collection of process definitions that can be used to create simple test environments for simulation purposes. Import this namespace using |
| |
| <code act> |
| import sim; |
| </code> |
| |
| ===== Exported processes ===== |
| |
<code act> | <code act> |
This process also provides a ''W''-bit source. Values generated by this source are specified in the ''N''-entry ''data[]'' array. The outputs produced are ''data[0]'', ''data[1]'', ..., ''data[N-1]''. If ''REP'' is set to true, then this sequence is repeated forever. | This process also provides a ''W''-bit source. Values generated by this source are specified in the ''N''-entry ''data[]'' array. The outputs produced are ''data[0]'', ''data[1]'', ..., ''data[N-1]''. If ''REP'' is set to true, then this sequence is repeated forever. |
| |
| <code act> |
| export template<pint ID; pbool LOOP; pint W> |
| defproc file_source(chan!(int<W>) O); |
| </code> |
| This process is also a ''W''-bit source, except the values produced are taken from a file. The identified ''ID'' is used to determine the file name, and the file is assumed to have at least one data value. By default, the file name is ''_infile_.{ID}''. The file format is a sequence of hexadecimal values, one per line. If ''LOOP'' is set to true, then the sequence of values specified in the file is repeated forever. |
| |
| <code act> |
| export template<pint ID; pbool LOOP; pint W> |
| defproc check_sink(chan?(int<W>) I); |
| </code> |
| This process is a ''W''-bit sink, except the values produced are compared to those specified in a file. The identified ''ID'' is used to determine the file name, and the file is assumed to have at least one data value. The file specified and the ''LOOP'' parameter is the same as in ''file_source''. |
| |
| ===== Namespace sim::rand ===== |
| |