Skip to content

Commit a621557

Browse files
authored
Merge pull request #323 from pllab/consts-update
Keep user-defined const name after synthesis; error in simulation if only named wires are Consts
2 parents b430e9c + 3b5133c commit a621557

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
@@ -420,7 +420,7 @@ def synthesize(update_working_block=True, merge_io_vectors=True, block=None):
420420
new_name = '_'.join((wirevector.name, 'synth', str(i)))
421421
if isinstance(wirevector, Const):
422422
new_val = (wirevector.val >> i) & 0x1
423-
new_wirevector = Const(bitwidth=1, val=new_val)
423+
new_wirevector = Const(name=new_name, bitwidth=1, val=new_val)
424424
elif isinstance(wirevector, (Input, Output)):
425425
if merge_io_vectors:
426426
new_wirevector = WireVector(name="tmp_" + new_name, bitwidth=1)

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)