《eda课后作业》ppt课件

上传人:tian****1990 文档编号:74191029 上传时间:2019-01-27 格式:PPT 页数:31 大小:500.81KB
返回 下载 相关 举报
《eda课后作业》ppt课件_第1页
第1页 / 共31页
《eda课后作业》ppt课件_第2页
第2页 / 共31页
《eda课后作业》ppt课件_第3页
第3页 / 共31页
《eda课后作业》ppt课件_第4页
第4页 / 共31页
《eda课后作业》ppt课件_第5页
第5页 / 共31页
点击查看更多>>
资源描述

《《eda课后作业》ppt课件》由会员分享,可在线阅读,更多相关《《eda课后作业》ppt课件(31页珍藏版)》请在金锄头文库上搜索。

1、4-1画出与下例实体描述对应的原理图符号元件: ENTITY buf3s IS - 实体1: 三态缓冲器 PORT (input : IN STD_LOGIC ; - 输入端 enable : IN STD_LOGIC ; - 使能端 output : OUT STD_LOGIC ) ; - 输出端 END buf3x ; ENTITY mux21 IS -实体2: 2选1多路选择器 PORT (in0, in1, sel : IN STD_LOGIC; output : OUT STD_LOGIC);,4-2. 图4-17所示的是4选1多路选择器,试分别用IF_THEN语句和CASE语句的表

2、达方式写出此电路的VHDL程序。 选择控制的信号s1和s0的数据类型为STD_LOGIC_VECTOR; 当s1=0,s0=0;s1=0,s0=1;s1=1,s0=0和s1=1,s0=1分别执行y=a、y=b、y=c、y=d。,图4-17 4选1多路选择器,使用IFTHEN语句: Library ieee; use ieee.std_logic_1164.alll; Entity mux41 is Port(s0,s1,a,b,c,d:in std_logic; y:out std_logic); End mux41; Architecture one of mux41 is Signal s

3、10:std_logic_vector(1 downto 0); Begin s10=s1 ,使用CASE语句: Library ieee; use ieee.std_logic_1164.alll; Entity mux41 is Port(s0,s1,a,b,c,d:in std_logic; y:out std_logic); End mux41; Architecture one of mux41 is Signal s10:std_logic_vector(1 downto 0); Begin s10yyyy=a; end case; end process; End one;,KX

4、康芯科技,4-3. 图4-18所示的是双2选1多路选择器构成的电路MUXK,对于其中MUX21A,当s=0和1时,分别有y=a和y=b。试在一个结构体中用两个进程来表达此电路,每个进程中用CASE语句描述一个2选1多路选择器MUX21A。,图4-18 双2选1多路选择器,Library ieee; use ieee.std_logic_1164.alll; Entity muxk is Port(s0,s1,a1,a2,a3:in std_logic; outy:out std_logic); End muxk; Architecture one of muxk is Signal tmp:s

5、td_logic; Begin process(s0,a2,a3) begin case s0 is when 0=tmptmpoutyouty=tmp; end case; end process; End one;,Library ieee; use ieee.std_logic_1164.alll; Entity mux21 is port(s,a,b:in std_logic; y:out std_logic); End mux21; Architecture one of mux21 is Begin ya2,b=a3,s=s0,y=tmp); U2:mux21 port map(a

6、=a1,b=tmp,s=s1,y=outy); End beh;,4-4. 图4-19是一个含有上升沿触发的D触发器的时序电路,试写出此电路的VHDL设计文件。,图4-19 时序电路图,tmp,Library ieee; use ieee.std_logic_1164.alll; Entity exen is Port(cl,clk0:in std_logic; out1:out std_logic); End exen; Architecture one of exen is Signal tmp:std_logic; Begin process(clk0) begin if rising_

7、edge(clk0) then tmp=not(tmp or cl); end if; end process; Out1=not tmp; End one;,4-5. 给出1位全减器的VHDL描述。要求: (1) 首先设计1位半减器,然后用例化语句将它们连接起来,图4-20中h_suber是半减器,diff是输出差,s_out是借位输出,sub_in是借位输入。 (2) 以1位全减器为基本硬件,构成串行借位的8位减法器,要求用例化语句来完成此项设计(减法运算是 x y - sun_in = diffr)。,图4-19 时序电路图,t0,t1,t2,(1)先设计一个半减器 Library ie

