Register Model Structure

The Register Model is built from the following classes

Base Classes

class peakrdl_python.lib.base.Node(*, address: int, logger_handle: str, inst_name: str, parent: Node | NodeArray | None)

base class of for all types with an address i.e. not fields

Note

It is not expected that this class will be instantiated under normal circumstances however, it is useful for type checking

property address: int

address of the node

property full_inst_name: str

The full hierarchical systemRDL name of the instance

get_child_by_system_rdl_name(name: str) Base

returns a child node by its systemRDL name

Parameters:

name – name of the node in the systemRDL

Returns: Node

property inst_name: str

systemRDL name of the instance in the parent

property parent: Node | NodeArray | None

parent of the node or field, or None if it has no parent

abstract property size: int

Total Number of bytes of address the node occupies

abstract property systemrdl_python_child_name_map: Dict[str, str]

In some cases systemRDL names need to be converted make them python safe, this dictionary is used to map the original systemRDL names to the names of the python attributes of this class

Returns: dictionary whose key is the systemRDL names and value it the property name

class peakrdl_python.lib.base.NodeArray(*, logger_handle: str, inst_name: str, parent: Node, address: int, stride: int, dimensions: Tuple[int, ...], elements: Dict[Tuple[int, ...], NodeArrayElementType] | None = None)

base class of for all array types

property address: int

address of the node

count(value) integer -- return number of occurrences of value
property dimensions: Tuple[int, ...] | Tuple[int]

Dimensions of the array

property full_inst_name: str

The full hierarchical systemRDL name of the instance

index(value[, start[, stop]]) integer -- return first index of value.

Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

property inst_name: str

systemRDL name of the instance in the parent

items() Iterator[Tuple[Tuple[int, ...], NodeArrayElementType]]

iterate through all the items in an array but also return the index of the array

property parent: Node | NodeArray | None

parent of the node or field, or None if it has no parent

property size: int

Total Number of bytes of address the array occupies

property stride: int

address stride of the array

Address Maps

class peakrdl_python.lib.base.AddressMap(*, callbacks: NormalCallbackSet | None, address: int, logger_handle: str, inst_name: str, parent: AddressMap | None)

base class of address map wrappers

Note

It is not expected that this class will be instantiated under normal circumstances however, it is useful for type checking

property address: int

address of the node

property full_inst_name: str

The full hierarchical systemRDL name of the instance

get_child_by_system_rdl_name(name: str) Base

returns a child node by its systemRDL name

Parameters:

name – name of the node in the systemRDL

Returns: Node

get_children(unroll: bool = False) Iterator[Node | NodeArray]

generator that produces all the readable_registers of this node

Parameters:

unroll – Whether to unroll child array or not

abstract get_memories(unroll: bool = False) Iterator['Memory' | 'MemoryArray']

generator that produces all the Memory children of this node

Parameters:

unroll – Whether to unroll child array or not

Returns:

get_readable_registers(unroll: bool = False) Iterator[ReadableRegister | ReadableRegisterArray]

generator that produces all the readable_registers of this node

Parameters:

unroll – Whether to unroll child array or not

abstract get_registers(unroll: bool = False) Iterator[Reg | RegArray]

generator that produces all the readable_registers of this node

Parameters:

unroll – Whether to unroll child array or not

abstract get_sections(unroll: bool = False) Iterator[AddressMap | RegFile | AddressMapArray | RegFileArray]

generator that produces all the AddressMap and RegFile children of this node

Parameters:

unroll – Whether to unroll child array or not

Returns:

get_writable_registers(unroll: bool = False) Iterator[WritableRegister | WriteableRegisterArray]

generator that produces all the readable_registers of this node

Parameters:

unroll – Whether to unroll child array or not

property inst_name: str

systemRDL name of the instance in the parent

property parent: Node | NodeArray | None

parent of the node or field, or None if it has no parent

abstract property size: int

Total Number of bytes of address the node occupies

abstract property systemrdl_python_child_name_map: Dict[str, str]

In some cases systemRDL names need to be converted make them python safe, this dictionary is used to map the original systemRDL names to the names of the python attributes of this class

Returns: dictionary whose key is the systemRDL names and value it the property name

class peakrdl_python.lib.base.AddressMapArray(*, logger_handle: str, inst_name: str, parent: AddressMap, address: int, stride: int, dimensions: Tuple[int, ...])

base class for a array of address maps

property address: int

address of the node

count(value) integer -- return number of occurrences of value
property dimensions: Tuple[int, ...] | Tuple[int]

Dimensions of the array

property full_inst_name: str

The full hierarchical systemRDL name of the instance

index(value[, start[, stop]]) integer -- return first index of value.

Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

property inst_name: str

systemRDL name of the instance in the parent

items() Iterator[Tuple[Tuple[int, ...], NodeArrayElementType]]

iterate through all the items in an array but also return the index of the array

property parent: Node | NodeArray | None

parent of the node or field, or None if it has no parent

property size: int

Total Number of bytes of address the array occupies

property stride: int

address stride of the array

Register Files

class peakrdl_python.lib.base.RegFile(*, address: int, logger_handle: str, inst_name: str, parent: AddressMap | RegFile)

base class of register file wrappers

Note

It is not expected that this class will be instantiated under normal circumstances however, it is useful for type checking

property address: int

address of the node

property full_inst_name: str

The full hierarchical systemRDL name of the instance

get_child_by_system_rdl_name(name: str) Base

returns a child node by its systemRDL name

Parameters:

name – name of the node in the systemRDL

Returns: Node

get_children(unroll: bool = False) Iterator[Node | NodeArray]

