Jump to content
Sign in to follow this  
amritaas_20

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×