您的当前位置:首页正文

2016-EDA复习资料

来源:独旅网
1.FPGA中文名称是现场可编程门阵列,CPLD中文名称是复杂可编程逻辑器件。 2.VHDL的子程序有 函数 和 过程 两种。

3.VHDL的变量(VARIABLE)是一个局部变量 ,只能在进程和子程序中声明和使用。 4.VHDL的数据对象包括 信号 、 变量 和 常数 。 5.在VHDL的IEEE库中,预先定义的逻辑位数据STD_LOGIC有 9 个。

6.在用Quartus II进行设计电路时,用VHDL语言进行设计电路时,则文本文件后缀名为: VHD ,用于仿真的波形文件的后缀名为: VWF 。

7.以EDA方式实现的电路设计文件,最终可以编程下载到 CPLD或 FPGA芯片中,完成硬件设计与验证。

8. 实体 和 结构体 是VHDL程序的基本组成部分,它们可以构成最基本的的VHDL程序。

9.如果在VHDL程序中需要进行二个逻辑位矢量的加法运算,如果需要直接利用“+”进行运算,则必须调用IEEE库中的 std_logic_unsigned 包集合。

10.VHDL的端口声明语句中,端口方向包括 in 、 out、inout、 buffer 。 11.用VHDL语言设计数字电路,常用的描述方式有 数据流描述、行为级描述、结构化描述。

12.在VHDL的如果需要在二个进程中进行信息的通讯,则必须使用 信号 进行。 13.将硬件描述语言转化为硬件电路的重要工具软件称为 (HDL)结合器 。 14.VHDL的顺序语句只能出现在 进程 、 函数 和 过程 中,是按书写顺序一条一条执行的。

15 VHDL的Process(进程)内部的程序是按 顺序 执行方式执行的,但它本身却是按 并行 执行方式执行。

16. 用VHDL设计的电路,既可以被高层次的系统调用,成为系统的一部分,也可以作为一个电路的功能块 独立存在 和 独立运行 。

17.基于EPRom、EPRom和内存储器件的可编程器件,在系统断电后编程信息 [不会] 丢失。

18.采用SDRam结构的可编程器件,在系统断电后编程信息 [会] 丢失

2

1.在EDA工具中,能将硬件描述语言转化为硬件电路图的重要工具软件称为( )。 A.仿真器 B.综合器 C.适配器 D.下载器 2.Quartus II的文本设计文件类型是( )。 A.scf B.gdf C.vhd D.v

3.在VHDL中,用语句( )表示检测CLOCK的上升沿。

A.clock’event B.clock’event and clk=’1’ C.clock=’1’ D.clock’event and clock=’0’ 4.Quartus II是( )。

A.高级语言 B.硬件描述语言 C.EDA工具软件 D.综合软件

5.在VHDL的CASR语句中,条件句中“=>”不是操作符,它相当于( )的作用 A.IF B.THEN C.AND D.OR

6.在VHDL的IEEE库中,预先定义的逻辑位数据BIT有()种逻辑值。 A.2 B.3 C.8 D.9

7.基于硬件描述语言HDL的数字系统设计目前最常用的设计方法称为( )设计法。 A.自底向上 B.自顶向下 C.积木式 D.顶层.

8.在VHDL中,语句“FOR n IN 0 TO 8 LOOP”定义的循环次数为( )次。 A.2 B.7 C.8 D.9

8.在VHDL的并行语句之间,可以用( )来传送往来信息。 A.变量 B.变量和信号 C.信号 D.常量

10.在VHDL中,语句“FOR n IN 0 TO 7 LOOP”定义的循环次数为( )次。 A.2 B.7 C.8 D.9 11.VHDL常用的为是( )标准库

A.IEEE B. STD C.WORK D.PACKAGE 12.在VHDL中,为目标信号赋值符号是( )。 A. := B.=: C.= D.<= 13.在VHDL中,为目标变量赋值符号是( )。 A. := B.=: C.= D.<= 14.VHDL常用的库是( )标准库。

