There are two DUTs I have to verify. and what I need to do is compare the transactions between these two DUTs. ( one is RTL design, named SIM. And the other is based on cpp file, named EMU) For SIM, it's just like a traditional DUT and for EMU we just use DPI function to instance.
Here is my question. When I try to use queue to record each transaction in EMU and SIM in order to compare in testbench, I met a problem needed your help. (Please notice that the EMU and the SIM are concurrent running)
Firstly I create a emu_queue[$] to record each transaction for EMU and create a sim_queue[$] to record each transaction for SIM.
And waiting both size of emu_queue and sim_queue are not zero, then pop up the first element in the queues to compare. (because sometimes they won’t be have data in the same point)
For example, a1, a2, a3 for EMU are pushed into emu_queue[$] one by one. And then a1 for SIM is pushed into sim_queue[$]. So I can start to pop up the first element for both queues to compare. But the data popped in emu_queue[$] is not a1 but a3. It seems to me that the emu_queue is not effected to reserve all transactions happened before this point.
Here is some snippet code below. In write_sim() and write_emu(), I will push_back the tr into the sim_queue and emu_queue separately. And in task compare() we will wait both size is not zero. And then pop_front the first element to compare.
task write_sim(my_trans tr);
task write_emu(my_trans tr);
task compare(uvm_phase phase);
tr = new(“tr”);
tr_emu = new(“tr_emu”);
wait(emu_queue.size && sim_queue.size)
tr_emu = emu_queue.pop_front();
tr = sim_queue.pop_front();
if (!tr.compare(tr_emu)) begin
`uvm_fatal(get_type_name(), " transcation is not match")