Update testbench-fp.sv to check result and flags for cvtint and cmp. This addresses fix for Issue #541. It also adds a temporary fix to avoid issues between tests. This will be fixed in an upcoming push where we use scanf instead of readmemh to help keep compatibility with Verilator. Additional testing is needed of new testbench-fp.sv before can push in new tb with scanf

This commit is contained in:
James E. Stine 2024-01-12 00:32:18 -06:00
parent d31c28e2a3
commit dbe8394651

View File

@ -957,23 +957,15 @@ module testbenchfp;
$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
// 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 // Check for conversion and comparisons
// the riscv spec specifies 2^31-1 for positive values out of range and NaNs ie 7fff... else if (((UnitVal === `CVTINTUNIT) | (UnitVal === `CMPUNIT)) &
else if ( ((UnitVal === `CVTINTUNIT) | (UnitVal === `CMPUNIT)) & ~FlagMatch ) begin ~(ResMatch & FlagMatch) & (Ans[0] !== 1'bx)) begin
// ResMatch & FlagMatch checks the result again. It is checked within the errors += 1;
// test again to avoid issues related when the values change tests (e.g., f16_eq_rne -> f16_eq_rz) $display("\nError in %s", Tests[TestNum]);
if (~(ResMatch & FlagMatch)) begin $display("TestNum %d OpCtrl %d", TestNum, OpCtrl[TestNum]);
errors += 1; $display("inputs: %h %h %h\nSrcA: %h\n Res: %h %h\n Ans: %h %h", X, Y, Z, SrcA, Res, ResFlg, Ans, AnsFlg);
$display("\nError in %s", Tests[TestNum]); $stop;
$display("TestNum %d OpCtrl %d", TestNum, OpCtrl[TestNum]);
$display("inputs: %h %h %h\nSrcA: %h\n Res: %h %h\n Ans: %h %h", X, Y, Z, SrcA, Res, ResFlg, Ans, AnsFlg);
$stop;
end
end end
if (TestVectors[VectorNum][0] === 1'bx & Tests[TestNum] !== "") begin // if reached the eof if (TestVectors[VectorNum][0] === 1'bx & Tests[TestNum] !== "") begin // if reached the eof