Changed mtval for instruction misaligned fault to get address from ieuAdrM (Jal/branch target address)

This commit is contained in:
Kip Macsai-Goren 2022-04-22 22:45:23 +00:00
parent cd70175e5a
commit bd87af478a
4 changed files with 5 additions and 9 deletions

View File

@ -65,7 +65,6 @@ module ifu (
output logic InstrPageFaultF,
output logic IllegalIEUInstrFaultD,
output logic InstrMisalignedFaultM,
output logic [`XLEN-1:0] InstrMisalignedAdrM,
input logic ExceptionM,
// mmu management
input logic [1:0] PrivilegeModeW,
@ -330,7 +329,6 @@ module ifu (
// Traps: Cant happen. The bottom two bits of MTVEC are ignored so the trap always is to a multiple of 4. See 3.1.7 of the privileged spec.
assign BranchMisalignedFaultE = (IEUAdrE[1] & ~`C_SUPPORTED) & PCSrcE;
flopenr #(1) InstrMisalginedReg(clk, reset, ~StallM, BranchMisalignedFaultE, InstrMisalignedFaultM);
flopenr #(`XLEN) InstrMisalignedAdrReg(clk, reset, ~StallM, PCNextF, InstrMisalignedAdrM);
// Instruction and PC/PCLink pipeline registers
mux2 #(32) FlushInstrEMux(InstrD, nop, FlushE, NextInstrD);

View File

@ -57,7 +57,7 @@ module privileged (
input logic StoreAmoMisalignedFaultM,
input logic TimerIntM, MExtIntM, SExtIntM, SwIntM,
input logic [63:0] MTIME_CLINT,
input logic [`XLEN-1:0] InstrMisalignedAdrM, IEUAdrM,
input logic [`XLEN-1:0] IEUAdrM,
input logic [4:0] SetFflagsM,
// Trap signals from pmp/pma in mmu
@ -222,7 +222,7 @@ module privileged (
.MIP_REGW, .MIE_REGW, .SIP_REGW, .SIE_REGW, .MIDELEG_REGW,
.STATUS_MIE, .STATUS_SIE,
.PCM,
.InstrMisalignedAdrM, .IEUAdrM,
.IEUAdrM,
.InstrM,
.InstrValidM, .CommittedM, .DivE,
.TrapM, .MTrapM, .STrapM, .UTrapM, .RetM,

View File

@ -44,7 +44,7 @@ module trap (
(* mark_debug = "true" *) input logic [11:0] MIP_REGW, MIE_REGW, SIP_REGW, SIE_REGW, MIDELEG_REGW,
input logic STATUS_MIE, STATUS_SIE,
input logic [`XLEN-1:0] PCM,
input logic [`XLEN-1:0] InstrMisalignedAdrM, IEUAdrM,
input logic [`XLEN-1:0] IEUAdrM,
input logic [31:0] InstrM,
input logic InstrValidM, CommittedM, DivE,
output logic TrapM, MTrapM, STrapM, UTrapM, RetM,
@ -152,7 +152,7 @@ module trap (
// Technically
always_comb
if (InstrMisalignedFaultM) NextFaultMtvalM = InstrMisalignedAdrM;
if (InstrMisalignedFaultM) NextFaultMtvalM = IEUAdrM;
else if (LoadMisalignedFaultM) NextFaultMtvalM = IEUAdrM;
else if (StoreAmoMisalignedFaultM) NextFaultMtvalM = IEUAdrM;
else if (BreakpointFaultM) NextFaultMtvalM = PCM;

View File

@ -82,7 +82,6 @@ module wallypipelinedcore (
logic InstrPageFaultF, LoadPageFaultM, StoreAmoPageFaultM;
logic LoadMisalignedFaultM, LoadAccessFaultM;
logic StoreAmoMisalignedFaultM, StoreAmoAccessFaultM;
logic [`XLEN-1:0] InstrMisalignedAdrM;
logic InvalidateICacheM, FlushDCacheM;
logic PCSrcE;
logic CSRWritePendingDEM;
@ -190,7 +189,6 @@ module wallypipelinedcore (
// Faults
.IllegalBaseInstrFaultD, .InstrPageFaultF,
.IllegalIEUInstrFaultD, .InstrMisalignedFaultM,
.InstrMisalignedAdrM,
// mmu management
.PrivilegeModeW, .PTE, .PageType, .SATP_REGW,
@ -332,7 +330,7 @@ module wallypipelinedcore (
.LoadMisalignedFaultM, .StoreAmoMisalignedFaultM,
.TimerIntM, .MExtIntM, .SExtIntM, .SwIntM,
.MTIME_CLINT,
.InstrMisalignedAdrM, .IEUAdrM,
.IEUAdrM,
.SetFflagsM,
// Trap signals from pmp/pma in mmu
// *** do these need to be split up into one for dmem and one for ifu?