Open fzhwenzhou opened 6 months ago
Running into a very similar issue while trying to use a packed struct.
iverilog -g2012 -o graph/crossbar.vvp -s crossbar_tb src/defines.sv test/crossbar_tb.sv src/crossbar.sv
src/crossbar.sv:84: assert: elab_expr.cc:2487: failed assertion base_index.size()+1 == net->packed_dimensions()
sh: line 1: 18726 Done /Users/justinzaun/local/brew/Cellar/icarus-verilog/12.0/lib/ivl/ivlpp -L -F"/var/folders/2n/9d_8f0dd7tj6bwwx3tmxrgn80000gn/T//ivrlg212c1da7c" -f"/var/folders/2n/9d_8f0dd7tj6bwwx3tmxrgn80000gn/T//ivrlg12c1da7c" -p"/var/folders/2n/9d_8f0dd7tj6bwwx3tmxrgn80000gn/T//ivrli12c1da7c"
18727 Abort trap: 6 | /Users/justinzaun/local/brew/Cellar/icarus-verilog/12.0/lib/ivl/ivl -C"/var/folders/2n/9d_8f0dd7tj6bwwx3tmxrgn80000gn/T//ivrlh12c1da7c" -C"/Users/justinzaun/local/brew/Cellar/icarus-verilog/12.0/lib/ivl/vvp.conf" -- -
make: *** [test_crossbar] Error 134
Unpacked arrays of packed structs are not yet fully supported. But if you can use a packed array, e.g.
test_t [0:1] tests = '{'{'b0, 'b1}, '{'b1, 'b0}};
that does work.
Packed arrays do work for the sample above, but it DON'T work for the sample where there are packed arrays in the struct.
Sample:
typedef struct packed {
logic [1:0] a, b;
} test_t;
module test;
test_t [0:1] tests = '{'{2'b01, 2'b10}, '{2'b10, 2'b01}};
wire [1:0] w;
assign w = tests[0].a;
endmodule
It throws
test.sv:6: error: Packed array assignment pattern expects 4 element(s) in this context.
test.sv:6: : Found 2 element(s).
test.sv:6: error: Packed array assignment pattern expects 4 element(s) in this context.
test.sv:6: : Found 2 element(s).
2 error(s) during elaboration.
when it is a packed array, and it throws the same error as above when it is an unpacked array.
There is some bug when working out my SystemVerilog project. After reduction, the minimal sample that triggers this error could be:
The detailed output of the error is:
The compiling command is:
Icarus-Verilog version:
uname -a
output for my computer: