资源预览内容
第1页 / 共10页
第2页 / 共10页
第3页 / 共10页
第4页 / 共10页
第5页 / 共10页
第6页 / 共10页
第7页 / 共10页
第8页 / 共10页
第9页 / 共10页
第10页 / 共10页
亲,该文档总共10页全部预览完了,如果喜欢就下载吧!
资源描述
数字电路EDA技术复习资料1. 用VHDL语言设计一个4输入同或门。library ieee;use ieee.std_logic_1164.all;entity yhm4 is port(x1,x2,x3,x4:in std_logic; y:out std_logic);end;architecture x of yhm4 isbegin y=x1 xnor x2 xnor x3 xnor x4;end;2. 在同一个VHDL文本中同时实现一个二输入的与门、或门、与非门、或非门、异或门及反相器的逻辑功能。library ieee;use ieee.std_logic_1164.all;entity ljm is port(a,b:in std_logic; yand,yor,ynot,ynor,ynand,yxor:out std_logic);end;architecture x of ljm isbegin yand=a and b; yor=a or b; ynot=not a; ynor=a nor b; ynand=a nand b; yxor= a xor b;end;3. 用VHDL设计一个实现三输入端的多数表决器。library ieee;use ieee.std_logic_1164.all;entity bjq3 is port(a,b,c:in std_logic; y:out std_logic);end;architecture x of bjq3 is signal ty:std_logic_vector(2 downto 0);begin ty=a&b&c; with ty select y=0 when 000, 0 when 001, 0 when 010, 1 when 011, 0 when 100, 1 when 101, 1 when 110, 1 when 111, X when others;end;4. 用并行信号赋值语句设计8选1数据选择器。library ieee;use ieee.std_logic_1164.all;entity xzq8 is port(x:in std_logic_vector(7 downto 0); sel:in std_logic_vector(2 downto 0); f:out std_logic);end;architecture a of xzq8 isbegin f=x(0) when sel=000 else x(1) when sel=001 else x(2) when sel=010 else x(3) when sel=011 else x(4) when sel=100 else x(5) when sel=101 else x(6) when sel=110 else x(7) when sel=111 else X;end;5. 分别用IF语句和CASE语句设计3-8译码器。1)IF语句2)CASE语句library ieee;use ieee.std_logic_1164.all;entity de38 is port(x:in std_logic_vector(2 downto 0); y:out std_logic_vector(7 downto 0);end;architecture a of de38 isbegin process(x) begin if x=000 then y=00000001; elsif x=001 then y=00000010; elsif x=010 then y=00000100; elsif x=011 then y=00001000; elsif x=100 then y=00010000; elsif x=101 then y=00100000; elsif x=110 then y=01000000; elsif x=111 then y=10000000; else yyyyyyyyyy=XXXXXXXX; end case; end process;end;6. 分别用IF语句和条件信号赋值语句实现8-3线优先编码器(输入、输出低电平有效)。1)IF语句2)条件信号赋值语句library ieee;use ieee.std_logic_1164.all;entity bmq is port(x:in std_logic_vector(7 downto 0); y:out std_logic_vector(2 downto 0);end;architecture a of bmq isbegin process(x) begin if x(7)=0 then y=000; elsif x(6)=0 then y=001; elsif x(5)=0 then y=010; elsif x(4)=0 then y=011; elsif x(3)=0 then y=100; elsif x(2)=0 then y=101; elsif x(1)=0 then y=110; elsif x(0)=0 then y=111; else y=XXX; end if; end process;end;library ieee;use ieee.std_logic_1164.all;entity bmq_2 is port(x:in std_logic_vector(7 downto 0); y:out std_logic_vector(2 downto 0);end;architecture a of bmq_2 isbegin y=000 when x(7)=0 else 001 when x(6)=0 else 010 when x(5)=0 else 011 when x(4)=0 else 100 when x(3)=0 else 101 when x(2)=0 else 110 when x(1)=0 else 111 when x(0)=0 else XXX;end;7. 用数据流描述方法,编写8位全加器的VHDL源代码。library ieee;use ieee.std_logic_1164.all;entity qjq8 is port(a,b:in std_logic_vector(8 downto 1); cin:in std_logic; s :out std_logic_vector(8 downto 1); c :buffer std_logic_vector(8 downto 0);end;architecture behave of qjq8 isbegin process(a,b,cin) begin c(0)=cin; for i in 1 to 8 loop s(i)=a(i) xor b(i) xor c(i-1); c(i)b then y=010; elsif a=b then y=100; else y=001; end if; end process;end;9. 设计一个8位偶校验电路(输出高电平有效)。library ieee;use ieee.std_logic_1164.all;entity oxy is port(a:in std_logic_vector(7 downto 0); y:out std_logic);end;architecture behave of oxy isbegin process(a) variab
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号