0% found this document useful (0 votes)
129 views

Module 3 - Verilog HDL

5th sem ECE BGSIT Verilog hdl notes ACU

Uploaded by

balajibs
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
129 views

Module 3 - Verilog HDL

5th sem ECE BGSIT Verilog hdl notes ACU

Uploaded by

balajibs
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 47
Vewt leq HDL 1gecsé Mopbute -3 [aare- LeveL Move LING GATE TYPES A degic ireutk vom be duscgned aurng bagte wate. ¥ Verleg + uppests doasve degre qatu a predefined “pac hives Thue patmiever ore instantiated dike meduly eneepd that Hey are pardefrned th Vewtog and we net need medule wlefvark'on . * Thee we 2 cleus +} dase gates’ namely : WD and/or wate wy dnt | not gore CG) and [or ates + and] o 9 ates Arowe 4 sealer output ward ruth plp Aralar daputs » toGn the Link of pote taminals , the I keminal wr veutprt and te vetha tuminal wa spats. + The weutput af a gab i walusted os soon ou one of the input changes. + Me ond] gat avatlable si Verwhog are: now xno Noyana-K, Act. Prof , ECE ,SVIr 4 Veorllog HDL I1ZECSé — The degre zymbel fe thue gee wre shen below. Lee a onsen gate auth 2 inputs . The eutput Lerminty 4s wleneted ay out and input tummy co oie oe at 4A out out ar a2 and nand ay ent «4 . — out 42 ad ce nor “4 out a4 —)>- _) “ an LL xn xno, — Thue aed et inttartoted be dwild We eels 1 Vewlag- The quel jon <4 got sthitontation ts gote- primitive tatel ( output, inputs, tapuk 2, ); Examples of pak drétanti adion wim out, dnt, ind 5 and at (ont, int, cr); . nond nal (wut, ind, sn2)) Or ond ( werk, ing, 42); nor ni (eut, ani, tnd); Xor xs ( eat, wd, sno): dee ug Se Womens than 9 “ apo at Kout, wnt, ind, tnB); MH got snadant’aton “ond aulthent dud anc name or Lalel end (out) int, irr) 5 Noyana-K, Asst Paol , ece, SvIT Verileg Hou IEC 56 + the tauth Halter fox the wand] os gate G shown deter: 1 al and] 0 4 x O11 © 0 Oe AL Xx} O x x x Z| 0 x x at aL oe] ol xz mw} O i x 4% Oo o| 1 0 x i Toi 4 1/0 ) 0 A ad . ie Me OF x) 2 le LL cae xo | 0 1 xX Z xno} oO | xX @% 0 o 1x x Oo; 1 0 x* x ! 10 x x ' oO 1 x x ar Ar x x x x A de z x x x ¥ uw) Kk K x xX +> The truth soblu wary ebined aus wring 2 inputs, + Rukpud +f qote auth moe than 2 tnputs ww tempted fy apply ang the £ruth table vk aabiely Naqana- K, Asst. Prof, ECE, SVIT 3 Varle! IB ECS6 } tog IDL Ss. ) ii) bug | not gates > buy] not ote have ene scalar Jinput wand 4 or mou seolor vourtputs . The Lost temninal un the port List de vennectet to the snput- Othe tuminals was tonnert eh te the eutpwtr We all wonucder only gota Hat rove 4 dnput ond 1 voukpuk: T* Te date dug | not “gue pacmihive ou provicled sn Vertey i) doug ii) nok + the aymbols ie Hhuse gore wit sthoun Lelow in > out 7 > -— dud not + Thue got mwrL instanb'ated in Veridog Eon { A HW Avasic gat and tontiaton, ous, 541 (out, wn)y nek mM (out) an), I me then ca vout pubs Auf bt (outs, weut2, in) Se The truth kabls for dup |net gots wucth 4 dapat wd t outpd not | sn out | lO x x ZB x Nayana-K, Asst. Paol, ECE, SVLT Nayona - K , Agst. Pre}, ECE, SNIT Verleg HDL 18Ecse bubs, [rete + Gate uth an «addi beonal sontuol aranal en suf wok gas ou Hu taf atel gets + The ange rf [neta ote pacrutiver provided Je Vewtlag aap i) dnp 4 ii) doug o fii) noted iv) notefo bas meee propagate aad +f Hin control sv x ae propagate “2 sf their wontrel svonal it wl sobted ™y mg { 7 Aymbels for tugat | notef gets or shown telow a ~ ot ot dupe motif at SP Jutep 0 neti . alles a OLE ws ore im th Inetsh “tal frtteus un Kk KX YX Newleg HOL Ie € C58 > Thue goku orn aud auhen wm ds to be vluven vanly wer the control signal 4a enabled. — Ex.ompdes a qe dnsdontiokion | drug and rotef qntg HM cnrskortiak on I kufet qa Juscht bt (vent) in, etal) ; Joagedo bo (out, an) weal) I inskertivtion qf netef gate notsft nt (souk 5 ory tal) 5 nebsto no (wut, ory «kal) ; 7 ——_ ¥ ARRAY OF ONSTANCES Ale ees x Tn some avkuobon,, vipehbve snitanty wre Atquined , Thee inskonees diff fom eh wsthn erly by the index of he veto to which hug are connected. * Vertleg HDL alles an Atm eve arnuckeun de te defined - a4 P “ cA wine [io] aut, int, i125 nond nd [3:0] (wut, ant, in2); 1 This is eopu'valent to the # gutraucllow ni( wut], silo], an2Col), no (owt (i, dit) orf); ne Cont [2], wife), an202))> ah ( et (3 wi 033, 412(3))- “Noyana K, Aest. Prof) ECE, SvIr 6 ERLE Varley HDL 18ECSS GATE- Lever MODELING EXAMPLES _ 2S (Gar LMU % Kovardir «fil mudtipdener auth 2 detect danas. $ The ffo duingram end te auth totle for tre mutt’ plener wu shou Aelow eu 40 OF 0 £0 a4 eal 0 I 44 S 4 out a Mux iO) a2 a3 _ - L Pay St $0 ok = £160.00 + S180-44 + 8150.02 415043 ¥ The tegec iogrorn. aad drove gate + a btlMox As shown Ielow. ee 1 ie di aL 43 ! | ' I I 1 1 ' i ' ' 7 ' | son | I S14 $0. Nayana-K , Asst. Prot, ECE, Svar 1 Yurlog HoL 1B ECS * Veudteg seston ct Ail Mux module muxh-L£ (veut, £0) d4, 42) 43, SI 180); anpuk wo, at, £2, 3, $1, $04 Output out 5 Sin, sOn, ye yh yey BB; nok ni( Sin, $1) 5 ni (s0n, $0); MAAR net got Cnsdanti ation not urd al Cys 40) Sin, son) 5 I aud qu Uastantiqtion (3 -i/R) nd a2 (yl, a4, sin, so), and 8 (Yr, £2) 1) On), wound ow ay Cys, 3, s4, 50); 01 ( out, yo, yy Y2y yBds WA aIP ca git Uaetartint trolmodule % Akins for Ail Mux modulo stimu 5 wag £0) Ti, £2, 1, 31, 20) Autre OUT 5 We irsdontioke thy sdleavgre tock muxy-s m4 (ovT, Lo, 1, £2, 23, st, so); Ht saienalade du dnpwoks by Vatkialiaerg tem dntecod Doz! 4 Tis 0 4 L2=15 T3=05 I set volun #1 Fdveploy ("10=%eb, L1= eb, 12 Nayana-K, Asst, Pact, ECE, Svar for vapucs hb, 13= %b", 10,11, 12,13): g Vealog HDL 4 7 — $1205 $0=0, I select To xpd | tet fduplay (“sic %b, $02 %b, ouT= Abin ", $1, $0, out); IB ECSE S12 05 soz ty I select Ld spat #1 $dusp log ("si hb, $0= %b, ouT= %b\n", $1, S0, our), | ete 15 Soe 0; M select 12 mput | | atl Puelisploy (“éI= fob, $0= hb, OUT = hb\n", St, $0, ovr), J} | $12 15 sos ts 1 sect £3 input | #1 Feces sayy ("sls %eb, $0= %b, ovT= %b\n", $1, $0, out). | end [erin * The output ef the simulation ie chown slow. Ti=0 » T2=1, 13-0 SO 0) 0Usa— = | SO= 1, ovT= 0 S0=0) OvT= | SO= 1, ovtT= 0 Note :- *Y alo ds nel mentioned in the warvdvalizahion «dep, ck dhoutd be ancluded in the # display Hint) dae only the Leak value wll be deaplosd, ¥ The wlove pro von alo be wactten aucag foarte ayer bask. Nayana - Kk, Aest. Pao} , ECE, Svat Veuleg HOL Igecse a it) y-bit RaorpLe Carry Fore Appear ® A he vk anpphe om adder ds comtaucted wavag foe bck flt addew ¥ The deste drwlding dock and mathematical equebions for todet full ddele ore shou delow. Aum= AO b@ un aout = ab + Un( a@b) % Th depie agnor fo a Whit full adder is os she Ca ) $y an Vow ducriphion I-bet full adoler _ produdke prtadd (sum, cout) a, bua); - ] ho dnpvk yb win 5 woutprt dum, weuk 5 IAAL $4, ch, c24 XO x1 (94, a, bd) one 88+ (cd, a,b); xr x2 C4um, st) aa); wd ar( Cr) wa, st) 5 XO XZ (aot, Cr, CLD) endl oducts Nayana-K, Asst: Pad, ECE, svir 40 Velo HDL IBECSE XA yndck mupple oan fr older con be contacted from four Iodvt fut addr as thoun Leto: alo] bLo} aly bf) az] bt] a3] bla] TT TT sum[o] Aum [i] Bgy An bet Mepple easy adds Vert Log duten'p bon fe A-bek supple couny full adder module rippadd (sum, cout, a, b, ways dinpuk [3:0Ja, by dnpuk un 5 autpuk [3:0] sum ; wukpuk wout » wre CL, 62, cay UW castarkiote Inble full adders foo (4um([o], ¢1, alo], bf], un)+ J fuiloda fot (4um C1] » ez, ad, 6611, <1); quiluadd fa2(4um[2I , e345 afr], bf[2], ¢2)° frtodd fas(aum [3], cout, af], bla], c3)s endmodule % fad, fod, far, fod mu dutancu of Hu module fuladd. 4 the duvgn modus is ctucked by applying stimulus. Nowpana-K, Asct fof , ECE, SvIT Veuthog Hb if Atimudus for h-bit Ripple Camy Full adder r geese « module — shimetus 5 aed [3:0] A,B y | “4 CIN » ware [310] sum» arg COUT + aippleadd At (SUM, COUT, A,B, CIN)s drt dd ol we Gmoniter (thine, "A= %b, Bob, CIN= %b~--Sum=%b, | CouT = &b\n", A,B, CIN, som, cout) s | | end | | dnt tiol nae 4y'd0, B=4'd0 | CIN= bo, | HS A= 4'd3 Be w'dh 5 | | HE A= 4dr 5 Be Kid Ss HS A= 4'dd 5 B= 4'da; #5 A= h'dld> B=Hidis; " HS A=d'dI; B= aids, CIN= I'bl > end endme duly The output of He dimuloblon it chown telors 0 A=0000, 6+ 0000, tzN=0, --- sum= 0000, courco ee se -——___U 10 A= 0010) B= 0101, CEN=0,~--SuM= oll! , cour=o9 15 A= Wl, Be 1001, crN=0, ~-~SuM= 0010, covT=1 20 A= 1010, BIN, CIN=0,~---sum=1001, cours 1 25 A= VON, B=ol01, cEN=1,~- ---6UM= 6001, cour=| Nayora-k, Rest. Prof ECE, svar Ieecst Vewleg HDL GATE- DELAYS © > In rcal earned y dagee qe Save aloe Ousou'ated awh them. Gab wallow) the Vewleg sia te apee'ty Alay, trvcugh thu loge secnents Rase, FALL & TurN- OFF DELAYS SES > Thue ae the kype 4 dele, fom Hu inputs te the ect prt of woe patie tive qe: | Ci) Rive Diag (i) Fatt Delay (vii) Tuan - off Delay | @ Rese Dela, + th ate 4 omouwatel wth o ete seutkpuk transctin tow 4 fom OX ax, i 1 od 4 tgise 0, xr 1) Fou beleg > The jou dle ue wisocrated wulth ow gee out put transit Xo mw 0 fom 4, x wz. | mi : fale Wi) Tuan off Dele + The daun- bh diloy is amowaked uuth wa gee output Aronsition to the dugh ampedonu value (2) from conethe Value « + Of the value te x, the miatmum 3 delays us j u , 4 conserved | Newanu:K, Asct. Prof ECE, Svtr AB ; t Veuleg HDL. Igecse > The dype of daley ape fice anu wre allowed @ q senly 4 wlelay as apecfred , thu vole is seed frau trons hone. ay qh a uae peared , they afer do Hu mae & four valu. The tuan- off delay as fhe minimum of the 2 ‘delays « a rT. “, . @) nee an apesfey thay acfer te Acse, jou ee delays one spetfved , the default value is ‘0’, > Examples vel by pes 4 sla apeecfration wort a1 follow; Delay fox alt Exerc bons urd (#atay) ad (out, a4, 22); WM Rese and Fatt delay apecrficaction ond # (xtse_vol fau-val) a2 (out, <1, £2); NW Rese, Faw 2 Tuan ef} delay 4pectfriadi on Arvfito 4 acze val, fival , buneff val) b4 (aut, an, contol): Examples 4 aleloy pea cad on wre thoun Lelow and #15) atCout, d4, ir); Medelay ef § for att bance wd #4, 6) a2 Conk, £8, 42)) I wse-y fous 6, tutn-qf = (rer 2) wound (3/415) 03 (out y £4, €2)5 acres, fal, duanefp = 5 dnp cq H# (4,5) b1 (out, we , Lonbrel) « M rise = 6 fas 5, Auenoff-¢ -| Nayana: kK, Aeck. Pref, ECE, Svar yh ISECSe Verleg HoL 7 * Vetleg provides on addtional divel of contsol for each type wef delay. + Thee valu min, typ ond man can be apecrfred fox tach type 4 delay — aise , fe 2 burn off one value con be whoenr iat the ctaxt of amulatio, Mea] kyp}mon voluss are wed te Modul dewies uhore olay: vag wulthin we mintnuun £ montmum ‘ange Accouse of the re fobrration pros vanetions, O Min Value. = ¥ The min volue & the menu des igre enpects the ‘head bo have. Gi) Typ value ¥ The AYP value is Lhe typrcal delay value that tty dlesvgnsr enpects the qe have. Gi) Moe vadoae delay value Hak the Te watie 4 the mastmum diley value Sat tty dear, enpects He qu to hove. + Ma, yp A max valu ton de chosen ot Vey dime, The method 4 selecoaing oO rnin | yp] max value may vouy for dfn simulate ar opeaking systems, THs olous the deccgnen He flewttenty 4 buchding thr adlog voles fr tach troucbion dante tun dean. > Fa Venttog XL y the volues oe cheotenr ty “peer fying options Fmoxdelags + Ly proctor, and F mninclelogs at sun time, Tf ne option is speerfred y the Aypecat sdiloy it default. Aan 1S Noyenas K, Asst. Prof , ECE, SvIT p—Wetleg Hoe ieese Examples 4 min , typ and max volue , burn-off=4 I ef thypalays ) aae> 3, foll= by bun-elle & I 4f F ronda ; wse= hy pauses, Bune off = 6 ound (25324, BintS, 42516) ad(out, 44, é2)5 Examplu ef Sevelung the Vewleg- XL avmutator uth ty ommend Lint ephiens air shown lows Auuma Lhat Hy Module unit, delays 21 oleclored an the ple tertev I] dnveke aimutedton wulth monn daly a Yetlog tut.v + mandala, I snvoke simulation wth minum sololay > Votdeg kuteV + mirdelous Jl dnveke dimutetton uth typical solelay > Verloy suk. v + typ. Nawona-K, Asst. Prof, &CE , Svar "6 —Veulog HL = leecse | DELAY EXAMPLE * onside vor tnample to slluckrat He use gee delay, to model diruing ooo ogee nue. ¥ A module nomed Loge * amplements the following dogee equation; aut = absc ¥ The goats Lived implementation i shown in module bogie’ The modus contains two gets sucth salle of 5 ord A kone sds, Veulog es crup-b on of mode doe uith vlola : U Module ogee C out, yy oe, input a, b, | oudput aut 5 tnd #(5) atle, a, b); Malay of © on gest 0 ~anp A #4) v1 (aut, e, oy uly ef en gate 01-00 tmdrmnodule Nayana+K, Asst. Prel, ECE, svar "7 ‘Verrlog HDL ISECSy Ths module is tuted ty the stimula block shown Lele wy module stimulus “4 A,B, Cy wuure OUTS dogec 41 (out, A,B, oy “ne biol Oe ne, B= Ibo} c=1'bd 5 Ho A=4'b1; B= 1'b1; cot bs) Flo A=1'b1 5; B=1'bO}y C= 4'b0; #20 $hinrsh 5 end endo dure, * The waveforms from Hu simulation vars chou Lelong A 1 i ' timed 5 91 4 Nayana- K, Asst. Prof » ECE, Svtr 1g Vescleg HDL. > The souk puts E and OUT we but ally sunknowsn , AE dims 10, ofEa A,B and C all traction to 4, OUT Aronskions to 4 abe om duloy 4 k time wuts and E changes value to 4 after § tine aunts - + AL time 20, B and taansttton do 0. £ Igecse vale te 0 afta Stine we wl OUT bawuchons db °, H time wuts after & changes, ——_ & Nayana-K, Asst. Paol, ECE, svir Verlog HDL ee 1BECS6 MopbuLeE -3 DATAFLOW MODELING, > Continuous ASST@NMENTS + A vontinucw seatgument ds be most deste statement ua dotatlew medeling , used to dative a value onto a net, > us aus gnemenk ttokeent stare uuth He Regword wustgn "6 The Ayrton 4 oun aaa vgn stotement Os frien assign [dave strength] [delay] rut--onsigrmtnt enpacary | > The lurve akrangth and dulog ang opt onal. Lontinuons ousignmant statements chawe the foutcuasng CHARACTERISTICS. (#1) The LHS of van ausignmend ome alee cage be ox stele. ow ver mt ov ow roncakuvation of calor and veto neh. Tt vonnet be va segerter. G2) Lentinucs aucaumentr wv achive. The usignment enpraion ix evaluated 04 sor ws ens of He RHS operands and the value ie veer to th LHS ore a a (2) The epuounels wn He RHS con Le Aegeates oy nett or function vwolls , These ALqokers Lan be salar ovecth (x4) Dog valu con Le speccfred fe auigament an Leon of tee wnids Delay valuts wore used te vontrot de dou when a net i euaugned Abe evoluated valut. Nayana-k, Asst. Prof ECE, Svar a : Vosleg HDL | Exampls q centinwcus Paatgnment | F |W Lerkinscus tustgament . Voulabls ed, 245 62 ou nets | uttgn ent = ad B12; W Lewd rues ausrgnmunt foe veer nets. adda in a le-bet | vecke net ond at 2 ad are ib bet vet ueguteg. | ND METHOD OF PLACING A CONTINUOUS ASSIGNMENT ON > SHORTHAND GS ae re © Lprtcrt CONTINUOUS ASSIGNMENT _ * Vatlog provides a shekiok ly aduch © tentnucw Pugnment son de plaad en a ut, udin st is dicord . % There con Me only one _ am plcek dicloratien eject) pA net dtcuue mw net u decloud ently ence . | Bremph? I] Regelan werdinent anigerent | wire gut * at | . / . LULU —— M bore fee w cbtorned wustag smpliat aes wut outs mit ina, | ii) CmPLtcit NET DECLARATION | eT ow nome ds sued to the LHS of a continuous | vousigament , on imphuk net daclorablen sul Le inforrg Hot sugnal nome ¥ If wo mt unnted 40 aw medi pet, the sual of ee ta fosed net is ecprod fo the ualdth of He module pork. | Noyans-k, Asst. Prof » ECE, SVIT 2 Vea leg HDL Example Duce at, Ly | alr, owe = Lax ia; Ix Neb thet cut ste net declared ox a wuss Jak on amplut wars declaration dor cut us dere | Ay He smulater «/ > > DELAYS * Delay voluts centacl the time Jetwern Hi chang An & RHS wcprand. and an te aw vale uo ° aracgrudl te th LHS. * the we 3 meas of pees fy eng delays 46 verkinveus eaargnennt skot enents i) Arguton wausigqarrent dulay tl) Sempdiert went nous auscgamant delay fit) net wleelaration delay () REGULAR ASsStGNMENT Decay * In this method, Je aaecgn a vdolog value in a continnous suacgnment atatunent, the delay valus apectied afte the kagwosrd ‘ausiga Ena pl lovsign FEIO souk = ind & in ind Fj Mab ee teetinnens anid + slay henge in value of nt oo ing | Debt sn eh savey of Ip bew uit Aefera Aetemputetin of He enpracen “und & 1nd" ound Hu AuulE wall te auscgnudl bo _ Nowana:K ) Aest. Pref , ECE, SVET 2 1BECSE Vewley HDL * Tf unt! oe ne! changes value sapein tefow 10 beens unt shun the Auule propagates to eut’ , the valuss of out tind ind wt the time 4 arcomputotion art conoleud. % Tha property b walled " prertial delay % he onprt pulue that uv shor Han the ultlay of the usarnment statement do net propagate to the outpd. * Mowucdix the amavefoum of the enpiuscon fun a gurated dy dimulating te aac g thokemerdk " ausvgn Wouk = int ind”. TF sous the delay ven Avgnol oud wat He fottouning tiene inekances © wher augnals ints inr dught 1) ot Lime 20, signal Cut whongs to Huigh (1) ft 10 Lime anit Ctime= 30) ©) When ind dew(0) wt 60, ent changes £0 Low at 70 time ‘ei . tit) ant to hugh (1) ot @0, Jut gets Aewo(o) befor 10 dime auwb- Here, ot the dio of Atcomputatien , 10 wunthe otter dime 80) int BO. Thu, out the value 0, A pwue of much Leys than the speafeed ousignriaent is wok propagated to Hu eutput, %) Enckally ouk ty x! ALL 10 bine wits Nowyana- Kk 1 Ack. Pro} ECE, Svat 4 _Newleg HDL ISECSe - | ii) Gmpeteat ConTaNvOVS ASSTGNMENT DELAY * Bn eqypvalent method to Ag ulon austgmment ditag is te ae an uimplark rentinnous vn sgnment He apeer}y doth a alow and an veusignmenk cr the net, MW sonpiieck condinvens us cgnment elo Tre alow utotenent sane a Tatan- out 5 | | Letter #10 outs inte inns | * The declaration above has tap came pe 04 defenuing ew uk ad declaning oo ontinuoud vase tii) INET DECLARATION DELAY aN | * A delouy eon de apeatfied wore wont hen ot is | declared thou putting a conbinous vauigamert on | the nek. «Tf a dilay iu spear'frect won a net out’, then ony value change copplied te the nek “oud ie delayed accordingly « If Net autre FID out 5 ee Out = dnd & ind) HW The wbove statement ra some opp as folleus AAW AL out } Saige HID out= int 2 nd ; Nayana-K, Asst. Prof, ECE, svar 5 Vewleg HDL reECSE EXPRESSIONS , OPERATORS S OPERANDS — ¥ Dataflow modeling olucrches the oleacgr ain beams of emparuvors ingtead of pane tive gre: Empacsvons , vopurakers nd vopercurds for dhe boss of tatajlovo Modul W £XPRESSTONS _ X Enpaeuvons ae vontanch rat xombias veperatou and epronds to produ a scrult- ab alb W Emamples 4 emprustons. Lombrnos operands & operator. add [20211] + adde [20 +17] ii) OPERANDS % Dprands ore vawoller on udech eprahions are perfound, ¥ Mprandu «con Le any one of He dota Hype , they con He content, integer, wal numbers, rts, segiatens, | Aime) Anvk-sdlect ( one int a_vectsr) | pork —Lelect (set 4 Arts of a vector ) wand memos ep function calls, Exampls- inkgr a, b, CG C= a+b ; Hwa, b, € ware integer operands Acol Ay Ye Le ny sy II yy) % ane weal operands [isso] a, b; Aug [3:0] ¢; £= af3:0}* b[3:0)7 a[3:0J 2 bf 3:0] are part select ragiy, Nayana Ky Awe Tae} ECE, SYIT 6 Veatheg HOL PSECeUm valut » Volue = pomty (A, you Ponty tt aw function bype operand ii OPERATORS ¥ Mperotou act on te epoands to produce dlessced rcrutt. * £puateu perform He Arquimd voperabion . ¥ Verilog provides vaxvous ype 4 eprrctors . di s2d2 // ge y Legicod AND operator vor operands dt. t.d2, fofo] 4 1 sogival Nor tor operand afo] Bors mrs Aogical weght shaft eprredar en operands Bey x—* OPERATOR TyPES * Verilog provides mma differant dypes eh operators. * Bprokes on dt samthentic, Aogtcad i Aledional , eaprolity bituuse ) Arduckion , hate 7 eoncakenation , ot conditional, + Loh operator bype 4s denoted 4y oe azgmbel Orerator Types & SymBore SS OMB OLS OPeraToR [OPERATOR OPERATION Numper OF TYPE SymBoL PERFORMED OPERANDS * rrlsp ly 2 / divide 2 ARITHMETIC + 2 co aubtaect De % Moduli 2 xx pewsr(exponent)| 2. Nayans-K Aust. Past » ECE, vir Vecleg HDL 18ECSE 7 OPERATOR OPERATOR Operation Numer OF TYPE SYMBOL PERFORMED OPERANDS ! Logecat Nor (negation L Logacar Bh ogee AND 2 I Leqeeal OR 2 > wppentn than 2D RELATIONAL < oe 2 = weyeaken. Hhon ot cays 2 F Aus, Han or eoprad 2 eqprol'ty 2 in f EQuALITy wy a ote tqpradioy 2 Cate tnequaity 2 “ bits rugation 1 a bituwse AND 2 BITWIse | brtwaxe oR 2 A bebuuze xOR . Aw wn” | beduise XNOR 2 & Ardudkion AND L wh vedurklon NAND 1 : ! Atducton OR 1 REpucTION ~| seduction Now 4 a Arduchon xo 4 Aw iw laeduction XNOR 4 >> ght chef 2 << tb abeft 2 SHIFT >>> Laacthmeb’c wight shit] 2 < wide (1) > mad C+) + subtrad (-) > power Cer) > modulus C%) * Binoy operateu take 2 operand Examrre Az k‘bollo jp B= hb00ID HAeB ware Atgiste vectey C= 8 5 D5, Ere kD 2 E vase sinkegers ee Y Mude' ply A&B Evaluate te 4'bliod [ A= o10ls) ; B= 00102) > AeB=N0M(a] L+A | B if Divede A ty B ¥ Evoluak to 4'b0oii [Rebun guetient, tuuncate ret onal 8/3 = 3-oou fa] LC] D / Diwde ¢ ty D dv co Fvoluots to 2 [ 8]/3> 2 5 tumcate factional pat] inte I Adh ArB Evaluatn ty 'bioop [ dif + colo = tom] PrA-B WW Subtract 8B from A + a B Evoluatir to 4'bolop [ 0110 - 0010 = o1o0] PONE MD to Hu peur of E+ Evatuata to 9 (3724) Noyana: Ky Asst. Prof ECE, svar 4 Vewkog HOL Ieecse J x If sony cprand dik dros oo value 'x'Cwiknown) » then the Aue of the entire exprcuvon is x ~ Example [ ist = 4 Broix | and = h'b lolo y | coal whit ard) I sum welt Le woluoted te ylox * Modulus swpuater (%) produce He aunarnder fom the dawavon fwo num. Example i a= 13 > b= J+ a %b I 13%3 > evaluat to 4 eee | [+ 1624 W Evaluate to 0 Te Remainder a7 n2 Wl kvaluadu tp -1 , dass sign of the I operand + T%-2 I) Evaluets te +4, take ayy of He 1" operand b) UNARY OPERATORS * The vepuotsu + and - war wolte watrR var unary epuakers « wore sued to spect of He wpoand. * Une + ma — operate trove uigher pareed once Hhan the Ainony + on - wepuatou. ¥ ty the porchive ou Teg ote aga -h I Negateve 4 +5 HW Posbve = ¥ N eqabve runt ore Aaprsented pa 2's tomplement trkernall ta Vou. 4 Leu a “good prartie to we negate numbeu vonty of type sink eg oa Acol in expAnutons. t Dutgnirs shoutd averd negabive numbeu <£85>"¢bae>"¢hae> | -4PA10]5 We equrvotent a (2 eompiement of 10)/5 32> in defautt madure (2°? 10) / 5 | word | WU Eveluot 20 wan invouect rand wunexpected | Ate l Wi) Logaca OPerators ¥ Logical veprake in veileg Ono + aa togveol — ond ( &%) + Aogecal — on C1) > doqrcol — nNoT ( }) + Apurotes 22 and eat Innany operate x Bpuste bow iw erory op rater. 4 Logical eperctou follow thue wondibions : > Logical operate always ewaluate te ale bit value ; 0 [ fate, 1tCamu) , XL wrknewn/ vembiguons) > a an epesnd 44 net equal to reo ct i equvaled ke howtcah “1 ( taut) . “1'( tas). St ths veprond ix equal to xer0’ Ak is cqmivelert to togrieal (fate), Tf ony oprand inti x az, chi epevalint te 'x" — Logical wpurctes stoke vowablr rer empauavons as Sprands. 1 Exprrstons (a==2) £2 Cb==3) / Evatuatis to 4 uf both Haz=2 and _b=3 ele ‘0 it Nayana:K , Aut, Prof , ECE) SviT Newleg HDL leecse penile DEE A= h'bOll0 5 B= 4'b0000 A= y'boulo #04, = Aogical 4 B= 4'bo0o = 0 v. = Aogieat 0 +A £o B ¥ Cregueat 4 Qe begeeat o)= 0 Evoluatu to ‘0’, > A\LB 4 (Aogecat 4 II togveal 0) =| » Evaluate te)’. |+ oa 4 not (Logial 1) Evoluetu te 0’ —+ %!8 4 net ( Legal 0) Evaluatu de 1! TT Unknewurt values A= 2'bOxl j B= 2'b100, A= 2'boxl#0 = Aogical 4 B= 2'b100 FO +. => Aoguat 4 + mae ( Aegescos 1 oe Aogecal eee J. Evoluotu be 4! To As 2'bOx ; B= 2'bix Az 2'bOx : % depending en the value of %)A Logit 4, SAGER SS Kee Jogial 1 = x “ Evoluotu te Nayona-K, Aast-Parol , ECE, SvIT a feiaars “Y wwlog HOL | is) Revataonar OPERATORS * Relational eperators tin veukog ware peat -than (>) > dus - than ( 2) > fee Khan or egal te (>=) Aus Eran ot equal to C2=) (Tf Acteenal eprnter van aued on van enprtaton , the tmprvovon Arbus ve dogical value of 4" ef the | Mmparuron is tae 5 om Lege coh Value 4 bd” rprrscon is Jaues * * q ee at ord unknoun 2 bt ain the operands Hea enpauaon Lakes A value "x" Enamples |VA=h, B=3 | |W x= A'bio1o , Y= A'bI10/ , Ze k'bixx,x | | | AB + Evaluctes to a Aogicod ‘Cc Aa’ greater than B- Truc) — y>=x Evaluates to a fogted'4°(-2 a yeedex than Xx -True) Ev “Ke | Maas Ae aK" Co feo dats of © a sunknouin (2)) Nowyona: Kk, Aut Prof ) ECR, svat Vewkog HOL _ I Fecsh vy) EQUALITY OPERATORS ¥ Ecapralcey epuatou in Verclog One + togical eqpatity (== ae Logical sneqpolity Cl=) > tase eapod by amas TF tose aneqpadcly (1 == | * When wed tn von empauscen , capo aprctou | “hen dagieet vale “A ef taut) “0” of fae % thee ep rato, tempore the two sprands Ant ty bet, Auth zero priting “a fhe eperands ase of suncauas | | * £f the epuanis match in Cor) dvt Porrkon, er ae hogecod "1" ( kane) ete togucad ‘0 false), Expressron DEScRIPTION Possteve Ovreur Logicar_Vatve Q==b rg ga ape ate A x 4 Whe a oe b dros *x' (unknown 2) al=5 A mot egal te by Aurutt is xe | Af Chen ob hos x! 5p @e==b A toprol te b tecluding ‘x’ 9°y' 0 al==b ‘A net equalte b; Arthuding X22 O, * The Logical eqprateky vopuatou (G+, [=) ae yild an x +f wht epuond har x a Z in ob dnt. * The care quality operate (===, L==) compare beth vepronds dnt ty dnt ond ompars alt its, srcluadiing x! wud vs The Aeult ivf th He eperands moth eractly , srcluding XK and 2 dW. the rut ss Oat te operands do net match tnactly » Lose cqwality wperatos never Ault sin an ‘x’. Nayana- Kk, Asst Paol Eck, svit My Veclog HOL I9eC [E ramples 1) A=4, B=3 Vi ee eee OlO 2 Y,—) bit 0) (1 2 = hlbixxz » Mz hi bIxxz, N= h'bixxx > A== ‘ ay . Resutts in legicat 0° [A cis not cquod 42 8] + x yey 4 we Res utts tn dogicat 't) [ 1" X i net equal to ¥ > krue J > xX==z + . Route on x! Ey he wrbreuue bets, the Actes x] ===M J Resuits in togteot 4 [Fall te moth » tne ding x and z bit) + L===N 4 Results ain foqeat OC) Lat Agni ficant nt not J > MI=N 4 | Resubts an bogeal 1 [ s+ M tenet equal 40K, vba Leue] | * (vy) BITWISe OPERATORS * Bukuusc oprroters in Veutlog ory + Atbusre negation Cn) + Intuuse ond (2) > Mnkwse xox, (4) —> drkvese xngy C4n, ~) ¥ Bukuie -eperatoy Pefem va Ant ty-dik operation ven ewe operands « Nayana-Ky Aast. Prof » ECE, SvIT Is Verwleg HDL 1SeCse ¥ They take tach det in ore weperand and pufoam the weperabon ath the aay dekh in the otha oprand ¥ Tf ene veprand ds shoe, thon He ethy » vt ule be drh- entended uth zeroes es ee) gaat ee tonger seperand , ¥ The negation veperoker (~) Lakes venly ons operand wand operate on Ely Ants of the siglo «perand , BLTNISE BETWIse | xeh, 0 ix XNOR oO | x | ee 0} 10x ! 1 0x I OX x |x x x x |x x Examples || X= #'bl0i0 , Y= &'biior y L=h' bln) || mor I Negation (complement ony bit) -Ruwtt 4'bO10; + X ZY I] Betwese AND (1010 ZIIO1) . Rewlt 4445) 000 xX] 1 Brtuuse OR (1010 J 1101). Rett & Ab) +> X*Y I Bekuune xoRC1010%1101). Rewtt is 4'bO1N —> X “wy I) Bitunie xNOR( l010%~ (101). Ruwtt is k'b1000 |] PX Sz M Bite AND (1010 K ox!) Reeutlt 4 4'bIOxO \] ey eZ Il Betusize AND COL IDK). Rett is 4'b100) Nayana: Ky Aust. Pref, ECE, SVIT 16 BEC. Vewleg HOL veot vi) REDUCTION OPERATOR * Reduction operator in Vewtlog ware > Reduction AND (&) —> Reduction NaANDd (w&) > Reducton or (1) — Reduction Nok (wl) * Reduction yor (A) > Reduction xno Ag » Ww) Recluction wpucteu take venly one operand Reduction veperctou PAfom a tetuise ceperation en « Ainghe vector operand and yd oe Ibe vuult. | The ce tables Ho | x re erator, hg. An kuwse puto 7 = coe ad + Reductlon epuctou work Int 4 Jat fom Aeght to aft * Reduction Rand, aducion now vaund tomputed dey aeveke 1 X= k'bloio +2K I Equrvelent to 1202120. Reeults in I'bo (0) " Equivalent to 1] 0) 110 —°X I Kgucvalent to 1% 6% [TA tompterrent of Reokiuch aa + Rewlts an tI (1) 10 . Rent ain |'bO (0) On KOR. Results in 1 ¥ + Example: X=h'bIOI , Y= A'bINO) ) Bubuke AND H bogucal CAND ! Xey 7 X BEY i lor ! 101 #0= Loqueal 1 ' leoxuls] zllot 1 LLOL #0 > dogecats ' ‘ 2s ' 0 Toor ' TT — 1 v + ‘ ¥ ! Ans bone Aus i : 4 Nayona- kK, Asst. Prof, ECE, Svar ee re ; Isecse | vi) Sacet Operators x Abit wprakors un veu'log vase > Aughe shaft (7) > Aabe ahete CZe) ancthunebic aight sbuft ( >>>) anthemic debt shift C“69 * Regular shift epaatou , shaft a ver epuand to the weg or the Aap dy mo Apeapied ruumber of dnt. * When dhe nts soe shifted | the vacant Int power vector ond the rumber of nts to deft ante & same vos Aoguial Luft shaft Ceo) % AAC Hometic seghe ahefe Auploces the most At grefrant bet Cmse) (ie. the Atgn dnt) an the Vacant Ue postong Example. MX = yb 00 be |, Regt anafe dy 4 bre . Fell 0 46 vacant poschion | Iloo “Y= OND wed 0 TYE Keer y Left abate ty t bit. Y= }000 ye = XE 2; |] aberft eft ty 2b. Y= oon + y= x <>>] 5 I ected Maght shift Ibit. Retain MOB bet en Vasant powkon . Y= 1110 > integra, b, c M avgred date type toy c= a+ (b>>73) ; Rela in -2, due to aucthmnets © chat “IOD1ONO => 101l0>>>3=2> INO =-2 aac += Ig +S, ~ ve De comp ‘of 10 19 ECse Verilog HoL | Vii) CoNCATENATION OPERATOR, % The concatenation eprctor f,} provides 2 mechaniem te oppend multiple operands. The eprronds must de sized. Unczecl wprands we not allowed Lecause to sexe of each operand must Le know fer womputation wf the Acre of He rerule ¥ Loveotenabions vow emprersed vas vepeands within draws, stk commas Aceparohing He operands. + Operonds «an te acolor nels vor akers , veckor nek AK Augesbers , dot—seleck , part-selock or sted usnstanky. Examples | A= Vol, B= 2°00, C= 2'blO, D=3'bilo | * || Y= £8,¢$ Wf Evaluates to Y= 0010 lo Ye ir, B,C) D} It Evaluate to Y= 8'b 10010110 [> Y= LA, Blo}, lI} MW Evateaty to Y= 3'bio} Neer = | TA, 8, 3'b0013 Wf Evaluaie to ye &'b100001 ") Rertccatson Ovenaroe i144 af the came namber wen oe tnepatieed Ay using 2 Asplication vonstant, e 4 replication wonutont Y= TALAST WM areplicote A bem. Y= 4!bINN) “Ph Y= TH{M}, 20033 / replicates concatenate Y= 8'biitioroy Bee eat tence / ys eee ieicn | 1 Nayana- K, Asst. Prof, ECE, svar 4 + Vewleg WoL I9eCst @) ConDaTTonAL OPERATOR ¥ The condoned proto C1) takes tree veperande, [Formar ; eon tone emp Absavon 2 dame enpr : fodsc-enpa | * The condition enpacuron i frst evaluccted , * Tf the sult G tae (1) then tho tauuenpar & evaluated * Of the vcult & false (0) then the falre- expat evaluoted. «Of the Ault 4X! (wrombrguous unknown) , then beth, Aru enpa ound forte enpa wr walucted wand thei Aaults ore veompored , bot dy det to rchun for cach Ank pacbon an 4 tf te be wre Afb ot sand the Value wef He tubs tf Hey ore same, * The action +4 ow tenditrenal pret 4 simular te eo multiplener . Te war alice Le comp ored 0 +f cle Akokement: frucapyo 2 | yeuk Kaacepr yy Mr Cendlitionenpt * Lovdehi onal oprstors om used tn dlota How model, to mod wonrditonal eutrgamertss The conditional enprous OL Ob OL aust bang contrgh | vasgee out = uonkrcl ? td i £0; Mfr onatrty of 2:1 ox Ikoume as ef Coontrel = =1) Oub= 41> che 3 am bub = a, ¥lordiMonal cperabions can Le nuted . Lash Brus enpa oy folie enpe can tkaef be a conditienal epecatier utr ent = (A==3)? Ceonbrot fe: y) + ( contret 2min): Nayona-K, Asst Prof, ECE, Svzi 20 IBEC Vewleg HOL ad Operator PReceDEN ¥ Tf ne poranther's ore wed to separate poab of enplesvony Vetleg sue the following prrredlen ee, OPERATORS Operator SymBous PRECEDENCE t+ - |ow Heghet prrcedenis | | Materpiy , Devede, | |_ Meo ductus || Adel, Subteact +o | Supt << >> Reled eres £ <= > oe Equality == j= =-- Redurch'on Cane A , Aw | Vo wl Logical ne ul (Aondib ones, a: Lowert- Precedence x Examples OF Dara- Flow DESCRIPTION QO At 1 Muctaprexer ro St | So | out a ACd - o}o | 20 2 os MULTI PLexep| oj; 1] a t}o} a2 sso ') 1 fas Boolean enpreuvon .- out= Elsolo +Sisori 4+ siS124 Stsor3 Nayana+K, Agst. Pel, ECE, Svar ae Vewlog HDL MetHoD Vetng Logic EQuatron ~ hil Mux ISECSE module. muxh-1 (wut, £0, 1, £2, 03, st, $0); unput 10, £1,412, #3, Sl, So; output onk 3 Hl Logic equrctien, fer out Mus dn euk = = (esis wsozsro) | (wstesotzit)| ( sit wsoeus)| (sis soe 43): [erdmedute METHOD 2:- USING ConprtzowaL OPERATORS — h:1mux Moduls muxh-t (out, £0, £1, 12, 13, $1, £0), sainvpuk +0) 41,42, 43, s1,s0; eukpuk out + I] ase sovelukvonal epererter Ee S so? 13.42): (80241 :40)- qr ot= s12 C502 Gol at ys endinodule _ GD A~ Bar Fue Aover PP ER Truth table 4 bet Futt Adde, | b | al swn cout] pet | 4 DO }o}olo Faw [Psu pop epi ye un Addex |—> couk olilel« oO; il tlo Uy of of 4 4um= 2O©bOun = pOuy I loltjo taut = ab+ @Mb)un iad = 9+ pee Veryados L Nogana «Kk, Asst. Pael | ECE, Svar Vewleg HOL ir ¢ | |MetHop 1 : DATAFLOW OPERATORS — 4-bit adder medue flt_odd (4um, wouky a, by un); tut put [3:o]sum 5 voutput — cout | anpuk [3:0]a, by sn pve vin 5 eusegee f tout, sumf= atbt un; QD Il aacthmnetre operate, tnrdimedule MetHop 2:- Furr Adder Warn CARRY Look AHenp % In acpple any adden , the ony vrnust propagate trocugh the gots devels tefore the sum is avarteble at khe output Leuminals, * Rar nde spple ony woodleler will Lowe In gee tes ¥ The propagation time con Le we Lime bing fart on Hy speed the «rout * ane of the popular methods to Accducs delay wit ure. a | lock ahead mechonum , Tha propagation delay 11 acduced te four gota Levels , Larespecki ve af the number of beo an the adder, % Loge equations for amplomenting xony tock ahead addon Propagate Cp) = aO®b qeneods 4) = a-b 4um = P gun touk = g + p.u'a. Nagana -K, Asst. Pref y ECE, SVLr 23 NVewclog HDL ISEcst Verlog ler aup bon. of fetl adder aang adda feck obwad module full-add (sum, cout ) , b, an); snp [3:0]a, b; arpuk ayn + evt put [3: o]4um ; ouk prk woud 5 wuras, pO, 90, pl, gl, p2,g?) P3,g3, ct, c2, 63, Cs I sccm pute vo fo cach 4bage sustgr po = afo]* blo) , pi= alid*eci1), pr = af2}* bro], p32 = al3j* bral; urge go = ald} s blo], I/eompuh y for coch «trae gt = alive boi, g? = al2)e b[2], ge = a03h bLad; seca cL= g? | Cpoz un), Ncoary deck ahead Caleetion c2= gt | Cpt 2 ge) | Cpt 2 po Zun): c3= g2 | (p22 94)1 (p22 pt & go)) (p24 ps & pour), Ch = 93 | Cpaege)I Cp 2prZgi)| (p34 p2+psom) | Cp32-p2spl& poe ain) + ug sum [oJ= por ua, Il compute dum 4um [i] = pi ret, dum [2] = p2* 2, 4um [3)= p23“ C35 usin uk = Ch erdumecule Nayana+K, Asst. Paul, ECE, Svar 24 Vewleg MDE 1eecse (ii) Rippce _Counrer - }y “bet * be bvt scpple counter dude uuscag T- frp Ho pa 4s as shown. --i--- ea << «| % ¥ ve eS ¥ Roun eo) the Tap ep a ont ae 4 DO-fbp flepd net gat TrFL —— ‘Le bode —1—P_ D_-FF 4 Nayona Ky Asst. Pael, ECE, svir 25 Varley HOL 1SeEcst Verteg weds suing dataflow statement si a top ~etowin fosheon, _* Fess lercgn module arpple country, whith contours snetanbiati of ky -T-F Fs. module router ( G/, vdack, lear) anpuk lock, eon 5 eukpuk [3:0] y + T-FE eff C Lo], utock , wear); Tre ke Cali], af), «leary; TRF tifa (a/[2J oyL1] , uleor)) Tre EES Col 2d, alr], lear); end modu. © Voutog eruption for LFF (Lutead of aetgab , dato}in) operator ~ negeles sograt y) maodute TFF( wy, «Lk, vdeo)» wapuk — tk, dear ; | fedgendge tle, way, wth, tear) ; endlmeduts ~ Now, sue define tia tousert level modub D-FF (edged) sasung lake flow stobranb VERILOG DESCRIPTION OF EE DGE- TRIGGERED D-FitPFLop modure edge ath Cay) wybar, el, tk » dear) y anpuk id, lk, clear 5 oukput a , abo 5 wD, Sbar, A, Abox, coax » ; "Nayana- Ky Act. Prol , ECE, svat 26 Veleg HOL wouacgin ebar= wv hear 4 wus sbar= w(aba ts), ~(ebar 2 char k wk), w (aba t vik & 5), Aba = o( A L& chat d), | Wusrgn og = (St qbor), aybor= vly kak hax) 5 enclno dil: CNore: A Loker o sovel- senscbive , edge—souctie fuip pop 4s emplumented uscrg 3 SR Labcha] | The design tock us now + The atimutus block to | shimulus | eLOCE, CLEAR 4 aur [310)8 5 uw bok Smoncker ($time, " lount @= Lb Ulear> %b", 8 ,Cuene); IW anskontiot: tHe lesen block wountsr tountn c1 CQ, crock, cLenr); I] Atimutode the clear argnad ainiki al CLeRe = I'bl » “#35 CLEAR= I'bO, #20 CLeRe = Ibi, # 5d cuene= I'bo; end dub Hu ducgn Gas follows. Atirrutus i for top-level block f (RECs 'Nagana+Kk, Asst-Prel, ECE,svir 21 Verleg HDL [l seep ere wok bo toggle every 10 dime -untty atk oh Ain cLock= 1'bO) fren FIO CLOCK = CLOCK ¢ enck | It Funcom the scmulabion ob hive Ao snc kia +E OD $hewsh 7 end endirodue % The outprt vo the bimulod on ee eee © Sounk @ = 0006 Ueor 3S Mount @= 0000 AO Aeunk @ = 0001 60 Lount @= 0010 80 Lount &= 0011 100 fount &= 0100 120 Cowuk olot | VHO Lounk | is | 160 Louk B= OIL theme 0 | 180 Kount @= 1000 Aes 0 | 200 Kount Q= 1001 Ahear= 0 220 Kourk @= 1010 Uea= 0 235 sunt @= 0000 Lea=! 285 Louk G> 0000 thear-0 300 aunt G= 0001 Auar= 0 320 Aunt @ = 0010 Lear= 0 BHO Lount & = O0Il Aa 0 360 Aount Q= o1od Akear= 0 380 Kount Q= olol Lear 0. Nayana-k, Asst. Pol, ECE, svat IBEcst 28

You might also like