Added instruction counter and register file

This commit is contained in:
riley committed 2026-10-08 14:13:38 +11:00
1 parent 5cb48095ce
commit 0ef2aeeb48
2 files changed
+43

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
`ifndef INSTRUCTION_COUNTER_H
`define INSTRUCTION_COUNTER_H
module instruction_counter #(parameter width=5)(
input logic [0:0] clk, input logic [0:0] we,
input logic [2**width-1:0] W,
output logic [2**width-1:0] addr
);
logic [2**width-1:0] pc;
always_ff (@posedge clk) begin
if (we) begin
pc <= W
else
pc <= pc + 4;
end
end
assign addr = pc;
endmodule
`endif