hi
how can i share a queue ,that is in master driver, with slave driver when master and slave can’t see each other’s variable as set in config_db?
is there anyother alternate method as i wanted to read the queue (data stored in it is from master) in slave?
thank you
In reply to Er. Shipra:
Showing some code might be helpful. Can you use mailbox communication between the two? Or any port connection for OVM/UVM based TB.
Declare your mailbox of appropriate type in environment and pass its handle in both master and slave agents. Master may use blocking put or non-blocking try_put to keep the data into mailbox and slave might have get/try_get depending on the use case.
In reply to sharvil111:
In reply to Er. Shipra:
Showing some code might be helpful. Can you use mailbox communication between the two? Or any port connection for OVM/UVM based TB.
Declare your mailbox of appropriate type in environment and pass its handle in both master and slave agents. Master may use blocking put or non-blocking try_put to keep the data into mailbox and slave might have get/try_get depending on the use case.
hi
code is somewhat like:-
in master driver config:-
if(cfg.master_slave_select == AXI_MASTER)
for(int i=2;i<=rd_burst_length;i++ )
begin
@(posedge vif.aclk);
rd_next_addr=rd_start_address+1;
RADDR_Q.push_front(rd_next_addr);
end
in slave driver:-
if(cfg.master_slave_select == AXI_SLAVE)
@(posedge vif.aclk);
$display("\tQueue_1 size in read data is %0d",RADDR_Q.size());
addrr=RADDR_Q.pop_back();
vif.rdata<=mem[addrr];//
in agent:-
visibility is set.uvm_config_db#(axi_agent_configuration)::set(this,“axi_env.m_agnt.",“axi_agent_configuration”,m_cfg);
uvm_config_db#(axi_agent_configuration)::set(this,"axi_env.s_agnt.”,“axi_agent_configuration”,s_cfg);
In reply to Er. Shipra:
As I mentioned, do you see any hurdle in using mailboxes for communication? The queue here is itself behaving like a mailbox/FIFO.
As an alternative approach, we can also declare a queue in some common class and set the config_db for that particular class in both the agents. By this, the common class handle (and in-turn he queue) will be shared across the agents.
In reply to Er. Shipra:
Hi,
- There is a feature of UVM that it may help you solve your problem: uvm_queue. This is global singleton class, you can share queue resource between your components.
The following is example, please try it yourself.
At master:
typedef uvm_queue#(int) queue_int_t;
queue_int_t raddr_q = queue_int_t::get_global_queue();
raddr_q.push_back(rd_next_addr);
At slave:
typedef uvm_queue#(int) queue_int_t;
queue_int_t raddr_q = queue_int_t::get_global_queue();
addrr = raddr_q.pop_front();
- Could you explain more why do you need to communicate between multiple drivers? Normally, we don’t send traffic from a driver to a driver. Maybe you are not using a good approach.
In reply to sharvil111:
hi
i tried this but data is 0 always.
In reply to Er. Shipra:
Which way did you try it? Please share your code.
In reply to Er. Shipra:
As mentioned by Chris, please show the code where you have tried the inter-component communication. A simple example can be seen from here.
In your code, you need to do this:
// In high level env
mailbox #(int) mbx = new();
master_ag.mbx = this.mbx;
slave_ag.mbx = this.mbx;
// If Master
mbx.put(rd_next_addr);
// If Slave
mbx.get(rd_next_addr); // mbx.try_get(rd_next_addr);
Or you can go with uvm_queue singleton approach where UVM has created everything for the user.
In reply to sharvil111:
hi
uvm_queue singleton approach is working.
thanks alot for your time and help.
In reply to chris_le:
hi
the way you told is working. uvm_queue approach.
thanks alot for your time,help and solution.