Dear All,
I was made a simple task to collect output values from DUT in the Interface.
I just want to pass the collected values from monitor to the scoreboard.
this is interface
interface apb_interface();
bit pclk;
bit presetn;
bit [9:0] paddress;
bit [31:0] pwdata;
bit pselect;
bit pready;
bit penable;
bit [31:0] preaddata;
bit wr_rdenable;
task send_to_dut(input bit [9:0] addr,
bit [31:0] wdata );
// @(posedge pclk)
paddress <= addr;
pwdata <= wdata;
$display("called_send_to_dut task\n");
endtask
task collect_data(output bit [9:0] addr,
bit [31:0] wdata,
bit [31:0] rdata);
addr = paddress;
wdata = pwdata;
rdata = preaddata;
$display("called_collect_data task rdata:%02h = preaddata:%02h;\n", rdata, preaddata);
endtask
endinterface
this is monitor.
class apb_monitor extends uvm_monitor;
`uvm_component_utils(apb_monitor)
virtual apb_interface vapb_intf;
function new(string name="apb_monitor", uvm_component parent = null);
super.new(name, parent);
endfunction
uvm_analysis_port #(apb_sequence_item) my_mon_port;
virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
my_mon_port = new ("my_mon_port", this);
if (! uvm_config_db #(virtual apb_interface) :: get (this, "", "virtualapb_intf", vapb_intf)) begin
`uvm_fatal (get_type_name (), "Monitor Didn't get handle to virtual interface virtualapb_intf")
end
endfunction
virtual task run_phase(uvm_phase phase);
forever begin
apb_sequence_item apb_rx = apb_sequence_item::type_id::create("apb_sequence_item");
@(posedge vapb_intf.pclk)
vapb_intf.collect_data(apb_rx.address, apb_rx.data, apb_rx.acc);
`uvm_info(get_type_name(), $sformatf("Value from Monitor!! => apb_rx.address:%0h, apb_rx.data:%0h, apb_rx.acc:%0h", apb_rx.address, apb_rx.data , apb_rx.acc), UVM_LOW)
apb_rx.wr_en <= vapb_intf.penable;
my_mon_port.write(apb_rx);
end
endtask
endclass
Problem is the difference between collected data from interface and received data from monitor.
When I print the log out as the blow, I was expected apb_rx.acc is 87 not 01.
rdata:87 = preaddata:87
UVM_INFO apb_monitor.sv(31) @ 25: uvm_test_top.apb_environment.apb_agent.monitor [apb_monitor] Value from Monitor!! => apb_rx.address:82, apb_rx.data:05, apb_rx.acc:01
Could you guide me how do I get the value correctly in monitor? why does “apb_rx." value differ from "vapb_intf.”?
How do I get the same correct value from a task(collect_data.rdata) and interface apb_rx.acc?
For your understand my problem, I make a link Edit code - EDA Playground
Thank you in advance.