Jump to content

Exiting simulation after some delay when errors exceed max_quit_count


ujjalbose
 Share

Recommended Posts

Hi,

 

just wondering if there is a way to delay the quitting of simulation when max_quit_count number of errors occur. For e.g. :

 

   >uvm_report_server svr;

 

   >virtual function void build_phase(uvm_phase phase);
   >  super.build_phase(phase);
   >  svr = _global_reporter.get_report_server();
   >  svr.set_max_quit_count(1);
   >endfunction:build_phase

 

In this example I want to exit after first error occurs, but want to insert some additional delay before actual $finish is called. This helps in debug. But I see that die() inside uvm_report_object.svh (which gets called when max_quit_count errors occur) is a function which calls $finish immediately :

 

  >virtual function void die();
  >  // make the pre_abort callbacks
  >  uvm_root top = uvm_root::get();
  >  top.m_do_pre_abort();

  > report_summarize();
  >  $finish;
  >endfunction

So I am wondering if it is possible to insert some hash delay before quitting in any other way but still using the max_quit_count feature ?

 

-Ujjal

 

Link to comment
Share on other sites

I think you might do better to use a report catcher for this situation. In the report catcher you can simply fork a delayed fatal:

class my_report_catcher extends uvm_report_catcher;
  int unsigned count = 1; // limit
  time fatal_timeout = 20ns; // amount to delay before exiting
  function new (string name = ""); super.new(name); endfunction
  function action_e catch; 
    uvm_severity severity  = get_severity();
    string       id        = get_id();
    uvm_action   action    = get_action();
    string       message   = get_message();
    int          verbosity = get_verbosity();
    if (count) --count;
    if (count == 0 && severity == UVM_ERROR) //< conditions to set fatal timeout
    begin
     fork begin // allow extra time
       #fatal_timeout;
       `uvm_report_fatal("","Exiting due to count")
     end join_none
     throw;
    end
  endfunction
endclass

Caveat emptor: untested. Also need to create/add the catcher at the appropriate location.

Link to comment
Share on other sites

Thanks David for the suggestion, this worked with some minor modifications ! The modified code along with some small enhancements is as :

class my_report_catcher extends uvm_report_catcher;
  int unsigned count = 1; // limit
  time fatal_timeout = 200; // amount to delay before exiting
  function new (string name = ""); super.new(name); endfunction
  function action_e catch; 
    uvm_severity severity  = get_severity();
    string       id        = get_id();
    uvm_action   action    = get_action();
    string       message   = get_message();
    int          verbosity = get_verbosity();
    if (count && severity == UVM_ERROR) begin
      --count;
    end
    if (count == 0 && severity == UVM_ERROR) //< conditions to set fatal timeout
    begin
      fork begin // allow extra time
        #fatal_timeout;
        //`uvm_report_fatal("","Exiting due to count")
	uvm_top.report_summarize(); //call end of test report_summarize()
	$finish;
      end join_none
    end
    return THROW;
  endfunction
endclass

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...