电子科技大学电子设计自动化EDA实验报告

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

EDA实验报告

一、设计思路

这个实验的最终成品是利用无缘蜂鸣器发出频率不断变小的声音,表现为音调不断下降,就像是飞机被击落的音调。设计初期是想令发声器发出不同的音调,但是如果要编程歌曲比较困难。于是考虑通过循环改变分频系数来进行变频,首先对时钟进行第一次分频,设置成周期为1ms的分频;然后设置分频循环为16到256,每1ms改变一次分频数;另开一个分频按16到256进行分频了,第三分频的最高位进行输出。仿真过程没有问题,下载时发声不能,复位指示灯显示正常,跳频指示灯不闪烁。上网查无源发生器的发生频率在1k到4k之间,而16到256分频是132k到2.11M,频率过大无法发声。因此改为从8192分频到32768分频,为了编程方便在第二分频加八位,第一分频减八位,因此总的发声循环不发生改变,同时降低输出频率。

最终结果成功!

二、编程源码

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

use IEEE.STD_LOGIC_ARITH.ALL;

use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity sound is

port (clk,clr:in std_logic;

output,light1,run:out std_logic);

end sound;

architecture rtl_sound of sound is

signal cnt:std_logic_vector(12 downto 0);

signal spt:std_logic_vector(13 downto 0);

signal snd:std_logic_vector(12 downto 0);

signal ver:std_logic;

begin

process(clk,clr)

begin

if(clr='0')then

spt<="10011101111001";

elsif(rising_edge(clk))then

if(spt="00000000000000")then

spt<="10011101111001";

else

spt<=spt+"11111111111111";

end if;

end if;

end process;

process(spt(13),clk,clr)

begin

if(clr='0')then

cnt<="0000111111111";

elsif(rising_edge(spt(13)))then

if(cnt="1111111111111")then

cnt<="0000111111111";

else

cnt<=cnt+"0000000000001";

end if;

end if;

end process;

process(clk,clr)

begin

if(clr='0')then

snd<=cnt;

ver<='1';

elsif(rising_edge(clk))then

if(snd="0000000000000")then

snd<=cnt;

ver<=not ver;

else

snd<=snd+"1111111111111";

end if;

end if;

end process;

output<=ver;

run<=clr;

light1<=cnt(12);

end rtl_sound;

三、仿真结果

可以看到输出的频率越来越小,对应发生音调越来越低图示cnt为此状态应分频数(count),spt为第一分频(seperate),snd为按照cnt的数目进行分频,ver取snd的最高位。

四、最终结果

I M G_2159.M O V

。或者见于附件的视频

相关文档
最新文档