mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Improved priority order and mtval of traps to match spec
This commit is contained in:
parent
04b0579b89
commit
ffecdda6e6
@ -130,8 +130,8 @@ module trap (
|
||||
else if (SPendingIntsM[5]) CauseM = (1 << (`XLEN-1)) + 5; // Supervisor Timer Int handled by S-mode
|
||||
else if (InstrPageFaultM) CauseM = 12;
|
||||
else if (InstrAccessFaultM) CauseM = 1;
|
||||
else if (InstrMisalignedFaultM) CauseM = 0;
|
||||
else if (IllegalInstrFaultM) CauseM = 2;
|
||||
else if (InstrMisalignedFaultM) CauseM = 0;
|
||||
else if (BreakpointFaultM) CauseM = 3;
|
||||
else if (EcallFaultM) CauseM = {{(`XLEN-2){1'b0}}, PrivilegeModeW} + 8;
|
||||
else if (LoadMisalignedFaultM) CauseM = 4;
|
||||
@ -152,13 +152,17 @@ module trap (
|
||||
// Technically
|
||||
|
||||
always_comb
|
||||
if (InstrMisalignedFaultM) NextFaultMtvalM = IEUAdrM;
|
||||
if (InstrPageFaultM) NextFaultMtvalM = PCM;
|
||||
else if (InstrAccessFaultM) NextFaultMtvalM = PCM;
|
||||
else if (IllegalInstrFaultM) NextFaultMtvalM = {{(`XLEN-32){1'b0}}, InstrM};
|
||||
else if (InstrMisalignedFaultM) NextFaultMtvalM = PCM;
|
||||
else if (EcallFaultM) NextFaultMtvalM = 0;
|
||||
else if (BreakpointFaultM) NextFaultMtvalM = PCM;
|
||||
else if (LoadMisalignedFaultM) NextFaultMtvalM = IEUAdrM;
|
||||
else if (StoreAmoMisalignedFaultM) NextFaultMtvalM = IEUAdrM;
|
||||
else if (BreakpointFaultM) NextFaultMtvalM = PCM;
|
||||
else if (InstrPageFaultM) NextFaultMtvalM = PCM;
|
||||
else if (LoadPageFaultM) NextFaultMtvalM = IEUAdrM;
|
||||
else if (StoreAmoPageFaultM) NextFaultMtvalM = IEUAdrM;
|
||||
else if (IllegalInstrFaultM) NextFaultMtvalM = {{(`XLEN-32){1'b0}}, InstrM};
|
||||
else if (LoadAccessFaultM) NextFaultMtvalM = IEUAdrM;
|
||||
else if (StoreAmoAccessFaultM) NextFaultMtvalM = IEUAdrM;
|
||||
else NextFaultMtvalM = 0;
|
||||
endmodule
|
||||
|
Loading…
Reference in New Issue
Block a user