Skip to content

Commit ff9c63d

Browse files
committed
RFC #74: Update from feedback
1 parent ce7c5c1 commit ff9c63d

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

text/0074-structured-vcd.md

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,34 @@ These images demonstrate the difference in GTKWave output:
112112

113113
Currently, Amaranth represents aggregate signals in the VCD by appending the names of elements/members to the name of the signal.
114114
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+
115118
We propose the following conventions:
116119

117120
- The `module` scope defines a group of signals belonging to the same `Module`
118121
- 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`)
120130

121-
> **NOTE**: (Implementation details pending)
122-
> ...
131+
### Changes to `pyvcd`
123132

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.
124135

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
126143

127144
```python
128145
from amaranth import *
@@ -143,7 +160,7 @@ $scope vhdl_array foo $end
143160
$upscope $end
144161
```
145162

146-
### Expected Output: Struct-like
163+
### Expected VCD Output: Struct-like
147164

148165
```python
149166
from amaranth import *
@@ -167,7 +184,7 @@ $scope vhdl_record bar $end
167184
$upscope $end
168185
```
169186

170-
### Expected Output: Nested Aggregates
187+
### Expected VCD Output: Nested Aggregates
171188

172189
```python
173190
from amaranth import *
@@ -228,12 +245,7 @@ $upscope $end
228245
## Unresolved questions
229246
[unresolved-questions]: #unresolved-questions
230247

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?
248+
None.
237249

238250
## Future possibilities
239251
[future-possibilities]: #future-possibilities

0 commit comments

Comments
 (0)