EDA课程设计歌曲.docx

上传人:b****6 文档编号:8846424 上传时间:2023-02-02 格式:DOCX 页数:17 大小:174.36KB
下载 相关 举报
EDA课程设计歌曲.docx_第1页
第1页 / 共17页
EDA课程设计歌曲.docx_第2页
第2页 / 共17页
EDA课程设计歌曲.docx_第3页
第3页 / 共17页
EDA课程设计歌曲.docx_第4页
第4页 / 共17页
EDA课程设计歌曲.docx_第5页
第5页 / 共17页
点击查看更多>>
下载资源
资源描述

EDA课程设计歌曲.docx

《EDA课程设计歌曲.docx》由会员分享,可在线阅读,更多相关《EDA课程设计歌曲.docx(17页珍藏版)》请在冰豆网上搜索。

EDA课程设计歌曲.docx

EDA课程设计歌曲

 

课程设计

 

课程设计名称:

EDA课程设计

专业班级

学生姓名:

学号:

指导教师:

课程设计时间:

电子信息科学与技术专业课程设计任务书

学生姓名

专业班级

学号

题目

《友谊地久天长》乐曲自动播放器

课题性质

工程设计

课题来源

自拟课题

指导教师

同组姓名

主要内容

用FPGA设计实现乐曲《友谊地久天长》的自动演奏电路。

任务要求

(1)根据设计题目要求编写相应程序代码

(2)对编写的VHDL程序代码进行编译和仿真

(3)利用实验箱完成硬件验证

(4)总结设计内容,完成课程设计说明书

参考文献

[1]曹昕燕.<>.北京:

清华大学出版社,2004年

[2]焦素敏.<>.北京:

清华大学出版社,2005年

[3]焦素敏.<>.河南工业大学,2008年

[4]黄智伟.<>.电子工业出版社,2005年

[5]刘昌华.<<数字逻辑EDA设计与实践>>.国防工业出版社,2005年

审查意见

指导教师签字:

教研室主任签字:

年月日

说明:

本表由指导教师填写,由教研室主任审核后下达给选题学生,装订在设计(论文)首页

1设计任务及要求

本系统是利用硬件描述语言VHDL的设计思想设计的一个乐曲演奏电路,该系统基于计算机中时钟分频器的原理,采用自顶向下的设计方法来实现用硬件描述语言VHDL按模块化方式进行设计,然后进行编程、时序仿真、并进行硬件验证。

(1)音高与频率的对应关系下表:

1

2

3

4

5

6

7

低音

131

147

165

175

196

221

248

中音

262

294

330

350

393

441

496

高音

525

589

661

700

786

882

990

(2)《友谊地久天长》乐谱

2设计原理及总体框图

该实验由三个模块组成,FENPIN模块将12HZ的时钟信号分为4HZ,为paia模块提供时钟,paia模块控制每个音的长短,fana模块产生不同的音高,从而达到播放音乐的目的。

3程序设计

该设计共分为三个模块:

(1)FENPIN模块该模块输入12MHz的时钟,输出4MHz的时钟,实现给paia模块提供时钟。

程序如下

LIBRARYIEEE;

USEIEEE.STD_LOGIC_1164.ALL;

USEIEEE.STD_LOGIC_UNSIGNED.ALL;

ENTITYFENPINIS

PORT(CLKIN:

INSTD_LOGIC;

CLKOUT:

OUTSTD_LOGIC);

ENDENTITYFENPIN;

ARCHITECTUREARTOFFENPINIS

SIGNALQ:

INTEGERRANGE0TO2;

SIGNALCLK:

STD_LOGIC;BEGIN

PROCESS(CLKin)IS

BEGIN

