Skip to content

Commit 3e950a8

Browse files
Merge pull request #1316 from jordancarlin/rv32imc_lockstep
Add rv32IMC Imperas Configuration for Lockstep
2 parents a047651 + 96f3643 commit 3e950a8

File tree

5 files changed

+122
-6
lines changed

5 files changed

+122
-6
lines changed

bin/regression-wally

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ testfloatsim = "questa" # change to Verilator when Issue #707 about testfloat
4242
standard_tests = [
4343
["rv32e", ["arch32e"]],
4444
["rv32i", ["arch32i"]],
45-
["rv32imc", ["arch32i", "arch32c", "arch32m", "wally32periph"]],
45+
["rv32imc", ["arch32i", "arch32c", "arch32m"]], # add when issue #1321 is fixed: "wally32periph"
4646
["rv32gc", ["arch32f", "arch32d", "arch32f_fma", "arch32d_fma", "arch32f_divsqrt", "arch32d_divsqrt",
4747
"arch32i", "arch32priv", "arch32c", "arch32m", "arch32a_amo", "arch32zifencei", "arch32zicond",
4848
"arch32zba", "arch32zbb", "arch32zbc", "arch32zbs", "arch32zfh", "arch32zfh_fma",

config/rv32imc/config.vh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ localparam logic IEEE754 = 0;
3838
localparam logic E_SUPPORTED = 0;
3939

4040
// Integer instruction set extensions
41-
localparam logic ZIFENCEI_SUPPORTED = 1; // Instruction-Fetch fence
41+
localparam logic ZIFENCEI_SUPPORTED = 0; // Instruction-Fetch fence
4242
localparam logic ZICSR_SUPPORTED = 1; // CSR Instructions
4343
localparam logic ZICCLSM_SUPPORTED = 0; // Misaligned loads/stores
4444
localparam logic ZICOND_SUPPORTED = 0; // Integer conditional operations
@@ -85,7 +85,7 @@ localparam logic ZFH_SUPPORTED = 0;
8585
localparam logic ZFA_SUPPORTED = 0;
8686

8787
// privilege modes
88-
localparam logic S_SUPPORTED = 1; // Supervisor mode
88+
localparam logic S_SUPPORTED = 0; // Supervisor mode
8989
localparam logic U_SUPPORTED = 1; // User mode
9090

9191
// Supervisor level extensions

config/rv32imc/coverage.svh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// coverage.svh
2+
// David_Harris@hmc.edu 7 September 2024
3+
// SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
4+
5+
// This file is needed in the config subdirectory for each config supporting coverage.
6+
// It defines which extensions are enabled for that config.
7+
8+
// Define XLEN, used in covergroups
9+
`define XLEN32
10+
11+
// Define relevant addresses
12+
`define ACCESS_FAULT_ADDRESS 32'h0000
13+
`define CLINT_BASE 64'h02000000
14+
15+
// Unprivileged extensions
16+
`define I_COVERAGE
17+
`define M_COVERAGE
18+
`define ZCA_COVERAGE
19+
`define ZICSR_COVERAGE
20+
21+
// Privileged extensions
22+
`define ZICSRM_COVERAGE
23+
`define ZICSRU_COVERAGE
24+
`define EXCEPTIONSM_COVERAGE
25+
`define EXCEPTIONSU_COVERAGE
26+
`define EXCEPTIONSZC_COVERAGE
27+
`define ZICNTRU_COVERAGE
28+
`define ZICNTRM_COVERAGE
29+
`define INTERRUPTSU_COVERAGE
30+
`define INTERRUPTSM_COVERAGE

config/rv32imc/imperas.ic

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# imperas.ic
2+
# Initialization file for ImperasDV lock step simulation
3+
# David_Harris@hmc.edu 15 August 2024
4+
# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
5+
6+
#--mpdconsole
7+
#--gdbconsole
8+
#--showoverrides
9+
#--showcommands
10+
11+
# Core settings
12+
--variant RV32IMC
13+
--override cpu/priv_version=1.12
14+
--override cpu/user_version=20191213
15+
# arch
16+
--override cpu/mimpid=0x100
17+
--override cpu/mvendorid=0x602
18+
--override cpu/marchid=0x24
19+
--override refRoot/cpu/tvec_align=64
20+
21+
# No Supervisor mode
22+
--override cpu/sub_Extensions="S"
23+
24+
# Zifencei extension not implemented
25+
--override cpu/Zifencei=F
26+
27+
# Little endian only
28+
--override cpu/endianFixed=T
29+
30+
# For code coverage, don't produce pseudoinstructions
31+
--override no_pseudo_inst=T
32+
33+
# Show "c." with compressed instructions
34+
--override show_c_prefix=T
35+
36+
# mcause and scause only have 4 lsbs of code and 1 msb of interrupt flag
37+
--override cpu/ecode_mask=0x8000000F # for RV32
38+
39+
# disable CSRs 7a0-7a8
40+
--override cpu/trigger_num=0
41+
42+
# Reset address
43+
--override cpu/reset_address=0x80000000
44+
45+
# Wally implementats WFI as NOP
46+
--override cpu/wfi_is_nop=T
47+
48+
# MISA not writable
49+
--override cpu/misa_Extensions_mask=0x0
50+
51+
# No PMP
52+
--override cpu/PMP_registers=0
53+
--override cpu/PMP_undefined=T
54+
55+
# PMA Settings
56+
# 'r': read access allowed
57+
# 'w': write access allowed
58+
# 'x': execute access allowed
59+
# 'a': aligned access required
60+
# 'A': atomic instructions NOT allowed (actually USER1 privilege needed)
61+
# 'P': push/pop instructions NOT allowed (actually USER2 privilege needed)
62+
# '1': 1-byte accesses allowed
63+
# '2': 2-byte accesses allowed
64+
# '4': 4-byte accesses allowed
65+
# '8': 8-byte accesses allowed
66+
# '-', space: ignored (use for input string formatting).
67+
#
68+
# SVxx Memory 0x0000000000 0x7FFFFFFFFF
69+
#
70+
--callcommand refRoot/cpu/setPMA -lo 0x0000000000 -hi 0xFFFFFFFFFFFFFFFFFF -attributes " ---a-- ---- " # All memory inaccessible unless defined otherwise
71+
--callcommand refRoot/cpu/setPMA -lo 0x0000000000 -hi 0x7FFFFFFFFF -attributes " ---a-- ---- " # INITIAL
72+
--callcommand refRoot/cpu/setPMA -lo 0x0002000000 -hi 0x000200FFFF -attributes " rw-aA- 1248 " # CLINT
73+
--callcommand refRoot/cpu/setPMA -lo 0x000C000000 -hi 0x000FFFFFFF -attributes " rw-aA- --4- " # PLIC
74+
--callcommand refRoot/cpu/setPMA -lo 0x0010000000 -hi 0x0010000007 -attributes " rw-aA- 1--- " # UART0
75+
--callcommand refRoot/cpu/setPMA -lo 0x0010060000 -hi 0x00100600FF -attributes " rw-aA- --4- " # GPIO
76+
--callcommand refRoot/cpu/setPMA -lo 0x0010040000 -hi 0x0010040FFF -attributes " rw-aA- --4- " # SPI
77+
--callcommand refRoot/cpu/setPMA -lo 0x0080000000 -hi 0x00807FFFFF -attributes " rwx--- 1248 " # DTIM/IROM
78+
79+
# Store simulator output to logfile
80+
--output imperas.log

testbench/common/wallyTracer.sv

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,28 +220,34 @@ module wallyTracer import cvw::*; #(parameter cvw_t P) (rvviTrace rvvi);
220220
// Machine Information Registers and Configuration CSRs
221221
`CONNECT_CSR(MISA, 12'h301, testbench.dut.core.priv.priv.csr.csrm.MISA_REGW);
222222
`CONNECT_CSR(MENVCFG, 12'h30A, testbench.dut.core.priv.priv.csr.csrm.MENVCFG_REGW);
223-
`CONNECT_CSR(SENVCFG, 12'h10A, testbench.dut.core.priv.priv.csr.csrs.csrs.SENVCFG_REGW);
224223
`CONNECT_CSR(MSECCFG, 12'h747, 0); // mseccfg
225224
`CONNECT_CSR(MVENDORID, 12'hF11, 0); //mvendorid
226225
`CONNECT_CSR(MARCHID, 12'hF12, 0); // marchid
227226
`CONNECT_CSR(MIMPID, 12'hF13, {{P.XLEN-12{1'b0}}, 12'h100}); // mimpid
228227
`CONNECT_CSR(MHARTID, 12'hF14, testbench.dut.core.priv.priv.csr.csrm.MHARTID_REGW);
229228
`CONNECT_CSR(MCONFIGPTR, 12'hF15, 0); //mconfigptr
230229

230+
// Supervisor Information Registers and Configuration CSRs
231+
if (P.S_SUPPORTED) begin
232+
`CONNECT_CSR(SENVCFG, 12'h10A, testbench.dut.core.priv.priv.csr.csrs.csrs.SENVCFG_REGW);
233+
end
234+
231235
// Sstc CSRs
232236
if (P.SSTC_SUPPORTED) begin
233237
`CONNECT_CSR(STIMECMP, 12'h14D, testbench.dut.core.priv.priv.csr.csrs.csrs.STIMECMP_REGW[P.XLEN-1:0]);
238+
if (P.XLEN == 32) begin
239+
`CONNECT_CSR(STIMECMPH, 12'h15D, testbench.dut.core.priv.priv.csr.csrs.csrs.STIMECMP_REGW[63:32]);
240+
end
234241
end
235242

236243
// Zkr CSRs
237244
// seed not connected (015)
238245

239-
// extra CSRs for RV32
246+
// extra M mode CSRs for RV32
240247
if (P.XLEN == 32) begin
241248
`CONNECT_CSR(MSTATUSH, 12'h310, testbench.dut.core.priv.priv.csr.csrsr.MSTATUSH_REGW);
242249
`CONNECT_CSR(MENVCFGH, 12'h31A, testbench.dut.core.priv.priv.csr.csrm.MENVCFGH_REGW);
243250
`CONNECT_CSR(MSECCFGH, 12'h757, 0); // mseccfgh
244-
`CONNECT_CSR(STIMECMPH, 12'h15D, testbench.dut.core.priv.priv.csr.csrs.csrs.STIMECMP_REGW[63:32]);
245251
end
246252
end
247253

0 commit comments

Comments
 (0)