mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Incorporated jstine fixes of FPU special case and testbench for conversion
This commit is contained in:
parent
50b7ddb450
commit
9e78a7e290
@ -315,8 +315,7 @@ module specialcase import cvw::*; #(parameter cvw_t P) (
|
|||||||
else
|
else
|
||||||
if(Xs&~NaNIn) OfIntRes = {P.XLEN{1'b1}}; // unsigned negative
|
if(Xs&~NaNIn) OfIntRes = {P.XLEN{1'b1}}; // unsigned negative
|
||||||
else OfIntRes = {P.XLEN{1'b1}}; // unsigned positive
|
else OfIntRes = {P.XLEN{1'b1}}; // unsigned positive
|
||||||
end // if (P.IEEE754)
|
end else begin
|
||||||
else begin
|
|
||||||
always_comb
|
always_comb
|
||||||
if(Signed)
|
if(Signed)
|
||||||
if(Xs&~NaNIn) // signed negative
|
if(Xs&~NaNIn) // signed negative
|
||||||
@ -328,7 +327,7 @@ module specialcase import cvw::*; #(parameter cvw_t P) (
|
|||||||
else
|
else
|
||||||
if(Xs&~NaNIn) OfIntRes = {P.XLEN{1'b0}}; // unsigned negative
|
if(Xs&~NaNIn) OfIntRes = {P.XLEN{1'b0}}; // unsigned negative
|
||||||
else OfIntRes = {P.XLEN{1'b1}}; // unsigned positive
|
else OfIntRes = {P.XLEN{1'b1}}; // unsigned positive
|
||||||
end // else: !if(P.IEEE754)
|
end
|
||||||
|
|
||||||
|
|
||||||
// select the integer output
|
// select the integer output
|
||||||
|
@ -956,18 +956,8 @@ module testbenchfp;
|
|||||||
$display("TestNum %d OpCtrl %d", TestNum, OpCtrl[TestNum]);
|
$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);
|
$display("inputs: %h %h %h\nSrcA: %h\n Res: %h %h\n Expected: %h %h", X, Y, Z, SrcA, Res, ResFlg, Ans, AnsFlg);
|
||||||
$stop;
|
$stop;
|
||||||
end
|
end else if (((UnitVal === `CVTINTUNIT) | (UnitVal === `CMPUNIT)) &
|
||||||
|
~(ResMatch & FlagMatch) & (Ans[0] !== 1'bx)) begin // Check for conversion and comparisons
|
||||||
// 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
|
|
||||||
errors += 1;
|
errors += 1;
|
||||||
$display("\nError in %s", Tests[TestNum]);
|
$display("\nError in %s", Tests[TestNum]);
|
||||||
$display("TestNum %d OpCtrl %d", TestNum, OpCtrl[TestNum]);
|
$display("TestNum %d OpCtrl %d", TestNum, OpCtrl[TestNum]);
|
||||||
|
Loading…
Reference in New Issue
Block a user