欢迎来到天天文库
浏览记录
ID:50775120
大小:637.50 KB
页数:62页
时间:2020-03-08
《EDA技术及应用教程 教学课件 作者 赵全利EDA 实例源程序代码.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、第4章用VHDL程序实现常用逻辑电路4.1组合逻辑电路设计4.1.1基本逻辑门libraryieee;useiee.std_logic_1164.all;entityjbmisport(a,b:inbit;f1,f2,f3,f4,f5,f:outbit);endjbm;architectureaofjbmisbeginf1<=aandb;--构成与门f2<=aorb;--构成或门f<=nota;--构成非门f3<=anandb;--构成与非门f4<=anorb;--构成异或门f5<=not(axorb);--构成异或非门即同门end;4
2、.1.2三态门libraryieee;useieee.std_logic_1164.all;entitytri_sisport(enable:instd_logic;datain:instd_logic_vector(7downto0);dataout:outstd_logic_vector(7downto0));endtri_s;architecturebhvoftri_sisbeginprocess(enable,datain)beginifenable='1'thendataout<=datain;elsedataout<="ZZ
3、ZZZZZZ";endif;endprocess;endbhv;4.1.33-8译码器libraryieee;useieee.std_logic_1164.all;entitydecoder3_8isport(a,b,c,g1,g2a,g2b:instd_logic;y:outstd_logic_vector(7downto0));enddecoder3_8;architectureaofdecoder3_8issignaldz:std_logic_vector(2downto0);begindz<=c&b&a;process(dz,g
4、1,g2a,g2b)beginif(g1='1'andg2a='0'andg2b='0')thencasedziswhen"000"=>y<="11111110";when"001"=>y<="11111101";when"010"=>y<="11111011";when"011"=>y<="11110111";when"100"=>y<="11101111";when"101"=>y<="11011111";when"110"=>y<="10111111";when"111"=>y<="01111111";whenothers=>y<
5、="XXXXXXXX";endcase;elsey<="11111111";endif;endprocess;4.1.4优先编码器libraryieee;useieee.std_logic_1164.allentitycoderisport(din:instd_logic_vector(0to7);output:outstd_logic_vector(0to2));endcoder;architecturebehaveofcoderissignalsint:std_logic_vevtor(4downto0);beginprocess(
6、din)beginif(din(7)='0')thenoutput<="000";elsif(din(6)='0')thenoutput<="100";elsif(din(5)='0')thenoutput<="010";elsif(din(4)='0')thenoutput<="110";elsif(din(3)='0')thenoutput<="001";elsif(din(2)='0')thenoutput<="101";elsif(din(1)='0')thenoutput<="011";elseoutput<="111";en
7、dif;endprocess;endbehav;4.1.57段码译码器libraryieee;useieee.std_logic_1164.allentitydecl7sisport(a:instd_logic_vector(3downto0);led7s:outstd_logic_vector(6downto0));enddecl7s;architecturebehaveofdecl7sisbeginprocess(a)begincaseaiswhen"0000"=>led7s<="0111111";when"0001"=>led7s
8、<="0000110";when"0010"=>led7s<="1011011";when"0011"=>led7s<="1001111";when"0100"=>led7s<="1100110";when
此文档下载收益归作者所有