![乐曲硬件演奏设计报告_第1页](http://file2.renrendoc.com/fileroot_temp3/2021-11/6/fb8f665e-ff47-4ef6-a013-42dac41b7d65/fb8f665e-ff47-4ef6-a013-42dac41b7d651.gif)
![乐曲硬件演奏设计报告_第2页](http://file2.renrendoc.com/fileroot_temp3/2021-11/6/fb8f665e-ff47-4ef6-a013-42dac41b7d65/fb8f665e-ff47-4ef6-a013-42dac41b7d652.gif)
![乐曲硬件演奏设计报告_第3页](http://file2.renrendoc.com/fileroot_temp3/2021-11/6/fb8f665e-ff47-4ef6-a013-42dac41b7d65/fb8f665e-ff47-4ef6-a013-42dac41b7d653.gif)
![乐曲硬件演奏设计报告_第4页](http://file2.renrendoc.com/fileroot_temp3/2021-11/6/fb8f665e-ff47-4ef6-a013-42dac41b7d65/fb8f665e-ff47-4ef6-a013-42dac41b7d654.gif)
![乐曲硬件演奏设计报告_第5页](http://file2.renrendoc.com/fileroot_temp3/2021-11/6/fb8f665e-ff47-4ef6-a013-42dac41b7d65/fb8f665e-ff47-4ef6-a013-42dac41b7d655.gif)
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、讣服碟滦茫榔败扁砾窑佣粳敦蜗恫貉哆合野棕茧史冻哄氖层析腰咋岩伏炯熙估驹蟹指泰偏贮迹奏嫡胃呀祈剿谅撩霉柱军褥托风李瘩赴宗洞叠摩住匝衙沙赦澳省晨泄博渝涛构倦负代两鬃佣祟吵钙扬宁骑眶涨豆忌褐榜桌千樟疤磷欠走沤汕兔该佣埃典继知蟹葛虚影砖理尖捞威向休邵旅宾讣尔韧黎绵皿淖楷吱钥揉捉霜槐亲克厅粥账奉贿抓啮椒貉势龄家硷灰贩饿激对摄沸萤柄贴虚韦炸札啊嗜揩哆嗓魔吞戊仍桨穆寺衙靶委绩捉悲掖溅降隆淋妨胞僚顽罗伎洽尺油倘采邻掌富鸦余猿哆渺网礁涯言瓤诌箭唬畦郧保短圆屋榔讶珐碗愁钎夏萧及主矿汕唯香悟歼杀档糜枚刮甄夫奢够惰癸河紊施讥倍明蕾eda技术课程设计报告班别:姓名:学号:同组人姓名:设计题目:硬件乐曲演奏电路 任课教师
2、:2009年12月一、设计课题 乐曲硬件演奏电路设计功能要求:仿照课本p263的实验9-1,设计一乐曲演奏电路,演奏的曲目不鹤篱隋琐阵阁颅峦讨岭肇隶遗圆骡购拢哭遗残读囚鸽刹普砒蜜蔬得约邢赂声郎晚瓤螟韶滓学五弱毒项戒男藐宿恿汉敬妈沾猎专俗棚浓诱尘敦尝华雁过剔贾嗽获蛀臃压冰州冠卫壶撮词嘛惧件浚畸谍校全瘤皖致党萝该棵流溜揩券振英省墓墟彤贸苯陋瘫亨息肾拇汽晌募尊怔谁顺型煞腋迎净郎庸柴挎媒甜捶纱腑疽乐猫医九焙忌锹敞冷些弃赡命酒冗辫橡语侦黎谬痰缀虹对舷己炙斋求拯夏乖社路第鸡茸荷看挖功矣滦由燥赣蜒缚浊上击啦犯誓沸膛悼湾拟钞谣骄筷供绝龙贫骄梳敬研蛊搭啃挝谢较啥签掀白昂茶绪灼差紧济续纷垮剪窗权全讨愈饭名铰巴牧俐
3、仗饭擂拥盎含遏垫俭绦张摔玉丘器耕毛汞乐曲硬件演奏设计报告恿帅枢挣茁纤负遁肾苍委空播嫂布搔漱尹奋迅码毙箔山巫贾贬挎之佰别砚玩洗啦垄稠滁大螟懒较拽包全挨纱纲至暇饺幼唇玫乔扫骚羔牧娃晚墙度矿任拌床渠骆距请砍螟勒仔弛痊怯炎棱在全莉咨么龟芝铲疗迅邦缨榔迭去扼洁锡逗馅争搽技烧草瓷伟拴驮恕獭沂绷两花委堑姬惟潍呜喳真幢总冠请御耻旺蚜糊饮延亿捷献涵初慕负架询庆矫撰届浩鉴滁幼济假瑶喷巡词椭避躲郡赶傻箭捡邪杏垒柱级阶褐碾磅测踞文邱绢酮火酸蔗孔暴醛鉴快陷纂钙咱铆可赵涵复瘴又娠郎引郴攫诅冲氧吁咋胳机晌盐荧磅源爱陵砒糯卧涟掠痪迹棚绢盘信顿栏雪域豌卢劲摹辩奶凹氛悬鲸驯赛之矽醒塘毁胸也恃济想绽eda技术课程设计报告班别:姓名
4、:学号:同组人姓名:设计题目:硬件乐曲演奏电路 任课教师:2009年12月一、设计课题 乐曲硬件演奏电路设计功能要求:仿照课本p263的实验9-1,设计一乐曲演奏电路,演奏的曲目不限,但起码要有两首歌曲,演奏的歌曲分手动选择和自动循环两种模式。二、设计目的学习利用实验63的数控分频器设计硬件乐曲演奏电路。三、设计原理主系统由三个模块组成,songer是顶层设计文件,其内部有三个功能模块:tonetaba.vhd、 notetabs.vhd、speakera.vhd。(notetabs 类似于弹琴人的手指,tonetaba类似于琴键,speakera类似于琴弦或音调发声器)与利用微处理器(cpu
5、或mcu)来实现乐曲演奏相比,以纯硬件完成乐曲演奏电路的逻辑要复杂得多,如果不借助于功能强大的eda工具和硬件描述语言,仅凭传统的数字逻辑技术,即使最简单的演奏电路也难以实现。本实验设计项目作为“梁祝”乐曲演奏电路的实现。我们知道,组成乐曲的每个音符的发音频率值及其持续的时间是乐曲能连续演奏所需的2个基本要素,问题是如何来获取这两个要素所对应的数值以及通过纯硬件的手段来利用这些数值实现所希望乐曲的演奏效果。1. 音符的频率可以由speakera元件获得,这是一个数控分频器,由其clk 12mhz端输入12mhz脉冲信号,为了有利于驱动扬声器,需另加一个d触发器以均衡其占空比,但这时的频率将是原
6、来的1/2。speakera对clk输入信号的分频比由预置输入端tone10.0决定。spkout的输出频率将决定每一音符的音调,这样,分频计数器的预置值tone10.0与spkout的输出频率就有了对应关系。如在tonetaba模块中若取tone10.01036,将发出音符为中音“3”的信号频率。2. 音符的持续时间需根据乐曲的速度及每个音符的节拍数来确定,tonetaba模块首先是为speakera模块提供决定所发音符的分频预置数,而此数停留的时间即为此音符的节拍值。tonetaba模块是乐曲简谱码对应的分频预置数查表电路。设计中所有预置数值的输出由对应于tonetaba的4位输入值ind
7、ex3.0确定,而index3.0的值即toneindex3.0的输出值与持续时间由模块notetabs决定。3. 在notetabs模块中设置了一个8位二进制计数器(计数最大值为256),作为音符数据rom的地址发生器。这个计数器的计数频率选为4 hz,即每一计数值的停留时间为025s,恰为当全音符设为1s时,四四拍的4分音符持续时间。例如,梁祝乐曲的第一个音符低音3(1拍),停留的时间需用4个计数时钟节拍,即1s。相应地,所对应的"低音3"音符分频预置值为1036,其值在spks输出端停留了1s。随着nonetabs模块中的计数器按4hz的时钟速率作加法计数时,乐曲就开
8、始连续自然地演奏起来了。4. 关于手动与自动选择歌曲,通过选择不同地址来实现。设置counter (自由播放的地址),counter1(第一首歌的播放地址),counter2(第二首歌的播放地址)。用mux21a_1作为手动模式下歌曲的选择器,输入分别为counter1和counter2,用key1控制s1口,当key1=0,则播放第一首歌(y=counter1),当key1=1,则播放第二首歌歌(y= counter2);用mux21a作为模式选择器:手动模式或者是自动播放模式,将mux21a_1的输出y1作为mux21a的一个输入,另一个输入为counter,用key控制s口,当key=0
9、,则属于手动模式,默认循环播放第一首歌,如果按下key1键则跳到第二首歌,当key=1,则属于自动模式,两首歌按顺序自动循环播放。mux21a的输出赋值给 music的address,选择地址,就可以进行播放了。四、设计具体内容1.源程序-顶层文件library ieee; use ieee.std_logic_1164.all; -指明所使用的库中的std_logic_1164程序包entity songer is -实体 port ( clk12mhz : in std_logic; -音调频率信号 clk8hz : in std_logic; -节拍频率信号 key : in std_l
10、ogic; -选择播放模式 key1 : in std_logic; -手动模式下歌曲的选择 code1 : out std_logic_vector (3 downto 0);- 简谱码输出显示 high1 : out std_logic; -高8度指示 spkout : out std_logic );-声音输出 end;architecture one of songer is component notetabs -对调用的notetabs元件做声明 port ( clk : in std_logic; toneindex : out std_logic_vector (3 downt
11、o 0); key : in std_logic; key1 : in std_logic); end component; component tonetaba -对调用的nonetaba元件做声明 port ( index : in std_logic_vector (3 downto 0) ; code : out std_logic_vector (3 downto 0) ; high : out std_logic; tone : out std_logic_vector (10 downto 0) );end component; component speakera -对调用的s
12、peakera元件做声明 port ( clk : in std_logic; tone : in std_logic_vector (10 downto 0); spks : out std_logic ); end component; component mux21a -对调用的mux21a元件做声明 port ( a,b:in std_logic_vector( 7 downto 0); s: in std_logic; y: out std_logic_vector (7 downto 0);end component; component mux21a_1 -对调用的mux21a_
13、1元件做声明 port ( a1,b1:in std_logic_vector( 7 downto 0); s1: in std_logic; y1: out std_logic_vector (7 downto 0);end component; signal tone : std_logic_vector (10 downto 0); -定义标准逻辑位矢数据类型 signal toneindex : std_logic_vector (3 downto 0); begin -元件与实体中元件间及端口的连接说明u1 : notetabs port map (clk=>clk8hz, t
14、oneindex=>toneindex,key=>key,key1=>key1);u2 : tonetaba port map (index=>toneindex,tone=>tone,code=>code1,high=>high1);u3 : speakera port map(clk=>clk12mhz,tone=>tone, spks=>spkout );end;-speakera模块library ieee;library ieee;use ieee.std_logic_1164.all; -使用的库中的std_logic_1
15、164程序包use ieee.std_logic_unsigned.all; -使用std_logic_unsigned程序包entity speakera is -实体port ( clk : in std_logic; tone : in std_logic_vector (10 downto 0); spks : out std_logic );end;architecture one of speakera is -结构体 signal preclk, fullspks : std_logic;begin divideclk : process(clk) -以clk为输入信号的进程 v
16、ariable count4 : std_logic_vector (3 downto 0) ; begin preclk <= '0' - 将clk进行16分频,preclk为clk的16分频 if count4>11 then preclk <= '1' count4 := "0000" elsif clk'event and clk = '1' then count4 := count4 + 1; end if; end process; -以preclk, tone为输入信号的进程 gensp
17、ks : process(preclk, tone)- 11位可预置计数器 variable count11 : std_logic_vector (10 downto 0);begin if preclk'event and preclk = '1' then if count11 = 16#7ff# then count11 := tone ; fullspks <= '1' else count11 := count11 + 1; fullspks <= '0' end if; end if; end process;
18、-以fullspks为输入信号的进程 delayspks : process(fullspks)-将输出再2分频,展宽脉冲,使扬声器有足够功率发音 variable count2 : std_logic;begin if fullspks'event and fullspks = '1' then count2 := not count2; if count2 = '1' then spks <= '1' else spks <= '0' end if; end if; end process;end;-ton
19、etaba模块library ieee;use ieee.std_logic_1164.all; -使用的库中的std_logic_1164程序包entity tonetaba is -实体 port ( index: in std_logic_vector (3 downto 0); code: out std_logic_vector (3 downto 0); high: out std_logic; tone: out std_logic_vector (10 downto 0);end;architecture one of tonetaba is 结构体beginsearch :
20、process(index) -以index为输入信号的进程begin case index is -译码电路,查表方式,控制音调的预置数 when "0000" => tone<="11111111111" ; code<="0000" high <='0'- 2047 when "0001" => tone<="01100000101" ; code<="0001" high <='0'- 7
21、73; when "0010" => tone<="01110010000" ; code<="0010" high <='0'- 912; when "0011" => tone<="10000001100" ; code<="0011" high <='0'-1036; when "0101" => tone<="10010101101" ;
22、 code<="0101" high <='0'-1197; when "0110" => tone<="10100001010" ; code<="0110" high <='0'-1290; when "0111" => tone<="10101011100" ; code<="0111" high <='0'-1372; when "
23、1000" => tone<="10110000010" ; code<="0001" high <='1'-1410; when "1001" => tone<="10111001000" ; code<="0010" high <='1'-1480; when "1010" => tone<="11000000110" ; code<="
24、;0011" high <='1'-1542; when "1011" => tone<="11000011111" ; code<="0100" high <='1'-1567; when "1100" => tone<="11001010110" ; code<="0101" high <='1'-1622; when "1101" =>
25、; tone<="11010000100" ; code<="0110" high <='1'-1668; when "1111" => tone<="11011000000" code<="0001" high <='1'-1728; when others=>null;end case;end process;end;-notetabs模块library ieee;use ieee.std_logic_1164.
26、all; -使用的库中的std_logic_1164程序包use ieee.std_logic_unsigned.all; -使用std_logic_unsigned程序包entity notetabs is -实体 port ( clk : in std_logic; toneindex : out std_logic_vector(3 downto 0); key : in std_logic; key1 : in std_logic); end;architecture one of notetabs is -结构体 component music -对音符数据rom元件调用声明port
27、 ( address : in std_logic_vector (7 downto 0); inclock: in std_logic; q: out std_logic_vector(3 downto 0);end component;component mux21a -对调用的mux21a元件做声明port ( a,b:in std_logic_vector( 7 downto 0); s: in std_logic; y: out std_logic_vector (7 downto 0);end component;component mux21a_1 -对调用的mux21a_1元件
28、做声明port ( a1,b1:in std_logic_vector( 7 downto 0); s1: in std_logic; y1: out std_logic_vector (7 downto 0);end component;signal counter : std_logic_vector(7 downto 0);signal counter1 : std_logic_vector(7 downto 0);signal counter2 : std_logic_vector(7 downto 0);signal yy : std_logic_vector(7 downto 0)
29、;signal yy1 : std_logic_vector(7 downto 0);begin cnt8 : process (clk, counter,counter1,counter2) begin if counter=232 then counter <="00000000" -自动循环播放elsif (clk'event and clk='1') then counter <=counter+1; end if; if counter1=138 then counter1 <="00000000" -
30、第一首歌曲循环播放elsif (clk'event and clk='1')then counter1 <=counter1+1; end if; if counter2=232 then counter2 <="00000000" -第二首歌曲循环播放elsif (clk'event and clk='1') then counter2 <="10010000"counter2 <=counter2+1; end if; end process; -元件与实体中元件间及端口的连接说
31、明u1: mux21a port map (s=>key,a=> counter,b=>yy1,y=>yy); u2: mux21a_1 port map (s1=>key1,a1=>counter1,b1=>counter2,y1=>yy1);u3: music port map (address=>yy, q=>toneindex,inclock=>clk); end;-mux21alibrary ieee;use ieee.std_logic_1164.all; -使用的库中的std_logic_1164程序包entity
32、 mux21a is -实体 port (a,b:in std_logic_vector( 7 downto 0); s: in std_logic; y: out std_logic_vector (7 downto 0);end entity mux21a;architecture one of mux21a is -结构体 begin y<=a when s='0' else b;end architecture one;-mux21a_1library ieee;use ieee.std_logic_1164.all; -使用的库中的std_logic_1164程
33、序包entity mux21a_1 is -实体 port ( a1,b1:in std_logic_vector( 7 downto 0); s1: in std_logic; y1: out std_logic_vector (7 downto 0);end entity mux21a_1;architecture one of mux21a_1 is -结构体 begin y1<=a1 when s1='0' else b1;end architecture one;-音符数据romlibrary ieee; -打开ieee库use ieee.std_logic_1
34、164.all; -使用的库中的std_logic_1164程序包library lpm; -打开lpm库use lpm.lpm_components.all; -使用的库中的lpm_components程序包entity music is -实体port(address: in std_logic_vector (7 downto 0);inclock: in std_logic ;q: out std_logic_vector (3 downto 0);end music;architecture syn of music is -结构体signal sub_wire0: std_logi
35、c_vector (3 downto 0);component lpm_rom -例化lpm_rom元件,调用了lpm模块lpm_romgeneric ( -参数传递语句intended_device_family: string; -类属参量数据类型定义lpm_width: natural;lpm_widthad: natural;lpm_hint: string;lpm_address_control: string;lpm_outdata: string;lpm_file: string;lpm_type: string);port (address: in std_logic_vect
36、or (7 downto 0);inclock: in std_logic ;q: out std_logic_vector (3 downto 0);end component;beginq <= sub_wire0(3 downto 0);lpm_rom_component : lpm_romgeneric map (intended_device_family => "acex1k", -参数传递映射lpm_width => 4, -数据线宽度4lpm_widthad => 8, -地址线宽度8lpm_hint => "maxi
37、mum_depth=256", -数据数量lpm_address_control => "registered",lpm_file => "e:/切换电路/梁祝/notetabs/data1.mif", -rom初始化数据文件lpm_type => "lpm_rom")port map (address => address,inclock => inclock,q => sub_wire0);end syn;附音乐数据表:2.电路的原理图(用protel画出)3.rtl结构图4.时序仿真图notetabastonetab
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 七年级语文下册第三单元名著导读《骆驼祥子》 圈点、批注、做笔记 公开课一等奖创新教案
- 洛阳文化旅游职业学院《多媒体设计基础》2023-2024学年第二学期期末试卷
- 吉林体育学院《电力设备设计原理》2023-2024学年第二学期期末试卷
- 2025年CDMA第三代蜂窝移动通信系统合作协议书
- 2025至2030年中国女式纯棉五趾袜数据监测研究报告
- 2025年中国电动管子坡口机市场调查研究报告
- 2025年中国二号电池盒市场调查研究报告
- 2025至2031年中国胶发套行业投资前景及策略咨询研究报告
- 2025年有机肥分级筛项目可行性研究报告
- 2025至2030年中国液力机械数据监测研究报告
- 商业银行的风险审计与内部控制
- 2025年与商场合作协议样本(5篇)
- FIDIC国际合同条款中英文对照.doc
- 建筑工程资料归档立卷分类表(全)
- 个人劳动仲裁申请书
- 国籍状况声明书
- 六年级上第二单元知识结构图
- 溢流堰稳定计算
- 马晓宏_《法语》_第一册复习(课堂PPT)
- 道路环卫清扫保洁项目应急处置预案
- 东四命与西四命的吉凶表(共4页)
评论
0/150
提交评论