Helper for llvm::Log2_64_Ceil or 1
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 524
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 46
Description
Since we don't support 0 width wires (https://github.com/llvm/circt/issues/2219), there are a lot of situations where we take the size of something (usually a type), and if it is 1, return 1, else return Log2_64_Ceil. This is common in situations like "How many bits do I need to index into this array?". Because we can't say zero bits for a 1 element array (yet), we use 1 bit. This logic gets sprinkled throughout the codebase (sometimes with alternate styles), to the point that I think it's worth having a helper, potentially in lib/Support, to do this so we have a consistent way of doing it. Good first issue, since it's simple to implement, and hunting down instances of Log2_64_Ceil is a good tour of CIRCT.
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 by searching the codebase for uses of Log2_64_Ceil and review the alternate patterns used for one-element sizes. Consider the proposed helper in lib/Support, then identify the duplicated cases it should unify. Done means the helper provides the consistent behavior and relevant scattered logic uses it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100