Is there a specific way to stop the test/simulation in case condition failure?

I want that the test will stop in case condition failure.
I used UVM_ERROR, but this only produce text message.
Is there a specific way to stop the test/simulation in case condition failure in addition to the text message (something like assert in systemVerilog)?

In reply to saritr:

If you are not okay with error message in test, code in test:


virtual task main_phase(uvm_phase phase);
  super.main_phase(phase);
  wait(my_condition_is_true) begin
    foreach(env.my_agent[i])
       env.my_agent[i].sequencer.stop_sequences();
  end
  `uvm_info(get_full_name(), "I kill my test, because ...", UVM_NONE)
endtask

Or if you are okay with error message in test, add +UVM_MAX_QUIT_COUNT=1 in SIM_OPTS.

In reply to trymybest:

what do you mean by error message in test?

In reply to saritr:

In my opinion, if there is at least one error message in the test, then it is FAILED test.
If you want kill your test which should end like PASSED test, you can choose the first way.
If you dont care about it, you can choose any way.

In reply to trymybest:

Is there option for only uvm_fatal?

In reply to saritr:

I came from a more flexible solutions. Assume we choose uvm_error, if you dont want to stop the simulation each time. It is enough to remove the key word from SIM_OPTS. You dont need to change your uvm code.

The best way ist to use
set_report_severity_action.
There you can specify what you want.
In most cases you don’t want stop immediately if you found the first error. You can define after how many errors the simulation should stop.
In case of an fatal you should stop immediately.

In reply to trymybest:

I I use +UVM_MAX_QUIT_COUNT=1 it ends the simulation in case of uvm_error (even if I don’t have uvm_fatal)

In reply to saritr:

In elaboration phase of the test , put the below line, it will stop the test after the first error .
set_report_max_quit_count(1);

what you used above its also correct but its command line.

Of course you have a lot of choices for that:

  1. +UVM_MAX_QUIT_COUNT=1 as said before,
  2. Use UVM_FATAL() instead of UVM_ERROR();
  3. Use function $fatal following your UVM_ERROR().

Hope it can fix your issue.