A.IEEE B. STD C.WORK D.PACKAGE 15.在下列标识符中,()是VHDL合法标识符。 A.4h_adde B.h_adde_ C.h_adder D._h_adde

16.在VHDL的IEEE库中,预先定义的逻辑位数据STD_LOGIC有()个。 A.2 B.3 C.8 D.9

17.在VHDL中,用语句()表示检测CLOCK的下降沿。

A.clock’event B.clock’event and clk=’1’ C.clock=’1’ D.clock’event and clock=’0’ 18.在VHDL语言中,( )的数据传输是立即发生的,不存在任何的延时行为。 A.信号 B.常量 C.数据 D.变量

19.VHDL的设计实体可以被高层次的系统 ,成为系统的—部分。 A.输入 B.输出 C.仿真 D.调用 20.在VHDL的端口声明语句中,( )声明端口为双向方向。 A.In B.Out C.InOut D.Buffer 21.在VHDL中,( )的数据传输是立即发生的,不存在任何延时的行为; A.信号 B.常量 C.数据 D.变量 22.在VHDL中,( )的数据转输不是立即发生的,目标信号的赋值是需要一定延时时间。 A.信号 B.常量 C.数据 D.变量

23.在VHDL中,For__Loop语句的循环变量是一个临时变量,属于Loop语句的局部变量,( )事先说明。

A.必须 B.不必 C.其类型要 D.其属性要

24.在VHDL个,含WAIT语句的进程PROCESS的括号中( )再加敏感信号,否则是非法的。

A.可以 B.不能 C.任意 D.只能

25.VHDL的块语句是并行语句结构,它的内部是由( )语句构成的。 A.并行和顺序 B.顺序 C.并行 D.任意

26.在VHDL巾,条件信号赋值语句WHEN—ELSE属于( )语句。 A.并行兼顺序 B.顺序 C.并行 D.不存在的

27.在元件例化语句(Component)中,用( )符号实现名称映射,将例化元件端口声明语句中的信号名与Port Map( )个的信号名关联起来。 A.= B.:= C.<= D.=>

28.在VHDL中,为了使已声明的数据类型、子程序、元件能被其他设计实体调用或共享,可以把它们汇集在( )里。

A.设计实体 B.程序体 C.结构体 D.程序包

29.使用Quartus II工具软件实现原理图设计输入,应采用 方式: A.图形编辑 B.文本编辑 C.符号编辑 D.波形编辑

30.执行Quartus II的 命令,可以对设计电路进行功能仿真或者时序仿真。 A.Start Software Build B.Start Simulator C.Statr Compilation D. Compilation Report 31.执行Quartus II的 命令,可以检查站设计电路的错误。 A.Start Software Build B.Start Simulator C.Statr Compilation D. Compilation Report 32.下列对进程的描述中,正确的是 。

A.在一个结构体中可以包含多个进程,进程和进程之间的执行都是顺序执行的; B.进程内部的语句是顺序执行;

C.进程说明语句定义该进程所需要的全局量; D.在进程中允许定义信号。 33.下面说法错误的是 。

A.调用函数时可以一次返回多个值;

B.在进程与结构体中不必定义函数首,仅在程序包中才定义函数首 ; C.过程返回值是在过程的参数表中,一次可以返回多个值;

D.过程体中的说明语句说明的量是一个局部量,仅在该过程中有效。

根据VHDL的实体说明语句画出与下列实体描述对应的原理图符号。 略

以下程序有何错处?试改正。

①ENTITY aa IS PORT(clk: IN BIT;

q: OUT BIT_VECTOR(3 DOWNTO 0);) END bb;

ARCHITECTURE a OF aa IS BEGIN

PROCESS(clk)

IF clk'event AND clk='1' THEN

q<=q+1; END IF;

END PROCESS; END a;

②SIGNAL invalue : INTEGER RANGE 0 TO 15; SIGNAL outvalue: STD_LOGIC;

„„„

„„„ CASE invalue IS

WHEN 0=>outvalue<=1; WHEN 1=>outvalue<=0; END CASE;

