我是靠谱客的博主 唠叨小土豆,这篇文章主要介绍Count clock/HDLBits,现在分享给大家,希望可以做个参考。

复制代码
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
module top_module( input clk, input reset, input ena, output pm, output [7:0] hh, output [7:0] mm, output [7:0] ss); reg clkm,clkh; always@(posedge clk) begin if(reset) ss=0; else if(ena==1) begin if(ss[3:0]==9) if(ss[7:4]==5) ss=0; else begin ss[7:4]=ss[7:4]+1; ss[3:0]=0; end else ss[3:0]=ss[3:0]+1; end end always@(posedge clk) begin if(reset) mm=0; else if(ena) begin if(ss[7:4]==5&&ss[3:0]==9) if(mm[3:0]==9) if(mm[7:4]==5) mm=0; else begin mm[7:4]=mm[7:4]+1; mm[3:0]=0; end else mm[3:0]=mm[3:0]+1; end end always@(posedge clk) begin if(reset) begin hh[3:0]=2; hh[7:4]=1; end else if(ena) begin if(mm[7:4]==5&&mm[3:0]==9&&ss[7:4]==5&&ss[3:0]==9) if(hh[7:4]==0&&hh[3:0]==9) begin hh[3:0]=0; hh[7:4]=1; end else if(hh[7:4]==1&&hh[3:0]==1) begin pm=~pm; hh[3:0]=2; end else if(hh[7:4]==1&&hh[3:0]==2) begin hh[7:4]=0; hh[3:0]=1; end else hh[3:0]=hh[3:0]+1; end end endmodule

最后

以上就是唠叨小土豆最近收集整理的关于Count clock/HDLBits的全部内容,更多相关Count内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(79)

评论列表共有 0 条评论

立即
投稿
返回
顶部