0
votes

In case I want to end the simulation from my monitor (I know that it is not the recommended way) how can I do this? lets say I got this code inside my monitor:

Virtual task monitor_run();

fork

forever begin
.....
end

forever begin
.....
end

forever begin
.....
end

join

endtask : monitor_run

Every forever loop check that outputs of the DUT came on time, in case they doesnt it should stop simulation. This special monitor should break the simulation in case of mismatch(error) and there is no Scoreboard. I still want to manage nice end of simulation behaviour. I tried use raise and drop objection but I get an error of OBJT_ZERO sometimes. Does anyone knows a good way to end the simulation in that case? thanks!

1
Yes,but i want to finish the test through my base test component in order to print "Test Failed" in an organized way. I got few situations in this monitor in which I need to end the test so I do not want to use uvm_fatal so many times - UVMag

1 Answers

2
votes

The UVM is set up by default so that uvm_report_fatal ends the test immediately, and uvm_report_error lets the simulation continue until hitting an error limit that you can set. And you can control the actions of each severity for an individual component. See uvm_report_object which is the base class of uvm_component.

Upon ending the test, the UVM calls uvm_report_server::report_summarize() that dumps out all the severity counts. If you insist, you can create a final block in your testbench module that gathers the severity counts from the report server and print the last message. For example:

module top;
  initial run_test();


  uvm_report_server rs = uvm_report_server::get_server();

  final if (rs.get_severity_count(UVM_FATAL) != 0 ||
            rs.get_severity_count(UVM_ERROR) !=0 )
            $display("Test Failed");

endmodule

But this is really unnecessary and may not catch other non-UVM errors like assertion failures or timing checks. Many tools have a TESTSTATUS exit code that reports the most severe message encounte, UVM or tool.