Hi
I have an analysis port which sends packets to the corresponding write function in the subscriber:
foreach(exp_dma[dma_id]) begin //exp_dma is associative array
//Using this field to pass the DMA number to comparator.
xgmac_pkt.avb_gateway_info=dma_id;
exp_pcie_rx_pkt_ap.write(xgmac_pkt);
/// rd_bk_ap.write(dma_id);
end
function void write_EXP_``P(T pkt);\
ethernet_transaction exp_pkt;\
//load_mc_bc(pkt);\
//exp_``P``_q[pkt]=1'b1;\
exp_tmp_q.push_back(pkt);\
$display("vem avb_gateway_info =%0d",pkt.avb_gateway_info);\
foreach(exp_tmp_q[i])begin \
exp_pkt = exp_tmp_q[i]; \
$display("vem1 i=%0d dma_id=%0d",i,exp_pkt.avb_gateway_info);\
end\
`uvm_info("base_comparator",$psprintf("EXP pkt received from the ref_model module for path.size=%0d \n %s",exp_tmp_q.size(),pkt.sprint),UVM_LOW);\
endfunction
output of the above code is :
vem avb_gateway_info =0
vem1 i=0 dma_id=0
.
.
.
vem avb_gateway_info =2
vem1 i=0 dma_id=2
vem1 i=1 dma_id=2
===========================
When the “write” function got executed the first time, pkt with avb_gateway_info=0 was sent and it was pushed into the exp_tmp_q.
When the second pkt was written, it was also pushed into the exp_tmp_q with avb_gateway_info==2. But I’m not able to understand why the first pkt’s avb_gateway_info changed from 0 to 2. It should have remained 0.
Can anyone please help me understand where is the error in this code.