summaryrefslogtreecommitdiff
path: root/rtl/core/fetch/fetch.sv
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2022-11-10 01:36:37 -0600
committerAlejandro Soto <alejandro@34project.org>2022-11-10 01:36:37 -0600
commit0f89db514bd174def590645c30a7bd358ea6be93 (patch)
treea9c39a599ac5adf66d1a15478360b5958e5b6296 /rtl/core/fetch/fetch.sv
parentbf82f69cbf7fa0900263236057174c421a28045c (diff)
Fix flush-stall relationship in porch
Diffstat (limited to 'rtl/core/fetch/fetch.sv')
-rw-r--r--rtl/core/fetch/fetch.sv14
1 files changed, 8 insertions, 6 deletions
diff --git a/rtl/core/fetch/fetch.sv b/rtl/core/fetch/fetch.sv
index dc97909..1853ee0 100644
--- a/rtl/core/fetch/fetch.sv
+++ b/rtl/core/fetch/fetch.sv
@@ -18,10 +18,11 @@ module core_fetch
flush,
output word insn,
output ptr insn_pc,
- addr
+ addr,
+ fetch_head
);
- ptr next_pc, head, hold_addr, target;
+ ptr next_pc, hold_addr, target;
logic fetched_valid, discard;
assign flush = branch || prefetch_flush;
@@ -30,20 +31,21 @@ module core_fetch
core_prefetch #(.ORDER(PREFETCH_ORDER)) prefetch
(
+ .head(fetch_head),
.fetched(fetched_valid),
.*
);
always_comb begin
if(branch)
- head = target;
+ fetch_head = target;
else if(prefetch_flush)
- head = next_pc;
+ fetch_head = next_pc;
else
- head = {30{1'bx}};
+ fetch_head = {30{1'bx}};
if(flush)
- addr = head;
+ addr = fetch_head;
else if(fetch && fetched_valid)
addr = hold_addr + 1;
else