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

Allow width to be specified in target code #420

Merged
merged 3 commits into from
Jul 27, 2021
Merged

Conversation

cmnrd
Copy link
Collaborator

@cmnrd cmnrd commented Jul 21, 2021

This PR extends the grammar slightly so that target code enclosed in {==} can be used in width specifications. For instance:

reactor Foo(a: size_t{8}, b: size_t{2}) {
    input[{=a*b=}] in: size_t;
    output[{=a/b=}] out: size_t;
}

This feature is really handy for some of the more complex connection patterns found in the Savina suite.

This feature is currently only supported in the C++ target. The validator will display an error message if this feature is used in any other target.

@cmnrd cmnrd mentioned this pull request Jul 21, 2021
24 tasks
Copy link
Collaborator

@edwardalee edwardalee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will ever be supportable in the C target and it disables a few static checks, but if you find it valuable, I'm OK with including it. This should be described in the Wiki, perhaps in the Cpp page rather than language specification (?).

Copy link
Contributor

@Soroosh129 Soroosh129 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks good to me as well. Maybe the TypeScript target can also utilize this feature?

@cmnrd
Copy link
Collaborator Author

cmnrd commented Jul 26, 2021

I think it should be documented in the language specification, even if it is only supported in C++ (for now). I will add a description before merging this. BTW, this PR does not really add a new feature, since we can use parameters with target code assignments to assign target code to widths. This PR only makes it more convenient by eliminating the need for creating an additional parameter.

@cmnrd
Copy link
Collaborator Author

cmnrd commented Jul 27, 2021

I added a note to the Multiports and Banks wiki page.

@cmnrd cmnrd merged commit ae6d573 into master Jul 27, 2021
@cmnrd cmnrd deleted the width-given-by-code branch August 20, 2021 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants