-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogramCounter.sv
More file actions
34 lines (31 loc) · 795 Bytes
/
programCounter.sv
File metadata and controls
34 lines (31 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/****************************************************************************************
* *
* https://www.bigmessowires.com/nibbler/ *
* Implementation by: Bryan Chan and Diego Regalado *
* *
*****************************************************************************************/
module ProgramCounter(
input [11:0] addressIn,
input incPC,
input notReset,
input notLoadPC,
input clk,
output [11:0] addressOut
);
reg [11:0] addressOut = 0;
always @ ( posedge clk) begin
if(~notReset) begin
addressOut = 12'b0;
end else begin
if(~notLoadPC) begin
addressOut = addressIn;
end else begin
if(incPC) begin
addressOut += 1;
end else begin
addressOut = addressOut;
end
end
end
end
endmodule