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

Generate or-and trees for guarded assignments #2024

Closed
wants to merge 2 commits into from

Conversation

rachitnigam
Copy link
Contributor

Instead of generating:

in = g0 ? o1 : 
       g1 ? o2 : 'x

This generates:

in = ({WIDTH{g0}} & o1) |
       ({WIDTH{g1}} & o2) | 0

Note that we have to generate 0 instead of 'x because otherwise the &-| chain will produce an 'x value.

The --emit-mux option simulates the old behavior.

I'm also noticing that a lot of optimizations around guards are now happening within the Verilog backend which is bad. We should move that logic into a pass if possible.

@rachitnigam rachitnigam enabled auto-merge (squash) April 25, 2024 17:22
@rachitnigam
Copy link
Contributor Author

Fixes #1423

@andrewb1999
Copy link
Collaborator

I think if/when this gets merged this should not be made the default yet. As mentioned on slack I have concerns that this will have unintended effects on resource utilization because it makes it harder for synthesis to optimize away guards.

@rachitnigam
Copy link
Contributor Author

Good point! The alternative is generating casex statements which might not have the best support in the simulators we use but should otherwise support the optimization and generation of non-priority logic.

Copy link
Contributor

This pull request has been marked as stale due to inactivity.

Copy link
Contributor

This stale PR is being closed because it has not seen any activity in 7 days. If you're planning to continue work on it, please reopen it and mention how to make progress on it.

@github-actions github-actions bot closed this Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants