This file defines the following converter classes
Static methods allow conversion without object allocation and is compile-time compile-time type-safe. Each class handles one direction, as many applications require conversion in only one direction.
In addition to the converters, this section also defines typedefs to APB-specific specializations for all the adapters.
| apb_rw converter classes | |
| This file defines the following converter classes | |
| apb_rw_convert_ovm2vmm | Convert OVM apb transactions to VMM apb transactions. |
| convert | Converts an OVM apb transaction to a VMM apb transaction, including the transaction/data and sequence/scenario ids. |
| apb_rw_convert_vmm2ovm | Convert VMM apb transactions to OVM apb transactions. |
| convert | Converts a VMM apb transaction to an OVM apb transaction, including the transaction/data and sequence/scenario ids. |
| Adapter Types | Define adapter specialization typedefs for the apb_rw transactions type. |
Convert OVM apb transactions to VMM apb transactions.
static function vmm_apb_rw convert( ovm_apb_rw from, vmm_apb_rw to = null )
Converts an OVM apb transaction to a VMM apb transaction, including the transaction/data and sequence/scenario ids.
If the to argument is provided, the OVM transaction contents are copied into the existing to VMM transaction. Otherwise, a new VMM transaction is allocated, copied into, and returned.
Convert VMM apb transactions to OVM apb transactions.
static function ovm_apb_rw convert( vmm_apb_rw from, ovm_apb_rw to = null )
Converts a VMM apb transaction to an OVM apb transaction, including the transaction/data and sequence/scenario ids.
If the to argument is provided, the VMM transaction contents are copied into the existing to OVM transaction. Otherwise, a new OVM transaction is allocated, copied into, and returned.
Define adapter specialization typedefs for the apb_rw transactions type.
`ifndef OVM_APB_RW_CONVERTERS_SV
`define OVM_APB_RW_CONVERTERS_SV
class apb_rw_convert_ovm2vmm;
// Function: convert
//
// Converts an OVM apb transaction to a VMM apb transaction,
// including the transaction/data and sequence/scenario ids.
//
// If the ~to~ argument is provided, the OVM transaction
// contents are copied into the existing ~to~ VMM transaction.
// Otherwise, a new VMM transaction is allocated, copied into,
// and returned.
static function vmm_apb_rw convert(ovm_apb_rw from, vmm_apb_rw to=null);
if (to == null)
convert = new;
else
convert = to;
case (from.cmd)
ovm_apb_rw::RD : convert.kind = vmm_apb_rw::READ;
ovm_apb_rw::WR : convert.kind = vmm_apb_rw::WRITE;
endcase
convert.addr = from.addr;
convert.data = from.data;
convert.data_id = from.get_transaction_id();
convert.scenario_id = from.get_sequence_id();
endfunction
endclass
class apb_rw_convert_vmm2ovm;
typedef ovm_apb_rw ovm_apb_rw;
// Function: convert
//
// Converts a VMM apb transaction to an OVM apb transaction,
// including the transaction/data and sequence/scenario ids.
//
// If the ~to~ argument is provided, the VMM transaction
// contents are copied into the existing ~to~ OVM transaction.
// Otherwise, a new OVM transaction is allocated, copied into,
// and returned.
static function ovm_apb_rw convert(vmm_apb_rw from, ovm_apb_rw to=null);
if (to == null)
convert = new;
else
convert = to;
case (from.kind)
vmm_apb_rw::READ: convert.cmd = ovm_apb_rw::RD;
vmm_apb_rw::WRITE: convert.cmd = ovm_apb_rw::WR;
endcase
convert.addr = from.addr;
convert.data = from.data;
convert.set_transaction_id(from.data_id);
convert.set_sequence_id(from.scenario_id);
endfunction
endclass
typedef apb_rw_convert_ovm2vmm ovm2vmm_apb_tr_converter;
typedef apb_rw_convert_ovm2vmm ovm2vmm_apb_item_converter;
typedef apb_rw_convert_vmm2ovm vmm2ovm_apb_tr_converter;
typedef apb_rw_convert_vmm2ovm vmm2ovm_apb_item_converter;
typedef avt_channel2tlm
#(vmm_apb_rw,ovm_apb_rw,
apb_rw_convert_vmm2ovm,
ovm_apb_rw,vmm_apb_rw,
apb_rw_convert_ovm2vmm) apb_channel2tlm;
typedef avt_tlm2channel
#(ovm_apb_rw,vmm_apb_rw,
apb_rw_convert_ovm2vmm,
vmm_apb_rw,ovm_apb_rw,
apb_rw_convert_vmm2ovm) apb_tlm2channel;
typedef avt_analysis_channel
#(ovm_apb_rw,vmm_apb_rw,
apb_rw_convert_ovm2vmm,
apb_rw_convert_vmm2ovm) apb_analysis_channel;
typedef avt_analysis2notify
#(ovm_apb_rw,vmm_apb_rw,
apb_rw_convert_ovm2vmm) apb_analysis2notify;
typedef avt_notify2analysis
#(vmm_apb_rw,ovm_apb_rw,
apb_rw_convert_vmm2ovm) apb_notify2analysis;
`endif // OVM_APB_RW_CONVERTERS_SV
Converts an OVM apb transaction to a VMM apb transaction, including the transaction/data and sequence/scenario ids.
static function vmm_apb_rw convert( ovm_apb_rw from, vmm_apb_rw to = null )