Jump to content

AHB RAL is not updating the correct value

How to make the adapter,s bus2reg function sample the data at correct timestamp  

  1. 1. How to make the adapter,s bus2reg function sample the data at correct timestamp

    • Can i use callbacks?
    • any inputs?

Recommended Posts

I am trying to create and RAL for AHB bus. My adapter is not able to read the data correctly.

My env uses a synopsis AHB VIP.VIP is configured to 32bit address and data.

Write is working with this adapter. Read is delayed by one clock cycle which is making read data from adapter as 0’s always.

Here is the sim.log displays from adapter:

@ 78400823500: reporter [RAL ADAPTER] reg2bus rw.DATA = 00, rw.ADDRESS = 20c

@ 78400823500: reporter [RAL ADAPTER] reg2bus tr.DATA = 00, tr.ADDRESS = 20c

@78400823500 address is on reg2bus

@ 78412835500: reporter [RAL ADAPTER] bus2reg rw.DATA = 00, rw.ADDRESS = 20c

@ 78412835500: reporter [RAL ADAPTER] bus2reg tr.DATA = 00, tr.ADDRESS = 20c

In waveform @78409832500 we can see data on hrdata lines, but bus2reg displays shows timestamps @ 78412835500: by this timestamp data is zero on hrdata.

Can anyone tell me What should be made to adapter so that it read data at correct timestamp.

I have attached the snapshot of read transaction at @ 78400823500,@78409832500,@ 78412835500

Here is the adapter code which I have implemented.

class reg_adapter extends uvm_reg_adapter;


function new (string name = "reg_adapter");


provides_responses = 1;

endfunction : new

virtual function uvm_sequence_item reg2bus(const ref uvm_reg_bus_op rw);

pcie_dw_vip_ahb_master_transaction tr;

tr = pcie_dw_vip_ahb_master_transaction::type_id::create("tr");

tr.m_enXactType = (rw.kind == UVM_READ) ? pcie_dw_vip_ahb_master_transaction::READ : pcie_dw_vip_ahb_master_transaction::WRITE;

tr.m_enXferSize = pcie_dw_vip_ahb_master_transaction::XFER_SIZE_32BIT;

tr.m_bvAddress = rw.addr;

tr.m_nNumBytes = 4;

tr.m_bvvData = new[4];

tr.m_bvvData[0] = rw.data[7:0];

tr.m_bvvData[1] = rw.data[15:8];

tr.m_bvvData[2] = rw.data[23:16];

tr.m_bvvData[3] = rw.data[31:24];

`uvm_info("RAL ADAPTER",$sformatf("reg2bus rw.DATA = %2h, rw.ADDRESS = %2h",rw.data,rw.addr),UVM_LOW);

`uvm_info("RAL ADAPTER",$sformatf("reg2bus tr.DATA = %2h, tr.ADDRESS = %2h",{tr.m_bvvData[0],tr.m_bvvData[1],tr.m_bvvData[2],tr.m_bvvData[3]},tr.m_bvAddress),UVM_LOW);

return tr;


virtual function void bus2reg(uvm_sequence_item bus_item, ref uvm_reg_bus_op rw);

pcie_dw_vip_ahb_master_transaction tr;


`uvm_fatal("NOT_HOST_REG_TYPE","bus_item is not correct type");


rw.kind = (tr.m_enXactType == pcie_dw_vip_ahb_master_transaction::READ) ? UVM_READ : UVM_WRITE;

tr.m_enXferSize = pcie_dw_vip_ahb_master_transaction::XFER_SIZE_32BIT;

rw.addr = tr.m_bvAddress;

tr.m_nNumBytes = 4;

tr.m_bvvData = new[4];

rw.data[7:0] = tr.m_bvvData[0];

rw.data[15:8] = tr.m_bvvData[1];

rw.data[23:16] = tr.m_bvvData[2];

rw.data[31:24] = tr.m_bvvData[3];

rw.status = UVM_IS_OK;

`uvm_info("RAL ADAPTER",$sformatf("bus2reg rw.DATA = %2h, rw.ADDRESS = %2h",rw.data,rw.addr),UVM_LOW);

`uvm_info("RAL ADAPTER",$sformatf("bus2reg tr.DATA = %2h, tr.ADDRESS = %2h",{tr.m_bvvData[0],tr.m_bvvData[1],tr.m_bvvData[2],tr.m_bvvData[3]},tr.m_bvAddress),UVM_LOW);



Link to comment
Share on other sites

  • 4 weeks later...
  • 8 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...