From 665c2a349c921e5af239edd8861625faa02f4894 Mon Sep 17 00:00:00 2001 From: Megan Wachs Date: Tue, 27 Jun 2017 13:31:29 -0700 Subject: [PATCH] Correct Debug + WFI Interactions 1) Debug interrupt should end WFI 2) WFI should end immedately during single-step 3) WFI should act like NOP during Debug Mode --- src/main/scala/rocket/CSR.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/scala/rocket/CSR.scala b/src/main/scala/rocket/CSR.scala index a51fbdfc..9b077f66 100644 --- a/src/main/scala/rocket/CSR.scala +++ b/src/main/scala/rocket/CSR.scala @@ -505,8 +505,8 @@ class CSRFile(perfEventSets: EventSets = new EventSets(Seq()))(implicit p: Param val exception = insn_call || insn_break || io.exception assert(PopCount(insn_ret :: insn_call :: insn_break :: io.exception :: Nil) <= 1, "these conditions must be mutually exclusive") - when (insn_wfi) { reg_wfi := true } - when (pending_interrupts.orR || exception) { reg_wfi := false } + when (insn_wfi && !io.singleStep && !reg_debug) { reg_wfi := true } + when (pending_interrupts.orR || exception || reg_dcsr.debugint) { reg_wfi := false } assert(!reg_wfi || io.retire === UInt(0)) when (io.retire(0) || exception) { reg_singleStepped := true }