eda考试题.docx
《eda考试题.docx》由会员分享,可在线阅读,更多相关《eda考试题.docx(54页珍藏版)》请在冰豆网上搜索。
eda考试题
设计实验与考核
1.设计一个带计数使能、异步复位、异步装载、可逆计数的通用计数器。
计数结果由七段数码管显示。
2.设计一个具有16分频、8分频、4分频和2分频功能的分频器
3.设计一个正负脉宽相等的通用分频器
4.设计一个正负脉宽可控的16分频的分频器
5.根据需要设计一个分频器:
可以控制实现四种分频形式:
第一种:
8分频、第二种:
10分频、第三种:
15分频、第四种:
16分频,其中8分频和16分频为正负脉宽相等的分频器
6.可变模计数器,控制信号MA和MB为00、01、10、11时计数器的模分别为3、5、7、9。
(计数结果由七段数码管显示)
7.设计一个带计数使能、异步复位、带进位输出的增1二十进制计数器,计数结果由七段数码管显示。
8.设计一个序列发生器,序列为“1101101”
9.设计一个彩灯控制器,彩灯共有16个,每次顺序点亮相邻的3个彩灯,如此循环执行,循环的方向可以控制
10.设计一个具有左移、右移控制,同步并行装载和串行装载的8位串行移位寄存器,每次移位为1位
11.设计一个7人表决电路,参加表决者为7人,同意为1,不同意为0,同意者过半则表决通过,绿指示灯亮,表决不通过则红指示灯亮。
数码管显示赞成人数。
12.设计一个异步复位,同步并行装载的8位串行左移移位寄存器
13.有16个开关,编号为0到15,编号0的优先级最高。
当某一个拨码开关为‘1’时由七段数码管显示其编号(可用16进制数显示,亦可用十进制显示)
14.根据真值表设计一位全加器,然后用结构的描述方法设计一个6位加法器。
15.设计一个带计数使能、同步复位、同步装载的可逆七位二进制计数器,计数结果由七段数码管显示。
16.血型配对指示器:
供血血型和受血血型分别有A、B、AB、O四种。
当供血血型和受血血型符合要求是,T指示灯亮,否则F指示灯亮。
17.设计4位二进制数到BCD码(8421码)的转换器。
结果由数码管显示。
18.设计一个跑马灯控制器。
一共有8个彩灯,编号为LED0~LED7,点亮方式为:
先从左往右顺序点亮,然后从右往左,每次点亮1个彩灯,如此循环往复。
19.设计一个带计数使能、同步复位、带进位输出的增1六位二进制计数器,计数结果由七段数码管显示。
20.有5路数据输入,每路数据为2位二进制数,根据不同的控制信号,输出相应的输入数据。
同时由七段数码管显示输出数据的路号。
21.设计一个电磁炉控制器:
火力控制有三档:
煮汤、火锅、煎炒;每种操作都可以设定时间,当时间到自动停火。
22.设计三位BCD码(8421码)到十六进制数的转换器。
结果由数码管显示。
23.用结构的描述方法设计一个跑表,计时范围为59.99秒,有计时开始和停止计时控制,复位控制可以对所有计时进行异步复位。
计时结果由四位七段数码管显示。
24.一个电子系统中需要三种时钟,分别是:
1600HZ、800Hz、50Hz,系统输入时钟为160KHz。
试用VHDL描述该时钟发生器。
其中50Hz时钟为正负脉宽相等的时钟信号,其他不限。
25.某医院1到8号病房共8间,每室设有呼叫按钮,同时护士值班室内有一个七段数码管显示病房号;当多个病房同时有按钮按下时,病房号小的先显示。
26.亲自判定器:
根据亲子血型关系规则,当输入的亲、子血型符合时,指示灯亮。
27.模为的计数器,计数步长由控制信号A、B、C进行控制:
ABC=001时,步长为1,计数规律为:
0-1-2-3-4-5-6-7-8-9-0顺序计数;ABC=010时,步长为3,计数规律为:
0-3-6-9-0顺序计数;ABC=100时,步长为1,计数规律为:
0-9-8-7-6-5-4-3-2-1-0顺序计数;(计数结果由七段数码管显示)
28.模为16的计数器,控制信号为MA和MB。
MA和MB为“00”时不计数,“01”时加法计数器,“10”时减法计数器,“11”时预置数功能,加碱计数步长均为1。
(计数结果由数码管显示)
29.8位多功能寄存器:
由选择信号和控制信号进行控制。
当选择信号S=‘0’时:
C=‘0’为加计数器,C=‘1’为减计数器;当选择信号S=‘1’时,将计数值移位输出:
C=1时右移串行输出,C=0时左移串行输出。
(发光二极管显示)
30.一个电子系统中需要三种时钟,分别是:
1000Hz、500Hz、50Hz,系统输入时钟为100KHz。
试用VHDL描述该时钟发生器。
第一题
LIBRARYIEEE;
USEIEEE.STD_LOGIC_1164.ALL;
USEIEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITYcounterIS
GENERIC(count_value:
INTEGER:
=9);
PORT(clk,clr,en,load,dir:
INSTD_LOGIC;
data_in:
ININTEGERRANGE0TOcount_value;
ledout:
OUTSTD_LOGIC_VECTOR(6DOWNTO0));
ENDcounter;
ARCHITECTUREaOFcounterIS
SIGNALcnt:
INTEGERRANGE0TOcount_value;
SIGNALled:
STD_LOGIC_VECTOR(6DOWNTO0);
BEGIN
PROCESS(load,clk)
BEGIN
IFload='1'THEN
cnt<=data_in;
elsifclr='1'THEN
cnt<=0;
ELSIF(clk'EVENTANDclk='1')THEN
IFen='1'THEN
IFdir='1'THEN
IFcnt=count_valueTHEN
cnt<=0;
ELSE
cnt<=cnt+1;
endif;
else
IFcnt=0THEN
cnt<=count_value;
else
cnt<=cnt-1;
endif;
endif;
endif;
endif;
ENDPROCESS;
ledout<=NOTled;
WITHcntSELECT
led<="1111001"WHEN1,
"0100100"WHEN2,
"0110000"WHEN3,
"0011001"WHEN4,
"0010010"WHEN5,
"0000010"WHEN6,
"1111000"WHEN7,
"0000000"WHEN8,
"0010000"WHEN9,
"1000000"WHEN0,
"1111111"WHENothers;
ENDa;
第二题分频器
LIBRARYIEEE;
USEIEEE.STD_LOGIC_1164.ALL;
USEIEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITYdiv4IS
PORT(clk:
INSTD_LOGIC;
din:
INSTD_LOGIC_VECTOR(3DOWNTO0);
fout:
OUTstd_LOGIC);
ENDdiv4;
ARCHITECTUREaOFdiv4IS
begin
process(clk)
variablecnt:
std_logic_vector(3downto0);
begin
if(clk'eventandclk='1')then
ifcnt="1111"then
cnt:
="0000";
else
cnt:
=cnt+'1';
endif;
ifdin="0000"then
fout<=cnt(3);
elsifdin="1000"then
fout<=cnt
(2);
elsifdin="1100"then
fout<=cnt
(1);
elsifdin="1110"then
fout<=cnt(0);
else
fout<='1';
endif;
endif;
endprocess;
enda;
第三题
LIBRARYIEEE;
USEIEEE.STD_LOGIC_1164.ALL;
USEIEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITYdivIS
GENERIC(num:
INTEGER:
=2);
PORT
(clk:
INSTD_LOGIC;
co:
OUTSTD_LOGIC);
ENDdiv;
ARCHITECTURErtlOFdivIS
BEGIN
PROCESS(clk)
VARIABLEcnt:
STD_LOGIC_VECTOR(numdownto0);
BEGIN
IF(clk'eventandclk='1')THEN
cnt:
=cnt+'1';
ENDIF;
co<=cnt(num);
ENDPROCESS;
ENDrtl;
第四题
LIBRARYIEEE;
USEIEEE.STD_LOGIC_1164.ALL;
USEIEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITYdivIS
PORT(clk:
INSTD_LOGIC;
din:
INSTD_LOGIC_VECTOR(3DOWNTO0);
COUNT:
OUTSTD_LOGIC);
ENDdiv;
ARCHITECTURErtlOFdivIS
SIGNALco:
STD_LOGIC;
BEGIN
count<=co;
PROCESS(clk)
VARIABLEcnt:
STD_LOGIC_VECTOR(3DOWNTO0);
BEGIN
IF(clk'eventandclk='1')then
if(cnt="1111")then
cnt:
="0000";
co<=notco;
elsif(cnt=din)then
co<=notco;
cnt:
=cnt+'1';
else
cnt:
=cnt+'1';
endif;
endif;
endprocess;
endrtl;
第五题
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entityfenpinis
port(clk:
instd_logic;
en:
instd_logic_vector(1downto0);
cout:
outstd_logic;
ledout:
outstd_logic_vector(6downto0));
endfenpin;
architecturedgnfenpinoffenpinis
signalled:
std_logic_vector(6downto0);
signalhex:
std_logic_vector(3downto0);
begin
process(clk)
variablecnt:
std_logic_vector(3downto0);
begin
if(clk'eventANDclk='1')then
if(en="00")then
if(cnt>="1000")then
cnt:
="0000";
else
cnt:
=cnt+'1';
endif;
cout<=cnt
(2);
elsif(en="01")then
if(cnt>="1010")then
cnt:
="0000";
cout<='1';
else
cnt:
=cnt+'1';
cout<='0';
endif;
elsif(en="10")then
if(cnt>="1110")then
cnt:
="0000";cout<='1';
else
cnt:
=cnt+'1';cout<='0';
endif;
else
if(cnt>="1111")then
cnt:
="0000";
else
cnt:
=cnt+'1';
endif;
cout<=cnt(3);
endif;
endif;
endprocess;
ledout<=notled;
withenselect
led<="0000000"when"00",
"0001000"when"01",
"0001110"when"10",
"1000000"when"11",
"1111111"whenothers;
enddgnfenpin;
第六题
LIBRARYIEEE;
USEIEEE.STD_LOGIC_1164.ALL;
USEIEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITYcounterIS
PORT(MA,MB:
INSTD_LOGIC;
clk:
INSTD_LOGIC;
ledout:
OUTSTD_LOGIC_VECTOR(6downto0));
ENDcounter;
ARCHITECTUREaOFcounterIS
SIGNALcnt:
STD_LOGIC_VECTOR(3downto0);
SIGNALled:
STD_LOGIC_VECTOR(6downto0);
BEGIN
PROCESS(clk)
BEGIN
IF(clk'EVENTANDclk='1')THEN
IF(MA='0'ANDMB='0')THEN
IFcnt>="0011"THEN
cnt<="0000";
ELSE
cnt<=cnt+'1';
ENDIF;
ELSIF(MA='0'ANDMB='1')THEN
IFcnt>="0101"THEN
cnt<="0000";
ELSE
cnt<=cnt+'1';
ENDIF;
ELSIF(MA='1'ANDMB='0')THEN
IFcnt>="0111"THEN
cnt<="0000";
ELSE
cnt<=cnt+'1';
ENDIF;
ELSIF(MA='1'ANDMB='1')THEN
IFcnt>="1001"THEN
cnt<="0000";
ELSE
cnt<=cnt+'1';
ENDIF;
ENDIF;
ENDIF;
ENDPROCESS;
ledout<=NOTled;
WITHcntSELECT
led<="1111001"WHEN"0001",
"0100100"WHEN"0010",
"0110000"WHEN"0011",
"0011001"WHEN"0100",
"0010010"WHEN"0101",
"0000010"WHEN"0110",
"1111000"WHEN"0111",
"0000000"WHEN"1000",
"0010000"WHEN"1001",
"1000000"WHENothers;
ENDa;
第七题
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entitycounteris
port(clk,clk1,en,clr:
instd_logic;
co,scanout:
outstd_logic;
ledout:
outstd_logic_vector(6downto0));
endcounter;
architecturertlofcounteris
signalcnt:
std_logic_vector(7downto0);
signalled:
std_logic_vector(6downto0);
signalscan:
std_logic;
signalhex:
std_logic_vector(3downto0);
begin
process(clk,clr)
begin
ifclr='1'then
cnt<=(others=>'0');
elsifclk'eventandclk='1'then
ifen='1'then
ifcnt="00001001"then
cnt<="00010000";
co<='0';
elsifcnt="00011001"then--注意此处,前面跳过了A到F的计数,所以计数到11001
cnt<="00000000";
co<='1';
else
cnt<=cnt+'1';
co<='0';
endif;
endif;
endif;
endprocess;
process(clk1)
begin
ifclk1'eventandclk1='1'then
scan<=notscan;
endif;
endprocess;
ledout<=notled;
scanout<=scan;
hex<=cnt(7downto4)whenscan='1'elsecnt(3downto0);
withhexselect
led<="1111001"when"0001",
"0100100"when"0010",
"0110000"when"0011",
"0011001"when"0100",
"0010010"when"0101",
"0000010"when"0110",
"1111000"when"0111",
"0000000"when"1000",
"0010000"when"1001",
"1000000"when"0000",
"1111111"whenothers;
endrtl;
第八题序列发生器
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entityxulieis
port(clk:
instd_logic;
fout:
outstd_logic);
endxulie;
architecturefashengqiofxulieis
signalcnt:
std_logic_vector(2downto0);
begin
process(clk)
begin
if(clk'eventANDclk='1')then
if(cnt="111")then
cnt<="000";
else
cnt<=cnt+'1';
endif;
endif;
endprocess;
withcntselect
fout<='1'when"000",
'1'when"001",
'0'when"010",
'1'when"011",
'1'when"100",
'0'when"101",
'1'whenothers;
endfashengqi;
第九题
libraryieee;
useieee.std_logic_1164.all;
entitycaidengis
port(rl,clk:
instd_logic;
ledout:
outstd_logic_vector(15downto0));
endcaideng;
architectureaofcaidengis
signalled:
std_logic_vector(15downto0);
signalk:
std_logic;
begin
process(clk)
begin
if(clk'eventandclk='1')then
if(k='0')then
led<=(0=>'1',1=>'1',2=>'1',others=>'0');
k<='1';
elsif(rl='1')then
led<=led(14downto0)&led(15);
elsif(rl='0')then
led<=led(0)&led(15downto1);
endif;
endif;
ledout<=led;
endprocess;
enda;
第十题
LIBRARYIEEE;
USEIEEE.STD_LOGIC_1164.ALL;
ENTITYshifter1IS
PORT(clk,clr,ser,dir,stld:
INSTD_LOGIC;
din:
INSTD_LOGIC_VECTOR(0TO7);
qh:
OUTSTD_LOGIC);
ENDshifter1;
ARCHITECTURErt1OFshifter1IS
SIGNALreg:
STD_LOGIC_VECTOR(0TO7);
begin
process(clk,clr)
begin
ifclr='1'then
reg<=(others=>'0');
elsifclk'eventandclk='1'then
ifstld='0'then
reg<=din;
else
if(dir='0')then
reg<=reg(1to7)&ser;qh<=reg(0);
else
reg<=ser®(0to6);qh<=reg(7);
endif;
endif;
endif;
endprocess;
endrt1;
第十一题
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entityselectoris
port(b:
instd_logic_vector(6downto0);
clr:
instd_logic;
red,gree:
outstd_logic;
ledout:
outstd_logic_vector(6downto0));
endselector;
architecturertlofselectoris
signalled:
std_logic_vector(6downto0);
signalcount:
std_logic_vector(3downto0);
signala:
std_logic_vector(6downto0);
begin
process(b,clr)
begin
if(clr='1')then