llvm / llvm/circt

[FIRRTL] Cannot index into giant vector (2^32 elements)

Open
#5,603 0 comments 0 reactions 0 assignees View on GitHub
FIRRTL
Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

("Should indexing operations have 64bit operands?")

We support large vectors, and the FieldIDTypeInterface uses 64bit fields (especially important for vector-of-vector-...).

However indexing operations are only 32bit so we cannot index into these, consider:

```firrtl
circuit Field64:
module Field64:
input x : UInt<1>[4294967296]
output y : UInt
y <= x[4294967295]
```

Which we reject during parsing:
```
field64.fir:5:12: error: value is too big to handle
y <= x[4294967295]
^
```

The same input parses (although don't recommend pushing through the pipeline) if not indexed into (drop last two lines).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the FIRRTL example with the 2^32-element vector and indexing expression, then trace the parser and indexing handling for the reported 32-bit limit. Done means the example is accepted with a 64-bit index operand while the existing non-indexed large-vector input continues to parse correctly.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.