generator that produces all the readable_registers of this node

Parameters:

unroll – Whether to unroll child array or not

get_readable_registers(unroll: bool = False) Iterator[ReadableRegister | ReadableRegisterArray]

generator that produces all the readable_registers of this node

Parameters:

unroll – Whether to unroll child array or not

abstract get_registers(unroll: bool = False) Iterator[Reg | RegArray]

generator that produces all the readable_registers of this node

Parameters:

unroll – Whether to unroll child array or not

abstract get_sections(unroll: bool = False) Iterator[RegFile | RegFileArray]

generator that produces all the RegFile children of this node

Parameters:

unroll – Whether to unroll child array or not

Returns:

get_writable_registers(unroll: bool = False) Iterator[WritableRegister | WriteableRegisterArray]

generator that produces all the readable_registers of this node

Parameters:

unroll – Whether to unroll child array or not

property inst_name: str

systemRDL name of the instance in the parent

property parent: Node | NodeArray | None

parent of the node or field, or None if it has no parent

abstract property size: int

Total Number of bytes of address the node occupies

abstract property systemrdl_python_child_name_map: Dict[str, str]

In some cases systemRDL names need to be converted make them python safe, this dictionary is used to map the original systemRDL names to the names of the python attributes of this class

Returns: dictionary whose key is the systemRDL names and value it the property name

class peakrdl_python.lib.base.RegFileArray(*, logger_handle: str, inst_name: str, parent: AddressMap | RegFile, address: int, stride: int, dimensions: Tuple[int, ...])

base class for a array of register files

property address: int

address of the node

count(value) integer -- return number of occurrences of value
property dimensions: Tuple[int, ...] | Tuple[int]

Dimensions of the array

property full_inst_name: str

The full hierarchical systemRDL name of the instance

index(value[, start[, stop]]) integer -- return first index of value.

Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

property inst_name: str

systemRDL name of the instance in the parent

items() Iterator[Tuple[Tuple[int, ...], NodeArrayElementType]]

iterate through all the items in an array but also return the index of the array

property parent: Node | NodeArray | None

parent of the node or field, or None if it has no parent

property size: int

Total Number of bytes of address the array occupies

property stride: int

address stride of the array

Memories

class peakrdl_python.lib.memory.MemoryReadOnly(address: int, width: int, accesswidth: int, entries: int, logger_handle: str, inst_name: str, parent: AddressMap | MemoryReadOnlyArray | MemoryWriteOnlyArray | MemoryReadWriteArray)

base class of memory wrappers

Note

It is not expected that this class will be instantiated under normal circumstances however, it is useful for type checking

property accesswidth: int

The access width of the register in bits, this uses the accesswidth systemRDL property

Returns: register access width

property address: int

address of the node

address_lookup(entry: int) int

provides the address for an entry in the memory.

Examples

Parameters:

entry – entry number to look up the address for

Returns: Address

property array_typecode: str

the python array.array type is initialised with a typecode. This property provides the recommended typecode to use with this class instance (based on the memwidth)

Returns: typecode

property entries: int

The number of entries in the memory, this uses the mementries systemRDL property

Returns: memory entries

property full_inst_name: str

The full hierarchical systemRDL name of the instance

get_child_by_system_rdl_name(name: str) Base

returns a child node by its systemRDL name

Parameters:

name – name of the node in the systemRDL

Returns: Node

get_readable_registers(unroll: bool = False) Iterator[ReadableRegister | ReadableRegisterArray]

generator that produces all the readable_registers of this node

Parameters:

unroll – Whether to unroll child array or not

abstract get_registers(unroll: bool = False) Iterator[Reg | RegArray]

generator that produces all the readable_registers of this node

Parameters:

unroll – Whether to unroll child array or not

property inst_name: str

systemRDL name of the instance in the parent

property parent: Node | NodeArray | None

parent of the node or field, or None if it has no parent

read(start_entry: int, number_entries: int) array

Read from the memory

Parameters:
  • start_entry – index in the memory to start from, this is not the address

  • number_entries – number of entries to read

Returns: data read from memory

property size: int

Total Number of bytes of address the node occupies

abstract property systemrdl_python_child_name_map: Dict[str, str]

In some cases systemRDL names need to be converted make them python safe, this dictionary is used to map the original systemRDL names to the names of the python attributes of this class

Returns: dictionary whose key is the systemRDL names and value it the property name

property width: int

The width of the memory in bits, this uses the memwidth systemRDL property

Returns: memory width

property width_in_bytes: int

The width of the memory bytes, i.e. the width in bits divided by 8

Returns: memory width (in bytes)

class peakrdl_python.lib.memory.MemoryWriteOnly(address: int, width: int, accesswidth: int, entries: int, logger_handle: str, inst_name: str, parent: AddressMap | MemoryReadOnlyArray | MemoryWriteOnlyArray | MemoryReadWriteArray)

base class of memory wrappers

Note

It is not expected that this class will be instantiated under normal circumstances however, it is useful for type checking

property accesswidth: int

The access width of the register in bits, this uses the accesswidth systemRDL property

Returns: register access width

property address: int

address of the node

address_lookup(entry: int) int

provides the address for an entry in the memory.

Examples

Parameters:

entry – entry number to look up the address for

Returns: Address

property array_typecode: str

the python array.array type is initialised with a typecode. This property provides the recommended typecode to use with this class instance (based on the memwidth)

Returns: typecode

property entries: int

The number of entries in the memory, this uses the mementries systemRDL property

Returns: memory entries

property full_inst_name: str

