summaryrefslogtreecommitdiff
path: root/rtl/core/fetch
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2022-12-07 19:18:04 -0600
committerAlejandro Soto <alejandro@34project.org>2022-12-07 19:51:41 -0600
commitc39552375661e495b344e8386649ade92a4d45b2 (patch)
tree45623ce35964e43ae7d8804c1ef1c6dedb3ba7a1 /rtl/core/fetch
parentb1761b8eac5777c09723bbc8cd31cc05d8ec35ae (diff)
Implement single-stepping
Diffstat (limited to 'rtl/core/fetch')
-rw-r--r--rtl/core/fetch/fetch.sv6
-rw-r--r--rtl/core/fetch/prefetch.sv6
2 files changed, 8 insertions, 4 deletions
diff --git a/rtl/core/fetch/fetch.sv b/rtl/core/fetch/fetch.sv
index acc8e9d..c024e7d 100644
--- a/rtl/core/fetch/fetch.sv
+++ b/rtl/core/fetch/fetch.sv
@@ -11,18 +11,20 @@ module core_fetch
wr_pc,
prefetch_flush,
input ptr branch_target,
+ porch_insn_pc,
input word wr_current,
fetch_data,
output logic fetch,
flush,
+ nop,
output word insn,
output ptr insn_pc,
addr,
fetch_head
);
- ptr next_pc, hold_addr, target;
+ ptr hold_addr, target;
logic branch, prefetch_ready, fetched_valid, discard, pending, next_pending;
assign fetch = prefetch_ready && !discard;
@@ -44,7 +46,7 @@ module core_fetch
if(branch)
fetch_head = target;
else if(prefetch_flush)
- fetch_head = next_pc;
+ fetch_head = porch_insn_pc;
else
fetch_head = {30{1'bx}};
diff --git a/rtl/core/fetch/prefetch.sv b/rtl/core/fetch/prefetch.sv
index 2f0a866..1b5a4c5 100644
--- a/rtl/core/fetch/prefetch.sv
+++ b/rtl/core/fetch/prefetch.sv
@@ -13,15 +13,17 @@ module core_prefetch
output word insn,
output ptr insn_pc,
- next_pc,
- output logic fetch
+ output logic fetch,
+ nop
);
localparam SIZE = (1 << ORDER) - 1;
+ ptr next_pc;
logic[31:0] prefetch[SIZE];
logic[ORDER - 1:0] valid;
+ assign nop = flush ? 1 : ~|valid;
assign insn = flush ? `NOP : prefetch[0];
assign next_pc = ~stall & |valid ? insn_pc + 1 : insn_pc;
assign fetch = !stall || ~&valid;