I have a sequence sending in commands to my DUT. Following each command, I would like to wait for a random delay.
Two possible techniques:
1) Use a virtual interface to my system interface; pass a random number to a wait_clk method, which in turn uses a clocking-block.
uint32_t delay; delay=$urandom_range(0,1000); vif.wait_clk(delay);
2) Perhaps 1 is overkill ( requires a virtual IF, which adds a dependency, perhaps less re-usable). Perhaps something more like...
uint32_t delay; delay=$urandom_range(0,1000); //#delay ns; // not correct syntax!
3) pull in the configuration of the agent, using m_sequencer, and use it's methods... maybe this is the most appropriate.
virtual task body();
if( !uvm_config_db #( plb_agent_configuration )::get( m_sequencer, "", "AGENT_CONFIG", cfg ))
`uvm_fatal(report_id, "cannot find resource plb config" )
// issue command left out
begin
uint32_t num;
num=$urandom_range(1000,0);
cfg.wait_clk(num);
end
end
endtask
Share with me your favorite technique