lib/Testing: add helper module to access test flags

Notably, this lets me plumb +v for verbose test output.
This commit is contained in:
David Anderson 2024-09-09 11:15:43 -07:00
parent 23a78eee9e
commit ffb9f7c062
1 changed files with 15 additions and 0 deletions

View File

@ -36,6 +36,21 @@ module mkCycleCounter(CycleCounter);
method all = total._read; method all = total._read;
endmodule endmodule
interface TestFlags;
method Bool verbose();
endinterface
module mkTestFlags(TestFlags);
Wire#(Bool) verbose_val <- mkBypassWire();
rule every;
let v <- $test$plusargs("v");
verbose_val <= v;
endrule
method verbose = verbose_val;
endmodule
// mkTest runs the given test, printing status text before and after // mkTest runs the given test, printing status text before and after
// the run. Tests can be nested. // the run. Tests can be nested.
function Stmt mkTest(String name, Stmt test); function Stmt mkTest(String name, Stmt test);