The full hierarchical systemRDL name of the instance

get_child_by_system_rdl_name(name: str) Base

returns a child node by its systemRDL name

Parameters:

name – name of the node in the systemRDL

Returns: Node

abstract get_registers(unroll: bool = False) Iterator[Reg | RegArray]

generator that produces all the readable_registers of this node

Parameters:

unroll – Whether to unroll child array or not

get_writable_registers(unroll: bool = False) Iterator[WritableRegister | WriteableRegisterArray]

generator that produces all the readable_registers of this node

Parameters:

unroll – Whether to unroll child array or not

property inst_name: str

systemRDL name of the instance in the parent

property parent: Node | NodeArray | None

parent of the node or field, or None if it has no parent

property size: int

Total Number of bytes of address the node occupies

abstract property systemrdl_python_child_name_map: Dict[str, str]

In some cases systemRDL names need to be converted make them python safe, this dictionary is used to map the original systemRDL names to the names of the python attributes of this class

Returns: dictionary whose key is the systemRDL names and value it the property name

property width: int

The width of the memory in bits, this uses the memwidth systemRDL property

Returns: memory width

property width_in_bytes: int

The width of the memory bytes, i.e. the width in bits divided by 8

Returns: memory width (in bytes)

write(start_entry: int, data: array) None

Write data to memory

Parameters:
  • start_entry – index in the memory to start from, this is not the address

  • data – data to write

Returns: None

class peakrdl_python.lib.memory.MemoryReadWrite(address: int, width: int, accesswidth: int, entries: int, logger_handle: str, inst_name: str, parent: AddressMap | MemoryReadOnlyArray | MemoryWriteOnlyArray | MemoryReadWriteArray)

base class of memory wrappers

Note

It is not expected that this class will be instantiated under normal circumstances however, it is useful for type checking

property accesswidth: int

The access width of the register in bits, this uses the accesswidth systemRDL property

Returns: register access width

property address: int

address of the node

address_lookup(entry: int) int

provides the address for an entry in the memory.

Examples

Parameters:

entry – entry number to look up the address for

Returns: Address

property array_typecode: str

the python array.array type is initialised with a typecode. This property provides the recommended typecode to use with this class instance (based on the memwidth)

Returns: typecode

property entries: int

The number of entries in the memory, this uses the mementries systemRDL property

Returns: memory entries

property full_inst_name: str

The full hierarchical systemRDL name of the instance

get_child_by_system_rdl_name(name: str) Base

returns a child node by its systemRDL name

Parameters:

name – name of the node in the systemRDL

Returns: Node

get_readable_registers(unroll: bool = False) Iterator[ReadableRegister | ReadableRegisterArray]

generator that produces all the readable_registers of this node

Parameters:

unroll – Whether to unroll child array or not

abstract get_registers(unroll: bool = False) Iterator[Reg | RegArray]

generator that produces all the readable_registers of this node

Parameters:

unroll – Whether to unroll child array or not

get_writable_registers(unroll: bool = False) Iterator[WritableRegister | WriteableRegisterArray]

generator that produces all the readable_registers of this node

Parameters:

unroll – Whether to unroll child array or not

property inst_name: str

systemRDL name of the instance in the parent

property parent: Node | NodeArray | None

parent of the node or field, or None if it has no parent

read(start_entry: int, number_entries: int) array

Read from the memory

Parameters:
  • start_entry – index in the memory to start from, this is not the address

  • number_entries – number of entries to read

Returns: data read from memory

property size: int

Total Number of bytes of address the node occupies

abstract property systemrdl_python_child_name_map: Dict[str, str]

In some cases systemRDL names need to be converted make them python safe, this dictionary is used to map the original systemRDL names to the names of the python attributes of this class

Returns: dictionary whose key is the systemRDL names and value it the property name

property width: int

The width of the memory in bits, this uses the memwidth systemRDL property

Returns: memory width

property width_in_bytes: int

The width of the memory bytes, i.e. the width in bits divided by 8

Returns: memory width (in bytes)

write(start_entry: int, data: array) None

Write data to memory

Parameters:
  • start_entry – index in the memory to start from, this is not the address

  • data – data to write

Returns: None

class peakrdl_python.lib.memory.MemoryReadOnlyArray(*, logger_handle: str, inst_name: str, parent: AddressMap, address: int, stride: int, dimensions: Tuple[int, ...])

base class for a array of read only memories

property address: int

address of the node

count(value) integer -- return number of occurrences of value
property dimensions: Tuple[int, ...] | Tuple[int]

Dimensions of the array

property full_inst_name: str

The full hierarchical systemRDL name of the instance

index(value[, start[, stop]]) integer -- return first index of value.

Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

property inst_name: str

systemRDL name of the instance in the parent

items() Iterator[Tuple[Tuple[int, ...], NodeArrayElementType]]

iterate through all the items in an array but also return the index of the array

property parent: Node | NodeArray | None

parent of the node or field, or None if it has no parent

property size: int

Total Number of bytes of address the array occupies

property stride: int

address stride of the array

class peakrdl_python.lib.memory.MemoryWriteOnlyArray(*, logger_handle: str, inst_name: str, parent: AddressMap, address: int, stride: int, dimensions: Tuple[int, ...])

base class for a array of write only memories

property address: int

address of the node

count(value) integer -- return number of occurrences of value
property dimensions: Tuple[int, ...] | Tuple[int]

Dimensions of the array

property full_inst_name: str

The full hierarchical systemRDL name of the instance

index(value[, start[, stop]]) integer -- return first index of value.

Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

property inst_name: str

