I have a scenario where I have created a new UVM event and triggered it and added to the uvm_event_pool. From print statements I can see its triggered. But another component is waiting for the trigger and not receiving it even after its triggered. I did a get from uvm_event_pool too. I have also done get_global_pool().
Another similar event is getting detected but the one I want is not. Please help
In reply to VarshaAnand2402:
Could you please show the relevant code snippet from creating and triggering the event as wellas where you are waiting for this event to be triggered.
Sure, here is the pseudo code
class ex_sb extends uvm_scoreboard;
uvm_event_pool m_event_pool;
uvm_event apb_cd_chks_done_ev;
function build_phase ();
m_event_pool.add ("SB_apb_cd_chks_done ", apb_cd_chks_done_ev );
apb_cd_chks_done_ev = new ("SB_apb_cd_chks_done");
endfunction
task trig_ev ();
// Do some checks and trigger event
// with help of print statements, I checked in my code this event is getting triggered
apb_cd_chks_done_ev.trigger();
endtask
task main_phase();
fork
trig_ev ();
join
endtask
endclass
class ex_seq extends uvm_sequence;
uvm_event_pool m_event_pool;
apb_cd_chks_done_ev = m_event_pool.get ("SB_apb_cd_chks_done");
function new ();
m_event_pool = uvm_event_pool::get_global_pool();
endfunction
task pre_body();
apb_cd_chks_done_ev = m_event_pool.get ("SB_apb_cd_chks_done");
endtask
task body ();
// Here it is just waiting for trigger to come
// I checked with print statements it started waiting before the event was triggered
apb_cd_chks_done_ev.wait_trigger ();
endtask
endclass
In reply to VarshaAnand2402:
I believe you are doing a few things wrong.
(1) You have to declare the uvm_event_pool and perform a get to get an object of this type loke this
uvm_event_pool ev_pool = uvm_event_pool::get_global_pool();
You have to do this in any component you want to use the event_pool.
(2) In the component which generates the trigger you do:
uvm_event ev = ev_pool.get("driver1_ev");
ev.trigger(req);
(3) in the run_phase of the component you are waiting for the trigger you do:
uvm_event ev = ev_pool.get("driver1_ev");
ev.wait_trigger();
That’s it.
I have made a copy paste error in the pseudo code above. I have done a get_global_pool. Updated the above code.
Whereever we are triggering, do need to use (2) from what you wrote above along with adding the event in the event pool?
In reply to VarshaAnand2402:
You do not have to perform an ‘add’ as you are doing. The event_pool works with named events.
In this line of code
uvm_event ev = ev_pool.get("driver1_ev");
the name is “driver_ev”:
If this named event does not exist it will be created. And with the get you are accessing the event. The 2nd line in (2) and (3) is showing if this component creates the event or waits for the event.
ok got it. Thank you! @chr_sue