资源描述
一、选择题:(20分)
1. 下列是EDA技术应用时波及的环节:
A. 原理图/HDL文本输入; B. 适配; C. 时序仿真; D. 编程下载; E. 硬件测试; F. 综合
请选择合适的项构成基于EDA软件的FPGA / CPLD设计流程:
A → ___F___ → ___B__ → ____C___ → D → ___E____
2. PLD的可编程重要基于A. LUT构造 或者 B. 乘积项构造:
请指出下列两种可编程逻辑基于的可编程构造:
FPGA 基于 ____A_____
CPLD 基于 ____B_____
3. 在状态机的详细实现时,往往需要针对详细的器件类型来选择合适的状态机编码。
对于A. FPGA B. CPLD 两类器件:
一位热码 状态机编码方式 适合于 ____A____ 器件;
次序编码 状态机编码方式 适合于 ____B____ 器件;
4. 下列优化措施中那两种是速度优化措施:____B__、__D__
A. 资源共享 B. 流水线 C. 串行化 D. 关键途径优化
单项选择题:
5. 综合是EDA设计流程的关键环节,综合就是把抽象设计层次中的一种表达转化成另一种表达的过程;在下面对综合的描述中,___D___是错误的。
A. 综合就是将电路的高级语言转化成低级的,可与FPGA / CPLD的基本构造相映射的网表文献;
B. 为实现系统的速度、面积、性能的规定,需要对综合加以约束,称为综合约束;
C. 综合可理解为,将软件描述与给定的硬件构造用电路网表文献表达的映射过程,并且这种映射关系不是唯一的。
D. 综合是纯软件的转换过程,与器件硬件构造无关;
6. 嵌套的IF语句,其综合成果可实现___D___。
A. 条件相与的逻辑
B. 条件相或的逻辑
C. 条件相异或的逻辑
D. 三态控制电路
7. 在一种VHDL设计中Idata是一种信号,数据类型为std_logic_vector,试指出下面那个赋值语句是错误的。D
A. idata <= “00001111”;
B. idata <= b”0000_1111”;
C. idata <= X”AB”;
D. idata <= B”21”;
8. 在VHDL语言中,下列对时钟边缘检测描述中,错误的是__D___。
A. if clk’event and clk = ‘1’ then
B. if falling_edge(clk) then
C. if clk’event and clk = ‘0’ then
D.if clk’stable and not clk = ‘1’ then
9. 请指出Altera Cyclone系列中的EP1C6Q240C8这个器件是属于__C___
A. ROM B. CPLD C. FPGA D.GAL
二、EDA名词解释,(10分)
写出下列缩写的中文(或者英文)含义:
1. ASIC 专用集成电路
2. FPGA 现场可编程门阵列
3. CPLD 复杂可编程逻辑器件
4. EDA 电子设计自动化
5. IP 知识产权核
6. SOC 单芯片系统
简要解释JTAG,指出JTAG的用途
JTAG,joint test action group,联合测试行动小组的简称,又意指其提出的一种硬件测试原则,常用于器件测试、编程下载和配置等操作。
三、VHDL程序填空:(10分)
下面程序是参数可定制带计数使能异步复位计数器的VHDL描述,试补充完整。
-- N-bit Up Counter with Load, Count Enable, and
-- Asynchronous Reset
library ieee;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
use IEEE.std_logic_arith.all;
entity counter_n is
generic (width : integer := 8);
port(data : in std_logic_vector (width-1 downto 0);
load, en, clk, rst : in std_logic;
q : out std_logic_vector (width - 1 downto 0));
end counter_n;
architecture behave of counter_n is
signal count : std_logic_vector (width-1 downto 0);
begin
process(clk, rst)
begin
if rst = '1' then
count <= (others => ‘0’); ―― 清零
elsif clk’event and clk = ‘1’ then ―― 边缘检测
if load = '1' then
count <= data;
elsif en = '1' then
count <= count + 1;
end if;
end if;
end process;
q <= count;
end behave;
四、VHDL程序改错:(10分)
仔细阅读下列程序,回答问题
LIBRARY IEEE; -- 1
USE IEEE.STD_LOGIC_1164.ALL; -- 2
ENTITY LED7SEG IS -- 3
PORT ( A : IN STD_LOGIC_VECTOR(3 DOWNTO 0); -- 4
CLK : IN STD_LOGIC; -- 5
LED7S : OUT STD_LOGIC_VECTOR(6 DOWNTO 0)); -- 6
END LED7SEG; -- 7
ARCHITECTURE one OF LED7SEG IS -- 8
SIGNAL TMP : STD_LOGIC; -- 9
BEGIN -- 10
SYNC : PROCESS(CLK, A) -- 11
BEGIN -- 12
IF CLK'EVENT AND CLK = '1' THEN -- 13
TMP <= A; -- 14
END IF; -- 15
END PROCESS; -- 16
OUTLED : PROCESS(TMP) -- 17
BEGIN -- 18
CASE TMP IS -- 19
WHEN "0000" => LED7S <= "0111111"; -- 20
WHEN "0001" => LED7S <= "0000110"; -- 21
WHEN "0010" => LED7S <= "1011011"; -- 22
WHEN "0011" => LED7S <= "1001111"; -- 23
WHEN "0100" => LED7S <= "1100110"; -- 24
WHEN "0101" => LED7S <= "1101101"; -- 25
WHEN "0110" => LED7S <= "1111101"; -- 26
WHEN "0111" => LED7S <= "0000111"; -- 27
WHEN "1000" => LED7S <= "1111111"; -- 28
WHEN "1001" => LED7S <= "1101111"; -- 29
END CASE; -- 30
END PROCESS; -- 31
END one;
1.在程序中存在两处错误,试指出,并阐明理由:
在MAX+PlusII中编译时,提醒的错误为:
Error: Line 14: File f:\upload\eda\maxplusii\my_proj\s8_5\led7seg.vhd: Type error: type in waveform element must be "std_ulogic"
Error: Line 19: File f:\upload\eda\maxplusii\my_proj\s8_5\led7seg.vhd: VHDL syntax error: expected choices in case statement
14行,TMP和A矢量位宽不一致
19行,CASE语句缺乏WHEN OTHERS语句处理剩余条件
2.修改对应行的程序(假如是缺乏语句请指出大体的行数):
错误1 行号: 9 程序改为:SIGNAL TMP : STD_LOGIC_VECTOR(3 DOWNTO 0);
错误2 行号: 29 程序改为:这行后添加 when others => null;
五、阅读下列VHDL程序,画出对应RTL图:(10分)
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY three IS
PORT
(
clk,d : IN STD_LOGIC;
dout : OUT STD_LOGIC );
END;
ARCHITECTURE bhv OF three IS
SIGNAL tmp: STD_LOGIC;
BEGIN
P1: PROCESS(clk)
BEGIN
IF rising_edge(clk) THEN
Tmp <= d;
dout <= tmp;
END IF;
END PROCESS P1;
END bhv;
六、写VHDL程序:(20分)
1. 数据选择器MUX,其系统模块图和功能表如下图所示。试采用下面四种方式中的两种来描述该数据选择器MUX的构造体。
(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;
Architecture one of mymux is
Begin
Process (sel, ain, bin)
Begin
If sel = “00” then cout <= ain or bin;
Elsif sel = “01” then cout <= ain xor bin;
Elsif sel = “10” then cout <= ain and bin;
Else cout <= ain nor bin;
End if;
End process;
End one;
Architecture two of mymux is
Begin
Process (sel, ain, bin)
Begin
Case sel is
when “00” => cout <= ain or bin;
when “01” => cout <= ain xor bin;
when “10” => cout <= ain and bin;
when others => cout <= ain nor bin;
End case;
End process;
End two;
2. 看下面原理图,写出对应VHDL描述
Library ieee;
Use ieee.std_logic_1164.all;
Entity mycir is
Port (ain , bin , clk : in std_logic;
Cout : out std_logic);
End mycir;
Architecture one of mycir is
Signal tb, tc;
begin
Process (clk) begin
If clk’event and clk = ‘1’ then
tb <= bin;
end if;
End process;
Process (clk, tc) begin
If clk = ‘1’ then cout <= tc;end if;
End process;
Tc <= ain xor tb;
End one;
七、综合题(20分)
用VHDL设计两层升降平台控制器
图a是一种两层的升降平台示意图,一层和二层各有一种按钮用来呼喊升降机。
图a 两层升降平台示意图
对应图a的升降平台控制器,拟用VHDL语言设计一种电路模拟其控制逻辑,图b为该VHDL电路的设计模块图。
图b 两层升降平台控制器设计模块图
图b中的cnt100模块用来控制升降台开关门延时,elev2为升降平台状态控制器。升降台闸门由打开到关闭或由关闭到打开时,elev2模块向cnt100模块输出一种en计数使能信号(高电平有效)。cnt100模块计数溢出(≥100)时cnt100输出cout信号为高电平,同步cnt100计数停止。
cnt100模块的实体描述如下所示:
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY CNT100 IS
PORT ( CLK, EN : IN STD_LOGIC; -- 时钟、使能信号
COUT : OUT STD_LOGIC ); -- 溢出信号
END CNT100;
问题1,请完毕cnt100模块的VHDL设计(实体部分已给出,不用写),参照的仿真波形如图c所示。
图c cnt100仿真波形图
Architecture one of cnt100 is
Begin
Process (clk, en)
Variable q : std_logic_vector (7 downto 0);
Begin
If en = ‘0’ then q := (others => ‘0’);
Elsif clk’event and clk = ‘1’ then q := q + 1;
End if;
If q < “01100100” then cout <= ‘0’;
Else cout <= ‘1’;
End if;
End process;
End one;
问题2,如下是elev2模块的VHDL描述:
library ieee;
use ieee.std_logic_1164.all;
entity elev2 is
port ( clk, rst : in std_logic; -- 时钟、复位信号
cout : in std_logic; -- 定期溢出信号
call : in std_logic_vector(2 downto 1); -- 呼喊信号
arr : in std_logic_vector(2 downto 1); -- 抵达信号
door : out std_logic; -- 门控信号,低电平开门
up : out std_logic; -- 上升信号
down : out std_logic; -- 下降信号
en : out std_logic); -- 延时计数清零、使能信号
end elev2;
architecture behav of elev2 is
constant CL1 : std_logic_vector(2 downto 0) := "000";-- 一楼关门
constant OP1 : std_logic_vector(2 downto 0) := "100";-- 一楼开门
constant UP1 : std_logic_vector(2 downto 0) := "010";-- 一楼上升
constant DN2 : std_logic_vector(2 downto 0) := "001";-- 二楼下降
constant CL2 : std_logic_vector(2 downto 0) := "011";-- 二楼关门
constant OP2 : std_logic_vector(2 downto 0) := "111";-- 二楼开门
signal control : std_logic_vector(2 downto 0); -- 状态控制信号
begin
door <= not control(2); up <= control(1); down <= control(0);
process (clk, rst, arr, call)
variable ven : std_logic;
begin
if rst = '1' then control <= CL1;
elsif clk'event and clk = '1' then
case control is
when CL1 => if cout = '1' then -- 关门已完毕
if call(1) = '1' then control <= OP1; en <= '0';
elsif call(2) = '1' then control <= UP1; en <= '1';
else control <= CL1; en <= '1'; end if;
else control <= CL1; en <= '1'; end if;
when OP1 => if cout = '1' then -- 开门已完毕
if call(1) = '1' then control <= OP1; en <= '1';
else control <= CL1; en <= '0'; end if;
else control <= OP1; en <= '1'; end if;
when UP1 => if arr(2) = '1' then control <= CL2;
else control <= UP1; end if;
when DN2 => if arr(1) = '1' then control <= CL1;
else control <= DN2; end if;
when CL2 => if cout = '1' then -- 关门已完毕
if call(2) = '1' then control <= OP2; en <= '0';
elsif call(1) = '1' then control <= DN2; en <= '1';
else control <= CL2; en <= '1'; end if;
else control <= CL2; en <= '1'; end if;
when OP2 => if cout = '1' then -- 开门已完毕
if call(2) = '1' then control <= OP2; en <= '1';
else control <= CL2; en <= '0'; end if;
else control <= OP2; en <= '1'; end if;
when others => if arr(10 = ‘1’ then control <= CL1;
else control <= CL2;end if;
end case;
end if;
end process; end behav;
请根据elev2的VHDL描述画出其状态迁移图。
问题3,根据图b所示升降平台模块图,写出升降平台控制器ELEV_TOP的VHDL顶层描述:
Library ieee;
Use ieee.std_logic_1164.all;
Entity elev is
Port (clk, rst : in std_logic;
Call, arr : in std_logic_vector(2 downto 1);
Door, up, down : out std_logic );
End elev;
Architecture one of elev is
component CNT100
PORT ( CLK, EN : IN STD_LOGIC; -- 时钟、使能信号
COUT : OUT STD_LOGIC ); -- 溢出信号
END component;
component elev2 is
port ( clk, rst : in std_logic; -- 时钟、复位信号
cout : in std_logic; -- 定期溢出信号
call : in std_logic_vector(2 downto 1); -- 呼喊信号
arr : in std_logic_vector(2 downto 1); -- 抵达信号
door : out std_logic; -- 门控信号,低电平开门
up : out std_logic; -- 上升信号
down : out std_logic; -- 下降信号
en : out std_logic); -- 延时计数清零、使能信号
end component;
signal ena, cout : std_logic;
begin
u1 : cnt100 port map (clk, ena, cout);
u2 : elev2 port map (clk, rst, cout, call, arr, door, up, down, ena);
end one;
展开阅读全文