Files
yosys/tests/various/json_netnames_signed.ys
T
John Kearney 0f5efca3c9 json: read 'signed' attribute on netnames, matching ports
The JSON backend writes "signed": 1 for any signed wire, including
internal nets. The frontend only parsed the attribute for ports,
so a write-read roundtrip silently cleared is_signed on internal
nets. Signed internal wires became unsigned between the two passes.

Fix: parse 'signed' in the netnames loop, next to the existing
upto/offset handling. Regression test does a full roundtrip and
checks the internal signed wire survives.
2026-08-20 22:20:24 -07:00

9 lines
463 B
Plaintext

! mkdir -p temp
read_verilog json_netnames_signed.v
write_json temp/json_netnames_signed_r1.json
design -reset
read_json temp/json_netnames_signed_r1.json
write_json temp/json_netnames_signed_r2.json
# the internal signed wire t must survive the roundtrip with signedness intact
! python3 -c "import json; d=json.load(open('temp/json_netnames_signed_r2.json')); assert d['modules']['top']['netnames']['t'].get('signed') == 1, 'signedness lost on internal net t'"