rtlpy.design.memory.Register

class rtlpy.design.memory.Register(name: str, coverage: str = 'UVM_NO_COVERAGE', dimension: int = 1, fields: dict[int, ~rtlpy.design.memory.Field] = <factory>)

Bases: object

The class which represents a Register in a MemoryMap

__init__(name: str, coverage: str = 'UVM_NO_COVERAGE', dimension: int = 1, fields: dict[int, ~rtlpy.design.memory.Field] = <factory>) None

Methods

__init__(name[, coverage, dimension, fields])

add_field(fld[, lsb_pos])

Adds the field at the given lsb position

from_dict(definition)

Converts the dictionary definition into a Register object.

randomizable()

Determines if the register is randomizable.

valid()

Checks the Register is validly defined

Attributes

coverage

The UVM Coverage type to apply in a RAL

dimension

The dimension of this register (the number of times it repeats in the Map)

name

The name of the register

fields

A list of the fields in the register bank

add_field(fld: Field, lsb_pos: int | None = None) bool

Adds the field at the given lsb position

Parameters:
  • fld (Field) – The field to add

  • lsb_pos (int, optional) – The lsb_position to insert. Defaults to None. When None, the field is inserted at the first valid lsb position

Returns:

True if the field was successfully inserted. False otherwise

Return type:

bool

coverage: str = 'UVM_NO_COVERAGE'

The UVM Coverage type to apply in a RAL

dimension: int = 1

The dimension of this register (the number of times it repeats in the Map)

fields: dict[int, Field]

A list of the fields in the register bank

static from_dict(definition: dict) Register

Converts the dictionary definition into a Register object. Requires the following keys: [name] Accepts the optional keys: [addr, coverage, fields]

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 register derived from the definition

Return type:

Register

name: str

The name of the register

randomizable() bool

Determines if the register is randomizable. (Any of the fields are randomizable)

Returns:

True if any field is randomizable, False otherwise

Return type:

bool

valid() bool

Checks the Register is validly defined

Raises:

bool – Returns true if the Field is valid. False otherwise