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,19 +713,24 @@ architecture behaviour of fpu is
end; end;


-- Determine result flags to write into the FPSCR -- 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 return std_ulogic_vector is
begin begin
case class is if int_result = '1' then
when ZERO => return "00000";
return sign & "0010"; else
when FINITE => case class is
return (not unitbit) & sign & (not sign) & "00"; when ZERO =>
when INFINITY => return sign & "0010";
return '0' & sign & (not sign) & "01"; when FINITE =>
when NAN => return (not unitbit) & sign & (not sign) & "00";
return "10001"; when INFINITY =>
end case; return '0' & sign & (not sign) & "01";
when NAN =>
return "10001";
end case;
end if;
end; end;


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


if r.update_fprf = '1' then 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); r.r(UNIT_BIT) and not r.denorm);
end if; end if;



Loading…
Cancel
Save