[ExportVerilog] Incorrect verilog output for bitcast + zero width aggregate types
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 524
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 46
Description
We are emitting zero bit width array/struct as one bit element. This is problem when we use bitcast for them.
```mlir
hw.module @top(%source: i1) -> (b: !hw.struct, c: i1>) {
%cast = hw.bitcast %source: (i1) -> !hw.struct, c: i1>
hw.output %cast : !hw.struct, c: i1>
}
```
```sv
module top( // out.mlir:2:3
input source,
output struct packed {logic [0:0]/*Zero Width*/ zero; logic c; } b);
assign b = source; // out.mlir:3:12, :4:5
endmodule
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the ExportVerilog path that lowers the provided MLIR bitcast involving a zero-width array and struct, and reproduce the example from the issue. Trace how zero-width aggregate fields are represented in the generated SystemVerilog. Done means the example no longer emits a one-bit [0:0] field for the zero-width aggregate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100