From ed22d502fd37e41c4131e0bfdfa460d387811357 Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Mon, 6 Dec 2021 19:28:21 +0000 Subject: [PATCH] Fix bus stall getting stuck high when a bus fault exception isn't immediately accepted by the frontend --- hdl/hazard3_core.v | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hdl/hazard3_core.v b/hdl/hazard3_core.v index 8ad6fa2..829a4ce 100644 --- a/hdl/hazard3_core.v +++ b/hdl/hazard3_core.v @@ -766,7 +766,11 @@ assign f_jump_req = x_jump_req || m_trap_enter_vld; assign f_jump_target = m_trap_enter_vld ? m_trap_addr : x_jump_target; assign x_jump_not_except = !m_trap_enter_vld; -wire m_bus_stall = xm_memop != MEMOP_NONE && !bus_dph_ready_d && !( +// EXCEPT_NONE clause is needed in the following sequence: +// - Cycle 0: hresp asserted, hready low. We set the exception to squash behind us. Bus stall high. +// - Cycle 1: hready high. For whatever reason, the frontend can't accept the trap address this cycle. +// - Cycle 2: Our dataphase has ended, so bus_dph_ready_d doesn't pulse again. m_bus_stall stuck high. +wire m_bus_stall = xm_memop != MEMOP_NONE && !bus_dph_ready_d && xm_except == EXCEPT_NONE && !( |EXTENSION_A && xm_memop == MEMOP_SC_W && !mw_local_exclusive_reserved );