systemRDL name of the instance in the parent

items() Iterator[Tuple[Tuple[int, ...], NodeArrayElementType]]

iterate through all the items in an array but also return the index of the array

property parent: Node | NodeArray | None

parent of the node or field, or None if it has no parent

property size: int

Total Number of bytes of address the array occupies

property stride: int

address stride of the array

class peakrdl_python.lib.memory.MemoryReadWriteArray(*, logger_handle: str, inst_name: str, parent: AddressMap, address: int, stride: int, dimensions: Tuple[int, ...])

base class for a array of read and write memories

property address: int

address of the node

count(value) integer -- return number of occurrences of value
property dimensions: Tuple[int, ...] | Tuple[int]

Dimensions of the array

property full_inst_name: str

The full hierarchical systemRDL name of the instance

index(value[, start[, stop]]) integer -- return first index of value.

Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

property inst_name: str

systemRDL name of the instance in the parent

items() Iterator[Tuple[Tuple[int, ...], NodeArrayElementType]]

iterate through all the items in an array but also return the index of the array

property parent: Node | NodeArray | None

parent of the node or field, or None if it has no parent

property size: int

Total Number of bytes of address the array occupies

property stride: int

address stride of the array

Registers

class peakrdl_python.lib.register.RegReadOnly(*, address: int, width: int, accesswidth: int, logger_handle: str, inst_name: str, parent: AddressMap | RegFile | MemoryReadOnly | MemoryReadWrite)

class for a read only register

Parameters:
  • callbacks – set of callback to be used for accessing the hardware or simulator

  • address – address of the register

  • width – width of the register in bits

  • accesswidth – minimum access width of the register in bits

  • logger_handle – name to be used logging messages associate with this object

property accesswidth: int

The access width of the register in bits, this uses the accesswidth systemRDL property

Returns: register access width

property address: int

address of the node

property full_inst_name: str

The full hierarchical systemRDL name of the instance

get_child_by_system_rdl_name(name: str) Base

returns a child node by its systemRDL name

Parameters:

name – name of the node in the systemRDL

Returns: Node

property inst_name: str

systemRDL name of the instance in the parent

property max_value: int

maximum unsigned integer value that can be stored in the register

For example:

  • 8-bit register returns 0xFF (255)

  • 16-bit register returns 0xFFFF (65535)

  • 32-bit register returns 0xFFFF_FFFF (4294967295)

property parent: Node | NodeArray | None

parent of the node or field, or None if it has no parent

read() int

Read value from the register

Returns:

The value from register

read_fields() Dict[str, bool | Enum | int]

read the register and return a dictionary of the field values

abstract property readable_fields: Iterator[FieldReadOnly | FieldReadWrite]

generator that produces has all the readable fields within the register

single_read() Generator[Self, None, None]

Context manager to allow multiple field accesses to be performed with a single read of the register

Returns:

property size: int

Total Number of bytes of address the node occupies

abstract property systemrdl_python_child_name_map: Dict[str, str]

In some cases systemRDL names need to be converted make them python safe, this dictionary is used to map the original systemRDL names to the names of the python attributes of this class

Returns: dictionary whose key is the systemRDL names and value it the property name

property width: int

The width of the register in bits, this uses the regwidth systemRDL property

Returns: register width

class peakrdl_python.lib.register.RegWriteOnly(*, address: int, width: int, accesswidth: int, logger_handle: str, inst_name: str, parent: AddressMap | RegFile | MemoryWriteOnly | MemoryReadWrite)

class for a write only register

property accesswidth: int

The access width of the register in bits, this uses the accesswidth systemRDL property

Returns: register access width

property address: int

address of the node

property full_inst_name: str

The full hierarchical systemRDL name of the instance

get_child_by_system_rdl_name(name: str) Base

returns a child node by its systemRDL name

Parameters:

name – name of the node in the systemRDL

Returns: Node

property inst_name: str

systemRDL name of the instance in the parent

property max_value: int

maximum unsigned integer value that can be stored in the register

For example:

  • 8-bit register returns 0xFF (255)

  • 16-bit register returns 0xFFFF (65535)

  • 32-bit register returns 0xFFFF_FFFF (4294967295)

property parent: Node | NodeArray | None

parent of the node or field, or None if it has no parent

property size: int

Total Number of bytes of address the node occupies

abstract property systemrdl_python_child_name_map: Dict[str, str]

In some cases systemRDL names need to be converted make them python safe, this dictionary is used to map the original systemRDL names to the names of the python attributes of this class

Returns: dictionary whose key is the systemRDL names and value it the property name

property width: int

The width of the register in bits, this uses the regwidth systemRDL property

Returns: register width

abstract property writable_fields: Iterator[FieldWriteOnly | FieldReadWrite]

generator that produces has all the readable fields within the register

write(data: int) None

Writes a value to the register

Parameters:

data – data to be written

Raises:
  • ValueError – if the value provided is outside the range of the permissible values for the register

  • TypeError – if the type of data is wrong

abstract write_fields(**kwargs) None

Do a write to the register, updating any field included in the arguments

class peakrdl_python.lib.register.RegReadWrite(*, address: int, width: int, accesswidth: int, logger_handle: str, inst_name: str, parent: AddressMap | RegFile | MemoryReadWrite)

class for a read and write only register

property accesswidth: int

The access width of the register in bits, this uses the accesswidth systemRDL property

Returns: register access width

property address: int

address of the node

property full_inst_name: str

The full hierarchical systemRDL name of the instance

get_child_by_system_rdl_name(name: str) Base

returns a child node by its systemRDL name

