This section defines classes used to convert transaction streams between generic register address/data reads and writes and physical bus accesses.
Classes for Adapting Between Register and Bus Operations | This section defines classes used to convert transaction streams between generic register address/data reads and writes and physical bus accesses. |
uvm_reg_adapter | This class defines an interface for converting between uvm_reg_bus_op and a specific bus transaction. |
uvm_reg_tlm_adapter | For converting between uvm_reg_bus_op and uvm_tlm_gp items. |
This class defines an interface for converting between uvm_reg_bus_op and a specific bus transaction.
uvm_reg_adapter | ||||
This class defines an interface for converting between uvm_reg_bus_op and a specific bus transaction. | ||||
Class Hierarchy | ||||
| ||||
Class Declaration | ||||
| ||||
new | Create a new instance of this type, giving it the optional name. | |||
supports_byte_enable | Set this bit in extensions of this class if the bus protocol supports byte enables. | |||
provides_responses | Set this bit in extensions of this class if the bus driver provides separate response items. | |||
reg2bus | Extensions of this class must implement this method to convert a uvm_reg_item to the uvm_sequence_item subtype that defines the bus transaction. | |||
bus2reg | Extensions of this class must implement this method to copy members of the given bus_item to corresponding members of the provided bus_rw instance. | |||
Example | The following example illustrates how to implement a RegModel-BUS adapter class for the APB bus protocol. |
function new( string name = "" )
Create a new instance of this type, giving it the optional name.
bit supports_byte_enable
Set this bit in extensions of this class if the bus protocol supports byte enables.
bit provides_responses
Set this bit in extensions of this class if the bus driver provides separate response items.
pure virtual function uvm_sequence_item reg2bus( const ref uvm_reg_bus_op rw )
Extensions of this class must implement this method to convert a uvm_reg_item to the uvm_sequence_item subtype that defines the bus transaction.
The method must allocate a new bus item, assign its members from the corresponding members from the given bus_rw item, then return it. The bus item gets returned in a uvm_sequence_item base handle.
pure virtual function void bus2reg( uvm_sequence_item bus_item, ref uvm_reg_bus_op rw )
Extensions of this class must implement this method to copy members of the given bus_item to corresponding members of the provided bus_rw instance. Unlike reg2bus, the resulting transaction is not allocated from scratch. This is to accommodate applications where the bus response must be returned in the original request.
The following example illustrates how to implement a RegModel-BUS adapter class for the APB bus protocol.
class rreg2apb_adapter extends uvm_reg_adapter; `uvm_object_utils(reg2apb_adapter) function new(string name="reg2apb_adapter"); super.new(name); endfunction virtual function uvm_sequence_item reg2bus(uvm_reg_bus_op rw); apb_item apb = apb_item::type_id::create("apb_item"); apb.op = (rw.kind == UVM_READ) ? apb::READ : apb::WRITE; apb.addr = rw.addr; apb.data = rw.data; return apb; endfunction virtual function void bus2reg(uvm_sequencer_item bus_item, uvm_reg_bus_op rw); apb_item apb; if (!$cast(apb,bus_item)) begin `uvm_fatal("CONVERT_APB2REG","Bus item is not of type apb_item") end rw.kind = apb.op==apb::READ ? UVM_READ : UVM_WRITE; rw.addr = apb.addr; rw.data = apb.data; rw.status = UVM_IS_OK; endfunction endclass
For converting between uvm_reg_bus_op and uvm_tlm_gp items.
uvm_reg_tlm_adapter | |||||
For converting between uvm_reg_bus_op and uvm_tlm_gp items. | |||||
Class Hierarchy | |||||
| |||||
Class Declaration | |||||
| |||||
Methods | |||||
reg2bus | Converts a uvm_reg_bus_op struct to a uvm_tlm_gp item. | ||||
bus2reg | Converts a uvm_tlm_gp item to a uvm_reg_bus_op. |
virtual function uvm_sequence_item reg2bus( const ref uvm_reg_bus_op rw )
Converts a uvm_reg_bus_op struct to a uvm_tlm_gp item.
virtual function void bus2reg( uvm_sequence_item bus_item, ref uvm_reg_bus_op rw )
Converts a uvm_tlm_gp item to a uvm_reg_bus_op. into the provided rw transaction.
This class defines an interface for converting between uvm_reg_bus_op and a specific bus transaction.
virtual class uvm_reg_adapter extends uvm_object
For converting between uvm_reg_bus_op and uvm_tlm_gp items.
class uvm_reg_tlm_adapter extends uvm_reg_adapter
This typedef provides a short, more convenient name for the uvm_tlm_generic_payload type.
typedef uvm_tlm_generic_payload uvm_tlm_gp
The uvm_object class is the base class for all UVM data and hierarchical classes.
virtual class uvm_object extends uvm_void
Create a new instance of this type, giving it the optional name.
function new( string name = "" )
Set this bit in extensions of this class if the bus protocol supports byte enables.
bit supports_byte_enable
Set this bit in extensions of this class if the bus driver provides separate response items.
bit provides_responses
Extensions of this class must implement this method to convert a uvm_reg_item to the uvm_sequence_item subtype that defines the bus transaction.
pure virtual function uvm_sequence_item reg2bus( const ref uvm_reg_bus_op rw )
Defines an abstract register transaction item.
class uvm_reg_item extends uvm_sequence_item
The base class for user-defined sequence items and also the base class for the uvm_sequence class.
class uvm_sequence_item extends uvm_transaction
Extensions of this class must implement this method to copy members of the given bus_item to corresponding members of the provided bus_rw instance.
pure virtual function void bus2reg( uvm_sequence_item bus_item, ref uvm_reg_bus_op rw )
Converts a uvm_reg_bus_op struct to a uvm_tlm_gp item.
virtual function uvm_sequence_item reg2bus( const ref uvm_reg_bus_op rw )
Converts a uvm_tlm_gp item to a uvm_reg_bus_op.
virtual function void bus2reg( uvm_sequence_item bus_item, ref uvm_reg_bus_op rw )