Incorporated jstine fixes of FPU special case and testbench for conversion

This commit is contained in:
David Harris 2024-01-15 07:25:08 -08:00
parent 50b7ddb450
commit 9e78a7e290
2 changed files with 100 additions and 111 deletions

View File

@ -315,8 +315,7 @@ module specialcase import cvw::*; #(parameter cvw_t P) (
else
if(Xs&~NaNIn) OfIntRes = {P.XLEN{1'b1}}; // unsigned negative
else OfIntRes = {P.XLEN{1'b1}}; // unsigned positive
end // if (P.IEEE754)
else begin
end else begin
always_comb
if(Signed)
if(Xs&~NaNIn) // signed negative
@ -328,7 +327,7 @@ module specialcase import cvw::*; #(parameter cvw_t P) (
else
if(Xs&~NaNIn) OfIntRes = {P.XLEN{1'b0}}; // unsigned negative
else OfIntRes = {P.XLEN{1'b1}}; // unsigned positive
end // else: !if(P.IEEE754)
end
// select the integer output

View File

@ -956,18 +956,8 @@ module testbenchfp;
$display("TestNum %d OpCtrl %d", TestNum, OpCtrl[TestNum]);
$display("inputs: %h %h %h\nSrcA: %h\n Res: %h %h\n Expected: %h %h", X, Y, Z, SrcA, Res, ResFlg, Ans, AnsFlg);
$stop;
end
// TestFloat sets the result to all 1's when there is an invalid result, however in
// http://www.jhauser.us/arithmetic/TestFloat-3/doc/TestFloat-general.html it says
// for an unsigned integer result 0 is also okay
// TestFloat outputs 800... for both the largest integer values for both positive and negitive numbers but
// the riscv spec specifies 2^31-1 for positive values out of range and NaNs ie 7fff...
else if ( ((UnitVal === `CVTINTUNIT) | (UnitVal === `CMPUNIT)) & ~FlagMatch ) begin
// ResMatch & FlagMatch checks the result again. It is checked within the
// test again to avoid issues related when the values change tests (e.g., f16_eq_rne -> f16_eq_rz)
if (~(ResMatch & FlagMatch)) begin
end else if (((UnitVal === `CVTINTUNIT) | (UnitVal === `CMPUNIT)) &
~(ResMatch & FlagMatch) & (Ans[0] !== 1'bx)) begin // Check for conversion and comparisons
errors += 1;
$display("\nError in %s", Tests[TestNum]);
$display("TestNum %d OpCtrl %d", TestNum, OpCtrl[TestNum]);