计数器的VHDL设计.doc

计数器的VHDL设计.doc

ID:59599737

大小:135.50 KB

页数:9页

时间:2020-11-14

计数器的VHDL设计.doc_第1页
计数器的VHDL设计.doc_第2页
计数器的VHDL设计.doc_第3页
计数器的VHDL设计.doc_第4页
计数器的VHDL设计.doc_第5页
资源描述:

《计数器的VHDL设计.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、实验名称:计数器的VHDL设计一、带高电平使能信号,低电平清零信号,低电平置数信号的十进制计数器的VHDL设计1.实体框图2.程序设计①编译前的程序Libraryieee;Useieee.std_logic_1164.all;Useieee.std_logic_unsigned.all;Entitycnt10isPort(clk,RST,SET,EN:instd_logic;CQ:outstd_logic_vector(3downto0);Cout:outstd_logic);Endcnt10;Arc

2、hitectureoneofcnt10isBeginProcess(clk,RST,SET,EN)VariableCQ1:std_logic_vector(3downto0);BeginifRST='0'ThenCQ1:=(others=>'0');elsifclk'eventandclk='1'thenifSET='0'ThenCQ1:=(others=>'1');elsifEN='1'ThenifCQ1<9ThenCQ1:=CQ1+1;elseCQ1:=(others=>'0');endif;en

3、dif;endif;ifCQ1=9Thencout<='1';elsecout<='0';endif;CQ<=CQ1;Endprocess;Endone;②程序编译错误情况错误:Error(10500):VHDLsyntaxerrorat/cnt10.vhd(12)neartext"?;expecting":",or","标点符号格式输入不对引起的,切换到英文输入模式重新输入即可③正确的程序Libraryieee;Useieee.std_logic_1164.all;Useieee.std_logic

4、_unsigned.all;Entitycnt10isPort(clk,RST,SET,EN:instd_logic;CQ:outstd_logic_vector(3downto0);Cout:outstd_logic);Endcnt10;Architectureoneofcnt10isBeginProcess(clk,RST,SET,EN)VariableCQ1:std_logic_vector(3downto0);BeginifRST='0'ThenCQ1:=(others=>'0');elsif

5、clk'eventandclk='1'thenifSET='0'ThenCQ1:=(others=>'1');elsifEN='1'ThenifCQ1<9ThenCQ1:=CQ1+1;elseCQ1:=(others=>'0');endif;endif;endif;ifCQ1=9Thencout<='1';elsecout<='0';endif;CQ<=CQ1;Endprocess;Endone;3.仿真波形图4.仿真波形分析当低电平清零信号有效时,计数器清零;当低电平置数信号有效时,计数器置数使能信

6、号为高电平且脉冲上升沿有效时,计数器开始计数(从0到9)为十进制计数一、64进制的二进制计数器的VHDL设计1.实体框图2.程序设计①编译前的程序Libraryieee;Useieee.std_logic_1164.all;Useieee.std_logic_unsigned.all;Entitycnt64isPort(clk:instd_logic;D:instd_logic_vector(5downto0);Q:outstd_logic_vector(5downto0));Endcnt64;Arc

7、hitecturetwoofcnt64isSignalQ1:std_logic_vector(5downto0);BeginProcess(clk)Beginifclk'eventandclk='1'Thenif(Q1="")ThenQ1<="";elseQ1<=Q1+1;endif;Endprocess;Q<=Q1;Endtwo;②程序编译错误情况Error(10500):VHDLsyntaxerroratcnt64.vhd(18)neartext"process";expecting"if";Er

8、ror(10500):VHDLsyntaxerroratcnt64.vhd(20)neartext"two";expecting"if"经过检查,发现原程序少了ENDIF,加上即可;③正确的程序Libraryieee;Useieee.std_logic_1164.all;Useieee.std_logic_unsigned.all;Entitycnt64isPort(clk:instd_logic;D:instd_logic_vector(5downto

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

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

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