EDA考试

  • 格式:doc
  • 大小:92.00 KB
  • 文档页数:16
begin
process(d1,d2,sel)
begin
q<d1 when sel=’0’
elsed2;
end process;
end rt1;
程序6:
library ieee;
use ieee.std_logic_1164.all;
entity test is
port(clk: in std_logic;
4.3.实体中定义的信号描述对应信号端口模式有哪几种类型?比较端口模式INOUT和BUFFER有何异同点。
in含义:输入
OUT含义:输出但在构造体内部不使用
INOUT含义:说明该端口是双向的,可以输出也可以输入
BUFFER含义:说明该端口可以输出信号且在构造体内部可以使用该输出信号
4.8.判断下列VHDL标识是否合法,如果有误则指出原因:
end rt1;
程序三:
Architecture rt3 of ex is
signal a,b,c,c,d,e: std_logic_vector(3 downto 0);
begin
process(a,d,e,en)
begin
if en=’1’then
a<=c;
b<=d;
else
a<=e;
end if;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity cnt is
port(
cp : in std_logic;
u_d : in std_logic;
q2,q1,q0 : out std_logic;
clk : in std_logic;
dr : in std_logic;
qin: in std_logic_vector(15 downto 0);
en: in std_logic;
qont:out std_logic_vector(15 downto 0);
qout: out std_logic
7.2用VHDL设计一个七段显示译码器电路,要求输入8421BCD码,输出为高电平有效的七段码。
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity cnt is
port(
clk,rst,en,load : in std_logic;
q<=d;
end if;
end rt1;
程序2:
library ieee;
use ieee.std_logic_1164.all;
entity d_latch is
port(d,ena:in std_logic;
q: out std_logic);
end d_latch;
architecture rt1 of d_latch is
if u_d=’1’ then
q<=q-’1’;
else u_d=’0’ then
q<=q+’1’;
end if;
end if;
end process;
com:process(q)
begin
q0=<=q(0);
q1=<=q(1);
q2=<=q(2);
end process com;
end begin;
程序一:
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 sample is
Variable a,b,c :integer;
5.1信号赋值语句与变量赋值语句有何不同?
信号赋值采用“<=”而变量赋值采用“:=”
变量赋值立即生效上一条语句赋值结果下一条语句就可以使用,信号的赋值不立即生效,等到process语句结束才有效。而信号赋值语句和实际赋值过程是分开的,变量赋值不可产生附加延时而信号可以。
5.2判断下面3个程序中是否有误,若有则指出错误所在,并加以改正。
Begin
If rst=’1’ then
Con1<=”0000”;
Conm<=”0000”;
Conh<-=”0000”;
Elsif rising_edge(clk) then
If en=’1’ then
Con1<=con1;
Conh<=conh;
Conm<=conm;
Elsif load=’1’ then
end rt1;
程序5:
Library ieee;
Use ieee.std_logic_1164.all;
Entity test is
Port(d1,d2: in std_logic;
sel :in std_logic;
q :out std_logic);
end test;
architecture rt1 of test is
Con1<=data1;
Conm<=data2;
Conh<=data3;
Elsif(con1=”1001” and
Conm=”1001”
And conh=”1001”)
Then
Con1<=”0000”;
Conm<=”0000”;
Conh<-=”0000”;
Elsif con1=”1001 then
If conm<=”1001” then
begin
if ena=’1’then
q<=d;
end if;
end rt1;
程序3:
Library ieee;
Use ieee.std_logic_1164.all
Entity test is
Port(d,clk:in std_logic;
q:out std_logicc);
end test;
architecture rt1 of test is
end process;
end rt1;
5.4分别使用IF语句和CASE语句设计一个3—8译码器。
5.5指出下述CASE语句使用中的错误,说明原因。
5.6使用FOR循环语句设计一个8位的奇校验发生器。
5.11进程内部的语句是顺序执行还是并行执行?同一结构中的多个进程是顺序执行还是并行执行?
5.12改正一下程序中的错误,简要说明原因,并指出可综合成什么电路。
7.4设计含有异步清零和计数能使能的16位二进制加法计数器。
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity cnt_16 is
port(
data1,data2,data3 : in std_logic_vector(3 downto 0);
con1,conm,conh : buffer d_logic_vector(3 downto 0)
);
End cnt;
Architecture behave of cnt is
Begin
Process(rst,clk)
process(clk)
begin
if clk=’1’and clk’event then
if q(3) /=’1’then
q<=a+b;
end if;
end if;
end process;
end rt1;
程序二:
Architecture rt1 of ex is
singnal a,b:std_logic_vector(3 downto 0);
Con1<=”0000”;
Conm<=”0000”;
Conh<=conh+1;
Else conm=conm+1;
Con1<=”0000”;
7.3用VHDL描述一个六进制可逆计数器,设加法控制信号为u_d,当u_d为1时,减计数,u_d为0时,加计数;输出为q2、q1、q0,时钟为cp,上升沿有效。
library ieee;
程序一:
Library ieee;
use ieee.std_logic_1164.all;
entity d_flip_flop is
port(d,clk:in std_logic;
q:out std_logic);
end d_flip_flop is
begin
if clk’event and clk=’1’then
常量用于描述向设计实体输入的固定值,如总线的宽度、用于时序仿真的延迟时间;
变量通常用于行为描述中,是一种为了便于行为描述而声明的对象,不一定有具体的硬件对应,因此往往在综合之后就不见了;
信号则具体指硬件中的信号线,即元件之间的连线,或者设计实体的端口连线,信号在综合之后一定会有硬件连线与之对应。
4.18如何描述时钟信号的上升沿和下降沿?
begin
ifsel=:’0’then
c:=a;
else
c:=b;
end if;
end two;