-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathfenpin.v
50 lines (41 loc) · 1.11 KB
/
fenpin.v
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
module fenpin (clk,clk_1HZ,clk_2HZ,clk_100HZ,clk_1KHZ,high);
input clk;
output clk_1HZ,clk_2HZ,clk_100HZ,clk_1KHZ,high;
reg clk_1HZ,clk_2HZ,clk_100HZ,clk_1KHZ,high;
reg[26:0] count1=0,count2=0,count3=0,count4=0;
always@(*)
begin
high<=1;
end
always@(posedge clk)
begin
count1<=count1+1;
if(count1<25000000)
clk_1HZ<=1;
else if(count1<49999999)
clk_1HZ<=0;
if(count1==49999999)
count1<=0;
count2<=count2+1;
if(count2<12500000)
clk_2HZ<=1;
else if(count2<24999999)
clk_2HZ<=0;
if(count2==24999999)
count2<=0;
count3<=count3+1;
if(count3<250000)
clk_100HZ<=1;
else if(count3<499999)
clk_100HZ<=0;
if(count3==499999)
count3<=0;
count4<=count4+1;
if(count4<25000)
clk_1KHZ<=1;
else if(count4<49999)
clk_1KHZ<=0;
if(count4==49999)
count4<=0;
end
endmodule