Jump to content

How to execute code in a component after a UVM_FATAL?


Recommended Posts

Hi,

I have a scoreboard which raises an objection against the run phase ending while there are pending items to be checked.

In the case where a DUT bug causes the expected item to never get generated, the scoreboard will keep the objection raised forever. I want my test to end due to the phase timeout, so I set the global phase timeout using uvm_top.set_timeout(t).

This all works fine, but when the test ends with a UVM_FATAL due to the timeout, the extract_phase function in my scoreboard is not being called.

I want my scoreboard to print out the pending items after the UVM_FATAL, to signal the user what the problem was that caused the timeout.

How can I accomplish this?

Thanks,

Doug

Link to comment
Share on other sites

Guess I should have checked the docs first. ;)

This can be accomplished by implementing uvm_component's pre_abort().

   //
   // UVM pre_abort() : Called prior to UVM_EXIT, e.g. when a fatal occurs
   //
   virtual function void pre_abort();
      // Call extract and report so that the state of the scoreboard is printed
      // if the test ends with a UVM_FATAL
      extract_phase(null);
      report_phase(null);
   endfunction
Link to comment
Share on other sites

//------------------------------------------------------------------------------

// Copyright 2007-2011 Cadence Design Systems, Inc.

// All Rights Reserved Worldwide

//

// Licensed under the Apache License, Version 2.0 (the

// "License"); you may not use this file except in

// compliance with the License. You may obtain a copy of

// the License at

//

// http://www.apache.org/licenses/LICENSE-2.0

//

// Unless required by applicable law or agreed to in

// writing, software distributed under the License is

// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR

// CONDITIONS OF ANY KIND, either express or implied. See

// the License for the specific language governing

// permissions and limitations under the License.

//------------------------------------------------------------------------------

// author: uwes@cadence.com

// run using: irun -uvm test252.sv

module test252;

import uvm_pkg::*;

`include "uvm_macros.svh"

class demote extends uvm_report_catcher;

function void cdns_tcl_global_stop_request ();

uvm_domain common;

uvm_phase e;

common = uvm_domain::get_common_domain();

e = common.find_by_name("extract");

uvm_domain::jump_all(e);

endfunction

function new();

super.new("demote");

endfunction

virtual function action_e catch();

if (get_severity() == UVM_FATAL)

cdns_tcl_global_stop_request();

return THROW;

endfunction

endclass

class test extends uvm_test;

`uvm_component_utils(test)

function new(input string name, input uvm_component parent=null);

super.new(name,parent);

endfunction // new

virtual function void report();

$display("still alive");

endfunction // report

virtual task run_phase(uvm_phase phase);

super.run_phase(phase);

uvm_top.set_report_severity_action_hier(UVM_FATAL,UVM_DISPLAY|UVM_COUNT);

`uvm_info("FOO","BLA",UVM_NONE)

`uvm_warning("aWARNING","SUCH")

`uvm_error("anERROR","ERROR")

`uvm_fatal("aFATAL","a fatal")

#20;

endtask

endclass

initial begin

demote d;

d = new();

uvm_report_cb::add(null, d);

run_test("test");

end

endmodule

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.

×
×
  • Create New...