freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

eda課程設(shè)計--乒乓球游戲電路設(shè)計(雙打)-文庫吧

2025-01-01 04:54 本頁面


【正文】 21的數(shù)字,每個七段譯碼器需要芯片的7個輸出端口來控制,總共28個輸出端口。實體的設(shè)計如下:library ieee。use 。use 。use 。 //引用必要的庫函數(shù)和包集合entity pingponggame is 實體名為pingponggame port(reset:int std_logic。clk:int std_logic。startbutton:int std_logic。 開始游戲輸入端口serve:in std_logic_vector(1 to 2)。 發(fā)球輸入端口hit1,hit2,hit3,hit4 a,b:int std_logic。 甲乙和丙丁的擊球輸入端口控制8個發(fā)光二極管的輸出端口Llight:out std_logic_vector(1 to 8)。 score11,score12,score21,score22:out std_logic_vector(1 to 7)); 4個用于控制4個7段譯碼器的輸出端口end pingponggame。 狀態(tài)機(jī)編程實現(xiàn) 狀態(tài)機(jī)設(shè)置了7個狀態(tài),分別是waitserve, light1on, ballmoveto2, Allow24hit,light8on,ballmoveto1,和allow13hit它們代表的具體數(shù)值依次是0到6。在波形模擬圖中是用數(shù)值來表示狀態(tài)的。下圖是各狀態(tài)相互轉(zhuǎn)換的轉(zhuǎn)換圖: 在整個程序中,狀態(tài)機(jī)起的是中央控制器的作用,由它控制的信號來影響整個程序中的其他相關(guān)部分,如記分部分,發(fā)光二極管部分。乒乓球游戲機(jī)中有兩個計數(shù)器count1和count2,分別記憶甲乙和丙丁的得分,用發(fā)光二極管的輪流發(fā)光表示球的移動軌跡。狀態(tài)機(jī)的進(jìn)程如下: process(clk) clk作為敏感信號觸發(fā)進(jìn)程begin 進(jìn)程開始if reset=39。139。 then 異步置位i=0。count100000。count2=00000。a=0。b=0。elsif clk39。event and clk=39。139。 then 當(dāng)處于時鐘inclock上升沿時 if count1=10101or count2=10101theni=0。count100000。count2=00000。elsif startbutton+39。039。 theni=0。count100000。count2=00000。else 以下case語句是程序中最關(guān)鍵的狀態(tài)機(jī)部分case state iswhen waitserve= 進(jìn)程處于等待發(fā)球狀態(tài)case serve iswhen 00”or”01”= i=1。state=light1on。when 10”or”11”= i=8。state=light8on。when others= i=0。end case。when light1on= 進(jìn)程處于第一盞燈亮狀態(tài)i=2if (hit2=’1’) or (hit4=39。139。 ) theni=0。count1=count1+1。state=waitserve。 elsestate=ballmoveto2。end if。when light8on= 進(jìn)程處于第八盞燈亮狀態(tài)i=7。if (hit1=’1’) or (hit3=’1’) theni=0。count2=count2+1。state=waitserve。elsestate=ballmoveto1。end if。 when ballmoveto1= 進(jìn)程處于球向丙丁移動狀態(tài)if (hit1=39。1’) or ( hit3=39。1’) theni=0。count2=count2+1。state=waitserve。elsif i=2 then i=1。state=(allow1hit or allow3hit)。else i=i1。end if。when ballmoveto2= 進(jìn)程處于球向甲乙移動狀態(tài)if (hit2=’1’) or (hit4=39。139。) theni=0。ount1=count1+1。state=waitserve。elsif i=7 then i=8。state=(allow2hit or allow4hit)。else i=i+1。end if。when (allow1hit or allow3hit)= 進(jìn)程處于允許甲或乙擊球狀態(tài)if (hit1=39。139。) and (a=’0’)then i=2。state=ballmoveto2。a=’1’。elsif (hit3=39。139。) and (a=’1’) then i=2。state=ballmoveto2。a=’0’。else count2=count2+1。i=0。state=waitserve。end if。when (allow2hit or allow4hit)= 進(jìn)程處于允許丙或丁擊球狀態(tài)if (hit2 =39。139。) and (a=39。0’) then i=7。state=ballmoveto1。a=’1’。elsif (hit4=39。139。) and (a=’1’) then i=2。state=ballmoveto2。a=’0’。else count1=count1+1。i=0。state=waitserve。end if。end case。end if。end if。end process。 記分譯碼器的設(shè)計七段譯碼器是在數(shù)學(xué)電路設(shè)計中經(jīng)常用到的顯示電路。所謂七段譯碼器,其實是由7段發(fā)光二極管組成的用于顯示數(shù)字的器件。記分譯碼器(mydecoder):由于記分需要顯示出來,所以要使用七段譯碼器。而狀態(tài)機(jī)中的記分是由5位二進(jìn)制碼來表示的,即count1和count2。以下程序就是實現(xiàn)從5位二進(jìn)制碼轉(zhuǎn)換成七段譯碼顯示。library ieee。use 。use 。use 。 entity mudecoder isport(binaryin:int std_logic_vector(1 to 5)。 5位二進(jìn)制碼的輸入端口bcdout1:out std_logic_vector(1 to 7)。 七段譯碼器輸出端口bcdout2:out std_logic_vector(1 to 7))。end mydecoder。architecture m of mydecoder issignal tembinaryin:std_logic_vector(1 to 5)。beginprocess(
點擊復(fù)制文檔內(nèi)容
環(huán)評公示相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1