From 777028e43bf254584ca0e8a72289175a03936b3d Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 18 Apr 2023 23:06:52 -0700 Subject: [PATCH 1/2] 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 00000000..387a8a72 --- /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 00000000..96264c55 --- /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 00000000..5966e3cd --- /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 2a4bc01944a07d16bb1ca510e9ec1e9ed0e7c8cc Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 18 Apr 2023 23:15:47 -0700 Subject: [PATCH 2/2] 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 6a0f8027..f777dbf1 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[] = '{