Fix WFI. Not sensitive anymore to global interrupt enables, delegation and privilege

This commit is contained in:
Charles Papon 2019-06-05 00:32:38 +02:00
parent 64e8919e89
commit 56f7c27d18
1 changed files with 2 additions and 1 deletions

View File

@ -879,9 +879,10 @@ class CsrPlugin(val config: CsrPluginConfig) extends Plugin[VexRiscv] with Excep
import execute._ import execute._
//Manage WFI instructions //Manage WFI instructions
val inWfi = False.addTag(Verilator.public) val inWfi = False.addTag(Verilator.public)
val wfiWake = RegNext(interruptSpecs.map(_.cond).orR) init(False)
if(wfiGenAsWait) when(arbitration.isValid && input(ENV_CTRL) === EnvCtrlEnum.WFI){ if(wfiGenAsWait) when(arbitration.isValid && input(ENV_CTRL) === EnvCtrlEnum.WFI){
inWfi := True inWfi := True
when(!interrupt){ when(!wfiWake){
arbitration.haltItself := True arbitration.haltItself := True
} }
} }