Skip to content

Commit 4639f67

Browse files
committed
review tweaks
1 parent bd2ece0 commit 4639f67

7 files changed

Lines changed: 53 additions & 20 deletions

File tree

docs/api/hwio.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ HWIO
55

66
The PyRAL runtime library provides several built-in HWIO classes that you can use
77

8-
.. list-table:: Frozen Delights!
8+
.. list-table::
99
:header-rows: 1
1010

1111
* - Class

docs/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ Links
8080
- `Source repository <https://github.com/SystemRDL/PeakRDL-PyRAL>`_
8181
- `Release Notes <https://github.com/SystemRDL/PeakRDL-PyRAL/releases>`_
8282
- `Issue tracker <https://github.com/SystemRDL/PeakRDL-PyRAL/issues>`_
83-
- `PyPi (Exporter) <https://pypi.org/project/peakrdl-pyral>`_
84-
- `PyPi (Runtime) <https://pypi.org/project/peakrdl-pyral-runtime>`_
83+
- `PyPI (Exporter) <https://pypi.org/project/peakrdl-pyral>`_
84+
- `PyPI (Runtime) <https://pypi.org/project/peakrdl-pyral-runtime>`_
8585
- `SystemRDL Specification <http://accellera.org/downloads/standards/systemrdl>`_
8686

8787

docs/ug/hier-hwio.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ different hierarchical nodes.
2424
from my_soc_ral import my_soc
2525
2626
# Create each HWIO
27+
uio0 = MMapFileHWIO("/dev/uio0")
2728
uio1 = MMapFileHWIO("/dev/uio1")
2829
uio2 = MMapFileHWIO("/dev/uio2")
2930
uio3 = MMapFileHWIO("/dev/uio3")
30-
uio4 = MMapFileHWIO("/dev/uio4")
3131
3232
# Create the RAL
3333
ral = my_soc.get_ral()
3434
3535
# Attach HWIO to the respective components
36-
ral.awesome_A.attach_hwio(uio1)
37-
ral.awesome_B.attach_hwio(uio2)
38-
ral.splendid_X.attach_hwio(uio3)
39-
ral.splendid_Y.attach_hwio(uio4)
36+
ral.awesome_A.attach_hwio(uio0)
37+
ral.awesome_B.attach_hwio(uio1)
38+
ral.splendid_X.attach_hwio(uio2)
39+
ral.splendid_Y.attach_hwio(uio3)

docs/ug/installing.rst

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,30 @@ use-case, you may not need to install both of them every time.
1616
The exported RAL requires additional runtime files to be installed on the
1717
system that will run the RAL & application. This runtime package provides this.
1818

19-
.. todo::
20-
Add instructions on how to install the runtime on a device that cannot fetch from pypi
2119

22-
- pip download command for a specific platform
23-
- copy wheels over
24-
- install within the device
25-
- Mention that installing the runtime as part of the rootfs may be preferred
20+
Installing the runtime without PyPI
21+
------------------------------------
22+
Targets that cannot reach PyPI (embedded devices, air-gapped networks) can still
23+
install ``peakrdl-pyral-runtime`` from wheels you fetch ahead of time.
24+
25+
On a machine with network access, download the wheel as follows:
26+
27+
.. code-block:: bash
28+
29+
mkdir wheels
30+
python3 -m pip download peakrdl-pyral-runtime -d wheels
31+
32+
Since the runtime is implemented in pure Python, the weel is implicitly
33+
platform-independent.
34+
35+
Copy the ``wheels/`` directory to the device, then install from disk without
36+
contacting an index:
37+
38+
.. code-block:: bash
39+
40+
python3 -m pip install --no-index --find-links=wheels peakrdl-pyral-runtime
41+
42+
43+
.. note::
44+
For custom OS images, it is often preferable to install the runtime wheel
45+
during image build so the package included on the rootfs.

docs/ug/key-concepts.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ PeakRDL-PyRAL implements two major abstraction layers: The RAL and HWIO.
1212
Hardware I/O Abstraction Layer (HWIO)
1313
The HWIO layer defines how low-level read/write operations are initiated on
1414
the hardware. A HWIO layer may issue these accesses locally via a direct
15-
memory mapping, via a hardware debugger like JTAG, or even remotely though
15+
memory mapping, via a hardware debugger like JTAG, or even remotely through
1616
an SSH or telnet connection. Alternatively it could call read/write operations
1717
on a bus driver in a simulated environment like cocotb.
1818

pkg-runtime/src/peakrdl_pyral_runtime/dbapi.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,23 @@ def get_ref_dbapi(self, ref_dbid: int) -> "DBAPI":
9494
cur.close()
9595

9696
import_path = row["import_path"]
97-
# TODO: Make sure import errors result in a helpful error.
98-
# Ensure it tells the user what is wrong
99-
ref_module = importlib.import_module(import_path, self.origin_module_name)
100-
new_dbapi: DBAPI = ref_module._get_dbapi()
97+
try:
98+
ref_module = importlib.import_module(import_path, self.origin_module_name)
99+
except ImportError as exc:
100+
raise ImportError(
101+
f"Failed to import grafted PyRAL module '{import_path}' while resolving an "
102+
f"external reference from RAL package '{self.origin_module_name}. "
103+
"Ensure the module is installed and importable, and that PeakRDL "
104+
"--graft-type path provided is correct."
105+
) from exc
106+
107+
get_dbapi = getattr(ref_module, "_get_dbapi", None)
108+
if get_dbapi is None:
109+
raise RuntimeError(
110+
f"Grafted module '{import_path} (imported for RAL '{self.origin_module_name}) "
111+
"does not define _get_dbapi(); expected a PeakRDL-PyRAL generated module."
112+
)
113+
new_dbapi: DBAPI = get_dbapi()
101114

102115
# Child DBAPIs all share a common HWIO registry. Graft it in
103116
new_dbapi.hwio_registry = self.hwio_registry

pkg-runtime/src/peakrdl_pyral_runtime/model/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def _lookup_hwio(self) -> tuple["HWIO", int]:
8080
return self.parent._lookup_hwio()
8181

8282
# Reached root without finding anything
83-
raise LookupError("No HWIF was connected")
83+
raise LookupError("No HWIO was connected")
8484

8585
def attach_hwio(self, hwio: "HWIO") -> None:
8686
"""

0 commit comments

Comments
 (0)