Updated instruction counter to have an enable/disable port
This commit is contained in:
3 files changed
+6
-4
No files matched your search
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user