【正文】
53:12。 51: 6。 49: 8。 47:10。 45:10。 43:12。 41:12。 39:13。 37:12。 35:10。 33:10。 31:13。 29:13。 27:13。 25:13。 23:12。 21:13。 19:15。 17:15。 15:12。 13:12。 11:10。 09:10。 07:12。 05:13。 03:13。 01:13。 DATA_RADIX=DEC。 DEPTH=256。end。137:0。135:5。133:5。131:5。129:5。127:8。125:5。123:5。121:8。119:8。117:8。115:3。113:3。111:5。109:8。107:9。105:9。103:10。101:12。99:9。97:8。95:6。93:6。91:6。89:6。87:9。85:6。83:3。81:5。79:5。77:5。75:5。73:8。71:9。69:7。67:12。65:10。63:5。61:5。59:5。57:5。55:8。53:5。51:8。49:3。47:9。45:8。43:6。41:5。39:6。37:7。35:10。33:9。31:0。29:9。27:9。25:9。23:12。21: 12。19: 15。17: 12。15: 5。13: 8。11: 9。09: 8。07: 6。05: 5。03: 3。01: 3。data_radix = dec。depth = 256。(3)波形圖(4)波形分析由波形圖分析,當(dāng)tone給出不同的分頻預(yù)置數(shù),觀察到分頻效果是正確的,因此該模塊的功能符合設(shè)計(jì)要求。 end process。 end if。 else spks =39。 then spks =39。 if count2 =39。139。begin if fullspks39。 end process。 end if。 fullspks = 39。139。 then if count11 =167ff then count11 := tone 。event and preclk = 39。 genspks : process(preclk, tone) variable count11 : std_logic_vector(10 downto 0)。 end if。139。 elsif clk39。139。039。begin divideclk : process(clk) variable count4 : std_logic_vector (3 downto 0)。end。 tone : in std_logic_vector(10 downto 0)。use 。(1)模塊圖像(2)程序:library ieee。Spkout的輸出頻率將決定每一音符的音調(diào),這樣,分頻計(jì)數(shù)器的預(yù)制值tone與spkout的輸出頻率,就有了對(duì)應(yīng)關(guān)系。由其CLK端輸入一具有較高頻率(這里是12HZ)的信號(hào),通過(guò)speakera分頻后由spkout輸出,由于直接從數(shù)控分頻器中出來(lái)的輸出信號(hào)是脈寬極窄的脈沖式信號(hào),為了有利于驅(qū)動(dòng)揚(yáng)聲器,需另加一個(gè)D觸發(fā)器以均衡其占空比,但這時(shí)的頻率將是原來(lái)的一半。(3)波形圖(4)波形分析從波形圖可看出,當(dāng)輸入信號(hào)為00010,輸出為中音2,查預(yù)置初值,發(fā)現(xiàn)完全正確,因此該模塊功能正確。end process。when others =null。high=39。 When 10101=tone=11101011010。high=39。 When 10100=tone=11101000110。high=39。 When 10011=tone=11100101111。high=39。 When 10010=tone=11100010110。high=39。 When 10001=tone=11100000111。high=39。 When 10000=tone=11011101010。high=39。 When 01111=tone=11011000000。high=39。 When 01110=tone=11010110101。high=39。 When 01101=tone=11010000100。high=39。 When 01100=tone=11001010110。high=39。 When 01011=tone=11000101000。high=39。 When 01010=tone=11000000110。high=39。 When 01001=tone=10111001000。high=39。 When 01000=tone=10110000010。high=39。 When 00111=tone=10101011100。high=39。 When 00110=tone=10100001010。high=39。 When 00101=tone=10010101101。high=39。 When 00100=tone=10000110101。high=39。 When 00011=tone=10000001100。high=39。 When 000