mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
fpu coverage improvements
This commit is contained in:
parent
9d4a14b209
commit
ff055c404c
@ -98,6 +98,6 @@ module cvtshiftcalc import cvw::*; #(parameter cvw_t P) (
|
||||
// determine if the result underflows ??? -> fp
|
||||
// - if the first 1 is shifted out of the result then the result underflows
|
||||
// - can't underflow an integer to fp conversions
|
||||
assign CvtResUf = ($signed(CvtCe) < $signed({{P.NE-$clog2(P.NF){1'b1}}, ResNegNF}))&~XZero&~IntToFp;
|
||||
assign CvtResUf = ($signed(CvtCe) < $signed({{P.NE-$clog2(P.NF){1'b1}}, ResNegNF}))&~XZero; // dh &~IntToFp not necessary because integer to float conversion never underflows
|
||||
|
||||
endmodule
|
||||
|
@ -101,9 +101,9 @@ module fmashiftcalc import cvw::*; #(parameter cvw_t P) (
|
||||
assign Sum2GEFL = $signed(PreNormSumExp) >= $signed((P.NE+2)'(-P.NF2-2+P.BIAS-P.BIAS2)) | ~|PreNormSumExp;
|
||||
always_comb begin
|
||||
case (Fmt)
|
||||
P.FMT: FmaPreResultSubnorm = Sum0LEZ & Sum0GEFL & ~FmaSZero;
|
||||
P.FMT1: FmaPreResultSubnorm = Sum1LEZ & Sum1GEFL & ~FmaSZero;
|
||||
P.FMT2: FmaPreResultSubnorm = Sum2LEZ & Sum2GEFL & ~FmaSZero;
|
||||
P.FMT: FmaPreResultSubnorm = Sum0LEZ & Sum0GEFL; // & ~FmaSZero; // checking sum is not zero is harmless but turns out to be unnecessary
|
||||
P.FMT1: FmaPreResultSubnorm = Sum1LEZ & Sum1GEFL; // & ~FmaSZero;
|
||||
P.FMT2: FmaPreResultSubnorm = Sum2LEZ & Sum2GEFL; // & ~FmaSZero;
|
||||
default: FmaPreResultSubnorm = 1'bx;
|
||||
endcase
|
||||
end
|
||||
|
@ -164,6 +164,28 @@ main:
|
||||
fcvt.s.w ft2, zero
|
||||
fdiv.s ft3, ft1, ft2
|
||||
|
||||
/* These didn't make a difference
|
||||
|
||||
// Test subtraction of identical denormalized numbers with to exercise FmaPreResultSubnorm logic with FmaSZero
|
||||
li t0, 0xFFFFFFFF00000001
|
||||
fmv.w.x ft1, t0 // smallest denorm
|
||||
fsub.s ft1, ft1, ft1 // difference = 0
|
||||
|
||||
li t0, 0x0000000000000001
|
||||
fmv.d.x ft1, t0 // smallest denorm
|
||||
fsub.d ft1, ft1, ft1 // difference = 0
|
||||
|
||||
// Test subtraction of identical denormalized numbers with to exercise FmaPreResultSubnorm logic with FmaSZero
|
||||
li t0, 0xFFFFFFFF00100001
|
||||
fmv.w.x ft1, t0 // almost largest denorm
|
||||
fsub.s ft1, ft1, ft1 // difference = 0
|
||||
|
||||
li t0, 0x0001000000000001
|
||||
fmv.d.x ft1, t0 // smallest denorm
|
||||
fsub.d ft1, ft1, ft1 // difference = 0
|
||||
|
||||
*/
|
||||
|
||||
# Test floating point convert to integer and using result
|
||||
fcvt.w.s t0, f0
|
||||
add t1, t0, t0
|
||||
|
Loading…
Reference in New Issue
Block a user