【正文】
23。end process。D0=conv_std_logic_vector(0,4)。D0=conv_std_logic_vector(7,4)。D0=conv_std_logic_vector(6,4)。D0=conv_std_logic_vector(5,4)。D0=conv_std_logic_vector(4,4)。D0=conv_std_logic_vector(3,4)。D0=conv_std_logic_vector(2,4)。D0=conv_std_logic_vector(1,4)。D0=conv_std_logic_vector(7,4)。D0=conv_std_logic_vector(6,4)。D0=conv_std_logic_vector(5,4)。D0=conv_std_logic_vector(4,4)。D0=conv_std_logic_vector(3,4)。D0=conv_std_logic_vector(2,4)。D0=conv_std_logic_vector(1,4)。D0=conv_std_logic_vector(7,4)。D0=conv_std_logic_vector(6,4)。D0=conv_std_logic_vector(5,4)。D0=conv_std_logic_vector(4,4)。D0=conv_std_logic_vector(3,4)。D0=conv_std_logic_vector(2,4)。D0=conv_std_logic_vector(1,4)。end entity。 D1:out std_logic_vector(3 downto 0)。USE 。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)。判斷暫停,阻止暫停時(shí)的噪聲 elsecase 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。begint8 : 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 。數(shù)控分頻模塊library ieee。 u1:rom port map(address = counter,q=tone,inclock=clk)。如果為手動(dòng)模式,則讓出總線的控制權(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判斷自動(dòng)/手動(dòng)模式 if pause =39。decoder:process(tone)從rom取出數(shù)據(jù)進(jìn)行譯碼,作為下一級(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 。use 。end one。 e