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. | |||
parent_sequence | Set this member in extensions of this class if the bus driver requires bus items be executed via a particular sequence base type. | |||
reg2bus | Extensions of this class must implement this method to convert the specified uvm_reg_bus_op to a corresponding 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-specific bus_item to corresponding members of the provided bus_rw instance. | |||
get_item | Returns the bus-independent read/write information that corresponds to the generic bus transaction currently translated to a bus-specific transaction. | |||
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.
uvm_sequence_base parent_sequence
Set this member in extensions of this class if the bus driver requires bus items be executed via a particular sequence base type. The sequence assigned to this member must implement do_clone().
pure virtual function uvm_sequence_item reg2bus( const ref uvm_reg_bus_op rw )
Extensions of this class must implement this method to convert the specified uvm_reg_bus_op to a corresponding uvm_sequence_item subtype that defines the bus transaction.
The method must allocate a new bus-specific uvm_sequence_item, assign its members from the corresponding members from the given generic rw bus operation, then return it.
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-specific 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.
virtual function uvm_reg_item get_item()
Returns the bus-independent read/write information that corresponds to the generic bus transaction currently translated to a bus-specific transaction. This function returns a value reference only when called in the uvm_reg_adapter::reg2bus() method. It returns null at all other times. The content of the return uvm_reg_item instance must not be modified and used strictly to obtain additional information about the operation.
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_void class is the base class for all UVM classes.
virtual class uvm_void
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
Set this member in extensions of this class if the bus driver requires bus items be executed via a particular sequence base type.
uvm_sequence_base parent_sequence
Extensions of this class must implement this method to convert the specified uvm_reg_bus_op to a corresponding uvm_sequence_item subtype that defines the bus transaction.
pure virtual function uvm_sequence_item reg2bus( const ref uvm_reg_bus_op rw )
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-specific 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 )
Returns the bus-independent read/write information that corresponds to the generic bus transaction currently translated to a bus-specific transaction.
virtual function uvm_reg_item get_item()
Defines an abstract register transaction item.
class uvm_reg_item extends uvm_sequence_item
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 )