IF(CLKin'EVENTANDCLKin='1')THEN

if(Q=2)then

Q<=Q+1;

CLK<=NOTCLK;

ELSE

Q<=Q+1;

ENDIF;

ENDIF;

ENDPROCESS;

CLKOUT<=CLK;

ENDARCHITECTUREART;

(2)模块PAIA控制每一个音的长短,送初值给FANA模块,从而控制音高。

音符的持续时间必须根据乐曲的速度以及每个音符的节拍数决定,因此此模块的功能也就是为FANA提供决定所发音的分频预置值,而此数在FANA输入口停留时间即为此音节节拍值。

libraryieee;

useieee.std_logic_1164.all;

entitypaiais

port(clk:

instd_logic;

q:

outintegerrange0to10204);

endpaia;

architecturepai_arcofpaiais

begin

process(clk)

variablecnt1:

integerrange0

to1500000;

variablecnt2:

integerrange0

to8;

variablen:

integerrange0to

45;

begin

ifclk'eventandclk='1'then

ifcnt1<1500000then

cnt1:

=cnt1+1;

else

cnt1:

=0;

casenis

when0=>q<=10204;

ifcnt2<1then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=1;

endif;

when1=>q<=7634;

ifcnt2<6then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=2;

endif;

when2=>q<=6061;

ifcnt2<1then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=3;

endif;

when3=>q<=6803;

ifcnt2<3then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=4;

endif;

when4=>q<=7634;

n:

=5;

when5=>q<=6803;

ifcnt2<1then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=6;

endif;

when6=>q<=6061;

ifcnt2<1then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=7;

endif;

when7=>q<=7634;

ifcnt2<4then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=8;

endif;

when8=>q<=6061;

ifcnt2<1then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=9;

endif;

when9=>q<=5089;

ifcnt2<1then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=10;

endif;

when10=>q<=4535;

ifcnt2<9then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=11;

endif;

when11=>q<=5089;

ifcnt2<3then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=12;

endif;

when12=>q<=6061;

ifcnt2<2then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=13;

endif;

when13=>q<=7634;

ifcnt2<1then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=14;

endif;

when14=>q<=6803;

ifcnt2<3then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=15;

endif;

when15=>q<=7634;

n:

=16;

when16=>q<=6803;

ifcnt2<1then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=17;

endif;

when17=>q<=6061;

ifcnt2<1then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=18;

endif;

when18=>q<=7634;

ifcnt2<3then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=19;

endif;

when19=>q<=9050;

ifcnt2<2then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=20;

endif;

when20=>q<=10204;

ifcnt2<1then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=21;

endif;

when21=>q<=7634;

ifcnt2<7then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=22;

endif;

when22=>q<=4535;

ifcnt2<1then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=23;

endif;

when23=>q<=5089;

ifcnt2<3then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=24;

endif;

when24=>q<=6061;

ifcnt2<2then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=25;

endif;

when25=>q<=7634;

ifcnt2<1then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=26;

endif;

when26=>q<=6803;

ifcnt2<3then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=27;

endif;

when27=>q<=7634;

n:

=28;

when28=>q<=6803;

ifcnt2<1then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=29;

endif;

when29=>q<=4535;

ifcnt2<1then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=30;

endif;

when30=>q<=5809;

ifcnt2<3then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=31;

endif;

when31=>q<=6061;

ifcnt2<2then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=32;

endif;

when32=>q<=5089;

ifcnt2<1then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=33;

endif;

when33=>q<=4535;

ifcnt2<7then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=34;

endif;

when34=>q<=3809;

ifcnt2<1then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=35;

endif;

when35=>q<=5809;

ifcnt2<3then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=36;

endif;

when36=>q<=6061;

ifcnt2<2then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=37;

endif;

when37=>q<=7634;

ifcnt2<1then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=38;

endif;

when38=>q<=6803;

ifcnt2<3then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=39;

endif;

when39=>q<=7634;

n:

=40;

when40=>q<=6803;

ifcnt2<1then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=41;

endif;

when41=>q<=6061;

ifcnt2<1then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=42;

endif;

when42=>q<=7634;

ifcnt2<3then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=43;

endif;

when43=>q<=9050;

ifcnt2<2then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=44;

endif;

when44=>q<=10204;

ifcnt2<1then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=45;

endif;

when45=>q<=7634;

ifcnt2<7then

cnt2:

=cnt2+1;

else

cnt2:

=0;

n:

=0;

endif;

endcase;

endif;

endif;

endprocess;

endpai_arc;

(3)模块FANA的功能是根据PAIA送来的初值倒计时,每次计到0时就使信号Q反转,由于初值不同,从而产生不同的音高。

所以音符的频率可以由此模块得到。

libraryieee;

useieee.std_logic_1164.all;

entityfanais

port(a:

inintegerrange0to10204;

clk:

instd_logic;

q:

outstd_logic);

endfana;

architecturefan_arcoffanais

begin

process(clk)

variableb,d:

std_logic;

variablec:

integerrange0to10204;

begin

ifclk'eventandclk='1'then

ifb='0'then

c:

=a;

b:

='1';

else

ifc=0then

b:

='0';

d:

=notd;

else

c:

=c-1;

endif;

endif;

endif;

q<=d;

endprocess;

endfan_arc;

4编译及仿真

5硬件调试与结果分析

将实验程序下载到硬件验证实验箱上,能播放出相应的音乐。

模块PAIA控制每一个音的长短,此模块输出Q送初值给FANA模块,从而控制音高。

音符的持续时间必须根据乐曲的速度以及每个音符的节拍数决定,因此此模块的功能也就是为FANA提供决定所发音的分频预置值,而此数在FANA输入口停留时间即为此音节节拍值即为图中q值。

模块FANA的功能是根据PAIA送来的初值倒计时,每次计到0时就使信号Q反转,由于初值不同,从而产生不同的音高。

从扬声器中播放出音乐。

6参考文献

(1)焦素敏.<>.北京:

清华大学出版社,2005年

(2)潘松,黄继业.EDA技术与VHDL.清华大学出版社.2005

⑶王振红.VHDL数字电路设计与应用实践教程.机械工业出版社.2006

心得体会

本次课程设计是将书本知识用于实践,让我们更好的应用知识,提高动手能力,增强学习的趣味性,使我们对所学知识有更好的理解。

通过两周的课程设计,学习了QuartusII的学习,更好的运用VHDL编写程序,复习了EDA的相关知识,增强了我的动手能力,提高和巩固了VHDL语言知识,能熟练地使用QuartusII。

在本次课程设计过程中也出现了不少问题,但是在他人的帮助下得以解决,通过发现为题,解决问题,使我更好的学习了EDA技术,能更好的使用QuartusII软件,增强了学习的乐趣,是我对学习充满了信心,尤其是实践环节。

我相信通过学与用的结合,能让我个好的掌握知识。

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

当前位置:首页 > 考试认证 > 司法考试

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

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