杭州电子科技大学2004年EDA技术与VHD学生考试卷答案
考试课程 EDA技术与VHDL 考试日期 2005年 月 日 成 绩 参考答卷
课程号 教师号 任课教师姓名
考生姓名 学号(8位) 年级 专业 一、单项选择题:(20分) 1. IP核在EDA技术和开发中具有十分重要的地位;提供用VHDL等硬件描述语言描述的功能块,但不涉及实现该功能块的具体电路的IP核为__________。A A .软IP B.固IP C.硬IP D.都不是
2. 综合是EDA设计流程的关键步骤,在下面对综合的描述中,_________是错误的。D
A. 综合就是把抽象设计层次中的一种表示转化成另一种表示的过程;
B. 综合就是将电路的高级语言转化成低级的,可与FPGA / CPLD的基本结构相映射的网表文件;
C. 为实现系统的速度、面积、性能的要求,需要对综合加以约束,称为综合约束; D. 综合可理解为,将软件描述与给定的硬件结构用电路网表文件表示的映射过程,并且这种映射关系是唯一的(即综合结果是唯一的)。
3. 大规模可编程器件主要有FPGA、CPLD两类,下列对FPGA结构与工作原理的描述中,正确的是__C__。
A. FPGA是基于乘积项结构的可编程逻辑器件; B. FPGA是全称为复杂可编程逻辑器件;
C. 基于SRAM的FPGA器件,在每次上电后必须进行一次配置; D. 在Altera公司生产的器件中,MAX7000系列属FPGA结构。
4. 进程中的变量赋值语句,其变量更新是_________。A A. 立即完成; B. 按顺序完成; C. 在进程的最后完成; D. 都不对。
5. VHDL语言是一种结构化设计语言;一个设计实体(电路模块)包括实体与结构体两部分,结构体描述___________。D A. 器件外部特性; B. 器件的综合约束;
C. 器件外部特性与内部功能;
D. 器件的内部功能。
6. 不完整的IF语句,其综合结果可实现________。A
A. 时序逻辑电路 B. 组合逻辑电路 C. 双向电路 D. 三态控制电路
7. 子系统设计优化,主要考虑提高资源利用率减少功耗(即面积优化),以及提高
运行速度(即速度优化);指出下列哪些方法是面积优化_________。B
①流水线设计 ②资源共享 ③逻辑优化 ④串行化 ⑤寄存器配平 ⑥关键路径法
A. ①③⑤ B. ②③④ C. ②⑤⑥ D. ①④⑥
8. 下列标识符中,__________是不合法的标识符。B
A. State0 B. 9moon C. Not_Ack_0 D. signall
9. 关于VHDL中的数字,请找出以下数字中最大的一个:__________。A A. 2#1111_1110# B. 8#276# C. 10#170# D. 16#E#E1
10.下列EDA软件中,哪一个不具有逻辑综合功能:________。B A. Max+Plus II B. ModelSim C. Quartus II D. Synplify 第1页 共5页
二、EDA名词解释,写出下列缩写的中文(或者英文)含义:(10分) 1. VHDL 超高速集成电路硬件描述语言 2. FPGA 现场可编程门阵列 3. RTL 寄存器传输级 4. SOPC 可编程片上系统 5. EAB 嵌入式阵列块
三、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 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分) 仔细阅读下列程序,回答问题 1 LIBRARY IEEE;
2 USE IEEE.STD_LOGIC_1164.ALL; 3 use ieee.std_logic_unsinged.all 4 ENTITY CNT10 IS
5 PORT ( CLK : IN STD_LOGIC ;
6 Q : OUT STD_LOGIC_VECTOR(3 DOWNTO 0)) ; 7 END CNT10;
8 ARCHITECTURE bhv OF CNT10 IS
9 SIGNAL Q1 : STD_LOGIC_VECTOR(3 DOWNTO 0); 10 BEGIN
11 PROCESS (CLK) BEGIN
12 IF RISING_EDGE(CLK) begin ---then 13 IF Q1 < =9 THEN 14 Q1 <= Q1 + 1 ;
15 ELSE
16 Q1 <= (OTHERS => '0'); 17 END IF; 18 END IF; 19 END PROCESS ; 20 Q <= Q1;
21 END bhv;
1. 在MAX+PlusII中编译时,提示的第一条错误为:
Error: Line 12: File e:\\mywork\\test\\cnt10.vhd: VHDL syntax error: If statement must have THEN, but found BEGIN instead
指出并修改相应行的程序(如果是缺少语句请指出大致的行数):
错误1 行号:12 程序改为:IF RISING_EDGE(CLK) THEN
错误2 行号:3 程序改为:USE IEEE.STD_LOGIC_UNSIGNED.ALL; 12 行if语句配套关键字是then而非begin
3 行程序中使用了+号重载函数,应包含使用对应程序包ieee.std_logic_unsigned.all 2. 若编译时出现如下错误,请分析原因。
当前编译的程序文件没有放在指定文件夹内,所以系统找不到WORK工作库。 第2页 共5页
五、VHDL程序设计:(15分)
设计一数据选择器MUX,其系统模块图和功能表如下图所示。试采用下面三种方式中的两种来描述该数据选择器MUX的结构体。
(a) 用if语句。 (b) 用case 语句。 (c) 用when else 语句。
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;
Architecture three of mymux is Begin
Cout <= ain or bin when sel = “00” else
Ain xor bin when sel = “01” else
Ain and bin when sel = “10” else ain nor bin; End three;
六、根据原理图写出相应的VHDL程序:(15分)
Library ieee;
Use ieee.std_logic_1164.all; Entity mycir is
Port ( din, clk : in std_logic;
Qout : out std_logic); End mycir;
Architecture behave of mycir is Signal a, b, c; Begin
Qout <= c nand (a xor b); Process (clk)
Begin
If clk?event and clk = ?1? then A <= din; B <= A; C <= B; End if; End process; End behave;
第3页 共5页 七、综合题:(20分)
(一)已知状态机状态图如图a所示;完成下列各题:
图a 状态图
图b 状态机结构图
1. 试判断该状态机类型,并说明理由。