Parameters:

name – name of the node in the systemRDL

Returns: Node

property inst_name: str

systemRDL name of the instance in the parent

property max_value: int

maximum unsigned integer value that can be stored in the register

For example:

  • 8-bit register returns 0xFF (255)

  • 16-bit register returns 0xFFFF (65535)

  • 32-bit register returns 0xFFFF_FFFF (4294967295)

property parent: Node | NodeArray | None

parent of the node or field, or None if it has no parent

read() int

Read value from the register

Returns:

The value from register

read_fields() Dict[str, bool | Enum | int]

read the register and return a dictionary of the field values

abstract property readable_fields: Iterator[FieldReadOnly | FieldReadWrite]

generator that produces has all the readable fields within the register

single_read() Generator[Self, None, None]

Context manager to allow multiple field accesses to be performed with a single read of the register

Returns:

single_read_modify_write(verify: bool = False, skip_write: bool = False) Generator[Self, None, None]

Context manager to allow multiple field reads/write to be done with a single set of field operations

Parameters:
  • verify (bool) – very the write with a read afterwards

  • skip_write (bool) – skip the write back at the end

Returns:

property size: int

Total Number of bytes of address the node occupies

abstract property systemrdl_python_child_name_map: Dict[str, str]

In some cases systemRDL names need to be converted make them python safe, this dictionary is used to map the original systemRDL names to the names of the python attributes of this class

Returns: dictionary whose key is the systemRDL names and value it the property name

property width: int

The width of the register in bits, this uses the regwidth systemRDL property

Returns: register width

abstract property writable_fields: Iterator[FieldWriteOnly | FieldReadWrite]

generator that produces has all the readable fields within the register

write(data: int, verify: bool = False) None

Writes a value to the register

Parameters:
  • data – data to be written

  • verify – set to True to read back the register to verify the read has occurred correctly

Raises:
  • ValueError – if the value provided is outside the range of the permissible values for the register

  • TypeError – if the type of data is wrong

  • RegisterWriteVerifyError – the read back data after the write does not match the expected value

write_fields(**kwargs) None

Do a read-modify-write to the register, updating any field included in the arguments

class peakrdl_python.lib.register.RegReadOnlyArray(*, logger_handle: str, inst_name: str, parent: RegFile | AddressMap | MemoryReadOnly | MemoryReadWrite, address: int, width: int, accesswidth: int, stride: int, dimensions: Tuple[int, ...], elements: Dict[Tuple[int, ...], RegReadOnly] | None = None)

base class for a array of read only registers

property accesswidth: int

The access width of the register in bits, this uses the accesswidth systemRDL property

Returns: register access width

property address: int

address of the node

count(value) integer -- return number of occurrences of value
property dimensions: Tuple[int, ...] | Tuple[int]

Dimensions of the array

property full_inst_name: str

The full hierarchical systemRDL name of the instance

index(value[, start[, stop]]) integer -- return first index of value.

Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

property inst_name: str

systemRDL name of the instance in the parent

items() Iterator[Tuple[Tuple[int, ...], NodeArrayElementType]]

iterate through all the items in an array but also return the index of the array

property parent: Node | NodeArray | None

parent of the node or field, or None if it has no parent

single_read() Generator[Self, None, None]

Context manager to allow multiple field reads/write to be done with a single set of field operations

Args:

Returns:

property size: int

Total Number of bytes of address the array occupies

property stride: int

address stride of the array

property width: int

The width of the register in bits, this uses the regwidth systemRDL property

Returns: register width

class peakrdl_python.lib.register.RegWriteOnlyArray(*, logger_handle: str, inst_name: str, parent: RegFile | AddressMap | MemoryWriteOnly | MemoryReadWrite, address: int, width: int, accesswidth: int, stride: int, dimensions: Tuple[int, ...], elements: Dict[Tuple[int, ...], RegWriteOnly] | None = None)

base class for a array of write only registers

property accesswidth: int

The access width of the register in bits, this uses the accesswidth systemRDL property

Returns: register access width

property address: int

address of the node

count(value) integer -- return number of occurrences of value
property dimensions: Tuple[int, ...] | Tuple[int]

Dimensions of the array

property full_inst_name: str

The full hierarchical systemRDL name of the instance

index(value[, start[, stop]]) integer -- return first index of value.

Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

property inst_name: str

systemRDL name of the instance in the parent

items() Iterator[Tuple[Tuple[int, ...], NodeArrayElementType]]

iterate through all the items in an array but also return the index of the array

property parent: Node | NodeArray | None

parent of the node or field, or None if it has no parent

single_write() Generator[Self, None, None]

Context manager to allow multiple field reads/write to be done with a single set of field operations

Args:

Returns:

property size: int

Total Number of bytes of address the array occupies

property stride: int

address stride of the array

property width: int

The width of the register in bits, this uses the regwidth systemRDL property

Returns: register width

class peakrdl_python.lib.register.RegReadWriteArray(*, logger_handle: str, inst_name: str, parent: RegFile | AddressMap | MemoryReadWrite, address: int, width: int, accesswidth: int, stride: int, dimensions: Tuple[int, ...], elements: Dict[Tuple[int, ...], RegReadWrite] | None = None)

base class for a array of read and write registers

property accesswidth: int

The access width of the register in bits, this uses the accesswidth systemRDL property

Returns: register access width

property address: int

address of the node

count(value) integer -- return number of occurrences of value
property dimensions: Tuple[int, ...] | Tuple[int]

Dimensions of the array

property full_inst_name: str

The full hierarchical systemRDL name of the instance

