Jednoduch obvody ve VHDL.ppt
《Jednoduch obvody ve VHDL.ppt》由会员分享,可在线阅读,更多相关《Jednoduch obvody ve VHDL.ppt(35页珍藏版)》请在麦多课文档分享上搜索。
1、Jednoduch obvody ve VHDL,Pevzato z materil kurzu INP 2003,INP,2,Pklad: Multiplexor (mpx8) popis chovn,mpx8,y,s(1),s(0),s(2),din,0,7,P.: Kdy s=1 potom y=din(1),INP,3,library IEEE; use IEEE.std_logic_1164.all;entity mpx8 isport (din: in STD_LOGIC_VECTOR (7 downto 0); s: in STD_LOGIC_VECTOR (2 downto 0
2、); y: out STD_LOGIC); end mpx8;architecture mpx8 of mpx8 is begin process (s, din) variable ss: STD_LOGIC_VECTOR (2 downto 0); - pomocn promnn begin ss(0) := s(0); ss(1) := s(1); ss(2) := s(2);case ss is when “000“ = y y y y y y y y y = X; end case; end process; end mpx8;,rozhran,chovn,knihovny,INP,
3、4,Test bench pro mpx8 (automatick test komponenty),mpx8,y,s1,s0,s2,din,0,7,Genertor testu,INP,5,entity tb_mpx8 is - nem rozhran end tb_mpx8;architecture arch_tb_mpx8 of tb_mpx8 is signal din: STD_LOGIC_VECTOR (7 downto 0); - potebn signly signal s: STD_LOGIC_VECTOR (2 downto 0); signal y: STD_LOGIC;
4、 component mpx8 - testovan jednotkaport (din: in STD_LOGIC_VECTOR (7 downto 0); s: in STD_LOGIC_VECTOR (2 downto 0); y: out STD_LOGIC );end component;begin UUT : mpx8 port map (din = din, s = s, y = y); - pipojen process begin - vlastn test din = “01010101“; s = “000“; wait for 10 ns; s = “001“; wai
5、t for 10 ns; s = “010“; wait for 10 ns; s = “011“; wait for 10 ns; s = “100“; wait for 10 ns; s = “101“; wait for 10 ns; s = “110“; wait for 10 ns; s = “111“; wait for 10 ns; end process; end arch_tb_mpx8;,INP,6,Mpx8 strukturln (mpx8s.vhd),&,&,&,&,&,&,&,&,1,y,Potebujeme: 8 x 4vst. AND 1 x 8vst. OR 3
6、 x invertor ns(j) = not s(j),a0out,a3out,a4out,a5out,a6out,a7out,a1out,a2out,INP,7,And4.vhd,library IEEE; use IEEE.std_logic_1164.all;entity and4 isport (a1: in std_logic;a2: in std_logic;a3: in std_logic;a4: in std_logic;b: out STD_LOGIC ); end and4;architecture and4 of and4 is beginb = a1 and a2 a
7、nd a3 and a4; end and4;,INP,8,mpx8s.vhd,Vyzkouejte si mpx8s.vhd v ModelSimu msto mpx8.vhd. Jako test bench pouijte tb_mpx.vhd.,INP,9,Struktura VHDL kdu,library IEEE; entity name isport (); end name;architecture struc of name is signal ns0 : std_logic;component and4 port (); end component;begin ns2 =
8、 not s(2);aa0: and4 port map ();P0: process (a,b) begin end process;P1: process begin end process; end struc;,knihovny,definice rozhran,popis innosti komponenty,Deklarace signl pro propojovn komponent a komunikaci proces.,Deklarace komponent.,Zde jsou jen paraleln pkazy“!,mapovn komponenty na signly
9、,Uvnit procesu lze ut sekvenn pkazy a pouvat promnn.,INP,10,library IEEE; use IEEE.std_logic_1164.all;entity dec3to8 isport (addr: in STD_LOGIC_VECTOR (2 downto 0);y: out STD_LOGIC_VECTOR (7 downto 0); end dec3to8;architecture dec3to8 of dec3to8 is beginwith addr selecty = “10000000“ when “111“,“010
10、00000“ when “110“,“00100000“ when “101“,“00010000“ when “100“,“00001000“ when “011“,“00000100“ when “010“,“00000010“ when “001“,“00000001“ when others; end dec3to8;,Dekodr,INP,11,- HEX: in STD_LOGIC_VECTOR (3 downto 0); - LED: out STD_LOGIC_VECTOR (6 downto 0); - 0 - - - 5 | | 1 - - - 6 - 4 | | 2 -
11、- - 3with HEX selectLED= “1111001“ when “0001“, -1“0100100“ when “0010“, -2“0110000“ when “0011“, -3“0011001“ when “0100“, -4“0010010“ when “0101“, -5“0000010“ when “0110“, -6“1111000“ when “0111“, -7“0000000“ when “1000“, -8“0010000“ when “1001“, -9“0001000“ when “1010“, -A“0000011“ when “1011“, -b
12、“1000110“ when “1100“, -C“0100001“ when “1101“, -d“0000110“ when “1110“, -E“0001110“ when “1111“, -F“1000000“ when others; -0,Dekodr pro 7-segmentovku,INP,12,Klopn obvod typu D,library IEEE; use IEEE.std_logic_1164.all;entity dffx isport ( CLK : in std_logic;RSTn : in std_logic;DATA : in std_logic;Q
13、OUT : out std_logic ); end dffx;architecture behavr1 of dffx is begin process (CLK,RSTn) beginif (RSTn=0) then - asynchronni resetQOUT = 0;elsif (CLKevent and CLK = 1) thenQOUT = DATA; end if; end process; end behavr1;,Asynchronn reset, aktivn pi 0,D,CLK,QOUT,Q,RSTn,DATA,INP,13,Asynchronn reset u KO
14、 typu D,process (CLK, RESET) beginif RESET=1 then -asynchronous RESET active HighDOUT = 0;elsif (CLKevent and CLK=1) then -CLK rising edgeDOUT = DIN;end if; end process;,CLK,RESET,DOUT,DIN=1,D,CLK,Q,Q,RESET,DIN,DOUT,INP,14,Synchronn reset u KO typu D,process (CLK) begin if CLKevent and CLK=1 then -C
15、LK rising edgeif RESET=1 then -synchronous RESET active HighDOUT = 0;elseDOUT = DIN;end if; end if; end process;,CLK,RESET,DOUT,DIN=1,INP,15,Klopn obvod JK,entity JKFF isport (CLK, RSTn, J, K : in bit;Q : out bit); end JKFF; - architecture RTL of JKFF issignal FF : bit; beginprocess (CLK, RSTn)varia
16、ble JK : bit_vector(1 downto 0);beginif (RSTn = 0) thenFF FF FF FF FF = FF;end case;end if; end process;Q = FF; end RTL;,INP,16,Registr s asynchronnm nulovnm,- 4-bit parallel load register with asynchronous reset - CLK: in STD_LOGIC; - ASYNC: in STD_LOGIC; - LOAD: in STD_LOGIC; - DIN: in STD_LOGIC_V
17、ECTOR(3 downto 0); - DOUT: out STD_LOGIC_VECTOR(3 downto 0);process (CLK, ASYNC) beginif ASYNC=1 thenDOUT = “0000“;elsif CLK=1 and CLKevent thenif LOAD=1 thenDOUT = DIN;end if;end if; end process;,INP,17,Posuvn registr,- 4-bit serial-in and serial-out shift register - CLK: in STD_LOGIC; - DIN: in ST
18、D_LOGIC; - DOUT: out STD_LOGIC;process (CLK)variable REG: STD_LOGIC_VECTOR(3 downto 0); beginif CLKevent and CLK=1 then REG := DIN ,INP,18,clk,1,Posuvn registr a vnon stromeek,INP,19,Cvien,Popite a simulujte pomoc VHDL obvod pro zen vnonho stromeku.,INP,20,Cyklick ta 0-7 (toto rozhran je stejn pro s
- 1.请仔细阅读文档,确保文档完整性,对于不预览、不比对内容而直接下载带来的问题本站不予受理。
- 2.下载的文档,不会出现我们的网址水印。
- 3、该文档所得收入(下载+内容+预览)归上传者、原创作者;如果您是本文档原作者,请点此认领!既往收益都归您。
下载文档到电脑,查找使用更方便
2000 积分 0人已下载
下载 | 加入VIP,交流精品资源 |
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- JEDNODUCHOBVODYVEVHDLPPT
