google / google/xls

[dslx] Allow struct parametrics to be types other than `u32`

Open
#978 2 comments 0 reactions 0 assignees View on GitHub
dslx enhancement
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

Right now we evaluate all parametric expressions given to a struct as `u32`s, but that's technically too strict a limitation -- although we only allow u32s to appear in e.g. array dimensions when building a type, you could imagine a use case like the following:

```dslx
struct Point {
x: uN[N_U32],
}

fn f(p: Point) -> uN[3] {
p.y
}
```

Note that the value given as N is not used in any type definition, just as a value that we do some computation from.

Note that I'm going to land a change that overly restricts them to all be `u32`s at first to fix #727, then we can loosen from there.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.