eda实验报告全加器四选一数据选择器交通灯.docx

上传人:b****3 文档编号:10669620 上传时间:2023-05-27 格式:DOCX 页数:38 大小:258.69KB
下载 相关 举报
eda实验报告全加器四选一数据选择器交通灯.docx_第1页
第1页 / 共38页
eda实验报告全加器四选一数据选择器交通灯.docx_第2页
第2页 / 共38页
eda实验报告全加器四选一数据选择器交通灯.docx_第3页
第3页 / 共38页
eda实验报告全加器四选一数据选择器交通灯.docx_第4页
第4页 / 共38页
eda实验报告全加器四选一数据选择器交通灯.docx_第5页
第5页 / 共38页
eda实验报告全加器四选一数据选择器交通灯.docx_第6页
第6页 / 共38页
eda实验报告全加器四选一数据选择器交通灯.docx_第7页
第7页 / 共38页
eda实验报告全加器四选一数据选择器交通灯.docx_第8页
第8页 / 共38页
eda实验报告全加器四选一数据选择器交通灯.docx_第9页
第9页 / 共38页
eda实验报告全加器四选一数据选择器交通灯.docx_第10页
第10页 / 共38页
eda实验报告全加器四选一数据选择器交通灯.docx_第11页
第11页 / 共38页
eda实验报告全加器四选一数据选择器交通灯.docx_第12页
第12页 / 共38页
eda实验报告全加器四选一数据选择器交通灯.docx_第13页
第13页 / 共38页
eda实验报告全加器四选一数据选择器交通灯.docx_第14页
第14页 / 共38页
eda实验报告全加器四选一数据选择器交通灯.docx_第15页
第15页 / 共38页
eda实验报告全加器四选一数据选择器交通灯.docx_第16页
第16页 / 共38页
eda实验报告全加器四选一数据选择器交通灯.docx_第17页
第17页 / 共38页
eda实验报告全加器四选一数据选择器交通灯.docx_第18页
第18页 / 共38页
eda实验报告全加器四选一数据选择器交通灯.docx_第19页
第19页 / 共38页
eda实验报告全加器四选一数据选择器交通灯.docx_第20页
第20页 / 共38页
亲,该文档总共38页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

eda实验报告全加器四选一数据选择器交通灯.docx

《eda实验报告全加器四选一数据选择器交通灯.docx》由会员分享,可在线阅读,更多相关《eda实验报告全加器四选一数据选择器交通灯.docx(38页珍藏版)》请在冰点文库上搜索。

eda实验报告全加器四选一数据选择器交通灯.docx

eda实验报告全加器四选一数据选择器交通灯

 

浙师大数理与信息工程学院

 

学生实验报告

 

实验一简单组合逻辑电路设计

1、实验目的

熟悉软件使用,了解CPLD设计的过程。

用画逻辑图和直接

 

使用VHDL语言的两种方法进行逻辑设计。

2、实验内容

用开关K7,K8作为输入设置,从输出指示LED观察OUT21,22,23,24

 

等的变化。

3、实验条件

EDA实验箱、QUARTUS2软件

4、实验设计

 

原理图

 

VHDL源程序

libraryieee;

 

useieee.std_logic_1164.all;

 

entityshieris

 

Port(k7,k8:

instd_logic;

 

out20,out21,out22,out23,out24:

outstd_logic);

 

endshier;

 

architecturesrofshieris

 

begin

 

out20<=k7;

 

out21<=notk7;

 

out22<=k7andk8;

 

out23<=k7ork8;

 

out24<=k7xork8;

 

endsr;

 

波形仿真

 

实验二三八译码器电路设计

1、实验目的

 

熟悉软件使用,了解CPLD设计的过程。

用画逻辑图和直接使用

 

VHDL语言的两种方法进行逻辑设计。

2、实验内容

用开关K1,K2,K3,K4作为输入设置,组成一个高输出有

 

效的三八译码器,从输出指示LED观察OUT1到OUT8随K1,K1,

 

K3置值的改变而引起相应的变化。

3、实验条件

EDA实验箱、QUARTUS2软件

4、实验设计

 

原理图

 

VHDL源程序

libraryieee;

 

useieee.std_logic_1164.all;

 

entityshisanis

 

port(a,b,c:

instd_logic;

 

y:

outstd_logic_vector(7downto0));

 

endshisan;

 

architectureoneofshisanis

 

begin

 

process(a,b,c)

 

variabled:

std_logic_vector(2downto0);

 

begin

 

d:

