UVM QUEUE CLASS

In reply to Mechanic:

Can somebody guide me how to share the queue between two components using uvm_queue class with example.
Eg :) I have populated the queue at monitor side i need to share it with predictor how can i do that .
Please share the response.
Thanks in advance.

If you want to share uvm_queue between components, you can easily create a global pool wrapper a queue. From a pool, you can get the queue from specific key string.
Here is an example:

  • Create the pool with key is string for uvm_queue, type of queue element is int. The uvm_object_string_pool is supported by UVM.

typedef uvm_object_string_pool #(uvm_queue#(int)) uvm_queue_pool;

  • From a component, you get the uvm_queue from pool from a specific key string, push any value to a queue.

uvm_queue#(int) queue = uvm_queue_pool::get_global("queue_key");
queue.push_back(100);

  • From another component, you can get the same uvm_queue for the same key string, wait and pop the value to use.

int value;
uvm_queue#(int) queue = uvm_queue_pool::get_global("queue_key");
wait(queue.size() > 0);
value = queue.pop_front();