VHDL程序设计题Word格式.docx

上传人:b****4 文档编号:8035470 上传时间:2023-05-09 格式:DOCX 页数:21 大小:125.30KB
下载 相关 举报
VHDL程序设计题Word格式.docx_第1页
第1页 / 共21页
VHDL程序设计题Word格式.docx_第2页
第2页 / 共21页
VHDL程序设计题Word格式.docx_第3页
第3页 / 共21页
VHDL程序设计题Word格式.docx_第4页
第4页 / 共21页
VHDL程序设计题Word格式.docx_第5页
第5页 / 共21页
VHDL程序设计题Word格式.docx_第6页
第6页 / 共21页
VHDL程序设计题Word格式.docx_第7页
第7页 / 共21页
VHDL程序设计题Word格式.docx_第8页
第8页 / 共21页
VHDL程序设计题Word格式.docx_第9页
第9页 / 共21页
VHDL程序设计题Word格式.docx_第10页
第10页 / 共21页
VHDL程序设计题Word格式.docx_第11页
第11页 / 共21页
VHDL程序设计题Word格式.docx_第12页
第12页 / 共21页
VHDL程序设计题Word格式.docx_第13页
第13页 / 共21页
VHDL程序设计题Word格式.docx_第14页
第14页 / 共21页
VHDL程序设计题Word格式.docx_第15页
第15页 / 共21页
VHDL程序设计题Word格式.docx_第16页
第16页 / 共21页
VHDL程序设计题Word格式.docx_第17页
第17页 / 共21页
VHDL程序设计题Word格式.docx_第18页
第18页 / 共21页
VHDL程序设计题Word格式.docx_第19页
第19页 / 共21页
VHDL程序设计题Word格式.docx_第20页
第20页 / 共21页
亲,该文档总共21页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

VHDL程序设计题Word格式.docx

《VHDL程序设计题Word格式.docx》由会员分享,可在线阅读,更多相关《VHDL程序设计题Word格式.docx(21页珍藏版)》请在冰点文库上搜索。

VHDL程序设计题Word格式.docx

=aNANDb;

--与y<

=NOT(aANDb);

等价(10)

ENDnand2_1;

3、根据下表填写完成一个3-8线译码器的VHDL程序(16分)。

USEIEEE.STD_LOGIC_1164.ALL;

ENTITYdecoder_3_to_8IS

PORT(a,b,c,g1,g2a,g2b:

OUTSTD_LOGIC_VECTOR(7DOWNTO0));

ENDdecoder_3_to_8;

ARCHITECTURErtlOFdecoder_3_to_8IS

SIGNALindata:

STD_LOGIC_VECTOR(2DOWNTO0);

(4)

BEGIN

indata<

=c&

b&

a;

(6)

PROCESS(indata,g1,g2a,g2b)

IF(g1='

1'

ANDg2a='

0'

ANDg2b='

)THEN(8)

CASEindataIS

WHEN"

000"

=>

="

11111110"

;

001"

=>

11111101"

010"

11111011"

(10)

011"

11110111"

100"

11101111"

101"

11011111"

110"

10111111"

(12)

111"

01111111"

WHENOTHERS=>

XXXXXXXX"

ENDCASE;

ELSE

11111111"

(14)

ENDIF;

ENDPROCESS;

(16)

ENDrtl;

4、三态门电原理图如右图所示,真值表如左图所示,请完成其VHDL程序构造体部分。

(本题14分)

ENTITYtri_gateIS

PORT(din,en:

dout:

OUTSTD_LOGIC);

ENDtri_gate;

ARCHITECTUREzasOFtri_gateIS

PROCESS(din,en)

BEGIN

IF(en=‘1'

)THENdout<

=din;

ELSEdout<

=‘Z’;

ENDIF;

ENDPROCESS;

ENDzas;

1、根据一下四选一程序的结构体部分,完成实体程序部分(本题8分)

entityMUX4is

port(

(2)

s:

instd_logic_vector(1downto0);

(4)

d:

instd_logic_vector(3downto0);

(6)

y:

outstd_logic(8)

);

endMUX4;

architecturebehaveofMUX4is

process(s)

if(s="

00"

)then

y<

=d(0);

elsif(s="

01"

)then

=d

(1);

10"

=d

(2);

11"

=d(3);

else

null;

endif;

endprocess;

endbehave;

2、编写一个数值比较器VHDL程序的进程(不必写整个结构框架),要求使能信号g低电平时比较器开始工作,输入信号p=q,输出equ为‘0’,否则为‘1’。

(本题10分)

process(p,q)

(2)

ifg='

then(4)

ifp=qthen

equ<

='

(6)

else

(8)

endif;

else

equ<

(10)

endif;

endprocess;

3、填写完成一个8-3线编码器的VHDL程序(16分)。

Libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_arith.all;

useieee.std_logic_unsigned.all;

entityeight_triis

