Skip to content

Commit

Permalink
sim.pysim: admit non-signals in write_vcd(traces=...).
Browse files Browse the repository at this point in the history
Rather than requiring each additional requested trace to be a signal,
all of the signals in the provided value are added to the GTKW file and
to the VCD file if they are not already there. This improves usability
for `lib.data` as struct fields can now be added to traces.
  • Loading branch information
whitequark committed Nov 28, 2023
1 parent c6000b1 commit b0b193f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions amaranth/sim/pysim.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ def __init__(self, fragment, *, vcd_file, gtkw_file=None, traces=()):

trace_names = SignalDict()
for trace in traces:
if trace not in signal_names:
trace_names[trace] = {("bench", trace.name)}
self.traces.append(trace)
for trace_signal in trace._rhs_signals():
if trace_signal not in signal_names:
trace_names[trace_signal] = {("bench", trace_signal.name)}
self.traces.append(trace_signal)

if self.vcd_writer is None:
return
Expand Down

0 comments on commit b0b193f

Please sign in to comment.