diff options
| author | Alejandro Soto <alejandro@34project.org> | 2022-09-23 23:40:09 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2022-09-23 23:40:09 -0600 |
| commit | 33e4434a0cb4ad7f15178a013296fb2fa740112e (patch) | |
| tree | 96937c12dff200a59ed013cd18af16745cd962a8 /rtl/core/fetch/fetch.sv | |
| parent | 7f67a127f20b87c05ea1791321fb7dcc1083ceb1 (diff) | |
Implement initial fetch stage
Diffstat (limited to '')
| -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 |