①ENTITY aa IS PORT(clk: IN BIT;

q: buffer BIT_VECTOR(3 DOWNTO 0)) ; END bb;

ARCHITECTURE a OF bb IS BEGIN

PROCESS(clk)

begin IF clk'event AND clk='1' THEN

q<=q+1; END IF;

END PROCESS; END a;

②SIGNAL invalue : INTEGER RANGE 0 TO 15; SIGNAL outvalue: STD_LOGIC;

„„„

„„„ CASE invalue IS

WHEN ‘0’=>outvalue<='1'; WHEN ‘1’=>outvalue<='0'; WHEN OTHERS=>NULL; END CASE;

分析下面的VHDL源程序,说明设计电路的功能,要求说出输入信号输出信号的含义。

LIBRARY IEEE;

USE IEEE.STD_LOGIC_1164.ALL;

USE IEEE.STD_LOGIC_UNSIGNED.ALL; ENTITY ly IS

PORT(a,b : IN STD_LOGIC_VECTOR(3 DOWNTO 0); gt,lt,eq: OUT STD_LOGIC); END ly;

ARCHITECTURE a OF ly IS BEGIN

process(a,b) begin

if a>b then gt<='1'; lt<='0'; eq<='0';

elsif aend process; end a;

电路功能:电路功能:是一个比较器,当A大于B时,LT输出1其余输出0,当A小于B时,GT输出1其余输出零,当A等于B时EQ输出1其余输出零。

2、library ieee;

use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity lx is

port(s2,s1,s0:in std_logic;

d3,d2,d1,d0:in std_logic; d7,d6,d5,d4:in std_logic; y:out std_logic); end lx;

architecture a of lx is

signal s :std_logic_vector(2 downto 0); begin

s<=s2&s1&s0;

y<=d0 when s=\"000\" else d1 when s=\"001\" else d2 when s=\"010\" else

第5页,共14页

end a;

d3 when s=\"011\" else d4 when s=\"100\" else d5 when s=\"101\" else d6 when s=\"110\" else d7 ;

电路功能:是一个八选一的数据选择器,d0,d1,d2,d3,d4,d5,d6,d7是数据输入端,s2,s1,s0是地址端。

3、LIBRARY IEEE;

USE IEEE.STD_LOGIC_1164.ALL; ENTITY pc IS

PORT(a : IN STD_LOGIC_VECTOR(7 DOWNTO 0); y : OUT STD_LOGIC); END pc;

ARCHITECTURE behave OF pc IS BEGIN

cbc: PROCESS(a)

VARIABLE tmp: STD_LOGIC; BEGIN

tmp:='0';

FOR i IN 0 TO 7 LOOP tmp:=tmp XOR a(i); END LOOP; y<=tmp;

END PROCESS cbc; END behave;

电路功能:是一个奇偶校验电路,当输入中有偶数个1时,输出为0,奇数个1时输出为1。 4、分析下面的VHDL源程序,说出输入、输出信号的含义,画出相应信号的波形并分析clk_out的功能。(共8分)

LIBRARY IEEE;

USE IEEE.STD_LOGIC_1164.ALL; ENTITY three IS PORT(clk_in : IN STD_LOGIC; clk_out : OUT STD_LOGIC ); END three;

ARCHITECTURE bhv OF three IS SIGNAL temp1,temp2 : STD_LOGIC_VECTOR(1 DOWNTO 0); BEGIN P1: PROCESS(clk_in) BEGIN IF rising_edge(clk_in) THEN

第6页,共14页

CASE temp1 IS WHEN \"00\" => temp1 <= \"01\"; WHEN \"01\" => temp1 <= \"10\"; WHEN \"10\" => temp1 <= \"00\"; WHEN OTHERS => temp1 <= \"00\"; END CASE; END IF;

END PROCESS P1; P2: PROCESS(clk_in) BEGIN IF falling_edge(clk_in) THEN CASE temp2 IS WHEN \"00\" => temp2 <= \"01\"; WHEN \"01\" => temp2 <= \"10\"; WHEN \"10\" => temp2 <= \"00\"; WHEN OTHERS => temp2 <= \"00\"; END CASE; END IF;

