From 09b340e845fc470e557a9c9a4c39bd2eaa54fac4 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Thu, 4 Dec 2025 08:48:27 +1100 Subject: [PATCH] FPU: Update committed FPSCR value correctly The committed FPSCR is updated in the cycle where an FPU instruction signals completion. Since we update the FPRF field in the FPSCR in that same cycle, the value put into r.comm_fpscr needs to include the new FPRF value. Otherwise, a subsequent flush (for example, due to the following instruction being an illegal instruction that has to be emulated) will drop the FPSCR update. Signed-off-by: Paul Mackerras --- fpu.vhdl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fpu.vhdl b/fpu.vhdl index 52b35c2..190f4a3 100644 --- a/fpu.vhdl +++ b/fpu.vhdl @@ -1077,7 +1077,6 @@ begin v.writing_fpr := '0'; v.writing_cr := '0'; v.writing_xer := '0'; - v.comm_fpscr := r.fpscr; v.illegal := '0'; end if; @@ -3728,6 +3727,10 @@ begin v.fpscr(FPSCR_FX) := '1'; end if; + if r.complete = '1' or r.do_intr = '1' then + v.comm_fpscr := v.fpscr; + end if; + if v.instr_done = '1' then if r.state /= IDLE then v.state := IDLE;