Python API

If you want to embed this tool into your own script, you can do so with the following API.

Example

The following example shows how to compile a SystemRDL file and then generate the Erlang modules and header using the Python API.

from systemrdl import RDLCompiler
from peakrdl_beam.exporter import ErlangExporter

# compile the SystemRDL
rdlc = RDLCompiler()
rdlc.compile_file('example.rdl')
top = rdlc.elaborate()

# generate the Erlang module and header
exporter = ErlangExporter()
exporter.export(node=top, path='out.erl')

Exporter Class

class peakrdl_beam.exporter.ErlangExporter
export(node: RootNode | AddrmapNode, path: str, **kwargs: Any) None
Parameters:
  • node (AddrmapNode) – Top-level SystemRDL node to export.

  • path (str) – Output header file path

  • flavor (BeamLanguage) – Select which supported BEAM language to use

  • bitfield_order_ltoh (bool) – The packing order of C struct bitfields is implementation defined. If True, packing will assume low-to-high bit-packing order.