llvm / llvm/circt

[FIRRTL] Use `i0` when creating `hw.array_get` ops for singleton arrays

Open
#4,018 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

FIRRTL
Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

Currently, hw.array_get allows for both i0 and i1-typed values for singleton arrays https://github.com/llvm/circt/blob/727209a748563e8767c91068010f03a3d6d84847/include/circt/Dialect/HW/HWAggregates.td#L121 This is a special case added alongside #3985 to provide a transition period for FIRRTL. Eventually, FIRRTLToHW should be modified to remove any special-case logic around singleton arrays, which in turn will allow the type constraint to be made unambiguous.

An additional benefit of this is that once the i0/i1 type ambiguity is removed for hw.array_get, we can remove the index type from the ODS specifier that was added in #3985 to support this transition period.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the hw.array_get definition in include/circt/Dialect/HW/HWAggregates.td and the FIRRTLToHW conversion entry point. Trace the singleton-array handling and remove its special-case logic so created ops use i0; done means the ODS index type is no longer needed and the array_get type constraint is unambiguous.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.