Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated priority of actions after waking from SLEEP. #753

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions rtl/cv32e40x_controller_fsm.sv
Original file line number Diff line number Diff line change
Expand Up @@ -1348,8 +1348,10 @@ module cv32e40x_controller_fsm import cv32e40x_pkg::*;
woke_to_debug_q <= 1'b0;
woke_to_interrupt_q <= 1'b0;
end else begin
woke_to_debug_q <= (ctrl_fsm_cs == SLEEP) && debug_req_i;
woke_to_interrupt_q <= (ctrl_fsm_cs == SLEEP) && irq_wu_ctrl_i;
// Woke up to debug if no nmi was pending
woke_to_debug_q <= (ctrl_fsm_cs == SLEEP) && debug_req_i && !(pending_nmi);
// Woke up to interrupts if no NMI or debug was pending
woke_to_interrupt_q <= (ctrl_fsm_cs == SLEEP) && irq_wu_ctrl_i && !(pending_nmi || debug_req_i);
end
end

Expand Down
11 changes: 5 additions & 6 deletions sva/cv32e40x_controller_fsm_sva.sv
Original file line number Diff line number Diff line change
Expand Up @@ -881,24 +881,24 @@ end
(abort_op_wb_i && (ctrl_fsm_ns == DEBUG_TAKEN)))
else `uvm_error("controller", "Debug not entered on a WPT match")

// Ensure debug mode is entered if woken up by a debug request
// Ensure debug mode is entered if woken up by a debug request (unless a higher priority NMI woke up the core)
a_sleep_to_debug:
assert property (@(posedge clk) disable iff (!rst_n)
(ctrl_fsm_cs == SLEEP) &&
(ctrl_fsm_ns == FUNCTIONAL) &&
debug_req_i &&
!(pending_nmi || irq_wu_ctrl_i || (wfe_in_wb && wu_wfe_i))
!pending_nmi
|=>
(ctrl_fsm_ns == DEBUG_TAKEN))
else `uvm_error("controller", "Woke from sleep due to debug_req but debug mode not entered")

// Ensure interrupt is taken if woken up by an interrupt
// Ensure interrupt is taken if woken up by an interrupt (unless a higher priority NMI or debug request woke up the core)
a_sleep_to_irq:
assert property (@(posedge clk) disable iff (!rst_n)
(ctrl_fsm_cs == SLEEP) &&
(ctrl_fsm_ns == FUNCTIONAL) &&
irq_wu_ctrl_i &&
!(pending_nmi || debug_req_i || (wfe_in_wb && wu_wfe_i)) &&
!(pending_nmi || debug_req_i) &&
mstatus_i.mie
|=>
(ctrl_fsm_o.pc_mux == PC_TRAP_IRQ) || (ctrl_fsm_o.pc_mux == PC_TRAP_CLICV))
Expand All @@ -909,8 +909,7 @@ end
assert property (@(posedge clk) disable iff (!rst_n)
(ctrl_fsm_cs == SLEEP) &&
(ctrl_fsm_ns == FUNCTIONAL) &&
pending_nmi &&
!(debug_req_i || irq_wu_ctrl_i || (wfe_in_wb && wu_wfe_i))
pending_nmi
|=>
(ctrl_fsm_o.pc_mux == PC_TRAP_NMI))
else `uvm_error("controller", "Woke from sleep due to NMI but NMI not taken")
Expand Down