From 84911e634584964471c8aad92d6b335ea11ce977 Mon Sep 17 00:00:00 2001 From: Domenico Ottolia Date: Tue, 4 May 2021 00:16:19 -0400 Subject: [PATCH 1/3] Fix 32 bit privileged tests!!! --- .../testbench/testbench-imperas.sv | 26 ++++++++++--------- .../testgen/privileged/testgen-CAUSE.py | 20 ++++++++++++-- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/wally-pipelined/testbench/testbench-imperas.sv b/wally-pipelined/testbench/testbench-imperas.sv index 18539fda6..c186ae160 100644 --- a/wally-pipelined/testbench/testbench-imperas.sv +++ b/wally-pipelined/testbench/testbench-imperas.sv @@ -363,18 +363,18 @@ module testbench(); }; string tests32p[] = '{ - // "rv32p/WALLY-MCAUSE", "4000", - // "rv32p/WALLY-SCAUSE", "3000", - // "rv32p/WALLY-MEPC", "5000", - // "rv32p/WALLY-SEPC", "4000", - // "rv32p/WALLY-MTVAL", "5000", - // "rv32p/WALLY-STVAL", "4000", - // "rv32p/WALLY-MARCHID", "4000", - // "rv32p/WALLY-MIMPID", "4000", - // "rv32p/WALLY-MHARTID", "4000", - // "rv32p/WALLY-MVENDORID", "4000" - // "rv32p/WALLY-MTVEC", "2000", - // "rv32p/WALLY-STVEC", "2000" + "rv32p/WALLY-MCAUSE", "3000", + "rv32p/WALLY-SCAUSE", "2000", + "rv32p/WALLY-MEPC", "5000", + "rv32p/WALLY-SEPC", "4000", + "rv32p/WALLY-MTVAL", "5000", + "rv32p/WALLY-STVAL", "4000", + "rv32p/WALLY-MARCHID", "4000", + "rv32p/WALLY-MIMPID", "4000", + "rv32p/WALLY-MHARTID", "4000", + "rv32p/WALLY-MVENDORID", "4000", + "rv32p/WALLY-MTVEC", "2000", + "rv32p/WALLY-STVEC", "2000" }; string tests64periph[] = '{ @@ -437,6 +437,8 @@ module testbench(); if (`A_SUPPORTED) tests = {tests, tests32a}; if (`MEM_VIRTMEM) tests = {tests32mmu, tests}; end + + //tests = tests32p; end end diff --git a/wally-pipelined/testgen/privileged/testgen-CAUSE.py b/wally-pipelined/testgen/privileged/testgen-CAUSE.py index 2200dbe68..409564f7f 100644 --- a/wally-pipelined/testgen/privileged/testgen-CAUSE.py +++ b/wally-pipelined/testgen/privileged/testgen-CAUSE.py @@ -296,7 +296,7 @@ def writeTest(storecmd, f, r, test, interrupt, code, resetHander = ""): author = "dottolia@hmc.edu" xlens = [32, 64] -testCount = 16; +testCount = 8; # setup # Change this seed to a different constant value for every test @@ -336,7 +336,15 @@ for xlen in xlens: # insert generic header h = open("../testgen_header.S", "r") for line in h: - f.write(line) + f.write(line.replace("RV_COMPLIANCE_RV64M", "RV_COMPLIANCE_RV" + str(xlen) + "M")) + # f.write(f""" + # #include "riscv_test_macros.h" + # #include "compliance_test.h" + # #include "compliance_io.h" + + # 0000000080000000 <_start>: + # 80000000: 0480006f j 80000048 + # """) # We need to leave at least one bit in medeleg unset so that we have a way to get # back to machine mode when the tests are complete (otherwise we'll only ever be able @@ -383,6 +391,14 @@ for xlen in xlens: lines = f""" add x7, x6, x0 csrr x19, mtvec + + slli a0,a0,0x1f + slli a0,a0,0x1e + slli a0,a0,0x1d + slli a0,a0,0x1c + slli a0,a0,0x1b + slli a0,a0,0x1a + slli a0,a0,0x19 """ # Not used — user mode traps are deprecated From 1556cc5b9fd15bcf8b75157ebe175abba30660fa Mon Sep 17 00:00:00 2001 From: Domenico Ottolia Date: Tue, 4 May 2021 01:04:12 -0400 Subject: [PATCH 3/3] Use correct begin_signature for rv64p/MCAUSE and rv64p/SCAUSE --- wally-pipelined/testbench/testbench-imperas.sv | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wally-pipelined/testbench/testbench-imperas.sv b/wally-pipelined/testbench/testbench-imperas.sv index c186ae160..8e43f036d 100644 --- a/wally-pipelined/testbench/testbench-imperas.sv +++ b/wally-pipelined/testbench/testbench-imperas.sv @@ -348,8 +348,8 @@ module testbench(); }; string tests64p[] = '{ - "rv64p/WALLY-MCAUSE", "4000", - "rv64p/WALLY-SCAUSE", "3000", + "rv64p/WALLY-MCAUSE", "3000", + "rv64p/WALLY-SCAUSE", "2000", "rv64p/WALLY-MEPC", "5000", "rv64p/WALLY-SEPC", "4000", "rv64p/WALLY-MTVAL", "6000", @@ -423,7 +423,7 @@ module testbench(); end //tests = {tests64a, tests}; - //tests = tests64p; + tests = tests64p; end else begin // RV32 // *** add the 32 bit bp tests if (TESTSPERIPH) begin