Skip to content

FPU: prevent a coprocessor divide/sqrt from corrupting scalar FP registers - #3813

Open
emiliengnr wants to merge 1 commit into
chipsalliance:masterfrom
emiliengnr:fix-fpu-cp-divsqrt-scalar-regfile
Open

FPU: prevent a coprocessor divide/sqrt from corrupting scalar FP registers#3813
emiliengnr wants to merge 1 commit into
chipsalliance:masterfrom
emiliengnr:fix-fpu-cp-divsqrt-scalar-regfile

Conversation

@emiliengnr

@emiliengnr emiliengnr commented Jul 2, 2026

Copy link
Copy Markdown

Hello, here is a pull request for a bug I found.

In src/main/scala/tile/FPU.scala the shared divide/sqrt writeback selects its address and
data with divSqrt_wen and uses them for both the scalar register file and the coprocessor
response, without checking whether the completion belongs to the coprocessor. A coprocessor
divide/sqrt result can therefore land in a scalar FP register, either when no scalar write
is pending or when a scalar pipelined result writes back on the same cycle and loses the
shared address and data. The fix gives the scalar write separate sources selected only for a
scalar divide/sqrt (divSqrt_wen && !divSqrt_cp) and leaves io.cp_resp unchanged, matching
the !wbInfo(0).cp guard the pipelined path already uses. It is reachable on any core that
attaches a coprocessor on the shared divide/sqrt path, and was found with the Saturn vector
unit as Rocket's coprocessor.

Related issue: none

Type of change: bug report

Impact: no functional change

Development Phase: implementation

Release Notes
Fixed the shared FPU divide/sqrt writeback so a coprocessor divide/sqrt result no longer corrupts a scalar floating-point register.

@linux-foundation-easycla

linux-foundation-easycla Bot commented Jul 2, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: emiliengnr / name: Emilien Garnier (edc8cfa)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant