Added Changes to ModelSim from Modules folder (and small fix for ../hexfile path)
This commit is contained in:
21 files changed
+389
-1323
No files matched your search
@@ -2,14 +2,17 @@
|
||||
`define INSTRUCTION_COUNTER_H
|
||||
|
||||
module instruction_counter #(parameter width=5)(
|
||||
input logic [0:0] clk, input logic [0:0] we,
|
||||
input logic [0:0] clk, input logic [0:0] rst, 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
|
||||
|
||||
always_ff @(posedge clk or posedge rst) begin
|
||||
if (rst) begin
|
||||
pc <= {(2**width){1'b0}};
|
||||
end else if (we) begin
|
||||
pc <= W;
|
||||
end else begin
|
||||
pc <= pc + 4;
|
||||
|
||||
Reference in new issue
Block a user