[enhancement] DSLX bit type indexing
Open
dslx
enhancement
🧦 sox
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 283
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 135
Description
### What's hard to do? (limit 100 words)
If I try to write:
```
let foo: u23 = u23:0b10;
let bar = foo[1]; // expect u1:1
```
I get:
```
TypeInferenceError: uN[23] Value to index is not an array.
```
### Current best alternative workaround (limit 100 words)
You need to do a roundabout bit slice instead.
```
let bar = foo[1+:u1];
```
### Your view of the "best case XLS enhancement" (limit 100 words)
Support indexing, like we have in arrays. Note that this also works in Verilog and Python (I only reference Python because [the docs do](https://google.github.io/xls/dslx_reference/#bit-slice-expressions:~:text=DSLX%20supports-,Python%2Dstyle,-bit%20slicing%20over)).
Contributor guide
Assessment
This issue has not been assessed yet.