【正文】
i=0。039。 elsei=i+1。 count1=count1+1。 end if。 elsifi=2 then i=1。039。乙得一分 state=waitserve。 if hit1_en=39。甲得一分 state=waitserve。 if hit2_en=39。 elsei=6。 else 以下 case 語(yǔ)句是程序中最關(guān)鍵的狀態(tài)機(jī)部分 case state is when waitserve= 進(jìn)程處于等待發(fā)球狀態(tài) if serve=39。 count2=00000。 具體實(shí)現(xiàn)代碼如下: process(clk1,reset) clk 作為敏感信號(hào)觸發(fā)進(jìn)程 begin 進(jìn)程開(kāi)始 if reset=39。首先考慮輸入端口,一般都應(yīng)該設(shè)置一個(gè)異步置位端口 Reset,用于在系統(tǒng)不正常時(shí)回到初始狀態(tài);兩個(gè)發(fā)球輸入端 StartA, StartB,邏輯‘ 1’分別表示甲方和乙方的發(fā)球;兩個(gè)擊球輸入端 Hit1 和 Hit2,邏輯‘ 1’分別表示甲擊球和乙擊球;一個(gè)開(kāi)始游戲按鈕 startbutton,處于邏輯‘ 1’表示可以游戲;還得有一個(gè)時(shí)鐘輸入端口 clk。 4 21 分為一局,甲、乙雙方都應(yīng)設(shè)置各自的記分牌,任何一方先記滿 21 分,該方就算勝出。要求如下: 、乙雙方各在不同的位置發(fā)球或擊球。當(dāng)球過(guò)網(wǎng)后按照設(shè)計(jì)者規(guī)定的球位乙方就可以擊球。在游戲機(jī)的兩側(cè)各設(shè)置發(fā)球和擊球開(kāi)關(guān), (一個(gè)是發(fā)球開(kāi)關(guān) StartA, StartB。 完成可編程器件與 VHDL 語(yǔ)言課程設(shè)計(jì),掌握設(shè)計(jì)語(yǔ)言技術(shù)的綜合應(yīng)用性。 GW48。 本文設(shè)計(jì)一個(gè)基于 VHDL的乒乓游戲機(jī)模擬乒乓球比賽 。 VHDL是高速集成電路硬件描述語(yǔ)言,目前已成為許多設(shè)計(jì)自動(dòng)化工具普遍采用的標(biāo)準(zhǔn)化硬件描述語(yǔ)言. VHDL 語(yǔ)言功能性強(qiáng)、覆蓋面廣、靈活性高,具有很好的實(shí)用。 關(guān)鍵詞: VHDL; GW48;乒乓游戲機(jī) Abstract Table tennis simulation game using VHDL programming, circuit module is posed of state machine, marker, decoding display parts, each part of the preparation of the VHDL algorithm, pile, simulation, logic synthesis, logic adapter and program planted. Through experimental verification box type GW48 EDA, table tennis tour basic process and rules of play of function simulation table tennis petition, and can automatically judge and score. VHDL is a high speed integrated circuit hardware description language, has now bee the standard is widely used in many design automation tools, hardware description language function is strong, wide coverage, high flexibility, practicability is very good. A table tennis match simulation table tennis game machine based on VHDL is designed in this paper. Design is the difficulty of state machine. And the simulation, the simulation waveform, a plete program can be written with chip, peripheral ponents, to achieve the function of table tennis game machine. Keywords: VHDL。 在成功掌握軟件操作基礎(chǔ)上,將所學(xué)數(shù)字電路的基礎(chǔ)課知識(shí)與 VHDL 語(yǔ)言的應(yīng)用型知識(shí)結(jié)合起來(lái)并與實(shí)際設(shè)計(jì),操作聯(lián)系起來(lái),即 “ 理論聯(lián)系實(shí)際 ” 的觀點(diǎn)。 第二章 課程設(shè)計(jì)的內(nèi)容 課程設(shè)計(jì)的簡(jiǎn)要說(shuō)明 兩人乒乓球游戲機(jī)是用 9 個(gè)發(fā)光二級(jí)管代表乒乓球臺(tái),中間一個(gè)發(fā)光二極管兼做乒乓球網(wǎng),用點(diǎn)亮的發(fā)光二極管按一定方向移動(dòng)來(lái)表