Cov txheej txheem:

FPGA Reaction Game: 10 Kauj Ruam
FPGA Reaction Game: 10 Kauj Ruam

Video: FPGA Reaction Game: 10 Kauj Ruam

Video: FPGA Reaction Game: 10 Kauj Ruam
Video: Reaction timer DE10-Lite FPGA 2024, Hlis ntuj nqeg
Anonim
FPGA Reaction Game
FPGA Reaction Game

Los ntawm Lub Caij Ntuj Sov Rutherford thiab Regita Soetandar

Kauj ruam 1: Taw qhia

Rau peb qhov phiaj xwm zaum kawg rau CPE 133, peb tsim cov tshuaj tiv thaiv kev ua si hauv VHDL rau Pawg Basys3. Qhov kev ua si no tuaj yeem sib raug zoo tshaj plaws piv rau cov game arcade "Stacker" qhov twg cov neeg uas ua ntawv yuav tsum tso cov block rau lub sijhawm. Lub Rooj Tswjhwm Saib Basys3 txuas nrog lub khob cij, uas muaj cov LEDs sib txawv. Cov teeb LED no yuav hloov pauv ntawm qhov tshwj xeeb, nyob ntawm qib. Qhov kev ua si no siv lub moos sib faib thiab 4 tus lej 7 ntu tso saib, nrog rau lub xeev lub tshuab muaj qhov kawg. Thaum cov neeg ua si qhib qhov hloov pauv kom raug raws li qhov nruab nrab LED teeb, cov neeg uas ua ntawv yuav nce mus rau qib tom ntej ntawm qhov kev ua si, ua rau muaj qhov hloov pauv ntawm LEDs. Qhov no ua rau txhua qib ua tiav nyuaj dua qib yav dhau los. Thaum cov neeg ua si ntaus yeej qib 7, qib siab tshaj plaws, cov lus yuav tshwm ntawm ntu ntu thiab tag nrho cov LEDs yuav ib txhij nyem rau thiab tawm.

Kauj ruam 2: Cov ntaub ntawv

Khoom siv
Khoom siv
Khoom siv
Khoom siv
Khoom siv
Khoom siv

Cov ntaub ntawv uas koj yuav xav tau yog:

  • Digilent Basys3 board nrog micro USB cable
  • Cov qhob cij
  • 5 LEDs
  • 5 resistors (peb siv 220 ohms)
  • 11 jumper xov hlau
  • Khoos phis tawj nrog Vivado

Kauj Ruam 3: Daim Duab Sab Hauv Sab Hauv Sab Hauv

Sab saum toj Daim Duab Daim Npav Dub Tsim
Sab saum toj Daim Duab Daim Npav Dub Tsim
Sab saum toj Daim Duab Daim Npav Dub Tsim
Sab saum toj Daim Duab Daim Npav Dub Tsim

Raws li koj tuaj yeem pom, peb daim duab qhia sab saum toj theem pib los ntawm kev tau txais cov sijhawm teev los ntawm peb cov submodule, ClkDivide. Cov moos no yog cov tswv yim nkag mus rau ntau txoj hauv kev. Qhov tseem ceeb, qhov kev ua si yuav tsum lees paub tias thaum tus neeg siv hloov pauv qhov raug, lub LEDs yuav tsum pib hloov pauv sai dua thiab cov zaub xav tau nce mus rau ib qib. Daim duab kab thaiv yuav zoo li vwm me ntsis, tab sis qhov ntawd yog vim muaj ntau lub cim qhia uas tau tsim los hauv qee cov txheej txheem thiab tom qab ntawd lub teeb liab txhais lwm lub teeb liab hauv lwm cov txheej txheem thaiv.

Thaum kawg, tsuas yog cov tswv yim uas cov game siv yog lub moos nkag ntawm Basys3 pawg thawj coj uas khiav ntawm 100 Mhz, xya qhov hloov pauv ntawm Pawg Basys3, thiab khawm rov pib dua. Dab tsi yog tso tawm yog anode rau xya ntu ntu, xya ntu rau cov zaub, thiab LEDs.

Kauj ruam 4: CLKDivide

CLKDivide
CLKDivide
CLKDivide
CLKDivide
CLKDivide
CLKDivide

