forked from Github_Repos/cvw
Moved Breakpoint and Ecall fault logic into privdec
This commit is contained in:
parent
2ceed15bd5
commit
fde8375fbd
@ -40,11 +40,13 @@ module privdec (
|
|||||||
input logic STATUS_TSR, STATUS_TVM, STATUS_TW,
|
input logic STATUS_TSR, STATUS_TVM, STATUS_TW,
|
||||||
input logic [1:0] STATUS_FS,
|
input logic [1:0] STATUS_FS,
|
||||||
output logic IllegalInstrFaultM, ITLBFlushF, DTLBFlushM,
|
output logic IllegalInstrFaultM, ITLBFlushF, DTLBFlushM,
|
||||||
output logic sretM, mretM, ecallM, ebreakM, wfiM, sfencevmaM);
|
output logic EcallFaultM, BreakpointFaultM,
|
||||||
|
output logic sretM, mretM, wfiM, sfencevmaM);
|
||||||
|
|
||||||
logic IllegalPrivilegedInstrM, IllegalOrDisabledFPUInstrM;
|
logic IllegalPrivilegedInstrM, IllegalOrDisabledFPUInstrM;
|
||||||
logic WFITimeoutM;
|
logic WFITimeoutM;
|
||||||
logic StallMQ;
|
logic StallMQ;
|
||||||
|
logic ebreakM, ecallM;
|
||||||
|
|
||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
// Decode privileged instructions
|
// Decode privileged instructions
|
||||||
@ -68,6 +70,12 @@ module privdec (
|
|||||||
assign WFITimeoutM = ((STATUS_TW & PrivilegeModeW != `M_MODE) | (`S_SUPPORTED & PrivilegeModeW == `U_MODE)) & WFICount[`WFI_TIMEOUT_BIT];
|
assign WFITimeoutM = ((STATUS_TW & PrivilegeModeW != `M_MODE) | (`S_SUPPORTED & PrivilegeModeW == `U_MODE)) & WFICount[`WFI_TIMEOUT_BIT];
|
||||||
end else assign WFITimeoutM = 0;
|
end else assign WFITimeoutM = 0;
|
||||||
|
|
||||||
|
///////////////////////////////////////////
|
||||||
|
// Extract exceptions by name and handle them
|
||||||
|
///////////////////////////////////////////
|
||||||
|
assign BreakpointFaultM = ebreakM; // could have other causes from a debugger
|
||||||
|
assign EcallFaultM = ecallM;
|
||||||
|
|
||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
// sfence.vma causes TLB flushes
|
// sfence.vma causes TLB flushes
|
||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
|
@ -86,7 +86,7 @@ module privileged (
|
|||||||
logic [`XLEN-1:0] MEDELEG_REGW;
|
logic [`XLEN-1:0] MEDELEG_REGW;
|
||||||
logic [11:0] MIDELEG_REGW;
|
logic [11:0] MIDELEG_REGW;
|
||||||
|
|
||||||
logic sretM, mretM, ecallM, ebreakM, sfencevmaM;
|
logic sretM, mretM, sfencevmaM;
|
||||||
logic IllegalCSRAccessM;
|
logic IllegalCSRAccessM;
|
||||||
logic IllegalIEUInstrFaultE, IllegalIEUInstrFaultM;
|
logic IllegalIEUInstrFaultE, IllegalIEUInstrFaultM;
|
||||||
logic IllegalFPUInstrM;
|
logic IllegalFPUInstrM;
|
||||||
@ -116,8 +116,8 @@ module privileged (
|
|||||||
privdec pmd(.clk, .reset, .StallM, .InstrM(InstrM[31:20]),
|
privdec pmd(.clk, .reset, .StallM, .InstrM(InstrM[31:20]),
|
||||||
.PrivilegedM, .IllegalIEUInstrFaultM, .IllegalCSRAccessM, .IllegalFPUInstrM,
|
.PrivilegedM, .IllegalIEUInstrFaultM, .IllegalCSRAccessM, .IllegalFPUInstrM,
|
||||||
.PrivilegeModeW, .STATUS_TSR, .STATUS_TVM, .STATUS_TW, .STATUS_FS, .IllegalInstrFaultM,
|
.PrivilegeModeW, .STATUS_TSR, .STATUS_TVM, .STATUS_TW, .STATUS_FS, .IllegalInstrFaultM,
|
||||||
.ITLBFlushF, .DTLBFlushM,
|
.ITLBFlushF, .DTLBFlushM, .EcallFaultM, .BreakpointFaultM,
|
||||||
.sretM, .mretM, .ecallM, .ebreakM, .wfiM, .sfencevmaM);
|
.sretM, .mretM, .wfiM, .sfencevmaM);
|
||||||
|
|
||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
// Control and Status Registers
|
// Control and Status Registers
|
||||||
@ -149,12 +149,6 @@ module privileged (
|
|||||||
.CSRReadValW,
|
.CSRReadValW,
|
||||||
.IllegalCSRAccessM, .BigEndianM);
|
.IllegalCSRAccessM, .BigEndianM);
|
||||||
|
|
||||||
///////////////////////////////////////////
|
|
||||||
// Extract exceptions by name and handle them
|
|
||||||
///////////////////////////////////////////
|
|
||||||
|
|
||||||
assign BreakpointFaultM = ebreakM; // could have other causes too
|
|
||||||
assign EcallFaultM = ecallM;
|
|
||||||
|
|
||||||
|
|
||||||
// A page fault might occur because of insufficient privilege during a TLB
|
// A page fault might occur because of insufficient privilege during a TLB
|
||||||
|
Loading…
Reference in New Issue
Block a user