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

let bindings for ports and parameters #188

Closed
rachitnigam opened this issue Jun 24, 2023 · 0 comments · Fixed by #257
Closed

let bindings for ports and parameters #188

rachitnigam opened this issue Jun 24, 2023 · 0 comments · Fixed by #257
Assignees
Labels
C: language Component: the Filament language

Comments

@rachitnigam
Copy link
Member

We should add support for let-bindings to name ports and parameters.

Ports

A port let-binding is the same as a bundle of size one:

let p: [G, G+1] 32;
...
if cond {
  p = x.out
} else {
  p = y.out;
}
foo.in = p

Much like bundle types, a port definition of this form needs to have exactly one driver active within any given branch.
With the IR-flow, we can desugar port let-bindings into simple bundle definitions. For now, we'll require that the user provide the type for the port definition (like bundles) and eventually remove the restrictions once we have full type inference.

Parameters

A parameter let-binding allows us to name parameter expressions:

let #P = #K+1;
...
if #P > 10 { ... } else { ... }

This can make some of the code we write today nicer.

@rachitnigam rachitnigam added the C: language Component: the Filament language label Jun 24, 2023
@rachitnigam rachitnigam linked a pull request Jul 9, 2023 that will close this issue
@UnsignedByte UnsignedByte self-assigned this Aug 8, 2023
@UnsignedByte UnsignedByte linked a pull request Aug 8, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: language Component: the Filament language
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants