Updated instruction counter to have an enable/disable port

This commit is contained in:
riley committed 2026-11-11 15:24:41 +11:00
1 parent d2ba06b255
commit 2f3ecb9a3c
3 files changed
+6 -4

No files matched your search

+4 -2
View File
@@ -2,7 +2,7 @@
`define INSTRUCTION_COUNTER_H
module instruction_counter #(parameter width=5)(
input logic [0:0] clk, input logic [0:0] rst, input logic [0:0] we,
input logic [0:0] clk, input logic [0:0] rst, input logic [0:0] en, input logic [0:0] we,
input logic [2**width-1:0] W,
output logic [2**width-1:0] addr
);
@@ -10,7 +10,9 @@ module instruction_counter #(parameter width=5)(
logic [2**width-1:0] pc;
always_ff @(posedge clk or posedge rst) begin
if (rst) begin
if (~en) begin
// Skip any cycles where we are disabled
end else if (rst) begin
pc <= {(2**width){1'b0}};
end else if (we) begin
pc <= W;