lib: add test helpers for timeouts and sequential test running
This commit is contained in:
parent
730d11ecea
commit
39e17f8e42
|
@ -0,0 +1,23 @@
|
||||||
|
package Testing;
|
||||||
|
|
||||||
|
import Assert::*;
|
||||||
|
import StmtFSM::*;
|
||||||
|
|
||||||
|
module mkTestCycleLimit#(Integer max_cycles)();
|
||||||
|
Reg#(UInt#(64)) c <- mkReg(fromInteger(max_cycles));
|
||||||
|
|
||||||
|
rule count;
|
||||||
|
dynamicAssert(c > 0, "FAIL: test timed out");
|
||||||
|
c <= c-1;
|
||||||
|
endrule
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module mkTest#(String name, RStmt#(Bit#(0)) test)();
|
||||||
|
mkAutoFSM(seq
|
||||||
|
$display("RUN ", name);
|
||||||
|
test;
|
||||||
|
$display("OK ", name);
|
||||||
|
endseq);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
endpackage
|
Loading…
Reference in New Issue