Conversation
dmem.v assigns we_mem and mem_out inside always @* blocks while
declaring we_mem a wire and leaving mem_out an implicit net. A net
cannot be the target of a procedural assignment (IEEE 1364-2005 6.1.2,
IEEE 1800-2023 6.5). yosys's Verilog frontend accepts it and infers the
variable; slang rejects it, nine times:
dmem.v:33:10: error: cannot assign to a net within a procedural context
so riscv32i cannot be read with SYNTH_HDL_FRONTEND=slang.
The declarations are fixed, not the code: `reg [3:0] we_mem` and
`output reg [31:0] mem_out`, which is what both frontends build. The
always blocks and drivers are unchanged. The file keeps its CRLF line
endings.
flow/test/test_riscv32i_slang.py reads the riscv32i sources with
read_slang, a black-box module standing in for the fakeram7_256x32
macro the flow takes from liberty, and asserts slang accepts them. It
fails before this change, and skips where no yosys with read_slang is
available (YOSYS_EXE or yosys on PATH, SLANG_PLUGIN_PATH for the
plugin).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
There was a problem hiding this comment.
Code Review
This pull request updates the Verilog module in dmem.v to declare mem_out and we_mem as reg instead of wire, ensuring compliance with stricter Verilog compilers like slang which require signals assigned in always blocks to be variables. It also introduces a new test suite test_riscv32i_slang.py to verify this compatibility. The feedback recommends wrapping the source file paths in double quotes to properly handle paths containing spaces and adding a timeout to the subprocess execution to prevent potential hangs during CI runs.
🔍 QoR checkMetrics reflect the PR merge build — i.e. what will land on the target branch. Commit 62 design(s) checked — 0 with regression(s), 0 without a comparable baseline. |
What
flow/designs/src/riscv32i/dmem.vassignswe_memandmem_outinsidealways @*blocks while declaringwe_memawireand leavingmem_outan implicit net. A net cannot be the target of a procedural assignment (IEEE 1364-2005 6.1.2, IEEE 1800-2023 6.5). yosys's Verilog frontend accepts it; slang rejects it nine times:so riscv32i cannot be read with
SYNTH_HDL_FRONTEND=slang.Fix
The declarations:
reg [3:0] we_memandoutput reg [31:0] mem_out, which is what both frontends build. Always blocks and drivers unchanged. The file keeps its CRLF line endings.Test
New
flow/test/test_riscv32i_slang.pyreads the riscv32i sources withread_slang(a black-box module standing in for thefakeram7_256x32macro the flow takes from liberty) and asserts slang accepts them.read_slangis available (YOSYS_EXEoryosysonPATH,SLANG_PLUGIN_PATHfor the plugin), which includes the Python-only util test job.🤖 Generated with Claude Code