From ffb9f7c062b2827dc218bf9b84c356cbf7bfb695 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 9 Sep 2024 11:15:43 -0700 Subject: [PATCH] lib/Testing: add helper module to access test flags Notably, this lets me plumb +v for verbose test output. --- lib/Testing.bsv | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/Testing.bsv b/lib/Testing.bsv index 4d529f2..16884c7 100644 --- a/lib/Testing.bsv +++ b/lib/Testing.bsv @@ -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);