DFRegister

DFRegister represents a register of a specific DFBlock. Registers have a specified width, broken up into multiple non-overlapping DFRegisterFields. Due to their similarities, DFRegister inherits a lot of its attributes from DFCommand - but gains properties of an address and access constraints. Additionally, as fields are not allowed to overlap, the width parameter of DFCommand is not used and instead the width is derived from the contained DFRegisterFields.

As with every tag, DFRegister inherits from DFBase, so has support for all of the core attributes (id, description, and attributes).

{
    "id": "my_register",
    "description": "Free-form description",
    "attributes": { },
    "offset": 16,
    "access": {
        "bus": "AR",
        "block": "RO",
        "inst": "RW"
    },
    "fields": [ ]
}
Property Usage
offset Offset from the base address of the DFRegisterGroup
access.bus Supported access mode from an external register bus (e.g. AXI4)
access.block Supported access mode from the block
access.inst Supported access mode from instructions executing within the block
fields A list of DFRegisterField objects

For the access parameters, a number of different modes are defined - some of which are only valid for the different access classes:

Mode Bus Block Inst Usage
NONE Y Y Y Access prohibited to this register
RW Y Y Y Read-write access allowed
RO Y Y Y Read-only access allowed
WO Y Y Y Write-only access
AR Y N N Read-only access allowed, with strobe on access
AW Y N N Write-only access allowed, with strobe on write
ARW Y N N Read-write access allowed, with separate strobes for read and write accesses
WC Y N N Write mask to clear bits within a stored value
WS Y N N Write mask to set bits within a stored value

Python API

class designformat.register.DFRegister(id=None, offset=None, bus_access=None, block_access=None, inst_access=None, group=None, description=None)

DesignFormat representation of a register. This is treated as a special case of DFCommand, with extra parameters for its offset and access conditions. However, unlike with commands, register fields should never overlap.

__init__(id=None, offset=None, bus_access=None, block_access=None, inst_access=None, group=None, description=None)

Constructor for the register object

Parameters
  • id – Name of the register

  • offset – Offset from the register group’s base address

  • bus_access – Type of software access to the register (e.g. RW, RO, WO, etc)

  • block_access – Type of hardware access to the register (e.g. RO, WO, …)

  • inst_access – Type of instruction access to the register (e.g. RO, WO, …)

  • group – The parent group of this register

  • description – Human read-able description of the register

dumpObject(project)

Dump out this node so that it can be reloaded

Parameters

project – Project definition used to calculate references

getOffset()

Calculate the total offset of this register from the register bank’s base address, taking into account the parent group’s offset.

getRelativeAddress(remote)

Get the address of this register relative to a port or block somewhere else in the design. This leverages connectivity and address maps to determine how the two points are related.

Parameters

remote – DFPort or DFBlock to measure relative address from

loadObject(obj, root)

Reload this node from passed in object.

Parameters
  • obj – Description of this node

  • root – Root object in the tree

sortFields()

Ensures fields are in ascending bit order - also checks for overlaps.

Javascript API

class DFRegister(id, offset, bus_access, block_access, inst_access, group, description)

DesignFormat representation of a register. This is treated as a special case of DFCommand, with extra parameters for its offset and access conditions. However, unlike with commands, register fields should never overlap.

Constructor for the register object

Arguments
  • id (string) – Name of the register

  • offset (integer) – Offset from the register group’s base address

  • bus_access (string) – Type of software access to the register (e.g. RW, RO, WO, etc)

  • block_access (string) – Type of hardware access to the register (e.g. RO, WO, …)

  • inst_access (string) – Type of instruction access to the register (e.g. RO, WO, …)

  • group (DFRegisterGroup) – The parent group of this register

  • description (string) – Human read-able description of the register

DFRegister.dumpObject(project)

Dump out this node so that it can be reloaded

Arguments
  • project (DFProject) – Project definition used to calculate references

DFRegister.getOffset()

Calculate the total offset of this register from the register bank’s base address, taking into account the parent group’s offset.

DFRegister.getRelativeAddress(remote)

Get the address of this register relative to a port or block somewhere else in the design. This leverages connectivity and address maps to determine how the two points are related.

Arguments
  • remote (DFBase) – DFPort or DFBlock to measure relative address from

DFRegister.loadObject(obj, root, types)

Reload this node from passed in object.

Arguments
  • obj (object) – Description of this node

  • root (DFBase) – Root object in the tree

  • types (object) – Map from class name to class definition

DFRegister.sortFields()

Ensures fields are in ascending bit order - also checks for overlaps.