From f4b47235ddc3a7a771278d2646adccf0cd3d30a6 Mon Sep 17 00:00:00 2001 From: Olivier Betschi Date: Fri, 8 Nov 2024 09:50:42 +0100 Subject: [PATCH] Remove custom PMP test config --- verif/docs/VerifPlans/PMP/runme.sh | 34 ++ verif/regress/pmp_cv32a65x_tests.sh | 340 ++++++++++++++++++ .../custom/pmp/pmp_decreasing_entries_test.S | 79 ---- .../custom/pmp/pmp_defined_matches_test.S | 41 --- .../custom/pmp/pmp_double_entries_test.S | 85 ----- verif/tests/custom/pmp/pmp_exact_csrr_test.S | 161 --------- verif/tests/custom/pmp/pmp_granularity_test.S | 36 -- .../pmp/pmp_locked_outside_napot_test.S | 36 -- .../custom/pmp/pmp_locked_outside_tor_test.S | 40 --- .../tests/custom/pmp/pmp_locked_rw_na4_test.S | 124 ------- verif/tests/custom/pmp/pmp_lsu_na4_test.S | 150 -------- verif/tests/custom/pmp/pmp_lsu_napot_test.S | 166 --------- verif/tests/custom/pmp/pmp_lsu_tor_test.S | 199 ---------- 13 files changed, 374 insertions(+), 1117 deletions(-) create mode 100644 verif/docs/VerifPlans/PMP/runme.sh create mode 100644 verif/regress/pmp_cv32a65x_tests.sh delete mode 100644 verif/tests/custom/pmp/pmp_decreasing_entries_test.S delete mode 100644 verif/tests/custom/pmp/pmp_defined_matches_test.S delete mode 100644 verif/tests/custom/pmp/pmp_double_entries_test.S delete mode 100644 verif/tests/custom/pmp/pmp_exact_csrr_test.S delete mode 100644 verif/tests/custom/pmp/pmp_granularity_test.S delete mode 100644 verif/tests/custom/pmp/pmp_locked_outside_napot_test.S delete mode 100644 verif/tests/custom/pmp/pmp_locked_outside_tor_test.S delete mode 100644 verif/tests/custom/pmp/pmp_locked_rw_na4_test.S delete mode 100644 verif/tests/custom/pmp/pmp_lsu_na4_test.S delete mode 100644 verif/tests/custom/pmp/pmp_lsu_napot_test.S delete mode 100644 verif/tests/custom/pmp/pmp_lsu_tor_test.S diff --git a/verif/docs/VerifPlans/PMP/runme.sh b/verif/docs/VerifPlans/PMP/runme.sh new file mode 100644 index 0000000000..08508cfb81 --- /dev/null +++ b/verif/docs/VerifPlans/PMP/runme.sh @@ -0,0 +1,34 @@ +############################################################################# +# Copyright (C) 2022 Thales DIS France SAS +# +# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.0. +# +# Original Author: Zbigniew Chamski (zbigniew.chamski@thalesgroup.com) +############################################################################# +#!/bin/sh + +# Location of project-specific directories +ROOTDIR=`readlink -f $(dirname "${BASH_SOURCE[0]}")` + +# Set up platform location. It can be anywhere but should contain +# a valid `vp_config.py` file in `vptool` directory. +# Here we use the verification tree from the example directory. +export PLATFORM_TOP_DIR="$ROOTDIR" + +# Set the printable name for the project that will be used +# in the human-readable documentation. +export PROJECT_NAME="PMP" + +# Set the alphanumerical identifier of the project that +# will be used to construct file names etc. +export PROJECT_IDENT="PMP" + +# Set the destination directory of Markdown files for this project. +# Since it will be used by VPTOOL, it shall NOT be a relative path. +export MARKDOWN_OUTPUT_DIR=`readlink -f "$ROOTDIR/../source"` + +# Run VPTOOL overriding the default theme from Yaml config with 'winxpblue'. +# FIXME: Introduce a suitably named shell variable that points to the root +# directory of the tool set (TOOL_TOP etc.) +# FORNOW use a hardcoded relative path. +sh $ROOTDIR/../../../core-v-verif/tools/vptool/vptool.sh $* diff --git a/verif/regress/pmp_cv32a65x_tests.sh b/verif/regress/pmp_cv32a65x_tests.sh new file mode 100644 index 0000000000..08b3acfa68 --- /dev/null +++ b/verif/regress/pmp_cv32a65x_tests.sh @@ -0,0 +1,340 @@ +# Copyright 2024 Thales DIS design services SAS +# +# Licensed under the Solderpad Hardware Licence, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.0 +# You may obtain a copy of the License at https://solderpad.org/licenses/ +# +# Original Author: Jean-Roch COULON - Thales + + +# Where the tools are +if ! [ -n "$RISCV" ]; then + echo "Error: RISCV variable undefined" + return +fi + +# Install the required tools +source ./verif/regress/install-verilator.sh +source ./verif/regress/install-spike.sh + +# Install the required test suites +source ./verif/regress/install-riscv-compliance.sh +source ./verif/regress/install-riscv-tests.sh +source ./verif/regress/install-riscv-arch-test.sh + +# Setup sim env +source ./verif/sim/setup-env.sh + +echo "$SPIKE_INSTALL_DIR$" + +if ! [ -n "$DV_SIMULATORS" ]; then + # DV_SIMULATORS=vcs-testharness,spike + # DV_SIMULATORS=vcs-uvm,spike + # DV_SIMULATORS=xrun-uvm,spike + # DV_SIMULATORS=vcs-testharness + # DV_SIMULATORS=vcs-uvm + DV_SIMULATORS=xrun-uvm + # DV_SIMULATORS=spike +fi + +if ! [ -n "$UVM_VERBOSITY" ]; then + UVM_VERBOSITY=UVM_NONE +fi + +SIMUENV_VCS_TESTHARNESS=`echo $DV_SIMULATORS | grep -c vcs-testharness` +SIMUENV_VCS_UVM=`echo $DV_SIMULATORS | grep -c vcs-uvm` +SIMUENV_XRUN_UVM=`echo $DV_SIMULATORS | grep -c xrun-uvm` +SIMULATOR_VCS=`echo $DV_SIMULATORS | grep -c vcs` +SIMULATOR_XRUN=`echo $DV_SIMULATORS | grep -c xrun` + +export DV_OPTS="$DV_OPTS" +export DV_OPTS="$DV_OPTS --iss_timeout 0" +export DV_OPTS="$DV_OPTS --c_timeout 0 --asm_timeout 0 --elf_timeout 0" + +if [ $SIMULATOR_VCS == 1 ]; then + export ISSCOMP_OPTS="$ISSCOMP_OPTS -debug_access+r" +fi + +export ISSRUN_OPTS="$ISSRUN_OPTS +debug_disable=1" +export ISSRUN_OPTS="$ISSRUN_OPTS +UVM_VERBOSITY=$UVM_VERBOSITY" + +if [ $SIMULATOR_XRUN == 1 ]; then + export ISSRUN_OPTS="$ISSRUN_OPTS -gui" +fi + +export SPIKE_PARAMS="--help" + +export DEBUG_FILE="" + + +# Select the test to run here: + TEST_NUMBER="#1#" +# TEST_NUMBER="#2#" +# TEST_NUMBER="#3#" +# TEST_NUMBER="#4#" +# TEST_NUMBER="#5#" +# TEST_NUMBER="#6#" +# TEST_NUMBER="#7#" +# TEST_NUMBER="#8#" +# TEST_NUMBER="#9#" + + +TEST_TARGET="#cv32a65x#" + +cd verif/sim/ + + +# ------------------------------------------------------------------------------ +#1# pmp_cv32a65x_granularity_test.S on cv32a65x + +if [ $TEST_NUMBER == "#1#" ] ; then + + echo "running #1# pmp_cv32a65x_granularity_test.S on cv32a65x with $DV_SIMULATORS" + + python3 cva6.py \ + --target cv32a65x \ + --iss_yaml=cva6.yaml \ + --iss=$DV_SIMULATORS \ + --asm_tests ../tests/custom/pmp_cv32a65x/pmp_cv32a65x_granularity_test.S \ + --uvm_test uvmt_cva6_pmp_test_c \ + --linker=../tests/custom/common/test.ld \ + --gcc_opts="-static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles \ + -g ../tests/custom/common/syscalls.c ../tests/custom/common/crt.S -lgcc \ + -I../tests/custom/env -I../tests/custom/common" \ + $DV_OPTS \ + --debug="$DEBUG_FILE" \ + --spike_params="$SPIKE_PARAMS" \ + --issrun_opts="$ISSRUN_OPTS" \ + --isscomp_opts="$ISSCOMP_OPTS" + + make -C ../.. clean + make clean_all + +fi + +# ------------------------------------------------------------------------------ +#2# pmp_cv32a65x_exact_csrr_test.S on cv32a65x + +if [ $TEST_NUMBER == "#2#" ] ; then + + echo "running #2# pmp_cv32a65x_exact_csrr_test.S on cv32a65x with $DV_SIMULATORS" + + python3 cva6.py \ + --target cv32a65x \ + --iss_yaml=cva6.yaml \ + --iss=$DV_SIMULATORS \ + --asm_tests ../tests/custom/pmp_cv32a65x/pmp_cv32a65x_exact_csrr_test.S \ + --uvm_test uvmt_cva6_pmp_test_c \ + --linker=../tests/custom/common/test.ld \ + --gcc_opts="-static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles \ + -g ../tests/custom/common/syscalls.c ../tests/custom/common/crt.S -lgcc \ + -I../tests/custom/env -I../tests/custom/common" \ + $DV_OPTS \ + --debug="$DEBUG_FILE" \ + --spike_params="$SPIKE_PARAMS" \ + --issrun_opts="$ISSRUN_OPTS" \ + --isscomp_opts="$ISSCOMP_OPTS" + + make -C ../.. clean + make clean_all + +fi + +# ------------------------------------------------------------------------------ +#3# pmp_cv32a65x_lsu_tor_test.S on cv32a65x + +if [ $TEST_NUMBER == "#3#" ] ; then + + echo "running #3# pmp_cv32a65x_lsu_tor_test.S on cv32a65x with $DV_SIMULATORS" + + python3 cva6.py \ + --target cv32a65x \ + --iss_yaml=cva6.yaml \ + --iss=$DV_SIMULATORS \ + --asm_tests ../tests/custom/pmp_cv32a65x/pmp_cv32a65x_lsu_tor_test.S \ + --uvm_test uvmt_cva6_pmp_test_c \ + --linker=../tests/custom/common/test.ld \ + --gcc_opts="-static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles \ + -g ../tests/custom/common/syscalls.c ../tests/custom/common/crt.S -lgcc \ + -I../tests/custom/env -I../tests/custom/common" \ + $DV_OPTS \ + --debug="$DEBUG_FILE" \ + --spike_params="$SPIKE_PARAMS" \ + --issrun_opts="$ISSRUN_OPTS" \ + --isscomp_opts="$ISSCOMP_OPTS" + + make -C ../.. clean + make clean_all + +fi + +# ------------------------------------------------------------------------------ +#4# pmp_cv32a65x_lsu_napot_test.S on cv32a65x + +if [ $TEST_NUMBER == "#4#" ] ; then + + echo "running #4# pmp_cv32a65x_lsu_napot_test.S on cv32a65x with $DV_SIMULATORS" + + python3 cva6.py \ + --target cv32a65x \ + --iss_yaml=cva6.yaml \ + --iss=$DV_SIMULATORS \ + --asm_tests ../tests/custom/pmp_cv32a65x/pmp_cv32a65x_lsu_napot_test.S \ + --uvm_test uvmt_cva6_pmp_test_c \ + --linker=../tests/custom/common/test.ld \ + --gcc_opts="-static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles \ + -g ../tests/custom/common/syscalls.c ../tests/custom/common/crt.S -lgcc \ + -I../tests/custom/env -I../tests/custom/common" \ + $DV_OPTS \ + --debug="$DEBUG_FILE" \ + --spike_params="$SPIKE_PARAMS" \ + --issrun_opts="$ISSRUN_OPTS" \ + --isscomp_opts="$ISSCOMP_OPTS" + + make -C ../.. clean + make clean_all + +fi + +# ------------------------------------------------------------------------------ +#5# pmp_cv32a65x_decreasing_entries_test.S on cv32a65x + +if [ $TEST_NUMBER == "#5#" ] ; then + + echo "running #5# pmp_cv32a65x_decreasing_entries_test.S on cv32a65x with $DV_SIMULATORS" + + python3 cva6.py \ + --target cv32a65x \ + --iss_yaml=cva6.yaml \ + --iss=$DV_SIMULATORS \ + --asm_tests ../tests/custom/pmp_cv32a65x/pmp_cv32a65x_decreasing_entries_test.S \ + --uvm_test uvmt_cva6_pmp_test_c \ + --linker=../tests/custom/common/test.ld \ + --gcc_opts="-static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles \ + -g ../tests/custom/common/syscalls.c ../tests/custom/common/crt.S -lgcc \ + -I../tests/custom/env -I../tests/custom/common" \ + $DV_OPTS \ + --debug="$DEBUG_FILE" \ + --spike_params="$SPIKE_PARAMS" \ + --issrun_opts="$ISSRUN_OPTS" \ + --isscomp_opts="$ISSCOMP_OPTS" + + make -C ../.. clean + make clean_all + +fi + +# ------------------------------------------------------------------------------ +#6# pmp_cv32a65x_defined_matches_test.S on cv32a65x + +if [ $TEST_NUMBER == "#6#" ] ; then + + echo "running #6# pmp_cv32a65x_defined_matches_test.S on cv32a65x with $DV_SIMULATORS" + + python3 cva6.py \ + --target cv32a65x \ + --iss_yaml=cva6.yaml \ + --iss=$DV_SIMULATORS \ + --asm_tests ../tests/custom/pmp_cv32a65x/pmp_cv32a65x_defined_matches_test.S \ + --uvm_test uvmt_cva6_pmp_test_c \ + --linker=../tests/custom/common/test.ld \ + --gcc_opts="-static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles \ + -g ../tests/custom/common/syscalls.c ../tests/custom/common/crt.S -lgcc \ + -I../tests/custom/env -I../tests/custom/common" \ + $DV_OPTS \ + --debug="$DEBUG_FILE" \ + --spike_params="$SPIKE_PARAMS" \ + --issrun_opts="$ISSRUN_OPTS" \ + --isscomp_opts="$ISSCOMP_OPTS" + + make -C ../.. clean + make clean_all + +fi + +# ------------------------------------------------------------------------------ +#7# pmp_cv32a65x_double_entries_test.S on cv32a65x + +if [ $TEST_NUMBER == "#7#" ] ; then + + echo "running #7# pmp_cv32a65x_double_entries_test.S on cv32a65x with $DV_SIMULATORS" + + python3 cva6.py \ + --target cv32a65x \ + --iss_yaml=cva6.yaml \ + --iss=$DV_SIMULATORS \ + --asm_tests ../tests/custom/pmp_cv32a65x/pmp_cv32a65x_double_entries_test.S \ + --uvm_test uvmt_cva6_pmp_test_c \ + --linker=../tests/custom/common/test.ld \ + --gcc_opts="-static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles \ + -g ../tests/custom/common/syscalls.c ../tests/custom/common/crt.S -lgcc \ + -I../tests/custom/env -I../tests/custom/common" \ + $DV_OPTS \ + --debug="$DEBUG_FILE" \ + --spike_params="$SPIKE_PARAMS" \ + --issrun_opts="$ISSRUN_OPTS" \ + --isscomp_opts="$ISSCOMP_OPTS" + + make -C ../.. clean + make clean_all + +fi + +# ------------------------------------------------------------------------------ +#8# pmp_cv32a65x_locked_outside_napot_test.S on cv32a65x + +if [ $TEST_NUMBER == "#8#" ] ; then + + echo "running #8# pmp_cv32a65x_locked_outside_napot_test.S on cv32a65x with $DV_SIMULATORS" + + python3 cva6.py \ + --target cv32a65x \ + --iss_yaml=cva6.yaml \ + --iss=$DV_SIMULATORS \ + --asm_tests ../tests/custom/pmp_cv32a65x/pmp_cv32a65x_locked_outside_napot_test.S \ + --uvm_test uvmt_cva6_pmp_test_c \ + --linker=../tests/custom/common/test.ld \ + --gcc_opts="-static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles \ + -g ../tests/custom/common/syscalls.c ../tests/custom/common/crt.S -lgcc \ + -I../tests/custom/env -I../tests/custom/common" \ + $DV_OPTS \ + --debug="$DEBUG_FILE" \ + --spike_params="$SPIKE_PARAMS" \ + --issrun_opts="$ISSRUN_OPTS" \ + --isscomp_opts="$ISSCOMP_OPTS" + + make -C ../.. clean + make clean_all + +fi + +# ------------------------------------------------------------------------------ +#9# pmp_cv32a65x_locked_outside_tor_test.S on cv32a65x + +if [ $TEST_NUMBER == "#9#" ] ; then + + echo "running #9# pmp_cv32a65x_locked_outside_tor_test.S on cv32a65x with $DV_SIMULATORS" + + python3 cva6.py \ + --target cv32a65x \ + --iss_yaml=cva6.yaml \ + --iss=$DV_SIMULATORS \ + --asm_tests ../tests/custom/pmp_cv32a65x/pmp_cv32a65x_locked_outside_tor_test.S \ + --uvm_test uvmt_cva6_pmp_test_c \ + --linker=../tests/custom/common/test.ld \ + --gcc_opts="-static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles \ + -g ../tests/custom/common/syscalls.c ../tests/custom/common/crt.S -lgcc \ + -I../tests/custom/env -I../tests/custom/common" \ + $DV_OPTS \ + --debug="$DEBUG_FILE" \ + --spike_params="$SPIKE_PARAMS" \ + --issrun_opts="$ISSRUN_OPTS" \ + --isscomp_opts="$ISSCOMP_OPTS" + + make -C ../.. clean + make clean_all + +fi + +cd - diff --git a/verif/tests/custom/pmp/pmp_decreasing_entries_test.S b/verif/tests/custom/pmp/pmp_decreasing_entries_test.S deleted file mode 100644 index 5eb1b58141..0000000000 --- a/verif/tests/custom/pmp/pmp_decreasing_entries_test.S +++ /dev/null @@ -1,79 +0,0 @@ -#***************************************************************************** -# pmp_decreasing_entries_test.S (TST04-4) -#----------------------------------------------------------------------------- - .text - .globl main -main: - -# Configure PMP using 7 decreasing entries of TOR - - # From 0x0026_0000 to 0x0028_0000 read-write - li t0, 0x000a0000 - csrw pmpaddr6, t0 - - # From 0x0025_0000 to 0x0026_0000 no permissions - li t0, 0x00098000 - csrw pmpaddr5, t0 - - # From 0x0023_0000 to 0x0025_0000 read-write - li t0, 0x00094000 - csrw pmpaddr4, t0 - - # From 0x0022_0000 to 0x0023_0000 no permissions - li t0, 0x0008c000 - csrw pmpaddr3, t0 - - # From 0x0020_0000 to 0x0022_0000 read-write - li t0, 0x00088000 - csrw pmpaddr2, t0 - - # From 0x0010_0000 to 0x0020_0000 no permissions - li t0, 0x00080000 - csrw pmpaddr1, t0 - - # From 0x0000_0000 to 0x0010_0000 only execute - li t0, 0x00040000 - csrw pmpaddr0, t0 - - - # Addr 4-6 configs, written in cfg1, with LOCK OFF, and TOR. - li t0, 0x000b080b - csrw pmpcfg1, t0 - - # Addr 0-3 configs, written in cfg0, with LOCK OFF, and TOR. - li t0, 0x080b080c - csrw pmpcfg0, t0 - -# Do the READ-WRITE test - - # A read-write test at 0x0020_0000 - li t1, 0x00200000 - li t2, 0xEFFACED0 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # A read-write test at 0x0023_0000 - li t1, 0x00230000 - li t2, 0xEFFACED3 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # A read-write test at 0x0026_0000 - li t1, 0x00260000 - li t2, 0xEFFACED6 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - -pass: - # Success post-processing - li a0, 0x0; - jal exit; - -fail: - # Failure post-processing - li a0, 0x1; - jal exit; diff --git a/verif/tests/custom/pmp/pmp_defined_matches_test.S b/verif/tests/custom/pmp/pmp_defined_matches_test.S deleted file mode 100644 index e100e00d92..0000000000 --- a/verif/tests/custom/pmp/pmp_defined_matches_test.S +++ /dev/null @@ -1,41 +0,0 @@ -#***************************************************************************** -# pmp_defined_matches_test.S (TST10-1, TST10-2) -#----------------------------------------------------------------------------- - .text - .globl main -main: - - # Check a memory access succeeds if no PMP entry is defined. - li t1, 0x00200000 - li t2, 0xC0D1F1ED - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Set up a PMP entry using NAPOT, from 0x0021_0000 to 0x0028_0000, read and write - li t0, 0x000cffff - csrw pmpaddr0, t0 - csrr t1, pmpaddr0 - bne t0, t1, fail - li t0, 0x0000001b - csrw pmpcfg0, t0 - csrr t1, pmpcfg0 - bne t0, t1, fail - - # Check a memory access succeeds if no PMP entry matches. - li t1, 0x00208000 - li t2, 0xCA5CADED - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - -pass: - # Success post-processing - li a0, 0x0; - jal exit; - -fail: - # Failure post-processing - li a0, 0x1; - jal exit; diff --git a/verif/tests/custom/pmp/pmp_double_entries_test.S b/verif/tests/custom/pmp/pmp_double_entries_test.S deleted file mode 100644 index 2b5c185aed..0000000000 --- a/verif/tests/custom/pmp/pmp_double_entries_test.S +++ /dev/null @@ -1,85 +0,0 @@ -#***************************************************************************** -# pmp_double_entries_test.S (TST04-2) -#----------------------------------------------------------------------------- - .text - .globl main -main: - - # Set up a PMP entry using NAPOT, from 0x0025_0000 to 0x0028_0000, read and write - li t0, 0x00099fff - csrw pmpaddr11, t0 - csrr t1, pmpaddr11 - bne t0, t1, fail - li t0, 0x1b000000 - csrw pmpcfg2, t0 - csrr t1, pmpcfg2 - bne t0, t1, fail - - # Set up a PMP entry using NAPOT, from 0x0020_0000 to 0x0023_0000, read and write - li t0, 0x00085fff - csrw pmpaddr3, t0 - csrr t1, pmpaddr3 - bne t0, t1, fail - li t0, 0x1b000000 - csrw pmpcfg0, t0 - csrr t1, pmpcfg0 - bne t0, t1, fail - - # Read-Write in 0x0021_0000 - li t1, 0x00210000 - li t2, 0xC0D1F1ED - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Read-Write in 0x0026_0000 - li t1, 0x00260000 - li t2, 0xCA5CADED - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Check that all other addr / cfg read to zero - csrr t0, pmpaddr0 - bne t0, zero, fail - csrr t0, pmpaddr1 - bne t0, zero, fail - csrr t0, pmpaddr2 - bne t0, zero, fail - csrr t0, pmpaddr4 - bne t0, zero, fail - csrr t0, pmpaddr5 - bne t0, zero, fail - csrr t0, pmpaddr6 - bne t0, zero, fail - csrr t0, pmpaddr7 - bne t0, zero, fail - csrr t0, pmpaddr8 - bne t0, zero, fail - csrr t0, pmpaddr9 - bne t0, zero, fail - csrr t0, pmpaddr10 - bne t0, zero, fail - csrr t0, pmpaddr12 - bne t0, zero, fail - csrr t0, pmpaddr13 - bne t0, zero, fail - csrr t0, pmpaddr14 - bne t0, zero, fail - csrr t0, pmpaddr15 - bne t0, zero, fail - csrr t0, pmpcfg1 - bne t0, zero, fail - csrr t0, pmpcfg3 - bne t0, zero, fail - - -pass: - # Success post-processing - li a0, 0x0; - jal exit; - -fail: - # Failure post-processing - li a0, 0x1; - jal exit; diff --git a/verif/tests/custom/pmp/pmp_exact_csrr_test.S b/verif/tests/custom/pmp/pmp_exact_csrr_test.S deleted file mode 100644 index 2624739ace..0000000000 --- a/verif/tests/custom/pmp/pmp_exact_csrr_test.S +++ /dev/null @@ -1,161 +0,0 @@ -#***************************************************************************** -# pmp_exact_csrr_test.S (TST05-1) -#----------------------------------------------------------------------------- - .text - .globl main -main: - -# Write in addresses and check with csrr what is written - - # Checking PMP ADDR 0 - li t0, 0xFACADE00 - csrw pmpaddr0, t0 - csrr t1, pmpaddr0 - bne t0, t1, fail - csrw pmpaddr0, zero - - # Checking PMP ADDR 1 - li t0, 0xFACADE01 - csrw pmpaddr1, t0 - csrr t1, pmpaddr1 - bne t0, t1, fail - csrw pmpaddr1, zero - - # Checking PMP ADDR 2 - li t0, 0xFACADE02 - csrw pmpaddr2, t0 - csrr t1, pmpaddr2 - bne t0, t1, fail - csrw pmpaddr2, zero - - # Checking PMP ADDR 3 - li t0, 0xFACADE03 - csrw pmpaddr3, t0 - csrr t1, pmpaddr3 - bne t0, t1, fail - csrw pmpaddr3, zero - - # Checking PMP ADDR 4 - li t0, 0xFACADE04 - csrw pmpaddr4, t0 - csrr t1, pmpaddr4 - bne t0, t1, fail - csrw pmpaddr4, zero - - # Checking PMP ADDR 5 - li t0, 0xFACADE05 - csrw pmpaddr5, t0 - csrr t1, pmpaddr5 - bne t0, t1, fail - csrw pmpaddr5, zero - - # Checking PMP ADDR 6 - li t0, 0xFACADE06 - csrw pmpaddr6, t0 - csrr t1, pmpaddr6 - bne t0, t1, fail - csrw pmpaddr6, zero - - # Checking PMP ADDR 7 - li t0, 0xFACADE07 - csrw pmpaddr7, t0 - csrr t1, pmpaddr7 - bne t0, t1, fail - csrw pmpaddr7, zero - - # Checking PMP ADDR 8 - li t0, 0xFACADE08 - csrw pmpaddr8, t0 - csrr t1, pmpaddr8 - bne t0, t1, fail - csrw pmpaddr8, zero - - # Checking PMP ADDR 9 - li t0, 0xFACADE09 - csrw pmpaddr9, t0 - csrr t1, pmpaddr9 - bne t0, t1, fail - csrw pmpaddr9, zero - - # Checking PMP ADDR 10 - li t0, 0xFACADE10 - csrw pmpaddr10, t0 - csrr t1, pmpaddr10 - bne t0, t1, fail - csrw pmpaddr10, zero - - # Checking PMP ADDR 11 - li t0, 0xFACADE11 - csrw pmpaddr11, t0 - csrr t1, pmpaddr11 - bne t0, t1, fail - csrw pmpaddr11, zero - - # Checking PMP ADDR 12 - li t0, 0xFACADE12 - csrw pmpaddr12, t0 - csrr t1, pmpaddr12 - bne t0, t1, fail - csrw pmpaddr12, zero - - # Checking PMP ADDR 13 - li t0, 0xFACADE13 - csrw pmpaddr13, t0 - csrr t1, pmpaddr13 - bne t0, t1, fail - csrw pmpaddr13, zero - - # Checking PMP ADDR 14 - li t0, 0xFACADE14 - csrw pmpaddr14, t0 - csrr t1, pmpaddr14 - bne t0, t1, fail - csrw pmpaddr14, zero - - # Checking PMP ADDR 15 - li t0, 0xFACADE15 - csrw pmpaddr15, t0 - csrr t1, pmpaddr15 - bne t0, t1, fail - csrw pmpaddr15, zero - -# Write in configurations and check with csrr what is written, except for the reserved combinations with R=0 and W=1 - - # Checking PMP CFG 0 - li t0, 0x01030304 - csrw pmpcfg0, t0 - csrr t1, pmpcfg0 - bne t0, t1, fail - csrw pmpcfg0, zero - - # Checking PMP CFG 1 - li t0, 0x03030405 - csrw pmpcfg1, t0 - csrr t1, pmpcfg1 - bne t0, t1, fail - csrw pmpcfg1, zero - - # Checking PMP CFG 2 - li t0, 0x03040505 - csrw pmpcfg2, t0 - csrr t1, pmpcfg2 - bne t0, t1, fail - csrw pmpcfg2, zero - - # Checking PMP CFG 3 - li t0, 0x04050507 - csrw pmpcfg3, t0 - csrr t1, pmpcfg3 - bne t0, t1, fail - csrw pmpcfg3, zero - - -pass: - # Success post-processing - li a0, 0x0; - jal exit; - -fail: - # Failure post-processing - li a0, 0x1; - jal exit; diff --git a/verif/tests/custom/pmp/pmp_granularity_test.S b/verif/tests/custom/pmp/pmp_granularity_test.S deleted file mode 100644 index 5eae5455df..0000000000 --- a/verif/tests/custom/pmp/pmp_granularity_test.S +++ /dev/null @@ -1,36 +0,0 @@ -#***************************************************************************** -# pmp_granularity_test.S (TST01) -#----------------------------------------------------------------------------- - .text - .globl main -main: - -# Configure PMP to find its granularity - - # Write all zeroes in cfg0. - li t0, 0 - csrw pmpcfg0, t0 - - # Write all ones in addr0. - li t1, -1 - csrw pmpaddr0, t1 - - # Read the value back. - csrr t2, pmpaddr0 - - # Check for granularity 8 = 2^(1+2) <=> G = 1. - # As per: https://docs.openhwgroup.org/projects/cva6-user-manual/01_cva6_user/PMP.html - # Which states: The PMP grain is 2**G+2. Only a PMP granularity of 8 bytes (G=1) is supported in CVA6. - # And from the RISC-V Spec: G is the index of the least-significant bit set, the PMP granularity is 2^(G+2) bytes. - li t3, 0xFFFFFFFE - bne t2, t3, fail - -pass: - # Success post-processing - li a0, 0x0; - jal exit; - -fail: - # Failure post-processing - li a0, 0x1; - jal exit; diff --git a/verif/tests/custom/pmp/pmp_locked_outside_napot_test.S b/verif/tests/custom/pmp/pmp_locked_outside_napot_test.S deleted file mode 100644 index 8d15318e84..0000000000 --- a/verif/tests/custom/pmp/pmp_locked_outside_napot_test.S +++ /dev/null @@ -1,36 +0,0 @@ -#***************************************************************************** -# pmp_locked_outside_napot_test.S (TST14-26, TST14-36) -#----------------------------------------------------------------------------- - .text - .globl main -main: - - # Set up a PMP entry using NAPOT, from 0x0021_0000 to 0x0028_0000 - li t0, 0x000cffff - csrw pmpaddr0, t0 - csrr t1, pmpaddr0 - bne t0, t1, fail - - # Configure it with LOCK ON, read-write. - li t0, 0x0000009b - csrw pmpcfg0, t0 - csrr t1, pmpcfg0 - bne t0, t1, fail - - # Check a memory access succeeds when outside the LOCKED entry. - li t1, 0x00200000 - li t2, 0xC0D1F1ED - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - -pass: - # Success post-processing - li a0, 0x0; - jal exit; - -fail: - # Failure post-processing - li a0, 0x1; - jal exit; diff --git a/verif/tests/custom/pmp/pmp_locked_outside_tor_test.S b/verif/tests/custom/pmp/pmp_locked_outside_tor_test.S deleted file mode 100644 index 46fc23afc9..0000000000 --- a/verif/tests/custom/pmp/pmp_locked_outside_tor_test.S +++ /dev/null @@ -1,40 +0,0 @@ -#***************************************************************************** -# pmp_locked_outside_tor_test.S (TST16-26, TST16-36) -#----------------------------------------------------------------------------- - .text - .globl main -main: - - # Set up a PMP entry using TOR, from 0x0000_0000 to 0x0010_0000 - li t0, 0x00040000 - csrw pmpaddr0, t0 - # From 0x0010_0000 to 0x0020_0000 no permissions - li t0, 0x00080000 - csrw pmpaddr1, t0 - # From 0x0020_0000 to 0x0026_0000 read-write - li t0, 0x00098000 - csrw pmpaddr2, t0 - - # Configure the TOR areas with LOCK ON - li t0, 0x008b888c - csrw pmpcfg0, t0 - csrr t1, pmpcfg0 - bne t0, t1, fail - - # Check a memory access succeeds when outside the LOCKED entry. - li t1, 0x00270000 - li t2, 0xC0D1F1ED - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - -pass: - # Success post-processing - li a0, 0x0; - jal exit; - -fail: - # Failure post-processing - li a0, 0x1; - jal exit; diff --git a/verif/tests/custom/pmp/pmp_locked_rw_na4_test.S b/verif/tests/custom/pmp/pmp_locked_rw_na4_test.S deleted file mode 100644 index 48fc098529..0000000000 --- a/verif/tests/custom/pmp/pmp_locked_rw_na4_test.S +++ /dev/null @@ -1,124 +0,0 @@ -#***************************************************************************** -# pmp_locked_rw_na4_test.S (TST12-24, TST12-34) -#----------------------------------------------------------------------------- - .text - .globl main -main: - -# Configure PMP - - # Area 0, at 0x0020_0000 read and write - li t0, 0x00200000 - csrw pmpaddr0, t0 - - # Area 1, at 0x0030_0000 read and write - li t0, 0x00300000 - csrw pmpaddr1, t0 - - # Area 2, at 0x0070_0000 read and write - li t0, 0x00700000 - csrw pmpaddr2, t0 - - # Area 3, at 0x0080_0000 read and write - li t0, 0x00800000 - csrw pmpaddr3, t0 - - - # Area 4, at 0x4000_0000 read and write - li t0, 0x40000000 - csrw pmpaddr4, t0 - - # Area 5, at 0x6000_0000 read and write - li t0, 0x60000000 - csrw pmpaddr5, t0 - - # Area 6, at 0xE000_0000 read and write - li t0, 0xE0000000 - csrw pmpaddr6, t0 - - # Area 7, at 0xF000_0000 read and write - li t0, 0xF0000000 - csrw pmpaddr7, t0 - - - # Area 0-3 configs, written in cfg0, with LOCK ON, and NA4. - li t0, 0x93939393 - csrw pmpcfg0, t0 - csrr t1, pmpcfg0 - bne t0, t1, fail - - # Area 5-8 configs, written in cfg1, with LOCK ON, and NA4. - li t0, 0x93939393 - csrw pmpcfg1, t0 - csrr t1, pmpcfg1 - bne t0, t1, fail - - -# Do the READ-WRITE test - - # Area 1 read-write test, at 0x0020_0000 - li t1, 0x00200000 - li t2, 0xEFFACED1 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 2 read-write test, at 0x0030_0000 - li t1, 0x00300000 - li t2, 0xACCEDED2 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 3 read-write test, at 0x0070_0000 - li t1, 0x00700000 - li t2, 0xDEFACED3 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 4 read-write test, at 0x0080_0000 - li t1, 0x00800000 - li t2, 0xEC0C1DE4 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 5 read-write test, at 0x4000_0000 - li t1, 0x40000000 - li t2, 0xBACCAE05 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 6 read-write test, at 0x6000_0000 - li t1, 0x60000000 - li t2, 0xC0FFEE06 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 7 read-write test, at 0xE000_0000 - li t1, 0xE0000000 - li t2, 0x0FF1CE07 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 8 read-write test, at 0xF000_0000 - li t1, 0xF0000000 - li t2, 0xDABBED08 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - -pass: - # Success post-processing - li a0, 0x0; - jal exit; - -fail: - # Failure post-processing - li a0, 0x1; - jal exit; diff --git a/verif/tests/custom/pmp/pmp_lsu_na4_test.S b/verif/tests/custom/pmp/pmp_lsu_na4_test.S deleted file mode 100644 index 43e66bf3ec..0000000000 --- a/verif/tests/custom/pmp/pmp_lsu_na4_test.S +++ /dev/null @@ -1,150 +0,0 @@ -#***************************************************************************** -# pmp_lsu_na4_test.S (TST12-11, TST12-21, TST12-31) -#----------------------------------------------------------------------------- - .text - .globl main -main: - -# Configure PMP - - # Area 1, at 0x0020_0000 read and write - li t0, 0x00200000 - csrw pmpaddr0, t0 - - # Area 2, at 0x0030_0000 exec, read and write - li t0, 0x00300000 - csrw pmpaddr1, t0 - - # Area 3, at 0x0070_0000 read and write - li t0, 0x00700000 - csrw pmpaddr2, t0 - - # Area 4, at 0x0080_0000 exec, read and write - li t0, 0x00800000 - csrw pmpaddr3, t0 - - - # Area 5, at 0x4000_0000 read and write - li t0, 0x40000000 - csrw pmpaddr4, t0 - - # Area 6, at 0x6000_0000 read and write - li t0, 0x60000000 - csrw pmpaddr5, t0 - - # Area 7, at 0xE000_0000 read and write - li t0, 0xE0000000 - csrw pmpaddr6, t0 - - # Area 8, at 0xF000_0000 exec, read and write - li t0, 0xF0000000 - csrw pmpaddr7, t0 - - - # Area 1-4 configs, written in cfg0, with LOCK OFF, and NA4. - li t0, 0x17131713 - csrw pmpcfg0, t0 - csrr t1, pmpcfg0 - bne t0, t1, fail - - # Area 5-8 configs, written in cfg1, with LOCK OFF, and NA4. - li t0, 0x17131313 - csrw pmpcfg1, t0 - csrr t1, pmpcfg1 - bne t0, t1, fail - - -# Do the READ-WRITE test - - # Area 1 read-write test, at 0x0020_0000 - li t1, 0x00200000 - li t2, 0xEFFACED1 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 2 read-write test, at 0x0030_0000 - li t1, 0x00300000 - li t2, 0xACCEDED2 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 3 read-write test, at 0x0070_0000 - li t1, 0x00700000 - li t2, 0xDEFACED3 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 4 read-write test, at 0x0080_0000 - li t1, 0x00800000 - li t2, 0xEC0C1DE4 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 5 read-write test, at 0x4000_0000 - li t1, 0x40000000 - li t2, 0xBACCAE05 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 6 read-write test, at 0x6000_0000 - li t1, 0x60000000 - li t2, 0xC0FFEE06 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 7 read-write test, at 0xE000_0000 - li t1, 0xE0000000 - li t2, 0x0FF1CE07 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 8 read-write test, at 0xF000_0000 - li t1, 0xF0000000 - li t2, 0xDABBED08 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - -# Do the EXEC test - - # Exec test, at 0x0030_0000 - li t0, 0x00300000 - li t1, 0x8082 - sw t1, 0(t0) - lw t2, 0(t0) - bne t1, t2, fail - jalr t0 - - # Exec test, at 0x0080_0000 - li t0, 0x00800000 - li t1, 0x8082 - sw t1, 0(t0) - lw t2, 0(t0) - bne t1, t2, fail - jalr t0 - - # Exec test, at 0xF000_0000 - li t0, 0xF0000000 - li t1, 0x8082 - sw t1, 0(t0) - lw t2, 0(t0) - bne t1, t2, fail - jalr t0 - - -pass: - # Success post-processing - li a0, 0x0; - jal exit; - -fail: - # Failure post-processing - li a0, 0x1; - jal exit; diff --git a/verif/tests/custom/pmp/pmp_lsu_napot_test.S b/verif/tests/custom/pmp/pmp_lsu_napot_test.S deleted file mode 100644 index 80afc417e2..0000000000 --- a/verif/tests/custom/pmp/pmp_lsu_napot_test.S +++ /dev/null @@ -1,166 +0,0 @@ -#***************************************************************************** -# pmp_lsu_napot_test.S (TST14-11, TST14-21, TST14-31) -#----------------------------------------------------------------------------- - .text - .globl main -main: - -# Configure PMP - - # Area 0, from 0x0000_0000 to 0x0010_0000, execute only - li t0, 0x0001ffff - csrw pmpaddr0, t0 - - # Area 1, from 0x0020_0000 to 0x0028_0000, read and write - li t0, 0x0008ffff - csrw pmpaddr1, t0 - - # Area 2, from 0x0030_0000 to 0x0038_0000, exec, read and write - li t0, 0x000cffff - csrw pmpaddr2, t0 - - # Area 3, from 0x0070_0000 to 0x0070_1000, read and write - li t0, 0x001c01ff - csrw pmpaddr3, t0 - - - # Area 4, from 0x0080_0000 to 0x00C0_0000, exec, read and write - li t0, 0x0027ffff - csrw pmpaddr4, t0 - - # Area 5, from 0x4000_0000 to 0x4000_7000, read and write - li t0, 0x10000dff - csrw pmpaddr5, t0 - - # Area 6, from 0x6000_0000 to 0xE000_0000, read and write - li t0, 0x27ffffff - csrw pmpaddr6, t0 - - # Area 7, from 0xE000_0000 to 0xE004_1000, read and write - li t0, 0x380081ff - csrw pmpaddr7, t0 - - - # Area 8, from 0xF000_0000 to 0xF000_4000, exec, read and write - li t0, 0x3c0007ff - csrw pmpaddr8, t0 - - - # Area 0-3 configs, written in cfg0, with LOCK OFF, and NAPOT. - li t0, 0x1b1f1b1c - csrw pmpcfg0, t0 - csrr t1, pmpcfg0 - bne t0, t1, fail - - # Area 4-7 configs, written in cfg1, with LOCK OFF, and NAPOT. - li t0, 0x1b1b1b1f - csrw pmpcfg1, t0 - csrr t1, pmpcfg1 - bne t0, t1, fail - - # Area 8 configs, written in cfg2, with LOCK OFF, and NAPOT. - li t0, 0x0000001f - csrw pmpcfg2, t0 - csrr t1, pmpcfg2 - bne t0, t1, fail - -# Do the READ-WRITE test - - # Area 1 read-write test, at 0x0020_0000 - li t1, 0x00200000 - li t2, 0xEFFACED1 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 2 read-write test, at 0x0030_0000 - li t1, 0x00300000 - li t2, 0xACCEDED2 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 3 read-write test, at 0x0070_0000 - li t1, 0x00700000 - li t2, 0xDEFACED3 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 4 read-write test, at 0x0080_0000 - li t1, 0x00800000 - li t2, 0xEC0C1DE4 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 5 read-write test, at 0x4000_0000 - li t1, 0x40000000 - li t2, 0xBACCAE05 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 6 read-write test, at 0x6000_0000 - li t1, 0x60000000 - li t2, 0xC0FFEE06 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 7 read-write test, at 0xE000_0000 - li t1, 0xE0000000 - li t2, 0x0FF1CE07 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 8 read-write test, at 0xF000_0000 - li t1, 0xF0000000 - li t2, 0xDABBED08 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Exec test, at 0x00370000 - li t0, 0x00370000 - li t1, 0x8082 - sw t1, 0(t0) - lw t2, 0(t0) - bne t1, t2, fail - jalr t0 - - # Exec test, at 0x00B00000 - li t0, 0x00B00000 - li t1, 0x8082 - sw t1, 0(t0) - lw t2, 0(t0) - bne t1, t2, fail - jalr t0 - - # Exec test, at 0xF0003000 - li t0, 0xF0003000 - li t1, 0x8082 - sw t1, 0(t0) - lw t2, 0(t0) - bne t1, t2, fail - jalr t0 - - # Exec test, at 0x000F0000 - li t0, 0x000F0000 - li t1, 0x8082 - sw t1, 0(t0) - lw t2, 0(t0) - bne t1, t2, fail - jalr t0 - - -pass: - # Success post-processing - li a0, 0x0; - jal exit; - -fail: - # Failure post-processing - li a0, 0x1; - jal exit; diff --git a/verif/tests/custom/pmp/pmp_lsu_tor_test.S b/verif/tests/custom/pmp/pmp_lsu_tor_test.S deleted file mode 100644 index 165b2c8d7c..0000000000 --- a/verif/tests/custom/pmp/pmp_lsu_tor_test.S +++ /dev/null @@ -1,199 +0,0 @@ -#***************************************************************************** -# pmp_lsu_tor_test.S (TST16-11, TST16-21, TST16-31) -#----------------------------------------------------------------------------- - .text - .globl main -main: - -# Configure PMP using TOR - - # From 0x0000_0000 to 0x0010_0000 only execute - li t0, 0x00040000 - csrw pmpaddr0, t0 - - # From 0x0010_0000 to 0x0020_0000 no permissions - li t0, 0x00080000 - csrw pmpaddr1, t0 - - # From 0x0020_0000 to 0x0028_0000 read-write - li t0, 0x000a0000 - csrw pmpaddr2, t0 - - # From 0x0028_0000 to 0x0030_0000 no permissions - li t0, 0x000c0000 - csrw pmpaddr3, t0 - - # From 0x0030_0000 to 0x0038_0000 read-write-execute - li t0, 0x000e0000 - csrw pmpaddr4, t0 - - # From 0x0038_0000 to 0x0070_0000 no permissions - li t0, 0x001c0000 - csrw pmpaddr5, t0 - - # From 0x0070_0000 to 0x0070_1000 read-write - li t0, 0x001c0400 - csrw pmpaddr6, t0 - - # From 0x0070_1000 to 0x0080_0000 no permissions - li t0, 0x00200000 - csrw pmpaddr7, t0 - - # From 0x0080_0000 to 0x00C0_0000 read-write-execute - li t0, 0x00300000 - csrw pmpaddr8, t0 - - # From 0x00C0_0000 to 0x4000_0000 no permissions - li t0, 0x10000000 - csrw pmpaddr9, t0 - - # From 0x4000_0000 to 0x4000_7000 read-write - li t0, 0x10001c00 - csrw pmpaddr10, t0 - - # From 0x4000_7000 to 0x6000_0000 no permissions - li t0, 0x18000000 - csrw pmpaddr11, t0 - - # From 0x6000_0000 to 0xE004_1000 read-write - li t0, 0x38010400 - csrw pmpaddr12, t0 - - # From 0xE004_1000 to 0xF000_0000 no permissions - li t0, 0x3c000000 - csrw pmpaddr13, t0 - - # From 0xF000_0000 to 0xF000_4000 read-write-execute - li t0, 0x3c001000 - csrw pmpaddr14, t0 - - # From 0xF000_4000 to 0xFFFF_FFFF no permissions - li t0, 0x3fffffff - csrw pmpaddr15, t0 - - # Addr 0-3 configs, written in cfg0, with LOCK OFF, and TOR. - li t0, 0x080b080c - csrw pmpcfg0, t0 - csrr t1, pmpcfg0 - bne t0, t1, fail - - # Addr 4-7 configs, written in cfg1, with LOCK OFF, and TOR. - li t0, 0x080b080f - csrw pmpcfg1, t0 - csrr t1, pmpcfg1 - bne t0, t1, fail - - # Addr 8-11 configs, written in cfg2, with LOCK OFF, and TOR. - li t0, 0x080b080f - csrw pmpcfg2, t0 - csrr t1, pmpcfg2 - bne t0, t1, fail - - # Addr 12-15 configs, written in cfg3, with LOCK OFF, and TOR. - li t0, 0x080f080b - csrw pmpcfg3, t0 - csrr t1, pmpcfg3 - bne t0, t1, fail - -# Do the READ-WRITE test - - # Area 1 read-write test, at 0x0020_0000 - li t1, 0x00200000 - li t2, 0xEFFACED1 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 2 read-write test, at 0x0030_0000 - li t1, 0x00300000 - li t2, 0xACCEDED2 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 3 read-write test, at 0x0070_0000 - li t1, 0x00700000 - li t2, 0xDEFACED3 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 4 read-write test, at 0x0080_0000 - li t1, 0x00800000 - li t2, 0xEC0C1DE4 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 5 read-write test, at 0x4000_0000 - li t1, 0x40000000 - li t2, 0xBACCAE05 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 6 read-write test, at 0x6000_0000 - li t1, 0x60000000 - li t2, 0xC0FFEE06 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 7 read-write test, at 0xE000_0000 - li t1, 0xE0000000 - li t2, 0x0FF1CE07 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - - # Area 8 read-write test, at 0xF000_0000 - li t1, 0xF0000000 - li t2, 0xDABBED08 - sw t2, 0(t1) - lw t3, 0(t1) - bne t2, t3, fail - -# Do the EXEC "RET" test - - # Exec test, at 0x00370000 - li t0, 0x00370000 - li t1, 0x8082 - sw t1, 0(t0) - lw t2, 0(t0) - bne t1, t2, fail - jalr t0 - - # Exec test, at 0x00B00000 - li t0, 0x00B00000 - li t1, 0x8082 - sw t1, 0(t0) - lw t2, 0(t0) - bne t1, t2, fail - jalr t0 - - # Exec test, at 0xF0003000 - li t0, 0xF0003000 - li t1, 0x8082 - sw t1, 0(t0) - lw t2, 0(t0) - bne t1, t2, fail - jalr t0 - - # Exec test, at 0x000F0000 - li t0, 0x000F0000 - li t1, 0x8082 - sw t1, 0(t0) - lw t2, 0(t0) - bne t1, t2, fail - jalr t0 - - -pass: - # Success post-processing - li a0, 0x0; - jal exit; - -fail: - # Failure post-processing - li a0, 0x1; - jal exit;