END PROCESS P2;

clk_out <= temp1(1) or temp2(1);

END bhv;

电路功能:是一个占空比为50%的三分频电路。

第7页,共14页

五、用VHDL描述下图所示的方框图,即在元件TOP中例化元件C1(两次)和元件C2。仅写出TOP层的程序。 library ieee;

use ieee.std_logic_1164.all entity TOP is

port(A,B,C,D : in std_logic;

q : out std_logic);

end TOP;

architecture connect of TOP is

signal I1,I2 : std_logic ; (0.5分) component C1

port(A,B : in std_logic;

out std_logic ); (0.5分)

End component ; component C2

port( D1 , D2 : in std_logic ; (0.5分)

Q : out std_logic ); (0.5分)

End component ; begin

U0:C1 port map ( a , b , i1 ); (2分)

U1: C1port map (c , d , i2) ; (2分) U3: C2port map( i1 , i2 , q) ; (2分) End connect;

第8页,共14页

完成下面带复位和预置数及使能端的11进制的加法计数器的设计。其中CLRN是复位控制输入端,当CLRN=1时,输出全为0,LDN是预置控制输入端,当LDN=1时,并且CLK上升沿到来时,进行预置数,当EN=1时,并且CLK上升沿到来时,计数器计数,EN=0时计数器保持不变。(12分) library ieee;

use ieee.std_logic_1164.all; entity count11 is

port(clk,clen,en,ldn: in std_logic; ia,ib,ic,id: in std_logic; qa,qb,qc,qd: out std_logic); end count11;

architecture behave of count11 is

signal count_4: std_logic_vector(3 downto 0); begin

qa<=count_4(0); qb<=count_4(1); qc<=count_4(2); qd<=count_4(3);

process( ) begin

if then count_4<=\"0000\";

