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