[circt-verilog] zero parameter at module declaration fails when used
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 524
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 46
Description
I have a mmu.sv module for RISC-V implementation:
```Verilog
module mmu #(
parameter integer DEVICE_COUNT = 0
) (
...
output logic [31:2] dev_addr[DEVICE_COUNT]
...
```
that is used in top module like:
```Verilog
mmu #(
.DEVICE_COUNT(8)
) mmu (
...
.dev_addr(
'{
rom_addr,
ram_addr[0],
ram_addr[1],
ram_addr[2],
ram_addr[3],
led_addr,
mtime_addr,
mtimecmp_addr
}
...
```
when trying to compile with `circt-verilog mmu.sv` i get this error:
```bash
core/mmu.sv:17:34: error: value must be positive
output logic [31:2] dev_addr[DEVICE_COUNT],
```
is it impossible to compile such module? why so?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the reported error with the mmu.sv example using circt-verilog, focusing on the parameterized dev_addr array dimension and DEVICE_COUNT=0. Compare the behavior when the module is instantiated with DEVICE_COUNT=8, then determine whether zero-sized dimensions should compile or receive a clearer diagnostic.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100