diff --git a/.gitignore b/.gitignore index cfde0fa64..501874d09 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,9 @@ __pycache__/ .vscode/ +#External repos +addins + #vsim work files to ignore transcript vsim.wlf @@ -38,4 +41,5 @@ wally-pipelined/linux-testgen/buildroot-config-src/main.config.old wally-pipelined/linux-testgen/buildroot-config-src/linux.config.old wally-pipelined/linux-testgen/buildroot-config-src/busybox.config.old wally-pipelined/regression/slack-notifier/slack-webhook-url.txt +wally-pipelined/regression/logs diff --git a/.gitmodules b/.gitmodules index e69de29bb..65e1e71c9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "sky130/sky130_osu_sc_t12"] + path = sky130/sky130_osu_sc_t12 + url = https://foss-eda-tools.googlesource.com/skywater-pdk/libs/sky130_osu_sc_t12/ diff --git a/README.md b/README.md index 6aaa28dab..559c3e0ee 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,36 @@ # riscv-wally Configurable RISC-V Processor + +Wally is a 5-stage pipelined processor configurable to support all the standard RISC-V options, incluidng RV32/64, A, C, F, D, and M extensions, FENCE.I, and the various privileged modes and CSRs. It is written in SystemVerilog. It passes the RISC-V Arch Tests and Imperas tests. As of October 2021, it boots the first 10 million instructions of Buildroot Linux. + +To use Wally on Linux: + +``` +git clone https://github.com/davidharrishmc/riscv-wally +cd riscv-wally +cd imperas-riscv-tests +make +cd ../addins +git clone https://github.com/riscv-non-isa/riscv-arch-test +git clone https://github.com/riscv-software-src/riscv-isa-sim +cd riscv-isa-sim +mkdir build +cd build +set RISCV=/cad/riscv/gcc/bin (or whatever your path is) +../configure --prefix=$RISCV +make (this will take a while to build SPIKE) +sudo make install +cd ../../riscv-arch-test +cp ../riscv-isa-sim/arch_test_target/spike/Makefile.include . +edit Makefile.include + change line with TARGETDIR to /home/harris/riscv-wally/addins/riscv-isa-sim/arch_test_target (or whatever your path is) + add line export RISCV_PREFIX = riscv64-unknown-elf- # this might not be needed if you have 32-bit versions of the riscv gcc compiler built separately +make +make XLEN=32 +exe2memfile.pl work/*/*/*.elf # converts ELF files to a format that can be read by Modelsim +``` + +Notes: +Eventually download imperas-riscv-tests separately +Move our custom tests to another directory +Eventually replace exe2memfile.pl with objcopy diff --git a/riscv-coremark/.gitignore b/tests/riscv-coremark/.gitignore similarity index 100% rename from riscv-coremark/.gitignore rename to tests/riscv-coremark/.gitignore diff --git a/riscv-coremark/.gitmodules b/tests/riscv-coremark/.gitmodules similarity index 100% rename from riscv-coremark/.gitmodules rename to tests/riscv-coremark/.gitmodules diff --git a/riscv-coremark/LICENSE b/tests/riscv-coremark/LICENSE similarity index 100% rename from riscv-coremark/LICENSE rename to tests/riscv-coremark/LICENSE diff --git a/riscv-coremark/README.md b/tests/riscv-coremark/README.md similarity index 100% rename from riscv-coremark/README.md rename to tests/riscv-coremark/README.md diff --git a/riscv-coremark/build-coremark.sh b/tests/riscv-coremark/build-coremark.sh similarity index 100% rename from riscv-coremark/build-coremark.sh rename to tests/riscv-coremark/build-coremark.sh diff --git a/riscv-coremark/coremark/LICENSE.md b/tests/riscv-coremark/coremark/LICENSE.md similarity index 100% rename from riscv-coremark/coremark/LICENSE.md rename to tests/riscv-coremark/coremark/LICENSE.md diff --git a/riscv-coremark/coremark/Makefile b/tests/riscv-coremark/coremark/Makefile similarity index 100% rename from riscv-coremark/coremark/Makefile rename to tests/riscv-coremark/coremark/Makefile diff --git a/riscv-coremark/coremark/README.md b/tests/riscv-coremark/coremark/README.md similarity index 100% rename from riscv-coremark/coremark/README.md rename to tests/riscv-coremark/coremark/README.md diff --git a/riscv-coremark/coremark/barebones/core_portme.c b/tests/riscv-coremark/coremark/barebones/core_portme.c similarity index 100% rename from riscv-coremark/coremark/barebones/core_portme.c rename to tests/riscv-coremark/coremark/barebones/core_portme.c diff --git a/riscv-coremark/coremark/barebones/core_portme.h b/tests/riscv-coremark/coremark/barebones/core_portme.h similarity index 100% rename from riscv-coremark/coremark/barebones/core_portme.h rename to tests/riscv-coremark/coremark/barebones/core_portme.h diff --git a/riscv-coremark/coremark/barebones/core_portme.mak b/tests/riscv-coremark/coremark/barebones/core_portme.mak similarity index 100% rename from riscv-coremark/coremark/barebones/core_portme.mak rename to tests/riscv-coremark/coremark/barebones/core_portme.mak diff --git a/riscv-coremark/coremark/barebones/cvt.c b/tests/riscv-coremark/coremark/barebones/cvt.c similarity index 100% rename from riscv-coremark/coremark/barebones/cvt.c rename to tests/riscv-coremark/coremark/barebones/cvt.c diff --git a/riscv-coremark/coremark/barebones/ee_printf.c b/tests/riscv-coremark/coremark/barebones/ee_printf.c similarity index 100% rename from riscv-coremark/coremark/barebones/ee_printf.c rename to tests/riscv-coremark/coremark/barebones/ee_printf.c diff --git a/riscv-coremark/coremark/core_list_join.c b/tests/riscv-coremark/coremark/core_list_join.c similarity index 100% rename from riscv-coremark/coremark/core_list_join.c rename to tests/riscv-coremark/coremark/core_list_join.c diff --git a/riscv-coremark/coremark/core_main.c b/tests/riscv-coremark/coremark/core_main.c similarity index 100% rename from riscv-coremark/coremark/core_main.c rename to tests/riscv-coremark/coremark/core_main.c diff --git a/riscv-coremark/coremark/core_matrix.c b/tests/riscv-coremark/coremark/core_matrix.c similarity index 100% rename from riscv-coremark/coremark/core_matrix.c rename to tests/riscv-coremark/coremark/core_matrix.c diff --git a/riscv-coremark/coremark/core_state.c b/tests/riscv-coremark/coremark/core_state.c similarity index 100% rename from riscv-coremark/coremark/core_state.c rename to tests/riscv-coremark/coremark/core_state.c diff --git a/riscv-coremark/coremark/core_util.c b/tests/riscv-coremark/coremark/core_util.c similarity index 100% rename from riscv-coremark/coremark/core_util.c rename to tests/riscv-coremark/coremark/core_util.c diff --git a/riscv-coremark/coremark/coremark.h b/tests/riscv-coremark/coremark/coremark.h similarity index 100% rename from riscv-coremark/coremark/coremark.h rename to tests/riscv-coremark/coremark/coremark.h diff --git a/riscv-coremark/coremark/coremark.md5 b/tests/riscv-coremark/coremark/coremark.md5 similarity index 100% rename from riscv-coremark/coremark/coremark.md5 rename to tests/riscv-coremark/coremark/coremark.md5 diff --git a/riscv-coremark/coremark/cygwin/core_portme.c b/tests/riscv-coremark/coremark/cygwin/core_portme.c similarity index 100% rename from riscv-coremark/coremark/cygwin/core_portme.c rename to tests/riscv-coremark/coremark/cygwin/core_portme.c diff --git a/riscv-coremark/coremark/cygwin/core_portme.h b/tests/riscv-coremark/coremark/cygwin/core_portme.h similarity index 100% rename from riscv-coremark/coremark/cygwin/core_portme.h rename to tests/riscv-coremark/coremark/cygwin/core_portme.h diff --git a/riscv-coremark/coremark/cygwin/core_portme.mak b/tests/riscv-coremark/coremark/cygwin/core_portme.mak similarity index 100% rename from riscv-coremark/coremark/cygwin/core_portme.mak rename to tests/riscv-coremark/coremark/cygwin/core_portme.mak diff --git a/riscv-coremark/coremark/docs/READM.md b/tests/riscv-coremark/coremark/docs/READM.md similarity index 100% rename from riscv-coremark/coremark/docs/READM.md rename to tests/riscv-coremark/coremark/docs/READM.md diff --git a/riscv-coremark/coremark/docs/balance_O0_joined.png b/tests/riscv-coremark/coremark/docs/balance_O0_joined.png similarity index 100% rename from riscv-coremark/coremark/docs/balance_O0_joined.png rename to tests/riscv-coremark/coremark/docs/balance_O0_joined.png diff --git a/riscv-coremark/coremark/docs/html/files/PIC32/core_portme-mak.html b/tests/riscv-coremark/coremark/docs/html/files/PIC32/core_portme-mak.html similarity index 100% rename from riscv-coremark/coremark/docs/html/files/PIC32/core_portme-mak.html rename to tests/riscv-coremark/coremark/docs/html/files/PIC32/core_portme-mak.html diff --git a/riscv-coremark/coremark/docs/html/files/core_list_join-c.html b/tests/riscv-coremark/coremark/docs/html/files/core_list_join-c.html similarity index 100% rename from riscv-coremark/coremark/docs/html/files/core_list_join-c.html rename to tests/riscv-coremark/coremark/docs/html/files/core_list_join-c.html diff --git a/riscv-coremark/coremark/docs/html/files/core_main-c.html b/tests/riscv-coremark/coremark/docs/html/files/core_main-c.html similarity index 100% rename from riscv-coremark/coremark/docs/html/files/core_main-c.html rename to tests/riscv-coremark/coremark/docs/html/files/core_main-c.html diff --git a/riscv-coremark/coremark/docs/html/files/core_matrix-c.html b/tests/riscv-coremark/coremark/docs/html/files/core_matrix-c.html similarity index 100% rename from riscv-coremark/coremark/docs/html/files/core_matrix-c.html rename to tests/riscv-coremark/coremark/docs/html/files/core_matrix-c.html diff --git a/riscv-coremark/coremark/docs/html/files/core_state-c.html b/tests/riscv-coremark/coremark/docs/html/files/core_state-c.html similarity index 100% rename from riscv-coremark/coremark/docs/html/files/core_state-c.html rename to tests/riscv-coremark/coremark/docs/html/files/core_state-c.html diff --git a/riscv-coremark/coremark/docs/html/files/core_util-c.html b/tests/riscv-coremark/coremark/docs/html/files/core_util-c.html similarity index 100% rename from riscv-coremark/coremark/docs/html/files/core_util-c.html rename to tests/riscv-coremark/coremark/docs/html/files/core_util-c.html diff --git a/riscv-coremark/coremark/docs/html/files/coremark-h.html b/tests/riscv-coremark/coremark/docs/html/files/coremark-h.html similarity index 100% rename from riscv-coremark/coremark/docs/html/files/coremark-h.html rename to tests/riscv-coremark/coremark/docs/html/files/coremark-h.html diff --git a/riscv-coremark/coremark/docs/html/files/docs/core_state.png b/tests/riscv-coremark/coremark/docs/html/files/docs/core_state.png similarity index 100% rename from riscv-coremark/coremark/docs/html/files/docs/core_state.png rename to tests/riscv-coremark/coremark/docs/html/files/docs/core_state.png diff --git a/riscv-coremark/coremark/docs/html/files/linux/core_portme-c.html b/tests/riscv-coremark/coremark/docs/html/files/linux/core_portme-c.html similarity index 100% rename from riscv-coremark/coremark/docs/html/files/linux/core_portme-c.html rename to tests/riscv-coremark/coremark/docs/html/files/linux/core_portme-c.html diff --git a/riscv-coremark/coremark/docs/html/files/linux/core_portme-h.html b/tests/riscv-coremark/coremark/docs/html/files/linux/core_portme-h.html similarity index 100% rename from riscv-coremark/coremark/docs/html/files/linux/core_portme-h.html rename to tests/riscv-coremark/coremark/docs/html/files/linux/core_portme-h.html diff --git a/riscv-coremark/coremark/docs/html/files/linux/core_portme-mak.html b/tests/riscv-coremark/coremark/docs/html/files/linux/core_portme-mak.html similarity index 100% rename from riscv-coremark/coremark/docs/html/files/linux/core_portme-mak.html rename to tests/riscv-coremark/coremark/docs/html/files/linux/core_portme-mak.html diff --git a/riscv-coremark/coremark/docs/html/files/readme-txt.html b/tests/riscv-coremark/coremark/docs/html/files/readme-txt.html similarity index 100% rename from riscv-coremark/coremark/docs/html/files/readme-txt.html rename to tests/riscv-coremark/coremark/docs/html/files/readme-txt.html diff --git a/riscv-coremark/coremark/docs/html/files/release_notes-txt.html b/tests/riscv-coremark/coremark/docs/html/files/release_notes-txt.html similarity index 100% rename from riscv-coremark/coremark/docs/html/files/release_notes-txt.html rename to tests/riscv-coremark/coremark/docs/html/files/release_notes-txt.html diff --git a/riscv-coremark/coremark/docs/html/index.html b/tests/riscv-coremark/coremark/docs/html/index.html similarity index 100% rename from riscv-coremark/coremark/docs/html/index.html rename to tests/riscv-coremark/coremark/docs/html/index.html diff --git a/riscv-coremark/coremark/docs/html/index/BuildTargets.html b/tests/riscv-coremark/coremark/docs/html/index/BuildTargets.html similarity index 100% rename from riscv-coremark/coremark/docs/html/index/BuildTargets.html rename to tests/riscv-coremark/coremark/docs/html/index/BuildTargets.html diff --git a/riscv-coremark/coremark/docs/html/index/Configuration.html b/tests/riscv-coremark/coremark/docs/html/index/Configuration.html similarity index 100% rename from riscv-coremark/coremark/docs/html/index/Configuration.html rename to tests/riscv-coremark/coremark/docs/html/index/Configuration.html diff --git a/riscv-coremark/coremark/docs/html/index/Configurations.html b/tests/riscv-coremark/coremark/docs/html/index/Configurations.html similarity index 100% rename from riscv-coremark/coremark/docs/html/index/Configurations.html rename to tests/riscv-coremark/coremark/docs/html/index/Configurations.html diff --git a/riscv-coremark/coremark/docs/html/index/Files.html b/tests/riscv-coremark/coremark/docs/html/index/Files.html similarity index 100% rename from riscv-coremark/coremark/docs/html/index/Files.html rename to tests/riscv-coremark/coremark/docs/html/index/Files.html diff --git a/riscv-coremark/coremark/docs/html/index/Functions.html b/tests/riscv-coremark/coremark/docs/html/index/Functions.html similarity index 100% rename from riscv-coremark/coremark/docs/html/index/Functions.html rename to tests/riscv-coremark/coremark/docs/html/index/Functions.html diff --git a/riscv-coremark/coremark/docs/html/index/General.html b/tests/riscv-coremark/coremark/docs/html/index/General.html similarity index 100% rename from riscv-coremark/coremark/docs/html/index/General.html rename to tests/riscv-coremark/coremark/docs/html/index/General.html diff --git a/riscv-coremark/coremark/docs/html/index/General2.html b/tests/riscv-coremark/coremark/docs/html/index/General2.html similarity index 100% rename from riscv-coremark/coremark/docs/html/index/General2.html rename to tests/riscv-coremark/coremark/docs/html/index/General2.html diff --git a/riscv-coremark/coremark/docs/html/index/Types.html b/tests/riscv-coremark/coremark/docs/html/index/Types.html similarity index 100% rename from riscv-coremark/coremark/docs/html/index/Types.html rename to tests/riscv-coremark/coremark/docs/html/index/Types.html diff --git a/riscv-coremark/coremark/docs/html/index/Variables.html b/tests/riscv-coremark/coremark/docs/html/index/Variables.html similarity index 100% rename from riscv-coremark/coremark/docs/html/index/Variables.html rename to tests/riscv-coremark/coremark/docs/html/index/Variables.html diff --git a/riscv-coremark/coremark/docs/html/javascript/main.js b/tests/riscv-coremark/coremark/docs/html/javascript/main.js similarity index 100% rename from riscv-coremark/coremark/docs/html/javascript/main.js rename to tests/riscv-coremark/coremark/docs/html/javascript/main.js diff --git a/riscv-coremark/coremark/docs/html/javascript/searchdata.js b/tests/riscv-coremark/coremark/docs/html/javascript/searchdata.js similarity index 100% rename from riscv-coremark/coremark/docs/html/javascript/searchdata.js rename to tests/riscv-coremark/coremark/docs/html/javascript/searchdata.js diff --git a/riscv-coremark/coremark/docs/html/search/BuildTargetsP.html b/tests/riscv-coremark/coremark/docs/html/search/BuildTargetsP.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/BuildTargetsP.html rename to tests/riscv-coremark/coremark/docs/html/search/BuildTargetsP.html diff --git a/riscv-coremark/coremark/docs/html/search/ConfigurationC.html b/tests/riscv-coremark/coremark/docs/html/search/ConfigurationC.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/ConfigurationC.html rename to tests/riscv-coremark/coremark/docs/html/search/ConfigurationC.html diff --git a/riscv-coremark/coremark/docs/html/search/ConfigurationH.html b/tests/riscv-coremark/coremark/docs/html/search/ConfigurationH.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/ConfigurationH.html rename to tests/riscv-coremark/coremark/docs/html/search/ConfigurationH.html diff --git a/riscv-coremark/coremark/docs/html/search/ConfigurationM.html b/tests/riscv-coremark/coremark/docs/html/search/ConfigurationM.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/ConfigurationM.html rename to tests/riscv-coremark/coremark/docs/html/search/ConfigurationM.html diff --git a/riscv-coremark/coremark/docs/html/search/ConfigurationS.html b/tests/riscv-coremark/coremark/docs/html/search/ConfigurationS.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/ConfigurationS.html rename to tests/riscv-coremark/coremark/docs/html/search/ConfigurationS.html diff --git a/riscv-coremark/coremark/docs/html/search/ConfigurationT.html b/tests/riscv-coremark/coremark/docs/html/search/ConfigurationT.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/ConfigurationT.html rename to tests/riscv-coremark/coremark/docs/html/search/ConfigurationT.html diff --git a/riscv-coremark/coremark/docs/html/search/ConfigurationU.html b/tests/riscv-coremark/coremark/docs/html/search/ConfigurationU.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/ConfigurationU.html rename to tests/riscv-coremark/coremark/docs/html/search/ConfigurationU.html diff --git a/riscv-coremark/coremark/docs/html/search/ConfigurationsH.html b/tests/riscv-coremark/coremark/docs/html/search/ConfigurationsH.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/ConfigurationsH.html rename to tests/riscv-coremark/coremark/docs/html/search/ConfigurationsH.html diff --git a/riscv-coremark/coremark/docs/html/search/ConfigurationsM.html b/tests/riscv-coremark/coremark/docs/html/search/ConfigurationsM.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/ConfigurationsM.html rename to tests/riscv-coremark/coremark/docs/html/search/ConfigurationsM.html diff --git a/riscv-coremark/coremark/docs/html/search/ConfigurationsS.html b/tests/riscv-coremark/coremark/docs/html/search/ConfigurationsS.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/ConfigurationsS.html rename to tests/riscv-coremark/coremark/docs/html/search/ConfigurationsS.html diff --git a/riscv-coremark/coremark/docs/html/search/ConfigurationsT.html b/tests/riscv-coremark/coremark/docs/html/search/ConfigurationsT.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/ConfigurationsT.html rename to tests/riscv-coremark/coremark/docs/html/search/ConfigurationsT.html diff --git a/riscv-coremark/coremark/docs/html/search/FilesC.html b/tests/riscv-coremark/coremark/docs/html/search/FilesC.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/FilesC.html rename to tests/riscv-coremark/coremark/docs/html/search/FilesC.html diff --git a/riscv-coremark/coremark/docs/html/search/FilesR.html b/tests/riscv-coremark/coremark/docs/html/search/FilesR.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/FilesR.html rename to tests/riscv-coremark/coremark/docs/html/search/FilesR.html diff --git a/riscv-coremark/coremark/docs/html/search/FunctionsC.html b/tests/riscv-coremark/coremark/docs/html/search/FunctionsC.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/FunctionsC.html rename to tests/riscv-coremark/coremark/docs/html/search/FunctionsC.html diff --git a/riscv-coremark/coremark/docs/html/search/FunctionsG.html b/tests/riscv-coremark/coremark/docs/html/search/FunctionsG.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/FunctionsG.html rename to tests/riscv-coremark/coremark/docs/html/search/FunctionsG.html diff --git a/riscv-coremark/coremark/docs/html/search/FunctionsI.html b/tests/riscv-coremark/coremark/docs/html/search/FunctionsI.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/FunctionsI.html rename to tests/riscv-coremark/coremark/docs/html/search/FunctionsI.html diff --git a/riscv-coremark/coremark/docs/html/search/FunctionsM.html b/tests/riscv-coremark/coremark/docs/html/search/FunctionsM.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/FunctionsM.html rename to tests/riscv-coremark/coremark/docs/html/search/FunctionsM.html diff --git a/riscv-coremark/coremark/docs/html/search/FunctionsP.html b/tests/riscv-coremark/coremark/docs/html/search/FunctionsP.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/FunctionsP.html rename to tests/riscv-coremark/coremark/docs/html/search/FunctionsP.html diff --git a/riscv-coremark/coremark/docs/html/search/FunctionsS.html b/tests/riscv-coremark/coremark/docs/html/search/FunctionsS.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/FunctionsS.html rename to tests/riscv-coremark/coremark/docs/html/search/FunctionsS.html diff --git a/riscv-coremark/coremark/docs/html/search/FunctionsT.html b/tests/riscv-coremark/coremark/docs/html/search/FunctionsT.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/FunctionsT.html rename to tests/riscv-coremark/coremark/docs/html/search/FunctionsT.html diff --git a/riscv-coremark/coremark/docs/html/search/GeneralB.html b/tests/riscv-coremark/coremark/docs/html/search/GeneralB.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/GeneralB.html rename to tests/riscv-coremark/coremark/docs/html/search/GeneralB.html diff --git a/riscv-coremark/coremark/docs/html/search/GeneralC.html b/tests/riscv-coremark/coremark/docs/html/search/GeneralC.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/GeneralC.html rename to tests/riscv-coremark/coremark/docs/html/search/GeneralC.html diff --git a/riscv-coremark/coremark/docs/html/search/GeneralD.html b/tests/riscv-coremark/coremark/docs/html/search/GeneralD.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/GeneralD.html rename to tests/riscv-coremark/coremark/docs/html/search/GeneralD.html diff --git a/riscv-coremark/coremark/docs/html/search/GeneralF.html b/tests/riscv-coremark/coremark/docs/html/search/GeneralF.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/GeneralF.html rename to tests/riscv-coremark/coremark/docs/html/search/GeneralF.html diff --git a/riscv-coremark/coremark/docs/html/search/GeneralG.html b/tests/riscv-coremark/coremark/docs/html/search/GeneralG.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/GeneralG.html rename to tests/riscv-coremark/coremark/docs/html/search/GeneralG.html diff --git a/riscv-coremark/coremark/docs/html/search/GeneralH.html b/tests/riscv-coremark/coremark/docs/html/search/GeneralH.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/GeneralH.html rename to tests/riscv-coremark/coremark/docs/html/search/GeneralH.html diff --git a/riscv-coremark/coremark/docs/html/search/GeneralI.html b/tests/riscv-coremark/coremark/docs/html/search/GeneralI.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/GeneralI.html rename to tests/riscv-coremark/coremark/docs/html/search/GeneralI.html diff --git a/riscv-coremark/coremark/docs/html/search/GeneralL.html b/tests/riscv-coremark/coremark/docs/html/search/GeneralL.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/GeneralL.html rename to tests/riscv-coremark/coremark/docs/html/search/GeneralL.html diff --git a/riscv-coremark/coremark/docs/html/search/GeneralM.html b/tests/riscv-coremark/coremark/docs/html/search/GeneralM.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/GeneralM.html rename to tests/riscv-coremark/coremark/docs/html/search/GeneralM.html diff --git a/riscv-coremark/coremark/docs/html/search/GeneralO.html b/tests/riscv-coremark/coremark/docs/html/search/GeneralO.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/GeneralO.html rename to tests/riscv-coremark/coremark/docs/html/search/GeneralO.html diff --git a/riscv-coremark/coremark/docs/html/search/GeneralP.html b/tests/riscv-coremark/coremark/docs/html/search/GeneralP.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/GeneralP.html rename to tests/riscv-coremark/coremark/docs/html/search/GeneralP.html diff --git a/riscv-coremark/coremark/docs/html/search/GeneralR.html b/tests/riscv-coremark/coremark/docs/html/search/GeneralR.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/GeneralR.html rename to tests/riscv-coremark/coremark/docs/html/search/GeneralR.html diff --git a/riscv-coremark/coremark/docs/html/search/GeneralS.html b/tests/riscv-coremark/coremark/docs/html/search/GeneralS.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/GeneralS.html rename to tests/riscv-coremark/coremark/docs/html/search/GeneralS.html diff --git a/riscv-coremark/coremark/docs/html/search/GeneralT.html b/tests/riscv-coremark/coremark/docs/html/search/GeneralT.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/GeneralT.html rename to tests/riscv-coremark/coremark/docs/html/search/GeneralT.html diff --git a/riscv-coremark/coremark/docs/html/search/GeneralU.html b/tests/riscv-coremark/coremark/docs/html/search/GeneralU.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/GeneralU.html rename to tests/riscv-coremark/coremark/docs/html/search/GeneralU.html diff --git a/riscv-coremark/coremark/docs/html/search/GeneralV.html b/tests/riscv-coremark/coremark/docs/html/search/GeneralV.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/GeneralV.html rename to tests/riscv-coremark/coremark/docs/html/search/GeneralV.html diff --git a/riscv-coremark/coremark/docs/html/search/GeneralW.html b/tests/riscv-coremark/coremark/docs/html/search/GeneralW.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/GeneralW.html rename to tests/riscv-coremark/coremark/docs/html/search/GeneralW.html diff --git a/riscv-coremark/coremark/docs/html/search/NoResults.html b/tests/riscv-coremark/coremark/docs/html/search/NoResults.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/NoResults.html rename to tests/riscv-coremark/coremark/docs/html/search/NoResults.html diff --git a/riscv-coremark/coremark/docs/html/search/TypesS.html b/tests/riscv-coremark/coremark/docs/html/search/TypesS.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/TypesS.html rename to tests/riscv-coremark/coremark/docs/html/search/TypesS.html diff --git a/riscv-coremark/coremark/docs/html/search/VariablesC.html b/tests/riscv-coremark/coremark/docs/html/search/VariablesC.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/VariablesC.html rename to tests/riscv-coremark/coremark/docs/html/search/VariablesC.html diff --git a/riscv-coremark/coremark/docs/html/search/VariablesD.html b/tests/riscv-coremark/coremark/docs/html/search/VariablesD.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/VariablesD.html rename to tests/riscv-coremark/coremark/docs/html/search/VariablesD.html diff --git a/riscv-coremark/coremark/docs/html/search/VariablesL.html b/tests/riscv-coremark/coremark/docs/html/search/VariablesL.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/VariablesL.html rename to tests/riscv-coremark/coremark/docs/html/search/VariablesL.html diff --git a/riscv-coremark/coremark/docs/html/search/VariablesO.html b/tests/riscv-coremark/coremark/docs/html/search/VariablesO.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/VariablesO.html rename to tests/riscv-coremark/coremark/docs/html/search/VariablesO.html diff --git a/riscv-coremark/coremark/docs/html/search/VariablesP.html b/tests/riscv-coremark/coremark/docs/html/search/VariablesP.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/VariablesP.html rename to tests/riscv-coremark/coremark/docs/html/search/VariablesP.html diff --git a/riscv-coremark/coremark/docs/html/search/VariablesR.html b/tests/riscv-coremark/coremark/docs/html/search/VariablesR.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/VariablesR.html rename to tests/riscv-coremark/coremark/docs/html/search/VariablesR.html diff --git a/riscv-coremark/coremark/docs/html/search/VariablesS.html b/tests/riscv-coremark/coremark/docs/html/search/VariablesS.html similarity index 100% rename from riscv-coremark/coremark/docs/html/search/VariablesS.html rename to tests/riscv-coremark/coremark/docs/html/search/VariablesS.html diff --git a/riscv-coremark/coremark/docs/html/styles/1.css b/tests/riscv-coremark/coremark/docs/html/styles/1.css similarity index 100% rename from riscv-coremark/coremark/docs/html/styles/1.css rename to tests/riscv-coremark/coremark/docs/html/styles/1.css diff --git a/riscv-coremark/coremark/docs/html/styles/2.css b/tests/riscv-coremark/coremark/docs/html/styles/2.css similarity index 100% rename from riscv-coremark/coremark/docs/html/styles/2.css rename to tests/riscv-coremark/coremark/docs/html/styles/2.css diff --git a/riscv-coremark/coremark/docs/html/styles/main.css b/tests/riscv-coremark/coremark/docs/html/styles/main.css similarity index 100% rename from riscv-coremark/coremark/docs/html/styles/main.css rename to tests/riscv-coremark/coremark/docs/html/styles/main.css diff --git a/riscv-coremark/coremark/freebsd/core_portme.mak b/tests/riscv-coremark/coremark/freebsd/core_portme.mak similarity index 100% rename from riscv-coremark/coremark/freebsd/core_portme.mak rename to tests/riscv-coremark/coremark/freebsd/core_portme.mak diff --git a/riscv-coremark/coremark/linux/core_portme.c b/tests/riscv-coremark/coremark/linux/core_portme.c similarity index 100% rename from riscv-coremark/coremark/linux/core_portme.c rename to tests/riscv-coremark/coremark/linux/core_portme.c diff --git a/riscv-coremark/coremark/linux/core_portme.h b/tests/riscv-coremark/coremark/linux/core_portme.h similarity index 100% rename from riscv-coremark/coremark/linux/core_portme.h rename to tests/riscv-coremark/coremark/linux/core_portme.h diff --git a/riscv-coremark/coremark/linux/core_portme.mak b/tests/riscv-coremark/coremark/linux/core_portme.mak similarity index 100% rename from riscv-coremark/coremark/linux/core_portme.mak rename to tests/riscv-coremark/coremark/linux/core_portme.mak diff --git a/riscv-coremark/coremark/linux64/core_portme.c b/tests/riscv-coremark/coremark/linux64/core_portme.c similarity index 100% rename from riscv-coremark/coremark/linux64/core_portme.c rename to tests/riscv-coremark/coremark/linux64/core_portme.c diff --git a/riscv-coremark/coremark/linux64/core_portme.h b/tests/riscv-coremark/coremark/linux64/core_portme.h similarity index 100% rename from riscv-coremark/coremark/linux64/core_portme.h rename to tests/riscv-coremark/coremark/linux64/core_portme.h diff --git a/riscv-coremark/coremark/linux64/core_portme.mak b/tests/riscv-coremark/coremark/linux64/core_portme.mak similarity index 100% rename from riscv-coremark/coremark/linux64/core_portme.mak rename to tests/riscv-coremark/coremark/linux64/core_portme.mak diff --git a/riscv-coremark/coremark/macos/core_portme.mak b/tests/riscv-coremark/coremark/macos/core_portme.mak similarity index 100% rename from riscv-coremark/coremark/macos/core_portme.mak rename to tests/riscv-coremark/coremark/macos/core_portme.mak diff --git a/riscv-coremark/coremark/posix/core_portme.c b/tests/riscv-coremark/coremark/posix/core_portme.c similarity index 100% rename from riscv-coremark/coremark/posix/core_portme.c rename to tests/riscv-coremark/coremark/posix/core_portme.c diff --git a/riscv-coremark/coremark/posix/core_portme.h b/tests/riscv-coremark/coremark/posix/core_portme.h similarity index 100% rename from riscv-coremark/coremark/posix/core_portme.h rename to tests/riscv-coremark/coremark/posix/core_portme.h diff --git a/riscv-coremark/coremark/posix/core_portme.mak b/tests/riscv-coremark/coremark/posix/core_portme.mak similarity index 100% rename from riscv-coremark/coremark/posix/core_portme.mak rename to tests/riscv-coremark/coremark/posix/core_portme.mak diff --git a/riscv-coremark/coremark/posix/core_portme_posix_overrides.h b/tests/riscv-coremark/coremark/posix/core_portme_posix_overrides.h similarity index 100% rename from riscv-coremark/coremark/posix/core_portme_posix_overrides.h rename to tests/riscv-coremark/coremark/posix/core_portme_posix_overrides.h diff --git a/riscv-coremark/coremark/rtems/core_portme.mak b/tests/riscv-coremark/coremark/rtems/core_portme.mak similarity index 100% rename from riscv-coremark/coremark/rtems/core_portme.mak rename to tests/riscv-coremark/coremark/rtems/core_portme.mak diff --git a/riscv-coremark/coremark/rtems/init.c b/tests/riscv-coremark/coremark/rtems/init.c similarity index 100% rename from riscv-coremark/coremark/rtems/init.c rename to tests/riscv-coremark/coremark/rtems/init.c diff --git a/riscv-coremark/coremark/simple/core_portme.c b/tests/riscv-coremark/coremark/simple/core_portme.c similarity index 100% rename from riscv-coremark/coremark/simple/core_portme.c rename to tests/riscv-coremark/coremark/simple/core_portme.c diff --git a/riscv-coremark/coremark/simple/core_portme.h b/tests/riscv-coremark/coremark/simple/core_portme.h similarity index 100% rename from riscv-coremark/coremark/simple/core_portme.h rename to tests/riscv-coremark/coremark/simple/core_portme.h diff --git a/riscv-coremark/coremark/simple/core_portme.mak b/tests/riscv-coremark/coremark/simple/core_portme.mak similarity index 100% rename from riscv-coremark/coremark/simple/core_portme.mak rename to tests/riscv-coremark/coremark/simple/core_portme.mak diff --git a/riscv-coremark/extraPortmes/README.md b/tests/riscv-coremark/extraPortmes/README.md similarity index 100% rename from riscv-coremark/extraPortmes/README.md rename to tests/riscv-coremark/extraPortmes/README.md diff --git a/riscv-coremark/extraPortmes/cygwin/core_portme.c b/tests/riscv-coremark/extraPortmes/cygwin/core_portme.c similarity index 100% rename from riscv-coremark/extraPortmes/cygwin/core_portme.c rename to tests/riscv-coremark/extraPortmes/cygwin/core_portme.c diff --git a/riscv-coremark/extraPortmes/cygwin/core_portme.h b/tests/riscv-coremark/extraPortmes/cygwin/core_portme.h similarity index 100% rename from riscv-coremark/extraPortmes/cygwin/core_portme.h rename to tests/riscv-coremark/extraPortmes/cygwin/core_portme.h diff --git a/riscv-coremark/extraPortmes/cygwin/core_portme.mak b/tests/riscv-coremark/extraPortmes/cygwin/core_portme.mak similarity index 100% rename from riscv-coremark/extraPortmes/cygwin/core_portme.mak rename to tests/riscv-coremark/extraPortmes/cygwin/core_portme.mak diff --git a/riscv-coremark/extraPortmes/linux/core_portme.c b/tests/riscv-coremark/extraPortmes/linux/core_portme.c similarity index 100% rename from riscv-coremark/extraPortmes/linux/core_portme.c rename to tests/riscv-coremark/extraPortmes/linux/core_portme.c diff --git a/riscv-coremark/extraPortmes/linux/core_portme.h b/tests/riscv-coremark/extraPortmes/linux/core_portme.h similarity index 100% rename from riscv-coremark/extraPortmes/linux/core_portme.h rename to tests/riscv-coremark/extraPortmes/linux/core_portme.h diff --git a/riscv-coremark/extraPortmes/linux/core_portme.mak b/tests/riscv-coremark/extraPortmes/linux/core_portme.mak similarity index 100% rename from riscv-coremark/extraPortmes/linux/core_portme.mak rename to tests/riscv-coremark/extraPortmes/linux/core_portme.mak diff --git a/riscv-coremark/extraPortmes/linux64/core_portme.c b/tests/riscv-coremark/extraPortmes/linux64/core_portme.c similarity index 100% rename from riscv-coremark/extraPortmes/linux64/core_portme.c rename to tests/riscv-coremark/extraPortmes/linux64/core_portme.c diff --git a/riscv-coremark/extraPortmes/linux64/core_portme.h b/tests/riscv-coremark/extraPortmes/linux64/core_portme.h similarity index 100% rename from riscv-coremark/extraPortmes/linux64/core_portme.h rename to tests/riscv-coremark/extraPortmes/linux64/core_portme.h diff --git a/riscv-coremark/extraPortmes/linux64/core_portme.mak b/tests/riscv-coremark/extraPortmes/linux64/core_portme.mak similarity index 100% rename from riscv-coremark/extraPortmes/linux64/core_portme.mak rename to tests/riscv-coremark/extraPortmes/linux64/core_portme.mak diff --git a/riscv-coremark/riscv64-baremetal/core_portme.c b/tests/riscv-coremark/riscv64-baremetal/core_portme.c similarity index 100% rename from riscv-coremark/riscv64-baremetal/core_portme.c rename to tests/riscv-coremark/riscv64-baremetal/core_portme.c diff --git a/riscv-coremark/riscv64-baremetal/core_portme.h b/tests/riscv-coremark/riscv64-baremetal/core_portme.h similarity index 100% rename from riscv-coremark/riscv64-baremetal/core_portme.h rename to tests/riscv-coremark/riscv64-baremetal/core_portme.h diff --git a/riscv-coremark/riscv64-baremetal/core_portme.mak b/tests/riscv-coremark/riscv64-baremetal/core_portme.mak similarity index 100% rename from riscv-coremark/riscv64-baremetal/core_portme.mak rename to tests/riscv-coremark/riscv64-baremetal/core_portme.mak diff --git a/riscv-coremark/riscv64-baremetal/crt.S b/tests/riscv-coremark/riscv64-baremetal/crt.S similarity index 100% rename from riscv-coremark/riscv64-baremetal/crt.S rename to tests/riscv-coremark/riscv64-baremetal/crt.S diff --git a/riscv-coremark/riscv64-baremetal/encoding.h b/tests/riscv-coremark/riscv64-baremetal/encoding.h similarity index 100% rename from riscv-coremark/riscv64-baremetal/encoding.h rename to tests/riscv-coremark/riscv64-baremetal/encoding.h diff --git a/riscv-coremark/riscv64-baremetal/link.ld b/tests/riscv-coremark/riscv64-baremetal/link.ld similarity index 100% rename from riscv-coremark/riscv64-baremetal/link.ld rename to tests/riscv-coremark/riscv64-baremetal/link.ld diff --git a/riscv-coremark/riscv64-baremetal/syscallbackup.c b/tests/riscv-coremark/riscv64-baremetal/syscallbackup.c similarity index 100% rename from riscv-coremark/riscv64-baremetal/syscallbackup.c rename to tests/riscv-coremark/riscv64-baremetal/syscallbackup.c diff --git a/riscv-coremark/riscv64-baremetal/syscalls.c b/tests/riscv-coremark/riscv64-baremetal/syscalls.c similarity index 100% rename from riscv-coremark/riscv64-baremetal/syscalls.c rename to tests/riscv-coremark/riscv64-baremetal/syscalls.c diff --git a/riscv-coremark/riscv64-baremetal/util.h b/tests/riscv-coremark/riscv64-baremetal/util.h similarity index 100% rename from riscv-coremark/riscv64-baremetal/util.h rename to tests/riscv-coremark/riscv64-baremetal/util.h diff --git a/riscv-coremark/riscv64/core_portme.c b/tests/riscv-coremark/riscv64/core_portme.c similarity index 100% rename from riscv-coremark/riscv64/core_portme.c rename to tests/riscv-coremark/riscv64/core_portme.c diff --git a/riscv-coremark/riscv64/core_portme.h b/tests/riscv-coremark/riscv64/core_portme.h similarity index 100% rename from riscv-coremark/riscv64/core_portme.h rename to tests/riscv-coremark/riscv64/core_portme.h diff --git a/riscv-coremark/riscv64/core_portme.mak b/tests/riscv-coremark/riscv64/core_portme.mak similarity index 100% rename from riscv-coremark/riscv64/core_portme.mak rename to tests/riscv-coremark/riscv64/core_portme.mak diff --git a/riscv-coremark/trace b/tests/riscv-coremark/trace similarity index 100% rename from riscv-coremark/trace rename to tests/riscv-coremark/trace diff --git a/riscv-coremark/transferobjump.sh b/tests/riscv-coremark/transferobjump.sh similarity index 100% rename from riscv-coremark/transferobjump.sh rename to tests/riscv-coremark/transferobjump.sh diff --git a/testsBP/crt0/Makefile b/tests/testsBP/crt0/Makefile similarity index 100% rename from testsBP/crt0/Makefile rename to tests/testsBP/crt0/Makefile diff --git a/testsBP/crt0/isr.s b/tests/testsBP/crt0/isr.s similarity index 100% rename from testsBP/crt0/isr.s rename to tests/testsBP/crt0/isr.s diff --git a/testsBP/crt0/pcnt_driver.h b/tests/testsBP/crt0/pcnt_driver.h similarity index 100% rename from testsBP/crt0/pcnt_driver.h rename to tests/testsBP/crt0/pcnt_driver.h diff --git a/testsBP/crt0/pcnt_driver.s b/tests/testsBP/crt0/pcnt_driver.s similarity index 100% rename from testsBP/crt0/pcnt_driver.s rename to tests/testsBP/crt0/pcnt_driver.s diff --git a/testsBP/crt0/pre_main.c b/tests/testsBP/crt0/pre_main.c similarity index 100% rename from testsBP/crt0/pre_main.c rename to tests/testsBP/crt0/pre_main.c diff --git a/testsBP/crt0/start.s b/tests/testsBP/crt0/start.s similarity index 100% rename from testsBP/crt0/start.s rename to tests/testsBP/crt0/start.s diff --git a/testsBP/fpga-blink-led/Makefile b/tests/testsBP/fpga-blink-led/Makefile similarity index 100% rename from testsBP/fpga-blink-led/Makefile rename to tests/testsBP/fpga-blink-led/Makefile diff --git a/testsBP/fpga-blink-led/blink-led.s b/tests/testsBP/fpga-blink-led/blink-led.s similarity index 100% rename from testsBP/fpga-blink-led/blink-led.s rename to tests/testsBP/fpga-blink-led/blink-led.s diff --git a/testsBP/james_mm/Makefile b/tests/testsBP/james_mm/Makefile similarity index 100% rename from testsBP/james_mm/Makefile rename to tests/testsBP/james_mm/Makefile diff --git a/testsBP/james_mm/james_mm.c b/tests/testsBP/james_mm/james_mm.c similarity index 100% rename from testsBP/james_mm/james_mm.c rename to tests/testsBP/james_mm/james_mm.c diff --git a/testsBP/linker.x b/tests/testsBP/linker.x similarity index 100% rename from testsBP/linker.x rename to tests/testsBP/linker.x diff --git a/testsBP/linker1000.x b/tests/testsBP/linker1000.x similarity index 100% rename from testsBP/linker1000.x rename to tests/testsBP/linker1000.x diff --git a/testsBP/makefile.inc b/tests/testsBP/makefile.inc similarity index 100% rename from testsBP/makefile.inc rename to tests/testsBP/makefile.inc diff --git a/testsBP/mibench_qsort/LICENSE b/tests/testsBP/mibench_qsort/LICENSE similarity index 100% rename from testsBP/mibench_qsort/LICENSE rename to tests/testsBP/mibench_qsort/LICENSE diff --git a/testsBP/mibench_qsort/Makefile b/tests/testsBP/mibench_qsort/Makefile similarity index 100% rename from testsBP/mibench_qsort/Makefile rename to tests/testsBP/mibench_qsort/Makefile diff --git a/testsBP/mibench_qsort/qsort_small.c b/tests/testsBP/mibench_qsort/qsort_small.c similarity index 100% rename from testsBP/mibench_qsort/qsort_small.c rename to tests/testsBP/mibench_qsort/qsort_small.c diff --git a/testsBP/sieve/Makefile b/tests/testsBP/sieve/Makefile similarity index 100% rename from testsBP/sieve/Makefile rename to tests/testsBP/sieve/Makefile diff --git a/testsBP/sieve/sieve.c b/tests/testsBP/sieve/sieve.c similarity index 100% rename from testsBP/sieve/sieve.c rename to tests/testsBP/sieve/sieve.c diff --git a/testsBP/simple/Makefile b/tests/testsBP/simple/Makefile similarity index 100% rename from testsBP/simple/Makefile rename to tests/testsBP/simple/Makefile diff --git a/testsBP/simple/fail.s b/tests/testsBP/simple/fail.s similarity index 100% rename from testsBP/simple/fail.s rename to tests/testsBP/simple/fail.s diff --git a/testsBP/simple/global_hist_test.s b/tests/testsBP/simple/global_hist_test.s similarity index 100% rename from testsBP/simple/global_hist_test.s rename to tests/testsBP/simple/global_hist_test.s diff --git a/testsBP/simple/header.h b/tests/testsBP/simple/header.h similarity index 100% rename from testsBP/simple/header.h rename to tests/testsBP/simple/header.h diff --git a/testsBP/simple/lbu_test.s b/tests/testsBP/simple/lbu_test.s similarity index 100% rename from testsBP/simple/lbu_test.s rename to tests/testsBP/simple/lbu_test.s diff --git a/testsBP/simple/main.c b/tests/testsBP/simple/main.c similarity index 100% rename from testsBP/simple/main.c rename to tests/testsBP/simple/main.c diff --git a/testsBP/simple/sample.s b/tests/testsBP/simple/sample.s similarity index 100% rename from testsBP/simple/sample.s rename to tests/testsBP/simple/sample.s diff --git a/tests/wally-riscv-arch-test/.gitignore b/tests/wally-riscv-arch-test/.gitignore new file mode 100644 index 000000000..3203a4378 --- /dev/null +++ b/tests/wally-riscv-arch-test/.gitignore @@ -0,0 +1,11 @@ +# Ignore editor backup files +*~ +# Ignore transients generated by the tests +/.cproject +/.project +/work/ +/setup.env +#ignore Mac file system artifacts +*.DS_Store + +riscv-target/ diff --git a/tests/wally-riscv-arch-test/CHANGELOG.md b/tests/wally-riscv-arch-test/CHANGELOG.md new file mode 100644 index 000000000..cf6144267 --- /dev/null +++ b/tests/wally-riscv-arch-test/CHANGELOG.md @@ -0,0 +1,413 @@ +# CHANGELOG + +## [2.5.3] - 2021-10-15 + - fix the lower case `i` in the `RVTEST_CASE` macros used in the shift operation tests. + +## [2.5.2] - 2021-10-14 + - update format for aes32 and sm4 instructions + - update reference signature for sha256 and sm3 instructions in rv64i_m/K_unratified + - delete zip and unzip tests in rv64i_m/K_unratified + - update tests for aes64ks1i, sm4ed and sm4ks to use byte_count with overlap = "Y" to improve the coverage of S-boxes + +## [2.5.1] - 2021-10-07 + - added styles files to the F coverage report directories. + +## [2.5.0] - 2021-10-01 + - Added rv32f tests, references, coverage files and data propagation reports + - fixed broken links in READMEs across the repo. + - corrected string "EBREAK" in io string macro to "ECALL" for ecall.S tests. #207 + - fixed typo `.alive` --> `.align` in `riscv-target/example_target/model_test.h`. + +## [2.4.7] - 2021-10-01 + - Fix for the issue #206 + +## [2.4.6] - 2021-08-02 + - Added rv32e tests in riscv-test-suite + +## [2.4.5] - 2021-07-29 + - fix for issue #195 + +## [2.4.4] - 2021-07-19 + - Annotating tags during releases + +## [2.4.3] - 2021-05-20 + - added new 64-bit K crypto tests as per the test-plan presented by the scalar crypto task group + [here](https://github.com/riscv/riscv-crypto/blob/d89dfee25780f79c162da4eb69cd9076dd701c88/tests/compliance/test-plan-scalar.adoc) + - added new 32-bit K crypto tests as per the above mentioned test-plan. + - added coverage and data propagation reports for the above tests. + - updated README in riscv-test-suite + - added missing semi-colon in example target Makefile.include files + +## [2.4.2] - 2021-04-20 + - changed all occurances of SPTBR to the new name SATP + +## [2.4.1] - 2021-04-01 + - updated issue number in TestFormatSpec to be consistent with doc history + - adding a contribution guideline + - updated comment on usage of RISCV_DEVICE in Makefile.include + - updated licenses that are currently used by tests + - renamed K tests to K_unratified + - updated ci to build and upload pdf for testformatspec + +## [2.4.0] - 2021-03-26 +2021-03-26 Duncan Graham + - Added new K Crypto (scalar) (0.8.1) tests from Imperas + +## [2.3.1] - 2021-03-20 +### Changed + - Compliance Task Group changed to Architecture Test SIG in all docs and comments + - replacing old riscv-compliance link with new riscv-arch-test links + - fixed ci for release +### Removed + - spec/TestFormatSpec.pdf is removed since its old. Keeping only adoc file + - removing obsolete and commented out portions from doc/README + +## [2.3] - 2021-03-11 +### Added + - updated maintainers list in root-level readme + - updated the links to riscof, isac and ctg repos and docs in root-level readme + - adding CI to update versions automatically +### Removed + - replaced spike target with a REAMDE pointing to riscv-isa-sim/arch_test_target/README.md + +## [2.2] - 2021-01-28 + 2021-01-22 Tobias Wölfel + * Add missing base ISA check in riscv-test-suite + + 2021-01-20 Xiretza + * Deduplicate makefiles in riscv-test-suite + * Makefile: Fix ordering of simulate and verify targets to allow multi-job runs (make -j) + * Makefile.include: Document RISCV_TEST + * Makefile: use $(TARGETDIR) variable for postverify target instead of hard-coded path + + 2021-01-16 S Pawan Kumar + * Fixed NARGS macro defintion to work correctly. + + 2021-01-15 Xiretza + * style: Add a missing space to the "OK" message in verify.sh + + 2020-12-17 Neel Gala + * remove env folder symlinks from all riscv-test-suite src folders + * fixed assertion macros for ovpsim + * renamed RVTEST_ASSERT to RVMODEL_ASSERT in the Makefile and ovpsim macros + * tests updated with right set of "correctvals" + + 2020-11-24 Neel Gala + * added MIGRATION.adoc in doc directory to indicate how old framework targets can work with + changes made as part of this PR + * updated doc/README.adoc to avoid the word "compliance" and updated the section on porting a new + target to the framework. + * Added an example_target directory to host dummy files which can be used as a starting point for + porting targets. This was provided by MarcKarasek. + * migrated/ported existing targets (except codasip and sifive-formal) to the new framework + changes. + * in riscv-test-env/p/riscv_test.h changed names of RVTEST_[CODE/DATA]_[BEGIN/END] to + RVTEST_[CODE/DATA]_[BEGIN/END]_OLD respectively to avoid conflicts with the new framework macros. + * in riscv-test-env/p/riscv_test.h re-strutucture RVTEST_DATA_BEGIN_OLD/END to ensure that all + target specific data contents are introduced in RVTEST_DATA_END after the signature. + * added new file riscv-test-suite/env/arch_test.h which contains the macros used by the new set of + tests. A symlink to this in the riscv-test-env directory is also created. The arch_test also + includes aliases for the old macros. + * encoding.h moved to riscv-test-suite/env and a symlink to this file exists in riscv-test-env. + This was done to ensure that the arch_test.h and encoding.h are not to be modified by the + targets + * Added riscv-test-stats which includes coverage and data propagation reports for the tests + available in the riscv-test-suite directory. + * upddted the directory structure of the riscv-test-suite as per definition found in the + TestFormatSpec document. + * new set of tests with better coverage for rv[32/64][I,M,C, Zifencei] added. Almost all tests + were generated using the open source riscv_ctg tool. A few tests like fence, fencei, ebreak, + ecall, etc were handwritten/modified to follow the new macro conventions. + * Updated TestFormatSpec to avoid the word compliance and also updated the definitions of macros + and signatures + * created a root-level Makefile.include to decouple the Makefile and target specific settings. + * Added riscv-target and Makefile.include to the .gitignore file to stop tracking target specific + changes. + * Added special targets for compile(build), simulate(run) and verify in the Makefiles of each + test-suite. + * the existing riscv-targets have been either updated for the new framework or migrated to the + framework. + + 2020-10-15 Simon Davidmann + * riscvOVPsim enhanced and moved to its own respository: github.com/riscv-ovpsim + + 2020-04-24 Allen Baum + * fixed the I-SB-01.S and I-SH-01.S tests and associated reference signatures to account + of tests with negative offsets (which causes stores outside the signature area) + + 2020-03-19 Neel Gala + * restructuring the riscv-test-suite to indicate clearly what is deprecated, wip and usable + tests. + * based on the above fixed the directory structure for riscv-targets where-ever applicable. Only + tested riscvOVPsim and spike. + * fixed script bugs for spike as well + * renamed rv32i/I-IO.S to rv32i/I-IO-01.S along with necessary changes to the reference files + and Makefrag + * renamed mbadaddr csr to mtval as raised in issue #31 + * C.SWSP-01.S test updated to fix issue #37 + + 2020-03-18 Neel Gala + * fixed doc/README.adoc with correct version to pass the sanity-check in the doc/Makefile + + 2020-02-07 Prashanth Mundkur + * Support F extension on RV32 sail-riscv-c. + + 2019-12-01 Allen Baum + * modified macro names to conformn to riscof naming convention of model specific vs. pre-defined + * add more complete list of macros, their uses, parameters, and whether they are required or optional + * minor structural changes (moving sentences, renumbering) and typo fixes + * clarified impact of debug macros + * clarified how SIGUPD and BASEUPD must be used + * remove section about test taxonomy, binary tests, emulated ops + * clarify/fix boundary between test target and framework responsibilities + (split test target into test target and test shell) + * remove To Be discussed items that have been discussed + * remove default case condition; if conditions are unchanged, part of same case + * minor grammatical changes related to the above + + 2019-10-16 Allen Baum + * spec/TestFormatSpec.adoc: changed the format of the signature to fixed physical address size, fixed 32b data size extracted from COMPLIANCE_DATA_BEGIN/END range. + + * more gramatical fixes, clarifications added + * added To Be Discussed items regarding emulated instruction and binary tests + + 2019-09-11 Allen Baum + * spec/TestFormatSpec.adoc: more grammar and typo corrections and changes + clarified and added To Be Discussed issues + + 2019-09-11 Allen Baum + * spec/TestFormatSpec.adoc: many grammar and typo corrections and changes + removed many "to Be Discussed items and made them official + Added wording to clarify spec intent (work in progress/goal rather than final) + Added macros to ease test authoring: RVTEST_SIGBASE, RVTEST_SIGUPDATE, RVTEST_CASE + Added detail on proposals for connection to framework (how framework selects tests). + Expanded definition of signature format + Changed the (proposed) directory structure and naming convention to eliminate ambiguities, add consistancy and slightly better match existing structure + Added many "future work" items related to the above + Added examples and comments to code examples to indicate how proposed macros would be used + * .gitignore: added condition to ignore Mac file system artifacts + + + 2019-11-05 Lee Moore + * Restructured RV32I to move Zicsr and Zifencei into their own suites + + 2019-10-14 Lee Moore + * Added Ability to run a single test by using the Make Variable RISCV_TEST + for example, to only run the test I-ADD-01 from the rv32i suite + make RISCV_ISA=rv32i RISCV_TEST=I-ADD-01 + * Added Top Level Variable to Makefile RISCV_TARGET_FLAGS, + in the case of the RISCV_TARGET this can be passed and appended to the invocation + commandline configuration, for example to pass a command line flag to the RISCV_TARGET + to perform tracing. The value of this flag will be target specific + make RISCV_ISA=rv32i RISCV_TEST=I-ADD-01 RISCV_TARGET_FLAGS="--trace" + This is has also been added to all other targets to allow target configuration from + the commandline + + 2019-10-07 Philipp Wagner + * When executing the test suite, Ibex always writes an instruction + log. Update the Makefile to write it to a test-specific location + (next to all other log files). + * On Ibex, provide an additional .objdump-noalias disassembly file + with no aliases and numeric register names (instead of ABI names). + This file matches the Ibex trace and can be used to debug the test + runs. + + 2019-08-29 Robert Balas + * Added support for using RI5CY as a target. + * Added subdirectory riscv-target/ri5cy + + 2019-08-08 Lee Moore + * Added support for lowRISC/ibex RTL as a target using Verilator. + In conjunction with Philipp Wagner of lowRISC phw@lowrisc.org + + 2019-07-18 Paul Donahue + * Fix typos/grammar and use correct architectural terms. + + 2019-06-21 Ben Selfridge + * Added support for using the the GRIFT simulator as a target. + * Added subdirectory riscv-target/grift + * updated README.md and doc/README.adoc + + 2019-05-23 Prashanth Mundkur + * Added support and instructions for using the C and OCaml simulators from the Sail RISC-V formal model as targets. + * added subdirectories riscv-target/sail-riscv-c and riscv-target/sail-riscv-ocaml + * updated README.md and doc/README.adoc + + 2019-04-05 Allen Baum + * spec/TestFormatSpec.adoc: Adding details, minor corrections, ToBeDiscussed + items and clarifications to the specification of the future compliance test + suite. Also removing restrictions on having absolate addresses in signature + + 2019-02-21 Lee Moore + * Fixed bug in RVTEST_IO_ASSERT_GPR_EQ which was not preserving register t0 + * Corrected commit I-LUI-01.S, register target changed but missed assertion + + 2019-02-21 Deborah Soung + * added RiscvFormalSpec as a target with its own unique environment + + 2019-02-15 Radek Hajek + * updated rv32i tests to support all registers (x31) with assertions + * updated spec/TestFormatSpec.adoc example ISA test with new assertions + + 2019-02-05 Deborah Soung + * [Issue #33] fixing rv32si/ma_fetch.S test + * [Issue #32] fixing breakpoint test + + 2019-02-01 Lee Moore + * updated Infrastructure macros to support non-volatile registers + * updated riscvOVPsim + + 2019-01-29 Deborah Soung + * Added Rocket Chip generated cores as a target + * riscv-target/rocket/compliance_io.h created + * riscv-target/rocket/compliance_test.h created + * riscv-target/rocket/*/Makefile.include created for existing test suites + * README.adoc updated with instructions for using Rocket cores as targets + + 2019-01-22 Premysl Vaclavik + * feature: initial version of Compliance Test Format Specification + * This new document outlines how we should like the compliance + system to work going forward. By contrast the doc/README.adoc file + describes the current system as it is. + * Approved at Compliance TG meeting of 9 Jan 2019. + + 2019-01-02 Radek Hajek + * unified macros in all compliance tests + + 2018-12-20 Lee Moore + * fixed riscvOVPsim + + 2018-11-22 Simon Davidmann + * added information on test suite status + + 2018-11-21 Olof Kindgren + * Added support for using external target directories with $TARGETDIR + + 2018-11-21 Neel Gala + * riscv-test-suite/rv_/references/_.reference_output: changed signature + format for all tests to include only 4-bytes per line starting with the + most significant byte on the left. + * riscv-target/spike/device/rv_/Makefile.include: Added a patch for + spike-device Makefiles where the old-signature format is post-processed + to generate a signature in the new format at the end of each test. + * riscv-target/riscvOVPsim/device/rv_/Makefile.include: same patch as above. + * Makefile: default target for Makefile is now to run all tests supported by + the target mentioned defined by RISCV_TARGET variable. + + 2018-10-11 Simon Davidmann + * Ported github riscv/riscv-tests for RV32 processors to this compliance env + * rv32ua rv32uc rv32ud rv32uf rv32ud rv32ui + + 2018-09-10 Lee Moore + * Added tests to RV32I to improve coverage, usage of Imperas Mutating Fault Simulator to + identify untested usage cases + * Macro renames to support GPR, (S)FPR, (D)FPR + * Added test suite RV32IM to test 32 bit Multiply and Divide instructions + * Added test suite RV32IMC to test 32 bit Compressed instructions + * Added test suite RV64I to test 64 bit Integer instructions + * Added test suite RV64IM to test 64 bit Multiply and Divide instructions + + + 2018-06-15 Radek Hajek + + Modifications to support Codasip simulator. + + The simulator is renamed as Codasip-simulator (was + Codasip-IA-simulator), compliance_test.h has been moved to target + directories and a COMPILE_TARGET has been added to Makefile to + allow use of LLVM. + + * Makefile: Include Codasip simulator target. + * riscv-target/codasip-IA-simulator/compliance_io.h: Renamed as + riscv-target/Codasip-simulator/compliance_io.h. + * riscv-target/Codasip-simulator/compliance_io.h: Renamed from + riscv-target/codasip-IA-simulator/compliance_io. + * riscv-target/Codasip-simulator/compliance_test.h: Created. + * riscv-target/codasip-IA-simulator/device/rv32i/Makefile.include: + Renamed as + riscv-target/Codasip-simulator/device/rv32i/Makefile.include + * riscv-target/Codasip-simulator/device/rv32i/Makefile.include: + Renamed from + riscv-target/codasip-IA-simulator/device/rv32i/Makefile.include. + * riscv-test-env/compliance_test.h: Renamed as + riscv-target/riscvOVPsim/compliance_test.h. + * riscv-target/riscvOVPsim/compliance_test.h: Renamed from + riscv-test-env/compliance_test.h. + * riscv-target/riscvOVPsim/device/rv32i/Makefile.include: Updated + for new environment. + * riscv-target/spike/compliance_test.h: Created. + * riscv-target/spike/device/rv32i/Makefile.include: Updated for + new environment. + * riscv-test-suite/rv32i/Makefile: Likewise. + + 2018-06-10 Jeremy Bennett + + Put placeholders in empty directories to make sure they show in + the GitHub hierarchy. + + * riscv-test-suite/rv32i/.gitignore: Created. + * riscv-test-suite/rv32m/.gitignore: Created. + + 2018-06-10 Jeremy Bennett + + * README.md: Make references to files in the repo into links. + + 2018-06-09 Jeremy Bennett + + * .gitignore: Ignore editor backup files. + + 2018-06-09 Jeremy Bennett + + * README.md: Add better link to documentation README.md. + + 2018-06-08 Jeremy Bennett + + * README.md: Move AsciiDoc details into new README.md in the doc + directory. + + 2018-06-08 Jeremy Bennett + + * README.md: Fix typo in link to AsciiDoc cheat sheet + + 2018-06-08 Jeremy Bennett + + * COPYING.BSD: Created. + * COPYING.CC: Created. + * README.md: Add git process, licensing and engineering process. + + 2018-06-08 Jeremy Bennett + + * README.md: Correct details for running the compliance tests and + directory for OVPsim. + + 2018-06-08 Jeremy Bennett + + Clean restructuring to just the work of interest. + + * thought-experiments: Directory removed. + * .gitignore: Merged with TestStructure/.gitignore + * Makefile: Renamed from TestStructure/Makefile. + * TestStructure/Makefile: Renamed as Makefile. + * README.md: Merged with TestStructure/README.md. + * TestStructure/.gitignore: Deleted and contents moved into + .gitignore. + * TestStructure/README.md: Deleted and contents moved into + README.md. + * TestStructure/doc: Directory deleted. + * TestStructure/riscv-target: Directory moved to riscv-target. + * riscv-target: Directory moved from TestStructure/riscv-target + * TestStructure/riscv-test-env: Directory moved to riscv-test-env. + * riscv-test-env: Directory moved from + TestStructure/riscv-test-env. + * TestStructure/riscv-test-suite: Directory moved to + riscv-test-suite. + * riscv-test-suite: Directory moved from + TestStructure/riscv-test-suite. + * thought-experiments: Directory deleted. + + 2018-05-21 Jeremy Bennett + + Initial commit to populate the repository. + + * ChangeLog: Created. + * README.md: Created. diff --git a/tests/wally-riscv-arch-test/CONTRIBUTION.md b/tests/wally-riscv-arch-test/CONTRIBUTION.md new file mode 100644 index 000000000..01f4424c7 --- /dev/null +++ b/tests/wally-riscv-arch-test/CONTRIBUTION.md @@ -0,0 +1,66 @@ +# Contributing to RISC-V Architecture Tests + +Your inputs are welcome and greatly appreciated! We want to make contributing to this project as easy and transparent as possible, whether it's: + +- Reporting a bug +- Discussing the current state of the code +- Submitting a fix +- Proposing new features +- Becoming a maintainer + +## We develop with Github +We use github to host code, to track issues and feature requests, as well as accept pull requests. + +## We use a simple git flow where all code changes happen through Pull Requests + +Pull requests are the best way to propose changes to the codebase. We actively welcome your pull requests: + +1. Fork the repo and create your branch from `master`. +2. If you have added new tests, please ensure they adhere to the latest TestFormatSpec and that you have run them on the RVI approved reference + models (if support in those models is available). +3. If you have updated any test-macros make sure to update the documentation as well. +4. If you have updated the docs, ensure that they render correctly in the respective format. +5. Make sure to create an entry in the CHANGELOG.md. Please refer to the section on versioning below + to choose an appropriate version number. +6. Ensure the existing tests are not broken and still pass on the the RVI approved reference models. +7. Please include a comment with the SPDX license identifier in all source files, for example: + ``` + // SPDX-License-Identifier: BSD-3-Clause + ``` +8. Issue that pull request! + +## Versioning + +When issuing pull requests, an entry in the CHANGELOG.md is mandatory. The arch-test-repo adheres to +the [`Semantic Versioning`](https://semver.org/spec/v2.0.0.html) scheme. Following guidelines must +be followed while assigning a new version number : + +- Patch-updates: all doc updates (like typos, more clarification,etc) and updates to unratified extensions. +- Minor-updates: Updates to ratified extensions OR migration of extensions to ratified OR changes in docs regarding policies or spec. +- Major-updates: Changes to the framework flow (backward compatible or incompatible). + +Note: You can have either a patch or minor or major update. +Note: In case of a conflict, the maintainers will decide the final version to be assigned. + +## Any contributions you make will be under the permissive open-source License +In short, when you submit code changes, your submissions are understood to be under a permissive open source license like BSD-3, Apache-2.0 and CC, etc that covers the project. Feel free to contact the maintainers if that's a concern. + +## Report bugs using Github's [issues](https://github.com/riscv/riscv-arch-test/issues) +We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/riscv/riscv-arch-test/issues/new); it's that easy! + +## Write bug reports with detail, background, and sample code + +**Great Bug Reports** tend to have: + +- A quick summary and/or background +- Steps to reproduce + - Be specific! + - Give sample code if you can. +- What you expected would happen +- What actually happens +- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work) + +## License +By contributing, you agree that your contributions will be licensed under its permissive open source +licenses. + diff --git a/tests/wally-riscv-arch-test/COPYING.APACHE b/tests/wally-riscv-arch-test/COPYING.APACHE new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/tests/wally-riscv-arch-test/COPYING.APACHE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/tests/wally-riscv-arch-test/COPYING.BSD b/tests/wally-riscv-arch-test/COPYING.BSD new file mode 100644 index 000000000..1d9da10ca --- /dev/null +++ b/tests/wally-riscv-arch-test/COPYING.BSD @@ -0,0 +1,9 @@ +Copyright (c) . All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/tests/wally-riscv-arch-test/COPYING.CC b/tests/wally-riscv-arch-test/COPYING.CC new file mode 100644 index 000000000..0fb847eb0 --- /dev/null +++ b/tests/wally-riscv-arch-test/COPYING.CC @@ -0,0 +1,395 @@ +Attribution 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution 4.0 International Public License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution 4.0 International Public License ("Public License"). To the +extent this Public License may be interpreted as a contract, You are +granted the Licensed Rights in consideration of Your acceptance of +these terms and conditions, and the Licensor grants You such rights in +consideration of benefits the Licensor receives from making the +Licensed Material available under these terms and conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + + c. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + d. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + e. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + f. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + g. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + h. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + i. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + j. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + k. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part; and + + b. produce, reproduce, and Share Adapted Material. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + 4. If You Share Adapted Material You produce, the Adapter's + License You apply must not prevent recipients of the Adapted + Material from complying with this Public License. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material; and + + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + + +======================================================================= + +Creative Commons is not a party to its public +licenses. Notwithstanding, Creative Commons may elect to apply one of +its public licenses to material it publishes and in those instances +will be considered the “Licensor.” The text of the Creative Commons +public licenses is dedicated to the public domain under the CC0 Public +Domain Dedication. Except for the limited purpose of indicating that +material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the +public licenses. + +Creative Commons may be contacted at creativecommons.org. diff --git a/tests/wally-riscv-arch-test/Makefile b/tests/wally-riscv-arch-test/Makefile new file mode 100644 index 000000000..8e817231d --- /dev/null +++ b/tests/wally-riscv-arch-test/Makefile @@ -0,0 +1,123 @@ +# +# Ensure the compiler and necessary executables are on the search PATH +# + +# +# Ensure you have set the following Variables +# +# +export ROOTDIR = $(shell pwd) +export WORK ?= $(ROOTDIR)/work + +include Makefile.include + +pipe:= | +empty:= +comma:= , +space:= $(empty) $(empty) + +RISCV_ISA_ALL = $(shell ls $(TARGETDIR)/$(RISCV_TARGET)/device/rv$(XLEN)i_m) +RISCV_ISA_OPT = $(subst $(space),$(pipe),$(RISCV_ISA_ALL)) + +RISCV_ISA_ALL := $(filter-out Makefile.include,$(RISCV_ISA_ALL)) + +ifeq ($(RISCV_DEVICE),) + RISCV_DEVICE = I + DEFAULT_TARGET=all_variant +else + DEFAULT_TARGET=variant +endif +export SUITEDIR = $(ROOTDIR)/riscv-test-suite/rv$(XLEN)i_m/$(RISCV_DEVICE) + +$(info ) +$(info ============================ VARIABLE INFO ==================================) +$(info ROOTDIR: ${ROOTDIR} [origin: $(origin ROOTDIR)]) +$(info WORK: ${WORK} [origin: $(origin WORK)]) +$(info TARGETDIR: ${TARGETDIR} [origin: $(origin TARGETDIR)]) +$(info RISCV_TARGET: ${RISCV_TARGET} [origin: $(origin RISCV_TARGET)]) +$(info XLEN: ${XLEN} [origin: $(origin XLEN)]) +$(info RISCV_DEVICE: ${RISCV_DEVICE} [origin: $(origin RISCV_DEVICE)]) +$(info =============================================================================) +$(info ) + +RVTEST_DEFINES = +ifeq ($(RISCV_ASSERT),1) + RVTEST_DEFINES += -DRVMODEL_ASSERT +endif +export RVTEST_DEFINES + +VERBOSE ?= 0 +ifeq ($(VERBOSE),1) + export V= + export REDIR1 = + export REDIR2 = +else + export V=@ + export REDIR1 = 1>/dev/null + export REDIR2 = 2>/dev/null +endif + +default: $(DEFAULT_TARGET) + +variant: simulate verify + +all_variant: + @for isa in $(RISCV_ISA_ALL); do \ + $(MAKE) $(JOBS) RISCV_TARGET=$(RISCV_TARGET) RISCV_TARGET_FLAGS="$(RISCV_TARGET_FLAGS)" RISCV_DEVICE=$$isa variant; \ + rc=$$?; \ + if [ $$rc -ne 0 ]; then \ + exit $$rc; \ + fi \ + done + +build: compile +run: simulate +clean_all: clean + +compile: + $(MAKE) $(JOBS) \ + RISCV_TARGET=$(RISCV_TARGET) \ + RISCV_DEVICE=$(RISCV_DEVICE) \ + compile -C $(SUITEDIR) + +simulate: + $(MAKE) $(JOBS) \ + RISCV_TARGET=$(RISCV_TARGET) \ + RISCV_DEVICE=$(RISCV_DEVICE) \ + run -C $(SUITEDIR) + +verify: simulate + riscv-test-env/verify.sh + +postverify: +ifeq ($(wildcard $(TARGETDIR)/$(RISCV_TARGET)/postverify.sh),) + $(info No post verify script found $(TARGETDIR)/$(RISCV_TARGET)/postverify.sh) +else + $(TARGETDIR)/$(RISCV_TARGET)/postverify.sh +endif + +clean: + $(MAKE) $(JOBS) \ + RISCV_TARGET=$(RISCV_TARGET) \ + RISCV_DEVICE=$(RISCV_DEVICE) \ + clean -C $(SUITEDIR) + +help: + @echo "RISC-V Architectural Tests" + @echo "" + @echo " Makefile Environment Variables to be set per Target" + @echo " -- TARGETDIR=''" + @echo " -- XLEN=''" + @echo " -- RISCV_TARGET=''" + @echo " -- RISCV_TARGET_FLAGS=''" + @echo " -- RISCV_DEVICE='$(RISCV_ISA_OPT)' [ leave empty to run all devices ]" + @echo " -- RISCV_TEST=' + * README.adoc: Documentation for rocket chip as target. + +2019-02-05 Deborah Soung + * README.adoc: Update documentation for rocket chip as target (fixed rv32si/ma_fetch.S). + * README.adoc: Update documentation for rocket chip as target (fixed breakpoint.S). + +2019-01-29 Deborah Soung + * README.adoc: Documentation for rocket chip as target. + +2018-11-21 Olof Kindgren + + * README.adoc (Repository structure) Added documentation for the $TARGETDIR environmental variable + +2018-11-21 Neel Gala + * README.adoc: Added new signature format spec. + +2018-06-18 Jeremy Bennett + + * README.adoc (Future work): Reflect changes made to support + Codasip simulator. + (Repository structure): Diagrammatic representation of the file + structure deleted. + +2018-06-12 Jeremy Bennett + + * .gitignore: Add custom.dict. + +2018-06-12 Jeremy Bennett + + Document issue 1.8 Draft. + + * README.adoc (Introduction): Add Future work section and bump + version. + * custom.wordlist: Add words needed for Future work section. + +2018-06-12 Jeremy Bennett + + * README.adoc: Remove special apostrophe from "licensor's". + * custom.wordlist: Updated with more words to be ignored. + +2018-06-12 Jeremy Bennett + + * README-old.md: Deleted. + * README.adoc: Include details of how to contribute and installing + the tools from the old README and reference the licence as an + appendix. + +2018-06-11 Jeremy Bennett + + This makes the document appear directly as the README of the doc + directory, so there is now no longer a need to publish to GitHub + pages. + + * .gitignore: Change name of files ignored. + * Makefile: Remove publish target. + * README.adoc: Symbolic link removed and replaced by design.adoc, + to which the CC license text has been added. + * design.adoc: Renamed as README.adoc. + * publish.sh: Deleted. + +2018-06-11 Jeremy Bennett + + * README.md: Previous version moved to README-old.md for the time + being. + * README.adoc: Created as symbolic link to design.adoc. + +2018-06-10 Jeremy Bennett + + * README.md: Note about make publish. + * design.adoc (Overall structure): Make list or instruction sets + and extensions compact representation. + +2018-06-10 Jeremy Bennett + + * publish.sh: Only publish from clean and committed master branch + to avoid difficult use of git stash. + +2018-06-10 Jeremy Bennett + + * publish.sh: Don't rely on doc directory being available on + gh-pages branch. + +2018-06-10 Jeremy Bennett + + * publish.sh: Make executable and correctly set top level + repository directory. + +2018-06-10 Jeremy Bennett + + Add a mechanism to make the latest documentation available via + GitHub pages. This means that design.html is no longer part of + the master branch, but is published by copying to index.html on + the gh-pages branch. + + * .gitignore: Ignore design.html. + * Makefile: Add publish target and delete design.html when cleaning. + * README.md: Link to GitHub pages for latest documentation. + * design.adoc: Deal with AsciiDoc apparent bug with consecutive + comment blogs. + * design.html: Deleted. + * publish.sh: Created. + +2018-06-10 Jeremy Bennett + + * README.md: Fix link to generated documentation. + * design.html: Regenerated. + +2018-06-09 Jeremy Bennett + + * Makefile: Add sanity check for version number and spell target. + * design.adoc: Fix trivial typo. + * design.html: Regenerated. + +2018-06-09 Jeremy Bennett + + * .gitignore: Don't ignore .html or .xml + * README.md: Note location of old documentation, give link to HTML + and explain how to contribute. + * custom.wordlist: Created. + * design.adoc: Cleaned up from top to bottom and spell checked. + * design.html: Generated. + +2018-06-08 Jeremy Bennett + + * Makefile: Clean up and add license header. + * README.md: Created. + * design.adoc: Add licensing and SPDX license identifier. + * legacy.adoc: Deleted. + +2018-06-04 Jeremy Bennett + + This is the first version of the document taken from Simon + Davidmann's MS Word document. The main document is design.adoc, + legacy material, currently just appendices C and D has been moved + to legacy.adoc. + + design.adoc is correct AsciiDoc. legacy.adoc is just a raw dump, + which needs cleaning up. + + The next step will be restructuring design.adoc as agreed. + + * .gitignore: Created. + * ChangeLog: Created. + * Makefile: Created. + * design.adoc: Created. + * legacy.adoc: Created. diff --git a/tests/wally-riscv-arch-test/doc/MIGRATION.adoc b/tests/wally-riscv-arch-test/doc/MIGRATION.adoc new file mode 100644 index 000000000..d9801c661 --- /dev/null +++ b/tests/wally-riscv-arch-test/doc/MIGRATION.adoc @@ -0,0 +1,88 @@ += Migration guide +:toc: +:icons: font +:numbered: +:source-highlighter: rouge + +This document serves as a guide to users of the architectural suite to migrate their targets from an +older version to a newer version with minimal changes. This guide thus provides a patch scheme to get +the previous versions of the targets up and running with the new versions of the framework. + +However, users are strongly encouraged to completely migrate to the newer versions, as and when +available, and avoid using these patches. + +== Migration from v0.1 to v0.2 + +This section will describe the changes required to transition your targets ported on v0.1 to v0.2 +framework. For examples please see: `riscv-target/riscvOVPsim_0p1` and `riscv-target/spike_0p1`. + +=== Change header filename + +In version v0.1 the target specific assembly macros were split across two files: `compliance_test.h` +and `compliance_io.h`. In version v0.2 these macros are to merged into a single file named +`model_test.h`. The following commands can the achieve the above: + +---- +mv compliance_test.h model_test.h +cat compliance_io.h >> model_test.h +rm compliance_io.h +---- + +=== Change device directory structure + +In version v0.1 a target would have one or multiple of the directories defined to indicate supported +extensions: `rv32i`, `rv32im`, `rv32imc`, `rv32Zicsr` and `rv32Zifencei`. In version v0.2 the +directories of the extensions have changed in order to provide more consistency and less ambiguity. + +For version v0.2, the `device` directory first needs to have either a `rv32i_m` directory to indicate +that the target is a 32-bit machine. The extension directories, as supported by the target, are +now to be created in each of these directories using the following mapping scheme: + +. device/rv32i -> device/rv32i_m/I +. device/rv32im -> device/rv32i_m/M +. device/rv32imc -> device/rv32i_m/C +. device/rv32Zicsr -> device/rv32i_m/privilege +. device/rv32Zifencei -> device/rv32i_m/Zifencei + +The contents of the extension directories need not change, unless there are dependencies on the path +of the directory itself. The following commands will achieve the above: + +---- +cd device +mkdir rv32i_m +mv rv32i rv32i_m/I +mv rv32im rv32i_m/M +mv rv32imc rv32i_m/C +mv rv32Zicsr rv32i_m/privilege +mv rv32Zifencei rv32i_m/Zifencei +---- + +=== Changes in target macro names. + +Since some of the macros from the old framework have been re-purposed in the new v0.2 framework, +there will be name conflicts rendering the old ones useless. In order to retain the old macros, they +have been renamed with a post-fix `_OLD`. The macros that have been renamed are given below: + +. `RVTEST_CODE_BEGIN` -> `RVTEST_CODE_BEGIN_OLD` +. `RVTEST_CODE_END` -> `RVTEST_CODE_END_OLD` +. `RVTEST_DATA_BEGIN` -> `RVTEST_DATA_BEGIN_OLD` +. `RVTEST_DATA_END` -> `RVTEST_DATA_END_OLD` + +The user is thus required to make the above changes in the new `model_test.h` that was created +as part of this migration. The following commands will help achieve the above: + +---- +sed -i 's/RVTEST_CODE_BEGIN/RVTEST_CODE_BEGIN_OLD/g' model_test.h +sed -i 's/RVTEST_CODE_END/RVTEST_CODE_END_OLD/g' model_test.h +sed -i 's/RVTEST_DATA_BEGIN/RVTEST_DATA_BEGIN_OLD/g' model_test.h +sed -i 's/RVTEST_DATA_END/RVTEST_DATA_END_OLD/g' model_test.h + +---- + +note:: the RVTEST_DATA_END in v0.1 enforced a 16-byte alignment before the signature end. This +constraint has been removed. + +=== Changes in device Makefile.include files + +No changes required. + diff --git a/tests/wally-riscv-arch-test/doc/Makefile b/tests/wally-riscv-arch-test/doc/Makefile new file mode 100644 index 000000000..697d89cdc --- /dev/null +++ b/tests/wally-riscv-arch-test/doc/Makefile @@ -0,0 +1,82 @@ +# Makefile for RISC-V Architectural Test SIG documentation + +# This file is part of the RISC-V Foundation Architectural Test SIG +# tool set and documentation. + +# Copyright (C) 2017 CodaSip Limited +# Copyright (C) 2018 Embecosm Limited . +# Copyright (C) 2018 Imperas Limited + +# All rights reserved. + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: + +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of mosquitto nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. + +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +# SPDX-License-Identifier: BSD-3-Clause + +ROOT = README +SRC = $(ROOT).adoc +SRC_STRIPPED = $(ROOT)-stripped.adoc + +.PHONY: all +all: pdf html + +.PHONY: pdf +pdf: $(ROOT).pdf + +$(ROOT).pdf: sanity-check $(SRC) + asciidoctor-pdf -d article $(SRC) + +.PHONY: html +html: $(ROOT).html + +$(ROOT).html: sanity-check $(SRC) + asciidoctor -d article -b html $(SRC) + +# It is all too easy for the document history and title page to have diverging +# version numbers. This target checks first. + +.PHONY: sanity-check +sanity-check: + @s=$$(sed -n < $(SRC) -e '3s/Issue //p') ; \ + t=$$(sed -n < $(SRC) -e "/== Document history/,/^$$/p" | \ + grep -c "$${s}") ; \ + if [ $${t} -ne 1 ] ; \ + then \ + echo "Version number of title and document history do not match" ; \ + exit 1 ; \ + fi + +custom.dict: custom.wordlist + aspell --lang=en create master ./$@ < $< + +.PHONY: spell +spell: custom.dict $(SRC) + sed < $(SRC) > $(SRC_STRIPPED) -e 's/`[^`]\+`//gp' -e '/^----$$/,/^----$$/d' + aspell --master=en_US --mode=none --add-extra-dicts=./custom.dict \ + -c $(SRC_STRIPPED) + $(RM) $(SRC_STRIPPED) + +clean: + rm -f $(ROOT)-stripped.adoc $(ROOT).pdf $(ROOT).html custom.dict diff --git a/tests/wally-riscv-arch-test/doc/README.adoc b/tests/wally-riscv-arch-test/doc/README.adoc new file mode 100644 index 000000000..fa7129b39 --- /dev/null +++ b/tests/wally-riscv-arch-test/doc/README.adoc @@ -0,0 +1,460 @@ += RISC-V Architectural Testing Framework = +RISC-V Foundation Architecture Test SIG +Issue 1.16 Draft +:toc: +:icons: font +:numbered: +:source-highlighter: rouge + +//// +SPDX-License-Identifier: CC-BY-4.0 + +Document conventions: +- one line per paragraph (don't fill lines - this makes changes clearer) +- Wikipedia heading conventions (First word only capitalized) +- US spelling throughout. +- Run "make spell" before committing changes. +- Build the HTML and commit it with any changed source. +- Do not commit the PDF! +//// + +== Introduction +=== About + +This document describes the RISC-V Architectural Testing framework which is used to test if a RISC-V device's has understood and implemented the specifications correctly + +* It explains the framework around the tests, the running of individual tests, and the suites of tests. + +* It explains how to set up targets to run the tests. + +This document is made freely available under a <>. + +=== Intent of the architectural test suite + +The RISC-V Architectural Tests are an evolving set of tests that are created to help ensure that software written for a given RISC-V Profile/Specification will run on all implementations that comply with that profile. + +These tests also help ensure that the implementer has both understood and implemented the specification correctly. + +The RISC-V Architectural Test suite is a minimal filter. Passing the tests and having the results approved by RISC-V International is a prerequisite to licensing the RISC-V trademarks in connection with the design. Passing the RISC-V Architectural Tests does not mean that the design complies with the RISC-V Architecture. These are only a basic set of tests checking important aspects of the specification without focusing on details. + +The RISC-V Architectural Tests are not a substitute for rigorous design verification. + +The result that the architecture tests provide to the user is an assurance that the specification has been interpreted correctly and the implementation under test (DUT) can be declared as RISC-V Architecture Test compliant. + +=== Intended audience + +This document is intended for design and verification engineers who wish to check if their RISC-V implementation (simulation models, HDL models, etc.) is compliant to the RISC-V specification. + +For those who wish to develop new architectural tests and/or to write or adapt their own test framework are suggested to read the link:../spec/TestFormatSpec.adoc[`Test Format Spec`]. + + +=== Contribute + +You are encouraged to contribute to this repository (including changes to this document) by submitting pull requests and by commenting on pull requests submitted by other people as described in the link:../README.md[`README.md`] file in the top level directory. + +While submitting a pull request note that some directories use `ChangeLog` files to track changes in the code and documentation. Please honor these, keeping them up to date and including the ChangeLog entry in the _git_ commit message. + +Make sure to also include a comment with the SPDX license identifier in all source files, for example: +``` +// SPDX-License-Identifier: BSD-3-Clause +``` + +NOTE: Don't forget to add your own name to the list of contributors in the document. + +== Licensing + +In general: + +* code is licensed under the BSD 3-clause license (SPDX license identifier `BSD-3-Clause`); +* documentation is licensed under the Creative Commons Attribution 4.0 International license (SPDX license identifier `CC-BY-4.0`). + +The files link:../COPYING.BSD[`COPYING.BSD`] and link:../COPYING.CC[`COPYING.CC`] in the top level directory contain the complete text of these licenses. + +NOTE: The riscv-ovpsim simulator is licensed under an Imperas license. There is no dependency on this and it is included as a convenience to users. + + +==== AsciiDoc + +This is a structured text format used by this document. Simple usage should be fairly self evident. + +* Comprehensive information on the format is on the http://www.methods.co.nz/asciidoc/[AsciiDoc website]. + +* Comprehensive information on the tooling on the https://asciidoctor.org/[AsciiDoctor website]. + +* You may find this https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/[cheat sheet] helpful. + +==== Installing tools + +To generate the documentation as HTML you need _asciidoctor_ and to generate as +PDF you need _asciidoctor-pdf_. + +* These are the https://asciidoctor.org/docs/install-toolchain/[installation instructions for asciidoctor]. + +* These are the https://asciidoctor.org/docs/asciidoctor-pdf/#install-the-published-gem[installation instructions for asciidoctor-pdf]. + +To spell check you need _aspell_ installed. + +==== Building the documentation + +To build HTML: +[source,make] +---- +make html +---- + +To build PDF: +[source,make] +---- +make pdf +---- + +To build both: +[source,make] +---- +make +---- + +To check the spelling (excludes any listing or code phrases): +[source,make] +---- +make spell +---- + +Any custom words for spell checking should be added to link:./custom.wordlist[`custom.wordlist`]. + +=== Contributors + +This document has been created by the following people (in alphabetical order of surname). + +* Jeremy Bennett +* Mary Bennett +* Simon Davidmann +* Neel Gala +* Radek Hajek +* Lee Moore +* Milan Nostersky +* Marcela Zachariasova + +=== Document history +[cols="<1,<2,<3,<4",options="header,pagewidth",] +|================================================================================ +| _Revision_ | _Date_ | _Author_ | _Modification_ +| 1.16 Draft | 23 September 2020 | Neel Gala| Changed Compliance to Architecture/Architectural. Refined the steps to port a new target. Removed simulator and target specific docs. Added vocabulary from the Test Format Specification +| 1.15 Draft | 14 March 2019 | +Prashanth Mundkur | + +Added support and instructions for using the C and OCaml simulators from the Sail RISC-V formal model as targets. +| 1.14 Draft | 21 February 2019 | +Deborah Soung | + +Documented how to use SiFive's RISC-V ISA Formal Specification model as a target. +| 1.13 Draft | 29 January 2019 | +Deborah Soung | + +Added documentation on how to use Rocket Chip generated cores as targets. +| 1.12 Draft | 22 November 2018 | +Simon Davidmann | + +Updated notes on Test Suites. +| 1.11 Draft | 21 November 2018 | +Neel Gala | + +Added new signature format specs . +| 1.10 Draft | 20 June 2018 | + +Simon Davidmann, Lee Moore | + +Cleaned up description of updated framework and inclusion of riscvOVPsim. + +| 1.9 Draft | 12 June 2018 | + +Jeremy Bennett | + +Update Future work section to take account of Codasip changes. Remove diagrammatic directory structure. + +| 1.8 Draft | 12 June 2018 | + +Jeremy Bennett | + +Add Future work section. + +| 1.7 Draft | 12 June 2018 | + +Jeremy Bennett | + +Add CC license as an appendix. + +| 1.6 Draft | 10 June 2018 | + +Jeremy Bennett | + +Tidy up areas that are flawed in HTML version. + +| 1.5 Draft | 8 June 2018 | + +Jeremy Bennett | + +General tidy up. + +| 1.4 Draft | 8 June 2018 | + +Jeremy Bennett | + +Added license preamble. + +| 1.3 Draft | 5 June 2018 | + +Simon Davidmann | + +Updated to reflect directory structure and trace macros. + +| 1.2 Draft | 3 June 2018 | + +Jeremy Bennett | + +Converted to AsciiDoc, cleaned up and restructured. + +| 1.1 Draft | 1 June 2018 | + +Simon Davidmann +Lee Moore | + +Revised format and expand to describe framework, usage of many tests groups, +and different Targets + +|1.0 | 24 December 2017 | + +Radek Hajek +Milan Nostersky +Marcela Zachariasova | + +First version of the document. + +|================================================================================ + +== Repository structure + +The top level directory contains : + + - a `README.md` file providing high-level details about the RISC-V Architecture Testing Framework. + - top level `Makefile` for running the tests on a RISC-V implementation. + - `ChangeLog` for logging changes with respect to code. + - complete license files for the Creative Commons and BSD licenses used by the task group. + +There are then five top level directories. + +`doc`:: All the documentation for the project, written using _AsciiDoc_. + +`coverage`:: This directory contains a sub-directory structure similar to the `riscv-test-suite` directory. The coverage reports of each test-suite are available in the corresponding directories. The reports are available in the html and yaml formats. The directory also contains multiple coverpoint YAMLs which capture all the coverpoints of interest which are covered by all the tests in the `riscv-test-suite` directory. + +`riscv-target`:: Contains a further subdirectory for each target, within which are placed the `model_test.h` header for that target and a `device` directory for all the devices of that target. If the `$TARGETDIR` environment variable is set to another directory, the scripts will search this directory for targets instead. + +`riscv-test-env`:: This contains the `verify.sh` script which checks if the signatures generated the riscv-target device match the statically hosted reference signatures at the end of simulation. The directory also contains symbolic-links to the `arch_test.h` and `encoding.h` files present in the `riscv-test-suite/env` directory. + +`riscv-test-suite`:: This contains a further `env` subdirectory which contains the `arch_test.h` and the `encoding.h` file which includes common assembly macros and routines which is used across the tests in the suite. Further directories are present which contain the actual architectural tests. The names and structure of these directories is based on the link:../test-pool structure guideline highlighted above. + +`riscv-ovpsim`:: This contains a README pointing to the Imperas OVP riscvOVPsim simulator for use in architectural testing. + +== Vocabulary +=== The architectural test + +At the heart of the testing infrastructure is the detailed <> available as `.S` assembly files. The specification and format of the tests is defined in the link:./TestFormatSpec.adoc[`Test Format Specification`]. + +=== The architectural test pool + +The <> are grouped into different functional test suites targeting the different subsets of the RISC-V specification. For more details on the test-pool structure, hierarchy and conventions please refer to the link:./TestFormatSpec.adoc[`Test Format Specification`]. + +For information on the currently supported different test suites, look here: link:../riscv-test-suite/README.md[../riscv-test-suite/README.md] + +=== The test signature + +Each test in the <> generates a <>, which represents the data written into specific memory locations during the execution of the test. The signature typically will record values (or sanitised values) of the operations carried out in the test. More details on the format and nature of the signatures is available in the link:./TestFormatSpec.adoc[`Test Format Specification`] + +=== The reference signature + +In order to claim that a device/implementation has passed the RISC-V Architecture Tests, the <> obtained from the execution of the tests on the implementation need to be compared against a set of _golden_ <>. These reference signatures are currently generated by the link:https://github.com/rems-project/sail-riscv[`RISC-V SAIL`] formal model and statically hosted in the repository for each test. + +=== The test target +The <> can be either a RISC-V Instruction Set Simulator (ISS), a RISC-V emulator, a RISC-V RTL model running on an HDL simulator, a RISC-V FPGA implementation or a physical chip. Each of the target types offers specific features and represents specific interface challenges. It is a role of the <> to handle different targets while using the same <> as a test source. + +=== The target shell +The <> is the software and hardware environment around the <> that enables it to communicate with the framework, including assembling and linking tests, loading tests into memory, executing tests, and extracting the signature. The input to the <> is a .S <> file, and the output is a <>. + + +== Porting a new target + + +In this section, a short tutorial on how to add a user target to the RISC-V Architectural Test Framework is provided. + +The following steps demonstrate an example in which a target was replaced by the RISCV-ISA-SIM +(a.k.a Spike). In a similar way, any RISC-V ISA simulator or any RTL simulation model of the +RISC-V processor can be ported as a potential target for testing. + +=== Setup environment variables + +NOTE: `ROOTDIR` will always point to the riscv-arch-test repo. + +1. Clone the repository: + + --- + git clone https://github.com/riscv/riscv-arch-test.git + cd riscv-arch-test + + --- + +2. Open the `Makefile.include` available in the root folder of the repository and edit the following +variables based on your target: + + a. `TARGETDIR` : set `TARGETDIR` to point to the directory which contains a sub-folder in the same name + as the target. For example, the arch-test repo includes the targets: sail-riscv-c and spike + under the `riscv-target` folder, in which case we set the `TARGETDIR` to riscv-target as shown + below. One can set this completely arbitrary paths as suitable by the user. + + + --- + export TARGETDIR ?= $(ROOTDIR)/riscv-target + + --- + + b. `XLEN`: set XLEN to max supported XLEN. Allowed values are 32 and 64. + + --- + export XLEN ?= 64 + + --- + +c. `RISCV_TARGET`: set this variable to the name of the target. A folder of the same name must exist in +the `TARGETDIR` directory + + --- + export RISCV_TARGET ?= spike + + --- + +d. `RISCV_DEVICE`: set the `RISCV_DEVICE` environment to the extension you want to compile, simulate and verify. Leave +this blank if you want to iterate through all the supported extensions of the target. Allowed values +are the individual names of the extensions supported by your target like: I, M, C or Zifencei, etc. Multiple extensions are not be provided. + + --- + export RISCV_DEVICE ?= + + --- + +e. `RISCV_TARGET_FLAGS`: set this to a string which needs to be passed to your target's Makefile.include files + + --- + export RISCV_TARGET_FLAGS ?= + + --- + +f. `RISCV_ASSERT`: set this if you want to enable assertions on the test-suites. **Currently no tests use assertions.** + + --- + export RISCV_ASSERT ?= 0 + + --- + +g. `JOBS`: set the number of parallel jobs (along with any other arguments) you would like to +execute. Note that the target needs to be coded in such a way to support parallel execution. Some +targets use common intermediate files, rather than unique files, which makes them unsuitable for +parallel execution, these targets will need to be re-coded. + + --- + JOBS= -j1 + + --- + +3. Now inside your `TARGETDIR/RISCV_TARGET` directory you will need to create the following files: + +a. `model_test.h`: A header file containing the definition of the various target specific +assembly macros that are required to compile and simulate the tests. The list and definition of the +required target specific macros is available in the link:../spec/TestFormatSpec.adoc[Test Format +Specification] + +b. `link.ld`: A linker script to compile the tests for your target. + +c. Any other files required by the target (configuration scripts, logs, etc.) can also be placed in +this directory. + +4. Inside the `TARGETDIR/RISCV_TARGET` directory create a new folder named: `device`. If your device +is a 32-bit target then create a directory `device/rv32i_m`. If your device is a 64-bit target then +create a directory `device/rv64i_m`. If your target is configurable on the `XLEN` parameter then +both the folders need to be created. + +5. Within the `rv32i_m`/`rv64i_m` directories sub-folders in the name of the extensions supported +by the target need to be created. For eg. A target supporting the ISA RV32IMC_Zifence will have the +following directory structure: + + --- + - rv32i_m/I + - rv32i_m/M + - rv32i_m/C + - rv32i_m/privilege + - rv32i_m/Zifencei + + --- + +6. Each of the above extension directories will now need to include a file: `Makefile.include` which +defines the following Makefile variables: + +a. `RUN_TARGET`:: This variable needs to include commands and steps to execute an ELF on target device. Note here that this variable should include all the necessary steps and arguments to run that specific test-suite. For example, in case of spike for the `rv32i_m/C` test-suite the corresponding `Makefile.include` has the `--isa=rv32ic` argument as opposed to just `--isa=rv32i` for the base `rv32i_m/I` test-suite. This variable should also include other steps to extract and sanitize the signature file as well for each test. The only argument available to this variable is the compiled `elf` file. + +b. `COMPILE_TARGET`:: This variable should include the commands and steps required to compile an assembly test for the target for each extension mentioned above. Note, currently only the GCC compiler is supported. This compiler takes `march` and `mabi` arguments from the corresponding architectural suite framework. `COMPILE_TARGET` will more or less be the same across test-suites. The only argument available to `COMPILE_TARGET` is the assembly file of one architectural test. + +The following figure depicts the final directory structure of a target device that should get created at the end of the above steps: + +[#img-testStruct] +.File Structure of the Target directory +image::./file-struct.jpg[TargetStruct] + + +=== Generating Signature + +As previously mentioned the execution of each test on the target must generate a signature file. The name of the signature file should be ``. The signature file should follow the guidelines mentioned in the link:../spec/TestFormatSpec.adoc[`Test Format Specification`]. + +In case of spike, we have ensured that the signature region is bounded by the labels: `begin_signature` and `end_signature`. This is enforced in the `RVMODEL_DATA_BEGIN` and `RVMODEL_DATA_END` macros defined in the `riscv-target/spike/model_test.h` file. Additionally, if you look closely at the `RUN_TARGET` variable defined in the `Makefile.include` files of the spike target, it includes a few bash commands to sanitize the signature produced from spike. This is done to conform the final signature file to the specification defined in the link:../spec/TestFormatSpec.adoc[`Test Format Specification`]. + +=== Compile, simulate and verify the tests + +Once you have ported your target to the riscv-arch-test framework by following the above steps, you +are now ready to compile, simulate and verify the tests on your target + +If you would like to compile, simulate and verify all the extension tests applicable to your target +simply run `make` from the `ROOTDIR`. + +NOTE: For the above to work the `RISCV_DEVICE` in `ROOTDIR/Makefile.include` must be left empty. + +If you would like to only compile the tests for a particular extension you can use the following +command. + + make RISCV_DEVICE=M compile + make RISCV_DEVICE=C compile + +The arguments to the `RISCV_DEVICE` variable must be the extensions supported by the target. +NOTE: If `RISCV_DEVICE` is not defined/empty it will default to the `I` extension which is necessary +for all targets. + +To simulate the compiled tests on your target: + + make RISCV_DEVICE=M simulate + make RISCV_DEVICE=Zifencei simulate + +NOTE: If `RISCV_DEVICE` is not defined/empty it will default to the `I` extension which is necessary +for all targets. + +To verify if the generated signatures match the corresponding reference signatures. + + make RISCV_DEVICE=M verify + +NOTE: If `RISCV_DEVICE` is not defined/empty it will default to the `I` extension which is necessary +for all targets. + +All the above steps create and modify files in the `work` directory created in `ROOTDIR` folder. To +clean the `workdir` simple run : + + make clean + +By default the working directory is set to `ROOTDIR/work`. This can be overwritten by assigning a +new working directory path via the command line. Note, the path must be absolute and not relative : + + make WORK=/home/me/my_path/mywork clean compile simulate diff --git a/tests/wally-riscv-arch-test/doc/custom.wordlist b/tests/wally-riscv-arch-test/doc/custom.wordlist new file mode 100644 index 000000000..2efdc5925 --- /dev/null +++ b/tests/wally-riscv-arch-test/doc/custom.wordlist @@ -0,0 +1,73 @@ +AsciiDoc +asciidoc +AsciiDoctor +asciidoctor +aspell +autotools +CGEN +cmake +Codasip +creativecommons +CY +Davidmann +discoverable +DUT +EF +enforceability +FPGA +GDB +Generis +github +Hajek +HDL +http +https +IC +ies +immunities +Imperas +io +IM +ISA +legalcode +licensor +licensors +licensor's +LLVM +makefile +makefiles +Marcela +md +merchantability +Nostersky +nz +pagewidth +parameterization +pdf +publicdomain +Radek +README +riscv +riscvOVPsim +RTL +rv +RVTEST +SiFive +spdx +src +subdirectory +sublicensable +synched +tbd +testbench +toc +toolchain +TVM +URI +Verilator +Verilog +waivable +WIPO +wordlist +www +Zachariasova diff --git a/tests/wally-riscv-arch-test/doc/file-struct.jpg b/tests/wally-riscv-arch-test/doc/file-struct.jpg new file mode 100644 index 000000000..7ddee1e84 Binary files /dev/null and b/tests/wally-riscv-arch-test/doc/file-struct.jpg differ diff --git a/tests/wally-riscv-arch-test/riscv-ovpsim/README.md b/tests/wally-riscv-arch-test/riscv-ovpsim/README.md new file mode 100644 index 000000000..1ee680815 --- /dev/null +++ b/tests/wally-riscv-arch-test/riscv-ovpsim/README.md @@ -0,0 +1,43 @@ +riscvOVPsim +=== +A Complete, Fully Functional, Configurable RISC-V Simulator +=== + +riscvOVPsim has moved to its own GitHub repository. + +It can now be found here: [github.com/riscv-ovpsim](https://github.com/riscv-ovpsim/imperas-riscv-tests) + +For the enhanced version, please download from [ovpworld.org/riscv-ovpsim-plus](https://www.ovpworld.org/riscvOVPsimPlus). + +The simulators implement the full and complete functionality of the RISC-V Foundation's public User and Privilege specifications. + +The simulator is command line configurable to enable/disable all current optional and processor specific options. + +The simulator is developed, licensed and maintained by [Imperas Software](http://www.imperas.com/riscv) and it is fully compliant to the OVP open standard APIs. + +As a member of the RISC-V Foundation community of software and hardware innovators collaboratively driving RISC-V adoption, Imperas has developed the riscvOVPsim simulator to assist RISC-V adopters to become compliant to the RISC-V specifications. The latest RISC-V compliance test suite and framework can be downloaded from https://www.github.com/riscv/riscv-compliance. + +riscvOVPsim includes an industrial quality model and simulator of RISC-V processors for use for compliance and test development. It has been developed for personal, academic, or commercial use, and the model is provided as open source under the Apache 2.0 license. The simulator is provided under the Open Virtual Platforms (OVP) Fixed Platform Kits license that enables download and usage. riscvOVPsim and Imperas RISC-V support is actively maintained and enhanced. To ensure you make use of the current version of riscvOVPsim versions do expire. Please download the latest version. + +![](riscvOVPsim.jpg) + +Extending riscvOVPsim and building your own models and platforms +--- +riscvOVPsim is a fixed function simulation of one configurable processor model in a fixed platform. +Full extendable platform simulations of reference designs booting FreeRTOS, Linux, SMP Linux etc. +are available as open source and are available from [www.IMPERAS.com](http://www.imperas.com), +[www.OVPworld.org](http://www.OVPworld.org). + +About Open Virtual Platforms (OVP) and Imperas Software +--- +**Open Virtual Platforms** was created in 2008 to provide an open standard set of APIs and methodology to develop virtual platforms and simulation technology. +[www.OVPworld.org](http://www.OVPworld.org/riscv). + +**Imperas Software Ltd.** is the leading independent commercial developer of virtual platforms and high-performance software simulation solutions for embedded processor and systems. Leading semiconductor and embedded software companies use Imperas simulators for their processor based simulation solutions. +[www.imperas.com](http://www.imperas.com/riscv). + +![OVP Image ](http://www.imperas.com/sites/default/files/partner-logos/ovp_0.jpg) +![Imperas Imperas](https://www.imperas.com/sites/default/files/imperas-web-logo_2.png) +--- + +This is the riscvOVPsim/README.md diff --git a/tests/wally-riscv-arch-test/riscv-ovpsim/riscvOVPsim.jpg b/tests/wally-riscv-arch-test/riscv-ovpsim/riscvOVPsim.jpg new file mode 100644 index 000000000..cee3f98ff Binary files /dev/null and b/tests/wally-riscv-arch-test/riscv-ovpsim/riscvOVPsim.jpg differ diff --git a/tests/wally-riscv-arch-test/riscv-test-env/LICENSE b/tests/wally-riscv-arch-test/riscv-test-env/LICENSE new file mode 100644 index 000000000..48fe522ac --- /dev/null +++ b/tests/wally-riscv-arch-test/riscv-test-env/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2012-2015, The Regents of the University of California (Regents). +All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. Neither the name of the Regents nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING +OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED +HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. diff --git a/tests/wally-riscv-arch-test/riscv-test-env/arch_test.h b/tests/wally-riscv-arch-test/riscv-test-env/arch_test.h new file mode 120000 index 000000000..c1b8c50bc --- /dev/null +++ b/tests/wally-riscv-arch-test/riscv-test-env/arch_test.h @@ -0,0 +1 @@ +../riscv-test-suite/env/arch_test.h \ No newline at end of file diff --git a/tests/wally-riscv-arch-test/riscv-test-env/encoding.h b/tests/wally-riscv-arch-test/riscv-test-env/encoding.h new file mode 120000 index 000000000..fd1833f03 --- /dev/null +++ b/tests/wally-riscv-arch-test/riscv-test-env/encoding.h @@ -0,0 +1 @@ +../riscv-test-suite/env/encoding.h \ No newline at end of file diff --git a/tests/wally-riscv-arch-test/riscv-test-env/p/link.ld b/tests/wally-riscv-arch-test/riscv-test-env/p/link.ld new file mode 100644 index 000000000..392e74f9e --- /dev/null +++ b/tests/wally-riscv-arch-test/riscv-test-env/p/link.ld @@ -0,0 +1,22 @@ +OUTPUT_ARCH( "riscv" ) +ENTRY(_start) + +SECTIONS +{ + . = 0x00000000; + .text.trap : { *(.text.trap) } + + . = 0x80000000; + .text.init : { *(.text.init) } + + . = ALIGN(0x1000); + .tohost : { *(.tohost) } + . = ALIGN(0x1000); + .text : { *(.text) } + . = ALIGN(0x1000); + .data : { *(.data) } + .data.string : { *(.data.string)} + .bss : { *(.bss) } + _end = .; +} + diff --git a/tests/wally-riscv-arch-test/riscv-test-env/p/riscv_test.h b/tests/wally-riscv-arch-test/riscv-test-env/p/riscv_test.h new file mode 100644 index 000000000..e452261c4 --- /dev/null +++ b/tests/wally-riscv-arch-test/riscv-test-env/p/riscv_test.h @@ -0,0 +1,251 @@ +// See LICENSE for license details. + +#ifndef _ENV_PHYSICAL_SINGLE_CORE_H +#define _ENV_PHYSICAL_SINGLE_CORE_H + +#include "../encoding.h" + +//----------------------------------------------------------------------- +// Begin Macro +//----------------------------------------------------------------------- + +#define RVTEST_RV64U \ + .macro init; \ + .endm + +#define RVTEST_RV64UF \ + .macro init; \ + RVTEST_FP_ENABLE; \ + .endm + +#define RVTEST_RV32U \ + .macro init; \ + .endm + +#define RVTEST_RV32UF \ + .macro init; \ + RVTEST_FP_ENABLE; \ + .endm + +#define RVTEST_RV64M \ + .macro init; \ + RVTEST_ENABLE_MACHINE; \ + .endm + +#define RVTEST_RV64S \ + .macro init; \ + RVTEST_ENABLE_SUPERVISOR; \ + .endm + +#define RVTEST_RV32M \ + .macro init; \ + RVTEST_ENABLE_MACHINE; \ + .endm + +#define RVTEST_RV32S \ + .macro init; \ + RVTEST_ENABLE_SUPERVISOR; \ + .endm + +#if __riscv_xlen == 64 +# define CHECK_XLEN li a0, 1; slli a0, a0, 31; bgez a0, 1f; RVTEST_PASS; 1: +#else +# define CHECK_XLEN li a0, 1; slli a0, a0, 31; bltz a0, 1f; RVTEST_PASS; 1: +#endif + +#define INIT_PMP \ + la t0, 1f; \ + csrw mtvec, t0; \ + li t0, -1; /* Set up a PMP to permit all accesses */ \ + csrw pmpaddr0, t0; \ + li t0, PMP_NAPOT | PMP_R | PMP_W | PMP_X; \ + csrw pmpcfg0, t0; \ + .align 2; \ +1: + +#define INIT_SATP \ + la t0, 1f; \ + csrw mtvec, t0; \ + csrwi satp, 0; \ + .align 2; \ +1: + +#define DELEGATE_NO_TRAPS \ + la t0, 1f; \ + csrw mtvec, t0; \ + csrwi medeleg, 0; \ + csrwi mideleg, 0; \ + csrwi mie, 0; \ + .align 2; \ +1: + +#define RVTEST_ENABLE_SUPERVISOR \ + li a0, MSTATUS_MPP & (MSTATUS_MPP >> 1); \ + csrs mstatus, a0; \ + li a0, SIP_SSIP | SIP_STIP; \ + csrs mideleg, a0; \ + +#define RVTEST_ENABLE_MACHINE \ + li a0, MSTATUS_MPP; \ + csrs mstatus, a0; \ + +#define RVTEST_FP_ENABLE \ + li a0, MSTATUS_FS & (MSTATUS_FS >> 1); \ + csrs mstatus, a0; \ + csrwi fcsr, 0 + +#define RISCV_MULTICORE_DISABLE \ + csrr a0, mhartid; \ + 1: bnez a0, 1b + +#define EXTRA_TVEC_USER +#define EXTRA_TVEC_MACHINE +#define EXTRA_INIT +#define EXTRA_INIT_TIMER + +// +// undefine some unusable CSR Accesses if no PRIV Mode present +// +#if defined(PRIV_MISA_S) +# if (PRIV_MISA_S==0) +# undef INIT_SATP +# define INIT_SATP +# undef INIT_PMP +# define INIT_PMP +# undef DELEGATE_NO_TRAPS +# define DELEGATE_NO_TRAPS +# undef RVTEST_ENABLE_SUPERVISOR +# define RVTEST_ENABLE_SUPERVISOR +# endif +#endif +#if defined(PRIV_MISA_U) +# if (PRIV_MISA_U==0) +# endif +#endif +#if defined(TRAPHANDLER) +#include TRAPHANDLER +#endif + +#define INTERRUPT_HANDLER j other_exception /* No interrupts should occur */ + +#define RVTEST_CODE_BEGIN_OLD \ + .section .text.init; \ + .align 6; \ + .weak stvec_handler; \ + .weak mtvec_handler; \ + .globl _start; \ +_start: \ + /* reset vector */ \ + j reset_vector; \ + .align 2; \ +trap_vector: \ + /* test whether the test came from pass/fail */ \ + csrr t5, mcause; \ + li t6, CAUSE_USER_ECALL; \ + beq t5, t6, write_tohost; \ + li t6, CAUSE_SUPERVISOR_ECALL; \ + beq t5, t6, write_tohost; \ + li t6, CAUSE_MACHINE_ECALL; \ + beq t5, t6, write_tohost; \ + /* if an mtvec_handler is defined, jump to it */ \ + la t5, mtvec_handler; \ + beqz t5, 1f; \ + jr t5; \ + /* was it an interrupt or an exception? */ \ + 1: csrr t5, mcause; \ + bgez t5, handle_exception; \ + INTERRUPT_HANDLER; \ +handle_exception: \ + /* we don't know how to handle whatever the exception was */ \ + other_exception: \ + /* some unhandlable exception occurred */ \ + 1: ori TESTNUM, TESTNUM, 1337; \ + write_tohost: \ + sw TESTNUM, tohost, t5; \ + j write_tohost; \ +reset_vector: \ + RISCV_MULTICORE_DISABLE; \ + INIT_SATP; \ + INIT_PMP; \ + DELEGATE_NO_TRAPS; \ + li TESTNUM, 0; \ + la t0, trap_vector; \ + csrw mtvec, t0; \ + CHECK_XLEN; \ + /* if an stvec_handler is defined, delegate exceptions to it */ \ + la t0, stvec_handler; \ + beqz t0, 1f; \ + csrw stvec, t0; \ + li t0, (1 << CAUSE_LOAD_PAGE_FAULT) | \ + (1 << CAUSE_STORE_PAGE_FAULT) | \ + (1 << CAUSE_FETCH_PAGE_FAULT) | \ + (1 << CAUSE_MISALIGNED_FETCH) | \ + (1 << CAUSE_USER_ECALL) | \ + (1 << CAUSE_BREAKPOINT); \ + csrw medeleg, t0; \ + csrr t1, medeleg; \ + bne t0, t1, other_exception; \ +1: csrwi mstatus, 0; \ + init; \ + EXTRA_INIT; \ + EXTRA_INIT_TIMER; \ + la t0, 1f; \ + csrw mepc, t0; \ + csrr a0, mhartid; \ + mret; \ +1: \ +begin_testcode: + + +//----------------------------------------------------------------------- +// End Macro +//----------------------------------------------------------------------- + +#define RVTEST_CODE_END_OLD \ +end_testcode: \ + ecall; + +//----------------------------------------------------------------------- +// Pass/Fail Macro +//----------------------------------------------------------------------- +#define RVTEST_SYNC fence +//#define RVTEST_SYNC nop + +#define RVTEST_PASS \ + RVTEST_SYNC; \ + li TESTNUM, 1; \ + SWSIG (0, TESTNUM); \ + ecall + +#define TESTNUM gp +#define RVTEST_FAIL \ + RVTEST_SYNC; \ +1: beqz TESTNUM, 1b; \ + sll TESTNUM, TESTNUM, 1; \ + or TESTNUM, TESTNUM, 1; \ + SWSIG (0, TESTNUM); \ + la x1, end_testcode; \ + jr x1; + +//----------------------------------------------------------------------- +// Data Section Macro +//----------------------------------------------------------------------- + +#define EXTRA_DATA + +#define RVTEST_DATA_BEGIN_OLD \ + .align 4; .global begin_signature; begin_signature: + +#define RVTEST_DATA_END_OLD \ + .align 4; .global end_signature; end_signature: \ + EXTRA_DATA \ + .pushsection .tohost,"aw",@progbits; \ + .align 8; .global tohost; tohost: .dword 0; \ + .align 8; .global fromhost; fromhost: .dword 0; \ + .popsection; \ + .align 8; .global begin_regstate; begin_regstate: \ + .word 128; \ + .align 8; .global end_regstate; end_regstate: \ + .word 4; + +#endif diff --git a/tests/wally-riscv-arch-test/riscv-test-env/pm/link.ld b/tests/wally-riscv-arch-test/riscv-test-env/pm/link.ld new file mode 100644 index 000000000..b3e315e78 --- /dev/null +++ b/tests/wally-riscv-arch-test/riscv-test-env/pm/link.ld @@ -0,0 +1,17 @@ +OUTPUT_ARCH( "riscv" ) +ENTRY(_start) + +SECTIONS +{ + . = 0x80000000; + .text.init : { *(.text.init) } + . = ALIGN(0x1000); + .tohost : { *(.tohost) } + . = ALIGN(0x1000); + .text : { *(.text) } + . = ALIGN(0x1000); + .data : { *(.data) } + .bss : { *(.bss) } + _end = .; +} + diff --git a/tests/wally-riscv-arch-test/riscv-test-env/pm/riscv_test.h b/tests/wally-riscv-arch-test/riscv-test-env/pm/riscv_test.h new file mode 100644 index 000000000..38a0e86b8 --- /dev/null +++ b/tests/wally-riscv-arch-test/riscv-test-env/pm/riscv_test.h @@ -0,0 +1,11 @@ +// See LICENSE for license details. + +#ifndef _ENV_PHYSICAL_MULTI_CORE_H +#define _ENV_PHYSICAL_MULTI_CORE_H + +#include "../p/riscv_test.h" + +#undef RISCV_MULTICORE_DISABLE +#define RISCV_MULTICORE_DISABLE + +#endif diff --git a/tests/wally-riscv-arch-test/riscv-test-env/pt/link.ld b/tests/wally-riscv-arch-test/riscv-test-env/pt/link.ld new file mode 100644 index 000000000..b3e315e78 --- /dev/null +++ b/tests/wally-riscv-arch-test/riscv-test-env/pt/link.ld @@ -0,0 +1,17 @@ +OUTPUT_ARCH( "riscv" ) +ENTRY(_start) + +SECTIONS +{ + . = 0x80000000; + .text.init : { *(.text.init) } + . = ALIGN(0x1000); + .tohost : { *(.tohost) } + . = ALIGN(0x1000); + .text : { *(.text) } + . = ALIGN(0x1000); + .data : { *(.data) } + .bss : { *(.bss) } + _end = .; +} + diff --git a/tests/wally-riscv-arch-test/riscv-test-env/pt/riscv_test.h b/tests/wally-riscv-arch-test/riscv-test-env/pt/riscv_test.h new file mode 100644 index 000000000..34c2a331a --- /dev/null +++ b/tests/wally-riscv-arch-test/riscv-test-env/pt/riscv_test.h @@ -0,0 +1,69 @@ +// See LICENSE for license details. + +#ifndef _ENV_PHYSICAL_SINGLE_CORE_TIMER_H +#define _ENV_PHYSICAL_SINGLE_CORE_TIMER_H + +#include "../p/riscv_test.h" + +#define TIMER_INTERVAL 2 + +#undef EXTRA_INIT_TIMER +#define EXTRA_INIT_TIMER \ + li a0, MIP_MTIP; \ + csrs mie, a0; \ + csrr a0, mtime; \ + addi a0, a0, TIMER_INTERVAL; \ + csrw mtimecmp, a0; \ + +#if SSTATUS_XS != 0x18000 +# error +#endif +#define XS_SHIFT 15 + +#undef INTERRUPT_HANDLER +#define INTERRUPT_HANDLER \ + slli t5, t5, 1; \ + srli t5, t5, 1; \ + add t5, t5, -IRQ_M_TIMER; \ + bnez t5, other_exception; /* other interrups shouldn't happen */\ + csrr t5, mtime; \ + addi t5, t5, TIMER_INTERVAL; \ + csrw mtimecmp, t5; \ + mret; \ + +//----------------------------------------------------------------------- +// Data Section Macro +//----------------------------------------------------------------------- + +#undef EXTRA_DATA +#define EXTRA_DATA \ + .align 3; \ +regspill: \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ + .dword 0xdeadbeefcafebabe; \ +evac: \ + .skip 32768; \ + +#endif diff --git a/tests/wally-riscv-arch-test/riscv-test-env/v/entry.S b/tests/wally-riscv-arch-test/riscv-test-env/v/entry.S new file mode 100644 index 000000000..97196620f --- /dev/null +++ b/tests/wally-riscv-arch-test/riscv-test-env/v/entry.S @@ -0,0 +1,125 @@ +#include "riscv_test.h" + +#if __riscv_xlen == 64 +# define STORE sd +# define LOAD ld +# define REGBYTES 8 +#else +# define STORE sw +# define LOAD lw +# define REGBYTES 4 +#endif + +#define STACK_TOP (_end + 4096) + + .section ".text.init","ax",@progbits + .globl _start +_start: + j handle_reset + + /* NMI vector */ +nmi_vector: + j wtf + +trap_vector: + j wtf + +handle_reset: + la t0, trap_vector + csrw mtvec, t0 + la sp, STACK_TOP - SIZEOF_TRAPFRAME_T + csrr t0, mhartid + slli t0, t0, 12 + add sp, sp, t0 + csrw mscratch, sp + la a0, userstart + j vm_boot + + .globl pop_tf +pop_tf: + LOAD t0,33*REGBYTES(a0) + csrw sepc,t0 + LOAD x1,1*REGBYTES(a0) + LOAD x2,2*REGBYTES(a0) + LOAD x3,3*REGBYTES(a0) + LOAD x4,4*REGBYTES(a0) + LOAD x5,5*REGBYTES(a0) + LOAD x6,6*REGBYTES(a0) + LOAD x7,7*REGBYTES(a0) + LOAD x8,8*REGBYTES(a0) + LOAD x9,9*REGBYTES(a0) + LOAD x11,11*REGBYTES(a0) + LOAD x12,12*REGBYTES(a0) + LOAD x13,13*REGBYTES(a0) + LOAD x14,14*REGBYTES(a0) + LOAD x15,15*REGBYTES(a0) + LOAD x16,16*REGBYTES(a0) + LOAD x17,17*REGBYTES(a0) + LOAD x18,18*REGBYTES(a0) + LOAD x19,19*REGBYTES(a0) + LOAD x20,20*REGBYTES(a0) + LOAD x21,21*REGBYTES(a0) + LOAD x22,22*REGBYTES(a0) + LOAD x23,23*REGBYTES(a0) + LOAD x24,24*REGBYTES(a0) + LOAD x25,25*REGBYTES(a0) + LOAD x26,26*REGBYTES(a0) + LOAD x27,27*REGBYTES(a0) + LOAD x28,28*REGBYTES(a0) + LOAD x29,29*REGBYTES(a0) + LOAD x30,30*REGBYTES(a0) + LOAD x31,31*REGBYTES(a0) + LOAD a0,10*REGBYTES(a0) + sret + + .global trap_entry +trap_entry: + csrrw sp, sscratch, sp + + # save gprs + STORE x1,1*REGBYTES(sp) + STORE x3,3*REGBYTES(sp) + STORE x4,4*REGBYTES(sp) + STORE x5,5*REGBYTES(sp) + STORE x6,6*REGBYTES(sp) + STORE x7,7*REGBYTES(sp) + STORE x8,8*REGBYTES(sp) + STORE x9,9*REGBYTES(sp) + STORE x10,10*REGBYTES(sp) + STORE x11,11*REGBYTES(sp) + STORE x12,12*REGBYTES(sp) + STORE x13,13*REGBYTES(sp) + STORE x14,14*REGBYTES(sp) + STORE x15,15*REGBYTES(sp) + STORE x16,16*REGBYTES(sp) + STORE x17,17*REGBYTES(sp) + STORE x18,18*REGBYTES(sp) + STORE x19,19*REGBYTES(sp) + STORE x20,20*REGBYTES(sp) + STORE x21,21*REGBYTES(sp) + STORE x22,22*REGBYTES(sp) + STORE x23,23*REGBYTES(sp) + STORE x24,24*REGBYTES(sp) + STORE x25,25*REGBYTES(sp) + STORE x26,26*REGBYTES(sp) + STORE x27,27*REGBYTES(sp) + STORE x28,28*REGBYTES(sp) + STORE x29,29*REGBYTES(sp) + STORE x30,30*REGBYTES(sp) + STORE x31,31*REGBYTES(sp) + + csrrw t0,sscratch,sp + STORE t0,2*REGBYTES(sp) + + # get sr, epc, badvaddr, cause + csrr t0,sstatus + STORE t0,32*REGBYTES(sp) + csrr t0,sepc + STORE t0,33*REGBYTES(sp) + csrr t0,sbadaddr + STORE t0,34*REGBYTES(sp) + csrr t0,scause + STORE t0,35*REGBYTES(sp) + + move a0, sp + j handle_trap diff --git a/tests/wally-riscv-arch-test/riscv-test-env/v/link.ld b/tests/wally-riscv-arch-test/riscv-test-env/v/link.ld new file mode 100644 index 000000000..b3e315e78 --- /dev/null +++ b/tests/wally-riscv-arch-test/riscv-test-env/v/link.ld @@ -0,0 +1,17 @@ +OUTPUT_ARCH( "riscv" ) +ENTRY(_start) + +SECTIONS +{ + . = 0x80000000; + .text.init : { *(.text.init) } + . = ALIGN(0x1000); + .tohost : { *(.tohost) } + . = ALIGN(0x1000); + .text : { *(.text) } + . = ALIGN(0x1000); + .data : { *(.data) } + .bss : { *(.bss) } + _end = .; +} + diff --git a/tests/wally-riscv-arch-test/riscv-test-env/v/riscv_test.h b/tests/wally-riscv-arch-test/riscv-test-env/v/riscv_test.h new file mode 100644 index 000000000..8ca9ffd76 --- /dev/null +++ b/tests/wally-riscv-arch-test/riscv-test-env/v/riscv_test.h @@ -0,0 +1,71 @@ +// See LICENSE for license details. + +#ifndef _ENV_VIRTUAL_SINGLE_CORE_H +#define _ENV_VIRTUAL_SINGLE_CORE_H + +#include "../p/riscv_test.h" + +//----------------------------------------------------------------------- +// Begin Macro +//----------------------------------------------------------------------- + +#undef RVTEST_FP_ENABLE +#define RVTEST_FP_ENABLE fssr x0 + +#undef RVTEST_CODE_BEGIN +#define RVTEST_CODE_BEGIN \ + .text; \ + .global userstart; \ +userstart: \ + init + +//----------------------------------------------------------------------- +// Pass/Fail Macro +//----------------------------------------------------------------------- + +#undef RVTEST_PASS +#define RVTEST_PASS li a0, 1; scall + +#undef RVTEST_FAIL +#define RVTEST_FAIL sll a0, TESTNUM, 1; 1:beqz a0, 1b; or a0, a0, 1; scall; + +//----------------------------------------------------------------------- +// Data Section Macro +//----------------------------------------------------------------------- + +#undef RVTEST_DATA_END +#define RVTEST_DATA_END + +//----------------------------------------------------------------------- +// Supervisor mode definitions and macros +//----------------------------------------------------------------------- + +#define MAX_TEST_PAGES 63 // this must be the period of the LFSR below +#define LFSR_NEXT(x) (((((x)^((x)>>1)) & 1) << 5) | ((x) >> 1)) + +#define PGSHIFT 12 +#define PGSIZE (1UL << PGSHIFT) + +#define SIZEOF_TRAPFRAME_T ((__riscv_xlen / 8) * 36) + +#ifndef __ASSEMBLER__ + +typedef unsigned long pte_t; +#define LEVELS (sizeof(pte_t) == sizeof(uint64_t) ? 3 : 2) +#define PTIDXBITS (PGSHIFT - (sizeof(pte_t) == 8 ? 3 : 2)) +#define VPN_BITS (PTIDXBITS * LEVELS) +#define VA_BITS (VPN_BITS + PGSHIFT) +#define PTES_PER_PT (1UL << RISCV_PGLEVEL_BITS) +#define MEGAPAGE_SIZE (PTES_PER_PT * PGSIZE) + +typedef struct +{ + long gpr[32]; + long sr; + long epc; + long badvaddr; + long cause; +} trapframe_t; +#endif + +#endif diff --git a/tests/wally-riscv-arch-test/riscv-test-env/v/string.c b/tests/wally-riscv-arch-test/riscv-test-env/v/string.c new file mode 100644 index 000000000..4ffedc0a4 --- /dev/null +++ b/tests/wally-riscv-arch-test/riscv-test-env/v/string.c @@ -0,0 +1,114 @@ +#include +#include +#include + +void* memcpy(void* dest, const void* src, size_t len) +{ + if ((((uintptr_t)dest | (uintptr_t)src | len) & (sizeof(uintptr_t)-1)) == 0) { + const uintptr_t* s = src; + uintptr_t *d = dest; + while (d < (uintptr_t*)(dest + len)) + *d++ = *s++; + } else { + const char* s = src; + char *d = dest; + while (d < (char*)(dest + len)) + *d++ = *s++; + } + return dest; +} + +void* memset(void* dest, int byte, size_t len) +{ + if ((((uintptr_t)dest | len) & (sizeof(uintptr_t)-1)) == 0) { + uintptr_t word = byte & 0xFF; + word |= word << 8; + word |= word << 16; + word |= word << 16 << 16; + + uintptr_t *d = dest; + while (d < (uintptr_t*)(dest + len)) + *d++ = word; + } else { + char *d = dest; + while (d < (char*)(dest + len)) + *d++ = byte; + } + return dest; +} + +size_t strlen(const char *s) +{ + const char *p = s; + while (*p) + p++; + return p - s; +} + +int strcmp(const char* s1, const char* s2) +{ + unsigned char c1, c2; + + do { + c1 = *s1++; + c2 = *s2++; + } while (c1 != 0 && c1 == c2); + + return c1 - c2; +} + +int memcmp(const void* s1, const void* s2, size_t n) +{ + if ((((uintptr_t)s1 | (uintptr_t)s2) & (sizeof(uintptr_t)-1)) == 0) { + const uintptr_t* u1 = s1; + const uintptr_t* u2 = s2; + const uintptr_t* end = u1 + (n / sizeof(uintptr_t)); + while (u1 < end) { + if (*u1 != *u2) + break; + u1++; + u2++; + } + n -= (const void*)u1 - s1; + s1 = u1; + s2 = u2; + } + + while (n--) { + unsigned char c1 = *(const unsigned char*)s1++; + unsigned char c2 = *(const unsigned char*)s2++; + if (c1 != c2) + return c1 - c2; + } + + return 0; +} + +char* strcpy(char* dest, const char* src) +{ + char* d = dest; + while ((*d++ = *src++)) + ; + return dest; +} + +long atol(const char* str) +{ + long res = 0; + int sign = 0; + + while (*str == ' ') + str++; + + if (*str == '-' || *str == '+') { + sign = *str == '-'; + str++; + } + + while (*str) { + res *= 10; + res += *str++ - '0'; + } + + return sign ? -res : res; +} diff --git a/tests/wally-riscv-arch-test/riscv-test-env/v/vm.c b/tests/wally-riscv-arch-test/riscv-test-env/v/vm.c new file mode 100644 index 000000000..8064b7baf --- /dev/null +++ b/tests/wally-riscv-arch-test/riscv-test-env/v/vm.c @@ -0,0 +1,273 @@ +// See LICENSE for license details. + +#include +#include +#include + +#include "riscv_test.h" + +void trap_entry(); +void pop_tf(trapframe_t*); + +volatile uint64_t tohost; +volatile uint64_t fromhost; + +static void do_tohost(uint64_t tohost_value) +{ + while (tohost) + fromhost = 0; + tohost = tohost_value; +} + +#define pa2kva(pa) ((void*)(pa) - DRAM_BASE - MEGAPAGE_SIZE) +#define uva2kva(pa) ((void*)(pa) - MEGAPAGE_SIZE) + +#define flush_page(addr) asm volatile ("sfence.vma %0" : : "r" (addr) : "memory") + +static uint64_t lfsr63(uint64_t x) +{ + uint64_t bit = (x ^ (x >> 1)) & 1; + return (x >> 1) | (bit << 62); +} + +static void cputchar(int x) +{ + do_tohost(0x0101000000000000 | (unsigned char)x); +} + +static void cputstring(const char* s) +{ + while (*s) + cputchar(*s++); +} + +static void terminate(int code) +{ + do_tohost(code); + while (1); +} + +void wtf() +{ + terminate(841); +} + +#define stringify1(x) #x +#define stringify(x) stringify1(x) +#define assert(x) do { \ + if (x) break; \ + cputstring("Assertion failed: " stringify(x) "\n"); \ + terminate(3); \ +} while(0) + +#define l1pt pt[0] +#define user_l2pt pt[1] +#if __riscv_xlen == 64 +# define NPT 4 +#define kernel_l2pt pt[2] +# define user_l3pt pt[3] +#else +# define NPT 2 +# define user_l3pt user_l2pt +#endif +pte_t pt[NPT][PTES_PER_PT] __attribute__((aligned(PGSIZE))); + +typedef struct { pte_t addr; void* next; } freelist_t; + +freelist_t user_mapping[MAX_TEST_PAGES]; +freelist_t freelist_nodes[MAX_TEST_PAGES]; +freelist_t *freelist_head, *freelist_tail; + +void printhex(uint64_t x) +{ + char str[17]; + for (int i = 0; i < 16; i++) + { + str[15-i] = (x & 0xF) + ((x & 0xF) < 10 ? '0' : 'a'-10); + x >>= 4; + } + str[16] = 0; + + cputstring(str); +} + +static void evict(unsigned long addr) +{ + assert(addr >= PGSIZE && addr < MAX_TEST_PAGES * PGSIZE); + addr = addr/PGSIZE*PGSIZE; + + freelist_t* node = &user_mapping[addr/PGSIZE]; + if (node->addr) + { + // check accessed and dirty bits + assert(user_l3pt[addr/PGSIZE] & PTE_A); + uintptr_t sstatus = set_csr(sstatus, SSTATUS_SUM); + if (memcmp((void*)addr, uva2kva(addr), PGSIZE)) { + assert(user_l3pt[addr/PGSIZE] & PTE_D); + memcpy((void*)addr, uva2kva(addr), PGSIZE); + } + write_csr(sstatus, sstatus); + + user_mapping[addr/PGSIZE].addr = 0; + + if (freelist_tail == 0) + freelist_head = freelist_tail = node; + else + { + freelist_tail->next = node; + freelist_tail = node; + } + } +} + +void handle_fault(uintptr_t addr, uintptr_t cause) +{ + assert(addr >= PGSIZE && addr < MAX_TEST_PAGES * PGSIZE); + addr = addr/PGSIZE*PGSIZE; + + if (user_l3pt[addr/PGSIZE]) { + if (!(user_l3pt[addr/PGSIZE] & PTE_A)) { + user_l3pt[addr/PGSIZE] |= PTE_A; + } else { + assert(!(user_l3pt[addr/PGSIZE] & PTE_D) && cause == CAUSE_STORE_PAGE_FAULT); + user_l3pt[addr/PGSIZE] |= PTE_D; + } + flush_page(addr); + return; + } + + freelist_t* node = freelist_head; + assert(node); + freelist_head = node->next; + if (freelist_head == freelist_tail) + freelist_tail = 0; + + uintptr_t new_pte = (node->addr >> PGSHIFT << PTE_PPN_SHIFT) | PTE_V | PTE_U | PTE_R | PTE_W | PTE_X; + user_l3pt[addr/PGSIZE] = new_pte | PTE_A | PTE_D; + flush_page(addr); + + assert(user_mapping[addr/PGSIZE].addr == 0); + user_mapping[addr/PGSIZE] = *node; + + uintptr_t sstatus = set_csr(sstatus, SSTATUS_SUM); + memcpy((void*)addr, uva2kva(addr), PGSIZE); + write_csr(sstatus, sstatus); + + user_l3pt[addr/PGSIZE] = new_pte; + flush_page(addr); + + __builtin___clear_cache(0,0); +} + +void handle_trap(trapframe_t* tf) +{ + if (tf->cause == CAUSE_USER_ECALL) + { + int n = tf->gpr[10]; + + for (long i = 1; i < MAX_TEST_PAGES; i++) + evict(i*PGSIZE); + + terminate(n); + } + else if (tf->cause == CAUSE_ILLEGAL_INSTRUCTION) + { + assert(tf->epc % 4 == 0); + + int* fssr; + asm ("jal %0, 1f; fssr x0; 1:" : "=r"(fssr)); + + if (*(int*)tf->epc == *fssr) + terminate(1); // FP test on non-FP hardware. "succeed." + else + assert(!"illegal instruction"); + tf->epc += 4; + } + else if (tf->cause == CAUSE_FETCH_PAGE_FAULT || tf->cause == CAUSE_LOAD_PAGE_FAULT || tf->cause == CAUSE_STORE_PAGE_FAULT) + handle_fault(tf->badvaddr, tf->cause); + else + assert(!"unexpected exception"); + + pop_tf(tf); +} + +static void coherence_torture() +{ + // cause coherence misses without affecting program semantics + unsigned int random = ENTROPY; + while (1) { + uintptr_t paddr = DRAM_BASE + ((random % (2 * (MAX_TEST_PAGES + 1) * PGSIZE)) & -4); +#ifdef __riscv_atomic + if (random & 1) // perform a no-op write + asm volatile ("amoadd.w zero, zero, (%0)" :: "r"(paddr)); + else // perform a read +#endif + asm volatile ("lw zero, (%0)" :: "r"(paddr)); + random = lfsr63(random); + } +} + +void vm_boot(uintptr_t test_addr) +{ + unsigned int random = ENTROPY; + if (read_csr(mhartid) > 0) + coherence_torture(); + + _Static_assert(SIZEOF_TRAPFRAME_T == sizeof(trapframe_t), "???"); + +#if (MAX_TEST_PAGES > PTES_PER_PT) || (DRAM_BASE % MEGAPAGE_SIZE) != 0 +# error +#endif + // map user to lowermost megapage + l1pt[0] = ((pte_t)user_l2pt >> PGSHIFT << PTE_PPN_SHIFT) | PTE_V; + // map kernel to uppermost megapage +#if __riscv_xlen == 64 + l1pt[PTES_PER_PT-1] = ((pte_t)kernel_l2pt >> PGSHIFT << PTE_PPN_SHIFT) | PTE_V; + kernel_l2pt[PTES_PER_PT-1] = (DRAM_BASE/RISCV_PGSIZE << PTE_PPN_SHIFT) | PTE_V | PTE_R | PTE_W | PTE_X | PTE_A | PTE_D; + user_l2pt[0] = ((pte_t)user_l3pt >> PGSHIFT << PTE_PPN_SHIFT) | PTE_V; + uintptr_t vm_choice = SATP_MODE_SV39; +#else + l1pt[PTES_PER_PT-1] = (DRAM_BASE/RISCV_PGSIZE << PTE_PPN_SHIFT) | PTE_V | PTE_R | PTE_W | PTE_X | PTE_A | PTE_D; + uintptr_t vm_choice = SATP_MODE_SV32; +#endif + write_csr(satp, ((uintptr_t)l1pt >> PGSHIFT) | + (vm_choice * (SATP_MODE & ~(SATP_MODE<<1)))); + + // Set up PMPs if present, ignoring illegal instruction trap if not. + uintptr_t pmpc = PMP_NAPOT | PMP_R | PMP_W | PMP_X; + asm volatile ("la t0, 1f\n\t" + "csrrw t0, mtvec, t0\n\t" + "csrw pmpaddr0, %1\n\t" + "csrw pmpcfg0, %0\n\t" + ".align 2\n\t" + "1:" + : : "r" (pmpc), "r" (-1UL) : "t0"); + + // set up supervisor trap handling + write_csr(stvec, pa2kva(trap_entry)); + write_csr(sscratch, pa2kva(read_csr(mscratch))); + write_csr(medeleg, + (1 << CAUSE_USER_ECALL) | + (1 << CAUSE_FETCH_PAGE_FAULT) | + (1 << CAUSE_LOAD_PAGE_FAULT) | + (1 << CAUSE_STORE_PAGE_FAULT)); + // FPU on; accelerator on; allow supervisor access to user memory access + write_csr(mstatus, MSTATUS_FS | MSTATUS_XS); + write_csr(mie, 0); + + random = 1 + (random % MAX_TEST_PAGES); + freelist_head = pa2kva((void*)&freelist_nodes[0]); + freelist_tail = pa2kva(&freelist_nodes[MAX_TEST_PAGES-1]); + for (long i = 0; i < MAX_TEST_PAGES; i++) + { + freelist_nodes[i].addr = DRAM_BASE + (MAX_TEST_PAGES + random)*PGSIZE; + freelist_nodes[i].next = pa2kva(&freelist_nodes[i+1]); + random = LFSR_NEXT(random); + } + freelist_nodes[MAX_TEST_PAGES-1].next = 0; + + trapframe_t tf; + memset(&tf, 0, sizeof(tf)); + tf.epc = test_addr - DRAM_BASE; + pop_tf(&tf); +} diff --git a/tests/wally-riscv-arch-test/riscv-test-env/verify.sh b/tests/wally-riscv-arch-test/riscv-test-env/verify.sh new file mode 100755 index 000000000..f69a4c633 --- /dev/null +++ b/tests/wally-riscv-arch-test/riscv-test-env/verify.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +printf "\n\nCompare to reference files ... \n\n"; +FAIL=0 +RUN=0 + +for ref in ${SUITEDIR}/references/*.reference_output; +do + base=$(basename ${ref}) + stub=${base//".reference_output"/} + + if [ "${stub}" = "*" ]; then + echo "No Reference Files ${SUITEDIR}/references/*.reference_output" + break + fi + + sig=${WORK}/rv${XLEN}i_m/${RISCV_DEVICE}/${stub}.signature.output + dif=${WORK}/rv${XLEN}i_m/${RISCV_DEVICE}/${stub}.diff + + RUN=$((${RUN} + 1)) + + # + # Ensure both files exist + # + if [ -f ${ref} ] && [ -f ${sig} ]; then + echo -n "Check $(printf %-24s ${stub}) " + else + echo -e "Check $(printf %-24s ${stub}) \e[33m ... IGNORE \e[39m" + continue + fi + diff --ignore-case --strip-trailing-cr ${ref} ${sig} &> /dev/null + if [ $? == 0 ] + then + echo -e "\e[32m ... OK \e[39m" + else + echo -e "\e[31m ... FAIL \e[39m" + FAIL=$((${FAIL} + 1)) + sdiff ${ref} ${sig} > ${dif} + fi +done + +# warn on missing reverse reference +for sig in ${WORK}/rv${XLEN}i_m/${RISCV_DEVICE}/*.signature.output; +do + base=$(basename ${sig}) + stub=${base//".signature.output"/} + ref=${SUITEDIR}/references/${stub}.reference_output + + if [ -f $sig ] && [ ! -f ${ref} ]; then + echo -e "\e[31m Error: sig ${sig} no corresponding ${ref} \e[39m" + FAIL=$((${FAIL} + 1)) + fi +done + +declare -i status=0 +if [ ${FAIL} == 0 ] +then + echo "--------------------------------" + echo -n -e "\e[32m OK: ${RUN}/${RUN} " + status=0 +else + echo "--------------------------------" + echo -n -e "\e[31m FAIL: ${FAIL}/${RUN} " + status=1 +fi +echo -e "RISCV_TARGET=${RISCV_TARGET} RISCV_DEVICE=${RISCV_DEVICE} XLEN=${XLEN} \e[39m" +echo +exit ${status} diff --git a/tests/wally-riscv-arch-test/riscv-test-suite/Makefile.include b/tests/wally-riscv-arch-test/riscv-test-suite/Makefile.include new file mode 100644 index 000000000..080aa1ee7 --- /dev/null +++ b/tests/wally-riscv-arch-test/riscv-test-suite/Makefile.include @@ -0,0 +1,58 @@ +#======================================================================= +# Makefile for riscv-tests/isa +#----------------------------------------------------------------------- + +act_dir := . +src_dir := $(act_dir)/src +work_dir := $(WORK) +work_dir_isa := $(work_dir)/rv$(XLEN)i_m/$(RISCV_DEVICE) + +include $(act_dir)/Makefrag +ifneq ($(RISCV_TEST),) + target_tests = $(RISCV_TEST).elf +endif + +default: all + +#-------------------------------------------------------------------- +# Build rules +#-------------------------------------------------------------------- + +vpath %.S $(act_dir) + +INCLUDE=$(TARGETDIR)/$(RISCV_TARGET)/device/rv$(XLEN)i_m/$(RISCV_DEVICE)/Makefile.include +ifeq ($(wildcard $(INCLUDE)),) + $(error Cannot find '$(INCLUDE)`. Check that RISCV_TARGET and RISCV_DEVICE are set correctly.) +endif +-include $(INCLUDE) + +#------------------------------------------------------------ +# Build and run assembly tests + +%.log: %.elf + $(V) echo "Execute $(@)" + $(V) $(RUN_TARGET) + + +define compile_template + +$(work_dir_isa)/%.elf: $(src_dir)/%.S + $(V) echo "Compile $$(@)" + @mkdir -p $$(@D) + $(V) $(COMPILE_TARGET) + +.PRECIOUS: $(work_dir_isa)/%.elf + +endef + +target_elf = $(foreach e,$(target_tests),$(work_dir_isa)/$(e)) +target_log = $(patsubst %.elf,%.log,$(target_elf)) + +compile: $(target_elf) +run: $(target_log) + +#------------------------------------------------------------ +# Clean up + +clean: + rm -rf $(work_dir) diff --git a/tests/wally-riscv-arch-test/riscv-test-suite/README.md b/tests/wally-riscv-arch-test/riscv-test-suite/README.md new file mode 100644 index 000000000..2e585c2f6 --- /dev/null +++ b/tests/wally-riscv-arch-test/riscv-test-suite/README.md @@ -0,0 +1,66 @@ +# RISC-V Test Suites + +The tests are grouped based on the different extension subsets of the RISC-V unprivileged ISA. +The tests strictly follow the [Test format](../spec/TestFormatSpec.adoc) specification. + +Directory names postfixed with "\_unratified" indicate that tests for extensions that have not yet +been ratified by RVI. + +The coverage report (in html format) of the tests available in this suite is generated through +[RISCOF](https://github.com/riscv-software-src/riscof) and is available here: [Coverage Report](../riscv-test-stats/coverage/README.md). + +These tests have been generated using the open source Compatibility Test Generator from InCore Semiconductors available +at: [CTG](https://github.com/riscv/riscv-ctg). + +The reference signatures are generated using [SAIL](https://github.com/riscv/sail-riscv) or +[SPIKE](https://github.com/riscv-software-src/riscv-isa-sim). + +Test directories with the "\_unratified" post-fix indicate test-suites for extensions which have not been +ratified (but are stable and near ratification) + +Directory structure +``` + +├── env # contains the architectural test header files +└── rv32i_m # top level folder indicate rv32 tests for machine mode + ├── C # include tests and references for "C" extension + │   ├── references # static references signatures for "C" extension + │   └── src # assembly tests for "C" extension + ├── F # include tests and references for "rv32F" extension + │   ├── references # static references signatures for "rv32F" extension + │   └── src # assembly tests for "rv32F" extension + ├── I # include tests and references for "I" extension + │   ├── references # static references signatures for "I" extension + │   └── src # assembly tests for "I" extension + ├── M # include tests and references for "M" extension + │ ├── references # static references signatures for "M" extension + │ └── src # assembly tests for "M" extension + ├── K_unratified # include tests and references for "K" extension + │ ├── references # static references signatures for "K" extension + │ └── src # assembly tests for "K" extension + ├── privilege # include tests and references for tests which require Privilege Spec + │ ├── references # static references signatures for tests which require Privilege Spec + │ └── src # assembly tests for tests which require Privilege Spec + └── Zifencei # include tests and references for "Zifencei" extension + ├── references # static references signatures for "Zifencei" extension + └── src # assembly tests for "Zifencei" extension +└── rv64i_m # top level folder indicate rv64 tests for machine mode + ├── C # include tests and references for "C" extension + │   ├── references # static references signatures for "C" extension + │   └── src # assembly tests for "C" extension + ├── I # include tests and references for "I" extension + │   ├── references # static references signatures for "I" extension + │   └── src # assembly tests for "I" extension + ├── M # include tests and references for "M" extension + │ ├── references # static references signatures for "M" extension + │ └── src # assembly tests for "M" extension + ├── K_unratified # include tests and references for "K" extension + │ ├── references # static references signatures for "K" extension + │ └── src # assembly tests for "K" extension + ├── privilege # include tests and references for tests which require Privilege Spec + │ ├── references # static references signatures for tests which require Privilege Spec + │ └── src # assembly tests for tests which require Privilege Spec + └── Zifencei # include tests and references for "Zifencei" extension + ├── references # static references signatures for "Zifencei" extension + └── src # assembly tests for "Zifencei" extension +``` diff --git a/tests/wally-riscv-arch-test/riscv-test-suite/env/arch_test.h b/tests/wally-riscv-arch-test/riscv-test-suite/env/arch_test.h new file mode 100644 index 000000000..286a64744 --- /dev/null +++ b/tests/wally-riscv-arch-test/riscv-test-suite/env/arch_test.h @@ -0,0 +1,1184 @@ +#include "encoding.h" +// TODO the following should come from the YAML. +#ifndef NUM_SPECD_INTCAUSES + #define NUM_SPECD_INTCAUSES 16 +#endif +//#define RVTEST_FIXED_LEN +#ifndef UNROLLSZ + #define UNROLLSZ 5 +#endif +// #ifndef rvtest_gpr_save +// #define rvtest_gpr_save +// #endif + +#define TEST_CASE_1 + +//----------------------------------------------------------------------- +// RV Arch Test Macros +//----------------------------------------------------------------------- +#ifndef RVMODEL_SET_MSW_INT + #warning "RVMODEL_SET_MSW_INT is not defined by target. Declaring as empty macro" + #define RVMODEL_SET_MSW_INT +#endif + +#ifndef RVMODEL_CLEAR_MSW_INT + #warning "RVMODEL_CLEAR_MSW_INT is not defined by target. Declaring as empty macro" + #define RVMODEL_CLEAR_MSW_INT +#endif + +#ifndef RVMODEL_CLEAR_MTIMER_INT + #warning "RVMODEL_CLEAR_MTIMER_INT is not defined by target. Declaring as empty macro" + #define RVMODEL_CLEAR_MTIMER_INT +#endif + +#ifndef RVMODEL_CLEAR_MEXT_INT + #warning "RVMODEL_CLEAR_MEXT_INT is not defined by target. Declaring as empty macro" + #define RVMODEL_CLEAR_MEXT_INT +#endif + +#ifdef RVTEST_FIXED_LEN + #define LI(reg, val)\ + .option push;\ + .option norvc;\ + .align UNROLLSZ;\ + li reg,val;\ + .align UNROLLSZ;\ + .option pop; + + #define LA(reg, val)\ + .option push;\ + .option norvc;\ + .align UNROLLSZ;\ + la reg,val;\ + .align UNROLLSZ;\ + .option pop; + +#else + #define LI(reg,val);\ + .option push;\ + .option norvc;\ + li reg,val;\ + .option pop; + + #define LA(reg,val);\ + .option push;\ + .option norvc;\ + la reg,val;\ + .option pop; +#endif +#if XLEN==64 + #define SREG sd + #define LREG ld + #define REGWIDTH 8 + #define MASK 0xFFFFFFFFFFFFFFFF + +#else + #if XLEN==32 + #define SREG sw + #define LREG lw + #define REGWIDTH 4 + #define MASK 0xFFFFFFFF + + #endif +#endif + +#if FLEN==64 + #define FLREG fld + #define FSREG fsd + #define FREGWIDTH 8 + +#else + #if FLEN==32 + #define FLREG flw + #define FSREG fsw + #define FREGWIDTH 4 + #endif +#endif + +#if XLEN==64 + #if FLEN==32 + #define SREG sw + #define LREG lW + #define REGWIDTH 4 + #define MASK 0xFFFFFFFF + #endif +#endif + +#define MMODE_SIG 3 +#define RLENG (REGWIDTH<<3) + +#define RVTEST_ISA(_STR) + +#ifndef DATA_REL_TVAL_MSK + #define DATA_REL_TVAL_MSK 0x0F05 << (REGWIDTH*8-16) +#endif + +#ifndef CODE_REL_TVAL_MSK + #define CODE_REL_TVAL_MSK 0xD008 << (REGWIDTH*8-16) +#endif + + +// ----------------------------------- CODE BEGIN w/ TRAP HANDLER START ------------------------ // + +.macro RVTEST_CODE_BEGIN + .align UNROLLSZ + .section .text.init; + .globl rvtest_init; \ + rvtest_init: +#ifdef rvtest_mtrap_routine + LA(x1, rvtest_trap_prolog ); + jalr ra, x1 + rvtest_prolog_done: +#endif + LI (x1, (0xFEEDBEADFEEDBEAD & MASK)); + LI (x2, (0xFF76DF56FF76DF56 & MASK)); + LI (x3, (0x7FBB6FAB7FBB6FAB & MASK)); + LI (x4, (0xBFDDB7D5BFDDB7D5 & MASK)); + LA (x5, rvtest_code_begin); + LA (x6, rvtest_data_begin); + LI (x7, (0xB7FBB6FAB7FBB6FA & MASK)); + LI (x8, (0x5BFDDB7D5BFDDB7D & MASK)); + LI (x9, (0xADFEEDBEADFEEDBE & MASK)); + LI (x10, (0x56FF76DF56FF76DF & MASK)); + LI (x11, (0xAB7FBB6FAB7FBB6F & MASK)); + LI (x12, (0xD5BFDDB7D5BFDDB7 & MASK)); + LI (x13, (0xEADFEEDBEADFEEDB & MASK)); + LI (x14, (0xF56FF76DF56FF76D & MASK)); + LI (x15, (0xFAB7FBB6FAB7FBB6 & MASK)); + #ifndef RVTEST_E + LI (x16, (0x7D5BFDDB7D5BFDDB & MASK)); + LI (x17, (0xBEADFEEDBEADFEED & MASK)); + LI (x18, (0xDF56FF76DF56FF76 & MASK)); + LI (x19, (0x6FAB7FBB6FAB7FBB & MASK)); + LI (x20, (0xB7D5BFDDB7D5BFDD & MASK)); + LI (x21, (0xDBEADFEEDBEADFEE & MASK)); + LI (x22, (0x6DF56FF76DF56FF7 & MASK)); + LI (x23, (0xB6FAB7FBB6FAB7FB & MASK)); + LI (x24, (0xDB7D5BFDDB7D5BFD & MASK)); + LI (x25, (0xEDBEADFEEDBEADFE & MASK)); + LI (x26, (0x76DF56FF76DF56FF & MASK)); + LI (x27, (0xBB6FAB7FBB6FAB7F & MASK)); + LI (x28, (0xDDB7D5BFDDB7D5BF & MASK)); + LI (x29, (0xEEDBEADFEEDBEADF & MASK)); + LI (x30, (0xF76DF56FF76DF56F & MASK)); + LI (x31, (0xFBB6FAB7FBB6FAB7 & MASK)); + #endif + .globl rvtest_code_begin + rvtest_code_begin: +.endm + +// --------------------------------- CODE BEGIN w/ TRAP HANDLER END -----------------------------// + +.macro RVTEST_CODE_END + .align 4; + .global rvtest_code_end + rvtest_code_end: +#ifdef rvtest_mtrap_routine + .option push + .option norvc + j exit_cleanup + + rvtest_trap_prolog: + /******************************************************************************/ + /**** Prolog, to be run before any tests ****/ + /**** #include 1 copy of this per mode in rvmodel_boot code? ****/ + /**** ------------------------------------------------------------------- ****/ + /**** if xTVEC isn't completely RW, then we need to change the code at its ****/ + /**** target. The entire trap trampoline and mtrap handler replaces the ****/ + /**** area pointed to by mtvec, after saving its original contents first. ****/ + /**** If it isn't possible to fully write that area, restore and fail. ****/ + /******************************************************************************/ + + //trap_handler_prolog; enter with t1..t6 available + + init_mscratch: + la t1, trapreg_sv + csrrw t1, CSR_MSCRATCH, t1 // swap old mscratch. mscratch not points to trapreg_sv + la t2, mscratch_save + SREG t1, 0(t2) // save old mscratch in mscratch_save region + csrr t1, CSR_MSCRATCH // read the trapreg_sv address + LA( t2, mtrap_sigptr ) // locate the start of the trap signature + SREG t2, 0(t1) // save mtrap_sigptr at first location of trapreg_sv + init_mtvec: + la t1, mtrampoline + la t4, mtvec_save + csrrw t2, CSR_MTVEC, t1 // swap mtvec and trap_trampoline + SREG t2, 0(t4) // save orig mtvec + csrr t3, CSR_MTVEC // now read new_mtval back + beq t3, t1, rvtest_prolog_done // if mtvec==trap_trampoline, mtvec is writable, continue + + /****************************************************************/ + /**** fixed mtvec, can't move it so move trampoline instead ****/ + /**** t1=trampoline, t2=oldmtvec, t3=save area, t4=save end ****/ + /****************************************************************/ + + // t2 = dut's original mtvec setting + // t1 = mtrampoline address + init_tramp: /**** copy trampoline at mtvec tgt ****/ + + csrw CSR_MTVEC, t2 // restore orig mtvec, will now attemp to copy trampoline to it + la t3, tramptbl_sv // addr of save area + addi t4, t3, NUM_SPECD_INTCAUSES*4 // end of save area + + overwrite_tt: // now build new trampoline table with offsets base from curr mtvec + lw t6, 0(t2) // get original mtvec target + sw t6, 0(t3) // save it + lw t5, 0(t1) // get trampoline src + sw t5, 0(t2) // overwrite mtvec target + lw t6, 0(t2) // rd it back to make sure it was written + bne t6, t5, resto_tramp // table isn't fully writable, restore and give up + addi t1, t1, 4 // next src index + addi t2, t2, 4 // next tgt index + addi t3, t3, 4 // next save index + bne t3, t4, overwrite_tt // not done, loop + j rvtest_prolog_done + + resto_tramp: // vector table not writeable, restore + LREG t1, 16(t4) // load mscratch_SAVE at fixed offset from table end + csrw CSR_MSCRATCH, t1 // restore mscratch + LREG t4, 8(t4) // load mtvec_SAVE (used as end of loop marker) + + + resto_loop: // goes backwards, t2= dest vec tbl ptr, t3=src save area ptr, t4=vec tbl begin + lw t6, 0(t3) // read saved tgt entry + sw t6, 0(t2) // restore original tgt + addi t2, t2, -4 // prev tgt index + addi t3, t3, -4 // prev save index + bne t2, t4, resto_loop // didn't restore to begining yet, loop + + j rvtest_end // failure to replace trampoline + + + #define mhandler \ + csrrw sp, CSR_MSCRATCH, sp; \ + SREG t6, 6*REGWIDTH(sp); \ + jal t6, common_prolog; + + /**********************************************************************/ + /**** This is the entry point for all m-modetraps, vectored or not.****/ + /**** At entry, mscratch will contain a pointer to a scratch area. ****/ + /**** This is an array of branches at 4B intevals that spreads out ****/ + /**** to an array of 32B mhandler macros for specd int causes, and ****/ + /**** to a return for anything above that (which causes a mismatch)****/ + /**********************************************************************/ + mtrampoline: // 64 or 32 entry table + value = 0 + .rept NUM_SPECD_INTCAUSES // located at each possible int vectors + j mtrap_handler + 12*(value) //offset < +/- 1MB + value = value + 1 + .endr + .rept RLENG-NUM_SPECD_INTCAUSES // fill at each impossible entry + mret + .endr + + mtrap_handler: /* after executing, sp points to temp save area, t4 is PC */ + .rept NUM_SPECD_INTCAUSES + mhandler + .endr + + common_prolog: + la t5, common_mhandler + jr t5 + /*********************************************************************/ + /**** common code for all ints & exceptions, will fork to handle ****/ + /**** each separately. The common handler first stores trap mode+ ****/ + /**** vector, and mcause signatures. All traps have 4wd sigs, but ****/ + /**** sw and timer ints only store 3 of the 4. ****/ + /**** sig offset Exception ExtInt SWInt TimerInt ****/ + /**** 0: tval IntID -1 -1 ****/ + /**** 4: mepc mip mip mip ****/ + /**** 8: <---------------------- mcause -------------> ****/ + /**** 12: <--------------------- Vect+mode ----------> ****/ + /*********************************************************************/ + /* in general, CSRs loaded in t2, addresses into t3 */ + + common_mhandler: /* enter with link in t6 */ + SREG t5, 5*REGWIDTH(sp) + SREG t4, 4*REGWIDTH(sp) + SREG t3, 3*REGWIDTH(sp) + SREG t2, 2*REGWIDTH(sp) + SREG t1, 1*REGWIDTH(sp) /* save other temporaries */ + + LREG t1, 0(sp) /* load trap sig pointer (runs backwards from DATA_END) */ + + LA( t3, mtrampoline) + sub t2, t6, t3 /* reloc “link” to 0..63 to show which int vector was taken */ + addi t2, t2, MMODE_SIG /* insert mode# into 1:0 */ + SREG t2, 0*REGWIDTH(t1) /* save 1st sig value, (vect, trapmode) */ + sv_mcause: + csrr t2, CSR_MCAUSE + SREG t2, 1*REGWIDTH(t1) /* save 2nd sig value, (mcause) */ + + bltz t2, common_mint_handler /* this is a interrupt, not a trap */ + + /********************************************************************/ + /**** This is the exceptions specific code, storing relative mepc****/ + /**** & relative tval signatures. tval is relocated by code or ****/ + /**** data start, or 0 depending on mcause. mepc signature value ****/ + /**** is relocated by code start, and restored adjusted depending****/ + /**** on op alignment so trapped op isn't re-executed. ****/ + /********************************************************************/ + common_mexcpt_handler: + csrr t2, CSR_MEPC + sv_mepc: + LA( t3, rvtest_prolog_done) /* offset to compensate for different loader offsets */ + sub t4, t2, t3 /* convert mepc to rel offset of beginning of test*/ + SREG t4, 2*REGWIDTH(t1) /* save 3rd sig value, (rel mepc) into trap signature area */ + adj_mepc: //adj mepc so there is padding after op, and its 8B aligned + andi t4, t2, 0x2 /* set to 2 if mepc was misaligned */ + sub t2, t2, t4 /* adjust mepc to prev 4B alignment */ + addi t2, t2, 0x8 /* adjust mepc, so it skips past the op, has padding & is 4B aligned */ + csrw CSR_MEPC, t2 /* restore adjusted value, has 1,2, or 3 bytes of padding */ + + + /* calculate relative mtval if it’s an address (by code_begin or data_begin amt) */ + /* note that masks that determine this are implementation specific from YAML */ + + /* masks are bit reversed, so mcause==0 bit is in MSB (so different for RV32 and RV64) */ + + adj_mtval: + csrr t2, CSR_MCAUSE /* code begin adjustment amount already in t3 */ + + LI(t4, CODE_REL_TVAL_MSK) /* trap#s 12, 3,1,0, -- adjust w/ code_begin */ + sll t4, t4, t2 /* put bit# in MSB */ + bltz t4, sv_mtval /* correct adjustment is code_begin in t3 */ + + LA( t3, mtrap_sigptr) /* adjustment assuming access is to signature region */ + LI(t4, DATA_REL_TVAL_MSK) /* trap#s not 14, 11..8, 2 adjust w/ data_begin */ + sll t4, t4, t2 /* put bit# in MSB */ + bgez t4, no_adj /* correct adjustment is data_begin in t3 */ + sigbound_chk: + csrr t4, CSR_MTVAL /* do a bounds check on mtval */ + bge t3, t4, sv_mtval /* if mtval is greater than the rvmodel_data_begin then use that as anchor */ + LA( t3, rvtest_data_begin) /* else change anchor to rvtest_data_begin */ + blt t3, t4, sv_mtval /* before the signature, use data_begin adj */ + mv t4, t3 /* use sig relative adjust */ + no_adj: + LI(t3, 0) /* else zero adjustment amt */ + + // For Illegal op handling + addi t2, t2, -2 /* check if mcause==2 (illegal op) */ + bnez t2, sv_mtval /* not illegal op, no special treatment */ + csrr t2, CSR_MTVAL + bnez t2, sv_mtval /* mtval isn’t zero, no special treatment */ + illop: + LI(t5, 0x20000) /* get mprv mask */ + csrrs t5, CSR_MSTATUS, t5 /* set mprv while saving the old value */ + csrr t3, CSR_MEPC + lhu t2, 0(t3) /* load 1st 16b of opc w/ old priv, endianess*/ + andi t4, t2, 0x3 + addi t4, t4, -0x3 /* does opcode[1:0]==0b11? (Meaning >16b op) */ + bnez t4, sv_mtval /* entire mtval is in tt2, adj amt will be set to zero */ + lhu t4, 2(t3) + sll t4, t4, 16 + or t3, t2, t4 /* get 2nd hwd, align it & insert it into opcode */ + csrw CSR_MSTATUS, t5 /* restore mstatus */ + +/*******FIXME: this will not handle 48 or 64b opcodes in an RV64) ********/ + + sv_mtval: + csrr t2, CSR_MTVAL + sub t2, t2, t3 /* perform mtval adjust by either code or data position or zero*/ + SREG t2, 3*REGWIDTH(t1) /* save 4th sig value, (rel mtval) into trap signature area */ + + resto_rtn: /* restore and return */ + addi t1, t1,4*REGWIDTH /* adjust trap signature ptr (traps always save 4 words) */ + SREG t1, 0*REGWIDTH(sp) /* save updated trap sig pointer (pts to trap_sigptr */ + + LREG t1, 1*REGWIDTH(sp) + LREG t2, 2*REGWIDTH(sp) + LREG t3, 3*REGWIDTH(sp) + LREG t4, 4*REGWIDTH(sp) + LREG t5, 5*REGWIDTH(sp) + LREG t6, 6*REGWIDTH(sp) /* restore temporaries */ + + csrrw sp, CSR_MSCRATCH, sp /* restore sp from scratch */ + mret + + common_mint_handler: /* t1 has sig ptr, t2 has mcause */ + + LI(t3, 1) + sll t3, t3, t2 /* create mask 1<