From c8a110e74031b56f6ea40cd1d30404f32ecd8874 Mon Sep 17 00:00:00 2001 From: un-lock-able Date: Fri, 12 Jul 2024 00:17:33 +0800 Subject: [PATCH] Avoid stall when actual branch --- PipelineProcessor.srcs/sources_1/new/InstFetch.v | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PipelineProcessor.srcs/sources_1/new/InstFetch.v b/PipelineProcessor.srcs/sources_1/new/InstFetch.v index 85f884a..94e044e 100644 --- a/PipelineProcessor.srcs/sources_1/new/InstFetch.v +++ b/PipelineProcessor.srcs/sources_1/new/InstFetch.v @@ -26,7 +26,9 @@ module InstFetch ( if (reset) begin PC <= 32'h00000000; end else begin - if (need_stall) begin + // Note: if the inst is branch followed by a load word, the stall of the load word + // will prevent the branch from jump + if (need_stall == 1'h1 && PC_branch == 1'h0) begin PC <= PC; end else begin if (PC_branch) begin