Lub moos faib faib submodule no tau tsim lub moos qeeb qeeb nyob ntawm tus nqi peb mapped rau nws hauv peb cov ntaub ntawv tseem ceeb. Peb siv cov submodule no los txiav txim Clk400, PushClk, thiab newlck. Qhov submodule no siv sijhawm ib teev thiab faib 32 ntsis raws li kev nkag. Lub moos qeeb tau tso tawm. Muaj cov txheej txheem thaiv rau tus faib thiab lub moos qeeb. Hauv cov txheej txheem yog qhov hloov pauv ib ntus, uas peb hu ua suav, uas suav ib qho ib zaug txhua lub sijhawm nce ntxiv ntawm lub moos nkag los raug. Thaum nws mus txog tus lej faib, lub moos qeeb toggled thiab suav rov pib dua rau xoom.

Kauj Ruam 5: Hloov Txheej Txheem

Ua Haujlwm Txheej Txheem
Ua Haujlwm Txheej Txheem

Cov txheej txheem Shift thaiv kev tswj hwm qhov hloov pauv thiab ceev ntawm LEDs. Hauv cov npe rhiab heev yog cov newclk thiab Stop signals. Nres ua rau ncua sijhawm luv luv thaum tus neeg siv dhau qib. Yog Nres tsis siab, ces cov LEDs hloov pauv ib txwm raws li qhov nrawm ntawm newclk. Qhov kev hloov pauv no raug tswj los ntawm ob qhov sib txawv: Taug qab thiab suav. Suav txiav txim siab tias LED yuav tsum nyob rau qhov twg, thaum Track txiav txim siab yog tias suav yuav tsum suav nrog lossis nce. Muaj lwm lub teeb liab, Qhov kawg, uas siv tau tsuas yog thaum Qib yog “111,” qhia tias tus neeg uas ua ntawv yeej qhov kev ua si. Qhov hloov pauv zaum kawg ntawm 0 thiab 1 txhua lub moos moos kom tig lub LEDs qhib thiab tsis tu ncua. Qhov no tsuas yog qhov pom kev pom rau qhov kawg tso saib.

Txoj kev hloov pauv no yog qhov chaw zoo tshaj los pib rau txoj haujlwm no. Yog tias koj tuaj yeem tau txais koj cov LEDs hloov pauv kom raug thiab xwm yeem, tom qab ntawd los ntawm no koj tsuas yog yuav tsum tau ntxiv tus cwj pwm thaum nce qib!

Kauj Ruam 6: Finite State Machine

Finite Xeev Tshuab
Finite Xeev Tshuab

Peb tsim Lub Xeev Lub Xeev Tshuab los txiav txim tus cwj pwm thaum hloov pauv lossis khawm rov pib dua. Txhua lub xeev yog "qib" thiab yog tias qhov kev hloov pauv rau lub sijhawm tsis raug lossis rov pib dua raug nias, qib rov qab mus rau "000." Txwv tsis pub, yog tias qhov hloov pauv tau raug xa mus rau qib nce mus txog thaum nws mus txog lub xeev kawg, "111" thiab cov lus xaus tshwm sim. FSM yog ua raws ob txheej txheem thaiv sync_proc thiab comb_proc. Sync_proc siv lub moos uas peb hu ua PushClk. Lub moos no tswj hwm sai npaum li cas lub xeev tom ntej dhau los ua lub xeev tam sim no. Lub moos no yuav tsum ceev heev; peb xaiv qhov nrawm uas yog kwv yees li ob zaug sai dua li peb qhov LED ceev tshaj plaws.

Peb tau siv txoj cai no siv FSM rau qib; txawm li cas los xij, tom qab txoj haujlwm no peb pom tau tias siv tau zoo dua ntawm FSM tej zaum yuav tau suav nrog lub xeev, rov kho lub xeev, lossis xeev nyob. Yog tias tsis muaj dab tsi raug nias, nws nyob hauv lub xeev nyob. Yog tias rov pib dua raug nias lossis tus neeg ua si tsis zoo, nws nyob hauv lub xeev pib dua. Yog tias raug nias, nws nyob hauv lub xeev suav. Muaj ntau txoj hauv kev los siv FSM hauv qhov kev ua si no ib yam nkaus!

Kauj Ruam 7: Kev Tswj Zaub Txheej Txheem Thaiv Nrog Qib

Tswj Zaub Txheej Txheem Thaiv Nrog Qib
Tswj Zaub Txheej Txheem Thaiv Nrog Qib