elsif then if (en='1') then if then count_4(0)<=ia; count_4(1)<=ib; count_4(2)<=ic; count_4(3)<=id; else if (count_4=\"1010\") then else count_4<=count_4+1; end if; end if; end if; end if; end process; end behave;

第9页,共14页

某医院有一、二、三、四号病室4间,每室设有呼叫按钮,同时在护士值班室内对应地装有一号、二号、三号、四号4个指示灯。现要求当一号病室的按钮按下时,无论其它病室的按钮是否按下,只有一号灯亮。当一号病室没有按下而二号病室按下时,无论三号、四号病室的按钮是否按下,只有二号灯亮。当一号、二号病室的按钮没的按下而三号病室的按钮按下时,无论四号病室的按钮是否按下,只有三号灯亮。只有在一、二、三号病室的按钮都没有按下而四号病室的按钮按下时,四号灯才亮。试用VHDL语言设计满足该要求的电路。 Library ieee;;

Use ieee.std_logic_1164.all; Use ieee.std_logic_unsigned.all; Entity aa is

port(a,b,c,d : IN STD_LOGIC; e,f,g,h : OUT STD_LOGIC); end aa;

architecture behave of aa is Begin

process(a,b,c,d)

variable tmp0,tmp1,tmp2,tmp3: STD_LOGIC; BEGIN tmp0:='0'; tmp1:='0'; tmp2:='0'; tmp3:='0'; if (a='1') then tmp0:='1'; elsif(b='1')then tmp1:='1'; elsif(c='1')then tmp2:='1'; elsif(d='1')then tmp3:='1'; end if; e<=tmp0; f<=tmp1; g<=tmp2; h<=tmp3; end process; end behave;

第10页,共14页

设计一个七人表决电路,当多数人同意表示通过表决。 library ieee;

use ieee.std_logic_1164.all; entity bj7 is

port(a,b,c,d,e,f,g:in std_logic; result:out std_logic); end bj7;

architecture behave of bj7 is

signal input:std_logic_vector(6 downto 0); signal flag:std_logic; begin

input<=a&b&c&d&e&f&g; process(input) variable i,count:integer range 0 to 7; begin count:=0; for i in 0 to 6 loop flag<='1'; if input(i)='1' then count:=count+1; end if; exit when count>3; flag<='0'; end loop; end process; result<=flag; end behave;

第11页,共14页

设计一个占空比为50%的6分频电路。 Library ieee;

use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity count11 is

port(clk,clen,en,ldn: in std_logic; ia,ib,ic,id: in std_logic; qa,qb,qc,qd: out std_logic); end count11;

architecture behave of count11 is

signal count_4: std_logic_vector(3 downto 0); begin

qa<=count_4(0); qb<=count_4(1); qc<=count_4(2); qd<=count_4(3); process(clk,clen) begin

if (clen='0') then

count_4<=\"0000\";

elsif(clk'event and clk='1') then if(en='1') then if(ldn='1')then count_4(0)<=ia; count_4(1)<=ib; count_4(2)<=ic; count_4(3)<=id; else

if(count_4=\"1010\") then count_4<=\"0000\"; else

count_4<=count_4+'1'; end if; end if; end if;

end if;

end process; end behave;

第12页,共14页

编写带复位和预置数及使能端的9进制的加法计数器,CRN是复位控制输入端,当CRN=1时,输出全为0,LDN是预置控制输入端,当LDN=1时,并且CLK上升沿到来时,进行预置数,当ENA=1时,并且CLK上升沿到来时,计数器计数,ENA=0时计数器保持不变。 Library ieee;

use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity count9 is

port(clk,clen,en,ldn: in std_logic; ia,ib,ic,id: in std_logic; qa,qb,qc,qd: out std_logic); end count9;

architecture behave of count10 is

signal count_4: std_logic_vector(3 downto 0); begin

qa<=count_4(0); qb<=count_4(1); qc<=count_4(2); qd<=count_4(3); process(clk,clen) begin

if (clen='0') then

count_4<=\"0000\";

elsif(clk'event and clk='1') then if(en='1') then if(ldn='1')then count_4(0)<=ia; count_4(1)<=ib; count_4(2)<=ic; count_4(3)<=id; else

if(count_4=\"1000 then count_4<=\"0000\"; else

count_4<=count_4+1; end if; end if; end if; end if;

end process; end behave;

第13页,共14页

数据选择器MUX的原理图符号和功能表如下所示,试采用下面四种方式中的

两种来描述该数据选择器MUX的结构体。(16分)

SEL(1:0)SEL00AIN(1:0)BIN(1:0)COUTA or BA xor BA and BA nor B“XX”MUXCOUT(1:0)011011OTHERS

(A)用if语句 (B)用case 语句 (C)用when else 语句 (D)用with select 语句。

Library ieee;

Use ieee.std_logic_1164.all; Entity mymux is

Port( sel : in std_logic_vector(1 downto 0); Ain, Bin : in std_logic_vector(1 downto 0); Cout : out std_logic_vector(1 downto 0) );

-- 选择信号输入 -- 数据输入

End mymux;

LIBRARY ieee;

use ieee.std_logic_1164.all;

Entity Component is

Port(a,b,sel:in std_logic; Q:out std_logic); End Component; (a) 用if语句。

Architecture if_arc of Component_A is Begin

Process(sel,a,b) Begin

If sel=\"00\" then Q<=a xor b; Elsif sel=\"01\"then Q<=a or b; Elsif sel=\"10\" then Q<=a nor b; Elsif sel=\"11\" then Q<=a and b; Else

Q <=\"XX\";

End if; End process;

End;

(b) 用case语句。

Architecture case_arc of Component_A is Begin

Process(sel,a,b) Case sel is

When\"00\"=>q<=a xor b; When\"01\"=>q<=a or b; When\"10\"=>q<=a nor b; When\"11\"=>q<=a and b; Whenothers=>q<=\"XX\"; End case;

End process; End;

第14页,共14页

因篇幅问题不能全部显示,请点此查看更多更全内容