Jump to content

uvm_queue : Can we have more than one uvm_queue of same item type in our env.


Recommended Posts

Hi!

Want to know whether we can use more than one uvm_queue of same item type in our env. I am facing some issue while doing so.

Consider following example:

// pass_value.sv

//File where uvm_queue is declared and data is passed on to it

//declare 2 uvm_queue of same item type

uvm_queue#(uvm_object) host_q;

uvm_queue#(uvm_object) device_q;

//create a handle to pass the item type by reference

host_q =uvm_queue#(uvm_object)::get_global_queue() ;

device_q=uvm_queue#(uvm_object)::get_global_queue() ;

uvm_object data_h;

//some logice goes here

...

....

host_q.push_front(data_h);

device_q.push_front(data_h);

....

// get_value.sv

//Another File to extract the data from uvm_queue.

host_q =uvm_queue#(uvm_object)::get_global_queue() ;

device_q=uvm_queue#(uvm_object)::get_global_queue() ;

uvm_object host_rx_pkt;

uvm_object host_rx_pkt;

wait(host_q.size() >= 1);

wait(device_q.size() >= 1);

host_rx_pkt = host_q.pop_back();

// over here host_q.size() become 0 as expected But also device_q.size() becomes 0

device_rx_pkt = device_q.pop_back(); // Since the size of device_q becomes 0 this line gives error msg stating that cannot pop_back() from an empty queue

So i have a doubt whether we can have more than one uvm_queue of same type defined in an env. I feel that they are treated as singleton queue, so it is not correct to do so.

Anyone having experience with this please suggest.

Thanks & Regards

Amrita

Link to comment
Share on other sites

  • 1 month later...

The uvm_queue::get_global_queue() function returns a shared queue of a particular type. You can create separate queues by using the uvm_queue::type_id::create(...) function.

 

If your intention is to communicate data between 2 components, it's probably better to use tlm ports.

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