It is not recommended to insert hard coded delays in your TB. If TB is a part of SOC, there always exists an ambiguity on which delay simulator takes, since there are many blocks which uses different timescales.
As mentioned below, a global task can be created and used it all through the TB to insert delays. Problem of having different timescale units in different files can be solved by normalizing the amount of delay you want before applying it.
can go through below example, to understand it.
Go through below link for complete information.
http://tenthousandfailures.com/blog/2014/4/6/the-delayps-task
As mentioned below, a global task can be created and used it all through the TB to insert delays. Problem of having different timescale units in different files can be solved by normalizing the amount of delay you want before applying it.
can go through below example, to understand it.
Go through below link for complete information.
http://tenthousandfailures.com/blog/2014/4/6/the-delayps-task
// `timescale 1ps/1ps `timescale 1fs/1fs package shared; class helper; static task delay_ps(real delay); real t0, t1; t0 = $realtime; $printtimescale; $display("delay_ps(%g)", delay); #(delay*1ps); t1 = $realtime; if (t0 == t1) $error("%m timescale not precise enough");
endtask // delay_ps endclass // helper endpackage // shared `timescale 1ps/1ps // `timescale 1fs/1fs module tb (); task print_time(); $display("\n%f is tb time\n", $realtime); endtask initial begin $display("\n"); $printtimescale; $display("\n"); print_time(); #2ps; $display("delay 2ps"); print_time(); shared::helper::delay_ps(2); print_time();
shared::helper::delay_ps(2ps/1ps); print_time(); shared::helper::delay_ps(0.002ns/1ps); print_time(); shared::helper::delay_ps(0.000002us/1ps); print_time(); #2fs; $display("delay 2fs"); print_time(); $finish(); end endmodule
No comments:
Post a Comment