8、ee; use ieee.std_logic_1164.alll; Entity h_suber is Port(x,y:in std_logic; diff,s_out:out std_logic); end h_suber; Architecture behav of h_suber is Begin process(x,y) begin diff=x xor y; s_out=(not x) and y; End process; End behav;,一位全减器的VHDL描述suber.vhd Library ieee; use ieee.std_logic_1164.alll; En

9、tity suber is Port(x,y,sub_in:in std_logic; diffr,sub_out:out std_logic); End suber; Architecture behav of suber is Component h_suber Port(x,y:in std_logic; diff,s_out:out std_logic); End component; Signal t0,t1,t2:std_logic; Begin u1:h_suber port map(x=x,y=y,diff=t0,s_out=t1); u2:h_suber port map(x

10、=t0,y=sub_in,diff=diffr,s_out=t2); Sub_out=t1 or t2; End behav;,(2)8位全减器(生成语句第九章) Library ieee; use ieee.std_logic_1164.alll; Entity suber8 is Port(a,b:in std_logic_vector(7 downto 0); Sin:in std_logic;sout:out std_logic; C:out std_logic_vector(7 doento 0); End sub8; Architecture behav of suber8 is

11、Component suber Port(x,y,sub_in:in std_logic; diffr,sub_out:out std_logic); End component; Signal stmp:std_logic_vector(8 downto 0); Begin stmp(0a(i),y=b(i),diffr=c(i),sub_out=stmp(i+1); End generate; end;,4-6. 根据图4-21,写出顶层文件MX3256.VHD的VHDL设计文件。,图4-21 题4-6电路图,t1,t2,t3,t4,Library ieee; use ieee.std_l

12、ogic_1164.alll; Entity mx3256 is Port(ina,inb,inck,inc:in std_logic; e,out1:out std_logic); End mx3256; Architecture behav of mx3256 is Component lk35 Port(a1,a2,clk:in std_logic; q1,q2:out std_logic); End component; Signal t1,t2,t3,t4:std_logic; Begin u1:lk35 port map(a1=ina,a2=inb,clk=inck,q1=t3,q

13、2=t2); U2: lk35 port map(a1=t2,a2=t1,clk=inck,q1=t4,q2=out1); Process(inck,inc) Begin if(inc=0)then t1=0; elsif(rising_edge(inck) then t1=t2; End if; end process; E=t4 when t2=0 else t3; end;,4-7. 设计含有异步清零和计数使能的16位二进制加减可控计数器。,Clr为异步清零端,en为计数使能端,sel控制加减 Library ieee; use ieee.std_logic_1164.alll; use

14、 ieee.std_logic_unsigned.alll; use ieee.std_logic_arith.alll; Entity ex16 is Port(clk,clr,en,sel:in std_logic; cnt:out std_logic_vector(15 downto 0); End ex16; Architecture behav of ex16 is Signal cnttmp: std_logic_vector(15 downto 0); Begin Process(clk,clr) Begin if clr=1 then cnttmp0); elsif(risin

15、g_edge(clk) then if en=1 then if sel=1 then cnttmp=cnttmp+1; else cnttmp=cnttmp-1; end if; End if; end if; end process; Cnt=cnttmp; end;,6-1. 什么是固有延时?什么是惯性延时? 6-2. 是什么?在VHDL中, 有什么用处? 6-3. 哪些情况下需要用到程序包STD_LOGIC_UNSIGNED?试举一例。 6-4. 说明信号和变量的功能特点,应用上的异同点。 6-5. 在VHDL设计中,给时序电路清0(复位)有两种方法,它们是什么? 6-6. 哪一种复位

16、方法必须将复位信号放在敏感信号表中?给出这两种电路的VHDL描述。 6-7. 什么是重载函数?重载算符有何用处?如何调用重载算符函数?,异步复位(清零): Process(clk,rst) Begin if rst=1 then cnt0); elsif rising_edge(clk) then cnt0); else cnt=cnt+1; End if; end if; End process;,6-8. 判断下面3个程序中是否有错误,若有则指出错误所在,并给出完整程序。,程序1: Signal A, EN : std_logic; Process (A, EN) Variable B : std_logic; Begin if EN = 1 then B = A; end if; end process;,程序2: Architecture one of sa

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 高等教育 > 大学课件

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号