From aebb677f7ac7351aeb1a5ed1ad5369832d851ea5 Mon Sep 17 00:00:00 2001 From: David Harris Date: Sun, 6 Mar 2022 13:39:53 +0000 Subject: [PATCH 1/3] Restored setup.sh to use . Working for David. Not sure what is happening for Ben - are you on Bash? --- setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index de048ed60..925d87e83 100755 --- a/setup.sh +++ b/setup.sh @@ -7,7 +7,7 @@ echo "Executing Wally setup.sh" # Path to Wally repository -WALLY=$(dirname $0) +WALLY=$(dirname ${BASH_SOURCE}) export WALLY=$(cd "$WALLY" && pwd) echo \$WALLY set to ${WALLY} From cfa82efccc5b4234d541e87672386db508ed532f Mon Sep 17 00:00:00 2001 From: David Harris Date: Tue, 8 Mar 2022 23:18:18 +0000 Subject: [PATCH 2/3] fma16_testgen.c test cases --- pipelined/src/fma/fma16_testgen.c | 93 ++++++++++++++++++++++++++++++- 1 file changed, 90 insertions(+), 3 deletions(-) diff --git a/pipelined/src/fma/fma16_testgen.c b/pipelined/src/fma/fma16_testgen.c index b294552e6..a5f3e083b 100644 --- a/pipelined/src/fma/fma16_testgen.c +++ b/pipelined/src/fma/fma16_testgen.c @@ -11,6 +11,7 @@ typedef union sp { // lists of tests, terminated with 0x8000 uint16_t easyExponents[] = {15, 0x8000}; uint16_t medExponents[] = {1, 14, 15, 16, 20, 30, 0x8000}; +uint16_t allExponents[] = {1, 15, 16, 30, 31, 0x8000}; uint16_t easyFracts[] = {0, 0x200, 0x8000}; // 1.0 and 1.1 uint16_t medFracts[] = {0, 0x200, 0x001, 0x3FF, 0x8000}; uint16_t zeros[] = {0x0000, 0x8000}; @@ -107,8 +108,8 @@ void genMulTests(uint16_t *e, uint16_t *f, int sgn, char *testName, char *desc, fclose(fptr); } -void genAddTests(uint16_t *e, uint16_t *f, int sgn, char *testName, char *desc) { - int i, j, numCases; +void genAddTests(uint16_t *e, uint16_t *f, int sgn, char *testName, char *desc, int zeroAllowed, int infAllowed, int nanAllowed) { + int i, j, k, numCases; float16_t x, y, z; float16_t cases[100000]; FILE *fptr; @@ -122,7 +123,72 @@ void genAddTests(uint16_t *e, uint16_t *f, int sgn, char *testName, char *desc) x.v = cases[i].v; for (j=0; j Date: Tue, 8 Mar 2022 23:29:29 +0000 Subject: [PATCH 3/3] Added more test cases and rounding modes to fma test generator --- pipelined/src/fma/fma16_testgen.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pipelined/src/fma/fma16_testgen.c b/pipelined/src/fma/fma16_testgen.c index a5f3e083b..a9a26d803 100644 --- a/pipelined/src/fma/fma16_testgen.c +++ b/pipelined/src/fma/fma16_testgen.c @@ -38,7 +38,7 @@ float convFloat(float16_t f16) { void genCase(FILE *fptr, float16_t x, float16_t y, float16_t z, int mul, int add, int negp, int negz, int zeroAllowed, int infAllowed, int nanAllowed) { float16_t result; int op; - char calc[80]; + char calc[80], flags[80]; float32_t x32, y32, z32, r32; float xf, yf, zf, rf; float16_t smallest; @@ -48,8 +48,15 @@ void genCase(FILE *fptr, float16_t x, float16_t y, float16_t z, int mul, int add if (negp) x.v ^= 0x8000; // flip sign of x to negate p if (negz) z.v ^= 0x8000; // flip sign of z to negate z op = mul<<3 | add<<2 | negp<<1 | negz; + softfloat_exceptionFlags = 0; // clear exceptions result = f16_mulAdd(x, y, z); + sprintf(flags, "NV: %d OF: %d UF: %d NX: %d", + (softfloat_exceptionFlags >> 4) % 2, + (softfloat_exceptionFlags >> 2) % 2, + (softfloat_exceptionFlags >> 1) % 2, + (softfloat_exceptionFlags) % 2); + // convert to floats for printing xf = convFloat(x); yf = convFloat(y); @@ -68,7 +75,7 @@ void genCase(FILE *fptr, float16_t x, float16_t y, float16_t z, int mul, int add if (resultmag.v == 0x0000 && !zeroAllowed) fprintf(fptr, "// skip zero: "); if ((resultmag.v == 0x7C00 || resultmag.v == 0x7BFF) && !infAllowed) fprintf(fptr, "// Skip inf: "); if (resultmag.v > 0x7C00 && !nanAllowed) fprintf(fptr, "// Skip NaN: "); - fprintf(fptr, "%04x_%04x_%04x_%02x_%04x // %s\n", x.v, y.v, z.v, op, result.v, calc); + fprintf(fptr, "%04x_%04x_%04x_%02x_%04x_%02x // %s %s\n", x.v, y.v, z.v, op, result.v, softfloat_exceptionFlags, calc, flags); } void prepTests(uint16_t *e, uint16_t *f, char *testName, char *desc, float16_t *cases,