From 531423d7e1eba90d8a6c1f479535b3969aa4719f Mon Sep 17 00:00:00 2001 From: Domenico Ottolia Date: Thu, 15 Apr 2021 16:55:39 -0400 Subject: [PATCH] Add 32 bit privileged tests --- .../testbench/testbench-imperas.sv | 18 +++++- .../testgen/privileged/testgen-CAUSE.py | 64 ++++++++++--------- .../testgen/privileged/testgen-TVAL.py | 2 +- 3 files changed, 49 insertions(+), 35 deletions(-) diff --git a/wally-pipelined/testbench/testbench-imperas.sv b/wally-pipelined/testbench/testbench-imperas.sv index 1e0bd95a..10993849 100644 --- a/wally-pipelined/testbench/testbench-imperas.sv +++ b/wally-pipelined/testbench/testbench-imperas.sv @@ -342,7 +342,7 @@ module testbench(); }; string tests64p[] = '{ - "rv64p/WALLY-CAUSE", "3000", + "rv64p/WALLY-MCAUSE", "3000", "rv64p/WALLY-EPC", "3000", "rv64p/WALLY-TVAL", "3000", "rv64p/WALLY-MARCHID", "4000", @@ -351,6 +351,16 @@ module testbench(); "rv64p/WALLY-MVENDORID", "4000" }; + string tests32p[] = '{ + "rv32p/WALLY-MCAUSE", "3000", + "rv32p/WALLY-EPC", "3000", + "rv32p/WALLY-TVAL", "3000", + "rv32p/WALLY-MARCHID", "4000", + "rv32p/WALLY-MIMPID", "4000", + "rv32p/WALLY-MHARTID", "4000", + "rv32p/WALLY-MVENDORID", "4000" + }; + string tests64periph[] = '{ "rv64i-periph/WALLY-PLIC", "2080" }; @@ -397,12 +407,13 @@ module testbench(); end //tests = {tests64a, tests}; // tests = {tests, tests64p}; + tests = tests64p; end else begin // RV32 // *** add the 32 bit bp tests if (TESTSPERIPH) begin tests = tests32periph; end else begin - tests = {tests32i};//,tests32periph}; *** broken at the moment + tests = {tests32i, tests32p};//,tests32periph}; *** broken at the moment if (`C_SUPPORTED % 2 == 1) tests = {tests, tests32ic}; else tests = {tests, tests32iNOc}; if (`M_SUPPORTED % 2 == 1) tests = {tests, tests32m}; @@ -410,8 +421,9 @@ module testbench(); if (`A_SUPPORTED) tests = {tests, tests32a}; if (`MEM_VIRTMEM) tests = {tests32mmu, tests}; end + + tests = tests32p; end - //tests = tests64p; end diff --git a/wally-pipelined/testgen/privileged/testgen-CAUSE.py b/wally-pipelined/testgen/privileged/testgen-CAUSE.py index 5784cde0..9bd72422 100644 --- a/wally-pipelined/testgen/privileged/testgen-CAUSE.py +++ b/wally-pipelined/testgen/privileged/testgen-CAUSE.py @@ -274,7 +274,7 @@ def writeTest(storecmd, f, r, test, interrupt, code, mode = "m", resetHander = " # csrrw, csrrs, csrrc, csrrwi, csrrsi, csrrci author = "dottolia@hmc.edu" xlens = [32, 64] -numrand = 10; +numrand = 8; # setup seed(0xC365DDEB9173AB42) # make tests reproducible @@ -295,43 +295,45 @@ for xlen in xlens: 0x624B3E976C52DD14 % 2**xlen, 2**(xlen-1)-2, 2**(xlen-1)-1, 2**(xlen-1), 2**(xlen-1)+1, 0xC365DDEB9173AB42 % 2**xlen, 2**(xlen)-2, 2**(xlen)-1 ] - imperaspath = "../../../imperas-riscv-tests/riscv-test-suite/rv" + str(xlen) + "p/" - basename = "WALLY-CAUSE" - fname = imperaspath + "src/" + basename + ".S" - refname = imperaspath + "references/" + basename + ".reference_output" - 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) + for mode in ["m", "s", "u"]: + imperaspath = "../../../imperas-riscv-tests/riscv-test-suite/rv" + str(xlen) + "p/" + basename = "WALLY-" + mode.upper() + "CAUSE" + fname = imperaspath + "src/" + basename + ".S" + refname = imperaspath + "references/" + basename + ".reference_output" + testnum = 0 - # insert generic header - h = open("../testgen_header.S", "r") - for line in h: + # 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) - # print directed and random test vectors - for i in range(0,numrand): - writeVectors(storecmd) + # insert generic header + h = open("../testgen_header.S", "r") + for line in h: + f.write(line) + + # print directed and random test vectors + for i in range(0,numrand): + writeVectors(storecmd) - # print footer - h = open("../testgen_footer.S", "r") - for line in h: - f.write(line) + # 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() + # 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/wally-pipelined/testgen/privileged/testgen-TVAL.py b/wally-pipelined/testgen/privileged/testgen-TVAL.py index b9935261..b2d9e7b5 100644 --- a/wally-pipelined/testgen/privileged/testgen-TVAL.py +++ b/wally-pipelined/testgen/privileged/testgen-TVAL.py @@ -163,7 +163,7 @@ def writeTest(storecmd, f, r, test, expected, mode = "m", resetHander = ""): # csrrw, csrrs, csrrc, csrrwi, csrrsi, csrrci author = "dottolia@hmc.edu" xlens = [32, 64] -numrand = 30; +numrand = 20; # setup seed(0xC363DDEB9173AB42) # make tests reproducible