diff --git a/amaranth/lib/data.py b/amaranth/lib/data.py
index 5f9fe37..aaa0a06 100644
--- a/amaranth/lib/data.py
+++ b/amaranth/lib/data.py
@@ -267,7 +267,21 @@ class StructLayout(Layout):
For example, the following layout of a 16-bit value:
- .. image:: _images/data/struct_layout.svg
+ .. wavedrom:: data/struct_layout
+
+ {
+ "reg": [
+ {"name": ".first", "bits": 3},
+ {"name": ".second", "bits": 7},
+ {"name": ".third", "bits": 6}
+ ],
+ "config": {
+ "lanes": 1,
+ "compact": true,
+ "vflip": true,
+ "hspace": 650
+ }
+ }
can be described with:
@@ -344,7 +358,23 @@ class UnionLayout(Layout):
For example, the following layout of a 7-bit value:
- .. image:: _images/data/union_layout.svg
+ .. wavedrom:: data/union_layout
+
+ {
+ "reg": [
+ {"name": ".third", "bits": 6},
+ {"name": "", "bits": 1, "type": 1},
+ {"name": ".second", "bits": 7},
+ {"name": ".first", "bits": 3},
+ {"name": "", "bits": 4, "type": 1}
+ ],
+ "config": {
+ "lanes": 3,
+ "compact": true,
+ "vflip": true,
+ "hspace": 289.4375
+ }
+ }
can be described with:
@@ -419,7 +449,22 @@ class ArrayLayout(Layout):
For example, the following layout of a 16-bit value:
- .. image:: _images/data/array_layout.svg
+ .. wavedrom:: data/array_layout
+
+ {
+ "reg": [
+ {"name": "[0]", "bits": 4},
+ {"name": "[1]", "bits": 4},
+ {"name": "[2]", "bits": 4},
+ {"name": "[3]", "bits": 4}
+ ],
+ "config": {
+ "lanes": 1,
+ "compact": true,
+ "vflip": true,
+ "hspace": 650
+ }
+ }
can be described with:
@@ -502,7 +547,28 @@ class FlexibleLayout(Layout):
For example, the following layout of a 16-bit value:
- .. image:: _images/data/flexible_layout.svg
+ .. wavedrom:: data/flexible_layout
+
+ {
+ "reg": [
+ {"name": "", "bits": 14, "type": 1},
+ {"name": "[0]", "bits": 1},
+ {"name": "", "bits": 1, "type": 1},
+ {"name": "", "bits": 10, "type": 1},
+ {"name": ".third", "bits": 6},
+ {"name": ".second", "bits": 7},
+ {"name": "", "bits": 9, "type": 1},
+ {"name": "", "bits": 1, "type": 1},
+ {"name": ".first", "bits": 3},
+ {"name": "", "bits": 12, "type": 1}
+ ],
+ "config": {
+ "lanes": 4,
+ "compact": true,
+ "vflip": true,
+ "hspace": 650
+ }
+ }
can be described with:
diff --git a/docs/_static/custom.css b/docs/_static/custom.css
index 053d59e..1c92c8a 100644
--- a/docs/_static/custom.css
+++ b/docs/_static/custom.css
@@ -22,4 +22,10 @@ a { text-decoration: underline; }
.rst-content pre.literal-block, .rst-content div[class^="highlight"] pre, .rst-content .linenodiv pre { white-space: pre-wrap; }
/* Work around https://github.com/readthedocs/sphinx_rtd_theme/issues/1301 */
-.py.property { display: block !important; }
\ No newline at end of file
+.py.property { display: block !important; }
+
+/* Work around images in docstrings being glued to the paragraph underneath */
+.rst-content section dd>img { margin-bottom: 24px; }
+
+/* No switchable color schemes */
+img { color-scheme: light; }
diff --git a/docs/conf.py b/docs/conf.py
index 3c5240a..3dbf9f9 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -46,8 +46,6 @@ napoleon_custom_sections = [
"Platform overrides"
]
-yowasp_wavedrom_skin = "light"
-
html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]
html_css_files = ["custom.css"]
diff --git a/docs/stdlib/_images/data/array_layout.svg b/docs/stdlib/_images/data/array_layout.svg
deleted file mode 100644
index 6e4131e..0000000
--- a/docs/stdlib/_images/data/array_layout.svg
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
diff --git a/docs/stdlib/_images/data/flexible_layout.svg b/docs/stdlib/_images/data/flexible_layout.svg
deleted file mode 100644
index 6e78a1e..0000000
--- a/docs/stdlib/_images/data/flexible_layout.svg
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
diff --git a/docs/stdlib/_images/data/rgb565_layout.svg b/docs/stdlib/_images/data/rgb565_layout.svg
deleted file mode 100644
index b10c898..0000000
--- a/docs/stdlib/_images/data/rgb565_layout.svg
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
diff --git a/docs/stdlib/_images/data/struct_layout.svg b/docs/stdlib/_images/data/struct_layout.svg
deleted file mode 100644
index ad9bf03..0000000
--- a/docs/stdlib/_images/data/struct_layout.svg
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
diff --git a/docs/stdlib/_images/data/union_layout.svg b/docs/stdlib/_images/data/union_layout.svg
deleted file mode 100644
index e94c3ae..0000000
--- a/docs/stdlib/_images/data/union_layout.svg
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
diff --git a/docs/stdlib/data.rst b/docs/stdlib/data.rst
index 198e8b1..cc3af24 100644
--- a/docs/stdlib/data.rst
+++ b/docs/stdlib/data.rst
@@ -39,7 +39,21 @@ The fundamental Amaranth type is a :class:`Value`: a sequence of bits that can a
For example, consider a module that processes pixels, converting them from RGB to grayscale. The color pixel format is RGB565:
-.. image:: _images/data/rgb565_layout.svg
+.. wavedrom:: data/rgb565_layout
+
+ {
+ "reg": [
+ {"name": ".red", "bits": 5, "type": 2},
+ {"name": ".green", "bits": 6, "type": 3},
+ {"name": ".blue", "bits": 5, "type": 4}
+ ],
+ "config": {
+ "lanes": 1,
+ "compact": true,
+ "vflip": true,
+ "hspace": 650
+ }
+ }
This module could be implemented (using a fast but *very* approximate method) as follows:
diff --git a/pyproject.toml b/pyproject.toml
index c32bddc..763e1a7 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -71,7 +71,7 @@ test = [
docs = [
"sphinx~=7.1",
"sphinxcontrib-platformpicker~=1.3",
- "sphinxcontrib-yowasp-wavedrom~=1.1",
+ "sphinxcontrib-yowasp-wavedrom==1.4", # exact version to avoid changes in rendering
"sphinx-rtd-theme~=2.0",
"sphinx-autobuild",
]