From db0ca8695a8e7051a9454dc631c29d506cdd4f98 Mon Sep 17 00:00:00 2001 From: Kevin Thomas Date: Tue, 18 Apr 2023 17:57:56 -0500 Subject: [PATCH 1/6] Add PR#252 test file to coverage --- testbench/tests.vh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testbench/tests.vh b/testbench/tests.vh index 6a0f80276..19adb818c 100644 --- a/testbench/tests.vh +++ b/testbench/tests.vh @@ -53,7 +53,8 @@ string tvpaths[] = '{ "lsu", "vm64check", "pmp", - "tlbKP" + "tlbKP", + "ifuCamlineWrite" }; string coremark[] = '{ From 1bdae2285d3276dd7e22b1c8e582c77d1326bb2f Mon Sep 17 00:00:00 2001 From: Kevin Wan Date: Tue, 18 Apr 2023 18:43:50 -0700 Subject: [PATCH 2/6] PMPCFG_ARRAY_REGW cases --- testbench/tests.vh | 2 ++ tests/coverage/pmpcfg.S | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 tests/coverage/pmpcfg.S diff --git a/testbench/tests.vh b/testbench/tests.vh index 6a0f80276..8e327cafb 100644 --- a/testbench/tests.vh +++ b/testbench/tests.vh @@ -53,7 +53,9 @@ string tvpaths[] = '{ "lsu", "vm64check", "pmp", + "pmpcfg", "tlbKP" + }; string coremark[] = '{ diff --git a/tests/coverage/pmpcfg.S b/tests/coverage/pmpcfg.S new file mode 100644 index 000000000..bb6961526 --- /dev/null +++ b/tests/coverage/pmpcfg.S @@ -0,0 +1,33 @@ +// pmpcfg supplemental + +#include "WALLY-init-lib.h" +main: + li t0, 0x8800000000000000 + csrw pmpcfg2, t0 + li t0, 0x88000000000000 + csrw pmpcfg2, t0 + li t0, 0x880000000000 + csrw pmpcfg2, t0 + li t0, 0x8800000000 + csrw pmpcfg2, t0 + li t0, 0x88000000 + csrw pmpcfg2, t0 + li t0, 0x880000 + csrw pmpcfg2, t0 + li t0, 0x8800 + csrw pmpcfg2, t0 + li t0, 0x8800000000000000 + csrw pmpcfg0, t0 + li t0, 0x88000000000000 + csrw pmpcfg0, t0 + li t0, 0x880000000000 + csrw pmpcfg0, t0 + li t0, 0x8800000000 + csrw pmpcfg0, t0 + li t0, 0x88000000 + csrw pmpcfg0, t0 + li t0, 0x880000 + csrw pmpcfg0, t0 + li t0, 0x8800 + csrw pmpcfg0, t0 + j done From 771124e265e0ce6b4f9fe8861de861fb9df24a96 Mon Sep 17 00:00:00 2001 From: Kevin Wan Date: Tue, 18 Apr 2023 21:50:48 -0700 Subject: [PATCH 3/6] Completely covers all PMPCFG_ARRAY_REGW cases --- testbench/tests.vh | 4 +++- tests/coverage/pmpcfg.S | 8 ++++++- tests/coverage/pmpcfg1.S | 48 ++++++++++++++++++++++++++++++++++++++++ tests/coverage/pmpcfg2.S | 12 ++++++++++ tests/coverage/priv.S | 1 + 5 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 tests/coverage/pmpcfg1.S create mode 100644 tests/coverage/pmpcfg2.S diff --git a/testbench/tests.vh b/testbench/tests.vh index 8e327cafb..49c946802 100644 --- a/testbench/tests.vh +++ b/testbench/tests.vh @@ -54,8 +54,10 @@ string tvpaths[] = '{ "vm64check", "pmp", "pmpcfg", + "pmpcfg1", + "pmpcfg2", "tlbKP" - + }; string coremark[] = '{ diff --git a/tests/coverage/pmpcfg.S b/tests/coverage/pmpcfg.S index bb6961526..d65f810e5 100644 --- a/tests/coverage/pmpcfg.S +++ b/tests/coverage/pmpcfg.S @@ -1,4 +1,7 @@ -// pmpcfg supplemental +// pmpcfg part 1 +// Kevin Wan, kewan@hmc.edu, 4/18/2023 +// locks each pmpXcfg bit field in order, from X = 15 to X = 0, with the A[1:0] field set to TOR. +// See the next part in pmpcfg1.S #include "WALLY-init-lib.h" main: @@ -16,6 +19,8 @@ main: csrw pmpcfg2, t0 li t0, 0x8800 csrw pmpcfg2, t0 + li t0, 0x88 + csrw pmpcfg2, t0 li t0, 0x8800000000000000 csrw pmpcfg0, t0 li t0, 0x88000000000000 @@ -30,4 +35,5 @@ main: csrw pmpcfg0, t0 li t0, 0x8800 csrw pmpcfg0, t0 + j done diff --git a/tests/coverage/pmpcfg1.S b/tests/coverage/pmpcfg1.S new file mode 100644 index 000000000..96264c55f --- /dev/null +++ b/tests/coverage/pmpcfg1.S @@ -0,0 +1,48 @@ +// another set of pmpcfg tests. A new file is made because pmpcfg register fields are +// locked forever after writing 1 to the lock bit for the first time. + +// Kevin Wan, kewan@hmc.edu, 4/13/2023 +// This set tests locking the pmpXcfg fields in descending order again, without setting the TOR bits. +// for the other part of the tests, see pmpcfg.S + +#include "WALLY-init-lib.h" +main: + li t0, 0x800 + csrw pmpcfg0, t0 + li t0, 0x8000000 + csrw pmpcfg0, t0 + + li t0, 0x8000000000000000 + csrw pmpcfg2, t0 + li t0, 0x80000000000000 + csrw pmpcfg2, t0 + li t0, 0x800000000000 + csrw pmpcfg2, t0 + li t0, 0x8000000000 + csrw pmpcfg2, t0 + li t0, 0x80000000 + csrw pmpcfg2, t0 + li t0, 0x800000 + csrw pmpcfg2, t0 + li t0, 0x8000 + csrw pmpcfg2, t0 + li t0, 0x80 + csrw pmpcfg2, t0 + li t0, 0x8000000000000000 + csrw pmpcfg0, t0 + li t0, 0x80000000000000 + csrw pmpcfg0, t0 + li t0, 0x800000000000 + csrw pmpcfg0, t0 + li t0, 0x8000000000 + csrw pmpcfg0, t0 + li t0, 0x80000000 + csrw pmpcfg0, t0 + li t0, 0x800000 + csrw pmpcfg0, t0 + li t0, 0x8000 + csrw pmpcfg0, t0 + + + + j done \ No newline at end of file diff --git a/tests/coverage/pmpcfg2.S b/tests/coverage/pmpcfg2.S new file mode 100644 index 000000000..5966e3cdc --- /dev/null +++ b/tests/coverage/pmpcfg2.S @@ -0,0 +1,12 @@ +// pmpcfg part 3 +// Kevin Wan, kewan@hmc.edu, 4/18/2023 +// locks each pmpXcfg bit field in order, from X = 15 to X = 0, with the A[1:0] field set to TOR. +// See the next part in pmpcfg1.S + +#include "WALLY-init-lib.h" +main: + li t0, 0x80 + csrw pmpcfg0, t0 + + + j done \ No newline at end of file diff --git a/tests/coverage/priv.S b/tests/coverage/priv.S index 94b7cd0ef..5e187866b 100644 --- a/tests/coverage/priv.S +++ b/tests/coverage/priv.S @@ -189,6 +189,7 @@ main: li t1, -1 csrw mcounteren, t1 + # Go to supervisor mode li a0, 1 ecall From b5a3ff2d2d6bdceca8388645b88c8e6e08de21c4 Mon Sep 17 00:00:00 2001 From: Kevin Wan Date: Tue, 18 Apr 2023 22:09:50 -0700 Subject: [PATCH 4/6] a --- tests/coverage/pmpcfg2.S | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 tests/coverage/pmpcfg2.S diff --git a/tests/coverage/pmpcfg2.S b/tests/coverage/pmpcfg2.S deleted file mode 100644 index 5966e3cdc..000000000 --- a/tests/coverage/pmpcfg2.S +++ /dev/null @@ -1,12 +0,0 @@ -// pmpcfg part 3 -// Kevin Wan, kewan@hmc.edu, 4/18/2023 -// locks each pmpXcfg bit field in order, from X = 15 to X = 0, with the A[1:0] field set to TOR. -// See the next part in pmpcfg1.S - -#include "WALLY-init-lib.h" -main: - li t0, 0x80 - csrw pmpcfg0, t0 - - - j done \ No newline at end of file From d74768ce04293ccc3019719825c8f5c1e9704d4f Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 18 Apr 2023 23:06:52 -0700 Subject: [PATCH 5/6] Add test cases for pmpcfg.S --- tests/coverage/pmpcfg.S | 39 ++++++++++++++++++++++++++++++++ tests/coverage/pmpcfg1.S | 48 ++++++++++++++++++++++++++++++++++++++++ tests/coverage/pmpcfg2.S | 12 ++++++++++ 3 files changed, 99 insertions(+) create mode 100644 tests/coverage/pmpcfg.S create mode 100644 tests/coverage/pmpcfg1.S create mode 100644 tests/coverage/pmpcfg2.S diff --git a/tests/coverage/pmpcfg.S b/tests/coverage/pmpcfg.S new file mode 100644 index 000000000..387a8a726 --- /dev/null +++ b/tests/coverage/pmpcfg.S @@ -0,0 +1,39 @@ +// pmpcfg part 1 +// Kevin Wan, kewan@hmc.edu, 4/18/2023 +// locks each pmpXcfg bit field in order, from X = 15 to X = 0, with the A[1:0] field set to TOR. +// See the next part in pmpcfg1.S + +#include "WALLY-init-lib.h" +main: + li t0, 0x8800000000000000 + csrw pmpcfg2, t0 + li t0, 0x88000000000000 + csrw pmpcfg2, t0 + li t0, 0x880000000000 + csrw pmpcfg2, t0 + li t0, 0x8800000000 + csrw pmpcfg2, t0 + li t0, 0x88000000 + csrw pmpcfg2, t0 + li t0, 0x880000 + csrw pmpcfg2, t0 + li t0, 0x8800 + csrw pmpcfg2, t0 + li t0, 0x88 + csrw pmpcfg2, t0 + li t0, 0x8800000000000000 + csrw pmpcfg0, t0 + li t0, 0x88000000000000 + csrw pmpcfg0, t0 + li t0, 0x880000000000 + csrw pmpcfg0, t0 + li t0, 0x8800000000 + csrw pmpcfg0, t0 + li t0, 0x88000000 + csrw pmpcfg0, t0 + li t0, 0x880000 + csrw pmpcfg0, t0 + li t0, 0x8800 + csrw pmpcfg0, t0 + + j done \ No newline at end of file diff --git a/tests/coverage/pmpcfg1.S b/tests/coverage/pmpcfg1.S new file mode 100644 index 000000000..96264c55f --- /dev/null +++ b/tests/coverage/pmpcfg1.S @@ -0,0 +1,48 @@ +// another set of pmpcfg tests. A new file is made because pmpcfg register fields are +// locked forever after writing 1 to the lock bit for the first time. + +// Kevin Wan, kewan@hmc.edu, 4/13/2023 +// This set tests locking the pmpXcfg fields in descending order again, without setting the TOR bits. +// for the other part of the tests, see pmpcfg.S + +#include "WALLY-init-lib.h" +main: + li t0, 0x800 + csrw pmpcfg0, t0 + li t0, 0x8000000 + csrw pmpcfg0, t0 + + li t0, 0x8000000000000000 + csrw pmpcfg2, t0 + li t0, 0x80000000000000 + csrw pmpcfg2, t0 + li t0, 0x800000000000 + csrw pmpcfg2, t0 + li t0, 0x8000000000 + csrw pmpcfg2, t0 + li t0, 0x80000000 + csrw pmpcfg2, t0 + li t0, 0x800000 + csrw pmpcfg2, t0 + li t0, 0x8000 + csrw pmpcfg2, t0 + li t0, 0x80 + csrw pmpcfg2, t0 + li t0, 0x8000000000000000 + csrw pmpcfg0, t0 + li t0, 0x80000000000000 + csrw pmpcfg0, t0 + li t0, 0x800000000000 + csrw pmpcfg0, t0 + li t0, 0x8000000000 + csrw pmpcfg0, t0 + li t0, 0x80000000 + csrw pmpcfg0, t0 + li t0, 0x800000 + csrw pmpcfg0, t0 + li t0, 0x8000 + csrw pmpcfg0, t0 + + + + j done \ No newline at end of file diff --git a/tests/coverage/pmpcfg2.S b/tests/coverage/pmpcfg2.S new file mode 100644 index 000000000..5966e3cdc --- /dev/null +++ b/tests/coverage/pmpcfg2.S @@ -0,0 +1,12 @@ +// pmpcfg part 3 +// Kevin Wan, kewan@hmc.edu, 4/18/2023 +// locks each pmpXcfg bit field in order, from X = 15 to X = 0, with the A[1:0] field set to TOR. +// See the next part in pmpcfg1.S + +#include "WALLY-init-lib.h" +main: + li t0, 0x80 + csrw pmpcfg0, t0 + + + j done \ No newline at end of file From 9b72d6ac37c6cacd3eee7f42f061e8184cb324a3 Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 18 Apr 2023 23:15:47 -0700 Subject: [PATCH 6/6] Update tests.vh --- testbench/tests.vh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/testbench/tests.vh b/testbench/tests.vh index 6a0f80276..f777dbf17 100644 --- a/testbench/tests.vh +++ b/testbench/tests.vh @@ -53,7 +53,11 @@ string tvpaths[] = '{ "lsu", "vm64check", "pmp", - "tlbKP" + "tlbKP", + "pmpcfg", + "pmpcfg1", + "pmpcfg2" + }; string coremark[] = '{