基于fpga的数字秒表.ppt

基于fpga的数字秒表.ppt

ID:56800393

大小:110.00 KB

页数:13页

时间:2020-06-28

上传者:U-5649
基于fpga的数字秒表.ppt_第1页
基于fpga的数字秒表.ppt_第2页
基于fpga的数字秒表.ppt_第3页
基于fpga的数字秒表.ppt_第4页
基于fpga的数字秒表.ppt_第5页
资源描述:

《基于fpga的数字秒表.ppt》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

数字秒表设计 数字秒表clkkclrrendataout(23..0)数字秒表的设计包括十进制计数器和六进制计数器,然后通过例化组合来得到数字秒表系统,这里首先要得到100Hz的时钟信号秒表计时的最大范围为1小时,精度为0.01秒,秒表可得到计时时间的分、秒、0.1秒、0.01秒等度量,并且各度量可正确进位 十进制计数器clkclrendout(3..0)六进制计数器dout(3..0)clkclren 计数单位及对应输出信号 libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitycntshiisport(clk,clr,ena:instd_logic;dout:outstd_logic_vector(3downto0);co:outstd_logic);endcntshi;architectureartofcntshiissignaltmp:std_logic_vector(3downto0);beginprocess(clk,clr,tmp)beginifclr='1'thentmp<="0000";co<='0';elsifclk'eventandclk='1'thenifena='1'then十进制计数器源程序--时钟、复位、计数使能信号--计数输出信号--进位输出信号--定义计数器--复位信号有效--时钟上升沿--计数使能信号 iftmp="1001"thentmp<="0000";co<='1';elsetmp<=tmp+'1';endif;endif;endif;dout<=tmp;endprocess;endart;六进制计数器libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitycntliuis--计数器加1--输出计数器的值--计数器满 port(clk,clr,ena:instd_logic;dout:outstd_logic_vector(3downto0);co:outstd_logic);endcntliu;architectureartofcntliuissignalcnt:std_logic_vector(3downto0);beginprocess(clk,clr,cnt)beginifclr='1'thencnt<="0000";co<='0';elsifrising_edge(clk)thenifena='1'thenifcnt="0101"thencnt<="0000";co<='1';elsecnt<=cnt+'1';--复位信号有效--时钟上升沿--允许计数--计数器满--计数器加1--时钟、复位、计数使能信号--定义计数器 endif;endif;endif;dout<=cnt;endprocess;endart;数字秒表顶层模块libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitymiaobiaoisport(clkk:instd_logic;clrr,en:instd_logic;dataout:outstd_logic_vector(23downto0));endmiaobiao;architecturewofmiaobiaois--定义时钟信号,周期为0.01秒--定义复位、计数使能信号--输出计时结果 componentcntliuisport(clk,clr,ena:instd_logic;q:outstd_logic_vector(3downto0);co:outstd_logic);endcomponentcntliu;componentcntshiisport(endart;clk,clr,ena:instd_logic;q:outstd_logic_vector(3downto0);co:outstd_logic);endcomponentcntshi;signalco1,co2,co3,co4,co5:std_logic;begin--定义六进制计数器元件--定义十进制计数器元件--定义计数器元件进位输出信号 u1:cntshiportmap(clkk,clrr,en,dataout(3downto0),co1);u2:cntshiportmap(co1,clrr,en,dataout(7downto4),co2);u3:cntshiportmap(co2,clrr,en,dataout(11downto8),co3);u4:cntliuportmap(co3,clrr,en,dataout(15downto12),co4);u5:cntshiportmap(co4,clrr,en,dataout(19downto16),co5);u6:cntliuportmap(co5,clrr,en,dataout(23downto20));endw;--元件例化语句,通过计数器级联实现数字秒表波形仿真十进制计数器仿真波形 六进制计数器仿真波形秒表仿真波形

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

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

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