Skip to content

Commit 6fb5f3f

Browse files
committed
docs/memory: use wavedrom directive for diagrams.
1 parent 7936b87 commit 6fb5f3f

File tree

5 files changed

+61
-65
lines changed

5 files changed

+61
-65
lines changed

docs/conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"sphinx.ext.napoleon",
1818
"sphinx_rtd_theme",
1919
"sphinxcontrib.platformpicker",
20+
"sphinxcontrib.yowasp_wavedrom",
2021
]
2122

2223
with open(".gitignore") as f:
@@ -45,6 +46,8 @@
4546
"Platform overrides"
4647
]
4748

49+
yowasp_wavedrom_skin = "light"
50+
4851
html_theme = "sphinx_rtd_theme"
4952
html_static_path = ["_static"]
5053
html_css_files = ["custom.css"]

docs/stdlib/_images/memory/example_fifo.svg

Lines changed: 0 additions & 41 deletions
This file was deleted.

docs/stdlib/_images/memory/example_hello.svg

Lines changed: 0 additions & 22 deletions
This file was deleted.

docs/stdlib/memory.rst

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,25 @@ In the following example, a read-only memory is used to output a fixed message i
7474

7575
In this example, the memory read port is asynchronous, and a change of the address input (labelled `a` on the diagram below) results in an immediate change of the data output (labelled `d`).
7676

77-
.. image:: _images/memory/example_hello.svg
77+
.. wavedrom:: memory/example_hello
78+
79+
{
80+
"signal": [
81+
{"name": "clk",
82+
"wave": "0P............"},
83+
{"name": "rd_port.addr",
84+
"wave": "==============",
85+
"data": [0,1,2,3,4,5,6,7,8,9,10,11,0,1],
86+
"node": ".a"},
87+
{"name": "rd_port.data",
88+
"wave": "==============",
89+
"data": ["H","e","l","l","o"," ","w","o","r","l","d","\\n","H","e"],
90+
"node": ".d"}
91+
],
92+
"edge": [
93+
"a-|d"
94+
]
95+
}
7896
7997

8098
First-in, first-out queue
@@ -112,7 +130,44 @@ In this example, the memory read and write ports are synchronous. A write operat
112130

113131
However, the memory read port is also configured to be *transparent* relative to the memory write port. This means that if a write and a read operation (labelled `t`, `u` respectively) access the same row with address 3, the new contents will be read out, reducing the minimum push-to-pop latency to one cycle, down from two cycles that would be required without the use of transparency.
114132

115-
.. image:: _images/memory/example_fifo.svg
133+
.. wavedrom:: memory/example_fifo
134+
135+
{
136+
"signal": [
137+
{"name": "clk",
138+
"wave": "P........"},
139+
{"name": "push",
140+
"wave": "01..0.10.",
141+
"node": ".x"},
142+
{"name": "wr_port.addr",
143+
"wave": "=.===..=.",
144+
"data": ["0", "1", "2", "3", "4", "5"]},
145+
{"name": "wr_port.data",
146+
"wave": "====..=..",
147+
"data": ["00", "AA", "BB", "CC", "DD"],
148+
"node": ".w....t"},
149+
{"name": "memory[0]",
150+
"wave": "=.=......",
151+
"data": ["00", "AA"],
152+
"node": "..G"},
153+
{"name": "memory[3]",
154+
"wave": "=......=.",
155+
"data": ["00", "DD"],
156+
"node": ".......H"},
157+
{"name": "pop",
158+
"wave": "0..1...0.",
159+
"node": "...y"},
160+
{"name": "rd_port.addr",
161+
"wave": "=...====.",
162+
"data": ["0", "1", "2", "3", "4", "5"]},
163+
{"name": "rd_port.data",
164+
"wave": "=...====.",
165+
"data": ["00", "AA", "BB", "CC", "DD"],
166+
"node": "....r..u"}
167+
], "edge": [
168+
"x-~>G", "w->G", "y-~>r", "t->H", "t->u"
169+
]
170+
}
116171

117172

118173
Memories

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ test = [
7171
docs = [
7272
"sphinx~=7.1",
7373
"sphinxcontrib-platformpicker~=1.3",
74+
"sphinxcontrib-yowasp-wavedrom~=1.1",
7475
"sphinx-rtd-theme~=2.0",
7576
"sphinx-autobuild",
7677
]

0 commit comments

Comments
 (0)