Skip to content

Latest commit

 

History

History
41 lines (29 loc) · 1.12 KB

api.rst

File metadata and controls

41 lines (29 loc) · 1.12 KB

Python API

PeakRDL Python can be used from a python API to generate the python package. This approach may be useful if multiple operations need to be sequenced for example:

  • A build process that has multiple files dependencies

  • A build process that needs other IP-XACT inputs

  • A build process that will use other tools form the PeakRDL Suite, for example:

    • building HTML documentation with PeakRDL HTML
    • building UVM using PeakRDL UVM

Example

The following example shows the compiling an SystemRDL file and then generating the python register access layer using PeakRDL Python.

from systemrdl import RDLCompiler
from peakrdl_python.exporter import PythonExporter

# compile the systemRDL
rdlc = RDLCompiler()
rdlc.compile_file('basic.rdl')
spec = rdlc.elaborate(top_def_name='basic').top

# generate the python package register access layer
exporter = PythonExporter()
exporter.export(node=spec, path='generated_code')

PythonExporter

.. autoclass:: peakrdl_python.exporter.PythonExporter
    :members:
    :special-members: __init__