summaryrefslogtreecommitdiff
path: root/rtl/core/fetch/prefetch.sv
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2022-10-15 19:31:55 -0600
committerAlejandro Soto <alejandro@34project.org>2022-10-15 19:31:55 -0600
commitec152d814af82524cf68df95d7f06b9b70c0d0d0 (patch)
tree417ad3c693f0618dd9609ffef6028fa0a955fee2 /rtl/core/fetch/prefetch.sv
parent7d95ff01bcd8c42efe118fd1bddaabfca0e937eb (diff)
Rework bus architecture
Diffstat (limited to 'rtl/core/fetch/prefetch.sv')
-rw-r--r--rtl/core/fetch/prefetch.sv13
1 files changed, 5 insertions, 8 deletions
diff --git a/rtl/core/fetch/prefetch.sv b/rtl/core/fetch/prefetch.sv
index 486ec96..4025339 100644
--- a/rtl/core/fetch/prefetch.sv
+++ b/rtl/core/fetch/prefetch.sv
@@ -23,19 +23,16 @@ module core_prefetch
assign insn = flush ? `NOP : prefetch[0];
assign next_pc = ~stall & |valid ? insn_pc + 1 : insn_pc;
-
- always_comb
- if((valid == SIZE - 2) & fetched)
- fetch = 0;
- else
- fetch = ~&valid;
+ assign fetch = !stall || ~&valid;
always_ff @(posedge clk) begin
insn_pc <= flush ? head : next_pc;
- if(~flush & fetched & (valid == SIZE - 1))
+ if(flush)
+ prefetch[SIZE - 1] <= `NOP;
+ else if(fetched && valid == SIZE - 1 + {{(ORDER - 1){1'b0}}, !stall})
prefetch[SIZE - 1] <= fetch_data;
- else
+ else if(!stall)
prefetch[SIZE - 1] <= `NOP;
if(flush)