[style] Revisit enum sections in the style guide and consider adding more guidance around casts
@vogelpi is already working on this.
Since Dec 7, 2021.
- Dominant language
- SystemVerilog
- Stars
- 3.6k
- Forks
- 1.1k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 141
Description
As recent discussions (#9391) have shown, we may need more guidance around enum casting in our style guide.
This issue is intended for collecting concerns and ideas so that they can eventually be translated to recommendations.
1. One concern surfaced in #9391 is how tools will actually synthesize a cast from a logic vector to an enum type of the same size, but with fewer allowed states. I.e., will the synthesis tools "filter" any out of range value and collapse them to one enum representation. This is spun out into its own issue (#9568), since we need feedback from tooling vendors for this.
1. Another concern recently brought up by @tjaychen is (please add more detail if necessary): How do we catch enum to enum typecasts where the length is mismatched. A cast will silence associated lint warning, since the conversion is made explicit. At the same time, the explicit cast may cut off bits if the width is mismatched - and this can go unnoticed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.