diff options
Diffstat (limited to 'rtl/core/fetch/fetch.sv')
| -rw-r--r-- | rtl/core/fetch/fetch.sv | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/rtl/core/fetch/fetch.sv b/rtl/core/fetch/fetch.sv new file mode 100644 index 0000000..9b21dd2 --- /dev/null +++ b/rtl/core/fetch/fetch.sv @@ -0,0 +1,35 @@ +`include "core/uarch.sv" + +module core_fetch +#(parameter PREFETCH_ORDER=2) +( + input logic clk, + stall, + flush, + fetched, + input logic[31:0] fetch_data, + + output logic fetch, + output logic[31:0] insn, + output logic[29:0] insn_pc, + addr +); + + logic[29:0] next_pc; + + core_prefetch #(.ORDER(PREFETCH_ORDER)) prefetch + ( + .* + ); + + always_ff @(posedge clk) + if(flush) + addr <= next_pc; + else if(fetched) + addr <= addr + 1; + + initial begin + addr = 0; + end + +endmodule |
