From bed2881ff89962ab888ee636e362d8a82fbb38f4 Mon Sep 17 00:00:00 2001 From: Alex Mykyta <amykyta3@users.noreply.github.com> Date: Tue, 7 Nov 2023 21:07:30 -0800 Subject: [PATCH] doc update --- docs/exporter.rst | 26 +++++++++++++++++++++ docs/importer.rst | 23 ++++++++++++++++++ docs/index.rst | 59 ++++++++--------------------------------------- 3 files changed, 59 insertions(+), 49 deletions(-) diff --git a/docs/exporter.rst b/docs/exporter.rst index de7ec41..445e145 100644 --- a/docs/exporter.rst +++ b/docs/exporter.rst @@ -36,3 +36,29 @@ API .. autoclass:: peakrdl_ipxact.Standard :members: + +Example +^^^^^^^ +Below is a simple example that shows how to convert a SystemRDL register model +into IP-XACT. + +.. code-block:: python + :emphasize-lines: 3, 13-15, 17 + + import sys + from systemrdl import RDLCompiler, RDLCompileError + from peakrdl_ipxact import IPXACTExporter, Standard + + rdlc = RDLCompiler() + + try: + rdlc.compile_file("path/to/my.rdl") + root = rdlc.elaborate() + except RDLCompileError: + sys.exit(1) + + exporter = IPXACTExporter( + standard=Standard.IEEE_1685_2014 + ) + + exporter.export(root, "path/to/output.xml") diff --git a/docs/importer.rst b/docs/importer.rst index 9630e11..5c009dd 100644 --- a/docs/importer.rst +++ b/docs/importer.rst @@ -138,3 +138,26 @@ API .. autoclass:: peakrdl_ipxact.IPXACTImporter :special-members: __init__ :members: import_file + + +Example +^^^^^^^ +Below is a simple example of how to import an IP-XACT definition into the +register model. + +.. code-block:: python + :emphasize-lines: 3, 6, 9 + + 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) diff --git a/docs/index.rst b/docs/index.rst index d365148..679ef6e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -19,59 +19,20 @@ Install from `PyPi`_ using pip .. _PyPi: https://pypi.org/project/peakrdl-ipxact +Example +------- +The easiest way to use PeakRDL-ipxact is via the `PeakRDL command line tool <https://peakrdl.readthedocs.io/>`_: -Quick Start ------------ - -Exporting to IP-XACT -^^^^^^^^^^^^^^^^^^^^ -Below is a simple example that shows how to convert a SystemRDL register model -into IP-XACT. - -.. code-block:: python - :emphasize-lines: 3, 13-15, 17 - - import sys - from systemrdl import RDLCompiler, RDLCompileError - from peakrdl_ipxact import IPXACTExporter, Standard - - rdlc = RDLCompiler() - - try: - rdlc.compile_file("path/to/my.rdl") - root = rdlc.elaborate() - except RDLCompileError: - sys.exit(1) - - exporter = IPXACTExporter( - standard=Standard.IEEE_1685_2014 - ) - - exporter.export(root, "path/to/output.xml") - - - -Importing IP-XACT -^^^^^^^^^^^^^^^^^ -Below is a simple example of how to import an IP-XACT definition into the -register model. - -.. code-block:: python - :emphasize-lines: 3, 6, 9 +.. code-block:: bash - import sys - from systemrdl import RDLCompiler, RDLCompileError - from peakrdl_ipxact import IPXACTImporter + # Install the command line tool + python3 -m pip install peakrdl - rdlc = RDLCompiler() - ipxact = IPXACTImporter(rdlc) + # Convert SystemRDL to IP-XACT + peakrdl ip-xact your_design.rdl -o your_design.xml - try: - ipxact.import_file("path/to/my_ipxact.xml") - rdlc.compile_file("path/to/my.rdl") - root = rdlc.elaborate() - except RDLCompileError: - sys.exit(1) + # Convert IP-XACT to SystemRDL + peakrdl systemrdl your_design.xml -o your_design.rdl