You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Synthesis tools usually can infer the optimal encoding for a finite state machine (FSM) described in SystemVerilog or VHDL. However, this does not seem to be the case for the SV generated by Chisel/firtool. In certain designs, especially with a larger state, the state equality checks can increase the critical path delay.
This PR adds a new ChiselEnum subclass named OneHotEnum with explicit one-hot encoding and optimized value checks (a new.is and also the existing .isOneOf).
Contributor Checklist
Did you add Scaladoc to every public function/method?
Did you add at least one test demonstrating the PR?
Did you delete any extraneous printlns/debugging code?
Did you specify the type of improvement?
Did you add appropriate documentation in docs/src?
Did you request a desired merge strategy?
Did you add text to be included in the Release Notes for this change?
Type of Improvement
Feature (or new API)
Desired Merge Strategy
Squash: The PR will be squashed and merged (choose this if you have no preference).
Release Notes
Reviewer Checklist (only modified by reviewer)
Did you add the appropriate labels? (Select the most appropriate one based on the "Type of Improvement")
Did you mark the proper milestone (Bug fix: 3.6.x, 5.x, or 6.x depending on impact, API modification or big change: 7.0)?
Did you review?
Did you check whether all relevant Contributor checkboxes have been checked?
Did you do one of the following when ready to merge:
Squash: You/ the contributor Enable auto-merge (squash) and clean up the commit message.
Merge: Ensure that contributor has cleaned up their commit history, then merge with Create a merge commit.
Binary incompatibility is due to the change in isOneOf signature. isOneOf is moved to Type and now expects the same Type as arguments. I think this is definitely better, but I'm open to rolling back to EnumType if that's desired (and also actually solves the issue).
I've implemented a similar feature here a long time ago: #2261 Maybe can be useful.
Hi Carlos,
Sorry I should have searched through the PRs before submitting. Your PR looks great. I like the ChiselEnum1H naming too.
This is certainly very useful feature and, from my own experience, it can help with the timing of many designs.
I wonder if we can get some feedback from @jackkoenig, @seldridge, and @sequencer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Synthesis tools usually can infer the optimal encoding for a finite state machine (FSM) described in SystemVerilog or VHDL. However, this does not seem to be the case for the SV generated by Chisel/firtool. In certain designs, especially with a larger state, the state equality checks can increase the critical path delay.
This PR adds a new
ChiselEnumsubclass namedOneHotEnumwith explicit one-hot encoding and optimized value checks (a new.isand also the existing.isOneOf).Contributor Checklist
docs/src?Type of Improvement
Desired Merge Strategy
Release Notes
Reviewer Checklist (only modified by reviewer)
3.6.x,5.x, or6.xdepending on impact, API modification or big change:7.0)?Enable auto-merge (squash)and clean up the commit message.Create a merge commit.