Fix some CsrPlugin flags issues

This commit is contained in:
Dolu1990 2019-03-20 20:27:47 +01:00
parent 6c2fe934fd
commit 39b2803914
1 changed files with 3 additions and 1 deletions

View File

@ -803,12 +803,14 @@ class CsrPlugin(config: CsrPluginConfig) extends Plugin[VexRiscv] with Exception
is(3){ is(3){
mstatus.MPP := U"00" mstatus.MPP := U"00"
mstatus.MIE := mstatus.MPIE mstatus.MIE := mstatus.MPIE
mstatus.MPIE := True
privilege := mstatus.MPP privilege := mstatus.MPP
jumpInterface.payload := mepc jumpInterface.payload := mepc
} }
if(supervisorGen) is(1){ if(supervisorGen) is(1){
sstatus.SPP := U"0" sstatus.SPP := U"0"
sstatus.SIE := sstatus.SPIE sstatus.SIE := sstatus.SPIE
sstatus.SPIE := True
privilege := U"0" @@ sstatus.SPP privilege := U"0" @@ sstatus.SPP
jumpInterface.payload := sepc jumpInterface.payload := sepc
} }
@ -864,7 +866,7 @@ class CsrPlugin(config: CsrPluginConfig) extends Plugin[VexRiscv] with Exception
//Manage MRET / SRET instructions //Manage MRET / SRET instructions
when(arbitration.isValid && input(ENV_CTRL) === EnvCtrlEnum.XRET) { when(arbitration.isValid && input(ENV_CTRL) === EnvCtrlEnum.XRET) {
//TODO check MPP value too //TODO check MPP value too
when(input(INSTRUCTION)(29 downto 28).asUInt =/= privilege) { when(input(INSTRUCTION)(29 downto 28).asUInt > privilege) {
illegalInstruction := True illegalInstruction := True
} }
} }