verilog数字时钟源程序 ,分频模块,计时模块,子函数调用,及测试模块

verilog数字时钟源程序 ,分频模块,计时模块,子函数调用,及测试模块

ID:5471615

大小:64.51 KB

页数:11页

时间:2017-12-14

verilog数字时钟源程序 ,分频模块,计时模块,子函数调用,及测试模块_第1页
verilog数字时钟源程序 ,分频模块,计时模块,子函数调用,及测试模块_第2页
verilog数字时钟源程序 ,分频模块,计时模块,子函数调用,及测试模块_第3页
verilog数字时钟源程序 ,分频模块,计时模块,子函数调用,及测试模块_第4页
verilog数字时钟源程序 ,分频模块,计时模块,子函数调用,及测试模块_第5页
资源描述:

《verilog数字时钟源程序 ,分频模块,计时模块,子函数调用,及测试模块》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、分频moduleclkgen(clock,reset,clkdiv,clk500);inputclock,reset;outputclkdiv;outputclk500;reg[31:0]counter1;regclkdiv;regclk500;reg[31:0]counter0;/********??1HZ?????*********/always@(posedgeclock)if(reset)beginclkdiv<=0;counter0<=0;endelseif(counter0==24'd4)beginc

2、ounter0<=0;clkdiv=~clkdiv;endelsebegincounter0<=counter0+1;clkdiv<=clkdiv;end/********??500HZ?????*********/always@(posedgeclock)if(reset)beginclk500<=0;counter1<=0;endelseif(counter1==24'd2)begincounter1<=0;clk500=~clk500;endelsebegincounter1<=counter1+1;clk

3、500<=clk500;endendmodule计数modulejishu24(clkdiv,clear,second,s_carry,minute,m_carry,hour,sL,sH,mL,mH,hL,hH);inputclkdiv,clear;output[5:0]second,minute;output[4:0]hour;outputs_carry,m_carry;outputsL,sH,mL,mH,hL,hH;regs_carry,m_carry;reg[5:0]second,minute;reg[4:

4、0]hour;regsL,sH,mL,mH,hL,hH;always@(posedgeclkdivorclear)if(clear)second<=0;elseif(second!=6'b111011)beginsecond<=second+1;s_carry<=0;endelsebeginsecond<=0;s_carry<=1;endalways@(posedges_carryorclear)if(clear)minute<=0;elseif(minute!=6'b111011)beginminute<=mi

5、nute+1;m_carry<=0;endelsebeginminute<=0;m_carry<=1;endalways@(posedgem_carryorclear)if(clear)hour<=0;elseif(hour!=5'b10111)beginhour<=hour+1;endelsebeginhour<=0;endalways@(posedgesecond)beginsL<=second%10;sH<=second/10;endalways@(posedgeminute)beginmL<=minute

6、%10;mH<=minute/10;endalways@(posedgehour)beginhL<=hour%10;hH<=hour/10;endendmodule显示moduledecode(clk500,reset,hH,hL,mH,mL,sH,sL,HIGH,LOW,COM);inputclk500;inputreset;inputhH,hL;//?????????inputmH,mL;//?????????inputsH,sL;//????????output[6:0]HIGH,LOW;//???????

7、???????output[7:0]COM;//??????????reg[7:0]show_temp_H,show_temp_L;//???????????????????reg[7:0]COM;reg[7:0]Uweixuan;//????COM????????????????reg[2:0]sm;//????reg[6:0]HIGH;//?????????????reg[6:0]LOW;//?????????????always@(posedgeclk500)beginif(sm==3'b111)sm<=3

8、'b000;elsesm<=sm+3'b001;Uweixuan<=Uweixuan<<1;//????????????????????????if(Uweixuan==8'b0000_0000)Uweixuan<=8'b0000_0001;//?Uweixuan???????COM=~Uweixuan;//?????????????????????Uweixuan???

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。