index(value[, start[, stop]]) integer -- return first index of value.

Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

property inst_name: str

systemRDL name of the instance in the parent

items() Iterator[Tuple[Tuple[int, ...], NodeArrayElementType]]

iterate through all the items in an array but also return the index of the array

property parent: Node | NodeArray | None

parent of the node or field, or None if it has no parent

single_read_modify_write(verify: bool = False, skip_write: bool = False) Generator[Self, None, None]

Context manager to allow multiple field reads/write to be done with a single set of field operations

Parameters:
  • verify (bool) – very the write with a read afterwards

  • skip_write (bool) – skip the write back at the end

Returns:

property size: int

Total Number of bytes of address the array occupies

property stride: int

address stride of the array

property width: int

The width of the register in bits, this uses the regwidth systemRDL property

Returns: register width

Register Fields

class peakrdl_python.lib.fields.FieldReadOnly(*, parent_register: RegReadOnly | RegReadWrite, size_props: FieldSizeProps, misc_props: FieldMiscProps, logger_handle: str, inst_name: str)

class for a read only register field

Parameters:
  • parent_register – register within which the field resides

  • size_props – object defining the msb, lsb, high bit, low bit and width

  • logger_handle – name to be used logging messages associate with this object

property bitmask: int

The bit mask needed to extract the field from its register

For example a register field occupying bits 7 to 4 in a 16-bit register will have a bit mask of 0x00F0

decode_read_value(value: int) int

extracts the field value from a register value, by applying the bit mask and shift needed

Parameters:

value – value to decode, normally read from a register

Returns:

field value

property default: int | None

The default value of the field

This returns None: - if the field is not reset. - if the register resets to a signal value tht can not be determined

property full_inst_name: str

The full hierarchical systemRDL name of the instance

property high: int

low index of the bit range of the field in the parent register

Note

The first bit in the register is bit 0

property inst_name: str

systemRDL name of the instance in the parent

property inverse_bitmask: int

The bitwise inverse of the bitmask needed to extract the field from its register

For example a register field occupying bits 7 to 4 in a 16-bit register will have a inverse bit mask of 0xFF0F

property is_volatile: bool

The HW volatility of the field

property low: int

low index of the bit range of the field in the parent register

Note

The first bit in the register is bit 0

property lsb: int

bit position of the least significant bit (lsb) of the field in the parent register

Note

fields can be defined as msb in bit 0 or as lsb in bit 0

property lsb0: bool

The field can either be lsb0 or msb0

Returns: true if lsb0

property max_value: int

maximum unsigned integer value that can be stored in the field

For example:

  • 8-bit field returns 0xFF (255)

  • 16-bit field returns 0xFFFF (65535)

  • 32-bit field returns 0xFFFF_FFFF (4294967295)

property msb: int

bit position of the most significant bit (msb) of the field in the parent register

Note

fields can be defined as msb in bit 0 or as lsb in bit 0

property msb0: bool

The field can either be lsb0 or msb0

Returns: true if msb0

property parent: Node | NodeArray | None

parent of the node or field, or None if it has no parent

property parent_register: RegReadOnly | RegReadWrite

parent register the field is placed in

read() int

Reads the register that this field is located in and retries the field value applying the required masking and shifting

Returns:

field value

property register_data_width: int

The width of the register within which the field resides in bits

property width: int

The width of the field in bits

class peakrdl_python.lib.fields.FieldWriteOnly(*, parent_register: RegWriteOnly | RegReadWrite, size_props: FieldSizeProps, misc_props: FieldMiscProps, logger_handle: str, inst_name: str)

class for a write only register field

Parameters:
  • parent_register – register within which the field resides

  • size_props – object defining the msb, lsb, high bit, low bit and width

  • logger_handle – name to be used logging messages associate with this object

property bitmask: int

The bit mask needed to extract the field from its register

For example a register field occupying bits 7 to 4 in a 16-bit register will have a bit mask of 0x00F0

property default: int | None

The default value of the field

This returns None: - if the field is not reset. - if the register resets to a signal value tht can not be determined

encode_write_value(value: int) int

Check that a value is legal for the field and then encode it in preparation to be written to the register

Parameters:

value – field value

Returns:

value which can be applied to the register to update the field

property full_inst_name: str

The full hierarchical systemRDL name of the instance

property high: int

low index of the bit range of the field in the parent register

Note

The first bit in the register is bit 0

property inst_name: str

systemRDL name of the instance in the parent

property inverse_bitmask: int

The bitwise inverse of the bitmask needed to extract the field from its register

For example a register field occupying bits 7 to 4 in a 16-bit register will have a inverse bit mask of 0xFF0F

property is_volatile: bool

The HW volatility of the field

property low: int

low index of the bit range of the field in the parent register

Note

The first bit in the register is bit 0

property lsb: int

bit position of the least significant bit (lsb) of the field in the parent register

Note

fields can be defined as msb in bit 0 or as lsb in bit 0

property lsb0: bool

The field can either be lsb0 or msb0

Returns: true if lsb0

property max_value: int

maximum unsigned integer value that can be stored in the field

For example:

  • 8-bit field returns 0xFF (255)

  • 16-bit field returns 0xFFFF (65535)

  • 32-bit field returns 0xFFFF_FFFF (4294967295)

property msb: int

bit position of the most significant bit (msb) of the field in the parent register

Note

fields can be defined as msb in bit 0 or as lsb in bit 0

property msb0: bool

The field can either be lsb0 or msb0

Returns: true if msb0

property parent: Node | NodeArray | None

parent of the node or field, or None if it has no parent

