Jump to content

uvm_objection_cbs_t :: Not working as recommended !!


Recommended Posts

Hi,

I'm trying to use the recommended callback method in the uvm_objection.svh to display a custom message each time when an objection is raised or dropped. Following is my code:

class objection_cb extends uvm_objection_callback;

function new(string name);

super.new( name );

endfunction : new

virtual function void raised (uvm_objection objection, uvm_object obj, uvm_object source_obj, string description, int count);

$display("%0t: Objection %s: Raised for %s", $time, objection.get_name() obj.get_full_name());

endfunction : raised

virtual function void dropped (uvm_objection objection, uvm_object obj, uvm_object source_obj, string description, int count);

$display("%0t: Objection %s: Dropped for %s", $time, objection.get_name(), obj.get_full_name());

endfunction : dropped

endclass : objection_cb

class mytest extends my_base_test;

`uvm_component_utils(mytest)

objection_cb obj_cb;

virtual function void build();

super.build();

obj_cb = new("obj_cb");

my_objection_cbs_t::add(null,obj_cb);

endfunction : build

..........

endclass : mytest

RESULT:

UVM_WARNING @ 0: reporter [CBUNREG] Callback obj_cb cannot be registered with object (*) because callback type objection_cb is not registered with object type uvm_object

I'm doing it exactly the way its recommended in the LRM but still it does not work. Am I missing something here?

Thanks,

-ND

Link to comment
Share on other sites

I would guess my_objection_cbs_t should be uvm_objection_cbs_t.

Erling

Hi Erling,

Sorry for the typo in my code it is uvm_objection_cbs_t::add(null,obj_cb);

But it seems some registration is missing in the base class uvm_objections.svh

Thanks,

-ND

Link to comment
Share on other sites

It seems the uvm_objection does not have callback support. Callbacks works with the uvm_callbacks_objection, which is derived from uvm_objection. Thus it seems hard to have the phase objections behave the way you want, since they are hardcoded as plain objections (for some reason).

Erling

Link to comment
Share on other sites

I think someone should remove that example & recommendation from the uvm_objections.svh. For now I get around that by using the following code to control this procedurally through the test case rather than using the +ARG option [which is needed when I want to compile all the test cases in a single image & have this option for only certain test cases]. But its not a clean way of doing it.

virtual task main_phase( uvm_phase phase );

phase.phase_done.trace_mode(1);

.....

endtask : main_phase

-ND

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...