D08 - Getting Started With DE2 and VHDL 28Aug

download D08 - Getting Started With DE2 and VHDL 28Aug

of 12

Transcript of D08 - Getting Started With DE2 and VHDL 28Aug

  • 8/11/2019 D08 - Getting Started With DE2 and VHDL 28Aug

    1/12

    D08 Getting Started with DE2 Development Board (VHDL)

    D08 - Getting Started with DE2 Development Board VHDL

    ! E"#ipment1. Altera DE2 Development board (equipped with Cyclone II EP2C35F !2C FP"A#2. $%& Cable3.

    'equired File ()ound on blac*board#a+ tut,quartu ,intro,vhdl+pd) b+ DE2,pin,a i-nment +c vc+ DE2,$ er.anual+pd) (a a re)erence#d+ tut,initialDE2+pd) (a a re)erence#

    4. Altera /uarta II 0eb Edition 9.0sp2

    2! Ba$%gro#nd &n'ormation1 he DE2 board )eature a power)ul Cyclone ' II FP"A chip+ All important component

    on the board are connected to the pin o) thi chip allowin- the u er to con4-urethe connection between the variou component a de ired+ For implee periment the DE2 board include a u6cient number o) witche (o) both to--leand pu hbutton variety# 7ED and !8 e-ment di play + For more advancede periment there are %'A. %D'A. and Fla h memory chip a well a a 9 x 2character di play+ For e periment that require a proce or and imple I:;inter)ace it i ea y to in tantiate Altera< =io II proce or and u e inter)ace

    tandard uch a '%8232 and P%:2+ For e periment that involve ound or videoi-nal there are tandard connector provided on the board+ For lar-e de i-n

    pro>ect it i po ible to u e $%& and Ethernet connection a well a the %Dmemory card+ Finally it i po ible to connect other u er8de i-ned board to theDE2 board by mean o) two e pan ion header +? @9

    ! E periment *verview9+ "ettin- %tarted In /uartu II2+ In tallation o) the $%&8&la ter Driver (u ed to communicate with the DE2 &oard#3+ Compile %imulate and Pro-ram your 4r t B D7 Pro>ect

    + Per)orm 7aboratory E erci e

    +evi,ed .#l/ 200 1age 2

  • 8/11/2019 D08 - Getting Started With DE2 and VHDL 28Aug

    2/12

    D08 Getting Started with DE2 Development Board (VHDL)

    3! 1ro$ed#re

    4.1 Installation of USB-Blaster Driver Plu- in the 8volt adapter to provide power to the board+ $ e the $%& cable to connectthe le)tmo t $%& connector (the one clo e t to the power witch# on the DE2 board to a$%& port on a computer that run the /uartu II o)tware+ urn on the power witch on

    the DE2 board (red#+ he computer will reco-ni e the new hardware connected to it $%& port but it will beunable to proceed i) it doe not have the required driver already in talled+ he DE2board i pro-rammed by u in- Altera< $%&8&la ter mechani m+ I) the $%&8&la terdriver i not already in talled the =ew ardware 0i ard in Fi-ure 9 will appear+

    %ince the de ired driver i not available on the 0indow $pdate 0eb ite elect No, notthis time in re pon e to the que tion a *ed and clic* Next + hi lead to the window inFi-ure 2+

    +evi,ed .#l/ 200 1age 2 2

  • 8/11/2019 D08 - Getting Started With DE2 and VHDL 28Aug

    3/12

    D08 Getting Started with DE2 Development Board (VHDL)

    he driver i available within the /uartu II o)tware+ ence elect Install from a specificlocation and clic* Next to -et to Fi-ure 3+

    =ow choo e Search for the best driver in these locations and clic* Browse to -et to the pop8up bo to 4nd the )older+ At thi point the in tallation will commence but a dialo- bowillappear indicatin- that the driver ha not pa ed the 0indow 7o-o te tin-+ Clic*Continue Anyway +

    +evi,ed .#l/ 200 1age 2

  • 8/11/2019 D08 - Getting Started With DE2 and VHDL 28Aug

    4/12

    D08 Getting Started with DE2 Development Board (VHDL)

    he driver will now be in talled+ Clic* Finish and you can tart u in- the DE2 board+ urnthe device oG until you pro-ram the FP"A+

    +evi,ed .#l/ 200 1age 3 2

  • 8/11/2019 D08 - Getting Started With DE2 and VHDL 28Aug

    5/12

    D08 Getting Started with DE2 Development Board (VHDL)

    4.2 Getting Started In Quartus II Each lo-ic circuit or ubcircuit bein- de i-ned with /uartu II o)tware i called a

    project + he o)tware wor* on one pro>ect at a time and *eep all in)ormation )or thatpro>ect in a in-le directory ()older# in the 4le y tem+

    1 Create a directory to hold your pro>ect< 4le +! %tart the /uartu II o)tware+

    " %elect File H New #ro$ect %i&ard thi open a dialo- which indicate the capabilityo) thi wi ard+ Pre Next

    ' %et the wor*in- directory to be the directory you created in tep 9 or enter a new)older and the wi ard will create the directory )or you+ he pro>ect mu t have aname which i u ually the ame a the top8level de i-n entity that will beincluded in the pro>ect+ Choo e light a the name )or both the pro>ect and the top8level entity+ Pre Next +

    ( he wi ard ma*e it ea y to peci)y which e i tin- 4le (i) any# hould beincluded in the pro>ect+ A umin- that we do not have any e i tin- 4le clic*

    Next +) 0e have to peci)y the type o) device in which the de i-ned circuit will be

    implemented+ Choo e Cyclone II a the tar-et device )amily+ 0e can let /uartu IIo)tware elect a peci4c device in the )amily or we can choo e the device

    e plicitly+ 0e will ta*e the latter approach+ From the li t o) available devicechoo e the device called EP2C35F672C6 which i the FP"A u ed on Altera< DE2board+ Pre Next +

    * %ince we will rely olely on /uartu II tool we will not choo e any other 3 rd partytool + Pre Next +

    + A ummary o) the cho en ettin- appear in the creen+ Pre Finish whichreturn to the main /uartu II window but with light peci4ed a the new pro>ectin the di play title bar+

    4.3 Compile Simulate and !rogram "our first #$D% !ro&e't Prep:

    9+ 'ead throu-h the tutorial tut_quartus_intro_vhdl.pdf available on blac*board+In Lab:

    9+ Continue the 4le tut_quartus_intro_vhdl.pdf )rom ection 3 (pa-e #+ =ote he tutorial wa written u in- /uartu II ver ion J+ I) prep ha been done thi ection will not ta*e lon- in the lab+ Doin- thi ection thorou-hly will help you with under tandin- and -ive you

    the ba ic *ill to u e /uartu II e6ciently+Summary

    Copy -iven B D7 into created pro>ect (pa-e 9K# Compile B D7 (pa-e 93# 7earn how to handle ynta error in B D7 (pa-e 9 895# Per)orm manual pin a i-nment (pa-e 9589 #

    +evi,ed .#l/ 200 1age 4 2

  • 8/11/2019 D08 - Getting Started With DE2 and VHDL 28Aug

    6/12

    D08 Getting Started with DE2 Development Board (VHDL)

    Per)orm pin a i-nment )rom +c v 4le (pa-e 9!89J# Important %imulate B D7 (pa-e 9 823# Pro-ram the FP"A Device (pa-e 2 82 #

    +evi,ed .#l/ 200 1age 5 2

  • 8/11/2019 D08 - Getting Started With DE2 and VHDL 28Aug

    7/12

    D08 Getting Started with DE2 Development Board (VHDL)

    4.4 !erform %a(orator" )*er'ises he purpo e o) thi e erci e i to learn how to connect imple input and output deviceto an FP"A chip and implement a circuit that u e the e device + 0e will u e the

    witche %09!LK on the DE2 board a input to the circuit+ 0e will u e li-ht emittin-diode (7ED # and !8 e-ment di play a output device + $ e !"# pro-rammin- )orthe remainder o) the laboratory+

    3!3! E er$i,e Prep:

    he DE2 board provide 9J to--le witche called SW 9! K that can be u ed a input toa circuit and 9J red li-ht called LEDR9! K that can be u ed to di play output value +Fi-ure 9 how a imple B D7 entity that u e the e witche and how their tate onthe 7ED + %ince there are 9J witche and li-ht it i convenient to repre ent them aarray in the B D7 code a hown+ 0e have u ed a in-le a i-nment tatement )or all9J LEDR output which i equivalent to the individual a i-nment

    7ED'(9!# < M %0(9!#N7ED'(9 # < M %0(9 #N

    . . .7ED'(K# < M %0(K#N

    he DE2 board ha hardwired connection between it FP"A chip and the witche andli-ht + o u e SW 9! K and LEDR9! K it i nece ary to include in your /uartu II pro>ect thecorrect pin a i-nment which are -iven in the DE2 ser !anual + For e ample themanual peci4e that SW K i connected to the FP"A pin "2# and LEDRK i connected topin $E2% + A -ood way to ma*e the required pin a i-nment i to import into the/uartu II o)tware the 4le called DE2 pin assign&ents.csv ( ee blac*board# which i

    provided on the DE2 S'ste& (D and in the $niver ity Pro-ram ection o) Altera< webite+ he procedure )or ma*in- pin a i-nment i de cribed in the tutorial )uartus ***ntroduction using +,DL Design which i al o available )rom Altera+ It i important toreali e that the pin a i-nment in the DE2 pin assign&ents.csv 4le are u e)ul only i)the pin name -iven in the 4le are e actly the ame a the port name u ed in yourB D7 entity+ he 4le u e the name SW @K. . . SW @9! and LEDR@K. . . LEDR @9! )orthe witche and li-ht which i the rea on we u ed the e name in Fi-ure 9 (note thatthe /uartu II o)tware u e @ quare brac*et )or array element while the B D7

    ynta u e ( # round brac*et #+ @3LIBRARY ieee;USE ieee.std_logic_1164.all;

    -- Simple module that co ects the S! s"itches to the LE#R lightsE$%I%Y pa&t1 IS

    '(R% ) S! * I$ S%#_L(+I,_ E,%(R)1 #(!$%( /0; LE#R * (U% S%#_L(+I,_ E,%(R)1 #(!$%( /0 -- &ed LE#s 0; 1

    E$# pa&t1;

    AR, I%E,%URE Beha2io& (3 pa&t1 IS

    +evi,ed .#l/ 200 1age 6 2

  • 8/11/2019 D08 - Getting Started With DE2 and VHDL 28Aug

    8/12

    D08 Getting Started with DE2 Development Board (VHDL)

    BE+I$LE#R < S!; --15 S"itches co ected to7 15 &ed LE#s

    E$# Beha2io&;

    Lab:Per)orm the )ollowin- tep to implement a circuit corre pondin- to the code in Fi-ure 9on the DE2 board+

    9+ Create a new /uartu II pro>ect )or your circuit+ %elect Cyclone II EP2C35F !2Ca the tar-et chip which i the FP"A chip on the Altera DE2 board+

    2+ Create a B D7 entity )or the code in Fi-ure 9 and include it in your pro>ect+3+ Include in your pro>ect the required pin a i-nment )or the DE2 board a

    di cu ed above+ Compile the pro>ect++ Download the compiled circuit into the FP"A chip+ e t the )unctionality o) the

    circuit by to--lin- the witche and ob ervin- the 7ED +

    3!3!2 E er$i,e 2Prep:

    &uild a - seg&ent decoder module that ha the two8bit input c 9c K+ hi decoderproduce even output that are u ed to di play the corre pondin- numer$% %&ara%teron the !8 e-ment di play+ he even e-ment in the di play are identi4ed by theindice K to hown below+ Each e-ment i illuminated by drivin- it to the 'o($%)a'ue 0 (active low#+ Oou are to write a B D7 entity that implement lo-ic )unctionthat repre ent circuit needed to activate each o) the even e-ment + $ e only impleB D7 a i-nment tatement in your code to peci)y each lo-ic )unction u in- a&oolean e pre ion+ here are multiple !8 e-ment di play on the DE2 boardN inDE2_pin_assign&ents.csv the ri-ht8mo t di play i called E K+ Each e-ment o) the

    di play i a in-le bit within the array E K+

    !rut& !ab'e

    #Inputs

    Outputsa b c d e f g

    C1 C0 0 1 2 3 4 5 60 / / / / / / / / 11 / 1 1 / / 1 1 1 12 1 / / / 1 / / 1 /3 1 1 / / / / 1 1 /

    E*amp'e +,-L or output se(ment 0 / 1E8/)/0 < $(%),)100 A$# ,)/0; --e9uatio :o& segme t a )/0

    +evi,ed .#l/ 200 1age 8 2

  • 8/11/2019 D08 - Getting Started With DE2 and VHDL 28Aug

    9/12

    D08 Getting Started with DE2 Development Board (VHDL)

    E8/)10 < /7; --e9uatio :o& segme t )10

    Lab:9+ Create a new /uartu II pro>ect )or your circuit (name it decode2to-seg #+2+ Create a B D7 entity )or the !8 e-ment decoder+ Connect the c 9c K input to

    witche SW 9 K and connect the output o) the decoder to the ,E/0 di play onthe DE2 board+ he e-ment in thi di play are called ,E/0 K ,E/0 9 . . .

    ,E/0 + Oou hould declare the !8bit port E8/ * (U% S%#_L(+I,_ E,%(R)/ %( 60;in your B D7 code o that the name o) the e output match thecorre pondin- name in the DE2 ser !anual and the DE2 pinassign&ents.csv 4le+

    3+ A)ter ma*in- the required DE2 board pin a i-nment compile the pro>ect++ Download the compiled circuit into the FP"A chip+ e t the )unctionality o) the

    circuit by to--lin- the SW 9 K witche and ob ervin- the !8 e-ment di play+5+ En ure you ave thi circuit a it will be u ed later+

    3!3! E er$i,e he purpo e o) thi e erci e i to create a 28bit counter u in- the /$A' $% II vi ualcircuit de i-n pac*a-e+Prep:De i-n a 28bit counter with d8Qip8Qop and lo-ic -ate in the pace below

    +evi,ed .#l/ 200 1age 2

  • 8/11/2019 D08 - Getting Started With DE2 and VHDL 28Aug

    10/12

    D08 Getting Started with DE2 Development Board (VHDL)

    Lab:1. Create a new /uartu II pro>ect )or your circuit (name it counter2 it #+2. Create a bloc* dia-ram by 3ile 4 "e5 4 6loc7 Diagra&8Sche&atic 3ile.

    %. $ e the ymbol tool or right clic7 4 insert 4 s'& ol to in ert d8Qip8Qop

    lo-ic -ate and input and output pin + $ e the ortho-onal node tool toconnect component +

    9. Compile and imulate the circuit to chec* )unctionality ( ee ection +3#+

    3!3!3 E er$i,e 3 he purpo e o) thi e erci e i to how how lo-ic can be encap ulated into Rblac* bo ect )or the current e erci e (name itcounting-seg #+ Include the B D7 4le )rom e erci e2 and the chematic 4le)rom e erci e3 in the pro>ect+

    2. Create a bloc* dia-ram by 3ile 4 "e5 4 6loc7 Diagra&8Sche&atic 3ile.%. ;pen your B D7 4le )rom e erci e 2 (4le tab in pro>ect navi-ator#+ 0ith thi

    4le open elect the )ollow menu option3ile 4 (reate8 pdate 4 (reate S'& ol 3iles for (urrent 3ile

    9. ;pen your chematic 4le )rom e erci e 3 and crete a ymbol 4le )or thi 4le ain tep 3+

    #. $ e the ymbol tool or right clic7 4 insert 4 s'& ol to in ert the new

    ymbol by brow in- )or the created 4le (+b )# or by loo*in- in the pro>ect

    node+ In ert both ymbol +:. %ome modi4cation to e erci e2 entity declaration will be needed to be)ore

    you can connect the two component +-. Connect the component o that an input pin i u ed a the cloc* to drive the

    counter and the output o) the counter drive the decoder S you hould end upwith omethin- imilar to the ima-e below+

    ;. 0hen connectin- node to a bu (bu mer-e or bu rip# it i the namin- thatconnect them (not the vi ual >oin#+ 'i-ht8clic* on the node line or bu and

    elect propertie to name in a imilar )a hion to the ima-e above+

    +evi,ed .#l/ 200 1age 0 2

  • 8/11/2019 D08 - Getting Started With DE2 and VHDL 28Aug

    11/12

    D08 Getting Started with DE2 Development Board (VHDL)

    . =ame the input pin to a witch and the output pin to a ! e-ment di play ali ted in the pin a i-nment c v 4le+ A)ter importin- DE2 pin assign&ents.csv=compile the pro>ect+

    10. Download the compiled circuit into the FP"A chip and te t the )unctionality+

    3!3!4 E er$i,e 4

    E tend the la t e erci e to a 3 bit counter and decoder+

    Con ider u in- a B D7 %ase statement )or an ea ier be&a)$oura' $mp'ementat$on o) the decoder or a $t& se'e%t &en statement )or a %on%urrent stru%tura'$mp'ementat$on +

    4! Bi7liograph/

    +evi,ed .#l/ 200 1age 2

  • 8/11/2019 D08 - Getting Started With DE2 and VHDL 28Aug

    12/12

    D08 Getting Started with DE2 Development Board (VHDL)

    @9 Altera >etting Started 5ith $ltera?s DE2 6oard + 2KKJ+@2 Altera )uartus ** *ntroduction sing +,DL Design + 2KKJ+@3 Altera La orator' E@ercise 1 + 2KK +