property parent_register: RegWriteOnly | RegReadWrite

parent register the field is placed in

property register_data_width: int

The width of the register within which the field resides in bits

property width: int

The width of the field in bits

write(value: int) None

The behaviour of this method depends on whether the field is located in a readable register or not:

If the register is readable, the method will perform a read-modify-write on the register updating the field with the value provided

If the register is not writable all other field values will be written with zero.

Parameters:

value – field value to update to

class peakrdl_python.lib.fields.FieldReadWrite(*, parent_register: RegReadWrite, size_props: FieldSizeProps, misc_props: FieldMiscProps, logger_handle: str, inst_name: str)

class for a read/write register field

Parameters:
  • parent_register – register within which the field resides

  • size_props – object defining the msb, lsb, high bit, low bit and width

  • logger_handle – name to be used logging messages associate with this object

property bitmask: int

The bit mask needed to extract the field from its register

For example a register field occupying bits 7 to 4 in a 16-bit register will have a bit mask of 0x00F0

decode_read_value(value: int) int

extracts the field value from a register value, by applying the bit mask and shift needed

Parameters:

value – value to decode, normally read from a register

Returns:

field value

property default: int | None

The default value of the field

This returns None: - if the field is not reset. - if the register resets to a signal value tht can not be determined

encode_write_value(value: int) int

Check that a value is legal for the field and then encode it in preparation to be written to the register

Parameters:

value – field value

Returns:

value which can be applied to the register to update the field

property full_inst_name: str

The full hierarchical systemRDL name of the instance

property high: int

low index of the bit range of the field in the parent register

Note

The first bit in the register is bit 0

property inst_name: str

systemRDL name of the instance in the parent

property inverse_bitmask: int

The bitwise inverse of the bitmask needed to extract the field from its register

For example a register field occupying bits 7 to 4 in a 16-bit register will have a inverse bit mask of 0xFF0F

property is_volatile: bool

The HW volatility of the field

property low: int

low index of the bit range of the field in the parent register

Note

The first bit in the register is bit 0

property lsb: int

bit position of the least significant bit (lsb) of the field in the parent register

Note

fields can be defined as msb in bit 0 or as lsb in bit 0

property lsb0: bool

The field can either be lsb0 or msb0

Returns: true if lsb0

property max_value: int

maximum unsigned integer value that can be stored in the field

For example:

  • 8-bit field returns 0xFF (255)

  • 16-bit field returns 0xFFFF (65535)

  • 32-bit field returns 0xFFFF_FFFF (4294967295)

property msb: int

bit position of the most significant bit (msb) of the field in the parent register

Note

fields can be defined as msb in bit 0 or as lsb in bit 0

property msb0: bool

The field can either be lsb0 or msb0

Returns: true if msb0

property parent: Node | NodeArray | None

parent of the node or field, or None if it has no parent

property parent_register: RegReadWrite

parent register the field is placed in

read() int

Reads the register that this field is located in and retries the field value applying the required masking and shifting

Returns:

field value

property register_data_width: int

The width of the register within which the field resides in bits

property width: int

The width of the field in bits

write(value: int) None

The behaviour of this method depends on whether the field is located in a readable register or not:

If the register is readable, the method will perform a read-modify-write on the register updating the field with the value provided

If the register is not writable all other field values will be written with zero.

Parameters:

value – field value to update to

class peakrdl_python.lib.fields.FieldEnumReadOnly(*, parent_register: RegReadOnly | RegReadWrite, size_props: FieldSizeProps, misc_props: FieldMiscProps, logger_handle: str, inst_name: str)

class for a read only register field with an enumerated value

property bitmask: int

The bit mask needed to extract the field from its register

For example a register field occupying bits 7 to 4 in a 16-bit register will have a bit mask of 0x00F0

decode_read_value(value: int) int

extracts the field value from a register value, by applying the bit mask and shift needed

Parameters:

value – value to decode, normally read from a register

Returns:

field value

property default: int | None

The default value of the field

This returns None: - if the field is not reset. - if the register resets to a signal value tht can not be determined

abstract property enum_cls: EnumType

The enumeration class for this field

property full_inst_name: str

The full hierarchical systemRDL name of the instance

property high: int

low index of the bit range of the field in the parent register

Note

The first bit in the register is bit 0

property inst_name: str

systemRDL name of the instance in the parent

property inverse_bitmask: int

The bitwise inverse of the bitmask needed to extract the field from its register

For example a register field occupying bits 7 to 4 in a 16-bit register will have a inverse bit mask of 0xFF0F

property is_volatile: bool

The HW volatility of the field

property low: int

low index of the bit range of the field in the parent register

Note

The first bit in the register is bit 0

property lsb: int

bit position of the least significant bit (lsb) of the field in the parent register

Note

fields can be defined as msb in bit 0 or as lsb in bit 0

property lsb0: bool

The field can either be lsb0 or msb0

Returns: true if lsb0

property max_value: int

maximum unsigned integer value that can be stored in the field

For example:

  • 8-bit field returns 0xFF (255)

  • 16-bit field returns 0xFFFF (65535)

  • 32-bit field returns 0xFFFF_FFFF (4294967295)

property msb: int

bit position of the most significant bit (msb) of the field in the parent register

Note

fields can be defined as msb in bit 0 or as lsb in bit 0

property msb0: bool

The field can either be lsb0 or msb0

Returns: true if msb0

property parent: Node | NodeArray | None

parent of the node or field, or None if it has no parent

property parent_register: RegReadOnly | RegReadWrite

parent register the field is placed in

read() int

