lowRISC / lowRISC/opentitan

[style] Revisit enum sections in the style guide and consider adding more guidance around casts

Open
#9,569 4 comments 0 reactions 7 assignees View on GitHub

@vogelpi is already working on this.

Since Dec 7, 2021.

Component:Doc Earlgrey-PROD Triaged Priority:P3 Type:Enhancement
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.