Hi,
I have implemented a simple UVM testbench. I have given my driver callback support.
My intention is to corrupt the sequence item. I am sending the original packet to scoreboard by connecting driver and scoreboard with analysis port and imp. I want to see this packet data mismatch in scoreboard.
Below is the code snippet of Driver logic.
forever begin
seq_item_port.get_next_item(req);
PktBeforeXmitPort.write(req); //Sending Packet to scoreboard before corruption.
`uvm_do_callbacks(tb_driver3, driver_cb, PktBeforeXmitCbf(req))
drive(req);
seq_item_port.item_done();
end
Below is the scoreboard logic.
Item received at write function.
function void write_sent(tb_seq_item tr);
tr_q_sent.push_back(tr);
->1. tr.print(); //Packet sent from driver before corruption
endfunction : write_sent
task compare_packets();
int i = 1;
forever begin
wait(tr_q_rcvd.size() != 0);
tr_sent = tr_q_sent.pop_front(); //Packet popped out of Queue for comparison
tr_rcvd = tr_q_rcvd.pop_front();
->2. tr_sent.print();
//tr_rcvd.print();
uvm_report_info(“SCBD”, $sformatf(“PKT NUMBER %0d”, i), UVM_LOW);
tr_sent.compare(tr_rcvd);
i++;
end
endtask : compare_packets
Strangely, when packet is received at write function, it is the one before corrupting the data.
But at comparison, when i popped the packet out of Queue, I am observing that packet is the one after corruption.
tr.print at line ->1. and tr_sent.print() at line ->2. are not the same.
Can anybody please let me know why this is happening? I am corrupting the packet through callback hook.
Thanks in Advance.
-Surya