lib/DelayLine: plumb verbose test flag into tests

This commit is contained in:
David Anderson 2024-09-09 11:20:09 -07:00
parent 1ca4ccff99
commit 80391cefee
1 changed files with 15 additions and 10 deletions

View File

@ -9,6 +9,7 @@ import List::*;
import DelayLine::*; import DelayLine::*;
module mkTB(); module mkTB();
let testflags <- mkTestFlags();
let cycles <- mkCycleCounter(); let cycles <- mkCycleCounter();
function Stmt testDelayLine(DelayLine#(Int#(8)) delay, Bit#(32) wantDelay); function Stmt testDelayLine(DelayLine#(Int#(8)) delay, Bit#(32) wantDelay);
@ -16,6 +17,7 @@ module mkTB();
action action
delay <= 42; delay <= 42;
cycles.reset(); cycles.reset();
if (testflags.verbose)
$display(" write cycle: %0d", cycles.all); $display(" write cycle: %0d", cycles.all);
endaction endaction
@ -39,6 +41,7 @@ module mkTB();
$display("delay line became ready after %0d cycles, want %0d (on cycle %0d)", cycles, wantDelay, cycles.all); $display("delay line became ready after %0d cycles, want %0d (on cycle %0d)", cycles, wantDelay, cycles.all);
$finish; $finish;
end end
if (testflags.verbose)
$display(" read cycle: %0d", cycles.all); $display(" read cycle: %0d", cycles.all);
endaction endaction
endpar endpar
@ -59,10 +62,12 @@ module mkTB();
par par
action action
delay0 <= 42; delay0 <= 42;
if (testflags.verbose)
$display(" write cycle: %0d", cycles.all); $display(" write cycle: %0d", cycles.all);
endaction endaction
action action
dynamicAssert(delay0.ready == True, "delay line not ready on same cycle"); dynamicAssert(delay0.ready == True, "delay line not ready on same cycle");
if (testflags.verbose)
$display(" read cycle: %0d", cycles.all); $display(" read cycle: %0d", cycles.all);
endaction endaction
dynamicAssert(delay0 == 42, "delay line has wrong value"); dynamicAssert(delay0 == 42, "delay line has wrong value");