FPU: Set FPSCR[FPRF] to zero for convert to integer operations

This seems to be what P9 does.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
pull/457/head
Paul Mackerras 2 months ago
parent 2f29daab2d
commit 0e11f80f2f

@ -713,9 +713,13 @@ architecture behaviour of fpu is
end;

-- Determine result flags to write into the FPSCR
function result_flags(sign: std_ulogic; class: fp_number_class; unitbit: std_ulogic)
function result_flags(sign: std_ulogic; class: fp_number_class; int_result: std_ulogic;
unitbit: std_ulogic)
return std_ulogic_vector is
begin
if int_result = '1' then
return "00000";
else
case class is
when ZERO =>
return sign & "0010";
@ -726,6 +730,7 @@ architecture behaviour of fpu is
when NAN =>
return "10001";
end case;
end if;
end;

begin
@ -3651,7 +3656,7 @@ begin
end if;

if r.update_fprf = '1' then
v.fpscr(FPSCR_C downto FPSCR_FU) := result_flags(r.res_sign, r.result_class,
v.fpscr(FPSCR_C downto FPSCR_FU) := result_flags(r.res_sign, r.result_class, r.int_result,
r.r(UNIT_BIT) and not r.denorm);
end if;


Loading…
Cancel
Save