Resolve implicit-width-truncation warnings #3822
All Vouch review confidence checks passed
Residual risk 0.11 = Change Risk (0.74) × (1 − Review Confidence (0.85)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.74 · 362 lines diff across 34 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.90 · 5 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.353
Mass File Touch
mass_file_touch
0.080
Real PR Conversation Timeline
7 items
haltedBitRegs :%= ((haltedBitRegs & ~(hartResumingIdIndex)) & ~(hartIsInResetSync.asUInt))
I personally would use the new truncating connection operator[[1]](https://www.chisel-lang.org/docs/explanations/connectable#connecting-components-with-different-widths) (only defined on
Bits) because with complex expressions on the RHS it can be easy to miss the .squeeze at the end. sink.data :<= (decoded zip sources).foldLeft(0.U(0.W)){ case (result, (d, i)) => result | Mux(i.ready, i.data, 0.U(0.W)}
I'm assuming this only fixes things when
sink.data is 0-width (because 0.U is 1-bit[^1]) so you can probably just do this?[^1]: I want to change it to 0-bit but until implicit truncation is gone that could silently change behavior
If the issue is using older Chisel, that's fine because you can easily copy the implementation of :%= in to rocket-chip, it uses extension methods anyway
Indeed the reason I didn't use :%= was to allow Rocket Chip to continue to work with older Chisel, but copying this implementation in sounds like a great idea.
Ya, that does work, I'll go with this.
Just did this, thanks for the suggestion!
jackkoenig
tynan-jdwk
firtool-1.154.0 and later warn on all implicit width truncations (https://github.com/llvm/circt/pull/10621). These width truncations were flagged in stock Chipyard builds.
The commits in this PR are separated by the type of truncation fix, and the commit messages describe why the fix was made, and why the resulting RTL is equivalent to the existing design.
<!--
Please select the item best describing the pull request in each category and delete the other items.
-->
Related issue: N/A
<!-- choose one -->
Type of change: other enhancement
<!-- choose one -->
Impact: no functional change
<!-- choose one -->
Development Phase: implementation
Release Notes
<!--
Text from here to the end of the body will be considered for inclusion in the release notes for the version containing this pull request.
-->
Resolve implicit-width-truncation warnings