lib/Testing: add helper module to access test flags
Notably, this lets me plumb +v for verbose test output.
This commit is contained in:
parent
23a78eee9e
commit
ffb9f7c062
|
@ -36,6 +36,21 @@ module mkCycleCounter(CycleCounter);
|
|||
method all = total._read;
|
||||
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
|
||||
// the run. Tests can be nested.
|
||||
function Stmt mkTest(String name, Stmt test);
|
||||
|
|
Loading…
Reference in New Issue