veriloghdl—电子琴课程设计

上传人:M****1 文档编号:432859763 上传时间:2022-10-29 格式:DOC 页数:22 大小:204KB
返回 下载 相关 举报
veriloghdl—电子琴课程设计_第1页
第1页 / 共22页
veriloghdl—电子琴课程设计_第2页
第2页 / 共22页
veriloghdl—电子琴课程设计_第3页
第3页 / 共22页
veriloghdl—电子琴课程设计_第4页
第4页 / 共22页
veriloghdl—电子琴课程设计_第5页
第5页 / 共22页
点击查看更多>>
资源描述

《veriloghdl—电子琴课程设计》由会员分享,可在线阅读,更多相关《veriloghdl—电子琴课程设计(22页珍藏版)》请在金锄头文库上搜索。

1、word某某文理学院课程设计报告题 目 Verilog hdl课程设计专业 1211自动化 学生某某 一天虹影指导教师 单鸣雷 完成时间 201519课程设计报告任务书理 工 科 类课程设计报告题目:电子琴的设计课程设计论文工作内容一、课程设计目标1、培养综合运用知识和独立开展实践创新的能力;2、深入学习Verilog HDL,了解其编程环境;3、学会运用Modelsim和Quartus II等编程仿真软件;4、将硬件语言编程与硬件实物功能演示相结合,加深理解Verilog HDL的学习;二、研究方法与手段应用1、将任务分成假如干模块,查阅相关论文资料,分模块调试和完成任务;2、遇到问题小组成

2、员与时讨论得出解决方法;3、遇到本组内解决不了的问题,与时和其他小组交流或询问教师;4、程序仿真,仿真无问题后进展模块调试,根据实验箱上的硬件实现是否符合要求来检验程序正确与否。三、课程设计预期效果1、完成实验环境搭建;2、具有手动弹奏和自动播放功能;3、以按键或开关作为琴键,至少可以通过蜂鸣器输出7个音阶;4、自动播放曲目至少两首;摘 要简易电子琴的设计通过通过软硬件结合实现,硬件系统包括主控器芯片、9个按键、LED、蜂鸣器等,软件资源包括编写Verilog HDL程序的应用软件Modelsim和仿真软件Quartus II。电子琴有按键代替琴键的弹奏功能和自动播放功能。按键有七个音,自动播

3、放功能中有三首曲子,分别是两只老虎、天空之城和某某情歌。程序共有五个模块,分别为主模块、琴键模块、曲1模块、曲2模块、曲3模块。硬件实现是用三个LED灯组合亮暗分别表示七个按键按下情况,另外两个按键用来选择曲目。实验箱原始时钟为50MHz,分频后变成不同的频率输出,通过蜂鸣器输出不同频率的声音。音乐的节拍通过分频变为4Hz,作为1/4拍。通过主模块调用各模块实现电子琴的功能。【关键词】Verilog HDL 电子琴 模块 分频ABSTRACTThis article introduced the simple electric pianos design. It realizes throug

4、h the software and hardware union. The hardware system includes a director, 9 keys, LEDs and a buzzer. The software design uses Verilog HDL. Emulation uses Quartus II. It can broadcast the system establishment the corresponding note, and can plete a military song the broadcast, but also has shows th

5、e sound the function. Designs the simple electric piano to have in the hardware. The program has seven modules, including main module, fractional frequency module and so on. Keyboard with keys to play the function and replace the keys to play function. Key has seven sound, automatic playback functio

6、n with three in song, were the two tiger , the sky city and kangding love songs. Software has its merit. It is perfect in the software Verilog HDL. The original frequency is divided into different frequencys. The piano makes sound by the buzzer with different frequencys.【keywords】Verilog HDL electri

7、c piano module fractional frequency第一章 系统设计第一节 课题目标与总体方案本次项目设计课程的目标是让我们在学习Verilog HDL的根底上更加深入的理解硬件设计语言的功能、作用与其特征,并且将我们的动手能力与创新能力结合起来。本次电子琴实验的目标是:1、具有手动弹奏和自动播放功能;2、以按键或开关作为琴键,至少可以通过蜂鸣器输出7个音阶;3、自动播放曲目至少两首;本次实验的方框图为:每个模块中都有分频主模块九个键Key1到Key7用于弹奏Key8与Key9mm用于选择歌曲mm=00按键模块Key1到Key7模块名digital_pianomm=01曲目1

8、两只老虎模块名 bellmm=10曲目2某某情歌模块名 bell2mm=11曲目3天空之城模块名 bell3第二节 设计框图说明一、 主模块主模块中用mm=(key8,key9)值的不同选择调用不同模块,mm=01调用曲目1模块,即bell模块;mm=10调用曲目2模块,即bell2模块;mm=11调用曲目3模块,即bell3模块;而在key8与key9没有被按下的情况下,程序调用按键模块,即digital_piano模块module main(inclk,outclk,key1,key2,key3,key4,key5,key6,key7,key8,key9,num);input inclk;

9、input key1,key2,key3,key4,key5,key6,key7,key8,key9;output outclk;output3:0num;reg outclk,clk_6M;reg 3:0c;wire out1,out2,out3,out4;wire8:0 key;reg 1:0mm;assign key = key1,key2,key3,key4,key5,key6,key7,key8,key9; /由按键拼键为变量key /调用子调块digital_piano m1(.inclk(inclk),.key1(key1),.key2(key2),.key3(key3),.ke

10、y4(key4), .key5(key5),.key6(key6),.key7(key7),.beep2(out2),.num(num); bell m2(.inclk(inclk),.beep1(out1);bell2 m3(.inclk(inclk),.beep3(out3);bell3 m4(.inclk(inclk),.beep4(out4);always (posedge clk_6M) /在时钟的上升沿检测是否有按键按下beginif(key = 9b111111110)mm = 2b01;else if(key=9b111111101)mm = 2b10;else if(key=

11、9b111111100)mm = 2b11;else mm = 2b00;end always(posedge inclk) begin if(c4d4) c=c+4d1; else begin c=4d0; clk_6M=clk_6M; endendalways (posedge clk_6M) beginif(mm = 2b01)outclk = out1;else if(mm = 2b00)outclk = out2;else if(mm = 2b10)outclk = out3;else outclk = out4;endendmodule二、按键模块Key1到key7对应do到si七

12、个音,用于模拟电子琴弹奏/digital_piano子模块module digital_piano(inclk,key1,key2,key3,key4,key5,key6,key7,beep2,num);input inclk,key1,key2,key3,key4,key5,key6,key7;output3:0num;output beep2; wire 6:0 key_code;reg 3:0c;reg clk_6M; reg beep_r;reg 3:0num;reg 15:0 count;reg 15:0 count_end;parameter Do = 7b1111110, /状态

13、机的7个编码,分别对应中音的7个音符 re = 7b1111101, mi = 7b1111011, fa = 7b1110111, so = 7b1101111, la = 7b1011111, si = 7b0111111;assign key_code = key7,key6,key5,key4,key3,key2,key1;assign beep2 = beep_r; /输出音乐always(posedge inclk) begin if(c4d4) c=c+4d1; else begin c=4d0; clk_6M=clk_6M; endendalways(posedge clk_6M) /分频模块,得出乐谱begincount = count + 16d1; /计数器加1if(count = count_end)begincount =16d0; /计数器清零beep_r = !beep_r; endendalways(posedge clk_6M) /状态机,根据按键状态,选择不同的音符输出begincase(key_code)Do: count_end = 16d11450;

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 建筑/环境 > 施工组织

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号