Skip to content

Commit c30585b

Browse files
wanda-phiwhitequark
authored andcommitted
back.rtlil: Emit proper source location for port-signals.
1 parent 1cb9d43 commit c30585b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

amaranth/back/rtlil.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ def __init__(self, builder, netlist, module, name_map, empty_checker):
289289
self.memories = {} # cell idx -> MemoryInfo
290290
self.value_names = {} # value -> signal or port name
291291
self.value_attrs = {} # value -> dict
292+
self.value_src_loc = {} # value -> source location
292293
self.sigport_wires = {} # signal or port name -> (wire, value)
293294
self.driven_sigports = set() # set of signal or port name
294295
self.nets = {} # net -> (wire name, bit idx)
@@ -372,6 +373,7 @@ def emit_signal_wires(self):
372373
# the design is flattened) will do that anyway, so it doesn't matter.
373374
attrs = self.value_attrs.setdefault(value, {})
374375
attrs.update(signal.attrs)
376+
self.value_src_loc[value] = signal.src_loc
375377

376378
for repr in signal._value_repr:
377379
if repr.path == () and isinstance(repr.format, _repr.FormatEnum):
@@ -399,7 +401,8 @@ def emit_port_wires(self):
399401
signed = named_signals[name].signed
400402
wire = self.builder.wire(width=len(value), signed=signed,
401403
port_id=port_id, port_kind=flow.value,
402-
name=name, attrs=self.value_attrs.get(value, {}))
404+
name=name, attrs=self.value_attrs.get(value, {}),
405+
src=_src(self.value_src_loc.get(value)))
403406
self.sigport_wires[name] = (wire, value)
404407
if flow == _nir.ModuleNetFlow.Output:
405408
continue

0 commit comments

Comments
 (0)