=(c&b&a);

 

ifd<="000"then

 

y<="00000001";

 

elsifd<="001"then

 

y<="00000010";

 

elsifd<="010"then

 

y<="00000100";

 

elsifd<="011"then

 

y<="00001000";

 

elsifd<="100"then

 

y<="00010000";

 

elsifd<="101"then

 

y<="00100000";

 

elsifd<="110"then

 

y<="01000000";

 

elsifd<="111"then

 

y<="10000000";

 

elsenull;

 

endif;

 

endprocess;

 

endone;

 

波形仿真

 

实验四四选一数据选择器电路设计

1、实验目的

熟悉和了解VHDL语言涉及数字电路的流程,掌握完整的

 

EDA设计方法。

2、实验内容

用VHDL语言编程实现一个四选一电路。

开关K5,K6作为控制端来确定K1,K2,K3,K4四个输入中的一个作为输入信号,

 

并将结果从OUT1输出。

3、实验条件

EDA实验箱、QUARTUS2软件

4、实验设计

 

VHDL源程序

libraryieee;

 

useieee.std_logic_1164.all;

 

entityshisiis

 

port(s1,s2,k1,k2,k3,k4:

instd_logic;

 

y:

outstd_logic);

 

endshisi;

 

architecturemuxofshisiis

 

signals:

std_logic_vector(1downto0);

 

begin

 

s<=(s1&s2);

 

process(s,s1,s2,k1,k2,k3,k4)

 

begin

 

casesis

 

when"00"=>y<=k1;

 

when"01"=>y<=k2;

 

when"10"=>y<=k3;

 

when"11"=>y<=k4;

 

whenothers=>null;

 

endcase;

 

endprocess;

 

endmux;

 

波形仿真:

 

实验五全加器电路设计

1、实验目的

熟悉VHDL语言的模块化设计,了解元件例化和打包调用语

 

句。

2、实验内容

用VHDL语言设计一个半加器电路。

然后用元件例化语句调

 

用两个半加器电路,用结构描述实现一个全加器。

3、实验条件

EDA实验箱、QUARTUS2软件

4、实验设计

 

VHDL源程序

 

libraryieee;

 

useieee.std_logic_1164.all;

 

entitybanjiais

 

port(a,b:

instd_logic;

 

so,co:

outstd_logic);

 

endbanjia;

 

architecturemuxofbanjiais

 

begin

 

so<=axorb;

 

co<=aandb;

 

endmux;

 

--半加器

 

libraryieee;

 

useieee.std_logic_1164.all;

 

entityor1is

 

port(a,b:

instd_logic;

 

c:

outstd_logic);

 

endor1;

 

architectureorrofor1is

 

begin

 

c<=aorb;

 

endorr;

 

--与门

 

libraryieee;

 

useieee.std_logic_1164.all;

 

packagemy_pkgis

 

componentbanjia

 

port(a,b:

instd_logic;

 

so,co:

outstd_logic);

 

endcomponent;

 

--元件声明

 

componentor1

 

port(a,b:

instd_logic;

 

c:

outstd_logic);

 

endcomponent;

 

endmy_pkg;

 

--元件声明

 

libraryieee;

 

useieee.std_logic_1164.all;

 

usework.my_pkg.all;

 

entityshiwuis

 

port(ain,bin,cin:

instd_logic;

 

cout:

outstd_logic;

 

sum:

bufferstd_logic);

 

endshiwu;

 

--打开程序包

 

architecturequanjiaofshiwuis--元件例化

 

signalx,y,z:

std_logic;

 

begin

 

u1:

banjiaportmap(a=>cin,b=>y,co=>z,so=>sum);--关联方式

 

u2:

banjiaportmap(a=>ain,b=>bin,co=>x,so=>y);--关联方式

 

u3:

or1portmap(a=>x,b=>z,c=>cout);--关联方式

 

endquanjia;

 

波形仿真

 

实验六交通灯电路设计

 

1、实验目的

熟悉软件使用,了解CPLD设计过程。

设计逻辑电路,完成交

 

通灯控制逻辑。

2、实验内容

 

1、设计电路,交通灯控制逻辑

 

2、了解状态变化电路的设计

3、实验条件

EDA实验箱、QUARTUS2软件

5、实验设计

 

VHDL源程序

libraryieee;

 

useieee.std_logic_1164.all;

 

useieee.std_logic_unsigned.all;

 

entityjiaotongdengis

 

