(PLD可编程逻辑器件]d应用程序举例.pdf
《(PLD可编程逻辑器件]d应用程序举例.pdf》由会员分享,可在线阅读,更多相关《(PLD可编程逻辑器件]d应用程序举例.pdf(54页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、(PLDPLD 可编程逻辑器件)可编程逻辑器件)d d应用程序举例应用程序举例PLD 段码显示library ieee;library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_1164.all;entity duanma isentity duanma isport(fff:out bit_vector(1 to 5);port(fff:out bit_vector(1 to 5);aaa:out bit_vector(1 to 5);aaa:out bit_vector(1 to 5);end;end;architecture
2、kk of duanma isarchitecture kk of duanma isbeginbeginfff(1 to 5)=11111;fff(1 to 5)=11111;aaa(1 to 5)=11111;aaa(1 to 5)=11111;end;end;PLDPLD 三个数加法编程三个数加法编程library ieee;library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_1164.all;entity jw isentity jw isport(in1,in2:in integer range 0 to 15;po
3、rt(in1,in2:in integer range 0 to 15;a,b:out std_logic_vector(1 to 7);a,b:out std_logic_vector(1 to 7);end;end;architecture gg of jw isarchitecture gg of jw issignal he:integer range 0 to 45;signal he:integer range 0 to 45;beginbeginhe=in1+in2;he=in1+in2;with he selectwith he selecta=1111110 when 0|1
4、0|20|30|40,a=1111110 when 0|10|20|30|40,0110000 when 1|11|21|31|41,0110000 when 1|11|21|31|41,1101101 when 2|12|22|32|42,1101101 when 2|12|22|32|42,1111001 when 3|13|23|33|43,1111001 when 3|13|23|33|43,0110011 when 4|14|24|34|44,0110011 when 4|14|24|34|44,1011011 when 5|15|25|35|45,1011011 when 5|15
5、|25|35|45,1011111 when 6|16|26|36,1011111 when 6|16|26|36,1110000 when 7|17|27|37,1110000 when 7|17|27|37,1111111 when 8|18|28|38,1111111 when 8|18|28|38,1111011 when 9|19|29|39,1111011 when 9|19|29|39,0000000 when others;0000000 when others;with he selectwith he selectb=0000000 when 0=he andb=00000
6、00 when 0=he andhe=9,elsehe=9,else0110000 when 10=he and0110000 when 10=he andhe=19,elsehe=19,else1101101 when 20=he and1101101 when 20=he andhe=29,elsehe=29,else1111001 when 30=he and1111001 when 30=he andhe=39,elsehe=39,else0110011 when 40=he and0110011 when 40=he andhe=39,elsehe=39,else0000000 wh
7、en others;0000000 when others;end;end;PLDPLD 八个按键两个灯八个按键两个灯library ieee;library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_1164.all;entity guozi3 isentity guozi3 isport(in1,in2:in std_logic_vector(1 toport(in1,in2:in std_logic_vector(1 to4);4);a,b:out std_logic_vector(1 to 8);a,b:out std_lo
8、gic_vector(1 to 8);end;end;architecture gg of guozi3 isarchitecture gg of guozi3 isbeginbeginwith in1 selectwith in1 select0110000 when 0001,0110000 when 0001,1101101 when 0010,1101101 when 0010,1111001 when 0011,1111001 when 0011,0110011 when 0100,0110011 when 0100,1011011 when 0101,1011011 when 01
9、01,1011111 when 0110,1011111 when 0110,1110000 when 0111,1110000 when 0111,1111111 when 1000,1111111 when 1000,1111011 when 1001,1111011 when 1001,0000000 when others;0000000 when others;with in2 selectwith in2 selectb=0110000when 0001,b=0110000when 0001,1101101 when 0010,1101101 when 0010,1111001 w
10、hen 0011,1111001 when 0011,0110011 when 0100,0110011 when 0100,1011011 when 0101,1011011 when 0101,1011111 when 0110,1011111 when 0110,1110000 when 0111,1110000 when 0111,1111111 when 1000,1111111 when 1000,1111011 when 1001,1111011 when 1001,0000000 when others;0000000 when others;end;end;PLDPLD 顺序
11、语句编程顺序语句编程(0(0 加到加到 9)9)library ieee;library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_1164.all;entity jinchen isentity jinchen isport(in1:in std_logic;port(in1:in std_logic;a:out std_logic_vector(1 to 7);a:out std_logic_vector(1 to 7);end;end;architecture gg of jinchen isarchitecture gg o
12、f jinchen issignal ss:integer range 0 to 9;signal ss:integer range 0 to 9;beginbeginprocessprocessbeginbeginwait until in1=1;wait until in1=1;ss=ss+1;ss=ss+1;if ss=10 thenif ss=10 thenss=0;ss=0;end if;end if;end process;end process;with ss selectwith ss selecta=1111110 when 0,a=1111110 when 0,011000
13、0 when 1,0110000 when 1,1101101 when 2,1101101 when 2,1111001 when 3,1111001 when 3,0110011 when 4,0110011 when 4,1011011 when 5,1011011 when 5,1011111 when 6,1011111 when 6,1110000 when 7,1110000 when 7,1111111 when 8,1111111 when 8,1111011 when 9,1111011 when 9,0000000 when others;0000000 when oth
14、ers;end;end;PLDPLD 矢量矢量 1010 个控制个控制 2 2 个数码管个数码管library ieee;library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_1164.all;entity kongzhi2 isentity kongzhi2 isport(a:out bit_vector(1 to 7);port(a:out bit_vector(1 to 7);b:in b:inbit_vector(1 to 10);bit_vector(1 to 10);end;end;architecture ff o
15、f kongzhi2 isarchitecture ff of kongzhi2 isbeginbegin a=1111110 a=1111110when b=1000000000elsewhen b=1000000000else01100000110000whenwhenb=0100000000elseb=0100000000else11011011101101when b=0010000000elsewhen b=0010000000else11110011111001when b=1001000000elsewhen b=1001000000else01100110110011when
16、b=1000100000elsewhen b=1000100000else10110111011011when b=1000010000elsewhen b=1000010000else10111111011111when b=1000001000elsewhen b=1000001000else11100001110000when b=1000000100elsewhen b=1000000100else11111111111111when b=1000000010elsewhen b=1000000010else11100111110011when b=1000000001elsewhen
17、 b=1000000001else0000000;0000000;end;end;PLDPLD 晶振晶振 50M50M 控制数码管控制数码管library ieee;library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_1164.all;entity jinzheng isentity jinzheng isport(in50m:in std_logic;port(in50m:in std_logic;a:out std_logic_vector(1 to 7);a:out std_logic_vector(1 to 7);en
18、d;end;architecture gg of jinzheng isarchitecture gg of jinzheng issignal in1:std_logic;signal in1:std_logic;signal ss:integer range 0 to 9;signal ss:integer range 0 to 9;signal count:integer range 0 tosignal count:integer range 0 to25000000;25000000;beginbeginprocessprocessbeginbeginwait until in50m
19、=1;wait until in50m=1;count=count+1;count=count+1;if count=25000000 thenif count=25000000 thencount=0;count=0;in1=not in1;in1=not in1;end if;end if;end process;end process;processprocessbeginbeginwait until in1=1;wait until in1=1;ss=ss+1;ss=ss+1;if ss=10 thenif ss=10 thenss=0;ss=0;end if;end if;end
20、process;end process;with ss selectwith ss selecta=1111110 when 0,a=1111110 when 0,0110000 when 1,0110000 when 1,1101101 when 2,1101101 when 2,1111001 when 3,1111001 when 3,0110011 when 4,0110011 when 4,1011011 when 5,1011011 when 5,1011111 when 6,1011111 when 6,1110000 when 7,1110000 when 7,1111111
21、when 8,1111111 when 8,1111011 when 9,1111011 when 9,0000000 when others;0000000 when others;end;end;PLDPLD 晶振晶振 50M50M 自动跳变程序(自动跳变程序(0 0 到到 5959)library ieee;library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_1164.all;entity jiadxx isentity jiadxx isport(in50m:in std_logic;port(in50m:in std
22、_logic;a,b:out std_logic_vector(1 to 7);a,b:out std_logic_vector(1 to 7);end;end;architecture gg of jiadxx isarchitecture gg of jiadxx issignal in1:std_logic;signal in1:std_logic;signal t,g:integer range 0 to 9;signal t,g:integer range 0 to 9;signal count:integer range 0 to 59signal count:integer ra
23、nge 0 to 5925000000;25000000;beginbeginprocessprocessbeginbeginwait until in50m=1;wait until in50m=1;count=count+1;count=count+1;if count=25000000 thenif count=25000000 thencount=0;count=0;in1=not in1;in1=not in1;end if;end if;end process;end process;processprocessbeginbeginwait until in1=1;wait unt
24、il in1=1;g=g+1;g=g+1;if g=9 thenif g=9 thenif g=5 thenif g=5 theng=0;g=0;t=t+1;t=t+1;if t=5 thenif t=5 thent=0;t=0;end if;end if;end if;end if;end process;end process;with g selectwith g selecta=1111110 when 0,a=1111110 when 0,0110000 when 1,0110000 when 1,改变变量改变变量1101101 when 2,1101101 when 2,11110
25、01 when 3,1111001 when 3,0110011 when 4,0110011 when 4,1011011 when 5,1011011 when 5,1011111 when 6,1011111 when 6,1110000 when 7,1110000 when 7,1111111 when 8,1111111 when 8,1111011 when 9,1111011 when 9,0000000 when others;0000000 when others;with t selectwith t selectb=1111110 when 0,b=1111110 wh
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- PLD 可编程 逻辑 器件 应用程序 举例
限制150内