Importer
Importing IP-XACT definitions can occur at any point alongside normal SystemRDL
file compilation. When an IP-XACT file is imported, the register description is
loaded into the SystemRDL register model as if it were an addrmap
component
declaration. Once imported, the IP-XACT contents can be used as-is, or
referenced from another RDL file.
Since the target register used internally uses SystemRDL semantics, the import operation does a ‘best effort’ attempt to faithfully map the concepts described in IP-XACT into SystemRDL objects.
The importer will automatically detect the IP-XACT standard used and will attempt to translate as much of the document into the SystemRDL object model as possible.
IP-XACT |
Resulting SystemRDL |
|
---|---|---|
Components |
<memoryMap> |
A named The definition’s type name is defined by the concatenation of the parent component’s <name> and memoryMap’s <name>. For example: The named definition is imported into the root SystemRDL namespace. |
<addressBlock> |
If the addressBlock’s <usage> tag specifies “memory”, then a named
The definition’s type name is defined by the concatenation of the enclosing component’s <name>, the parent memoryMap’s <name> and the addressBlock’s <name>. For example: The named definition is imported into the root SystemRDL namespace. The definition is also instantiated in the |
|
<registerFile> |
|
|
<register> |
|
|
<field> |
|
|
Fields |
<enumeratedValues> |
Creates an |
<access> |
If a <field> does not explicitly define <access>, it may inherit it from the enclosing <register> or <addressBlock>’s <access> tag |
|
<testable> |
|
|
<readAction> |
|
|
<modifiedWriteValue> |
|
|
Other |
<displayName> |
|
<description> |
|
|
<isPresent> |
|
Possible Transformations
Some of IP-XACTs semantics are slightly more permissive than SystemRDL. Since the importer must translate concepts to conform with SystemRDL rules, some transformations may be performed:
IP-XACT’s rules for <name> identifiers allows for colon (:), dash (-) and dot (.) characters. The importer will automatically sanitize IP-XACT names so that they conform to SystemRDL semantics by replacing these additional characters with underscores (_)
IP-XACT allows registers to be any arbitrary bit width, but SystemRDL requires the
regwidth
property to be at least 8, and a power of 2. The importedregwidth
may be padded up as necessary.IP-XACT allows a register to contain multiple fields with the same name. If this is detected, the importer will uniquify the instance names based on the fields’ bit ranges.
Any empty register model nodes are discarded. This can be due to a register not containing any fields, or register file or address map structures not containing any child components.
Remap States
The IP-XACT standard allows a document to capture memory remap states that describe which subsets of an address space is visible from a particular bus interface or operational state. (See IP-XACT’s <memoryRemap> elements)
Since SystemRDL is designed to only capture a monolithic snapshot of an address
space, it may be necessary to provide a remap_state
parameter to the importer
in order to show otherwise hidden <addressBlock> elements.
API
- class peakrdl_ipxact.IPXACTImporter(compiler: RDLCompiler)
- __init__(compiler: RDLCompiler)
- Parameters:
compiler – Reference to
RDLCompiler
instance to bind the importer to.
- import_file(path: str, remap_state: str | None = None) None
Import a single SPIRIT or IP-XACT file into the SystemRDL namespace.
- Parameters:
path – Input SPIRIT or IP-XACT XML file.
remap_state – Optional remapState string that is used to select memoryRemap regions that are tagged under a specific remap state.
Example
Below is a simple example of how to import an IP-XACT definition into the register model.
import sys
from systemrdl import RDLCompiler, RDLCompileError
from peakrdl_ipxact import IPXACTImporter
rdlc = RDLCompiler()
ipxact = IPXACTImporter(rdlc)
try:
ipxact.import_file("path/to/my_ipxact.xml")
rdlc.compile_file("path/to/my.rdl")
root = rdlc.elaborate()
except RDLCompileError:
sys.exit(1)