【正文】
end one。 end case。 when others =D1=conv_std_logic_vector(0,4)。 when 1857 = D1=conv_std_logic_vector(2,4)。 when 1834 = D1=conv_std_logic_vector(2,4)。 when 1808 = D1=conv_std_logic_vector(2,4)。 when 1779 = D1=conv_std_logic_vector(2,4)。 when 1763 = D1=conv_std_logic_vector(2,4)。 when 1728 = D1=conv_std_logic_vector(2,4)。 when 1689 = D1=conv_std_logic_vector(2,4)。 when 1667 = D1=conv_std_logic_vector(1,4)。 when 1621 = D1=conv_std_logic_vector(1,4)。 when 1569 = D1=conv_std_logic_vector(1,4)。 when 1510 = D1=conv_std_logic_vector(1,4)。 when 1478 = D1=conv_std_logic_vector(1,4)。 when 1409 = D1=conv_std_logic_vector(1,4)。 when 1342 = D1=conv_std_logic_vector(1,4)。 when 1288 = D1=conv_std_logic_vector(0,4)。 when 1195 = D1=conv_std_logic_vector(0,4)。 when 1090 = D1=conv_std_logic_vector(0,4)。 when 973 = D1=conv_std_logic_vector(0,4)。 when 909 = D1=conv_std_logic_vector(0,4)。 when 770 = D1=conv_std_logic_vector(0,4)。 architecture one of decoder is begin process(tone_code) begin case conv_integer(tone_code) is when 612 = D1=conv_std_logic_vector(0,4)。 D0:out std_logic_vector(3 downto 0))。 entity decoder is 沈陽工程學院課程設計 22 port( tone_code:in std_logic_vector(10 downto 0)。 use 。 數(shù)碼管譯碼模塊 library ieee。 u1:rom port map(address = counter,q=tone,inclock=clk)。如果為手動模式,則讓出總線的控制權(quán) end if。 end if。 when others=Toneindex=conv_std_logic_vector(2047,11)。 when 26 = Toneindex=conv_std_logic_vector(1834,11)。 when 24 = Toneindex=conv_std_logic_vector(1779,11)。 when 22 = Toneindex=conv_std_logic_vector(1728,11)。 when 17 = Toneindex=conv_std_logic_vector(1667,11)。 when 15 = Toneindex=conv_std_logic_vector(1569,11)。 when 13 = Toneindex=conv_std_logic_vector(1478,11)。 when 11 = Toneindex=conv_std_logic_vector(1342,11)。 when 6 = Toneindex=conv_std_logic_vector(1195,11)。 when 4 = Toneindex=conv_std_logic_vector(973,11)。 when 2 = Toneindex=conv_std_logic_vector(770,11)。 then Toneindex=conv_std_logic_vector(2047,11)。 then判斷自動 /手動模式 if pause =39。 decoder:process(tone)從 rom 取出數(shù)據(jù)進行譯碼,作為下一級的輸入 begin if auto = 39。 end if。 when others=null。 then counter=111111111。if counter(8)= 39。end if。039。 when 10= counter = counter+1。 then counter=011111111。if counter(8)= 39。end if。139。) then case temp is when 00= counter = counter+1。event and clk = 39。 back。 輸出音符 signal temp :std_logic_vector(1 downto 0)。 聲明 ROM 模塊 signal counter: std_logic_vector(8 downto 0)。 q : out std_logic_vector(4 downto 0))。 architecture one of notetabs is ponent rom port(address : in std_logic_vector(8 downto 0)。 Toneindex : out std_logic_vector(10 downto 0))。 USE 。 沈陽工程學院課程設計 20 use 。 end。 end process。譯碼, Toneindex 為分頻器的初值 else Toneindex =ZZZZZZZZZZZ。 end case。 when 27 = Toneindex=conv_std_logic_vector(1857,11)。 when 25 = Toneindex=conv_std_logic_vector(1808,11)。 when 23 = Toneindex=conv_std_logic_vector(1763,11)。 when 21 = Toneindex=conv_std_logic_vector(1689,11)。 when 16 = Toneindex=conv_std_logic_vector(1621,11)。 when 14 = Toneindex=conv_std_logic_vector(1510,11)。 when 12 = Toneindex=conv_std_logic_vector(1409,11)。 when 7 = Toneindex=conv_std_logic_vector(1288,11)。 when 5 = Toneindex=conv_std_logic_vector(1090,11)。 when 3 = Toneindex=conv_std_logic_vector(909,11)。判斷暫停,阻止暫停時的噪聲 else case conv_integer(tone) is when 1 = Toneindex=conv_std_logic_vector(612,11)。139。139。 end process。判斷最高位,決定切換歌曲以及歌曲的循環(huán) end case。end if。039。 when 11= counter = counter1。 then counter=100000000。if counter(8)= 39。end if。139。 when 01= counter = counter1。 then counter=000000000。if counter(8)= 39。139。輸入狀態(tài) if (clk39。 begin t8 : process(clk) begin temp = song amp。地址發(fā)生器, 512 位 signal tone :std_logic_vector(4 downto 0)。 end ponent。 inclock : in std_logic。 end entity。 entity notetabs is port( clk,auto,back,song,pause: in std_logic。 use 。 自動演奏模塊 library ieee。 end process P2。 end if。 else fout = 39。139。139。 then t := not t。event and full = 39。 P2: process(full) variable t : std_logic。 end if 。039。 同時是使溢出標志信號 full 輸出為高電平 else t2 := t2 + 1。 D 被同步預置給計數(shù)器 t8 full = 39。139。 begin if clk39。 architecture one of DVF is signal full : std_logic。 輸入控制端