f
Veatleg HDL PECs
U
Mopute-2
Basic Concerts
Lexical CONVENTIONS
tN kenastod ements” oy" dokuns” sau wed 0 eenstruct
Statements, dufrattion , celorabions ath va wed
te wonstaurct complete preqroms .
+ The date denial convertor wed ty
Vewleg HDL
wrr acourlor te those in '¢ programm
Ft henicol emer or dekens con le
¥ WSubespoce
* Lemments
* Opactou
¥* Numba Apeafration
* Ake
+ Toluntifros wok fea ails
«Escaped tdentifias
() WHarTespace
PA suhitespace son de ony one of Ha fotloung :
¥ Blank spoxes (\b)
* £obs (\t)
* nuwka (\n)
aan Wha tes pace as
Aeporotu tokens,
_ Whitespace as
xgreud ty Veuleg ened urhen st
net sgnoud mm stungs
48 Aowne on
kg vaput ws
arput ay Laptce ie rynoud J
Nagano: kK, Aset. Prof Eck, SVITVerthog HDL
(FECS6
ii) COMMENTS ;
+> Lomment «con de inueted ah He xode fo Fea hob
and oleumentation +
Thee wu 2 wos to unite Lommenti ;
¥ 7 Cre-line comment staxts wuth JIL, Versteg
7 Pe. fon Yok peik to te tnd od Line
vA
matt ple= kine vomment stark with — /y wana
ds muckh ¥/-
Mult ple Line comment coun.
Ae neskeds
* One- Lac womments corr Le embedded in math
dene Commun in
ex
a= bere » Hl This ts one-kine commer
/* Tha off vmuktipde Ling
vommuenk */
7% Ws in /x an leg al ¥ | comment ¥/
J¥ This & fl legal wommert */
fii) OPERATORS
> Operotors ax of S Hyper
% Unery
* Eo
47
Unory eperatou prrcede the veperand,
Bewany epuatou wypyear Lekween two prance.
Ternary eprokers Jove kwo separate proto that
_ Aeponoke S epaands,
Nayona-k, Asst. Prel , ECE, SviT 2
LdVetlog Hdl leecss
Example
a= ~b; Hm it a. sumany seperate b ii the operand,
a= bsec, I gp a trnary operader « PEC or weperands,
w= decid; Et 4 a benay sprater. by Crd ae operand
GY NomBer Spe crercarion_
a) Sizep NumBers
* Atxed mmbus ore Atpauented vas
< Size> Cote forrat>Cnumbud
* Calze> 2 witten tn dewmal vnel cpecfra the
numba ef tity ain the numba.
* << dose fomatez ere Aepatiorted cy
"da 'D > for dewmal
thw 'H fe Fanadenimal
‘rh ow 'B> fm inary
“o wa 'O — fa wetal
F
Apeerfrection va dewinal numbeu ty default.
* Numbeu that rr awatHen sutthout Oe <étzey speeef cabin
rave a. Atfoult numba wf Wb that 6 pmuletor ave
machine — ~epeafre Cust be ot least 39 In'tr).
23456 Wf This is a 32-Int deamal number 1
oF 4 O BI-dvk Nenadeeimal number ‘e3"
“O21 J) Thi isa 32-wt octal number 2)
‘bitoo // This uw @ 32- bet Jrnogy number
‘d250 Il This 4 & 32-bit sdeumok number 26D
o) Xe % values
¥ Vowheg hos 2 symbols for wrkroun anol dugh -
tmpedorre
* Ture valuu arr important for modeling teal erreur,
4 dn unknown value i denoted by an x!
* A gh impedone volt is denoted dy 2‘
- lo" 53x & The & @ I2-bte fax number ; J deaat sgesbiian
bits unknown (0101 ool ey
6'AK HW This be ww bebe don number, AU unknown born
32'bu /| Ths & wo 39-bit hagh empedante number,
Nayana-k Mest. Prof , ECE, SV IT 4IB EC
Veutlog HDL Ess
Kim Ko Z det fobih fora numba tn henadeurmal base
4 Angented as
eqe IG'HASXI ojo 0191 x0 peo! Cx ~ ds sep: abe)
An X wm 2 ae B-brb im wo nunba in wetal tase.
eq 6'O XH > Xxx oO Cok a Acprtsented was 3-brty)
x 4
* AK wD Mets [bat
fo a number se Urinary love
. i ¥ ~ i y bit ret ib
eqs A bIOX) > Aamaoins OX] ( x-Aemaing 40 nang ba)
+ Tf te meat scgneficank dik (sb) 4 eo number
0) XAK , He numba lt satemabiially enterded to
pe He moat ascgneficant dvb uth 0) X) 2 Auypechvety
j Ca
fe. B'hX8 > ‘Kexx 1000
g'hog—> 00001000
B'hz&—> zzzz!000
* if the mat arg front Wk ia
ok ert:
4 por +k ob Zao
intended tg Bhs > 90914000
4) NEGATIVE Numbers
RMBERS
* Negadire numbus con be Apectfied 4y puting aw miaus
argn defen Ehe atze fe a contbank numbe,
+ Avze comtont we elas posbive ,
# Tks ategal te ove wo manus 419A dekween < bose > B dau)
* An wp enol ainned
apterfrer. aon de added Jo sugead
waurkhmdicr
% Negative number wre nepruented in
-3'3 Hl @-ba megetiie number bored wr 2! & complernont [3
= 6'sd3 I Aed fo pefening agned integer math
A'd-2 Il Legad medule, uure, srput, output, aston , alure
endmoduls etc.
IDENTIFIERS
* dents ree vase ames given te wljects 40 thot thay won
ae Arpounrud in theslesvan. Thay wane ser lefonad
+ Ruler marking on cdercdifier
aes Tend fren stort muvth on eal phrobetic Character of
an undenscow '_'
-. cd. * *
> danti fees may “antain alphatetic shoracteu, rumen
hoades , khe undeswy and He ellos 4g 2"
> Tderdifies cornet stork wth ao aiget oY acgn
; 7 Mag as okey oar » Volue ab vdlentifrer
dinput lok y I ainpud is a Reyer ; ok is Fount fie,
Butput — aber 4 Il outputs a Reywords a-bor is tolerti fey
+) ESCAPED Lpentrerers
¥ Vorleg HDL wltous whorater te he useok iv ur
Falenb per Jy coping te Udardtifies.
* Escaped saben foes degia uitth the tackslosh(\) sand
nok ath ant tupace.
* any parntalte ASCII character ean de Included sin
wsoped tdantifiens + The (Vs white pace org not conscderedl os
Part of rdents}ier
| \atb-e Nouste oh +e Aymbely
ayn Hause ef w' symbsl
Nayana-k, Asst. Prof, Ece, Svar 7Vactlog HDL IBECSB
DATA TyPES
@) VALue Set
* Vouleg supports 4 valu and & thoengths to model Hy
functionality sf Mot tordiuars .
¥ the 4 value Levels mu listed below
VALUE LeveL | Conpsrzon IN Harowaee Crecurr ]
0 Loge Zero , fotse Kendrlion
| togec one , dtAue wondel en
x Unknown dogee value
Z High simpedance, floating dtake
* In addition to togic values, atnangtin ely ur sued Lo
turolve con}icts Lebweart drivers of aafpsent threngths at
digital wineuib. Value Lwelr 0 2 ‘1’ won drove thy
Abungth devs Listed dele
STRENGTH LEVEL’ TYPE DEGREE t
Aupply an St Aongert
strong Driveng A
pul Datveag
Loge. stowage
tak, Darveng
medium + bovage
4molh 4 borage
hugh dugh cmpelano |Weakut
Nayona-k, Asst: Prol, ECE ,SvirVecleg HDL Ieee se
* q 2 tignols 4 auniqurod Atsengths axe wluven an a sure,
the athens atgeak paar
Fg X 2 eugnate of adaangth trong | ard uusakO “ontend ,
te Ault ib aolved ar a sbiong 4
* af 2 Atgneals of eoyrol shangths me wliven ven ty,
He ruwlt & unknown (x)+
Ege a4 2 agnals +4 ae strong] woud trong 0
con fuck» the Aut tan x,
¥ bksangth levels ore partials quefd for wccurok
Models ng of scgnal tontention » MOS deveres, dynamic Mos
wand stler Low- devel denier,
* Onty tung nets won have sb cvage + brangbhs Harge ; medium
& smo,
(il) Nets
¥ Nets apauent wonnections Letween trorduaw elemerch ,
+ Net Soe values tondinnousty daiven vent Hum by the
wut puts ol devices tray ars connested 0.
¥ On the frque dow a, be, d mre cnpubs 3 Yu outpuk
nA and 12 Atpaurent connection between Hu gate and
Fone st is a net!
wire = 1'bOS Mek 0 as fread bo tegee 0
war A= OF;
Nayana+k, Asst. Prof , ECE, Svar 4IPE CSE
Verclog HOL
% Neb au [bet volues doy lefoutt andin Huy ore vleclang
es verkou, They con dake valuss 0, 1), %
¥ The wlefott value of net az!
¥ Net get try weutpat vous of Hatin livers «
as no dniver , ack gets the value %,
Hi)REGISTERS
Lf aonet
¥ Reguateus Atpauenrt wlata tovege elements»
* Regestus Arkain value wntiL wnother value is placeg
Onto Hum. They wan stoke He values 0,1, %,%
* In
veulog , wegeaken meen wo vaalle that wan told a
volue
+ Regester de net need a luver , unleke me net, They
lo net need a clock os harducore Argeater velo,
¥ Values wo} Angaben von Me changed anytime on
atmutotion ty aaargnsing A WI Vole bo tha Acgeater ,
% Rogues ou decloned ty He kepvoord ‘Asg'
* The dafoult value for a seg’ ote type us ‘x!
Keg! vowel must be inctcabizent duithin wartial ex |
,
7 starts
ree MAC FM darkore O Vorabhe Agree thot con held ve value
dnt Mod.
Ace = I'bh N inittobize. suet to 4
#00 alo, HW efter 100 dime wrrte make arsed = 0
end °
4 cake wan lio te siclod ot signed Vowels sand ton be
used for argned ox tnvutte
Arq Avgned 6 63:0]m 5 I/ by bret 4vgned value om.
Nayona-k, Asst. Prof , €ce,SvirIv ECSB
Verrteg He
iv) VEcTors
* Nets ow xq lata ypu von Le didored wr veckou(muttepl
brt uals).
* y Wk in not apeertred » he dofarett scalar CI-bit )»
¥ Vutou tan le decloud os [ight t toot] or
Pow tdughat] , dre teft eumber dn dquere tracked iy
alurays meb ve. [msb:lsb],
aucre [1:0] tus sy || weclors P-bit net tus.
wurne [312 0] dns, tusB, tury I cleclores 3 fuser of 32bet
eg [63to}a; MN clechars b4-rtJawalte “a',
9 (0: podaddy 5 A} declares SJ-pct ride addrey vualte
¥ We wan meen wa Wt & pest of a vecko. a4 fellow,
@) Verkor part select
(5) Vawalle vector port select
a)VECTOR PART SELECT
+ We von wey o tre of a vector or pats of veto,
dy Apes yong He Wt numba uuvtun [ 7,
En:
busALT] = // bit 7 of vedo buA
bus [2:0] I 3- break siguefrrant biti of vector “bus'
DNores- hee we cconmnot ae tus [02510 dn Hu deglorstion
we tant sued u're [7:0}bua (ms iy igher than Leb). J
dd. [02170 2- mest sarge fuiant dnts of ladda’ varcabts
Nayana-K, Asst- Pro, , ECE , SVITVertlog HDL [8Ecse
b) VARZABLE VECTOR PART ELECT
Anew ee
* Vou leg HDL prowdy the suc kity te Fave vorwalto park
Aducks we vector This wallow park detects be Le put in
fou Aeopa to sdact -vouous ports of Hue vector, Thee vy
L Apectak port ~ delet eperctor
(@) [Atoruing— ait +t wdth]— part select tncsernents from stating
() Latarteng dit at dth)— pork select cleoements from tnaing bet
% The atorting bet of tue port select con be vamed, but thy
aud thos to Le constant y
Ex:
Ag [255:0].datat * I/ Avkte endian netation
wg [03255 ]datad; |) Biy endian notation
aq [120] tye»
byte = detad [31-18]; M ataating bit 31; width= 9 =) data [31:24]
byte = Aotas [24:2]; MN Akasting bet = 24; wwdth=F => detafay; 247
byte = dota [31-28]; MH Akaxking bet = 31) mudine 8 => vclata [ry 1317
byte = dakar [o4+se] ; Mskonding bel = 24) suidth=#=> data [24:317
¥ The starting Wk won alio Le a -vowalke. Tr Hs cose Hy
auth hos bo be wontond.
kn
[fel je, Gy SGM)
days = dotat[( jest: 0]; UM seqponce sis £130] [18:4] ----Bs:2
A pork of Hu vector can de wardiatioad
e
walocta! LC ¥rti¢) =3'bos tenn =I, clear fbrls
01 ECbyterarn 5 Ia efasen <1 cas pe
L
Nayana- k, Asst. Prot, ECE, SVir 1Vetkeg HpL (8ECSB
WV) Integer, Rear & Ttme Register Data Tyres
> INTEGER
¥ An inte ds a gensal purpose Atgcater dato. type suse]
ca mont puladig quant bies
y Grbegor or diclaud dy the Ray wood Sink eger a
¥ Getega vawolte 4 sued for te purpose 0f counting »
4 The left wuidth for an antegr ds the Mosk - machine
aur 4022, which ib implement aban apeetfre (atleast 32-04)
¥ Regtstes ducal as dota type ‘Aug’ atew values vos nacgned
pronk be, uheeos Antegus store valu ox segaed Cre 8 v6)
wpantites. Integus ow urgned values inside ‘inital “statement
En-
dink eae. count ¢ |) declore vawable vounk a4 shbeger
inibiag
“Mount = =I 5 I] shone =| tn” the ankege vaniolte count
> REAL
¥ Real numba centank ond Aral Auguste, dake fypa avy
declared tate the keyword ‘Aral!
¥ Real numbes «can Le Aprrrpeed dn deamal netation eg 3-14)
O% un sacenlific notation (e.g. 3e6 whch is 3Xi0f)
¥ Reok mambes wonnst have oc range lecleration waunol
Hrs chefoult value is 0),
¥ Kthen wo acal value i ascarid Ae van inbeger , the cof
Mumba is rounded off do the neat intega.
NayouasK, Asst. Pach, ECE, SvariV ertleg HDL Ie ec
Eu:
ALod val ta * ll define & areal vorralle «abled delty
dnrhi oS
dltashelo 5 // delta u atagned te acter fee notation
delta = 2.13 4 Wi delta as vaucgaed avalie 2-13
end.
intean 4 5 define oun enkeges 4
tana keto
fe deltas Ie gets Hre Volue 2( sounded value ef 2:13)
> Time
¥ Veurlog avouledion is wlone ausith Auspect te simulation time,
¥ A specal dime aigister deta dype i aed dn Vewloy to
Ate amulalin time
v4 bine vawelle fs ceclaud with the kiywerd din’,
+ The wudlth for tema Atgeater daca types is implementa on
apenfe dut bk-leart b4-biy
* The! § time" Systane furclion us invoked te get the cutter
Airmulodion time,
dima atm_bime y Th define we dimavawalle sim bing
tnt kod.
armkima = $ hime |
D Maowe tha wdaene sreclabin te!
¥ Aimudabion Lime u measuard an tory | Avmuulocion seconds,
The writ 4 daneted Jy ¥ , dame ar sal kine.
L
Nayana-k, Asst. Prel, ECE, Svar 14Vutleg Hou gece
(vi) ARRAYS :- vcelLection of Clements o} armuler dake type
+ A asouys axe wellowed in Verilog fe stg snbeger, temo, seal,
Acaltime arte wand vector sagrater dora bipa.
# Mult diminscanal weraiys an de declared aut sony mune,
of dumenacona + Indenes needs bo Le proweded for each dumeniton,
¥ Arrays arm accrued ty sonay-nvarne [inden] '
bu
dnkeger sound [0:7]; M Ain oon 4 g trbeger vowalles count
a9 boot [31:0] ; / Arsoy 4 32 bck aagustes vosr'attes .
Rime — ehk_poid [15100] 5 I] Arnay GI lop time check pour vawabtes
Ag [40] pou_cd[ 0:71] - I Rrnay I 8 port-cde > coh pert rd ds evil
winkeaer practun [420] [0:95]; Two wlimensvonah array of vetegees,
Arg [63:0] array yd L150] [1:0] L120} [25580] 5 I] 4nd arany
water [1:0] waray[$i0]5 /I an array J & domants ; each bet uude
WAtre W-amay Crvolls:00; / ctectore son anny 4 auagle bet maltes
+A ver A a aungte cement thot in abit wurde +
+ Rssougs Ors mutltipe cement thot ore bet ot n-beb ude
x we wan wucgn voluss te ements of aay os showin below
wount [5J=05 I make tee sh lomant of ania count = 0
vk point Ctov] = 0; Il Rerek 100" element 4 Aims Whk-purnt
pobead [2] = 07 M Ruck SA clemant of port wasiay
motun[i]LoJ= 339542 /ack value d dement crdoned by [1] [0] 3355,
saatouy yd LONLOILOICE] L530} =0 5 Reon Ants 1540 o] Hho wotray
whose nden 4 [oJloJ[o][oq
pork—ld= 0} J] Iegat syntore ~ attempt le suck entre any
Nagena:K, Asst. Pare}, ECE, SVIT 1S, Vewrkeg HDL IP ECSB
foci) MEMoReS
* Memeca vrs modeled in Vew'leg on a cent vcimenstional
vate.
x Fach demint of tha sasnray is knowin as wan element:
ox mad ond 4 addrsed Jy a single vornay Andon
¥ Each element ot urd von Le | & mee Inte
¥ A partioor auord in memory iy wortorned ty macag Hy
walle 0s Memory rag subsurpe
ku:
memt bit [0:10237, Ioct
“a rem | bit 2H memory memibce with 1K) I-bt
o ods
[_}
|:
10322
W023
Ke)
love
a T7:0] rrembyte [0210239 ‘Je
3 a a momb ath,
Poe VK , &-bet ene
ee
0
[1022
1023
le— 9 pry
mands [ sir] 1 fetches Idle saupicl tuvhore addres SII
Nay ona K, Asst. Pae|, ECE, Svar 16IB ECS
Verclog HDL
(wit) PARAMETERS
X Vowteg ablowu constant te Le dafinad sn wo eno due by
By Mywerd “pramebe”
¥ Porometes vonnot te used ox vawabter » Paromebr type
and atzes can elie be Behind
En:
prrouneter = 28 5 [I defines ww wonstant mn =F
Porameter portid= 5% Mtlefrnes wo constant pod = 5
Poremetr coche wudth=258 5 II conthant wlefres wudth f
MH toche Lino ,
parameter Aigned [15 oJ mudth 5 " pred acy Pee fea
porameler nudth
¥ Parameter values wean te changed suscrg Hee “del pasar’
abatement
+ ‘Youlog HDL Jecal parameter ( Aaja watag Reyword -Local para
wrx sdentitad to porarated emetp E” that- thay connat Le.
Modiped eu th te * af porsien' etolirent,
¥ The Lecod param Ray word mae debone pecan hen
they, values should nok bed
Eu: skade encoding a aw stole maclune con He solefinad
wusceg Lecalpertm . the state enading vonnet Ae schanged.,
Aovalparam state ,'b0001
utaked = 4'b0010,
Abake3 = 'b 0100,
Abate = 4’ b1000 5
NayanaK, Asst. Paol, ECE, SVITVeclog HDL IG ECS
% Sparel character sewe wm speval Prrpase cn daspleging
Escaped tharoutn Ahoract er iaplayed
\n nealing
\t tole
Lo °h
\ \
yy? “a
L \ 000 vehourmke, surllen (a 1-3 oct diyty
(ix) STRINGS
Aknsags con Me sboud oe ing!
* Te wordt of the Argue. vawables mut be Horge enough
te told He akning-
Each charade in be akuing kokes up #- bel Cl byte )lascas]
Df tre mucdth ef Hu reat is proter than the d2e
sof the stung , Veuleg fs de de the Left of the abnig
aukh zoe
Tf the Aegeaker wutdth i small then He abating suidth
Vewloy tawuoter te leftmost Hrs of the ating.
Tt os good to declaw a atacag aude han neceuaay,
En:- .
Aeg [8 ¥ ie 1] seacng_ value + If dleclore a vawalte that is 18 yg |
cant Evo
akacagvaluc = “Helle Verilog Weld": 11 string ean be stn)
Hsin vaw'abe
atacags 1 Auch ea newlias, tals wand aire phoegengy engqueint
volutes, Apeual uhoractey eon Le clep. un aban
venly shen they are parcded ty eecape characte a
bhovum Aelow*
Spewal Character
Nayana:K, Asst, Prof, ECE, svIT
18Vewleg Hp Igecsa
System TASKS & Comparer Drrectives
(i) SYSTEM TASKS
% Vowleg prewdes atonaderd system tasks te pefoun
surtain operadions « ALL system tasks vopywor oa the foo
¥ Apuaton auch os dap Louging on dhe Auer ,
monikeung values ra nets, asbopping ond prvahiag
Avmulodtion, wie lone Ay aged. Loske.
@) DISPLAYING INFORMATION
x fdesploy a the main aystom tosk fo. Acaplogeng voles
cat vewablu et skwngs ve enpauacont.
3 Weoge + Geditaplay Cpt p2) P%---- Pr) |
Pty p2) PB) ---- Pn wan de grote ataings wer vawaltes
oO empauscons s
¥ A gdvop. dnsets a nuukinre wt tye end of Ee abning
ty Aajault
¥ A ddeploy su'thout any exgument prccduis a reutlin,
+ Tt & srmclor to pratt stolement in C-
4 q varias xantain x’ o ‘2’ valu, Hhay wore printed
ws Xo wD,
Ex-
M Dieplag the «bacag in quotes
Gacsploy C" Hello Veuteg Weld") ;
~~ Hello Vewtog Kloot
I Display value ct vumrenk dmiclalion Lime 230
$Acplay ( ¢ time)
== 230
Noyona kK, Asct. Prof, ECE, Svat ic
Vewleg HDL I9Ecs®
¥ Shaving von be fomnatied waving the specfrabions hiaked
Adlow.
Format DIsPLay
fod or Lod Display veratle tn wleamad
Yb wn MB Display vawoble tn drinoy
Fs vn hs Ditaplou stacng
Yoh a %H Deaptoy vorwolke sn hem.
fen hl
Depa ASCII choractey
hm wv tM Display Avercadwcal namelno caguments
Atapiated )
Fov A %V Desploy abrength
ho wn %%O Désplay vartable in octal,
Yor 7 hil Display tin cument dime fomat
Pe AW Lek Dacploy Atol number in scent fee feget
ot ow LF
Desploy arok mam ben in mak Barat
Cy)
“G Display veal numbeu sr suentitee of
dauimol » uchidrever is shorter,
&
h 9
En-
Wy Dasploy value of Hi-brt wddrea IFEOLIC8 IC]
ot Aime 200
aeg [0:40] wodddr y
Goclvaplay (AL time od watual addaus Lh") thine, addr)
~7 Ak dime 200 watua) ado IFE€ ounces ich
—+—_
M Display value of portcd S in bunony
Arg [4:07 porttd y
Fdveploy ("Id of the pat in hb", ported y
~~ ID of the port is o0104
Nayana-k, nest. Prof 2 ECE, SviyVerleg HDL
ISEcse
I Display value of y-brt dus lOxx in Ininary
aug (3:0) day
fdisploy C™ Bw value sob" dus);
~~ Bus value is lOxx
_—_—+
ly Display the Ivermehicat name ve) outante pL
Anakontiated andor He dupes diel module «olled tap
No or guenent At needled » )
Fakes ploy (" ts stacag 4 cuaploged trom tom devel of
- de ”
~~ This ataceg is ebiaplaged from top. pt devel of Aaeratehy
— ¥—
I Disploy Kperal chorator, newline and Yo
$ suaplay Chm ds a \n multiline «tary
-- The & @
> mult line akaing auth a, ug
’ rth a %% sum "eo
nag rth a % ean’),
b) MontrorINe fnFormarzon
ZRONTTORING INFORMATION
¥ Vetdog Prowler eo mechanism #0 ment wo se
gu
auhin he volo vehonges . Thu a proucded + th
$moncter task.
Usage frronitor( pt, p2, p3,--.. pn);
The poremelers pd) p2
yp wan be vawobla , acgnal
mares or quoted ekacngs,
¥ $menckr tentinwersly moniteu He value of the
vawalles ar acgvals apecetred in the porameter Lek
wend evsploaus Ol poremeton ia the dist vehenever the
Nayana-K, Asst. Prof » ECE, SvIT
L
2)Veutlog HDL
IB ECSE
Valu ef ony L vorwably or ei ae vehangnd «
¥ Unie” $displag gmanitr nels tw de inveked ene
¥ Brly sone mantbeuag disk won be wutive ota timo.
y Hun iu mou than sre ¢movtn utotement on Hy
acmulotion , dhe ¢ monk «bobonent ait be Hue adhe
Askokenent ,
¥ Two casks wu auecl do suu'tch montkouns on k off.
) ¢monitoron $
") 4} monctorof} yi
The fmonitmon Lasky enables monitouny wound she
drrenrkoroff £04k olexattea menitouag vduning oo avmuletio|
Menvkeung ds Fuad on by vale foualt wt the beginning
vf te aemudlation and tan be controlled duary try
srouilodion wuckh the $montoren and ¢ reecef|
Aosks .
Eni- To mote time und valuo of the Atgnad clock 2 rciet
Ketevsvder lock doggies every S dire wads ered gee
down ot 10 dime units */
initial
degin
F moniter (feime, “Value f avgnals cLod= % b acsch=%b',
2
a © lod seid)
1 The postial vextput of the mentor 4 tatemant:
-- 0 value oh 4vgnals eck = 0 aus]
-- § Vale of 4 gros wok =} Auek =]
Goon LOn Valine
oh Aeqrele utock = 0 ruet =o
Nayana-k, Asst. Pre] , ECE , SVar71
2bVewlog HDL I$ECSB
¢) Stopring & FInasHINg £N A SIMULATION
¥ The system task fetop | ts prowded 20 Atop Lauspend)
oluaing Avmuloban
Usage $atop
* The $etop task puts Hu dcmuledton it wan interactive med]
The sdeavgner won then delreg the des tan from the ateradiie
mode.
¥ The gatop tork iv aued urunever dhe dagen wants to
Auspend the atmutation and mama the value of tinal
dn the ecg
¥ The $ fravsh Aak tumnotu te simulation
VW
Ex dkop b finish kasks
MI Stop wk time 100 in the “tmulobion ward enanuine the Act
NW Aiatsh the simulotion at Aime 1opo.
HM time=0
#100 Jatop I suspend Ha avmutociion at time = lop
HA Phrwshy I Lemunate kde simulation wt time = (oa
oad
Nagara-k, Aset Pao} , ECE, Svis
23“Nayana +k, Asst. Pah, ECE ,Svir
Vetlog Hoe
IPECT
(i) Cometren Darectrves __
% Lempaler vliaect'ves ore praowoled Ut Veutlog wand axe defined
dey sung Regard eonstauct
a) Nolepra
¥ The ‘elefine volvacctive ds suaecl bo elefing tent reacres an Veuleg
e Vee,
womptler aubctibutu dhe Lenk sof Hu mero suhencves
dk encounteu a ‘macte_nanu »
® The defined vontants am tent macros OA2 Led Ain Lie
a code ty Prrtedsing thom acth a
F Atmekon te telepone inc!
Ea defense forguey
4 ne wo kenk morro kok defines ahef alt ward acxe
Musk os ‘wrordesczo sr He todo.
\
lepine werd acre 3D
* (rack Hick epesstey
V/A gakop sulk Le sulettheted qubhoreer ‘e woppeors
\ Aeprne _$ —_ tatop
“n eben feqpertty wack dhentadning
. rae WORD-REG Atg [31:0]
Ma 32-bet regitter wan be wlefmed ou
(b)_* erchuds-
“wororeg as
¥ The ‘dnelude wlirreiive ollews prcqrammer Lo tn clude entire
wentents of a Vakog souru fle an another Veurhog fole clumng
womprlation
o The wlixeclie iu sued to grotude Deador Tle, tut contads
global or commonly sued pate ee! #endude ia‘!
Iefnclude the fol dead. Vv ,uulu'ch containa ecloradiony tn the mata
vuiteg fri Ausign. v ¥ |
Vanclude dwada.v
"ie veclog lode ta aescgnev >
24Verclog HOL IBECSR
Mopute- 2
| Mopues AND PorTS |
Mopures
A medals is the deste tuilding beck in Vew'tog,
— A module aan de ar eiment or collection of
Lowe- Level duncan Mocks, It duccbu funcionality of design
> A Medi in Veleg wenssts f dusdinck ports
we theun in pique Lelow,
Bose components of a modute
Mopuie Name,
Port List, PorT DECLARATIONS CaF Ports PRESENT)
Parameters (OPTrONAL)
DECLARATION OF Weres, DATA FLOW STATEMENTS
REG AND OTHER VARIABLES CAsszqn)
INSTANTIATION OF LoweR Auwaygs & Inzrzar Brocks|
LeveL Mopuces ALL BenAvaoRAL STATEMENTS
. Go In Tuese Brocys
Tasks AND Functz0Ns
ENDMopuLeE = SrATEMENT
tg: Componente qf a Veuteg Module
AA module defvartion always Jegcar uatth kyword “madule ”
Nayana-K, Asst. Paol ECE, svar 2sVetlog HDL IS ECR
—> The module name, pert Wit , port decorations and
sptronal porometes must de fru in a module
defatihion
The five components uuthin a medule aw
Vawable declorations , dataflow abatements, i
+f tower medulu, Lehawerel Hecks and tasks Ow function
Thee vempenents can te in any ode vad
Plow sn the moolule aefentbion ,
any
+ The endmodule statement musk sols some Lost in
Oo module aefinthion ,
—+ Al tomponents module » module nome wand endmoduly
0 op and con ee ee wund mated ou
pu dutian need
s
enacdix te emample ef san SR batch de arleutand
Hr scompentnts the medule,
Sbor
(3d) 8
Qbar
Abos t {
(asset) bLa--------3
Ky 6R Lod
Nayona-k, Asst. Pref , ECE, Sva7 26Vewteg HDL (BEC
+ The SR Latch con le modeled as shoun
module SRtatch ( Y, Ghar , Shor, abor) 4 || module name, Portli
input shar, rbor ; I) Pork declorat'ons
output GY , Gbor ;
Nond at (G) shar, Whar) 5 Il dutunt'ab verilog prince masad
mand n2d (aba, abu, 4) j Hq procbive castanuenare(outpnl, caputs)
endmodule
+A A Atimub Hock Ios te be uu'tten to vety the forctionality
of Hee volo design Mock
Trodule adirnwlus 5
Ag sek, duet 5 I declaration of 22g- come er differnt names
be ated
bure 8, Qbar 7 I) dedarotion ite dame ot Apart moons
Skat mi(&, Abar, set, want) > // instarttinte ¢ Rode
sntdiok
degin
$monitor($ time, get =
ah = 0 5 Aesek= 0;
#5 sd
by Actb= bb, G2 %b ", set, rect, 0);
"
Oj Ateet =4 5,
Ho 4b = 4; suet= 0;
HS sk = 1; Aetet= 1;
end
endmodwle
NOTE: For wo slirulus stock
+ All anpat vewabls an ues block ve dedared as “nug"
¥ All woutput Vawaltes in dern block vare wlecloued ay
+ Tnstowtate Desrgn Mock ~ pau prranuteu by ede ot namy
(go values "be vas abter
Nayana-k, Asst Pro} ) ECE, Svar 27Vewlog HDL geen
Ports
— Pot provide the intufad by auhith a module won
dommnunsokt awth its environment,
> The snpvt] output pau of on TC ore att ports.
—+ The enwronment con vntaract uth the module
Hough oh pols. The intunels +f the module ae net
viacble te the enwaonment.
Ths provide a powurrdual Pewiletity te the dercpact,
> Ports ore aleo spurned te os“ taminals",
1) Last OF Ports
+ A module definition «entain von wephional uit of ports,
+ Th tu module dou not wang atqnals auith the
enwaonment , Hee awe no ports in the Avast.
> Aonaides a hott full adder thot ib instuntiated inne
A top-level module named “ads, "
Mapek | output ports 1mm fl adder ix shown bela
> Module stimulus is Aop- Level module »
+ Module fwladdl is instantiated below thinulu,
Nayana-K y dest. Pash / ECE, Svr7 298Verleg Hp I8EC SE
4
> The module full-eddy tok input en ports a,b and cin,
and produces an output ven pots sum end cout. Thus
module ful-aday perfouns addi bon for ths envixonment.
> The modu stimulus i dep devel module an the simulate
wund dees net nud be pow signals do ot Accerve argaals from
He enwaonment. Thus tk wos not have wo Jick of ports,
F The module mom cand pert Lith for dethe ( full-adill satiull
Modul declorotions in Vewtog ih ae shown below
module -fulloddy (sum, cout) we, b, win) 5 faith pest list
module szdimulus 5 Ino List of posts
as
») Port DECLARATION
AWM ports in the deat sof pots muut de declared in the
module. Povs wan be declared war follows +
) inpuk — inpwk pot
2) euckpwt — eukpuk poe
3) dneunk —— Lidiucbienal pot
Fak posk in the iat 3 dived as Laput, wulput ot inout
dased ven Hue liraecion of the port signal.
The put Audmation for a y-brt full adder iy ay shown below
module full-vaddt (sum, “out, ab, un) »
Ynpuk [3:0], bs |jy- bet dab fps sum.
, a ee
dinpuk ain ; 7 . futeadal
eutpwk [3:0] awmy Il Ao bit sun ofp 4 | souk
ouk ye out 5 ua
Zoodule entownalss
endmoducle
Nayonn-k, Acst Pref, ECE, Svit 24Vewlog HDL WECsE
> AIL pout declarations wart immpliutly clulared a4 Tawa i
Yesteg
+ input" ot dined "pos oe normally leclored vas Nae"
+ Tf eutput ports hold or «tow eet mut Le declared
as “ang
+ Exompl. 2: Port declaration fe D-FF
module DFF( y, d, «tk, Aust) ¢
Anpnt ah) atk, auset 5
output ay 5 D_FF
Mg oy; Hop pork heldg|étoces value
wdmodule
+ Posts of the hype inp & snout cannot be declored ar reg”
Accomse Atg vor btes Ako values wurol input ports «hold
net shoe values Jruk Atfleck the changes an Hu entanal
agree Hhey sour connected: :
a
Te ANSI ¢ Abyle ayrtan &o Apeaby the pos, of
Hot modulo as shoun Lelow. Tha avecds aluphivation of
mowing He pert doth in the moduk alefrnctien werrel port -
Atak
NOTE :-
medile fu addy ( outpace wg [3:0] sum y
Out put Ag
endnodulo
Nayana kK, Asst. Prot, ECE, svaz 3dVethog HDL 19 €cst
39 Port Connection Ruves.
HOA pert convets of 2 units , one wut that is intaned
to the modub wand onothn that is internal te Hu module.
+ The intemal and entunal unth ae connected. Thee
ore Audley qoverny pot connection alin module ow
auskontiated authin etlor modules,
> The vee Armuuleter complains af any pert wonnection
Auli arr woleted - Tha Pot uonneckion rules wort wot follows
fag ou net
Pork connection actes
Input $
¥ Intenally, dapat potty mut always be pe “net
Tntenally, dapat p Oe fee
¥ Extan ) 2nput pov ton de connected to we vawable wich
aS Oe ‘out -
Output
% Triton, outpuk po con be of He type “eq be’net'
y Entonally wutput pos must be «connect ed to ae nwt!
Inout:
¥ Dntonally » snout ports nuutt -olaways Le of the bype “not!
¥ Entunally ) trout pets muut always be vonnected te & “ach
WIDTH MATCHING $
¥ Tt is Legal to connect intanal and enternal unctt of
Nayana-k, Asst, Past, ECE, $vir 3)Vewlog HDL SECS.
ali ffprent airy wahen making intw- module port ann echory,
¥A aaanning is type cally wud thot the wulths oe net
™odkth.
UNCONNECTED PoRTS $
* Veuideg wallow ports to Aumain suncennected:
* Lekein autpat par may Le used enty for debugging are
4 you awe nat intersted de connect suck pos Lo thy
tntunol argnols, then such pods ran Aemain unconneded
Jy inaketicching a module a4 shown below
ful-addy foo(sum, A,B, CIN); /x out put port
Cout ip unconne cles”
x
ConnectinG Ports To ExrernaL Sr6nats
* Thee og 2 metheds 4 maktng “ennections detween
4rqnals ape feed in tho medule inmstantiotion sand the ports
in a module ifrathion «
¥ Thue bvo methods connet Le mud.
% The 2 methods wu:
') Lennucling Ports bywordirecl heat om Port mapping Jy order
2) Jonneching pots ty nome oo Pert mapp
Oo denaee
Neayora +k , Asst. Pref, ECE, Svat 32\
Veclog HDL IFECS
ConnecTINg Ports By ORDERED Last
* Lennecting ports dy wrlred Lak is the mort vahutive
¥ The Argnols te le connected must onpeor sa the
Medule iwtontiaton in tle same BAMA gu he
tn the port Last of module velefeec tron.
S Menacder tha enampds of vo fultaddy (1-b¢t futlaclder)
module Top,
rug [3:0]a, og
neg CIN ;
AAALAR C3:o]sum;
Aatar COUT y
NM dvstovivake futl-addy ona connect Avgrals 40 pertiin ede,
fulioddy fat (sum, cour, A,B, CIN) S Mtonnect by ode
sds >
endlne due
pets
module ful add (tum, taut) a, b, ua),
output [3:0]4um ;
outpuk — teuk +
Jnpuk [3,0] a, bs
dnpuk cn
Nayana-k, Asst. Pao , ECE, svar 33Veawhog HDL 18 ECS
¥ Fo Lange dura uuhue module dave mor than sdpos
Aue Leung He werden ef the port in the mo dle
oleate on as tenpaacte col nd wor prone.
¥ Vuuleg prowdu the capability to wonruck enternal 4c gna
ste port ty the pert names, Aothn than ty order (portion)
¥ Me von cpecty the port venucion in ony oroler 04
dong as the pot name in tHe module defenck on
veomuctty moti the emntunal signal
* Eg. ane ton vennect the ports ty nome sy srakondh abing
He module futadony soe follows Cruhote code 4 came entsp + nutateliin)
I Inetantia module fulleddy ond connect pact by namu,
full-aal fat (cout coor), + (A), + CB), «ern(can) ~Sum(stm))e
v
NOTE:- The crdur ef ports i aot important
¥ Only thae pot Hrat vor to le uennected to tok anes tig raby
mud dt aperbred dn pork conneck’on My nome
* Untemucted pots won Le wlropped Eg tp cous wuere bp
We unconnected , He catantiotin wiclt be
[porceaty fot (-4umCsum), +b(B) , « ainCcrn) , a,
¥ Another vadvand age ci wonnucling ports dy name thet
vas Long as Hu pot nana ib not changecl, the order of
He per in Humlist of o module van Le Aasnanged
mat dbo hanging He port aonnerctiong cn wo dio,
anak ond okions
Nayana-k, Asst Pel , ECE, Svat 34(BEC
Vertlog Hoe sé
¢
HiIeRaRcHicaL NAMES |
=> Vew'leg supports Avvrordu col aucga methodology.
+ Evey modulo instomee , axqral , A vartabte ds lefrned
mutt oun tedentifrer + A particwlor Hidurdi rer ros 0
wunriqne plore in te wdeavgn dev enan cha «
> Heercuducol name acfounuing willows us to denote
woy Eiderds fra in the Busia Arierorchy ec ara
Vw que viture »
pA dkvorhical name & o det + sedans foes separated
dry shots (+) for each sever vf tecrauehy
> Thu, any vider for ean be addarued from wry
place an Lhe vuign Jy sump ly Apeatying the complete
—* The top-level module is colted the “Root” modulp
4une th not tukantiated any wlre . It bp th
shorting porat.
— To aavgn oe nome te von dadent fea , stout
from the op- Lwel module and trac thy path along
the design Iurrorchy de the aduacaed A dunt fier
+ Knample ! Kenda the atmutedton sf SRLatch . The
design duro duy fo the come ub thou
Nayana+k, Asst. Prof , ECE, SvT7 colVeatloy HDL IEC SB
d
mai
ybon
(SR-dakeh) Sk , rerek
Cvartattes )
na nd | o ghee
Coed) Crand) Cavgrols)
ry Devgn Heerarcy as SR Lotth smuletia,
> Fe this semulation, “yormulus" a the Jop- level module
svat ck is nek gncdiated ang were , Tt if colled sou
He soot module
—+ The daenti frou ufired an this module ware ay , aybar
AK & auc.
TH Acet modulo snstantiotes m1, uch ss wa module
| SR Latch ,
—+ The module m4 instantiated nand
gots nig nr.
+ 8,
Boor 1S £ R wre pot atgnals tn inukanue m4.
A Hreorducel nome mepouniiag ens ge amp
He cach saber foes
+ To wurga Ainrarchiced nonut, wie the module now
fer rset module end instunu nae fr all module
unskuney Aelow Aho vecot module.
3t
Nagona K , Asst. Pref) Ece, SvarVertlog HDL IRECER
+> Heracdical name fo ald caer fiers i He SRLekch
Atmuledion shown 4 as fotlous.
Thee ib we let (+) for cach level wf Werouhy from
the -reet module te the luvaed sddundifier.
He
Akimulus adil s gy
ALimulus . yeu stimulus, set
shimulus . acset stimulus. m1
4dimulus. m1. Ahimulus. m4. bay
stimulus. m4. atimully. m4. R
Abdus a2.
NOTE: Each sdordli fer wn the lungn He unquely Apeecfeed
+4 the duunduicol poth narra,
To display tho Level of huwarchy , use the speaal stung
founad” Som’ sin Ks $Aruplay trak
*
L
Noyona +K, Asst. Paol , ECE, SVIT ai