Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement] Allow bits type aliases in match statements #1872

Open
mattskl-openai opened this issue Jan 21, 2025 · 0 comments
Open

[enhancement] Allow bits type aliases in match statements #1872

mattskl-openai opened this issue Jan 21, 2025 · 0 comments
Labels
dslx DSLX (domain specific language) implementation / front-end enhancement New feature or request

Comments

@mattskl-openai
Copy link

What's hard to do? (limit 100 words)

const WIDTH = u32:2;
type Val = uN[WIDTH];

fn test(val: Val) -> (bool, bool) {
  match val {
    Val:0 => (true, true),
    Val:1 => (true, false),
    _ => (false, false),
  }
}

Here, val is an actual value rather than enum.

Current best alternative workaround (limit 100 words)

  match val {
    uN[WIDTH]:0 => (true, true),
    uN[WIDTH]:1 => (true, false),
    _ => (false, false),
  }

Your view of the "best case XLS enhancement" (limit 100 words)

Let compiler figure out that Val:0 is equivalent to uN[WIDTH]:0

@mattskl-openai mattskl-openai added the enhancement New feature or request label Jan 21, 2025
@cdleary cdleary added the dslx DSLX (domain specific language) implementation / front-end label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dslx DSLX (domain specific language) implementation / front-end enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

2 participants