You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: text/0074-structured-vcd.md
+24-12Lines changed: 24 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,17 +112,34 @@ These images demonstrate the difference in GTKWave output:
112
112
113
113
Currently, Amaranth represents aggregate signals in the VCD by appending the names of elements/members to the name of the signal.
114
114
When simulator output is written to a VCD file, we intend that signals with aggregate datatypes are explicitly given their own scope and split into multiple VCD variables.
115
+
116
+
### Changes to VCD Writing
117
+
115
118
We propose the following conventions:
116
119
117
120
- The `module` scope defines a group of signals belonging to the same `Module`
118
121
- The `vhdl_array` scope defines a group of signals belonging to an array (such as a signal with `ArrayLayout`)
119
-
- The `vhdl_record` scope defines a structured group of signals (such as a signal with `StructLayout`)
122
+
- The `vhdl_record` scope defines a structured group of signals (such as a signal with `StructLayout`, `UnionLayout`, or `FlexibleLayout`)
123
+
124
+
After these changes, this functionality will be enabled by default in the VCD writer.
125
+
These changes will **not** be backported to Amaranth 0.5.x.
126
+
Users that require compatibility with the pre-RFC behavior are expected to either:
127
+
128
+
- Opt-out on a case-by-case basis by passing arguments to `write_vcd()` (ie. `structured=False`)
129
+
- Opt-out globally by setting an environment variable (ie. `AMARANTH_FLAT_VCD=1`)
120
130
121
-
> **NOTE**: (Implementation details pending)
122
-
> ...
131
+
### Changes to `pyvcd`
123
132
133
+
The VCD writer in Amaranth depends on `pyvcd`, which represents VCD scopes with a `ScopeType` enum.
134
+
`vhdl_record` and `vhdl_array` variants are required to implement this RFC.
124
135
125
-
### Expected Output: Array-like
136
+
### Changes to Amaranth Playground
137
+
138
+
The Amaranth Playground has a waveform viewer that depends on the [`d3-wave`](https://github.com/Nic30/d3-wave) library.
139
+
`d3-wave` has an exported/extensible `RowRendererBits` class that can be used to implement renderers for particular datatypes.
140
+
Custom renderers for aggregate datatypes are required for rendering grouped signals in the Amaranth Playground.
141
+
142
+
### Expected VCD Output: Array-like
126
143
127
144
```python
128
145
from amaranth import*
@@ -143,7 +160,7 @@ $scope vhdl_array foo $end
143
160
$upscope $end
144
161
```
145
162
146
-
### Expected Output: Struct-like
163
+
### Expected VCD Output: Struct-like
147
164
148
165
```python
149
166
from amaranth import*
@@ -167,7 +184,7 @@ $scope vhdl_record bar $end
167
184
$upscope $end
168
185
```
169
186
170
-
### Expected Output: Nested Aggregates
187
+
### Expected VCD Output: Nested Aggregates
171
188
172
189
```python
173
190
from amaranth import*
@@ -228,12 +245,7 @@ $upscope $end
228
245
## Unresolved questions
229
246
[unresolved-questions]: #unresolved-questions
230
247
231
-
- Should we continue to include the "flattened" [pure bit-vector] representation of aggregate signals in the VCD?
232
-
- Does this feature need to be gated/opt-in by default?
233
-
234
-
- The simulator currently depends on [westerndigitalcorporation/pyvcd](https://github.com/westerndigitalcorporation/pyvcd) when writing VCD files.
235
-
However, `pyvcd` only emits scope types defined by the VCD specification (and does not include the `vhdl_record`/`vhdl_array` scopes).
236
-
When implementing this RFC, should we continue relying on `pyvcd`, or does this warrant the addition of our own code in the simulator for writing VCD files?
0 commit comments