Skip to content

Commit

Permalink
Private names
Browse files Browse the repository at this point in the history
  • Loading branch information
tilk committed Mar 25, 2024
1 parent d0ce64d commit e1976d7
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions amaranth/sim/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,23 @@ def write_vcd(self, vcd_file, gtkw_file=None, *, traces=(), fs_per_delta=0):
file.close()
raise ValueError("Cannot start writing waveforms after advancing simulation time")

for trace in traces:
if isinstance(trace, ValueLike):
trace_cast = Value.cast(trace)
def traverse_traces(traces):
if isinstance(traces, ValueLike):
trace_cast = Value.cast(traces)
for trace_signal in trace_cast._rhs_signals():
if trace_signal.name == "":
if trace_signal is trace:
if trace_signal is traces:
raise TypeError("Cannot trace signal with private name")
else:
raise TypeError(f"Cannot trace signal with private name (within {trace!r})")
raise TypeError(f"Cannot trace signal with private name (within {traces!r})")
elif isinstance(traces, list) or isinstance(traces, tuple):
for trace in traces:
traverse_traces(trace)
elif isinstance(traces, dict):
for trace in traces.values():
traverse_traces(trace)

traverse_traces(traces)

return self._engine.write_vcd(vcd_file=vcd_file, gtkw_file=gtkw_file,
traces=traces, fs_per_delta=fs_per_delta)

0 comments on commit e1976d7

Please sign in to comment.