pld应用程序举例.doc





《pld应用程序举例.doc》由会员分享,可在线阅读,更多相关《pld应用程序举例.doc(36页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、pld应用程序举例PLD段码显示library ieee;use ieee.std_logic_1164.all;entity duanma isport(fff:out bit_vector(1 to 5);aaa:out bit_vector(1 to 5);end;architecture kk of duanma isbegin fff(1 to 5)=11111;aaa(1 to 5)=11111;end;PLD三个数加法编程library ieee;use ieee.std_logic_1164.all;entity jw isport(in1,in2:in integer ran
2、ge 0 to 15;a,b:out std_logic_vector(1 to 7);end;architecture gg of jw issignal he:integer range 0 to 45;beginhe=in1+in2;with he selecta=1111110 when 0|10|20|30|40, 0110000 when 1|11|21|31|41, 1101101 when 2|12|22|32|42, 1111001 when 3|13|23|33|43, 0110011 when 4|14|24|34|44, 1011011 when 5|15|25|35|
3、45, 1011111 when 6|16|26|36, 1110000 when 7|17|27|37, 1111111 when 8|18|28|38, 1111011 when 9|19|29|39, 0000000 when others;with he selectb=0000000 when 0=he and he=9,else 0110000 when 10=he and he=19,else 1101101 when 20=he and he=29,else 1111001 when 30=he and he=39,else 0110011 when 40=he and he=
4、39,else 0000000 when others;end;PLD八个按键两个灯library ieee;use ieee.std_logic_1164.all;entity guozi3 isport(in1,in2:in std_logic_vector(1 to 4);a,b:out std_logic_vector(1 to 8);end;architecture gg of guozi3 isbeginwith in1 select0110000 when 0001,1101101 when 0010,1111001 when 0011,0110011 when 0100,101
5、1011 when 0101,1011111 when 0110,1110000 when 0111,1111111 when 1000,1111011 when 1001,0000000 when others;with in2 selectb=0110000when 0001,1101101 when 0010,1111001 when 0011,0110011 when 0100,1011011 when 0101,1011111 when 0110,1110000 when 0111,1111111 when 1000,1111011 when 1001,0000000 when ot
6、hers;end;PLD顺序语句编程(0加到9)library ieee;use ieee.std_logic_1164.all;entity jinchen isport(in1:in std_logic;a:out std_logic_vector(1 to 7); end;architecture gg of jinchen issignal ss:integer range 0 to 9;beginprocess beginwait until in1=1;ss=ss+1;if ss=10 then ss=0;end if;end process;with ss selecta=111
7、1110 when 0, 0110000 when 1, 1101101 when 2, 1111001 when 3, 0110011 when 4, 1011011 when 5, 1011111 when 6, 1110000 when 7, 1111111 when 8, 1111011 when 9, 0000000 when others;end;PLD矢量 10个控制2个数码管library ieee;use ieee.std_logic_1164.all;entitykongzhi2 isport (a:out bit_vector(1 to 7);b:in bit_vecto
8、r(1 to 10);end;architecture ff of kongzhi2 isbegina=1111110 whenb=1000000000else 0110000 when b=0100000000else 1101101 whenb=0010000000else 1111001 whenb=1001000000else 0110011 whenb=1000100000else 1011011 whenb=1000010000else 1011111 whenb=1000001000else 1110000 whenb=1000000100else 1111111 whenb=1
9、000000010else 1110011 whenb=1000000001else 0000000;end;PLD晶振50M控制数码管library ieee;use ieee.std_logic_1164.all;entity jinzheng isport(in50m:in std_logic;a:out std_logic_vector(1 to 7); end;architecture gg of jinzheng issignal in1:std_logic; signal ss:integer range 0 to 9;signal count:integer range 0 t
10、o 25000000;beginprocess beginwait until in50m=1;count=count+1;if count=25000000 thencount=0;in1=not in1;end if;end process;processbeginwait until in1=1;ss=ss+1;if ss=10 then ss=0;end if;end process;with ss selecta=1111110 when 0, 0110000 when 1, 1101101 when 2, 1111001 when 3, 0110011 when 4, 101101
11、1 when 5, 1011111 when 6, 1110000 when 7, 1111111 when 8, 1111011 when 9, 0000000 when others;end;PLD晶振50M自动跳变程序(0到59)library ieee;use ieee.std_logic_1164.all;entity jiadxx isport(in50m:in std_logic;a,b:out std_logic_vector(1 to 7);end;architecture gg of jiadxx issignal in1:std_logic; signal t,g:int
12、eger range 0 to 9;signal count:integer range 0 to 59 25000000;beginprocess beginwait until in50m=1;count=count+1;if count=25000000 thencount=0;in1=not in1;end if;end process;processbeginwait until in1=1;g=g+1;if g=9 then if g=5 then 改变变量 g=0; t=t+1;if t=5 then t=0; end if; end if;end process;with g
13、selecta=1111110 when 0, 0110000 when 1, 1101101 when 2, 1111001 when 3, 0110011 when 4, 1011011 when 5, 1011111 when 6, 1110000 when 7, 1111111 when 8, 1111011 when 9, 0000000 when others;with t selectb=1111110 when 0, 0110000 when 1, 1101101 when 2, 1111001 when 3, 0110011 when 4, 1011011 when 5, 1
14、011111 when 6, 1110000 when 7, 1111111 when 8, 1111011 when 9, 0000000 when others; end;PLD(1-8数码管显示)第六个显示0library ieee;use ieee.std_logic_1164.all;entity jiadxx isport(a:out std_logic_vector(1 to 7); b:out std_logic_vector(1 to 3);end;architecture kk of jiadxx isbegina=1111110; -显示的数“0”b=010; -显示的位
15、“第6位”end;PLD动态间隔1秒闪烁library ieee;use ieee.std_logic_1164.all;entity jiadxx isport(in50m:in std_logic; b:out std_logic_vector(1 to 3); a:out std_logic_vector(1 to 7);end;architecture gg of jiadxx issignal count:integer range 0 to 25000000;signal count_one:integer range 0 to 1;signal one_hz:std_logic;
16、begin processbegin wait until in50m=1;count=count+1;if count=25000000 thencount=0;one_hz=not one_hz;end if; end process;processbeginwait until one_hz=1;count_one=count_one+1;if count_one=0 thenb=000;elseb=001;end if;end process;a=1111110; end;PLD动态显示0 1library ieee;use ieee.std_logic_1164.all;entity
17、 dz1121 isport(in50m:in std_logic; a:out std_logic_vector(1 to 7); b:out std_logic_vector(1 to 3);end;architecture gg of ningyi issignal in1:std_logic;signal count_c:integer range 0 to 3;signal count:integer range 0 to 2500;beginprocessbeginwait until in50m=1;count=count+1;if count=2500 thencount=0;
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- pld 应用程序 举例

限制150内