资源描述:
《EDA考试题目和答案.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、设计实验与考核1、设计一个带计数使能、异步复位、带进位输出的增1六位二进制计数器,计数结果由共阴极七段数码管显示。答:libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitycounterisport(clk,clk1,en,clr:instd_logic;ledout:outstd_logic_vector(6downto0);scanout,scanout1,co:outstd_logic);endcounter;architectureaofcounterissi
2、gnalcnt:std_logic_vector(7downto0);signalled:std_logic_vector(6downto0);signalscan:std_logic;signalhex:std_logic_vector(3downto0);beginprocess(clk)beginif(clk'eventandclk='1')thenifen='1'thenifclr='1'thencnt<=(others=>'0');elseifcnt=""thencnt<="";co<='1';elsecnt<=cnt+'1';co<='0';endif
3、;endif;endif;endif;endprocess;process(clk1)beginifclk1'eventandclk1='1'thenscan<=notscan;endif;Scanout=scan;Scanout1=notscan;endprocess;ledout<=notled;hex<=cnt(7downto4)whenscan='1'elsecnt(3downto0);withhexselectled<=""when"0001",""when"0010",""when"0011",""when"0100",""when"0101",""w
4、hen"0110",""when"0111",""when"1000",""when"1001",""when"1010",""when"1011",""when"1100",""when"1101",""when"1110",""when"1111",""whenothers;enda;1、设计一个带计数使能、同步复位、带进位输出的增1二十进制计数器,计数结果由共阴极七段数码管显示。答:libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitycounterisport
5、(clk,clk1,en,clr:instd_logic;co,scanout:outstd_logic;ledout:outstd_logic_vector(6downto0));endcounter;architecturertlofcounterissignalcnt:std_logic_vector(7downto0);signalled:std_logic_vector(6downto0);signalscan:std_logic;signalhex:std_logic_vector(3downto0);beginprocess(clk,clr)begi
6、nifclr='1'thencnt<=(others=>'0');elsifclk'eventandclk='1'thenifen='1'thenifcnt=""thencnt<="";co<='0';elsifcnt=""then--注意此处,前面跳过了A到F的计数,所以计数到11001cnt<="";co<='1';elsecnt<=cnt+'1';co<='0';endif;endif;endif;endprocess;process(clk1)beginifclk1'eventandclk1='1'thenscan<=notscan;endif;endpr
7、ocess;ledout<=notled;scanout<=scan;hex<=cnt(7downto4)whenscan='1'elsecnt(3downto0);withhexselectled<=""when"0001",""when"0010",""when"0011",""when"0100",""when"0101",""when"0110",""when"0111",""when"1000",""when"1001",""when"0000",""whenothers;endrtl;1、设计一个带计数使能、异步复位、同步装载的可逆七位二进制计数器,计
8、数结果由共