Reads the register that this field is located in and retries the field value applying the required masking and shifting

Returns:

field value

property register_data_width: int

The width of the register within which the field resides in bits

property width: int

The width of the field in bits

class peakrdl_python.lib.fields.FieldEnumWriteOnly(*, parent_register: RegWriteOnly | RegReadWrite, size_props: FieldSizeProps, misc_props: FieldMiscProps, logger_handle: str, inst_name: str)

class for a write only register field with an enumerated value

property bitmask: int

The bit mask needed to extract the field from its register

For example a register field occupying bits 7 to 4 in a 16-bit register will have a bit mask of 0x00F0

property default: int | None

The default value of the field

This returns None: - if the field is not reset. - if the register resets to a signal value tht can not be determined

encode_write_value(value: int) int

Check that a value is legal for the field and then encode it in preparation to be written to the register

Parameters:

value – field value

Returns:

value which can be applied to the register to update the field

abstract property enum_cls: EnumType

The enumeration class for this field

property full_inst_name: str

The full hierarchical systemRDL name of the instance

property high: int

low index of the bit range of the field in the parent register

Note

The first bit in the register is bit 0

property inst_name: str

systemRDL name of the instance in the parent

property inverse_bitmask: int

The bitwise inverse of the bitmask needed to extract the field from its register

For example a register field occupying bits 7 to 4 in a 16-bit register will have a inverse bit mask of 0xFF0F

property is_volatile: bool

The HW volatility of the field

property low: int

low index of the bit range of the field in the parent register

Note

The first bit in the register is bit 0

property lsb: int

bit position of the least significant bit (lsb) of the field in the parent register

Note

fields can be defined as msb in bit 0 or as lsb in bit 0

property lsb0: bool

The field can either be lsb0 or msb0

Returns: true if lsb0

property max_value: int

maximum unsigned integer value that can be stored in the field

For example:

  • 8-bit field returns 0xFF (255)

  • 16-bit field returns 0xFFFF (65535)

  • 32-bit field returns 0xFFFF_FFFF (4294967295)

property msb: int

bit position of the most significant bit (msb) of the field in the parent register

Note

fields can be defined as msb in bit 0 or as lsb in bit 0

property msb0: bool

The field can either be lsb0 or msb0

Returns: true if msb0

property parent: Node | NodeArray | None

parent of the node or field, or None if it has no parent

property parent_register: RegWriteOnly | RegReadWrite

parent register the field is placed in

property register_data_width: int

The width of the register within which the field resides in bits

property width: int

The width of the field in bits

write(value: int) None

The behaviour of this method depends on whether the field is located in a readable register or not:

If the register is readable, the method will perform a read-modify-write on the register updating the field with the value provided

If the register is not writable all other field values will be written with zero.

Parameters:

value – field value to update to

class peakrdl_python.lib.fields.FieldEnumReadWrite(*, parent_register: RegReadWrite, size_props: FieldSizeProps, misc_props: FieldMiscProps, logger_handle: str, inst_name: str)

class for a read/write register field with an enumerated value

property bitmask: int

The bit mask needed to extract the field from its register

For example a register field occupying bits 7 to 4 in a 16-bit register will have a bit mask of 0x00F0

decode_read_value(value: int) int

extracts the field value from a register value, by applying the bit mask and shift needed

Parameters:

value – value to decode, normally read from a register

Returns:

field value

property default: int | None

The default value of the field

This returns None: - if the field is not reset. - if the register resets to a signal value tht can not be determined

encode_write_value(value: int) int

Check that a value is legal for the field and then encode it in preparation to be written to the register

Parameters:

value – field value

Returns:

value which can be applied to the register to update the field

abstract property enum_cls: EnumType

The enumeration class for this field

property full_inst_name: str

The full hierarchical systemRDL name of the instance

property high: int

low index of the bit range of the field in the parent register

Note

The first bit in the register is bit 0

property inst_name: str

systemRDL name of the instance in the parent

property inverse_bitmask: int

The bitwise inverse of the bitmask needed to extract the field from its register

For example a register field occupying bits 7 to 4 in a 16-bit register will have a inverse bit mask of 0xFF0F

property is_volatile: bool

The HW volatility of the field

property low: int

low index of the bit range of the field in the parent register

Note

The first bit in the register is bit 0

property lsb: int

bit position of the least significant bit (lsb) of the field in the parent register

Note

fields can be defined as msb in bit 0 or as lsb in bit 0

property lsb0: bool

The field can either be lsb0 or msb0

Returns: true if lsb0

property max_value: int

maximum unsigned integer value that can be stored in the field

For example:

  • 8-bit field returns 0xFF (255)

  • 16-bit field returns 0xFFFF (65535)

  • 32-bit field returns 0xFFFF_FFFF (4294967295)

property msb: int

bit position of the most significant bit (msb) of the field in the parent register

Note

fields can be defined as msb in bit 0 or as lsb in bit 0

property msb0: bool

The field can either be lsb0 or msb0

Returns: true if msb0

property parent: Node | NodeArray | None

parent of the node or field, or None if it has no parent

property parent_register: RegReadWrite

parent register the field is placed in

read() int

Reads the register that this field is located in and retries the field value applying the required masking and shifting

Returns:

field value

property register_data_width: int

The width of the register within which the field resides in bits

property width: int

The width of the field in bits

write(value: int) None

The behaviour of this method depends on whether the field is located in a readable register or not:

If the register is readable, the method will perform a read-modify-write on the register updating the field with the value provided

If the register is not writable all other field values will be written with zero.

Parameters:

value – field value to update to