Importing Register Definitions

Inheritance diagram of avl_ral._ral.RAL

SystemRDL

AVL-RAL is based on systemrdl. As such AVL-RAL can import register block definitions from the native systemrdl file format.

The systemrdl-compiler library is used under-the-hood, which has a complete implementation of the standard.

SystemRDL register definition files are identified by the .ral file extension.

# Create AVL-RAL component
self.ral = avl_ral.RAL("ral", self)

# Import register block definitions
self.ral.load_definition("./myregisters.ral")

IP-XACT

AVL-RAL can also import from IP-XACT XML file format. These are identified by the .xml file extension.

The peakrdl-ipxact library is used for this purpose.

# Create AVL-RAL component
self.ral = avl_ral.RAL("ral", self)

# Import reister block definitions
self.ral.load_definition("./myregisters.xml")

Visualizing

AVL-RAL has added helpful string representations for address maps, registers and fields to help the user.

print(self.ral)

Results in:

AddrMap: simple_block
        Register: STATUS
                Address         : 0xx00000000
                Access Width    : 32
                Register Width  : 32
                Shared          : False
                Field: READY
                        Bits            : [0:0]
                        Reset           : 0
                        Value           : 0
                        SW Access       : R
                        HW Access       : W
                        Current Value   : 0x0
                Field: ERROR_CODE
                        Bits            : [7:4]
                        Reset           : 0
                        Value           : 0
                        SW Access       : R
                        HW Access       : W
                        Current Value   : 0x0
                Field: INT_PEND
                        Bits            : [31:31]
                        Reset           : 0
                        Value           : 0
                        SW Access       : R
                        HW Access       : W
                        Current Value   : 0x0
        Register: CONFIG
                Address         : 0xx00000004
                Access Width    : 32
                Register Width  : 32
                Shared          : False
                Field: EN
                        Bits            : [0:0]
                        Reset           : 0
                        Value           : 0
                        SW Access       : RW
                        HW Access       : R
                        Current Value   : 0x1
                Field: PARAM0
                        Bits            : [15:8]
                        Reset           : 0
                        Value           : 0
                        SW Access       : RW
                        HW Access       : R
                        Current Value   : 0x55
                Field: PARAM1
                        Bits            : [31:16]
                        Reset           : 0
                        Value           : 0
                        SW Access       : RW
                        HW Access       : R
                        Current Value   : 0xbabe

If back-door accesses have been enabled the print will contain the current values.