generic(

 

cnt_green1:

integer:

=25;

 

--定义主通道绿灯亮的时间

 

25秒

cnt_yellow1:

integer:

=5;

--定义主通道黄灯亮的时间

5秒

cnt_green2:

integer:

=15;

--定义支路绿灯亮的时间

15秒

cnt_yellow2:

integer:

=5);

--定义支路绿灯亮的时间

5秒

port(

clk

rst

:

instd_logic;

--时钟信号、复位信号

lgt1_yellow:

outstd_logic;

--主通道黄灯控制信号

lgt1_green

:

outstd_logic;

--主通道绿灯控制信号

lgt1_red

:

outstd_logic;

--主通道红灯控制信号

lgt2_yellow

:

outstd_logic;

--支路黄灯控制信号

lgt2_green

:

outstd_logic;

--支路绿灯控制信号

lgt2_red

:

outstd_logic);

--支路红灯控制信号

endjiaotongdeng;

 

architectureartofjiaotongdengis

 

typestatesis

 

--状态机

(st0,st1,st2,st3);

 

signalstate:

states:

=st0;

--状态机的各种状态

signalcnt:

integerrange0to30:

=0;

--定义计数器

signalcnt_en:

std_logic:

='0';

 

begin

 

process(clk,rst,cnt)

 

begin

--计数使能信号

ifrst='1'then

 

state<=st0;

 

cnt<=0;

--复位信号有效则执行复位操作

elsif(rising_edge(clk))then

 

ifcnt_en='1'then

--时钟上升沿到来

cnt<=cnt+1;

 

Else

--计数器计数

cnt<=0;

 

endif;

--计数器清零

casestateis

 

whenst0=>

 

ifcnt=cnt_green1then

 

--主通道绿灯亮了

 

25秒转换到状态

 

1

state<=st1;

 

else

 

state<=st0;

 

endif;

 

whenst1=>

 

ifcnt=cnt_yellow1then

 

--主通道黄灯亮了

 

5秒转换到状态

 

2

state<=st2;

 

else

 

state<=st1;

 

endif;

 

whenst2=>

 

ifcnt=cnt_green2then

 

--支路绿灯亮了

 

15秒转换到状态

 

3

 

state<=st3;

 

else

 

state<=st2;

 

endif;

 

whenst3=>

 

ifcnt=cnt_yellow2then

 

--支路黄灯亮了

 

5秒转换到状态

 

0

state<=st0;

 

else

 

state<=st3;

 

endif;

 

endcase;

 

endif;

 

endprocess;

 

process(state,cnt)

 

begin

 

casestateis

 

whenst0=>--状态lgt1_green<='1';lgt1_yellow<='0';lgt1_red<='0';lgt2_green<='0';lgt2_yellow<='0';lgt2_red<='1';

 

0时主通道绿灯亮,支路红灯亮

 

if

cnt_en<='1';

 

cnt=cnt_green1then

--开始计数

cnt_en<='0';

 

endif;

 

whenst1=>

 

--状态

--到25秒停止计数

 

0时主通道黄灯亮,支路红灯亮

lgt1_green<='0';

 

lgt1_yellow<='1';

 

lgt1_red<='0';

 

lgt2_green<='0';

 

lgt2_yellow<='0';

 

lgt2_red<='1';

 

cnt_en<='1';

 

ifcnt=cnt_yellow1then

 

--开始计数

cnt_en<='0';

--到

5秒停止计数

endif;

 

whenst2=>

 

--状态

 

0时主通道红灯亮

 

,支路绿灯亮

lgt1_green<='0';

 

lgt1_yellow<='0';

 

lgt1_red<='1';

 

lgt2_green<='1';

 

lgt2_yellow<='0';

 

lgt2_red<='0';

 

cnt_en<='1';

 

--开始计数

if

cnt=cnt_green2then

cnt_en<='0';

--到

15秒停止计数

endif;

 

whenst3=>

 

--状态

 

0时主通道红灯亮

 

,支路黄灯亮

lgt1_green<='0';

 

lgt1_yellow<='0';

 

lgt1_red<='1';

 

lgt2_green<='0';

 

lgt2_yellow<='1';

 

lgt2_red<='0';

 

cnt_en<='1';--开始计数

 

ifcnt=cnt_yellow2then

 

cnt_en<='0';--计数到5秒停止计数

 

endif;

 

endcase;

 

endprocess;

 

endart;

 

波形仿真

 

由于交通灯程序中绿灯设定时间较长,仿真时只能看到部分波

 

形,因此仿真时将绿灯时间缩短以便观察到完整的波形

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

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

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

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