port(

b:

instd_logic_vector(7downto0);

en:

instd_logic;

y:

outstd_logic_vector(2downto0)(4)

endeight_tri;

architectureaofeight_triis(6)

signalsel:

std_logic_vector(8downto0);

sel<

=en&

b;

y<

=“000”when(sel=”100000001”)else

“001”when(sel=”100000010”)else(10)

“010”when(sel=”100000100”)else

“011”when(sel=”100001000”)else

“100”when(sel=”100010000”)else(12)

“101”when(sel=”100100000”)else

“110”when(sel=”101000000”)else(14)

“111”when(sel=”110000000”)else(16)

“zzz”;

enda;

4、图中给出了4位逐位进位全加器,请完成其VHDL程序。

(本题16分)

libraryIEEE;

useIEEE.std_logic_1164.all;

useIEEE.std_logic_arith.all;

useIEEE.std_logic_unsigned.all;

entityfull_addis

port(

a,b:

instd_logic_vector(3downto0);

carr:

inoutstd_logic_vector(4downto0);

sum:

outstd_logic_vector(3downto0)

endfull_add;

architecturefull_add_archoffull_addis

componentadder(4)

port(

a,b,c:

inoutstd_logic;

outstd_logic(6)

);

endcomponent;

carr(0)<

='

u0:

adderportmap(a(0),b(0),carr(0),carr

(1),sum(0));

u1:

adderportmap(a

(1),b

(1),carr

(1),carr

(2),sum

(1));

(8)(10)

u2:

adderportmap(a

(2),b

(2),carr

(2),carr(3),sum

(2));

(12)

u3:

adderportmap(a(3),b(3),carr(3),carr(4),sum(3));

(14)(16)

endfull_add_arch;

四、编程(共50分)

1、完成下图所示的触发器。

entityVposDffis

port(CLK,CLR,D:

inSTD_LOGIC;

----------2分

Q,QN:

outSTD_LOGIC);

----------4分

endVposDff;

architectureVposDff_archofVposDffis

process(CLK,CLR)----------6分

ifCLR='

thenQ<

QN<

elsifCLK'

eventandCLK='

then

Q<

=D;

=notD;

----------8分

----------10分

endVposDff_arch;

2、完成以下4位全加器代码(本题10分)

instd_logic_vector(3downto0);

cin:

cout:

outstd_logic;

outstd_logic_vector(3downto0)

componentadder

port(a,b,c:

outstd_logic;

outstd_logic);

signalc1,c2,c3:

std_logic;

2分

adderportmap(a(0),b(0),cin,c1,sum(0));

4分

adderportmap(a

(1),b

(1),c1,c2,sum

(1));

5分

adderportmap(a

(2),b

(2),c2,c3,sum

(2));

6分

adderportmap(a(3),b(3),c3,cout,sum(3));

10分

3、补充完整如下代码,使之完成4状态不断循环。

ARCHITECTUREarcOFssIS

typestatesis(st0,st1,st2,st3);

signaloutc:

states;

PROCESS(clk)

IFreset='

outc<

=st0;

elsifclk'

eventandclk='

then

CASEoutcIS

WHENst0=>

outc<

=st1;

7分

WHENst1=>

=st2;

8分

WHENst2=>

=st3;

9分

WHENst3=>

=st0;

WHENOTHERS=>

=st0;

ENDCASE;

ENDarc;

4、设计异或门逻辑:

(本题20分)

如下异或门,填写右边的真值表。

(此项5分)

A

B

Y

1

其表达式可以表示为:

(此项5分)

这一关系图示如下:

试编写完整的VHDL代码实现以上逻辑。

可以采用任何描述法。

(此项10分)

libraryieee;

1分

entityyihuo1is

port(a,b:

instd_logic;

y:

outstd_logic);

endyihuo1;

4分

architectureyihuo1_behaviorofyihuo1is

begin7分

process(a,b)y<

=axorb;

begin(第2种写法)

ifa=bthen

y<

else

endyihuo1_behavior;

10分

四、编程(共50分,除特殊声明,实体可只写出PORT语句,结构体要写完整)

1、用IF语句编写一个二选一电路,要求输入a、b,sel为选择端,输出q。

Entitysel2is

Port(

a,b:

sel:

q:

outstd_logic

);

Endsel2;

(3)

Architectureaofsel2is

ifsel=‘0’then

q<

=a;

(6)

=b;

(9)

(10)

2、编写一个4位加法计数器VHDL程序的进程(不必写整个结构框架),要求复位信号reset低电平时计数器清零,变高后,在上升沿开始工作;

输入时钟信号为clk,输出为q。

Process(reset,clk)

(2)

ifreset=‘0’then

=“0000”;

(4)

elsifclk’eventandclk=‘1’then(6)

=q+1;

(9)

(10)

3、填写完成一个8-3线编码器的真值表(5分),并写出其VHDL程序(10分)。

8-3线编码器真值表

en

b

y0y1y2

00000000

000

00000010

001

00000100

010

00001000

011

00010000

100

00100000

101

01000000

110

10000000

111

xxxxxxxx

高阻态

outstd_logic_vector(2downto0)

(3)

architectureaofeight_triis

“001”when(sel=”100000010”)else

“100”when(sel=”100010000”)else

“110”when(sel=”101000000”)else

“111”when(sel=”110000000”)else(9)

4、根据已给出的全加器的VHDL程序,试写出一个4位逐位进位全加器的VHDL程序。

(本题15分)

entityadderis

port(

a,b,c:

carr:

sum:

outstd_logic

);

endadder;

architectureadder_archofadderis

sum<

=axorbxorc;

carr<

=(aandb)or(bandc)or(aandc);

endadder_arch;

(5)

outstd_logic

(10)

(15)

1、用IF语句编写一个四选一电路,要求输入d0~d3,s为选择端,输出y。

s:

d:

(3)

(4)

(5)

(7)

(9)

equ_tmp<

equ_tmp<

3、填写完成一个3-8线译码器的真值表(5分),并写出其VHDL程序(10分)。

3-8译码器的真值表

a2a1a0

y

00000001

xxx

00000

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 自然科学 > 物理

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2