Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
intro_example:standard_sim [2025/05/14 18:31] rajitintro_example:standard_sim [2025/05/14 18:40] (current) rajit
Line 47: Line 47:
 [                 140] <t1>  Source 0: Sequence ended. [                 140] <t1>  Source 0: Sequence ended.
 [                 140] <t2>  Sink 0: Received value 55 (0x37) [                 140] <t2>  Sink 0: Received value 55 (0x37)
 +</code>
 +
 +Instead of using a hard-coded set of values in the the test environment, the standard simulation library also provides a mechanism to read values from a file.  Using:
 +<code act>
 +sim::source_file<32 /* bit-width */, 
 +                    0 /* file ID */,
 +                    false /* don't loop file contents */,
 +                    0 /* source ID */,
 +                    false /* turn off verbose logs */>
 +            t1(b.I);
 +</code>
 +instead of a ''source_sequence'', gets the data values from a file ''_infile_.0'' (0 is the file ID).
 +
 +<file txt _infile_.0>
 +0x493
 +0x29
 +0x3
 +4
 +</file>
 +
 +The result is:
 +<code>
 +$ actsim -p test etest.act
 +WARNING: source_file<32,0,f,0,f>: substituting chp model (requested prs, not found)
 +WARNING: buffer<>: substituting chp model (requested prs, not found)
 +WARNING: sink<32,0,t>: substituting chp model (requested prs, not found)
 +actsim> cycle
 +[                  50] <t2>  Sink 0: Received value 1173 (0x495)
 +[                  70] <t2>  Sink 0: Received value 43 (0x2b)
 +[                  90] <t2>  Sink 0: Received value 5 (0x5)
 +[                 110] <t1>  Source 0: Input file #0 ended.
 +[                 110] <t2>  Sink 0: Received value 6 (0x6)
 </code> </code>