Skip to content

Commit 3b5133c

Browse files
committed
Keep user-defined const name after synthesis; error in simulation if only named wires are consts
1 parent 6217c96 commit 3b5133c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

pyrtl/passes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ def synthesize(update_working_block=True, block=None):
408408
new_name = '_'.join((wirevector.name, 'synth', str(i)))
409409
if isinstance(wirevector, Const):
410410
new_val = (wirevector.val >> i) & 0x1
411-
new_wirevector = Const(bitwidth=1, val=new_val)
411+
new_wirevector = Const(name=new_name, bitwidth=1, val=new_val)
412412
elif isinstance(wirevector, (Input, Output)):
413413
new_wirevector = WireVector(name="tmp_" + new_name, bitwidth=1)
414414
else:

pyrtl/simulation.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,8 +1001,9 @@ def is_internal_name(name):
10011001
elif wires_to_track == 'all':
10021002
wires_to_track = self.block.wirevector_set
10031003

1004-
if not len(wires_to_track):
1005-
raise PyrtlError("There needs to be at least one named wire "
1004+
non_const_tracked = list(filter(lambda w: not isinstance(w, Const), wires_to_track))
1005+
if not len(non_const_tracked):
1006+
raise PyrtlError("There needs to be at least one named non-constant wire "
10061007
"for simulation to be useful")
10071008
self.wires_to_track = wires_to_track
10081009
self.trace = TraceStorage(wires_to_track)

0 commit comments

Comments
 (0)