Skip to content

Commit

Permalink
doc update
Browse files Browse the repository at this point in the history
  • Loading branch information
amykyta3 committed Nov 8, 2023
1 parent 270ef95 commit bed2881
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 49 deletions.
26 changes: 26 additions & 0 deletions docs/exporter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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")
23 changes: 23 additions & 0 deletions docs/importer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
59 changes: 10 additions & 49 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bed2881

Please sign in to comment.