EDA基础实验报告.docx
《EDA基础实验报告.docx》由会员分享,可在线阅读,更多相关《EDA基础实验报告.docx(13页珍藏版)》请在冰豆网上搜索。
EDA基础实验报告
学院:
机电学院
班级:
072092-17
学号:
20091002559
组员:
张庆远
指导老师:
王院生
一基础实验
实验一组合逻辑设计
一、实验目的:
1.通过一个简单的3-8译码器的设计,让学生掌握组合逻辑电路的设计方法。
2.掌握组合逻辑电路的静态测试方法。
3.初步了解MAXPLUSII原理图输入设计的全过程。
二、实验的硬件要求:
1、主芯片:
EP1K10TC100—3
2、时钟源
3、八位七段数码显示管
4、四位拨码开关。
5、输入:
DIP拨码开关3位。
6、输出:
LED灯。
三、实验器材:
1.超想-3000TB综合实验仪1台
2.HK51TB仿真板1块
四、实验内容:
1、用拨码开关产生8421BCD码,用CPLD产生字形编码电路和扫描驱动电路,然后进行仿真,观察波形,正确后进行设计实现,适配化分。
调节时钟频率,感受“扫描”的过程,并观察字符亮度和显示刷新的效果。
2、编一个简单的从0~F轮换显示十六进制的电路。
五、实验原理:
三八译码器三输入,八输出。
当输入信号按二进制方式的表示为N时,输出端从零标记到八。
因为三个输入端能产生的组合状态有八种,所以输出端在每种组合中仅有一位有效的情况下,能表示所有的输入组合。
3-8译码器真值表
输入
输出
A2A1A0
Y7Y6Y5Y4Y3Y2Y1Y0
000
001
010
011
100
101
110
111
00000001
00000010
00000100
00001000
00010000
00100000
01000000
10000000
四位拨码开关提供8421BCD码,经译码电路后成为7段数码管的字形显示驱动信号。
(A…G)扫描电路通过可调时钟输出片选地址SEL[2..0]。
由SEL[2..0]和A..G决定了8位中的哪一位显示和显示什么字形.SEL[2..0]变化的快慢决定了扫描频率的快慢。
1、参考电路(时钟频率>40HZ,如图2—4—1)
图1—5—1
2、
参考电路(时钟频率<2HZ,如图2—4—2)
图1—5—2
六、实验连线:
输入信号:
D3,D2,D1,D0所对应的管脚同四位拨码开关相连;
清零信号RESET所对应的管脚同按键开关相连;
时钟CLK所对应的管脚同实验箱上的时钟源相连;
输出信号:
代表扫描片选地址信号SEL2,SEL1,SEL0的管脚同四位扫描驱动地址的低3位相连,最高位地址接“0”(也可悬空);
代表7段字码驱动信号A,B,C,D,E,F,G的管脚分别同扫描数码管的段输入a,b,c,d,e,f,g相连。
七、实验步骤:
1.进入WINDOWS操作系统,打开MAXPLUSII。
2.设计输入。
3.保存原理图。
4.用相关软件对程序进行管脚的定义、编译、仿真、下载,完成整个实验的设计。
八、实验程序图
七、实验结果:
拨动三个拨码输入开关,对应的LED指示灯点亮,实现译码功能,即实现了三个开关的任意组合。
二应用实验
梁祝音乐演奏实验
一、实验目的:
1.了解普通扬声器的工作原理。
2.使用FPGA产生不同的音乐频率。
3.进一步体验FPGA的灵活性。
二、实验硬件要求:
1.375KHz信号源。
2.FPGAEP1K10TC100—3主芯片。
3.扬声器。
三、实验原理:
本实验是完成一小段音乐程序的开发,然后再用扬声器进行试听。
下面主要介绍一下完成本实验的几个主要部分的工作原理。
1、音符的产生:
音符的产生是利用计数器对输入的时钟信号进行分频,然后输出不同的频率来控制扬声器发不同的声音。
计数器必须是模可变的计数器,也就是其初始计数值可变,这样便可以对其进行初始化,使其从不同的初始值开始计数,实现对输入时钟信号的不同分频。
2、节拍的产生:
节拍也是利用计数器来实现,如果某一个音符需要维持的时间比较长,那么就可以在此计数器从计数值A到计数值B之间都维持该音符,很显然,A和B之间的间隔越大,那么该音符维持的时间也就越长。
3、乐谱的存储:
乐谱是一个固定的组合电路,根据不同的输入值,然后输出一个固定的值,该值就是音符产生计数器的分频的初始值。
适当的选择这些计数器和组合电路,便可完成不同的乐曲和不同节奏。
四、实验内容及步骤:
本实验要完成的任务是设计一个驱动扬声器产生梁祝音乐的程序,设计步骤如下:
1、编写音乐输出的VHDL代码。
2、用MaxPlusII对其进行编译仿真。
3、在仿真确定无误后,选择芯片ACEX1K10TC100—3。
4、给芯片进行管脚绑定,在此进行编译。
5、根据自己帮点的管脚,在实验箱上对扬声器接口和FPGA之间进行正确连线。
6、给目标板下载代码,观看实验结果。
五、实验连线:
Clk:
时钟输入信号,接375KHz的时钟源。
Spk:
输出,接扬声器部分的输入端。
六、实验VHDL程序:
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_arith.all;
useieee.std_logic_unsigned.all;
----------------------------
entitymusicis
port(clk:
instd_logic;
spk:
bufferstd_logic);
endmusic;
---------------------
architecturebehaveofmusicis
signaltone:
std_logic_vector(10downto0);
signaltone_count:
std_logic_vector(10downto0);
signaltone_index:
integerrange0to15;
signalclk10_count:
std_logic_vector(17downto0);
signaltime:
integerrange0to150;
signalclk10:
std_logic;
begin
process(clk)--generate10hzclocksignal
begin
if(clk'eventandclk='1')then
clk10_count<=clk10_count+1;
if(clk10_count=16#3fff#)then
clk10<=notclk10;
endif;
endif;
endprocess;
process(clk10)
begin
if(clk10'eventandclk10='1')then
if(time=150)then
time<=0;
else
time<=time+1;
endif;
endif;
endprocess;
process(clk10)
begin
if(clk10'eventandclk10='1')then
casetimeis
when0=>tone_index<=3;
when1=>tone_index<=3;
when2=>tone_index<=3;
when3=>tone_index<=3;--
when4=>tone_index<=5;
when5=>tone_index<=5;
when6=>tone_index<=5;
when7=>tone_index<=6;--
when8=>tone_index<=8;
when9=>tone_index<=8;
when10=>tone_index<=8;
when11=>tone_index<=9;--
when12=>tone_index<=6;
when13=>tone_index<=8;
when14=>tone_index<=5;
when15=>tone_index<=5;--
when16=>tone_index<=12;
when17=>tone_index<=12;
when18=>tone_index<=12;
when19=>tone_index<=15;--
when20=>tone_index<=13;
when21=>tone_index<=12;
when22=>tone_index<=10;
when23=>tone_index<=12;--
when24=>tone_index<=9;
when25=>tone_index<=9;
when26=>tone_index<=9;
when27=>tone_index<=9;--
when28=>tone_index<=9;
when29=>tone_index<=9;
when30=>tone_index<=0;
when31=>tone_index<=0;--
when32=>tone_index<=9;
when33=>tone_index<=9;
when34=>tone_index<=9;
when35=>tone_index<=10;--
when36=>tone_index<=7;
when37=>tone_index<=7;
when38=>tone_index<=6;
when39=>tone_index<=6;--
when40=>tone_index<=5;
when41=>tone_index<=5;
when42=>tone_index<=5;
when43=>tone_index<=6;--
when44=>tone_index<=8;
when45=>tone_index<=8;
when46=>tone_index<=9;
when47=>tone_index<=9;--
when48=>tone_index<=3;
when49=>tone_index<=3;
when50=>tone_index<=8;
when51=>tone_index<=8;--
when52=>tone_index<=6;
when53=>tone_index<=5;
when54=>tone_index<=6;
when55=>tone_index<=8;--
when56=>tone_index<=5;
when57=>tone_index<=5;
when58=>tone_index<=5;
when59=>tone_index<=5;--
when60=>tone_index<=5;
when61=>tone_index<=5;
when62=>tone_index<=0;
when63=>tone_index<=0;----
when64=>tone_index<=10;
when65=>tone_index<=10;
when66=>tone_index<=10;
when67=>tone_index<=12;--
when68=>tone_index<=7;
when69=>tone_index<=7;
when70=>tone_index<=9;
when71=>tone_index<=9;--
when72=>tone_index<=6;
when73=>tone_index<=8;
when74=>tone_index<=5;
when75=>tone_index<=5;--
when76=>tone_index<=5;
when77=>tone_index<=5;
when78=>tone_index<=5;
when79=>tone_index<=5;--
when80=>tone_index<=5;
when81=>tone_index<=0;
when82=>tone_index<=0;
when83=>tone_index<=3;--
when84=>tone_index<=5;
when85=>tone_index<=3;
when86=>tone_index<=5;
when87=>tone_index<=5;--
when88=>tone_index<=6;
when89=>tone_index<=7;
when90=>tone_index<=9;
when91=>tone_index<=6;--
when92=>tone_index<=6;
when93=>tone_index<=6;
when94=>tone_index<=6;
when95=>tone_index<=6;--
when96=>tone_index<=6;
when97=>tone_index<=5;
when98=>tone_index<=6;
when99=>tone_index<=8;--
when100=>tone_index<=8;
when101=>tone_index<=8;
when102=>tone_index<=9;
when103=>tone_index<=12;--
when104=>tone_index<=12;
when105=>tone_index<=12;
when106=>tone_index<=10;
when107=>tone_index<=9;--
when108=>tone_index<=9;
when109=>tone_index<=10;
when110=>tone_index<=9;
when111=>tone_index<=8;--
when112=>tone_index<=8;
when113=>tone_index<=6;
when114=>tone_index<=5;
when115=>tone_index<=3;--
when116=>tone_index<=3;
when117=>tone_index<=3;
when118=>tone_index<=3;
when119=>tone_index<=8;--
when120=>tone_index<=8;
when121=>tone_index<=8;
when122=>tone_index<=8;
when123=>tone_index<=6;--
when124=>tone_index<=8;
when125=>tone_index<=6;
when126=>tone_index<=5;
when127=>tone_index<=3;--
when128=>tone_index<=5;
when129=>tone_index<=6;
when130=>tone_index<=8;
when131=>tone_index<=5;--
when132=>tone_index<=5;
when133=>tone_index<=5;
when134=>tone_index<=5;
when135=>tone_index<=5;--
when136=>tone_index<=5;
when137=>tone_index<=5;
when138=>tone_index<=0;
when139=>tone_index<=0;--
whenothers=>tone_index<=0;
endcase;
endif;
endprocess;
process(tone_index)
begin
casetone_indexis
when0=>tone<="11111111111";--nooutput
when1=>tone<="01100000101";--773
when2=>tone<="01110010000";--912
when3=>tone<="10000001100";--1036
when5=>tone<="10010101101";--1197
when6=>tone<="10100001010";--1290
when7=>tone<="10101011100";--1372
when8=>tone<="10110000010";--1410
when9=>tone<="10111001000";--1480
when10=>tone<="11000000110";--1542
when12=>tone<="11001010110";--1622
when13=>tone<="11010000100";--1668
when15=>tone<="11011000000";--1728
whenothers=>tone<="11111111111";--others:
nooutput
endcase;
endprocess;
process(clk)--controlthefrequenceofthespeaker
begin
if(clk'eventandclk='1')then
if(tone_count=16#7ff#)then
tone_count<=tone;
if(tone<2047)then
spk<=notspk;
endif;
else
tone_count<=tone_count+1;
endif;
endif;
endprocess;
endbehave;
七、实验结果
接6M时钟频率,蜂鸣器奏响比较动听的《梁祝》音乐,如用其他频率,音乐会走调失真。