mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-03 10:15:19 +00:00
Only delegated bits of SIP are readable
This commit is contained in:
parent
998f446e3c
commit
ca949f2110
@ -233,7 +233,7 @@ module csr #(parameter
|
|||||||
.STATUS_TVM, .CSRWriteValM, .PrivilegeModeW,
|
.STATUS_TVM, .CSRWriteValM, .PrivilegeModeW,
|
||||||
.CSRSReadValM, .STVEC_REGW, .SEPC_REGW,
|
.CSRSReadValM, .STVEC_REGW, .SEPC_REGW,
|
||||||
.SCOUNTEREN_REGW,
|
.SCOUNTEREN_REGW,
|
||||||
.SATP_REGW, .MIP_REGW, .MIE_REGW,
|
.SATP_REGW, .MIP_REGW, .MIE_REGW, .MIDELEG_REGW,
|
||||||
.WriteSSTATUSM, .IllegalCSRSAccessM);
|
.WriteSSTATUSM, .IllegalCSRSAccessM);
|
||||||
csru csru(.clk, .reset, .InstrValidNotFlushedM, .StallW,
|
csru csru(.clk, .reset, .InstrValidNotFlushedM, .StallW,
|
||||||
.CSRUWriteM, .CSRAdrM, .CSRWriteValM, .STATUS_FS, .CSRUReadValM,
|
.CSRUWriteM, .CSRAdrM, .CSRWriteValM, .STATUS_FS, .CSRUReadValM,
|
||||||
|
@ -151,8 +151,8 @@ module csrm #(parameter
|
|||||||
// CSRs
|
// CSRs
|
||||||
flopenr #(`XLEN) MTVECreg(clk, reset, WriteMTVECM, {CSRWriteValM[`XLEN-1:2], 1'b0, CSRWriteValM[0]}, MTVEC_REGW);
|
flopenr #(`XLEN) MTVECreg(clk, reset, WriteMTVECM, {CSRWriteValM[`XLEN-1:2], 1'b0, CSRWriteValM[0]}, MTVEC_REGW);
|
||||||
if (`S_SUPPORTED) begin:deleg // DELEG registers should exist
|
if (`S_SUPPORTED) begin:deleg // DELEG registers should exist
|
||||||
flopenr #(`XLEN) MEDELEGreg(clk, reset, WriteMEDELEGM, CSRWriteValM & MEDELEG_MASK /*12'h7FF*/, MEDELEG_REGW);
|
flopenr #(`XLEN) MEDELEGreg(clk, reset, WriteMEDELEGM, CSRWriteValM & MEDELEG_MASK, MEDELEG_REGW);
|
||||||
flopenr #(12) MIDELEGreg(clk, reset, WriteMIDELEGM, CSRWriteValM[11:0] & MIDELEG_MASK /*12'h222*/, MIDELEG_REGW);
|
flopenr #(12) MIDELEGreg(clk, reset, WriteMIDELEGM, CSRWriteValM[11:0] & MIDELEG_MASK, MIDELEG_REGW);
|
||||||
end else assign {MEDELEG_REGW, MIDELEG_REGW} = 0;
|
end else assign {MEDELEG_REGW, MIDELEG_REGW} = 0;
|
||||||
|
|
||||||
flopenr #(`XLEN) MSCRATCHreg(clk, reset, WriteMSCRATCHM, CSRWriteValM, MSCRATCH_REGW);
|
flopenr #(`XLEN) MSCRATCHreg(clk, reset, WriteMSCRATCHM, CSRWriteValM, MSCRATCH_REGW);
|
||||||
|
@ -61,7 +61,7 @@ module csrs #(parameter
|
|||||||
(* mark_debug = "true" *) output logic [`XLEN-1:0] SEPC_REGW,
|
(* mark_debug = "true" *) output logic [`XLEN-1:0] SEPC_REGW,
|
||||||
output logic [31:0] SCOUNTEREN_REGW,
|
output logic [31:0] SCOUNTEREN_REGW,
|
||||||
output logic [`XLEN-1:0] SATP_REGW,
|
output logic [`XLEN-1:0] SATP_REGW,
|
||||||
(* mark_debug = "true" *) input logic [11:0] MIP_REGW, MIE_REGW,
|
(* mark_debug = "true" *) input logic [11:0] MIP_REGW, MIE_REGW, MIDELEG_REGW,
|
||||||
output logic WriteSSTATUSM,
|
output logic WriteSSTATUSM,
|
||||||
output logic IllegalCSRSAccessM
|
output logic IllegalCSRSAccessM
|
||||||
);
|
);
|
||||||
@ -102,7 +102,7 @@ module csrs #(parameter
|
|||||||
case (CSRAdrM)
|
case (CSRAdrM)
|
||||||
SSTATUS: CSRSReadValM = SSTATUS_REGW;
|
SSTATUS: CSRSReadValM = SSTATUS_REGW;
|
||||||
STVEC: CSRSReadValM = STVEC_REGW;
|
STVEC: CSRSReadValM = STVEC_REGW;
|
||||||
SIP: CSRSReadValM = {{(`XLEN-12){1'b0}}, MIP_REGW & 12'h222}; // only read supervisor fields
|
SIP: CSRSReadValM = {{(`XLEN-12){1'b0}}, MIP_REGW & 12'h222 & MIDELEG_REGW}; // only read supervisor fields // *** and with MIDELEG instead of 222
|
||||||
SIE: CSRSReadValM = {{(`XLEN-12){1'b0}}, MIE_REGW & 12'h222}; // only read supervisor fields
|
SIE: CSRSReadValM = {{(`XLEN-12){1'b0}}, MIE_REGW & 12'h222}; // only read supervisor fields
|
||||||
SSCRATCH: CSRSReadValM = SSCRATCH_REGW;
|
SSCRATCH: CSRSReadValM = SSCRATCH_REGW;
|
||||||
SEPC: CSRSReadValM = SEPC_REGW;
|
SEPC: CSRSReadValM = SEPC_REGW;
|
||||||
|
@ -8,6 +8,7 @@ wally_workdir = $(work)/wally-riscv-arch-test
|
|||||||
current_dir = $(shell pwd)
|
current_dir = $(shell pwd)
|
||||||
#XLEN ?= 64
|
#XLEN ?= 64
|
||||||
|
|
||||||
|
#all: root wally32 wally64
|
||||||
all: root arch32 wally32 wally32e arch64 wally64
|
all: root arch32 wally32 wally32e arch64 wally64
|
||||||
|
|
||||||
root:
|
root:
|
||||||
|
@ -1295,6 +1295,12 @@ write_pmpaddr_end:
|
|||||||
addi a6, a6, 4
|
addi a6, a6, 4
|
||||||
j test_loop
|
j test_loop
|
||||||
|
|
||||||
|
write_mideleg:
|
||||||
|
// writes the value in t4 to the mideleg register
|
||||||
|
// Doesn't log anything
|
||||||
|
csrw mideleg, t4
|
||||||
|
j test_loop
|
||||||
|
|
||||||
executable_test:
|
executable_test:
|
||||||
// Execute the code at the address in t3, returning the value in t2.
|
// Execute the code at the address in t3, returning the value in t2.
|
||||||
// Assumes the code modifies t2, to become the value stored in t4 for this test.
|
// Assumes the code modifies t2, to become the value stored in t4 for this test.
|
||||||
|
@ -784,6 +784,7 @@ test_cases:
|
|||||||
|
|
||||||
# =========== S-mode enable tests (7.X) ===========
|
# =========== S-mode enable tests (7.X) ===========
|
||||||
|
|
||||||
|
.4byte 0x0, 0x222, write_mideleg # delegate supervisor interrupts to S mode
|
||||||
.4byte 0x0, 0x0, goto_s_mode # go to s-mode. 0xb written to output
|
.4byte 0x0, 0x0, goto_s_mode # go to s-mode. 0xb written to output
|
||||||
.4byte PLIC_THRESH0, 0x00000000, write32_test # set m-mode threshold to 0
|
.4byte PLIC_THRESH0, 0x00000000, write32_test # set m-mode threshold to 0
|
||||||
.4byte PLIC_THRESH1, 0x00000000, write32_test # set s-mode threshold to 0
|
.4byte PLIC_THRESH1, 0x00000000, write32_test # set s-mode threshold to 0
|
||||||
|
@ -102,6 +102,7 @@ test_cases:
|
|||||||
|
|
||||||
# =========== Enter Supervisor Mode ===========
|
# =========== Enter Supervisor Mode ===========
|
||||||
|
|
||||||
|
.4byte 0x0, 0x222, write_mideleg # delegate supervisor interrupts to S mode
|
||||||
.4byte 0x0, 0x0, goto_s_mode # Enter supervisor mode
|
.4byte 0x0, 0x0, goto_s_mode # Enter supervisor mode
|
||||||
|
|
||||||
# =========== Test interrupt enables and priorities ===========
|
# =========== Test interrupt enables and priorities ===========
|
||||||
|
@ -1335,6 +1335,12 @@ write_pmpaddr_end:
|
|||||||
addi a6, a6, 8
|
addi a6, a6, 8
|
||||||
j test_loop
|
j test_loop
|
||||||
|
|
||||||
|
write_mideleg:
|
||||||
|
// writes the value in t4 to the mideleg register
|
||||||
|
// Doesn't log anything
|
||||||
|
csrw mideleg, t4
|
||||||
|
j test_loop
|
||||||
|
|
||||||
executable_test:
|
executable_test:
|
||||||
// Execute the code at the address in t3, returning the value in t2.
|
// Execute the code at the address in t3, returning the value in t2.
|
||||||
// Assumes the code modifies t2, to become the value stored in t4 for this test.
|
// Assumes the code modifies t2, to become the value stored in t4 for this test.
|
||||||
|
@ -784,6 +784,7 @@ test_cases:
|
|||||||
|
|
||||||
# =========== S-mode enable tests (7.X) ===========
|
# =========== S-mode enable tests (7.X) ===========
|
||||||
|
|
||||||
|
.8byte 0x0, 0x222, write_mideleg # delegate supervisor interrupts to S mode
|
||||||
.8byte 0x0, 0x0, goto_s_mode # go to s-mode. 0xb written to output
|
.8byte 0x0, 0x0, goto_s_mode # go to s-mode. 0xb written to output
|
||||||
.8byte PLIC_THRESH0, 0x00000000, write32_test # set m-mode threshold to 0
|
.8byte PLIC_THRESH0, 0x00000000, write32_test # set m-mode threshold to 0
|
||||||
.8byte PLIC_THRESH1, 0x00000000, write32_test # set s-mode threshold to 0
|
.8byte PLIC_THRESH1, 0x00000000, write32_test # set s-mode threshold to 0
|
||||||
|
@ -102,6 +102,7 @@ test_cases:
|
|||||||
|
|
||||||
# =========== Enter Supervisor Mode ===========
|
# =========== Enter Supervisor Mode ===========
|
||||||
|
|
||||||
|
.8byte 0x0, 0x222, write_mideleg # delegate supervisor interrupts to S mode
|
||||||
.8byte 0x0, 0x0, goto_s_mode # Enter supervisor mode
|
.8byte 0x0, 0x0, goto_s_mode # Enter supervisor mode
|
||||||
|
|
||||||
# =========== Test interrupt enables and priorities ===========
|
# =========== Test interrupt enables and priorities ===========
|
||||||
|
Loading…
Reference in New Issue
Block a user