1. several ways to sample output signal
always @(negedge clk)
begin
$strobe(...)
end
parameter INTERVAL = 10;
always
begin
#(INTERVAL);
$strobe(...);
end
always @(q, qb)
begin
$strobe("...", rst, d0, d1, sel, q, qb);
end
initial
begin
$monitor("...", rst, d0, d1, sel, q, qb);
end
2. Minimizing Sampling
An active $monitor task can be turned on and off by using the $monitoron and $monitoroff tasks, respectively. If you are using an explicit sampling always block, you should include sampling minimization techniques in your model, as illustrated in Sample
5-34. A very efficient way of minimizing sampling is to have the stimulus
turn on the sampling when an interesting section of the testcase is entered, as shown in Sample 5-35.
always
begin
wait (<interesting_condition>);
while (<interesting_condition>) begin
@ (q, qb;)
$strobe(“...”, rst, d0, d1, sel, q, qb);
end
end
initial
begin
$monitor("...", rst, d0, d1, sel, q, qb);
$monitoroff;
sync_reset;
load_d0(1);
sync_reset;
$monitoron;
load_d1(1);
load_d0(0);
load_d1(1);
sync_reset;
$monitoroff;
...
end