rtlpy.design.memory.AddressBlock
- class rtlpy.design.memory.AddressBlock(name: str, addr_size: int, data_size: int, base_address: int = 0, dimension: int = 1, endianness: str = 'little', coverage: str = 'UVM_NO_COVERAGE', registers: dict[int, ~rtlpy.design.memory.Register] = <factory>, sub_blocks: dict[int, ~rtlpy.design.memory.AddressBlock] = <factory>, address_unit_bits: int = 8)
Bases:
_AddressBlockBaseAn AddressBlock in a MemoryMap which represents a collection of registers
- __init__(name: str, addr_size: int, data_size: int, base_address: int = 0, dimension: int = 1, endianness: str = 'little', coverage: str = 'UVM_NO_COVERAGE', registers: dict[int, ~rtlpy.design.memory.Register] = <factory>, sub_blocks: dict[int, ~rtlpy.design.memory.AddressBlock] = <factory>, address_unit_bits: int = 8) None
Methods
__init__(name, addr_size, data_size[, ...])add_register(reg[, offset])Adds the register at the given offset.
add_subblock(blk[, offset])Adds the sub-block at the given offset.
Determines the number of address bits in a single register
Determines the size of the data field in bytes
from_dict(definition)Converts the dictionary definition into an AddressBlock object.
Determines if the AddressBlock is randomizable. (Any of the registers
size()Determines the number of bytes which the AddressBlock takes up.
valid()Checks the AddressBlock is validly defined
Attributes
The number of bits per address increment
The base address for this address block
The UVM built-in coverage for the address block
The dimension of this AddressBlock (the number of times it repeats in the top block)
The endianness of the address space ('little' or 'big')
The name of the Address block
The number of address bits in the block
The number of data bits in the block
A dict of the Registers in the AddressBlock, indexed by offset
A dict of address sub-blocks, indexed by base_address
- add_register(reg: Register, offset: int | None = None) bool
Adds the register at the given offset. If the offset is None, then add at first valid position
- Parameters:
reg (Register) – The register to add
offset (int, optional) – The offset of the register. Defaults to None. When None, the field is inserted at the first valid offset position
- Returns:
True if the register was successfully added
- Return type:
bool
- add_subblock(blk: AddressBlock, offset: int | None = None) bool
Adds the sub-block at the given offset. If the offset is None, then add at first valid position
- Parameters:
blk (AddressBlock) – The sub-block to add
offset (Optional[int], optional) – The offset of the sub-block. Defaults to None. When None, the sub-block is inserted at the first valid offset position
- Returns:
True if the sub-block was successfully added
- Return type:
bool
- addr_per_reg() int
Determines the number of address bits in a single register
- Returns:
The number of address bits that increment on a register
- Return type:
int
- addr_size: int
The number of address bits in the block
- address_unit_bits: int = 8
The number of bits per address increment
- base_address: int = 0
The base address for this address block
- coverage: str = 'UVM_NO_COVERAGE'
The UVM built-in coverage for the address block
- data_bytes() int
Determines the size of the data field in bytes
- Returns:
The number of bytes the data field is
- Return type:
int
- data_size: int
The number of data bits in the block
- dimension: int = 1
The dimension of this AddressBlock (the number of times it repeats in the top block)
- endianness: str = 'little'
The endianness of the address space (‘little’ or ‘big’)
- classmethod from_dict(definition: dict) AddrBlockT
Converts the dictionary definition into an AddressBlock object. Requires the following keys: [name, addr_size, data_size] Accepts the optional keys: [base_address, dimension, endianness, coverage, registers, sub_blocks]
- Parameters:
definition (dict) – The definition of the Register in dictionary form
- Raises:
MissingDefinitionException – Raised when a required key is missing from the definition
- Returns:
The address block derived from the definition
- Return type:
- name: str
The name of the Address block
- randomizable() bool
- Determines if the AddressBlock is randomizable. (Any of the registers
or sub-blocks are randomizable)
- Returns:
True if any register or sub-block is randomizable, False otherwise
- Return type:
bool
- size() int
Determines the number of bytes which the AddressBlock takes up. Assumes all space is full and block interleaving is not permitted
- Returns:
The number of bytes in the address block
- Return type:
int
- sub_blocks: dict[int, AddressBlock]
A dict of address sub-blocks, indexed by base_address
- valid() bool
Checks the AddressBlock is validly defined
- Raises:
bool – Returns true if the Field is valid. False otherwise