This commit is contained in:
David Harris 2022-02-28 20:34:35 +00:00
commit e2abc79f1d
6 changed files with 62 additions and 41 deletions

View File

@ -93,8 +93,13 @@ void printF32(char *msg, float32_t f) {
else sprintf(sci, "%c1.%s x 2^%d", sign, fractstr, exp-127);
//printf ("%s: 0x%08x = %g\n", msg, conv.v, conv.f);
printf ("%s: 0x%08x = %g = %s: Biased Exp %d Fract 0x%lx\n",
msg, conv.v, conv.f, sci, exp, fract);
printf("%s: ", msg);
printf("0x%04x", (conv.v >> 16));
printf("_");
printf("%04x", (conv.v & 0xFF));
printf(" = %g = %s: Biased Exp %d Fract 0x%lx\n", conv.f, sci, exp, fract);
//printf ("%s: 0x%08x = %g = %s: Biased Exp %d Fract 0x%lx\n",
// msg, conv.v, conv.f, sci, exp, fract);
}
void printF64(char *msg, float64_t f) {
@ -118,8 +123,17 @@ void printF64(char *msg, float64_t f) {
else sprintf(sci, "%c1.%s x 2^%d", sign, fractstr, exp-1023);
//printf ("%s: 0x%016lx = %lg\n", msg, conv.v, conv.d);
printf ("%s: 0x%016lx = %lg = %s: Biased Exp %d Fract 0x%lx\n",
msg, conv.v, conv.d, sci, exp, fract);
printf("%s: ", msg);
printf("0x%04x", (conv.v >> 48));
printf("_");
printf("%04x", (conv.v >> 32) & 0xFFFF);
printf("_");
printf("%04x", (conv.v >> 16));
printf("_");
printf("%04x", (conv.v & 0xFFFF));
printf(" = %lg = %s: Biased Exp %d Fract 0x%lx\n", conv.d, sci, exp, fract);
//printf ("%s: 0x%016lx = %lg = %s: Biased Exp %d Fract 0x%lx\n",
// msg, conv.v, conv.d, sci, exp, fract);
}
void printFlags(void) {

View File

@ -12,10 +12,17 @@ typedef union sp {
float f;
} sp;
void printF32(char *msg, float32_t f) {
void printF32 (char *msg, float32_t f) {
sp conv;
int i, j;
conv.v = f.v; // use union to convert between hexadecimal and floating-point views
printf ("%s: 0x%08x = %g\n", msg, conv.v, conv.f);
// Print out nicely
printf("%s: ", msg);
printf("0x%04x", (conv.v >> 16));
printf("_");
printf("%04x", (conv.v & 0xFFFF));
printf(" = %g\n", conv.f);
//printf ("%s: 0x%08x = %g\n", msg, conv.v, conv.f);
}
void printFlags(void) {

View File

@ -1,6 +1,10 @@
beef00b5
000000b6
ffffffb7
00000007 # write access fault with 16 bit write to CLINT
00000005 # read access fault with 16 bit write to CLINT
00000bad
00000007 # write access fault with 8 bit write to CLINT
00000005 # read access fault with 8 bit write to CLINT
00000bad
00000001
00000bad
00000002
@ -1018,7 +1022,3 @@ deadbeef
deadbeef
deadbeef
deadbeef
deadbeef
deadbeef
deadbeef
deadbeef

View File

@ -66,7 +66,7 @@ test_cases:
# | Region | Base Address | Read widths | R | W | X | Cacheable | Idempotent | Atomic |
# | ROM | 0x1000 | Any | YES | NO | YES | YES | NO | NO |
# | CLINT | 0x2000000 | Any | YES | YES | NO | NO | NO | NO |
# | CLINT | 0x2000000 | 32-bit | YES | YES | NO | NO | NO | NO |
# | PLIC | 0xC000000 | 32-bit | YES | YES | NO | NO | NO | NO |
# | UART0 | 0x10000000 | 8-bit | YES | YES | NO | NO | NO | NO |
# | GPIO | 0x1012000 | 32-bit | YES | YES | NO | NO | NO | NO |
@ -82,10 +82,10 @@ test_cases:
# Use timecmp register as readable and writable section of the CLINT
.4byte CLINT_BASE + 0x4000, 0xBEEF00B5, write32_test # 32-bit write: success
.4byte CLINT_BASE + 0x4000, 0xBEEF00B5, read32_test # 32-bit read: success
.4byte CLINT_BASE + 0x4000, 0xBEEF00B6, write16_test# 16-bit write: success
.4byte CLINT_BASE + 0x4000, 0xBEEF00B6, read16_test# 16-bit read: success
.4byte CLINT_BASE + 0x4000, 0xBEEF00B7, write08_test# 08-bit write: success
.4byte CLINT_BASE + 0x4000, 0xBEEF00B7, read08_test# 08-bit read: success
.4byte CLINT_BASE + 0x4000, 0xBEEF00B6, write16_test# 16-bit write: failure *** Due to non-native access length in CLINT
.4byte CLINT_BASE + 0x4000, 0xBEEF00B6, read16_test# 16-bit read: failure
.4byte CLINT_BASE + 0x4000, 0xBEEF00B7, write08_test# 08-bit write: failure
.4byte CLINT_BASE + 0x4000, 0xBEEF00B7, read08_test# 08-bit read: failure
.4byte CLINT_BASE, 0xbad, executable_test# execute: instruction access fault

View File

@ -1,11 +1,23 @@
beef00b4 # Test 12.3.2.1: read 64 bits success in CLINT
0000dead # all of these read successes are also confirming successful writes
beef00b5 # read 32 bits success in CLINT (sign extended)
ffffffff
000000b6 # read 16 bits success in CLINT
00000007 # write 32 bits with access fault in CLINT
00000000
00000005 # read 32 bits with access fault in CLINT
00000000
00000bad
00000000
00000007 # write 16 bits with access fault in CLINT
00000000
00000005 # read 16 bits with access fault in CLINT
00000000
00000bad
00000000
00000007 # write 8 bits with access fault in CLINT
00000000
00000005 # read 8 bits with access fault in CLINT
00000000
00000bad
00000000
ffffffb7 # read 8 bits success in CLINT (sign extended)
ffffffff
00000001 # execute test with access fault in CLINT
00000000
00000bad
@ -1010,15 +1022,3 @@ deadbeef
deadbeef
deadbeef
deadbeef
deadbeef
deadbeef
deadbeef
deadbeef
deadbeef
deadbeef
deadbeef
deadbeef
deadbeef
deadbeef
deadbeef
deadbeef

View File

@ -69,7 +69,7 @@ test_cases:
# | Region | Base Address | Read widths | R | W | X | Cacheable | Idempotent | Atomic |
# | ROM | 0x1000 | Any | YES | NO | YES | YES | NO | NO |
# | CLINT | 0x2000000 | Any | YES | YES | NO | NO | NO | NO |
# | CLINT | 0x2000000 | 64-bit | YES | YES | NO | NO | NO | NO |
# | PLIC | 0xC000000 | 32-bit | YES | YES | NO | NO | NO | NO |
# | UART0 | 0x10000000 | 8-bit | YES | YES | NO | NO | NO | NO |
# | GPIO | 0x1012000 | 32-bit | YES | YES | NO | NO | NO | NO |
@ -85,12 +85,12 @@ test_cases:
# Use timecmp register as readable and writable section of the CLINT
.8byte CLINT_BASE + 0x4000, 0x0000DEADBEEF00B4, write64_test # 64-bit write: success
.8byte CLINT_BASE + 0x4000, 0x0000DEADBEEF00B4, read64_test # 64-bit read: success
.8byte CLINT_BASE + 0x4000, 0x0000DEADBEEF00B5, write32_test # 32-bit write: success
.8byte CLINT_BASE + 0x4000, 0x0000DEADBEEF00B5, read32_test # 32-bit read: success
.8byte CLINT_BASE + 0x4000, 0x0000DEADBEEF00B6, write16_test # 16-bit write: success
.8byte CLINT_BASE + 0x4000, 0x0000DEADBEEF00B6, read16_test # 16-bit read: success
.8byte CLINT_BASE + 0x4000, 0x0000DEADBEEF00B7, write08_test # 08-bit write: success
.8byte CLINT_BASE + 0x4000, 0x0000DEADBEEF00B7, read08_test # 08-bit read: success
.8byte CLINT_BASE + 0x4000, 0x0000DEADBEEF00B5, write32_test # 32-bit write: failure *** due to non-native length access
.8byte CLINT_BASE + 0x4000, 0x0000DEADBEEF00B5, read32_test # 32-bit read: failure
.8byte CLINT_BASE + 0x4000, 0x0000DEADBEEF00B6, write16_test # 16-bit write: failure
.8byte CLINT_BASE + 0x4000, 0x0000DEADBEEF00B6, read16_test # 16-bit read: failure
.8byte CLINT_BASE + 0x4000, 0x0000DEADBEEF00B7, write08_test # 08-bit write: failure
.8byte CLINT_BASE + 0x4000, 0x0000DEADBEEF00B7, read08_test # 08-bit read: failure
.8byte CLINT_BASE, 0xbad, executable_test# execute: instruction access fault