chisel
chisel copied to clipboard
Fix ActualDirection calculation from SpecifiedDirection
In https://github.com/chipsalliance/chisel/pull/2634, we unified the Chisel 2 and Chisel 3 direction semantics, making it legal to have Records where the directionality of elements is mixed (some may be specified, some may be not). The implementation is mostly right, but there was a corner case I came across in https://github.com/chipsalliance/chisel/issues/4204.
Previously, ActualDirection.fromSpecified would return Unspecified for either Unspecified or Flipped input. This in turn resulted in Bundles mixing Unspecified and Outputs as being "bidirectional" despite the fact that they are actually unidirectional (or passive), and similarly for Bundles mixing Flipped with Input.
Now, Unspecified maps to Output and Flip maps to Input. This change makes the direction calculation more consistent albeit at the cost of marking the directions of unspecified Data as Output.
I'm backporting this to 6.x because #4204 will manifest there, but this is a pretty big change to the reported direction of Chisel Data so I don't think we should backport it to other branches.
Contributor Checklist
- [x] Did you add Scaladoc to every public function/method?
- [x] Did you add at least one test demonstrating the PR?
- [x] Did you delete any extraneous printlns/debugging code?
- [x] Did you specify the type of improvement?
- [ ] Did you add appropriate documentation in
docs/src? - [x] Did you request a desired merge strategy?
- [x] Did you add text to be included in the Release Notes for this change?
Type of Improvement
- Bugfix
Desired Merge Strategy
- Squash
Release Notes
Fixes https://github.com/chipsalliance/chisel/issues/4204.
Unspecified direction maps to Output while Flip maps to Input. Previously, ActualDirection.fromSpecified would return Unspecified for either Unspecified or Flipped input. This in turn resulted in Bundles mixing Unspecified and Outputs as being "bidirectional" despite the fact that they are actually unidirectional (or passive).
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, or6.xdepending 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), clean up the commit message, and label withPlease Merge. - [ ] Merge: Ensure that contributor has cleaned up their commit history, then merge with
Create a merge commit.
- [ ] Squash: You/ the contributor