【正文】
:out std_logic)。architecture Behavioral of top isponent automusicPort ( clk :in std_logic。 index2:in std_logic_vector(7 downto 0)。 end ponent。 code : out std_logic_vector(6 downto 0)。 tone0 : out integer range 0 to 2047)。ponent speakerPort ( clk1 : in std_logic。spks : out std_logic)。signal tone2: integer range 0 to 2047。beginu0:automusic port map(clk=clk32MHZ,index2=index1,index0=indx,Auto=handtoAuto)。u2: speaker port map(clk1=clk32MHZ,tone1=tone2,spks=spkout)。(2)仿真。功能:library IEEE。use 。entity tone isPort ( index : in std_logic_vector(7 downto 0)。 音符顯示信號(hào)high : out std_logic。 音符的分頻系數(shù)end tone。code=1001111。139。code=0010010。139。code=0000110。139。code=1001100。139。code=0100100。139。code=0100000。039。code=0001111。039。code=0000000。039。code=0000001。039。end process。(2)音階發(fā)生器程序仿真。功 能:實(shí)現(xiàn)數(shù)控分頻。library IEEE。use 。entity speaker isPort ( clk1 : in std_logic。 音符分頻系數(shù)spks : out std_logic)。architecture Behavioral of speaker issignal preclk,fullspks:std_logic。beginif clk139。139。if count=2 then preclk=39。 elsif count=4 then preclk=39。count:=0。 end if。genspks:process(preclk,tone1) 此進(jìn)程按照tone1輸入的分頻系數(shù)對(duì)8MHz的脈沖再次分