diff --git a/tests/testgen/testgen-ADD-SUB-SLT-SLTU-XOR-OR-AND.py b/tests/testgen/imperas/testgen-ADD-SUB-SLT-SLTU-XOR-OR-AND.py similarity index 100% rename from tests/testgen/testgen-ADD-SUB-SLT-SLTU-XOR-OR-AND.py rename to tests/testgen/imperas/testgen-ADD-SUB-SLT-SLTU-XOR-OR-AND.py diff --git a/tests/testgen/testgen-ADDI-XORI-ORI-ANDI-SLTI.py b/tests/testgen/imperas/testgen-ADDI-XORI-ORI-ANDI-SLTI.py similarity index 100% rename from tests/testgen/testgen-ADDI-XORI-ORI-ANDI-SLTI.py rename to tests/testgen/imperas/testgen-ADDI-XORI-ORI-ANDI-SLTI.py diff --git a/tests/testgen/testgen-ADDIW-SLLIW-SRLIW-SRAIW.py b/tests/testgen/imperas/testgen-ADDIW-SLLIW-SRLIW-SRAIW.py similarity index 100% rename from tests/testgen/testgen-ADDIW-SLLIW-SRLIW-SRAIW.py rename to tests/testgen/imperas/testgen-ADDIW-SLLIW-SRLIW-SRAIW.py diff --git a/tests/testgen/testgen-ADDW-SUBW-SLLW-SRLW-SRAW.py b/tests/testgen/imperas/testgen-ADDW-SUBW-SLLW-SRLW-SRAW.py similarity index 100% rename from tests/testgen/testgen-ADDW-SUBW-SLLW-SRLW-SRAW.py rename to tests/testgen/imperas/testgen-ADDW-SUBW-SLLW-SRLW-SRAW.py diff --git a/tests/testgen/testgen-BRANCH.py b/tests/testgen/imperas/testgen-BRANCH.py similarity index 100% rename from tests/testgen/testgen-BRANCH.py rename to tests/testgen/imperas/testgen-BRANCH.py diff --git a/tests/testgen/testgen-CSR.py b/tests/testgen/imperas/testgen-CSR.py similarity index 100% rename from tests/testgen/testgen-CSR.py rename to tests/testgen/imperas/testgen-CSR.py diff --git a/tests/testgen/testgen-JAL-JALR.py b/tests/testgen/imperas/testgen-JAL-JALR.py similarity index 100% rename from tests/testgen/testgen-JAL-JALR.py rename to tests/testgen/imperas/testgen-JAL-JALR.py diff --git a/tests/testgen/testgen-LOAD.py b/tests/testgen/imperas/testgen-LOAD.py similarity index 100% rename from tests/testgen/testgen-LOAD.py rename to tests/testgen/imperas/testgen-LOAD.py diff --git a/tests/testgen/testgen-PIPELINE.py b/tests/testgen/imperas/testgen-PIPELINE.py similarity index 100% rename from tests/testgen/testgen-PIPELINE.py rename to tests/testgen/imperas/testgen-PIPELINE.py diff --git a/tests/testgen/testgen-SLL-SRL-SRA.py b/tests/testgen/imperas/testgen-SLL-SRL-SRA.py similarity index 100% rename from tests/testgen/testgen-SLL-SRL-SRA.py rename to tests/testgen/imperas/testgen-SLL-SRL-SRA.py diff --git a/tests/testgen/testgen-SLLI-SRLI-SRAI.py b/tests/testgen/imperas/testgen-SLLI-SRLI-SRAI.py similarity index 100% rename from tests/testgen/testgen-SLLI-SRLI-SRAI.py rename to tests/testgen/imperas/testgen-SLLI-SRLI-SRAI.py diff --git a/tests/testgen/testgen-SLTIU.py b/tests/testgen/imperas/testgen-SLTIU.py similarity index 100% rename from tests/testgen/testgen-SLTIU.py rename to tests/testgen/imperas/testgen-SLTIU.py diff --git a/tests/testgen/testgen-STORE.py b/tests/testgen/imperas/testgen-STORE.py similarity index 100% rename from tests/testgen/testgen-STORE.py rename to tests/testgen/imperas/testgen-STORE.py diff --git a/tests/testgen/testgen-VIRTUALMEMORY.py b/tests/testgen/imperas/testgen-VIRTUALMEMORY.py similarity index 100% rename from tests/testgen/testgen-VIRTUALMEMORY.py rename to tests/testgen/imperas/testgen-VIRTUALMEMORY.py diff --git a/tests/testgen/imperas/testgen_footer.S b/tests/testgen/imperas/testgen_footer.S new file mode 100644 index 000000000..f7cc0b18b --- /dev/null +++ b/tests/testgen/imperas/testgen_footer.S @@ -0,0 +1,18 @@ + # --------------------------------------------------------------------------------------------- + + RVTEST_IO_WRITE_STR(x31, "Test End\n") + + # --------------------------------------------------------------------------------------------- + + RV_COMPLIANCE_HALT + +RV_COMPLIANCE_CODE_END + +# Input data section. + .data + + +# Output data section. +RV_COMPLIANCE_DATA_BEGIN + +test_1_res: diff --git a/tests/testgen/imperas/testgen_header.S b/tests/testgen/imperas/testgen_header.S new file mode 100644 index 000000000..118042a5c --- /dev/null +++ b/tests/testgen/imperas/testgen_header.S @@ -0,0 +1,38 @@ +// +// Copyright (C) 2021 Harvey Mudd College & Oklahoma State University +// Adapted from Imperas RISCV-TEST_SUITE +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, +// modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +// is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +// OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +/////////////////////////////////////////// + +#include "riscv_test_macros.h" +#include "compliance_test.h" +#include "compliance_io.h" + +RV_COMPLIANCE_RV64M + +RV_COMPLIANCE_CODE_BEGIN + + + RVTEST_IO_INIT + RVTEST_IO_ASSERT_GPR_EQ(x31, x0, 0x00000000) + RVTEST_IO_WRITE_STR(x31, "Test Begin\n") + + # --------------------------------------------------------------------------------------------- + + #RVTEST_IO_WRITE_STR(x31, "# Test group 1\n") + + + # address for test results + la x6, test_1_res + \ No newline at end of file diff --git a/tests/testgen/testgen_footer.S b/tests/testgen/testgen_footer.S index f7cc0b18b..b0137b792 100644 --- a/tests/testgen/testgen_footer.S +++ b/tests/testgen/testgen_footer.S @@ -1,18 +1,46 @@ - # --------------------------------------------------------------------------------------------- - - RVTEST_IO_WRITE_STR(x31, "Test End\n") +RVTEST_CODE_END +RVMODEL_HALT - # --------------------------------------------------------------------------------------------- +RVTEST_DATA_BEGIN +.align 4 +rvtest_data: +.word 0xbabecafe +RVTEST_DATA_END - RV_COMPLIANCE_HALT - -RV_COMPLIANCE_CODE_END - -# Input data section. - .data +RVMODEL_DATA_BEGIN -# Output data section. -RV_COMPLIANCE_DATA_BEGIN +signature_x8_0: + .fill 0*(XLEN/32),4,0xdeadbeef -test_1_res: + +signature_x8_1: + .fill 19*(XLEN/32),4,0xdeadbeef + + +signature_x1_0: + .fill 256*(XLEN/32),4,0xdeadbeef + + +signature_x1_1: + .fill 256*(XLEN/32),4,0xdeadbeef + + +signature_x1_2: + .fill 148*(XLEN/32),4,0xdeadbeef + +#ifdef rvtest_mtrap_routine + +mtrap_sigptr: + .fill 64*(XLEN/32),4,0xdeadbeef + +#endif + +#ifdef rvtest_gpr_save + +gpr_save: + .fill 32*(XLEN/32),4,0xdeadbeef + +#endif + +RVMODEL_DATA_END diff --git a/tests/testgen/testgen_header.S b/tests/testgen/testgen_header.S index 118042a5c..3b3bd6876 100644 --- a/tests/testgen/testgen_header.S +++ b/tests/testgen/testgen_header.S @@ -1,6 +1,5 @@ // // Copyright (C) 2021 Harvey Mudd College & Oklahoma State University -// Adapted from Imperas RISCV-TEST_SUITE // // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation // files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, @@ -15,24 +14,18 @@ // OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /////////////////////////////////////////// -#include "riscv_test_macros.h" -#include "compliance_test.h" -#include "compliance_io.h" +#include "model_test.h" +#include "arch_test.h" +RVTEST_ISA("RV64I") -RV_COMPLIANCE_RV64M +.section .text.init +.globl rvtest_entry_point +rvtest_entry_point: +RVMODEL_BOOT +RVTEST_CODE_BEGIN -RV_COMPLIANCE_CODE_BEGIN +#ifdef TEST_CASE_1 +RVTEST_CASE(0,"//check ISA:=regex(.*64.*);check ISA:=regex(.*I.*);def TEST_CASE_1=True;",add) - RVTEST_IO_INIT - RVTEST_IO_ASSERT_GPR_EQ(x31, x0, 0x00000000) - RVTEST_IO_WRITE_STR(x31, "Test Begin\n") - - # --------------------------------------------------------------------------------------------- - - #RVTEST_IO_WRITE_STR(x31, "# Test group 1\n") - - - # address for test results - la x6, test_1_res - \ No newline at end of file +RVTEST_SIGBASE( x8,signature_x8_1) diff --git a/tests/testgen/wally-I.py b/tests/testgen/wally-I.py new file mode 100755 index 000000000..b186e21c5 --- /dev/null +++ b/tests/testgen/wally-I.py @@ -0,0 +1,153 @@ +#!/usr/bin/python3 +################################## +# wally-I.py +# +# David_Harris@hmc.edu 27 October 2021 +# +# Generate directed and random test vectors for RISC-V Design Validation. +################################## + +################################## +# libraries +################################## +from datetime import datetime +from random import randint +from random import seed +from random import getrandbits + +################################## +# functions +################################## + +def twoscomp(a): + amsb = a >> (xlen-1) + alsbs = ((1 << (xlen-1)) - 1) & a + if (amsb): + asigned = a - (1<> 32) + "\n" + r.write(line) + testnum = testnum+1 + +################################## +# main body +################################## + +# change these to suite your tests +instrs = ["ADD", "SUB", "SLT", "SLTU", "XOR", "OR", "AND"] +author = "David_Harris@hmc.edu" +xlens = [32, 64] +numrand = 100 + +# setup +seed(0) # make tests reproducible + +# generate files for each test +for xlen in xlens: + formatstrlen = str(int(xlen/4)) + formatstr = "0x{:0" + formatstrlen + "x}" # format as xlen-bit hexadecimal number + formatrefstr = "{:08x}" # format as xlen-bit hexadecimal number with no leading 0x + if (xlen == 32): + storecmd = "sw" + wordsize = 4 + else: + storecmd = "sd" + wordsize = 8 + pathname = "../wally-riscv-arch-test/riscv-test-suite/rv" + str(xlen) + "i_m/I/" + fname = pathname + "src/WALLY-PIPELINE.S" + testnum = 0 + + # print custom header part + f = open(fname, "w") +# r = open(refname, "w") + line = "///////////////////////////////////////////\n" + f.write(line) + lines="// "+fname+ "\n// " + author + "\n" + f.write(lines) + line ="// Created " + str(datetime.now()) + f.write(line) + + # insert generic header + h = open("testgen_header.S", "r") + for line in h: + f.write(line) + + # print directed and random test vectors + # for a in corners: + # for b in corners: + # writeVector(a, b, storecmd, xlen) + # for i in range(0,numrand): + # a = getrandbits(xlen) + # b = getrandbits(xlen) + # writeVector(a, b, storecmd, xlen) + + + # print footer + h = open("testgen_footer.S", "r") + for line in h: + f.write(line) + + # Finish +# lines = ".fill " + str(testnum) + ", " + str(wordsize) + ", -1\n" +# lines = lines + "\nRV_COMPLIANCE_DATA_END\n" + f.write(lines) + f.close() +# r.close() + + + + diff --git a/tests/wally-riscv-arch-test/riscv-test-suite/rv32i_m/I/Makefrag b/tests/wally-riscv-arch-test/riscv-test-suite/rv32i_m/I/Makefrag index 9331e7e14..e2cdf44da 100644 --- a/tests/wally-riscv-arch-test/riscv-test-suite/rv32i_m/I/Makefrag +++ b/tests/wally-riscv-arch-test/riscv-test-suite/rv32i_m/I/Makefrag @@ -28,7 +28,7 @@ # Description: Makefrag for RV32I architectural tests rv32i_sc_tests = \ - + WALLY-PIPELINE \ rv32i_tests = $(addsuffix .elf, $(rv32i_sc_tests)) diff --git a/wally-pipelined/regression/sim-wally-batch b/wally-pipelined/regression/sim-wally-batch index 4b627b768..c603b8432 100755 --- a/wally-pipelined/regression/sim-wally-batch +++ b/wally-pipelined/regression/sim-wally-batch @@ -1,3 +1,3 @@ vsim -c <