Theem tswj lub Zaub txheej txheem thaiv. Cov kev hloov pauv hauv cov npe rhiab heev yog Qib, Pib dua, thiab Clk400. Cov ntu 7 ntu pib los ntawm kev tso tawm '1' rau thawj qib. Nws suav txog 7 thaum txhua tus neeg siv dhau ib qib los qhia rau tus neeg siv tias lawv nyob qib twg. Thaum tus neeg siv tau dhau qib 7, nws qhia "COOL" kom qhia tau tias tus neeg siv tau yeej qhov kev ua si. Qhov "COOL" tso tawm ntawm 400 Hz moos uas peb hu ua Clk400. Yog tias rov pib dua, cov zaub rov qab mus rau "1."

Kauj Ruam 8: Tswj LED Ceev Nrog Qib

Tswj LED Ceev Nrog Qib
Tswj LED Ceev Nrog Qib

Thaum kawg, Qib tswj qhov nrawm ntawm LEDs. Theem yog lub teeb liab nkaus xwb hauv cov npe nkag siab. D1 yog lub teeb liab uas nkag mus rau hauv Clock Divider txheej txheem kom tau txais newclk. Txhua lub sijhawm hloov pauv, lossis lub xeev hloov pauv, txheej txheem thaiv "Ceev." Cov txheej txheem no txiav txim siab tus nqi ntawm D1. Muaj 8 qhov kev txiav txim siab tseem ceeb ntawm D1 uas peb tau xaiv raws qhov nrawm peb xav tau txhua qib kom khiav. D1 tau me dua txhua lub sijhawm qib nce kom cov newclk khiav nrawm dua.

Kauj ruam 9: Khoos phis tawj sib dhos

Khoos phis tawj sib dhos
Khoos phis tawj sib dhos

Peb txuas lub khob cij rau Basys3 nrog ib qho ntawm cov khoom sib txuas. Rau ntawm qhov chaw nres nkoj pmod tau siv los ntsaws tus txiv neej rau txiv neej txuas, ib qho rau hauv av thiab lwm qhov rau 5 LEDs. Peb kuj tau tso tus tiv thaiv rau txhua LED. Cov resistors no yog 220Ω thiab tiv thaiv cov LEDs los ntawm luv luv ncig thiab hlawv tawm. Txawm hais tias txhua tus LED muaj qee qhov tsis kam, qhov ua haujlwm tsis txaus los cuam tshuam qhov hluav taws xob los ntawm qhov chaw.

Kauj ruam 10: Muaj kev lom zem

Qhov kev ua si no yooj yim heev ua si. Tus neeg ua si pib ntawm txoj cai nyob deb hloov 1 ntawm pawg thawj coj, V17. Lawv yuav tsum tig qhov hloov pauv siab thaum nruab nrab LED qhib. Lawv mam li txav ib qho hloov mus rau sab laug thiab ua qhov qub! Yog tias tus neeg ua si ua rau qhov kawg, lawv yuav xaus rau ntawm qhov hloov thib xya, W14. Yog tias lawv yeej qhov kev ua si lawv tau pom qhov kev lom zem xaus qhov tso tawm tiag!

Ib yam yuav tsum nco ntsoov yog tias thaum tsim qhov kev ua si no qhov nrawm nrawm rau koj! Yog tias qhov nrawm peb tau xaiv tau qeeb dhau, xav tias ua kom nrawm dua thiab ua rau nws nyuaj dua! Kuj tseem tsis tau teev cov qib. Yog tias koj xav ua kom nws muaj ntau qib ntxiv, muaj kev hloov kho uas yuav tsum tau ua rau FSM thiab txheej txheem txheej txheem txiav txim siab los ntawm Qib, tab sis cov no yog kev hloov pauv yooj yim heev.

Peb kuj tau xaiv los siv cov hloov pauv ntawm lub rooj tsavxwm raws li cov neeg siv khoom siv, tab sis qhov no kuj tseem tuaj yeem ua tau nrog khawm ntawm Basys3 board; khawm yuav tshem tawm qhov xav tau kom rov pib dua cov hloov pauv txhua lub sijhawm tus neeg siv pib dua. Peb pib siv khawm, txawm li cas los xij qhov no ua rau yuam kev hauv kev txheeb xyuas qib vim tias nws yuav dhia ntau qib yog tias ob sab nce ntawm PushClk raug ntaus thaum lub khawm tau tuav cia.

Hauv qab no yog cov vis dis aus qhia yuav ua li cas, hla dhau thawj 4 qib, thiab qhov kawg tso tawm.

Cov ntaub ntawv tseem ceeb rau txoj haujlwm no suav nrog hauv qab no.

Qhov chaw

Basys3 siv phau ntawv

Kev tshoov siab rau txoj haujlwm - Arduino Stop It game

Pom zoo: