-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfull_blinker.v
More file actions
36 lines (32 loc) · 755 Bytes
/
full_blinker.v
File metadata and controls
36 lines (32 loc) · 755 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
35
36
module full_blink(full, CLK, light);
input full, CLK;
output reg light;
reg [3:0] counter;
reg blinking;
initial begin
light = 1'b0;
counter = 4'b0000;
blinking = 0;
end
wire CLK_OUT;
timer_clock_divider tcd(
.CLK_IN(CLK),
.CLK_OUT(CLK_OUT)
);
always @ (posedge CLK_OUT or posedge full) begin
if (full) begin
blinking <= 1'b1;
counter <= 0;
light <= 1'b1;
end
else if (counter != 6 - 1 & blinking) begin
light <= ~light;
counter <= counter + 1;
end
else begin
light <= 1'b0;
counter <= 0;
blinking <= 0;
end
end
endmodule