Repository navigation
fix(fpu): integrate FCSR rounding and retired exception flags - #12
Merged
Merged
Conversation
Integrate non-H in-order FCSR aliases, FS legality, static and dynamic rounding, and sticky exception flags at successful retirement. Preserve the existing FS dirty mechanism and leave H and OoO FCSR disabled. Normalize narrow computational operands and results while preserving raw move semantics. Suppress zero-source CSR set/clear writes so status reads do not dirty FP state. Cover both executors and repair RV32 microcoded FP read-width elaboration.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
fflags,frmandfcsrcurrently trap as unimplemented, and the iterative arithmetic units round to nearest-even regardless of the requested mode. Software can neither select dynamic rounding nor read accumulated FP exceptions.For example, adding
1.0 + 2^-53with round-up should return0x3ff0000000000001and set NX. Returning1.0instead changes the numerical result; failing to record NX also hides that rounding occurred.This wires FCSR through both in-order executors:
frm, latch the selected mode, and reject reserved modes before execution.FMA uses the single-rounding implementation from #11. Its flags describe the fused result, not an intermediate multiply.
Integration also exposed a few related problems: zero-source CSRRS/CSRRC still asserted the write port, so reading
fflagswould dirty FS; narrow FP results and raw moves needed consistent boxing/sign extension; and RV32 microcoded FP reads forwarded 64 bits into 32-bit latches. These are fixed here.Scope
Scalar FP on static and microcoded in-order cores, tested with RV32 F and RV64 F/D. H FCSR remains unavailable, and OoO explicitly leaves it disabled until precise FP retirement is implemented. Vector FP status is not included.
No replacement FPU, timing pipeline or board changes.
Testing
Compared against
60b1b2a, using identical tests in fresh processes:Coverage includes 106 new full-core cases, producer/CSR tests, existing FP controls and 52 straddling-fetch regressions. Baseline component adapters only ignore new inputs and supply zero for missing flag outputs.
Both trees use the same fixture corrections: explicit FS initialization, byte-enable-aware memory for word stores, and the correct RV64 sign-extension expectation for
FMV.X.W.