Test correct and incorrect type parameters from CVA6#281
Test correct and incorrect type parameters from CVA6#281jrrk2 wants to merge 6 commits intozachjs:masterfrom
Conversation
I'm opting for iverilog's interpretation of the specifications here. The commercial simulators I tested seem to agree.
The latest verion of iverilog enforces declaration ordering more strictly. Update a few test cases to match. sv2v still supports out-of-order items on a best-effort basis.
- refresh GitHub Actions versions - manually install shUnit2 v2.1.8 - more portable usage check - run-all.sh exits on ctrl-c
|
Thanks for sharing this test case! After minimizing the input, I believe this is the sane as #265. |
|
That may be so, and the fix could be complicated, |
|
I've attached my "minimized" version of your example. out.sv.txt To me, it looks like |
This patch contains a standalone set of Ariane (CVA6) System Verilog RISCV processor files to test the type parameter bug in sv2v.
sv2v/test/type_param/sv2v.sh contains the unpatched files and fails with this error:
sv2v: field 'insn' not found in struct packed {
logic x_compressed_valid;
struct packed {
logic [15:0] instr;
logic [1:0] mode;
logic [2:0] id;
} x_compressed_req;
logic x_issue_valid;
struct packed {
logic [31:0] instr;
logic [1:0] mode;
logic [2:0] id;
logic [1:0][63:0] rs;
logic [1:0] rs_valid;
} x_issue_req;
logic x_commit_valid;
struct packed {
logic [2:0] id;
logic x_commit_kill;
} x_commit;
logic x_mem_ready;
struct packed {
logic exc;
logic [5:0] exccode;
} x_mem_resp;
logic x_mem_result_valid;
struct packed {
logic [2:0] id;
logic [63:0] rdata;
logic err;
} x_mem_result;
logic x_result_ready;
}, in expression acc_req_o.insn, within scope acc_dispatcher_20306, near core/acc_dispatcher.sv:213:3
CallStack (from HasCallStack):
error, called at src/Convert/Scoper.hs:376:22 in main:Convert.Scoper
possibly because the converter tries to find struct fields in a type parameter prior to substitution.
The alternative script:
sv2v_patched/test/type_param/sv2v_corrected.sh
uses a patched core/acc_dispatcher.sv which substitutes the default type parameter value directly:
and this generates a plausible output file:
-rw-r--r-- 1 jonathan staff 7496480 23 Apr 10:50 cva6_nonsys.v
However, I don't have a suitable test bench or other methodology to add to the regression suite yet.