Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ExportVerilog] Unpacked array assignment to wire #6363

Closed
teqdruid opened this issue Nov 1, 2023 · 1 comment · Fixed by #4548
Closed

[ExportVerilog] Unpacked array assignment to wire #6363

teqdruid opened this issue Nov 1, 2023 · 1 comment · Fixed by #4548

Comments

@teqdruid
Copy link
Contributor

teqdruid commented Nov 1, 2023

hw.module @top() {
  %10 = hw.aggregate_constant [120 : i8, -38 : i8] : !hw.uarray<2xi8>
  hw.instance "e" @Ext(a: %10: !hw.uarray<2xi8>) -> ()
  hw.output
}
hw.module.extern @Ext(in %a: !hw.uarray<2xi8>)

Run through --export-verilog produces:

module top();	// test.mlir:1:1
  wire [7:0] _GEN[0:1] = '{8'h78, 8'hDA};	// test.mlir:2:9
  Ext e (	// test.mlir:3:3
    .a (_GEN)	// test.mlir:2:9
  );
endmodule

Which Verilator (4.110 and 5.018) chokes on:

%Error: test.sv:3:24: syntax error, unexpected '=', expecting ',' or ';'
    3 |   wire [7:0] _GEN[0:1] = '{8'h78, 8'hDA};

Changing wire to logic or reg eliminates that error message.

This may just be Verilator. Questa likes it, but Questa is very permissive. Icarus (iverilog) doesn't like assigning unpacked arrays at all so I have to break out all of the individual assignments to get it to not complain. I don't know what the spec says (but it doesn't matter). Do other simulators accept this?

@uenoku
Copy link
Member

uenoku commented Nov 1, 2023

Yeah, VCS accepts this. had a PR to make verilator happy #4548 so I'll rebase it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants