SynaptiCAD Tutorials

(TBench) 4.8 Set the Random Seed 

(TBench) 4.8 Set the Random Seed 

Previous topic Next topic  

(TBench) 4.8 Set the Random Seed 

Previous topic Next topic  

Although the transaction types and transaction input values are randomly generated, you will see the same results each time you simulate, because the seeds for the random number generator are not changed between simulation runs. This is normally desirable, since you want your test bench to generate the same results each time you run it. If you want to change the sequence of randomly generated values, you must change the seed values in the test bench.

Just below the begin statement in the sequencer process is an automatic macro, $InitializeDiagramTaskCall, which initializes the transactors of this BFM and also sets the random seed for the BFM's random number generator (this generator is used to randomize the posted transactions and the input data for these randomized transactions). Since this code is automatically generated, you cannot directly edit the seed statement in the macro. However, if you make another call to the InitializeUniform function below the macro, your new seed values will overwrite the auto-generated seed values.

set_seed

To set a different seed, copy the line of code from the macro that calls the InitializeUniform function and paste it below the macro end statement. Then edit the seed values passed to this new function call.

The InitializeUniform function is defined in a package file called tbrandom.vhd in the syncad_vhdl_library.