EDA复习Word格式文档下载.docx

上传人:b****4 文档编号:18452743 上传时间:2022-12-16 格式:DOCX 页数:19 大小:276.42KB
下载 相关 举报
EDA复习Word格式文档下载.docx_第1页
第1页 / 共19页
EDA复习Word格式文档下载.docx_第2页
第2页 / 共19页
EDA复习Word格式文档下载.docx_第3页
第3页 / 共19页
EDA复习Word格式文档下载.docx_第4页
第4页 / 共19页
EDA复习Word格式文档下载.docx_第5页
第5页 / 共19页
点击查看更多>>
下载资源
资源描述

EDA复习Word格式文档下载.docx

《EDA复习Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《EDA复习Word格式文档下载.docx(19页珍藏版)》请在冰豆网上搜索。

EDA复习Word格式文档下载.docx

useieee.std_logic_1164.all;

entityAND5Ais

port(a,en:

instd_logic;

y:

outstd_logic);

endentityAND5A;

architectureEX5ofAND5Ais

process(a,en)

ifen='

1'

theny<

=nota;

elsey<

='

Z'

;

endif;

endprocess;

endEX5;

 

2选1数据选择器

程序清单:

entityMUX21Ais

port(D1,D0,A,EN:

endentityMUX21A;

architectureoneofMUX21Ais

Y<

=D0whenA='

0'

andEN='

elseD1whenA='

else'

endarchitectureone;

仿真波形:

4选1数据选择器

entityMUX41Ais

port(EN,D3,D2,D1,D0,A1,A0:

endentityMUX41A;

architectureoneofMUX41Ais

=D0whenA1='

andA0='

elseD1whenA1='

elseD2whenA1='

elseD3whenA1='

8选1数据选择器

entityMUX81Ais

port(EN,D7,D6,D5,D4,D3,D2,D1,D0,A2,A1,A0:

Y:

endentityMUX81A;

architectureoneofMUX81Ais

=D0whenA2='

andA1='

elseD1whenA2='

8选1数据选择器的VHDL设计(低电平使能端)

1.实体框图

2.程序设计

entitymux81ais

port(A0,A1,A2,D0,D1,D2,D3,D4,D5,D6,D7,EN:

y:

endmux81a;

architecturebbbofmux81ais

signalA:

std_logic_vector(2downto0);

begin

A<

=A2&

A1&

A0;

y<

=D0whenA="

000"

else

D1whenA="

001"

D2whenA="

010"

D3whenA="

011"

D4whenA="

100"

D5whenA="

101"

D6whenA="

110"

D7whenA="

111"

endarchitecturebbb;

3.仿真波形图

4.仿真波形分析

D0-D7是数据输入端,EN为使能端,低电平有效,A2,A1,A0是控制输入端,Y是数据输出端。

当A2、A1、A0=‘000’时,D0数据被选中,输出Y=D0;

当A2、A1、A0=‘001’时,D1数据被选中,输出Y=D1,当A2、A1、A0=‘010’时,D2数据被选中,输出Y=D2,当A2、A1、A0=‘011’时,D3数据被选中,输出Y=D3,当A2、A1、A0=‘100’时,D4数据被选中,输出Y=D4,当A2、A1、A0=‘101’时,D5数据被选中,输出Y=D5,当A2、A1、A0=‘110’时,D6数据被选中,输出Y=D6,当A2、A1、A0=‘111’时,D7数据被选中,输出Y=D7。

std_logic_vector是标准逻辑矢量,定义的是长度大于1的变量,需要确定赋值方向(ndownto0)or(0downton)。

std_logic是长度为1的逻辑与bit相似,只是bit只能是'

0’和'

1‘而std_logic有以下九种状态:

U'

——初始值,'

X'

——不定,'

——0,'

——1,'

——高阻,'

W'

——弱信号不定,'

L'

——弱信号0,'

H'

——弱信号1,'

-'

——不可能的情况

38译码器:

用WITH-SELECT语句(低电平有效输出):

entityDECODER38Ais

port(A2,A1,A0,S3,S2,S1:

outstd_logic_vector(7downto0));

endDECODER38A;

architectureaaaofDECODER38Ais

signalF:

std_logic_vector(5downto0);

F<

=S3&

S2&

S1&

A2&

withFselect

="

11111110"

when"

001000"

"

11111101"

001001"

11111011"

001010"

11110111"

001011"

11101111"

001100"

11011111"

001101"

10111111"

001110"

01111111"

001111"

ZZZZZZZZ"

whenothers;

endaaa;

用WHEN-ELSE语句(高电平有效输出):

00000001"

whenF<

else"

00000010"

00000100"

00001000"

00010000"

00100000"

01000000"

10000000"

仿真波形

用if语句设计一个带同步清零(低电平有效)和异步置数(高电平有效)端的D触发器。

1.程序清单如下:

EntityD_FFis

port(D,clk,Reset,set:

Q:

EndEntityD_FF;

ArchitectureoneofD_FFis

signalQ1:

std_logic;

Begin

process(clk,Reset,set)

Begin

ifset='

then

Q1<

Else

ifclk'

eventandclk='

ifReset='

else

=D;

Q<

=Q1;

Endarchitectureone;

2.仿真波形:

Libraryieee;

使用if语句和case语句设计一个带异步清零(高电平有效)和同步置数(低电平有效)端的JK触发器。

1.程序清单:

EntityJK_FFis

port(clk,reset,set:

JK:

instd_logic_vector(0to1);

EndentityJK_FF;

ArchitecturetwoofJK_FFis

process(clk,reset,set,JK)

ifreset='

else

caseJKis

when"

00"

=>

Q1<

01"

10"

11"

=notQ1;

whenothers=>

NULL;

endcase;

endarchitecturetwo;

2.仿真波形

设计含并行置位功能的8位右移移位寄存器(时钟上升沿触发,最高位补‘0’,最低位串行输出)。

entityshiftis

port(CLK,LOAD:

instd_logic;

DIN:

instd_logic_vector(7downto0);

reg8:

QB:

outstd_logic_vector(7downto0));

endshift;

architecturebehavofshiftis

process(CLK,LOAD)

variablereg8:

std_logic_vector(7downto0);

ifCLK'

eventandCLK='

ifLOAD='

thenreg8:

=DIN;

elsereg8(6downto0):

=reg8(7downto1);

reg8(7):

QB<

=reg8;

endbehav;

2.仿真波形

四位双向移位寄存器,并行置数,左移地位补1,右移高位补0。

entityshift4ais

port(clk:

s:

instd_logic_vector(1downto0);

d:

instd_logic_vector(3downto0);

outstd_logic_vector(3downto0));

endshift4a;

architectureoneofshift4ais

signalQQ:

std_logic_vector(3downto0);

beginprocess(clk)begin

casesis

QQ<

=d;

=QQ(2downto0)&

'

&

QQ(3downto1);

whenothers=>

null;

=QQ;

endone;

64进制计数器(六位2进制)

useieee.std_logic_unsigned.all;

entitycdu_64ais

port(clk:

q:

outstd_logic_vector(5downto0));

endcdu_64a;

architectureaaofcdu_64ais

signalcout2,cout1:

std_logic_vector(3downto0);

process(clk)

if(cout2=3andcout1=15)thencout2<

0000"

cout1<

elseif(cout1=15)thencout2<

=cout2+1;

elsecout2<

=cout2;

=cout1+1;

endif;

q<

=cout2&

cout1;

endaa;

64进制BCD码计数器。

entitycdu64ais

q1,q2:

endcdu64a;

architecturethreeofcdu64ais

if(cout2=6andcout1=3)thencout2<

elseif(cout1=9)thencout2<

elsecout2<

q2<

q1<

=cout1;

endthree;

2.仿真波形:

十进制计数器,高电平使能信号,低电平异步清零,低电平同步置数。

entitycnt10is

port(clk,set,en,clr:

cq:

outstd_logic_vector(3downto0);

cout:

endcnt10;

architectureoneofcnt10is

process(clk,set,clr,en)

variablecqi:

ifclr='

thencqi:

=(others=>

);

elsifclk'

then

elsifen='

ifcqi<

9thencqi:

=cqi+1;

elsecqi:

ifcqi=9thencout<

elsecout<

cq<

=cqi;

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

当前位置:首页 > PPT模板 > 动物植物

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1