I'm trying to monitor the HRDATA
and HWDATA
on the AHB-Lite bus transfer.
The monitor message should only appear when a command(Read/ Write) is issued. because this monitor connected to Scoreboard, I need the monitor signals when they are issued in Scoreboard.
So I implement the Benjamin's idea in to the Monitor by using HTRANS.
if(ahb_if.HWRITE==1 && ahb_if.HTRANS==NONSEQ) begin
rsp.HWDATA = ahb_if.HWDATA;
`uvm_info(get_type_name(),$sformatf("Rcvd wr data=0x%h", ahb_if.HWDATA),UVM_LOW)
end
if(ahb_if.HWRITE==0 && ahb_if.HTRANS==NONSEQ) begin
rsp.HRDATA = ahb_if.HRDATA;
`uvm_info(get_type_name(),$sformatf("Rcvd rd data=0x%h", ahb_if.HRDATA),UVM_LOW)
end
then I got the message as per the condition after Update 1: Proposed Fixed output
But Problem is that the write and received data start with'xxxx
.
How can I get the one cycle delayed HRDATA
and HWDATA
from the monitor?
This is the snippet of monitor
virtual task run_phase(uvm_phase phase);
fork
do_ahb_trans();
do_ahb_trans();
join
endtask
// capture ahb transaction pipeline
task do_ahb_trans();
ahb_seq_item rsp;
forever begin
addr_key.get(); // lock addr pipeline
// wait for new trans addr accepted
do wait_cycle(); while(ahb_if.HREADY !=1 );
//`uvm_info(get_type_name(),$sformatf("Rcvd addr=0x%h", ahb_if.HADDR),UVM_LOW)
rsp = ahb_seq_item::type_id::create("mon_item");
// send cmds to cmd_fifo only in active slave mode for driving responses
addr_key.put(); // unlock addr pipeline
rsp.busy = new[1];
wait_ready(rsp.busy[0]); // wait for data accepted
if(ahb_if.HWRITE==1 && ahb_if.HTRANS==NONSEQ) begin
rsp.HWDATA = ahb_if.HWDATA;
`uvm_info(get_type_name(),$sformatf("Rcvd wr data=0x%h", ahb_if.HWDATA),UVM_LOW)
end
if(ahb_if.HWRITE==0 && ahb_if.HTRANS==NONSEQ) begin
rsp.HRDATA = ahb_if.HRDATA;
`uvm_info(get_type_name(),$sformatf("Rcvd rd data=0x%h", ahb_if.HRDATA),UVM_LOW)
end
mon_ap.write(rsp);
end
endtask
task wait_cycle;
@(posedge ahb_if.HCLK);
endtask // wait_cycle
// wait for hready
task wait_ready(output int busy);
busy = 0;
// wait for data accepted
do begin
wait_cycle();
busy++;
end while(!ahb_if.HREADY);
endtask // wait_ready