From 79d7bb60ead561a4e2ef9c63101beeaf8d5bef5e Mon Sep 17 00:00:00 2001 From: "James E. Stine" Date: Mon, 8 Jan 2024 21:28:47 -0600 Subject: [PATCH 1/2] Address Issue #541 where CVTINT or CMP in testfloat were not checked. The solution was to check inside the nested for loop. This was done to avoid issue related to the values changing between each cvtint or subsequent operation --- testbench/testbench-fp.sv | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/testbench/testbench-fp.sv b/testbench/testbench-fp.sv index 4bc3153df..f710ecd1e 100644 --- a/testbench/testbench-fp.sv +++ b/testbench/testbench-fp.sv @@ -964,12 +964,17 @@ module testbenchfp; // 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) & - ~((ResFlg === AnsFlg | AnsFlg === 5'bx))) begin - errors += 1; - $display("There is an error in %s", Tests[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; + else if ( ((UnitVal === `CVTINTUNIT) | (UnitVal !== `CMPUNIT)) & + ~((ResFlg === AnsFlg | AnsFlg === 5'bx)) ) begin + // ResMatch checks the result as well. It is checked within the + // test to avoid issues related when the values change tests (e.g., f16_eq_rne -> f16_eq_rz) + if (~(ResMatch)) begin + errors += 1; + $display("\nError in %s", Tests[TestNum]); + $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 if (TestVectors[VectorNum][0] === 1'bx & Tests[TestNum] !== "") begin // if reached the eof From f91b749f91da12d64297c33e9059c8cc8ac4b438 Mon Sep 17 00:00:00 2001 From: "James E. Stine" Date: Mon, 8 Jan 2024 22:01:52 -0600 Subject: [PATCH 2/2] Fix typo missed with === on Issue #541 --- testbench/testbench-fp.sv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testbench/testbench-fp.sv b/testbench/testbench-fp.sv index f710ecd1e..46d4ff4b0 100644 --- a/testbench/testbench-fp.sv +++ b/testbench/testbench-fp.sv @@ -964,7 +964,7 @@ module testbenchfp; // 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)) & + else if ( ((UnitVal === `CVTINTUNIT) | (UnitVal === `CMPUNIT)) & ~((ResFlg === AnsFlg | AnsFlg === 5'bx)) ) begin // ResMatch checks the result as well. It is checked within the // test to avoid issues related when the values change tests (e.g., f16_eq_rne -> f16_eq_rz)