gary/lib/Testing.bsv

24 lines
482 B
Plaintext
Raw Normal View History

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