1
0

enable the TestDriver to be used in a SystemVerilog UVM-based testbench, which has its own way to manage end-of-simulation and does not like anyone else to call $finish

This commit is contained in:
Scott Johnson 2016-08-19 17:14:54 -07:00
parent 2d12f6689c
commit 96a868d388

View File

@ -39,6 +39,11 @@ module TestDriver;
`endif `endif
end end
`ifdef TESTBENCH_IN_UVM
// UVM library has its own way to manage end-of-simulation.
// A UVM-based testbench will raise an objection, watch this signal until this goes 1, then drop the objection.
reg finish_request = 1'b0;
`endif
reg [255:0] reason = ""; reg [255:0] reason = "";
reg failure = 1'b0; reg failure = 1'b0;
wire success; wire success;
@ -73,7 +78,11 @@ module TestDriver;
if (verbose) if (verbose)
$fdisplay(stderr, "Completed after %d simulation cycles", trace_count); $fdisplay(stderr, "Completed after %d simulation cycles", trace_count);
`VCDPLUSCLOSE `VCDPLUSCLOSE
`ifdef TESTBENCH_IN_UVM
finish_request = 1;
`else
$finish; $finish;
`endif
end end
end end
end end