chipsalliance / chipsalliance/chisel
Fill 0 returns type instead of value
- Dominant language
- Scala
- Stars
- 4.8k
- Forks
- 658
- Avg merge
- 18h 59m
- Merged PRs (30d)
- 14
Description
**Type of issue**: bug report | feature request
**Impact**: no functional change (code could technically rely on this behavior but it would be super weird)
**Development Phase**: request
**Other information**
**If the current behavior is a bug, please provide the steps to reproduce the problem:**
**What is the current behavior?**
`chisel3.util.Fill` when given `n = 0` returns `UInt(0.W)` which is a type rather than a value which it returns for `n >= 1`: https://github.com/freechipsproject/chisel3/blob/387274784115bee2bf7167547a7ee459219e1413/src/main/scala/chisel3/util/Bitwise.scala#L68
**What is the expected behavior?**
Ideally this would return a zero-width-wire which would then go away, but since support for that is lacking, it should probably just error in the meantime.
**What is the use case for changing the behavior?**
Better error messages and with zero-width wire support, cleaner generators that don't have to special case zero.
Contributor guide
Research direction
Start at src/main/scala/chisel3/util/Bitwise.scala around line 68 and inspect how chisel3.util.Fill handles n = 0 versus n >= 1. Confirm the intended interim behavior for zero-width input, then verify that Fill no longer returns a type as a value and provides the expected error or handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100