| |
You can use the AHB Master VIP as a RAL BFM, and add a wrapper to convert RAL transactions into AHB READ/WRITE transactions before putting objects into AHB master VIP. And the ahbRALWrapper connects between the ahbRALRWXactor and AHB_Master_VIP .
Attach the ahbRALWrapper.sv for your reference. In brief, there are 3 steps for each WRITE/READ transaction:
step1. convert RAL transactions into AHB VIP transactions, for example:
master_trans.m_bvAddress = ral_trans.m_bvAddress;
master_trans.m_enXactType = dw_vip_ahb_transaction::WRITE;
master_trans.m_enBurstType = dw_vip_ahb_transaction::SINGLE;
master_trans.m_enXferSize = dw_vip_ahb_transaction::XFER_SIZE_32BIT;
master_trans.m_nNumBytes = 4;//32 bit data width, 4bytes
master_trans.m_bvvData = new[master_trans.m_nNumBytes];
master_trans.m_bvvData[0] = ral_trans.data[7:0];
master_trans.m_bvvData[1] = ral_trans.data[15:8];
master_trans.m_bvvData[2] = ral_trans.data[23:16];
master_trans.m_bvvData[3] = ral_trans.data[31:24];
step2. put the new transaction into VIP input channel
$cast(cpy_trans,master_trans.copy());
vip_input_chan.put(cpy_trans);
step3. Wait AHB VIP transaction completes
cpy_trans.notify.wait_for(vmm_data::ENDED);