From 6abd93eb497beada4a1635aafd2300d7e9d5853c Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Mon, 29 Aug 2022 16:14:42 +0100 Subject: [PATCH] Oops, masked the wakeup-on-halt request path when I masked IRQs on WFI state. --- hdl/hazard3_csr.v | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hdl/hazard3_csr.v b/hdl/hazard3_csr.v index ee4a1b9..b22a847 100644 --- a/hdl/hazard3_csr.v +++ b/hdl/hazard3_csr.v @@ -1423,8 +1423,11 @@ wire irq_active = |(mip & mie) && mstatus_mie && !dcsr_step; // WFI clear respects individual interrupt enables but ignores mstatus.mie. // Additionally, wfi is treated as a nop during single-stepping and D-mode. // Note that the IRQs and debug halt request input registers are clocked by -// clk_always_on, so that a wakeup can be generated when asleep. -assign pwr_wfi_wakeup_req = |(mip & mie) || dcsr_step || debug_mode || want_halt_irq_if_no_exception; +// clk_always_on, so that a wakeup can be generated when asleep. Note also +// that want_halt_irq_if_no_exception can be masked while asleep, so also +// feed in the raw halt request as a wakeup source. +assign pwr_wfi_wakeup_req = |(mip & mie) || dcsr_step || debug_mode || + want_halt_irq_if_no_exception || dbg_req_halt_prev; // Priority order from priv spec: external > software > timer wire [3:0] standard_irq_num =