EDA复习题.docx
《EDA复习题.docx》由会员分享,可在线阅读,更多相关《EDA复习题.docx(28页珍藏版)》请在冰豆网上搜索。
EDA复习题
1、基于EDA软件的FPGA/CPLD设计流程为:
原理图/HDL文本输入→__A__→综合→适配→____B____→编程下载→硬件测试。
A.功能仿真B.时序仿真
C.逻辑综合D.配置
2.IP核在EDA技术和开发中具有十分重要的地位;提供用VHDL等硬件描述语言描述的功能块,但不涉及实现该功能块的具体电路的IP核为__A___。
P25
A.软IPB.固IP
C.硬IPD.全对
3.VHDL语言是一种结构化设计语言;一个设计实体(电路模块)包括实体与结构体两部分,结构体描述_____B___。
P274
A.器件外部特性B.器件的内部功能
C.器件外部特性与内部功能D.器件的综合约束
4.进程中的信号赋值语句,其信号更新是___B____。
P130
A.立即完成B.在进程的最后完成
C.按顺序完成D.都不对
5.下面程序是1位十进制计数器的VHDL描述,试补充完整。
LIBRARYIEEE;
USEIEEE.STD_LOGIC_1164.ALL;--关键的基础包
USEIEEE.STD_LOGIC_UNSIGNED.ALL;--有重载运算符函数
ENTITYCNT10IS
PORT(CLK:
INSTD_LOGIC;
Q:
OUTSTD_LOGIC_VECTOR(3DOWNTO0));
ENDCNT10;
ARCHITECTUREbhvOFCNT10IS
SIGNALQ1:
STD_LOGIC_VECTOR(3DOWNTO0);
BEGIN
PROCESS(CLK)
BEGIN
IFCLK'EVENTANDCLK='1'THEN--边沿检测
IFQ1>10THEN
Q1<=(OTHERS=>'0');--置零
--eg:
Q1<=(1=>e
(1),3=>e
(2),others=>’0’);
--Q1<=e
(2)&’0’&e
(1)&’0’;
ELSE
Q1<=Q1+1;--加1
ENDIF;
ENDIF;
ENDPROCESS;
Q<=Q1;--因为Q是OUT只有输出模式,需定义信号缓存数据
ENDbhv;
6.下面是一个多路选择器的VHDL描述,试补充完整。
LIBRARYIEEE;
USEIEEE.STD_LOGIC_1164.ALL;
ENTITYbmuxIS
PORT(sel:
INSTD_LOGIC;
A,B:
INSTD_LOGIC_VECTOR(7DOWNTO0);
Y:
OUTSTD_LOGIC_VECTOR(7DOWNTO0));
ENDbmux;
ARCHITECTUREbhvOFbmuxIS
BEGIN
y<=Awhensel='1'ELSEB;--when-else并行赋值语句
ENDbhv;
7、阅读下列VHDL程序,画出原理图(RTL级)
and(与)、or(或)、not(非)、nand(与非)、nor(或非)、xor(异或)、xnor(异或非/)
LIBRARYIEEE;
USEIEEE.STD_LOGIC_1164.ALL;
ENTITYHADIS
PORT(a:
INSTD_LOGIC;
b:
INSTD_LOGIC;
c:
OUTSTD_LOGIC;
d:
OUTSTD_LOGIC
);
ENDENTITYHAD;
ARCHITECTUREfh1OFHADIS
BEGIN
c<=NOT(aNANDb);
d<=(aORb)AND(aNANDb);
ENDARCHITECTUREfh1;
8、请按题中要求写出相应VHDL程序
1.带计数使能的异步复位计数器
输入端口:
clk时钟信号
rst异步复位信号
en计数使能
load同步装载
data(装载)数据输入,位宽为10
输出端口:
q计数输出,位宽为10
LIBRARYIEEE;
USEIEEE.STD_LOGIC_1164.ALL;
USEIEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITYCNT1024IS
PORT(CLK,RST,EN,LOAD:
INSTD_LOGIC;
DATA:
INSTD_LOGIC_VECTOR(9DOWNTO0);
Q:
OUTSTD_LOGIC_VECTOR(9DOWNTO0));
ENDCNT1024;
ARCHITECTUREONEOFCNT1024IS
BEGIN
PROCESS(CLK,RST,EN,LOAD,DATA)
VARIABLEQ1:
STD_LOGIC_VECTOR(9DOWNTO0);
BEGIN
IFRST='1'THEN
Q1:
=(OTHERS=>'0');
ELSIFCLK='1'ANDCLK'EVENTTHEN
IFLOAD='1'THEN
Q1:
=DATA;
ELSE
IFEN='1'THEN
Q1:
=Q1+1;
ENDIF;
ENDIF;
ENDIF;
Q<=Q1;
ENDPROCESS;
ENDONE;
9.看下面原理图,写出相应VHDL描述
LIBRARYIEEE;
USEIEEE.STD_LOGIC_1164.ALL;
ENTITYTRI_STATEIS
PORT(E,A:
INSTD_LOGIC;
Y:
INOUTSTD_LOGIC;--注意端口符号
B:
OUTSTD_LOGIC);
ENDTRI_STATE;
ARCHITECTUREBEHAVOFTRI_STATEIS
BEGIN
PROCESS(E,A,Y)
BEGIN
IFE='0'THEN
B<=Y;
Y<='Z';
ELSE
B<='Z';
Y<=A;
ENDIF;
ENDPROCESS;
ENDBEHAV;
10.时序仿真是在设计输入完成之后,选择具体器件并完成布局、布线之后进行的时序关系仿真,因此又称为 功能仿真?
后仿真 。
11.VHDL的数据对象包括 变量 、 常量 和 信号 ,它们是用来存放各种类型数据的容器。
12.图形文件设计结束后一定要通过 仿真 ,检查设计文件是否正确。
13.以EDA方式设计实现的电路设计文件,最终可以编程下载到 FPGA 和 CPLD 芯片中,完成硬件设计和验证。
14.在VHDL中,用语句(D )表示clock的下降沿。
A.clock’event
B.clock’eventandclock=’1’--rising_edge(clock)
C.clock=’0’
D.clock’eventandclock=’0’--falling_edge(clock)
15. 下列标识符中,__________是不合法的标识符。
B
A.State0 B.9moon C.Not_Ack_0 D.signall
16. 关于VHDL中的数字,请找出以下数字中最大的一个:
__________。
A
A. 2#1111_1110#
B. 8#276#
C. 10#170#(10#170#=10#170#E0=10#17#E1)
D. 16#E#E1(十六进制数E(14)乘以进制数(16)的1次幂即14*16=224)
A.0xFEB.0xBEC.170D.0xE0
17。
EDA名词解释,写出下列缩写的中文(或者英文)含义:
(10分)
ASIC——(ApplicationSpecificIntegratedCircuit)专用集成电路
CPLD——(ComplexProgrammableLogicDevice)复杂可编程逻辑器件
CAD/E/M/T——(Computer-AidedDesign/Engineering/Manufacturing/Testing)计算机辅助
DRAM——(DynamicRandomAccessMemory)动态随机存取存储器
EDA——(ElectronicDesignAutomation)电子设计自动化
FSM——(FiniteStateMachine)有限状态机
FPGA——(FieldProgrammableGataArray)现场可编程门阵列
GAL——(genericarraylogic)通用阵列逻辑
HDL——(hardwaredescriptionlanguage)硬件描述语言
IP——(intellectualproperty)知识产权模块
ISP——(in-systemprogrammable)系统在线可编程
ICR——(Inthereconfigurablesystem)在电路可重构
IEEE——(InstituteofElectricalandElectronicEngineers)美国电气与电子工程协会
JTAG——(JointTestActionGroup)联合测试行为组织
LUT——(look-uptable)显示查找表
MC--(macrocell)宏单元
PLD——(ProgramableLogicDevice)可编程逻辑器件
PCB——(Printedcircuitboard/processcontrolmodule)进程控制块
PLA--可编程逻辑阵列
PAL--可编程阵列逻辑
PIA--可编程连线阵列
PROM--可编程只读存储器
RTL——(registertransferlevel)寄存器传输级
SOC——片上系统
SOPC——可编程片上系统
SRAM--静态随机存储器
UART——(UniversalAsynchronousReceiver/Transmitter)通用异步收发报机
VHDL——超高速硬件描述语言
18.下图为某一状态机对应的状态图,试用VHDL语言描述这一状态机。
(18分)
参考程序如下:
libraryieee;
useieee.std_logic_1164.all;
entityfsm2is
port(clk,reset,in1:
instd_logic;
out1:
outstd_logic_vector(3downto0));
end;
architecturebhvoffsm2is
typestate_typeis(s0,s1,s2,s3);
signalcurrent_state,next_state:
state_type;
begin
-->>p1:
主控时序程序
p1:
process(clk,reset)
begin
ifreset='1'then--异步复位
current_state<=s0;
elsifclk='1'andclk'eventthen
current_state<=next_state;
endif;
endprocess;
-->>p2:
规定状态转换方式
p2:
process(current_state)
begin
casecurrent_stateis
whens0=>ifin1='1'then
next_state<=s1;
else
next_state<=s0;
endif;
whens1=>ifin1='0'then
next_state<=s2;
else
next_state<=s1;
endif;
whens2=>ifin1='1'then
next_state<=s3;
elsenext_state<=s2;
endif;
whens3=>ifin1='0'then
next_state<=s0;
else
next_state<=s3;
endif;
endcase;
endprocess;
-->>p3:
规定状态输出
p3:
process(current_state)
begin
casecurrent_stateis
whens0=>ifin1='1'then
out1<="1001";
else
out1<="0000";
endif;
whens1=>ifin1='0'then
out1<="1100";
else
out1<="1001";
endif;
whens2=>ifin1='1'then
out1<="1111";
else
out1<="1001";
endif;
whens3=>ifin1='1'then
out1<="0000";
else
out1<="1111";
endif;
endcase;
endprocess;
endbhv;
1.分别用基本逻辑门和IFELSE语句用硬件描述语言写出反相器的程序。
①:
y<=nota;
②:
ifa='1'then
y<='0';
else
y<='1';
endif;
2.三态门电路
dout<=dinwhen(en='1')else'z';
3.单向总线缓冲器
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_arith.all;
useieee.std_logic_unsigned.all;
entitytri_buff8is
port(dout:
outstd_logic_vector(7downto0);
din:
instd_logic_vector(7downto0);
en:
instd_logic);
endtri_buff8;
architecturebehavoftri_buff8is
begin
p:
process(en,din)
begin
ifen='1'then
dout<=din;
else
dout<="ZZZZZZZZ";
endif;
endprocess;
--以上process语句等价于下面的when-else
--dout<=dinwhen(en='1')else(others=>’Z’);
--VHDL没有条件表达式?
:
但是可以用when-else
endbehav;
4.双向总线缓冲器
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_arith.all;
useieee.std_logic_unsigned.all;
entitytri_buff8isport(
a:
inoutstd_logic_vector(7downto0);
b:
inoutstd_logic_vector(7downto0);
en:
instd_logic;
dr:
instd_logic);
endtri_buff8;
architecturertloftri_buff8is
signalaout,bout:
std_logic_vector(7downto0);
begin
pa:
process(a,dr,en)
begin
if(en='1'anddr='1')then
bout<=a;
else
bout<="ZZZZZZZZ";
endif;
b<=bout;
endprocess;
pb:
process(b,dr,en)
begin
if(en='1'anddr='0')then
aout<=b;
else
aout<="ZZZZZZZZ";
endif;
a<=aout;
endprocess;
endrtl;
--architecturertloftri_buff8is
--begin
--b<=awhen(en='1'anddr='1')else("ZZZZZZZZ");
--a<=bwhen(en='1'anddr='0')else(others=>’Z’);
--endrtl;
5.8线-3线编码器
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_arith.all;
useieee.std_logic_unsigned.all;
entitybm8_3is
port(
din:
instd_logic_vector(7downto0);
dout:
outstd_logic_vector(2downto0));
endbm8_3;
architecturertlofbm8_3is
begin
process(din)
begin
if(din(7)='0')thendout<="000";
elsif(din(6)='0')thendout<="001";
elsif(din(5)='0')thendout<="010";
elsif(din(4)='0')thendout<="011";
elsif(din(3)='0')thendout<="100";
elsif(din
(2)='0')thendout<="101";
elsif(din
(1)='0')thendout<="110";
elsedout<="111";
endif;
endprocess;
--感觉没有优先级的编码器会很糟糕
--process(din)
--begin
--casedinis
--when"00000001"=>dout<="000";
--when"00000010"=>dout<="001";
--when"00000100"=>dout<="010";
--when"00001000"=>dout<="011";
--when"00010000"=>dout<="100";
--when"00100000"=>dout<="101";
--when"01000000"=>dout<="110";
--whenothers=>dout<="111";
--endcase;
--endprocess;
endrtl;
6.BCD七段显示译码器
7.四选一数据选择器
libraryieee;
useieee.std_logic_1164.all;
entitymux4is
port(a,b,c,d,s1,s2:
instd_logic;
y:
outstd_logic);
endmux4;
architecturebhvofmux4is
signalq:
std_logic_vector(1downto0);
begin
q<=s2&s1;
--->>1.使用with-select并行语句描述
withqselect
y<=awhen"00",
bwhen"01",
cwhen"10",
dwhenothers
--->>2.使用进程中if-then-elsif优先选择顺序语句
--process(q)
--begin
--if(sel='00')theny<=a;
--elsif(sel='01')theny<=b;
--elsif(sel='10')theny<=c;
--elsif(sel='11')theny<=d;
--endif;
--endprocess;
--->>3.使用进程中case-when顺序语句
--process(a,b,c,d,q)
--begin
--caseqis--
--when"00"=>y<=a;
--when"01"=>y<=b;
--when"10"=>y<=c;
--when"11"=>y<=d;
--whenothers=>null;
--endcase;
--endprocess;
endbhv;
8.八选一数据选择器
9.一位全加器
libraryieee;
useieee.std_logic_1164.all;
entityfull_adder1is
port(a,b,ci:
instd_logic;
y,co:
outstd_logic);
endfull_adder1;
architecturebhvoffull_adder1is
signalq:
std_logic_vector(2downto0);
signalq1:
std_logic_vector(1downto0);
begin
q<=a&b&ci;
process(q)
begin
caseqis
when"000"=>q1<="00";
when"001"=>q1<="01";
when"010"=>q1<="01";
when"100"=>q1<="01";
when"111"=>q1<="11";
whenothers=>q1<="10"