You are on page 1of 79

HDL LAB IVth Sem EC

H.D.L LAB
For IV Semester B.E
Electronics and Communication Engineering
(As per VT S!lla"us#
HDL MANUAL EC Dept, RNSIT 1
HDL LAB IVth Sem EC
E$%E&I'E(TS LIST (ACC)&DI(* T) VT S+LLABS#
HDL MANUAL EC Dept, RNSIT
SL.() (A'E )F THE E$%E&I'E(T %A*E ()
, L)*IC *ATES -
. ADDE&S A(D SBT&ACT)&S ,/
0 C)'BI(ATI)(AL DESI*(S
a.. T) 1 DEC)DE&
".2 T) 0 E(C)DE&
c.2 T) , 'LTI%LE$E&
d.1 BIT BI(A&+ T) *&A+ C)(VE&TE&
e. 'LTI%LE$E&3 DE4'LTI%LE$E&3
C)'%A&AT)&
,1
1 FLL ADDE&(0 ')DELI(* ST+LES# 0.
5 0. BIT AL SI(* THE SCHE'ATIC DIA*&A' 06
- FLI%4FL)%S (S&3 D3 78 A(D T# 1/
6 1 BIT BI(A&+3BCD C)(TE&S
S+(CH&)()S 9 AS+(CH&)()S C)(TE&S
15
2
:
ADDITI)(AL E$%E&I'E(TS
&I(* C)(TE&
7H)(S)( C)(TE&
I(TE&FACI(*
, DC A(D STE%%E& ')T)& 12
. E$TE&(AL LI*HT C)(T&)L 5,
0 ;AVEF)&' *E(E&ATI)( SI(* DAC 5.
1 SEVE( SE*'E(T DIS%LA+ 5-
2
HDL LAB IVth Sem EC
%&)*&A''I(* (using VHDL and Verilog#
,.;rite HDL code to reali<e all t=e gates.
..;rite a HDL program >or t=e >ollo?ing com"inational designs
a. . to 1 decoder
". 2 to 0 (encoder ?it=out priorit! 9 ?it= priorit!#
c. 2 to , multiple@er
d. 1 "it "inar! to gra! conAerter
e. 'ultiple@er3 de4multiple@er3 comparator.
0. ;rite a HDL code to descri"e t=e >unctions o> a >ull adder using t=ree modeling
st!les.
1. ;rite a model >or 0. "it AL using t=e sc=ematic diagram s=o?n "elo?
A(0,B/#
.
AL s=ould use t=e com"inational logic to calculate an output "ased on t=e >our
"it op4code input.
AL s=ould pass t=e result to t=e out "us ?=en ena"le line in =ig=3 and tri4state
t=e out "us ?=en t=e ena"le line is lo?.
AL s=ould decode t=e 1 "it op4code according to t=e giAen in e@ample "elo?.
HDL MANUAL EC Dept, RNSIT
)%C)DE AL )%E&ATI)(
,. ACB
.. A4B
0. A Complement
1. ADB
5. A A(D B
-. A )& B
6. A (A(D B
2. A $()& B
3
)pcode(0B/#
Ena"le
HDL LAB IVth Sem EC
5. DeAelop t=e HDL code >or t=e >ollo?ing >lip4>lop3 S&3 D3 783 T.
-. Design 1 "it "inar! 3 BCD counters (S!nc=ronous reset and as!nc=ronous reset# and
Ean! seFuenceG counters
INTERFACING (at least >our o> t=e >ollo?ing must "e coAered using VHDLHVerilog#
,. ;rite HDL code displa! messenger on t=e giAen seAen segment displa! and LCD
and accepting He@ Ie! pad input data.
.. ;rite HDL code to control speed3 direction o> DC and stepper motor.
0. ;rite HDL code to accept 2 c=annel analog signal3 Temperature sensors and
displa! t=e data on LC panel or seAen segment displa!
1. ;rite HDL code to generate di>>erent ?aAe>orms (Sine3 SFuare3 Triangle3
&amp etc.3#using DAC c=ange t=e >reFuenc! and amplitude.
5. ;rite H DL code to simulate EleAator operation
-. ;rite HDL code to control e@ternal lig=t using rela!s.
DDDDDDDDDDDDDDDDDDD
HDL MANUAL EC Dept, RNSIT 4
HDL LAB IVth Sem EC
HDL 'A(AL
It is one of most pop!"# soft$"#e too! se% to s&nthesi'e VHDL (o%e) This too!
In(!%es m"n& steps) To m"*e se# fee! (omfo#t"+!e $ith the too! the steps "#e
,i-en +e!o$./
Do+!e (!i(* on 0#o1e(t n"-i,"to#) 2Assme% i(on is p#esent on %es*top3)
Se!e(t (E; %&)7ECT in FILE 'E(.
Ente# fo!!o$in, %et"i!s "s pe# &o# (on-enien(e
0#o1e(t n"me . s"mp!e
0#o1e(t !o("tion . C.4e5"mp!e
Top !e-e! mo%!e . HDL
In (E; %&)7ECT %#op%o$n Di"!o, +o5, Choose &o# "pp#op#i"te %e-i(e
spe(ifi("tion) E5"mp!e is ,i-en +e!o$.
De-i(e f"mi!& . Sp"#t"n2
De-i(e . 5(2s266
0"(*",e . 07268
T90 Le-e! Mo%!e . HDL
S&nthesis Too! . :ST
Sim!"tion . Mo%e!sim ; othe#s
<ene#"te sim !"n, . VHDL
In so#(e $in%o$ #i,ht (!i(* on spe(ifi("tion, se!e(t ne$ so#(e
Ente# the fo!!o$in, %et"i!s
Entit&. s"mp!e
A#(hite(t#e . Be=aAioral
Ente# the inpt "n% otpt po#t "n% mo%es)
This $i!! (#e"te sample.VHDL so#(e fi!e) C!i(* Ne5t "n% finish the initi"! 0#o1e(t
p#ep"#"tion)
Do+!e (!i(* on s&nthesis) If e##o# o((#s e%it "n% (o##e(t VHDL (o%e)
Do+!e (!i(* on Ln(h mo%e!sim 2o# "n& e=i-"!ent sim!"to# if &o "#e sin,3 fo#
fn(tion"! sim!"tion of &o# %esi,n)
Ri,ht (!i(* on sample.VHDL in so#(e $in%o$, se!e(t ne$ so#(e
Se!e(t so#(e . Imp!ement"tion (onst#"ints fi!e)
>i!e n"me . s"mp!e
This $i!! (#e"te s"mp!e) UC> (onst#"ints fi!e)
Do+!e (!i(* on E%it (onst#"int 2Te5t3 in p#o(ess $in%o$)
E%it "n% ente# pin (onst#"ints $ith s&nt"5.
NET ?NETNAME@ L9C A ?0IN NAME@
Do+!e (!i(* on Imp!ement, $hi(h $i!! ("##& ot t#"ns!"te, m"ppin,, p!"(e "n% #ote
of &o# %esi,n) A!so ,ene#"te p#o,#"m fi!e +& %o+!e (!i(*in, on it, inte#n $hi(h
$i!! (#e"te )+it fi!e)
Conne(t BTA< ("+!e +et$een &o# *it "n% p"#"!!e! pot of &o# (ompte#)
Do+!e (!i(* on (onfi,#e %e-i(e "n% se!e(t mo%e in $hi(h &o $"nt to (onfi,#e
&o# %e-i(e) >o# e5. se!e(t s!"-e se#i"! mo%e in (onfi,#"tion $in%o$ "n% finish
&o# (onfi,#"tion)
HDL MANUAL EC Dept, RNSIT C
HDL LAB IVth Sem EC
Ri,ht (!i(* on %e-i(e "n% se!e(t Dp#o,#"mE) Ve#if& &o# %esi,n ,i-in, "pp#op#i"te
inpts "n% (he(* fo# the otpt)
A!so -e#if& the "(t"! $o#*in, of the (i#(it sin, pattern generator F logic
anal!<er)
E$%E&I'E(T (). ,
;&ITE HDL C)DE T) &EALIJE ALL L)*IC *ATES
AI'B Sim!"tion "n% #e"!i'"tion of "!! !o,i( ,"tes)
C)'%)(E(TS &EKI&EDB >0<A +o"#%, >RCEs, 1mpe# "n% po$e# spp!&)
Trut= ta"le ?it= s!m"ols
HDL MANUAL EC Dept, RNSIT G
HDL LAB IVth Sem EC

BlacI Bo@
(
" %
e
f
+ ,
h
i
HDL MANUAL EC Dept, RNSIT H

L)*IC
*ATES
HDL LAB IVth Sem EC

Trut= ta"le Basic gatesB
VHDL C)DE VE&IL)* C)DE
!i+#"#& IEEEI
se IEEE)STDJL9<ICJ11G4)ALLI
se IEEE)STDJL9< ICJARITH)ALLI
se IEEE)STDJL9<ICJUNSI<NED)ALLI
entit& ,"tes is
0o#t 2 ",+ . in st%J!o,i(I
(,%,e,f,,,h,i . ot st%J!o,i(3I
en% ,"tesI

"#(hite(t#e %"t"f!$ of ,"tes is

+e,in
(KA " "n% +I
%KA " o# +I
eKA not "I
fKA " n"n% +I
,KA " no# +I
hKA " 5o# +I
iKA " 5no# +I
en% %"t"f!$I
mo%!e "!!,"te 2 ", +, & 3I
inpt ",+I
otpt L1.GM &I
"ssi,n &L1MA " F +I
"ssi,n &L2MA " N +,
"ssi,n &L3MA O" ,
"ssi,n &L4MA O2" F +3,
"ssi,n &LCMA O2" N +3,
"ssi,n &LGMA " P +I
en%mo%!e
%rocedure to Aie? output on 'odel sim
1) Afte# the p#o,#"m is s&nthesi'e% (#e"te " Test +en(h, !o"% the inpt)
2) Hi,h!i,ht the t+$ fi!e "n% (!i(* onto Mo%e!sim Sim!"te +eh"-io#"! mo%e!)
3) No$ (!i(* the $"-efo#m "n% 'oom it to -ie$ the #es!t)
'odelsim )utput
HDL MANUAL EC Dept, RNSIT
" + ( % e f , h i
6 6 6 6 1 1 1 6 1
6 1 6 1 1 1 6 1 6
1 6 6 1 6 1 6 1 6
1 1 1 1 6 6 6 6 1
8
HDL LAB IVth Sem EC
9tpt 2( to i3
%&)CED&E T) D);(L)AD )(T) F%*A
13 C#e"te " UC>2Use# Const#"ints >i!e3)
23 C!i(* on UC> fi!e "n% (hoose "ssi,n p"(*",e pins option "s sho$n in the fi,#e
+e!o$)
33Assi,n the p"(*",e pins "s sho$n in fi, +e!o$
HDL MANUAL EC Dept, RNSIT Q
HDL LAB IVth Sem EC
33 s"-e the fi!e)
43 C!i(* on the mo%!e "n% (hoose (onfi,#e %e-i(e option)
C3 The fo!!o$in, i(on $i!! +e %isp!"&e%)
G3 Ri,ht (!i(* on the i(on "n% se!e(t p#o,#"m option)
H3 0#o,#"m s((ee%e% mess",e $i!! +e %isp!"&e%)
HDL MANUAL EC Dept, RNSIT 16
HDL LAB IVth Sem EC
83 M"*e (onne(tions to m"in +o"#% "n% %",hte# +o"#%s2 +efo#e (onfi,#in, 3 , ,i-e
ne(ess"#& inpts f#om DI0 SRITCH "n% o+se#-e the otpt on LEDs)
NET S"S L9C A SpH4S I
NET S+S L9C A SpHCS I
NET S(S L9C A Sp84S I
NET S%S L9C A Sp114S I
NET SeS L9C A Sp113S I
NET SfS L9C A Sp11CS I
NET S,S L9C A Sp11HS I
NET ShS L9C A Sp118S I
NET SiS L9C A Sp121S I

&epeat t=e a"oAe %rocedure to all t=e %rograms.
&ESLTB The !o,i( ,"tes %esi,n h"-e +een #e"!i'e% "n% sim!"te% sin, HDL (o%es)
E$%E&I'E(T ()..
HDL MANUAL EC Dept, RNSIT 11
HDL LAB IVth Sem EC
AI'B R#ite " HDL (o%e to %es(#i+e the fn(tions of H"!f "%%e#, H"!f S+t#"(to# "n% >!!
S+t#"(to#)
C)'%)(E(TS &EKI&EDB >0<A +o"#%, >RCEs, 1mpe# "n% po$e# spp!&)
(a# HALF ADDE&
T&TH TABLE BASIC *ATES





B))LEA( E$%&ESSI)(SB
SLA B
CLA B
VHDL C)DE VE&IL)* C)DE
!i+#"#& IEEEI
se IEEE)STDJL9<ICJ11G4)ALLI
se IEEE)STDJL9< ICJARITH)ALLI
se
IEEE)STDJL9<ICJUNSI<NED)ALLI
entit& HA is
0o#t 2 ", + . in st%J!o,i(I
s, ( . ot st%J!o,i(3I
en% HAI

"#(hite(t#e %"t"f!o$ of HA is

+e,in
sKA " 5o# +I
(KA " "n% +I
en% %"t"f!o$I
mo%!e h" 2 ", +, s, (3
inpt ", +I
otpt s, (I
"ssi,n sA " P +I
"ssi,n (A " F +I
en%mo%!e
HDL MANUAL EC Dept, RNSIT
I(%TS )T%TS
A B S C
6 6 6 6
6 1 1 6
1 6 1 6
1 1 6 1
12
HDL LAB IVth Sem EC
("#HALF SBT&ACT)&

T&TH TABLE B))LEA( E$%&ESSI)(SB
D L A B
Br L
B A
J

BASIC *ATES

VHDL C)DE VE&IL)* C)DE
HDL MANUAL EC Dept, RNSIT
I(%TS )T%TS
A B D B#
6 6 6 6
6 1 1 1
1 6 1 6
1 1 6 6
13
HDL LAB IVth Sem EC
!i+#"#& IEEEI
se IEEE)STDJL9<ICJ11G4)ALLI
se IEEE)STDJL9< ICJARITH)ALLI
se IEEE)STDJL9<ICJUNSI<NED)ALLI
entit& hs is
0o#t 2 ", + . in st%J!o,i(I
%, +# . ot st%J!o,i(3I
en% hsI

"#(hite(t#e %"t"f!o$ of hs is

+e,in
%KA " 5o# +I
+#KA 2not "3 "n% +I

en% %"t"f!o$I
mo%!e hs 2 ", +, %, +#3
inpt ", +I
otpt %, +#I
"ssi,n %A " P +I
"ssi,n +#A O" F +I
en%mo%!e
(C#FLL SBT&ACT)&
T&TH TABLE B))LEA( E$%&ESSI)(SB
DL A B
C
BrL
J
A
B C B Cin C
J
A
Cin

HDL MANUAL EC Dept, RNSIT
I(%TS )T%TS
A B Cin D B#
6 6 6 6 6
6 6 1 1 1
6 1 6 1 1
6 1 1 6 1
1 6 6 1 6
1 6 1 6 6
1 1 6 6 6
1 1 1 1 1
14
HDL LAB IVth Sem EC
BASIC *ATES
VHDL C)DE VE&IL)* C)DE
!i+#"#& IEEEI
se IEEE)STDJL9<ICJ11G4)ALLI
se IEEE)STDJL9< ICJARITH)ALLI
se IEEE)STDJL9<ICJUNSI<NED)ALLI
entit& fs is
0o#t 2 ", +, ( . in st%J!o,i(I
%, +# . ot st%J!o,i(3I
en% fsI

"#(hite(t#e %"t"f!$ of fs is
+e,in
%KA " 5o# + 5o# (I
+#KA 22not "3 "n% 2+ 5o# (33 o# 2+ "n% (3I
en% %"t"fo!$I
mo%!e fs 2 ", +, (, %, +#3
inpt ", +, (I
otpt %, +#I
"ssi,n %A " P + P (I
"ssi,n +#A22 O"3F 2+ P (33 N 2+ F (3I
en%mo%!e
&ESLTB The h"!f "%%e#, h"!f s+t#"(to# "n% f!! s+t#"(to# %esi,ns h"-e +een #e"!i'e% "n%
sim!"te% sin, HDL (o%es)
E$%E&I'E(T ().0
AI'B R#ite HDL (o%es fo# the fo!!o$in, (om+in"tion"! (i#(its)
C)'%)(E(TS &EKI&EDB>0<A +o"#%, >RCEs, 1mpe# "n% po$e# spp!&)
0.a# . T) 1 DEC)DE&
BLAC8 B)$

T6
Se! 6
Se! 1 T1
T2
E T4
HDL MANUAL EC Dept, RNSIT 1C

2 to 4
De(o%e#
HDL LAB IVth Sem EC
T#th T"+!e of 2 to 4 %e(o%e#
E Se!1 Se!6 T3 T2 T1 T6
1 6 6 6 6 6 1
1 6 1 6 6 1 6
1 1 6 6 1 6 6
1 1 1 1 6 6 6
6 : : 6 6 6 6
DATA FL);
NET SeS L9C A SpH4SI
NET Sse!K6US L9C A SpHCSI
NET Sse!K1US L9C A SpHGSI
NET S&K6US L9C A Sp112SI
NET S&K1US L9C A Sp114SI
NET S&K2US L9C A Sp113SI
NET S&K3US L9C A Sp11CSI
Simulation is done using 'odelsim
R"-efo#m $in%o$ . Disp!"&s otpt $"-efo#m fo# -e#ifi("tion.
HDL MANUAL EC Dept, RNSIT
VHDL C)DE VE&IL)* C)DE
!i+#"#& IEEEI
se IEEE)STDJL9<ICJ11G4)ALLI
se IEEE)STDJL9<ICJARITH)ALLI
se IEEE)STDJL9<ICJUNSI<NED)ALLI

entit& %e(2J4 is
po#t 2", +, en .in st%J!o,i( I
&6, &1, &2, &3.ot st%J!o,i(3I
en% %e(2J4I
"#(hite(t#e %"t" f!o$ of %e(2J4 is
+e,in
&6KA 2not "3 "n% 2not +3 "n% enI
&1KA 2not "3 "n% + "n% enI
&2KA " "n% 2not +3 "n% enI
&3KA " "n% + "n% enI
en% %"t"f!o$I
mo%!e %e(2J4 2",+,en,&6,&1,&2,&33
inpt ", +, enI
otpt &6,&1,&2,&3I
"ssi,n &6A 2O"3 F 2O+3 F enI
"ssi,n &1A 2O"3 F + F enI
"ssi,n &2A " F 2O +3 F enI
"ssi,n &3A " F + F enI
en% mo%!e
1G
HDL LAB IVth Sem EC
9tpt
0."# 2 T) 0 E(C)DE& ;ITH %&I)&IT+
BlacI Bo@


iH V3
V1
V6

en5
i6 V

en
T#th t"+!e
En IH IG IC I4 I3 I2 I1 I6 V2 V1 V6 en5 V
1 : : : : : : : : 1 1 1 1 1
6 1 1 1 1 1 1 1 1 1 1 1 1 6
6 1 1 1 1 1 1 1 6 1 1 1 6 1
6 1 1 1 1 1 1 6 : 1 1 6 6 1
6 1 1 1 1 1 6 : : 1 6 1 6 1
6 1 1 1 1 6 : : : 1 6 6 6 1
6 1 1 1 6 5 : : : 6 1 1 6 1
6 1 1 6 : : : : : 6 1 6 6 1
HDL MANUAL EC Dept, RNSIT 1H
8.3
0"#it&
En(o%e#
HDL LAB IVth Sem EC
6 1 6 : : : : : : 6 6 1 6 1
6 6 : : : : : : : 6 6 6 6 1
VHDL C)DE VE&IL)* C)DE
!i+#"#& IEEEI
se IEEE)STDJL9<ICJ11G4)ALLI
se IEEE)STDJL9<ICJARITH)ALLI
se IEEE)STDJL9<ICJUNSI<NED)ALLI
entit& en(o%e#8J3 is
0o#t 2 i . in st%J!o,i(J-e(to#2H %o$nto 63I
en . in st%J!o,i(I
en5,V . ot st%J!o,i(I
' . ot st%J!o,i(J-e(to#22 %o$nto 633I
en% en(o2I
"#(hite(t#e +eh"-io#"! of en(o%e#8J3 is
+e,in

en% +eh"-io#"! I
mo%!e en(8J3 2I, en, &, -3I
inpt LH.6MII
inpt enI
otpt -I
otpt L2.6M&I
si, &I si, -I
"!$"&s W 2en, I3
+e,in
if2enA A63
-A6I
e!se
-A1I
en%
if 2 ILHMA A1 F enA A13
&A3E+111I
e!se if 2 ILGMAA1 F enAA13 &A3E+116I
e!se if 2 ILCMAA1 F enAA13 &A3E+161I
e!se if 2 IL4MAA1 F enAA13 &A3E+166I
e!se if 2 IL3MAA1 F enAA13 &A3E+611I
e!se if 2 IL2MAA1 F enAA13 &A3E+616I
e!se if 2 IL1MAA1 F enAA13 &A3E+661I
e!se if 2 IL6MAA1 F enAA13 &A3E+666I
e!se &A3E+666I
en%
en% mo%!e
X0ACE. St"#t of Const#"ints ,ene#"te% +& 0ACE
X0ACE. St"#t of 0ACE I;9 0in Assi,nments
NET SenS L9C A Sp84SI
NET SiK6US L9C A Sp8CSI
NET SiK1US L9C A Sp8GSI
NET SiK2US L9C A Sp8HSI
NET SiK3US L9C A SpQ3SI
NET SiK4US L9C A SpQ4SI
NET SiKCUS L9C A SpQCSI
NET SiKGUS L9C A Sp166SI
NET SiKHUS L9C A SpH4SI
HDL MANUAL EC Dept, RNSIT 18
HDL LAB IVth Sem EC
NET Sen5S L9C A Sp112SI
NET SVS L9C A Sp114SI
NET S'K6US L9C A Sp113SI
NET S'K1US L9C A Sp11CSI
NET S'K2US L9C A Sp11HSI
9tpt
0.c# 2 T) , 'LTI%LE$E&
BlacI Bo@
"

+
(
% V
e
f
,
h
se! 22 to 63
T#th t"+!e
Se!2 Se!1 Se!6 V
6 6 6 A
6 6 1 B
6 1 6 C
6 1 1 D
1 6 6 E
1 6 1 >
1 1 6 <
1 1 1 H
HDL MANUAL EC Dept, RNSIT 1Q
8.1M5
HDL LAB IVth Sem EC
VHDL C)DE VE&IL)* C)DE
entit& m58J1 is
po#t2I. in st%J!o,i(J-e(to# 2H %o$nto 63I
S. in st%J!o,i(J-e(to# 22 %o$nto 63I
en. in st%J!o,i(I &. ot st%J!o,i(3I
en% m58J1I
"#(hite(t#e +eh"-io#"! of m58J1 is
+e,in
p#o(ess 2I,s,en3 is
+e,in
if enAE1E then
if SA@666@ then &KAI263I
e!sif SA@661@ then &KAI213I
e!sif SA@661@ then &KAI223I
e!sif SA@661@ then &KAI233I
e!sif SA@661@ then &KAI243I
e!sif SA@661@ then &KAI2C3I
e!sif SA@661@ then &KAI2G3I
e!se &KAI2H3I
en% ifI
e!se &KAE6EI
en% ifI
en% p#o(essI
en% m58J1I
mo%!e m58J1
inpt LH.6MII
otpt L2.6MSI
otpt &I
inpt enI
#e, &I
"!$"&s W2en,S,I,&3I
+e,in
if 2enA A13
+e,in
if 2sA A666 &AIL6MI
e!se if 2sAA6613 &AIL1MI
e!se if 2sAA6613 &AIL2MI
e!se if 2sAA6613 &AIL3MI
e!se if 2sAA6613 &AIL4MI
e!se if 2sAA6613 &AILCMI
e!se if 2sAA6613 &AILGMI
e!se if 2sAA6613 &AILHMI
en%
e!se &A6I
en%
en%
en%mo%!e
9tpt
HDL MANUAL EC Dept, RNSIT 26
HDL LAB IVth Sem EC
0.d#14BIT BI(A&+ T) *&A+ C)(TE& C)(VE&TE&
BlacI Bo@
(!*
en =23 %o$nto 63
#st
Trut= ta"le
Rst C!* En B3 B2 B1 B6 <3 <2 <1 <6
1 : 6 6 6 6 6 6 6 6 6
6 1 1 6 6 6 1 6 6 6 1
6 1 1 6 6 1 6 6 6 1 1
6 1 1 6 6 1 1 6 6 1 6
6 1 1 6 1 6 6 6 1 1 6
6 1 1 6 1 6 1 6 1 1 1
6 1 1 6 1 1 6 6 1 6 1
6 1 1 6 1 1 1 6 1 6 6
6 1 1 1 6 6 6 1 1 6 6
6 1 1 1 6 6 1 1 1 6 1
6 1 1 1 6 1 6 1 1 1 1
6 1 1 1 6 1 1 1 1 1 6
6 1 1 1 1 6 6 1 6 1 6
6 1 1 1 1 6 1 1 6 1 1
6 1 1 1 1 1 6 1 6 6 1
6 1 1 1 1 1 1 1 6 6 6
VHDL C)DE VE&IL)* C)DE
HDL MANUAL EC Dept, RNSIT 21

4 +it
Bin"#& to

,#"&
HDL LAB IVth Sem EC
entit& +into,#"& is
0o#t 2 #st,(!* . in st%J!o,i(I
, . inot st%J!o,i(J-e(to#23 %o$nto 633I
en% +into,#"&I
"#(hite(t#e Beh"-io#"! of +into,#"& is
si,n"! +. st%J!o,i(J-e(to#2 3 %o$nto 63I
+e,in
p#o(ess2(!*,#st3
+e,in
if #stAY1Y then +KAS6666SI
e!sif #isin,Je%,e2(!*3 then
+KA +ZE1EI
en% ifI
en% p#o(essI
,233KA +233I
,223KA +233 5o# +223I
,213KA +223 5o# +213I
,263KA +213 5o# +263I
en% Beh"-io#"!I
mo%!e +2,2+,,3I
inpt L3.6M +I
otpt L3.6M ,I
5o# 2,L6M,+L6M,+L1M3,
2,L1M,+L1M,+L2M3,
2,L2M,+L2M,+L3M3I
"ssi,n ,L3MA+L3MI
en%mo%!e

Bin"#& to ,#"& 9tpt
0ACE. St"#t of Const#"ints ,ene#"te% +& 0ACE
X0ACE. St"#t of 0ACE I;9 0in Assi,nments
NET S+K6US L9C A Sp84SI
NET S+K1US L9C A Sp8CSI
NET S+K2US L9C A Sp8GSI
NET S+K3US L9C A Sp8HSI
NET S,K6US L9C A Sp112SI
NET S,K1US L9C A Sp114SI
NET S,K2US L9C A Sp113SI
NET S,K3US L9C A Sp11CSI
0.e#'LTI%LE$E&(1 T) ,#
HDL MANUAL EC Dept, RNSIT 22
HDL LAB IVth Sem EC
BlacI Bo@
"

+ V
(
%
se! 21 to 63
T#th T"+!e
Se!1 Se!6 V
6 6 "
6 1 +
1 6 (
1 1 %
VHDL C)DE VE&IL)* C)DE
entit& m51 is
0o#t 2 en,I . in st%J!o,i(I
se!.in st%J!o,i(J-e(to#21%o$nto 63I
& . ot st%J!o,i(3I

en% m51I
"#(hite(t#e %"t"f!o$ of m51 is
+e,in
'KA I6 $hen se!A S66S e!se
I1 $hen se!A S61S e!se
I2 $hen se!A S16S e!se
I3I
en% %"t"f!o$I
mo%!e m54J12I6,I1,I2,I3,s2,s1,&,en3
inpt I6,I1,I2,I3,s2,s1,enI
otpt &I
"ssi,n&KA22Os23F2Os13FenFI63N
22Os23F2s13FenFI13N2s2F2Os13FenFI23N
2s2Fs1FenFI33I
en%mo%!e
2 4.13M!tip!e5e# 9tpt
0.># DE4'LTI%LE$E& ( , T) 1#
HDL MANUAL EC Dept, RNSIT 23
4.1
M5
HDL LAB IVth Sem EC
BlacI Bo@
"
en T23 %o$nto 63

se!21 %o$nto 13
T#th t"+!e
" en Se!1 Se!6 T3 T2 T1 T6
1 6 6 6 6 6 6 1
1 6 6 1 6 6 1 6
1 6 1 6 6 1 6 6
1 6 1 1 1 6 6 6
6 1 : : 6 6 6 6
VHDL C)DE VE&IL)* C)DE
entit& %em5 is
0o#t 2 I,en . in st%J!o,i(I
se!. in st%J!o,i(J-e(to#21 %o$nto 63I
&.otst%J!o,i(J-e(to#23%o$nto633I
en% %em5I
"#(hite(t#e %"t"f!o$ of %em5 is
si,n"! 5. st%J!o,i(J-e(to#2 1 %o$nto 63I
+e,in
5KA en F "I
& KAS6661S $hen se!AS66S "n% 5AS61S e!se
S6616S $hen se!AS61S "n% 5AS61S e!se
S6166S $hen se!AS16S "n% 5AS61S e!se
S1666S $hen se!AS11S "n% 5AS61S e!se
S6666SI
en% %"t"f!o$I
mo%!e %em5 2s2,s1,I,en,&6,&1,&2,&33
inpt s2,s1,I,enI
otpt &6,&1,&2,&3I
"ssi,n &6A2Os23F2Os13F IF enI
"ssi,n &1A2Os23F s1F IF enI
"ssi,n &2As2F2Os13F I F enI
"ssi,n &3As2F s1 F I F enI
en%mo%!e
otpt



NET S"S L9C A Sp84SI
HDL MANUAL EC Dept, RNSIT 24
1.4
Dem5
HDL LAB IVth Sem EC
NET SenS L9C A Sp8CSI
NET Sse!K6US L9C A Sp8GSI
NET Sse!K1US L9C A Sp8HSI
NET S&K6US L9C A Sp112SI
NET S&K1US L9C A Sp114SI
NET S&K2US L9C A Sp113SI NET S&K3US L9C A Sp11CSI

9tp

0.g#,4BIT C)'%A&AT)& (ST&CT&AL#
BlacI Bo@
" L
E
+
<
Trut= ta"le
" + L E <
6 6 6 1 6
6 1 1 6 6
1 6 6 6 1
1 1 6 1 6
VHDL C)DE VE&IL)* C)DE
HDL MANUAL EC Dept, RNSIT 2C

1+it
Comp"#"t
o#
HDL LAB IVth Sem EC
entit& +J(omp1 is
po#t2 ", +. in st%J!o,i(I
L,E,<. ot st%J!o,i(3I
en%I
"#(hite(t#e st#(t#"! of +J(omp1 is
(omponent notJ2 is
po#t2 ". in st%J!o,i(I
+. ot st%J!o,i(3I
en% (omponentI
(omponent "n%J2 is
po#t2 ", +. in st%J!o,i(I
(. ot st%J!o,i(3I
en% (omponentI
(omponent 5no#J2 is
po#t2 ", +. in st%J!o,i(I
(. ot st%J!o,i(3I
en% (omponentI
si,n"! s1,s2. st%J!o,i(I
+e,in
:1. notJ2 po#t m"p 2", s13I
:2. notJ2 po#t m"p 2", s23I
:3. "n%J2 po#t m"p 2s1, +, L3I
:4. "n%J2 po#t m"p 2s2, ", <3I
:C. 5no#J2 po#t m"p 2", +, E3I
en% st#(t#"!I
mo%!e +J(omp1 2", +, L, E,<3I
inpt ", +I otpt L, E, <I
$i#e s1, s2I
not :12s1, "3I
not :2 2s2, +3I
"n% :3 2L,s1, +3I
"n% :4 2<,s2, "3I
5no# :C 2E, ", +3I
en% mo%!e
otpt
NET S"S L9C A SpH4S I
NET S+S L9C A SpHCS I
NET SES L9C A Sp8GS I
NET S<S L9C A Sp8CS I
NET SLS L9C A Sp84S I
,4BIT C)'%A&AT)&(DATA FL);#
HDL MANUAL EC Dept, RNSIT 2G
HDL LAB IVth Sem EC
VHDL C)DE VE&IL)* C)DE
entit& +(omp is
po#t2 ", +. in st%J!o,i(I
(, %, e. ot st%J!o,i(3I
en% +(ompI
"#(hite(t#e %"t"f!o$ of +(omp is
+e,in
(KA 2not "3 "n% +I
%KA " 5no# +I
eKA " "n% 2not +3I
en% %"t"f!o$I
mo%!e +(omp 2", +, (, %, e3
inpt ", +I
otpt (, %, eI
"ssi,n (A 2O"3 F +I
"ssi,n %A O2" P +3I
"ssi,n eA " F 2O+3I
en% mo%!e
0.=#14BIT C)'%A&AT)&
BlacI Bo@
"23 to 63 5
&
+23 to 63 '
VHDL C)DE VE&IL)* C)DE
entit& (omp"#t4+it is
0o#t 2 ",+ . in st%J!o,i(J-e(to#23 %o$nto 63I
"e=+,",t+,"!t+. ot st%J!o,i(3I
en% (omp"#t4+itI

"#(hite(t#e Beh"-io#"! of
(omp"#t4+it is
+e,in
p#o(ess 2",+3
+e,in
if " U + then "e=+KAY1YI",t+KAE6EI"!t+KAE6EI
e!sif " K + then ",t+KAY1YI"e=+KAE6EI"!t+KAE6EI
e!se "!t+KAY1YI "e=+KAE6EI ",t+KAE6EI
en% if I
en% p#o(essI
en% Beh"-io#"!I
mo%!e (omp2",+,"e=+,",t+,"!t+3I
inpt L3.6M ",+I
otpt "e=+,",t+,"!t+I
#e, "e=+,",t+,"!t+I

"!$"&s W2" o# +3
+e,in
"e=+A6I ",t+A6I "!t+A6I
if2"AA+3
"e=+A1I
e!se if 2"U+3
",t+A1I
e!se
"!t+A1I
en%
en%mo%!e
HDL MANUAL EC Dept, RNSIT 2H
4+it
Comp"#"to#
HDL LAB IVth Sem EC
otpt
<#e"te# th"n E="! to Less th"n
&ESLTB Com+in"tion"! %esi,ns h"-e +een #e"!i'e% "n% sim!"te% sin, HDL (o%es)
E$%E&I'E(T ().1
HDL MANUAL EC Dept, RNSIT 28
HDL LAB IVth Sem EC
AI'B R#ite HDL (o%e to %es(#i+e the fn(tions of " f!! A%%e# Usin, th#ee mo%e!in, st&!es)
C)'%)(E(TS &EKI&EDB >0<A +o"#%, >RCEs, 1mpe# "n% po$e# spp!&)
DATA FL); BlacI "o@
T#th t"+!e
I(%TS )T%TS
a " cin S' Cout
/ / / / /
/ / , , /
/ , / , /
/ , , / ,
, / / , /
, / , / ,
, , / / ,
, , , , ,
VHDL C)DE VE&IL)* C)DE
entit& f!!"%%e# is
0o#t 2 ",+,( . in st%J!o,i(I
s,(ot . ot st%J!o,i(3I
en% f!!"%#I
"#(hite(t#e %"t" of f!!"%# is
+e,in
smKA" 5o# + 5o# (inI
(otKA 2 " "n% +3 o# 2 + "n% (in3 o# 2 (in "n%
"3I
en% %"t"I
mo%!e f!!"%%e# 2 ", +, (,s,(ot3
inpt ", +,(I
otpt s, (otI
"ssi,n sA " P +P(I
"ssi,n (otA " F + F (I
en%mo%!e
BEHAVI)&AL ST+LE
HDL MANUAL EC Dept, RNSIT 2Q
FLL
ADDE&
Sm
Cot
"
+
(
HDL LAB IVth Sem EC
VHDL C)DE VE&IL)* C)DE
entit& f!!"%%e# +eh is
0o#t 2 ",+,( . in st%J!o,i(I
sm,("##& . ot st%J!o,i(3I
en% f!!"%#+ehI
"#(hite(t#e Beh"-io#"! of f!!"%#+eh is
+e,in
p#o(ess2 ",+,(3
+e,in
if2"AY6Y "n% +AY6Y "n% (AY6Y3 then smKAY6YI
("##&KAY6YI
e!sif2"AY6Y "n% +AY6Y "n% (AY1Y3 then smKAY1YI
("##&KAY6YI
e!sif2"AY6Y "n% +AY1Y "n% (AY6Y3 then smKAY1YI
("##&KAY6YI
e!sif2"AY6Y "n% +AY1Y "n% (AY1Y3 then smKAY6YI
("##&KAY1YI
e!sif2"AY1Y "n% +AY6Y "n% (AY6Y3 then smKAY1YI
("##&KAY6YI
e!sif2"AY1Y "n% +AY6Y "n% (AY1Y3 then smKAY6YI
("##&KAY1YI
e!sif2"AY1Y "n% +AY1Y "n% (AY6Y3 then smKAY6YI
("##&KAY1YI
e!se
smKAY1YI ("##&KAY1YI
en% ifI
en% p#o(essI
en% Beh"-io#"!I
mo%!e f!!"%%2(in,5,&,s,(o3I
inpt (in,5,&I
otpt s,(oI
#e, s,(oI
"!$"&sW2(in o# 5 o# &3
+e,in
("se 2[(in,5,&\3

3Y+666.[(o,s\AY+66I
3Y+661.[(o,s\AY+61I
3Y+616.[(o,s\AY+61I
3Y+611.[(o,s\AY+16I
3Y+166.[(o,s\AY+61I
3Y+161.[(o,s\AY+16I
3Y+116.[(o,s\AY+16I
3Y+111.[(o,s\AY+11I
en%("se
en%
en%mo%!e

ST&CT&AL ST+LE
HDL MANUAL EC Dept, RNSIT 36
HDL LAB IVth Sem EC
VHDL C)DE VE&IL)* C)DE
entit& f!!st# is
0o#t 2 ",+,(in . in st%J!o,i(I
sm,("##& . ot st%J!o,i(3I
en% f!!st#I
"#(hite(t#e st#(t#"! of f!!st# is
si,n"! (1,(2,(3.st%J!o,i(I
(omponent 5o#J3
po#t25,&,'.in st%J!o,i(I
.ot st%J!o,i(3I
en% (omponentI
(omponent "n%J2
po#t2!,m.in st%J!o,i(I
n.ot st%J!o,i(3I
en% (omponentI
(omponent o#J3
po#t2p,=,#.in st%J!o,i(I
s.ot st%J!o,i(3I
en% (omponentI

+e,in
:1. 5o#J3 po#t m"p 2 ", +, (in,sm3I
A1. "n%J2 po#t m"p 2", +, (13I
A2. "n%J2 po#t m"p 2+,(in,(23I
A3. "n%J2 po#t m"p 2",(in,(33I
91. o#J3 po#t m"p 2(1,(2,(3,("##&3I

en% st#(t#"!I
mo%!e f" 25,&,',(ot,sm3I
inpt 5,&,'I
otpt (ot,smI
$i#e 01,02,03I
HA HA1 2sm2013,(ot2023,"253, +2&33I
HA HA2 2sm2sm3,("##&2033,"2013,+2V33I
9R1 9R< 202,03, Cot3I
en%mo%!e
HDL MANUAL EC Dept, RNSIT 31
HDL LAB IVth Sem EC
Sppo#tin, Component <"tes fo# St(t#"! >!! A%%e#
HHand gateHH
!i+#"#& IEEEI
se IEEE)STDJL9<ICJ11G4)ALLI
entit& "n%2 is
0o#t 2 !,m . in st%J!o,i(I
n . ot st%J!o,i(3I
en% "n%2I
"#(hite(t#e %"t"f of "n%2 is
+e,in
nKA! "n% mI
en% %"t"fI
HHor gateHH
!i+#"#& IEEEI
se IEEE)STDJL9<ICJ11G4)ALLI
entit& o#3 is
0o#t 2 p,=,# . in st%J!o,i(I
s . ot st%J!o,i(3I
en% o#3I
"#(hite(t#e %"t of o#3 is
+e,in
sKA p o# = o# #I
en% %"tI
HH@or gateHH
!i+#"#& IEEEI
se IEEE)STDJL9<ICJ11G4)ALLI
entit& 5o#3 is
0o#t 2 5,&,' . in st%J!o,i(I
. ot st%J!o,i(3I
en% 5o#3I
"#(hite(t#e %"t of 5o#3 is
+e,in
KA5 5o# & 5o# 'I
en% %"tI
>!! "%%e# %"t" f!o$ i;o pins
NET S"S L9C A S0H4SI
HDL MANUAL EC Dept, RNSIT 32
HDL LAB IVth Sem EC
NET S+S L9C A S0HCSI
NET S(inS L9C A S0HGSI
NET S(otS L9C A S084SI
NET SsmS L9C A S08CSI
Sm otpt ("##&otpt
&ESLTB Th#ee mo%e!in, st&!es of f!! "%%e# h"-e +een #e"!i'e% "n% sim!"te% sin, HDL)
(o%es)
HDL MANUAL EC Dept, RNSIT 33
HDL LAB IVth Sem EC
E$%E&I'E(T (). 5
AI'B R#ite " mo%e! fo# 32 +it ALU sin, the s(hem"ti( %i",#"m sho$n +e!o$)
C)'%)(E(TS &EKI&EDB>0<A;C0LD +o"#%, >RCEs, 1mpe# "n% po$e# spp!&)
)%C)DE AL )%E&ATI)(
1 AZB
2 A/B
3 A Comp!ement
4 A]B
C A "n% B
G A o# B
H A n"n% B
8 A 5o# B
Q Ri,ht shift
16 Left Shift
11 0"#"!!e! !o"%
BlacI "o@
A123 to 63
B123 to 63
Vot 2H %o$nto 63
op(o%e 22 to 63
T#th t"+!e
9pe#"tion 9p(o%e A B Vot
AZB 666 1111 6666 66661111
A/B 661 1116 6616 66661166
A o# B 616 1111 1666 66661111
A "n% B 611 1661 1666 66661666
Not A 166 1111 6666 11116666
A1]B1 161 1111 1111 11166661
A n"n% B 116 1111 6616 11111161
A 5o# B 111 6666 6166 66666166
HDL MANUAL EC Dept, RNSIT 34

ALU
HDL LAB IVth Sem EC
VHDL C)DE VE&IL)* C)DE
entit& "!ne$ is
0o#t2 "1,+1.in st%J!o,i(J-e(to#23 %o$nto 63I
op(o%e . in st%J!o,i(J-e(to#22 %o$nto 63I
'ot . ot st%J!o,i(J-e(to#2H %o$nto 633I
en% "!ne$I
"#(hite(t#e Beh"-io#"! of "!ne$ is
si,n"! ". st%J!o,i(J-e(to#2 H %o$nto 63I
si,n"! +. st%J!o,i(J-e(to#2 H %o$nto 63I
+e,in
"KA S6666S F "1I
+KA S6666S F +1I
'otKA "Z+ $hen op(o%e AS666S e!se
"/+ $hen op(o%e AS661S e!se
" o# + $hen op(o%e AS616S e!se
" "n% +$hen op(o%e AS611S e!se
not " $hen op(o%e AS166S e!se
"1 ] +1 $hen op(o%e AS161S e!se
" n"n% + $hen op(o%e AS116S e!se
" 5o# +I
en% Beh"-io#"!I
mo%!e ALU 2 ", +, s, en, & 3I
inpt si,n"! L3.6M", +I
inpt L3.6MsI
inpt enI
otpt si,n"! LH.6M&I
#e, &I
"!$"&sW2 ", +, s, en, & 3I
+e,in
if2enAA13
+e,in
("se
4E%6. &A"Z+I
4E%1. &A"/+I
4E%2. &A"]+I
4E%3. &A[4E +$$, O"\I
4E%4. &A[4E %6, 2" F +3\I
4E%C. &A[4E %6, 2" N +3\I
4E%G. &A[4E %6, 2" P +3\I
4E%H. &A[4E %6, O2" F +3\I
4E%8. &A[4E %6, O2" N +3\I
4E%Q. &A[4E %6, O2" P +3\I
%ef"!t. +e,in en%
en% ("se
en%
e!se
&A8E%6I
en%
en%mo%!e
&ESLTB 32 +it ALU ope#"tions h"-e +een #e"!i'e% "n% sim!"te% sin, HDL (o%es)
HDL MANUAL EC Dept, RNSIT 3C
HDL LAB IVth Sem EC
E$%E&I'E(T ().-
AI'B De-e!op the HDL (o%e fo# the fo!!o$in, f!ipf!op. T, D, SR, B^)
C)'%)(E(TS &EKI&EDB>0<A +o"#%, >RCEs, 1mpe# "n% po$e# spp!&)
T FLI%FL)%
BlacI Bo@
t
(!* =
#st =+
VHDL C)DE VE&IL)* C)DE
entit& tff is
0o#t 2 t,(!* . in STDJL9<ICI
=,=+ . ot STDJL9<IC3I
en% tffI
"#(hite(t#e Beh"-io#"! of tff is
si,n"! (!*%.st%J!o,i(J-e(to#221 %o$nto 63I
+e,in
p#o(ess2(!*%3
+e,in
if #isin,Je%,e2(!*3 then
(!*%KA (!*% Z Y1YI
en% ifI
en% p#o(essI
p#o(ess 2(!*3
-"#i"+!e temp.st%J!o,i(.AY6YI
+e,in
if #isin,Je%,e2(!*3 then
if 2tAY1Y3 then
temp.Anot tempI
e!se
temp.AtempI
en% ifI
en% ifI
=KAtempI=+KAnot tempI
en% p#o(essI
en% Beh"-io#"!I
mo%!e tff2t,(!*,#st, =,=+3I
inpt t,(!*,#stI
otpt =,=+I
#e, =,=+I
#e, tempA6I
"!$"&sW2pose%,e (!*,pose%,e #st3
+e,in

if 2#stAA63 +e,in
if2tAA13 +e,in
tempAO tempI
en%
e!se
tempAtempI

en%
=AtempI=+AOtempI
en%
en%mo%!e
HDL MANUAL EC Dept, RNSIT 3G


T ff
HDL LAB IVth Sem EC
T#th t"+!e
Rst T C!* =
1 6 1 =
1 1 1 =+
1 : No Z-e e%,e 0#e-ios st"te
6 : : 6
Risin, e%,e
9tpt
D FLI%FL)%
BlacI Bo@
%
=
(!* =+
VHDL C)DE VE&IL)* C)DE
entit& %ff is
0o#t 2 %,(!* . in STDJL9<ICI
=,=+ . ot STDJL9<IC3I
en% %ffI
"#(hite(t#e Beh"-io#"! of %ff is
si,n"! (!*%.st%J!o,i(J-e(to#221 %o$nto 63I
+e,in
p#o(ess2(!*%3
+e,in
if #isin,Je%,e2(!*3 then
(!*%KA (!*% Z Y1YI
en% ifI
en% p#o(essI
p#o(ess 2(!*3
-"#i"+!e temp. st%J!o,i(I
+e,in
if #isin,Je%,e2(!*3 then
temp.A%I
en% ifI
=KAtempI=+KAnot tempI
en% p#o(essI
en% Beh"-io#"!I
mo%!e %ff2%,(!*,#st,=,=+3I
inpt %,(!*,#stI
otpt =,=+I
#e, =,=+I
#e, tempA6I

"!$"&sW2pose%,e (!*,pose%,e #st3
+e,in
if 2#stAA63
tempA%I
e!se
tempAtempI
=AtempI
=+AO temp I
en%
en%mo%!e
HDL MANUAL EC Dept, RNSIT 3H
D >>
HDL LAB IVth Sem EC
T#th t"+!e
(!* % = =+
: 1 1 6
1 1 1 6
1 6 6 1
9tpt "t #isin, e%,e
NET S(!*S L9C A S018SI
NET S%S L9C A S0H4SI
NET S=S L9C A S084SI
NET S=+S L9C A S08CSI
S& FLI%FL)%
BlacI Bo@
(!*

s =
#
#st =+
p#

T#th t"+!e
#st p# C!* s # = =+
1 : : : : 6 1
6 1 : : : 1 6
6 6 1 6 6 7+ 7+p#e-ios
6 6 1 6 1 6 1
6 6 1 1 6 1 6
6 6 1 1 1 1 1
HDL MANUAL EC Dept, RNSIT 38
SR >>
HDL LAB IVth Sem EC
VHDL C)DE VE&IL)* C)DE
entit& s#ff is
0o#t 2 s,#,#st,(!* . in STDJL9<ICI
=,=+ . ot STDJL9<IC3I
en% s#ffI
"#(hite(t#e Beh"-io#"! of s#ff is
si,n"! (!*%.st%J!o,i(J-e(to#221 %o$nto 63I
+e,in
p#o(ess2(!*%3
+e,in
if #isin,Je%,e2(!*3 then
(!*%KA (!*% Z Y1YI
en% ifI
en% p#o(essI
p#o(ess2(!*,#st3
-"#i"+!e s#.st%J!o,i(J-e(to#21 %o$nto 63I
-"#i"+!e temp1,temp2.st%J!o,i(.AY6YI
+e,in
s#.AsF#I
if 2#st AY6Y3then
if #isin,Je%,e2(!*3 then
("se s# is
$hen S61SAU temp1.AY6YI temp2.AY1YI
$hen S16SAU temp1.AY1YI temp2.AY6YI
$hen S11SAU temp1.AY1YI temp2.AY1YI
$hen othe#sAU n!!I
en% ("seI
en% ifI
e!se temp1.AY6YI temp2.AY1YI
en% ifI
=KAtemp1I=+KAtemp2I
en% p#o(essI
en% Beh"-io#"!I
mo%!e s#ff2s,#,(!*,#st, =,=+3I
inpt s,#,(!*,#stI
otpt =,=+I
#e, =,=+I
#e, L1.6Ms#I
"!$"&sW2pose%,e (!*,pose%,e #st3
+e,in
s#A[s,#\I
if2#stAA63
+e,in
("se 2s#3
2Y%1.=A1Y+6I
2Y%2.=A1Y+1I
2Y%3.=A1Y+1I
%ef"!t. +e,in en%
en%("se
en%
e!se
+e,in
=A1Y+6I
en%
=+AO=I
en%
en%mo%!e
S R
otpt
HDL MANUAL EC Dept, RNSIT 3Q
HDL LAB IVth Sem EC
78 FLI%FL)%
BlacI Bo@
1
* =

(!* =+
#st
VHDL C)DE VE&IL)*
entit& 1*ff is
0o#t 2 1,*,#st,(!* . in STDJL9<ICI
=,=+ . ot STDJL9<IC3I
en% 1*ffI
"#(hite(t#e Beh"-io#"! of 1*ff is
si,n"! (!*%.st%J!o,i(J-e(to#221 %o$nto 63I
+e,in
p#o(ess2(!*%3
+e,in
if #isin,Je%,e2(!*3 then
(!*%KA (!*% Z Y1YI
en% ifI
en% p#o(essI
p#o(ess2(!*,#st3
-"#i"+!e 1*.st%J!o,i(J-e(to#21 %o$nto 63I
-"#i"+!e temp.st%J!o,i(.AY6YI
+e,in
1*.A1F*I
if 2#st AY6Y3then
if #isin,Je%,e2(!*3 then
("se 1* is
$hen S61SAU temp.AY6YI
$hen S16SAU temp.AY1YI
$hen S11SAU temp.Anot tempI
$hen othe#sAU n!!I
en% ("seI
en% ifI
e!se temp.AY6YI
en% ifI
=KAtempI
=+KAnot tempI
en% p#o(essI
en% Beh"-io#"!I
mo%!e 1*ff21,*,(!*,#st, =,=+3I
inpt 1,*,(!*,#stI
otpt =,=+I
#e, =,=+I
#e, L1.6M1*I
"!$"&sW2pose%,e (!*,pose%,e #st3
+e,in
1*A[1,*\I
if2#stAA63
+e,in
("se 21*3
2Y%1.=A1Y+6I
2Y%2.=A1Y+1I
2Y%3.=AO=I
%ef"!t. +e,in en%
en%("se
en%
e!se
=A1Y+6I
=+AO=I
en%
en%mo%!e
HDL MANUAL EC Dept, RNSIT 46
B^ >>
HDL LAB IVth Sem EC
T#th t"+!e
Rst C!* B ^ 7 7+
1 1 6 6 0#e-ios st"te
1 1 6 1 6 1
1 1 1 6 1 6
1 1 1 1 7+ 7
1 NoZ-e e,%e / / 0#e-ios st"te
6 / / / 6 1
9tpt2$hen inpt 66 "n% #isin, e%,e3
NET S(!*S L9C A Sp18SI
NET S1S L9C A Sp84SI
NET S*S L9C A Sp8CSI
NET S#stS L9C A Sp8GSI
NET S=S L9C A Sp112SI
NET S=+S L9C A Sp114SI
&ESLTB >!ip/f!op ope#"tions h"-e +een #e"!i'e% "n% sim!"te% sin, HDL (o%es
HDL MANUAL EC Dept, RNSIT 41
HDL LAB IVth Sem EC
E$%E&I'E(T ().6
AI'B Desi,n 4 +it Bin"#&, BCD (onte# 2 S&n(h#onos #eset "n% As&n(h#onos #eset "n%
"n& se=en(e (onte#s)
C)'%)(E(TS &EKI&EDB>0<A +o"#%, >RCEs, 1mpe# "n% po$e# spp!&)
a#BCD C)(TE&
BlacI Bo@
(!*
=23 %o$nto 63

#st
T#th t"+!e
Rst C!* 7
1 : 6666
6 1 6661
6 1 6616
6 1 6611
6 1 6166
6 1 6161
6 1 6116
6 1 6111
6
6
1
1
1666
1661
HDL MANUAL EC Dept, RNSIT 42
B(%
(onte#
HDL LAB IVth Sem EC
VHDL C)DE VE&IL)* C)DE
entit& +(% is
0o#t 2 (!#,(!*,%i# . in STDJL9<ICI
= . inot STDJL9<ICJVECT9R 23
%o$nto 63I
t( . ot STDJL9<IC3I
en% +(%I
"#(hite(t#e Beh"-io#"! of +(% is
si,n"! (!*%.st%J!o,i(J-e(to#221 %o$nto 63I
+e,in
p#o(ess2(!*3
+e,in
if #isin,Je%,e2(!*3 then
(!*%KA (!*% Z Y1YI
en% ifI
en% p#o(essI
p#o(ess2(!*%,(!#3
-"#i"+!e temp.st%J!o,i(J-e(to#23 %o$nto 63I
+e,in
if2(!#AY1Y3then
temp.AS6666SIt(KAY6YI
e!sif #isin,Je%,e2(!*%22133 then
if 2%i#AY1Y3 then
temp.AtempZ1I
e!sif2%i#AY6Y3 then
temp.Atemp/1I
en% ifI
if2%i#AY1Y "n% tempAS1616S3 then
temp.AS6666SI t(KAY1YI
e!sif2%i#AY6Y "n% tempAS1111S3 then
temp.AS1661SI t(KAY1YI
e!se t(KAY6YI
en% ifI
en% ifI
=KAtempI
en% p#o(essI
en% Beh"-io#"!I
mo%!e +(%2(!#,(!*,%i#, t(, =3I
inpt (!#,(!*,%i#I
otpt #e, t(I
otpt #e,L3.6M =I
"!$"&sW2pose%,e (!*,pose%,e (!#3
+e,in
if2(!#AA13
=A4Y%6I
e!se
+e,in
if 2%i#AA13
=A=Z1I
e!se if2%i#AA63
=A=/1I
if2%i#AA1 F =AA4Y%163
+e,in
=A4Y%6It(A1Y+1I
en%
e!se if2%i#AA6 F =AA4Y%1C3
+e,in
=A1Y%QIt(A1Y+1I
en%
e!se t(A1Y+6I
en%
en%

en%mo%!e
HDL MANUAL EC Dept, RNSIT 43
HDL LAB IVth Sem EC
"#*&A+ C)(TE&
BlacI Bo@
(!*
en =23 %o$nto 63
#st
HDL MANUAL EC Dept, RNSIT 44

4 +it
Bin"#& to

,#"&
HDL LAB IVth Sem EC
Trut= ta"le
Rst C!* En B3 B2 B1 B6 <3 <2 <1 <6
1 : 6 6 6 6 6 6 6 6 6
6 1 1 6 6 6 1 6 6 6 1
6 1 1 6 6 1 6 6 6 1 1
6 1 1 6 6 1 1 6 6 1 6
6 1 1 6 1 6 6 6 1 1 6
6 1 1 6 1 6 1 6 1 1 1
HDL MANUAL EC Dept, RNSIT
VHDL C)DE VE&IL)* C)DE
entit& ,#"& is
0o#t 2 (!#,(!* . in STDJL9<ICI
= . ot STDJL9<ICJVECT9R 22
%o$nto 633I
en% ,#"&I
"#(hite(t#e Beh"-io#"! of ,#"& is
si,n"! (!*%.st%J!o,i(J-e(to#221 %o$nto 63I
+e,in
p#o(ess2(!*3
+e,in
if #isin,Je%,e2(!*3 then
(!*%KA (!*% Z Y1YI
en% ifI
en% p#o(essI
p#o(ess2(!#,(!*%3
-"#i"+!e temp.st%J!o,i(J-e(to#22 %o$nto 63I
+e,in
if2(!#AY6Y3 then
if #isin,Je%,e2(!*%22133 then
("se temp is
$hen S666SAU temp.AS661SI
$hen S661SAU temp.AS611SI
$hen S611SAU temp.AS616SI
$hen S616SAU temp.AS116SI
$hen S116SAU temp.AS111SI
$hen S111SAU temp.AS161SI
$hen S161SAU temp.AS166SI
$hen S166SAU temp.AS666SI
$hen othe#s AU n!!I
en% ("seI
en% ifI
e!se temp.AS666SI
en% ifI
=KAtempI
en% p#o(essI
en% Beh"-io#"!I
mo%!e ,#"&2(!#,(!*, =3I
inpt (!#,(!*I
otpt #e,L2.6M =I
#e, tempA3Y%6I
"!$"&sW2pose%,e (!*,pose%,e (!#3
+e,in
if2(!#AA63
+e,in
("se2temp3
3Y%6.=A3Y%1I
3Y%1.=A3Y%3I
3Y%2.=A3Y%GI
3Y%3.=A3Y%2I
3Y%G.=A3Y%HI
3Y%H.=A3Y%CI
3Y%C.=A3Y%4I
3Y%4.=A3Y%6I
en%("se
en%
e!se =A3Y%6I
en%
en%mo%!e
4C
HDL LAB IVth Sem EC
6 1 1 6 1 1 6 6 1 6 1
6 1 1 6 1 1 1 6 1 6 6
6 1 1 1 6 6 6 1 1 6 6
6 1 1 1 6 6 1 1 1 6 1
6 1 1 1 6 1 6 1 1 1 1
6 1 1 1 6 1 1 1 1 1 6
6 1 1 1 1 6 6 1 6 1 6
6 1 1 1 1 6 1 1 6 1 1
6 1 1 1 1 1 6 1 6 6 1
6 1 1 1 1 1 1 1 6 6 6
BI(A&+ C)(TE&(%HD);(#
BlacI Bo@
(!*
=ot23 %t 63
#st
T#th t"+!e
C!* Rst 7ot
: 1 6666
1 6 6661
1 6 6616
1 6 6611
1 6 6166
1 6 6161
1 6 6116
1 6 6111
1 6 1666
1 6 1661
1 6 1616
1 6 1611
1 6 1166
1 6 1161
1
1
6
6
1116
1111
VHDL C)DE VE&IL)*
entit& +inJ"s is
0o#t 2 %i#,(!#,(!* . in STDJL9<ICI
= . ot STDJL9<ICJVECT9R 23
%o$nto 633I
en% +inJ"sI
mo%!e +inJ"s2(!*,(!#,%i#, temp3I
inpt (!*,(!#,%i#I
otpt #e,L3.6M tempI
"!$"&sW2pose%,e
(!*,pose%,e (!#3
+e,in
HDL MANUAL EC Dept, RNSIT 4G
Bin"#&
(onte#
HDL LAB IVth Sem EC
"#(hite(t#e Beh"-io#"! of +inJ"s is
si,n"! (!*%.st%J!o,i(J-e(to#221 %o$nto 63I
+e,in
p#o(ess2(!*3
+e,in
if #isin,Je%,e2(!*3 then
(!*%KA (!*% Z Y1YI
en% ifI
en% p#o(essI
p#o(ess2(!*%3
-"#i"+!e temp.st%J!o,i(J-e(to#23 %o$nto
63.AS6616SI
+e,in
if #isin,Je%,e2(!*%22133 then
if 2(!#AY6Y3 then
if 2%i#AY1Y3 then
temp.AtempZY1YI
e!se
temp.Atemp/Y1YI
en% ifI
e!se temp.AS6666SI
en% ifI
en% ifI
=KAtempI
en% p#o(essI
en% Beh"-io#"!I
if2(!#AA63
+e,in
if2%i#AA63
tempAtempZ1I
e!se tempAtemp/1I
en%
e!se
tempA4Y%6I
en%
en%mo%!e
HDL MANUAL EC Dept, RNSIT 4H
HDL LAB IVth Sem EC
9tpt 6666 9tpt 1111
&ESLTB As&n(h#onos "n% S&n(h#onos (onte#s h"-e +een #e"!i'e% "n% sim!"te% sin,
HDL (o%es)
ADDITIONAL EXPERIMENTS
E$%E&I'E(T ().2
AI'B Sim!"tion "n% #e"!i'"tion of Rin, (onte#)

HDL MANUAL EC Dept, RNSIT 48
HDL LAB IVth Sem EC
C)'%)(E(TS &EKI&EDB>0<A +o"#%, >RCEs, 1mpe# "n% po$e# spp!&)
&I(* C)(TE&
HDL MANUAL EC Dept, RNSIT 4Q
HDL LAB IVth Sem EC
INTERFACING PROGRAMS
,.;&ITE A HDL C)DE T) C)(T&)L THE S%EED3 DI&ECTI)(
)F DC 9 STE%%E& ')T)&
DC ')T)&
HDL MANUAL EC Dept, RNSIT C6
HDL LAB IVth Sem EC
VHDL C)DEB
!i+#"#& IEEEI
se IEEE)STDJL9<ICJ11G4)ALLI
se IEEE)STDJL9<ICJARITH)ALLI
se IEEE)STDJL9<ICJUNSI<NED)ALLI
entit& %(mot# is
0o#t 2 %i#,(!*,#st . in st%J!o,i(I
p$m . ot st%J!o,i(J-e(to#21 %o$nto 63I
#!& . ot st%J!o,i(I
#o$ . in st%J!o,i(J-e(to#26 to 333I
en% %(mot#I
"#(hite(t#e Beh"-io#"! of %(mot# is
si,n"! (ont#. st%J!o,i(J-e(to#2H %o$nto 63I
si,n"! %i-J#e,. st%J!o,i(J-e(to#21G %o$nto 63I
si,n"! %%(!*,ti(*. st%J!o,i(I
si,n"! %t&J(&(!e.inte,e# #"n,e 6 to 2CCI
+e,in
p#o(ess2(!*,%i-J#e,3
+e,in
if2(!*Ye-ent "n% (!*AY1Y3 then
%i-J#e,KA%i-J#e,ZY1YI
en% ifI
en% p#o(essI
%%(!*KA%i-J#e,2123I
ti(*KA #o$263 "n% #o$213 "n% #o$223 "n% #o$233I
p#o(ess2ti(*3
+e,in
if f"!!in,Je%,e2ti(*3 then
("se #o$ is
$henS1116SAU %t&J(&(!eKA2CCI
$henS1161SAU %t&J(&(!eKA266I
$henS1611SAU %t&J(&(!eKA1C6I
$henS6111SAU %t&J(&(!eKA166I
$hen othe#s AU %t&J(&(!eKA166I
en% ("seI
en% ifI
en% p#o(essI
p#o(ess2%%(!*, #st3
+e,in
if #stAY6Ythen (ont#KA2othe#sAUY6Y3I
p$mKAS61SI
e!sif2%%(!*Ye-ent "n% %%(!*AY1Y3 then
(ont#KA (ont#Z1I
if (ont#UA%t&J(&(!e then
p$m213KAY6YI
e!se p$m213KAY1YI
HDL MANUAL EC Dept, RNSIT C1
HDL LAB IVth Sem EC
en% ifI
en% ifI
en% p#o(essI
#!&KAY1Y $hen %i#AY1Y e!se Y6YI
en% Beh"-io#"!I
2. DC MOTOR
NET "CLK" LOC="p18";
NET "RESET" LOC="p74";
NET "dir" LOC="p75";
NET "pwm<0>" LOC="p5";
NET "pwm<1>" LOC="p141";
NET "r!" LOC="p"";
NET "RO#<0>" LOC="p$4";
NET "RO#<1>" LOC="p$"";
NET "RO#<2>" LOC="p$0";
NET "RO#<">" LOC="p58";
%&)DED&EB13 M"*e (onne(tion +et$een >RC Q "n% >0<A +o"#% to the %( moto#
(onne(to# of VTU ("#% 2
23 M"*e the (onne(tion +et$een >RC H of >0<A +o"#% to the ^;B (onne(to# of VTU ("#% 2
33 M"*e the (onne(tion +et$een >RC 1 of >0<A +o"#% to the DI0 s$it(h (onne(to# of VTV
("#% 2)
43 Conne(t the %o$n !o"%in, ("+!e "n% po$e# spp!& to >0<A +o"#%)
C3 Then open 5i!in5 imp"(t s;$, se!e(t s!"-e se#i"! mo%e "n% se!e(t the #espe(ti-e +it fi!e "n%
(!i(* p#o,#"m)
G3 M"*e the #eset s$it(h on)
H3 0#ess the He5 *e&s "n% "n"!&'e spee% (h"n,es fo# %( moto#)
&ESLTB The DC moto# #ns $hen #eset s$it(h is on "n% $ith p#essin, of %iffe#ent *e&s
-"#i"tion of DC moto# spee% $"s noti(e%)
STE%%E& ')T)&
!i+#"#& IEEEI
se IEEE)STDJL9<ICJ11G4)ALLI
se IEEE)STDJL9<ICJARITH)ALLI
se IEEE)STDJL9<ICJUNSI<NED)ALLI
entit& steppe#mt is
0o#t 2 (!*,%i#,#st . in st%J!o,i(I
%ot . ot st%J!o,i(J-e(to#23 %o$nto 633I
en% steppe#mtI
"#(hite(t#e Beh"-io#"! of steppe#mt is
HDL MANUAL EC Dept, RNSIT C2
HDL LAB IVth Sem EC
si,n"! (!*J%i-.st%J!o,i(J-e(to#21C %o$nto 63I // spee% is m"5imm "t 1C
si,n"! shiftJ#e,.st%J!o,i(J-e(to#23 %o$nto 63I
+e,in
p#o(ess2(!*3
+e,in
if #isin,Je%,e 2(!*3 then
(!*J%i- KA (!*J%i-ZY1YI
en% ifI
en% p#o(essI
p#o(ess2#st,(!*J%i-21C33 // spee% is m"5imm "t 1C
+e,in
if #stAY6Y then shiftJ#e,KAS6661SI
e!sif #isin,Je%,e 2(!*J%i-21C33 then
if %i#AY1Y then
shiftJ#e, KA shiftJ#e,263 F shiftJ#e,23 %o$nto 13I
e!se
shiftJ#e,KA shiftJ#e, 2 2 %o$nto 63 F shiftJ#e,233I
en% ifI
en% ifI
en% p#o(essI
%otKA shiftJ#e,I

en% Beh"-io#"!I
NET S(!*S L9C A Sp18SI NET S%i#S L9C A Sp8CSI
NET S#stS L9C A Sp84SI
NET S%otK6US L9C A SpHSI NET S%otK1US L9C A SpCSI
NET S%otK2US L9C A Sp3SI NET S%otK3US L9C A Sp141SI
%&)CED&EB13 M"*e (onne(tion +et$een >RC Q "n% >0<A +o"#% to the steppe# moto#
(onne(to# of
VTU ("#% 1
23 M"*e the (onne(tion +et$een >RC 1 of >0<A +o"#% to the DI0 s$it(h (onne(to# of
VTU ("#% 1)
33 Then open 5i!in5 imp"(t s;$, se!e(t s!"-e se#i"! mo%e "n% se!e(t the #espe(ti-e +it fi!e
"n% (!i(* p#o,#"m)
43 M"*e the #eset s$it(h on)
C3 Vis"!i'e the spee% -"#i"tion of steppe# moto# +& (h"n,in, (onte# -"!e in the
p#o,#"m)
&ESLT . The steppe# moto# #ns $ith -"#&in, spee% +& (h"n,in, the (onte# -"!e
..;&ITE A HDL C)DE T) C)(T&)L E$TE&(AL LI*HTS SI(*
&ELA+S
VHDL C)DE
HDL MANUAL EC Dept, RNSIT C3
HDL LAB IVth Sem EC
!i+#"#& IEEEI
se IEEE)STDJL9<ICJ11G4)ALLI
se IEEE)STDJL9<ICJARITH)ALLI
se IEEE)STDJL9<ICJUNSI<NED)ALLI
entit& e5te#n"!!( is
0o#t 2 (nt . in st%J!o,i(I
!i,ht . ot st%J!o,i(3I
en% e5te#n"!!(I
"#(hite(t#e Beh"-io#"! of e5te#n"!!( is
+e,in
!i,htKA(ntI
en% Beh"-io#"!I
NET S(ntS L9C A SpH4SI
NET S!i,htS L9C A SpHSI
%&)CED&EB
1)M"*e the (onne(tions +;$ >RCQ of fp," +o"#% to e5te#n"! !i,ht (onne(to# of -t ("#% 2
2)M"*e (onne(tion +;$ >RC1 of fp," +o"#% to the %ip s$it(h (onne(to# of -t("#%2
3)Conne(t the Do$n!o"%in, ("+!e "n% po$e# spp!& to fp," +o"#%)
1) Then open the 5i!in5 imp"(t soft$"#e se!e(t the s!"-e se#i"! mo%e "n% se!e(t
#espe(ti-e +it fi!e "n% (!i(* p#o,#"m
2) M"*e the #eset s$it(h on "n% !isten to the ti(* son%)
&ESLTB 9n(e the pin pH4 2#eset3 is s$it(he% on the ti(* son% is he"#% "t the e5te#n"! !i,ht
1n(tion)
0.;&ITE HDL C)DE T) *E(E&ATE DIFFE&E(T
;AVEF)&'S(SA;T))TH3 SI(E ;AVE3 SKA&E3 T&IA(*LE3
&A'% ETC# SI(* DAC CHA(*E THE F&EKE(C+ A(D
A'%LITDE.
HDL MANUAL EC Dept, RNSIT C4
HDL LAB IVth Sem EC
SA;T))TH
!i+#"#& IEEEI
se IEEE)STDJL9<ICJ11G4)ALLI
se IEEE)STDJL9<ICJARITH)ALLI
se IEEE)STDJL9<ICJUNSI<NED)ALLI
entit& s"$tooth is
0o#t 2 (!*,#st . in st%J!o,i(I
%"( . ot st%J!o,i(J-e(to#26 to H33I
en% s"$toothI
"#(hite(t#e Beh"-io#"! of s"$tooth is
si,n"! temp.st%J!o,i(J-e(to#23 %o$nto 63I
si,n"! (nt.st%J!o,i(J-e(to#2 6 to H3I
+e,in
p#o(ess2(!*3
+e,in
if #isin,Je%,e2(!*3 then
tempKA tempZY1YI
en% ifI
en% p#o(essI
p#o(ess 2temp233,(nt3
+e,in
if #stAY1Y then (ntKAS66666666SI
e!sif #isin,Je%,e2temp2333 then
(ntKA (ntZ1I
en% ifI
en% p#o(essI
%"(KA(ntI
en% Beh"-io#"!I
SKA&E
!i+#"#& IEEEI
se IEEE)STDJL9<ICJ11G4)ALLI
se IEEE)STDJL9<ICJARITH)ALLI
se IEEE)STDJL9<ICJUNSI<NED)ALLI
entit& s="#e$, is
0o#t 2 (!*,#st . in st%J!o,i(I
%"( . ot st%J!o,i(J-e(to#26 to H33I
en% s="#e$,I
"#(hite(t#e Beh"-io#"! of s="#e$, is
si,n"! temp.st%J!o,i(J-e(to#23 %o$nto 63I
HDL MANUAL EC Dept, RNSIT CC
HDL LAB IVth Sem EC
si,n"! (nt.st%J!o,i(J-e(to#26 to H3I
si,n"! en. st%J!o,i(I
+e,in
p#o(ess2(!*3
+e,in
if #isin,Je%,e2(!*3 then
tempKA tempZY1YI
en% ifI
en% p#o(essI
p#o(ess2temp2333
+e,in
if #stAY1Y then (ntKAS66666666SI
e!sif #isin,Je%,e 2temp2333 then
if (ntK 2CC "n% enAY6Y then
(ntKA(ntZ1I
enKAY6YI
%"(KAS66666666SI
e!sif (ntA6 then enKAY6YI
e!se enKAY1YI
(ntKA(nt/1I
%"(KAS11111111SI
en% ifI
en% ifI
en% p#o(essI
en% Beh"-io#"!I
T&IA(*LE
!i+#"#& IEEEI
se IEEE)STDJL9<ICJ11G4)ALLI
se IEEE)STDJL9<ICJARITH)ALLI
se IEEE)STDJL9<ICJUNSI<NED)ALLI
entit& t#i"n,$, is
0o#t 2 (!*,#st . in st%J!o,i(I
%"( . ot st%J!o,i(J-e(to#26 to H33I
en% t#i"n,$,I
"#(hite(t#e Beh"-io#"! of t#i"n,$, is
si,n"! temp. st%J!o,i(J-e(to#2 3 %o$nto 63I
si,n"! (nt. st%J!o,i(J-e(to#26 to 83I
si,n"! en.st%J!o,i(I
+e,in
p#o(ess2(!*3
+e,in
if #isin,Je%,e2(!*3 then
tempKA tempZ1I
en% ifI
HDL MANUAL EC Dept, RNSIT CG
HDL LAB IVth Sem EC
en% p#o(essI
p#o(ess2 temp2333
+e,in
if #stAY1Y then (ntKAS666666666SI
e!sif #isin,Je%,e2temp2333 then
(ntKA(ntZ1I
if (nt263AY1Y then
%"(KA(nt21 to 83I
e!se
%"(KA not2(nt2 1 to 833I
en% ifI
en% ifI
en% p#o(essI
en% Beh"-io#"!I
&A'%
!i+#"#& IEEEI
se IEEE)STDJL9<ICJ11G4)ALLI
se IEEE)STDJL9<ICJARITH)ALLI
se IEEE)STDJL9<ICJUNSI<NED)ALLI
entit& #"mp$, is
0o#t 2 (!*,#st . in st%J!o,i(I
%"( . ot st%J!o,i(J-e(to#26 to H33I
en% #"mp$,I
"#(hite(t#e Beh"-io#"! of #"mp$, is
si,n"! temp.st%J!o,i(J-e(to#23 %o$nto 63I
si,n"! (nt.st%J!o,i(J-e(to#2 6 to H3I
+e,in
p#o(ess2(!*3
+e,in
if #isin,Je%,e2(!*3 then
tempKA tempZY1YI
en% ifI
en% p#o(essI
p#o(ess 2temp233,(nt3
+e,in
if #stAY1Y then (ntKAS66666666SI
e!sif #isin,Je%,e2temp2333 then
(ntKA (ntZ1CI
en% ifI
en% p#o(essI
%"(KA(ntI

en% Beh"-io#"!I
HDL MANUAL EC Dept, RNSIT CH
HDL LAB IVth Sem EC
SI(E ;AVE
!i+#"#& IEEEI
se IEEE)STDJL9<ICJ11G4)ALLI
se IEEE)STDJL9<ICJARITH)ALLI
se IEEE)STDJL9<ICJUNSI<NED)ALLI
entit& sine$"-e is
0o#t 2 (!*,#st . in st%J!o,i(I
%"(Jot . ot st%J!o,i(J-e(to#26 to H33I
en% sine$"-eI
"#(hite(t#e Beh"-io#"! of sine$"-e is
si,n"! temp. st%J!o,i(J-e(to#23 %o$nto 63I
si,n"! (onte#. st%J!o,i(J-e(to#26 to H3I
si,n"! en. st%J!o,i(I
+e,in
p#o(ess2(!*3 is
+e,in
if #isin,Je%,e 2(!*3 then
tempKA tempZY1YI
en% ifI
en% p#o(essI
p#o(ess2temp2333 is
+e,in
if #stAY1Y then (onte#KAS66666666SI
e!sif #isin,Je%,e2temp2333 then
if (onte#K2CC "n% enAY6Y then
(onte#KA (onte#Z31I enKAY6YI
e!sif (onte#A6 then enKAY6YI
e!se enKAY1YI
(onte#KA (onte#/31I
en% ifI
en% ifI
en% p#o(essI
%"(JotKA (onte#I
en% Beh"-io#"!I
%&)CED&EB
13 M"*e (onne(tion +et$een >RC C "n% >0<A "n% DAC (onne(to# of VTU ("#% 2)
23 M"*e the (onne(tion +et$een >RC 1 of >0<A +o"#% to the DI0 s$it(h (onne(to# of VTU
("#% 2)
33 Then open 5i!in5 imp"(t s;$, se!e(t s!"-e se#i"! mo%e "n% se!e(t the #espe(ti-e +it fi!e "n%
(!i(* p#o,#"m)
43 M"*e the #eset s$it(h on)
&ESLTBThe $"-efo#m o+t"ine% R"mp, S"$ tooth, T#i"n,!"#, Sine "n% S="#e $"-es "#e
"s pe# the ,#"ph)
HDL MANUAL EC Dept, RNSIT C8
4.DAC
NET "CLK" LOC="p18";
NET "d%&'()*<0>" LOC="p27";
NET "d%&'()*<1>" LOC="p2$";
NET "d%&'()*<2>" LOC="p22";
NET "d%&'()*<">" LOC="p2"";
NET "d%&'()*<4>" LOC="p21";
NET "d%&'()*<5>" LOC="p1+";
NET "d%&'()*<$>" LOC="p20";
NET "d%&'()*<7>" LOC="p4";
NET "r,*" LOC="p74";
HDL LAB IVth Sem EC
1. ;&ITE A HDL C)DE T) DIS%LA+ 'ESSA*ES )( THE *IVE(
SEVE( SE*'E(T DIS%LA+
VHDL C)DE
!i+#"#& IEEEI
se IEEE)STDJL9<ICJ11G4)ALLI
se IEEE)STDJL9<ICJARITH)ALLI
se IEEE)STDJL9<ICJUNSI<NED)ALLI
entit& se-*e&+#% is
0o#t 2 #e"% . in st%J!o,i(J-e(to#23 %o$nto 63I
(!* . in st%J!o,i(I
s("n . inot st%J!o,i(J-e(to#23 %o$nto 63I
%ispJ(nt . ot st%J!o,i(J-e(to#23 %o$nto 63I
%isp1 . ot st%J!o,i(J-e(to#2G %o$nto 633I
en% se-*e&+#%I
"#(hite(t#e Beh"-io#"! of se-*e&+#% is
si,n"! (ntJ2+it.st%J!o,i(J-e(to#21 %o$nto 63I
+e,in
p#o(ess2(!*3
+e,in
if (!*AY1Y "n% (!*Ye-ent then
(ntJ2+itKA (ntJ2+itZ1I
en% ifI
en% p#o(essI
p#o(ess2(ntJ2+it3
+e,in
("se (ntJ2+it is
$hen S66S AU s("nKA S6661SI
$hen S61SAU s("nKAS6616SI
$hen S16SAUs("nKAS6166SI
$hen S11SAUs("nKAS1666SI
$hen othe#sAU n!!I
en% ("seI
en% p#o(essI
%ispJ(ntKAS1116SI
p#o(ess2s("n,#e"%3
+e,in
("se s("n is
$hen S6661SAU("se #e"% is
$hen S6661SAU%isp1KAS1111116SI
$hen S6616SAU%isp1KAS6116611SI
$hen S6166SAU%isp1KAS1111111SI
$hen S1666SAU%isp1KAS1661116SI
$hen othe#s AU%isp1KAS6666666SI
en% ("seI
$hen S6616SAU ("se #e"% is
HDL MANUAL EC Dept, RNSIT CQ
5. KEY BOARD TO 7 SEGMENT DISPLAY
NET "CLK" LOC="p18";
NET "di,p'&-*<0>" LOC="p"0";
NET "di,p'&-*<1>" LOC="p2+";
NET "di,p'&-*<2>" LOC="p"1";
NET "di,p'&-*<">" LOC="p"8";
NET "di,p<0>" LOC="p2$";
NET "di,p<1>" LOC="p22";
NET "di,p<2>" LOC="p2"";
NET "di,p<">" LOC="p21";
NET "di,p<4>" LOC="p1+";
NET "di,p<5>" LOC="p20";
NET "di,p<$>" LOC="p4";
NET "r.%d''i-<0>" LOC="122";
NET "r.%d''i-<1>" LOC="124";
NET "r.%d''i-<2>" LOC="12+";
NET "r.%d''i-<">" LOC="12$";
NET ",&%-'<0>" LOC="1"2";
NET ",&%-'<1>" LOC="1"$";
NET ",&%-'<2>" LOC="1"4";
NET ",&%-'<">" LOC="1"+";
HDL LAB IVth Sem EC
$hen S6661SAU%isp1KAS6116666SI
$hen S6616SAU%isp1KAS1611611SI
$hen S6166SAU%isp1KAS1111611SI
$hen S1666SAU%isp1KAS6111161SI
$hen othe#sAU%isp1KAS6666666SI
en% ("seI
$hen S6166SAU ("se #e"% is
$hen S6661SAU%isp1KAS1161161SI
$hen S6616SAU%isp1KAS1611111SI
$hen S6166SAU%isp1KAS1116111SI
$hen S1666SAU%isp1KAS1661111SI
$hen othe#sAU%isp1KAS6666666SI
en% ("seI
$hen S1666SAU ("se #e"% is
$hen S6661SAU%isp1KAS1111661SI
$hen S6616SAU%isp1KAS1116666SI
$hen S6166SAU%isp1KAS6611111SI
$hen S1666SAU%isp1KAS1666111SI
$hen othe#sAU%isp1KAS6666666SI
en% ("seI
$hen othe#sAU n!!I
en% ("seI
en% p#o(essI
en% Beh"-io#"!I
%&)CED&EB
13 M"*e (onne(tion +et$een >RC C "n% >0<A +o"#% to the se-en se,ment (onne(to# of
VTU ("#% 1)
23 M"*e the (onne(tion +et$een >RC 4 to >0<A +o"#% to ^;B (onne(to# of VTU ("#%1)
33 Then open 5i!in5 imp"(t s;$, se!e(t s!"-e se#i"! mo%e "n% se!e(t the #espe(ti-e +it fi!e
"n% (!i(* p#o,#"m)
43 M"*e the #eset s$it(h on)
C3 Ch"n,e the p#essin, of He5 ^e&s to $"t(h the %isp!"& on LCDEs #"n,in, f#om 6666 to
>>>>)
&ESLTBThe -"!es f#om 6 to > $e#e %isp!"&e% on "!! 4 LCDEs $ith the #espe(ti-e He5
^e& +ein, p#esse%)
IH) %in Assignments
/ii-0 1234
1OR DC 5 S*.pp.r
MOTOR
1RC 1RC1 1RC2 1RC" 1RC4 1RC$ 1RC7 /ii-0 1234
1 74 84 112 122 40 58 1RC 1RC+
2 75 85 114 124 41 $0 1 7
" 7$ 8$ 11" 12+ 42 $" 2 5
4 78 87 115 12$ 48 $4 " "
HDL MANUAL EC Dept, RNSIT G6
HDL LAB IVth Sem EC
5 77 +" 117 1"2 50 $5 4 141
$ 80 +4 118 1"$ 51 $$ + 56
7 7+ +5 121 1"4 5$ $7 10 3ND
8 8" 100 12" 1"+ 57 28
+ 6CC 6CC 6CC 6CC 6CC 6CC
10 3ND 3ND 3ND 3ND 3ND 3ND
1OR LCD 5 D4C 1OR 4DC
1RC 1RC5 1RC8 1RC10
1 4 +$ $2
2 20 ++ 5+
" 1+ 101 4+
4 21 102 47
5 2" 10" 4$
$ 22 11$ 4
7 2$ 120 4"
8 27 1"1 1"
+ "0 1"" 12
10 2+ 1"7 11
11 "1 1"8 10
12 "8 140 $
1" 56 56 56
14 758 758 758
15 "." "." "."
1$ 3ND 3ND 3ND
Constrints file
1. Etern!l Li"#t Controller
NET "&-*r" LOC="p74"; => 1RC1
NET "i9:*" LOC="p7"; => 1RC+

2. DC MOTOR
NET "CLK" LOC="p18";

NET "RESET" LOC="p74";
1RC1
NET "dir" LOC="p75";
NET "pwm<0>" LOC="p5";
1RC+ NET "pwm<1>" LOC="p141";
NET "r!" LOC="p"";
NET "RO#<0>" LOC="p$4";
1RC7
NET "RO#<1>" LOC="p$"";
NET "RO#<2>" LOC="p$0";
NET "RO#<">" LOC="p58";
$. STEPPER MOTOR
NET "CLK" LOC="p18";
NET "d()*<0>" LOC="p7";
1RC+
HDL MANUAL EC Dept, RNSIT G1
HDL LAB IVth Sem EC
NET "d()*<1>" LOC="p5";
NET "d()*<2>" LOC="p"";
NET "d()*<">" LOC="p141";
NET "RESET" LOC="p74";
1RC1
NET "dir" LOC="p75";
4.DAC
NET "CLK" LOC="p18";
1RC5
NET "d%&'()*<0>" LOC="p27";
NET "d%&'()*<1>" LOC="p2$";
NET "d%&'()*<2>" LOC="p22";
NET "d%&'()*<">" LOC="p2"";
NET "d%&'()*<4>" LOC="p21";
NET "d%&'()*<5>" LOC="p1+";
NET "d%&'()*<$>" LOC="p20";
NET "d%&'()*<7>" LOC="p4";
NET "r,*" LOC="p74"; 1RC1
5. KEY BOARD TO 7 SEGMENT DISPLAY
NET "CLK" LOC="p18";
NET "di,p'&-*<0>" LOC="p"0";
1RC5
NET "di,p'&-*<1>" LOC="p2+";
NET "di,p'&-*<2>" LOC="p"1";
NET "di,p'&-*<">" LOC="p"8";
NET "di,p<0>" LOC="p2$";
NET "di,p<1>" LOC="p22";
NET "di,p<2>" LOC="p2"";
NET "di,p<">" LOC="p21";
NET "di,p<4>" LOC="p1+";
NET "di,p<5>" LOC="p20";
NET "di,p<$>" LOC="p4";
NET "r.%d''i-<0>" LOC="122";
1RC4
NET "r.%d''i-<1>" LOC="124";
NET "r.%d''i-<2>" LOC="12+";
NET "r.%d''i-<">" LOC="12$";
NET ",&%-'<0>" LOC="1"2";
NET ",&%-'<1>" LOC="1"$";
NET ",&%-'<2>" LOC="1"4";
NET ",&%-'<">" LOC="1"+";
0#o(e%#e to %o$n!o"% the p#o,#"m on to >0<A
C#e"te ne$ so#(e
Imp!ement"tion (onst#"ints fi!e
Use# (onst#"ints
HDL MANUAL EC Dept, RNSIT G2
HDL LAB IVth Sem EC
C#e"te Timin, (onst#"ints. <i-e the inpt "n% otpt po#ts f#om the po#t nm+e#
!oo* p t"+!e2pin "ssi,nment3 "n% then s"-e)
E%it (onst#"ints to (he(* the spe(ifie% po#ts
C!i(* on the so#(e fi!e
Imp!ement %esi,n
Confi,#e %e-i(e 2imp"(t3"fte# s$it(hin, on po$e# spp!&
Se!e(t the s!"-e se#i"! mo%e
Se!e(t the so#(e fi!e
Ri,ht (!i(* on 5i!in5 "n% se!e(t p#o,#"m
Conne(t inpt po#t to %ip s$it(h "n% otpt po#t to !e%Es)
V"#& the inpts "n% -ie$ the (o##espon%in, otpts)
HDL MANUAL EC Dept, RNSIT G3
HDL LAB IVth Sem EC
HDL MANUAL EC Dept, RNSIT
SL.
().
In>rastructure &eFuirement
AICTEHniAersit!
(orms
Actuall!
proAided Cost/
Amount
+ear o>
purc=ase
4)2)
6
VHDL LAB
4)2)
1
'ulti4Vendor niAersal Demo
Board(Iit includes
mot=er"oard along
?it= do?nloading
Ca"les#
0o$e# spp!&, :i!in5 >0<A/166*
,"te %ensit& :i!in5 C0LD)
Inte#f"(in, ("#%s VTU inte#f"(e/1
F VTU inte#f"(e/2
"!on, $ith "+o-e mothe#+o"#%s to
pe#fo#m "!! e5pe#iments of
VHDL !"+ "s pe# #e-ise% VTU
s&!!"+s
16 12 26666;
.1////
1/62/6C
4)2)
2
C' -1/ C=ipma@
0"tte#n ,ene#"to# (m Lo,i(
An"!&'e#/G4 (h"nne!
64 6G 46666;
.1////
1/62/6C
4)2)
3
C=ipscope %ro4logic
An"!&'e# f#om A<ILENT
Te(hno!o,ies fo# on/(hip
%e+,,in, "n% #e"!/time "n"!&sis
of :i!in5
>0<As
61 61 26666;
.////
1/62/6C
4)2)
4
SiMS/VLSI Uni-e#s"! VLSI
T#"ine#;E-"!"tion ^it
B T", C"+!e _ 1No
0o$e# Spp!& _ 1No
9pe#"tion M"n"! _ 1No
62 62 023.6/.1/ 1Q/6H/64
4)2)
C
SiMS _ 0LD 2Sp"#t"n/II, C0LD
(oo! #nne#, S0R9M323 Nos3
1 set e"(h 1 set e"(h :3:51.// 1Q/6H/64
4)2)
G
SiMS/<0I9 <ene#"! p#pose
Inte,#"te% Inte#f"(e mo%!e
61 61 136.5.// 1Q/6H/64
4)2)
H
>on%"tion E5p#ess. :ILIN:
G)1i Ve#sion. ISE
61 61 1.3///.//
In(!si-e of "!! t"5es <#"n% Tot"!. C,44,Q4Q)46
SL.
().
In>rastructure &eFuirement
AICTEHniAersit!
(orms
Actuall!
proAided Cost/
Amount
+ear o>
purc=ase
4)2)
6
VHDL LAB
4)2)
1
'ulti4Vendor niAersal Demo
Board(Iit includes
mot=er"oard along
?it= do?nloading
Ca"les#
0o$e# spp!&, :i!in5 >0<A/166*
,"te %ensit& :i!in5 C0LD)
Inte#f"(in, ("#%s VTU inte#f"(e/1
F VTU inte#f"(e/2
"!on, $ith "+o-e mothe#+o"#%s to
pe#fo#m "!! e5pe#iments of
VHDL !"+ "s pe# #e-ise% VTU
s&!!"+s
16 12 26666;
.1////
1/62/6C
4)2)
2
C' -1/ C=ipma@
0"tte#n ,ene#"to# (m Lo,i(
An"!&'e#/G4 (h"nne!
64 6G 46666;
.1////
1/62/6C
4)2)
3
C=ipscope %ro4logic
An"!&'e# f#om A<ILENT
Te(hno!o,ies fo# on/(hip
%e+,,in, "n% #e"!/time "n"!&sis
of :i!in5
>0<As
61 61 26666;
.////
1/62/6C
4)2)
4
SiMS/VLSI Uni-e#s"! VLSI
T#"ine#;E-"!"tion ^it
B T", C"+!e _ 1No
0o$e# Spp!& _ 1No
9pe#"tion M"n"! _ 1No
62 62 023.6/.1/ 1Q/6H/64
4)2)
C
SiMS _ 0LD 2Sp"#t"n/II, C0LD
(oo! #nne#, S0R9M323 Nos3
1 set e"(h 1 set e"(h :3:51.// 1Q/6H/64
4)2)
G
SiMS/<0I9 <ene#"! p#pose
Inte,#"te% Inte#f"(e mo%!e
61 61 136.5.// 1Q/6H/64
4)2)
H
>on%"tion E5p#ess. :ILIN:
G)1i Ve#sion. ISE
61 61 1.3///.//
In(!si-e of "!! t"5es <#"n% Tot"!. C,44,Q4Q)46
G4
HDL LAB IVth Sem EC
entit& +(% is
0o#t 2 (!#,(!*,%i# . in STDJL9<ICI
= . inot STDJL9<ICJVECT9R 23 %o$nto 63I
t( . ot STDJL9<IC3I
en% +(%I
"#(hite(t#e Beh"-io#"! of +(% is
si,n"! (!*%.st%J!o,i(J-e(to#221 %o$nto 63I
+e,in
p#o(ess2(!*3
+e,in
if #isin,Je%,e2(!*3 then
(!*%KA (!*% Z Y1YI
en% ifI
en% p#o(essI
p#o(ess2(!*%,(!#3
-"#i"+!e temp.st%J!o,i(J-e(to#23 %o$nto 63I
+e,in
if2(!#AY1Y3then
temp.AS6666SIt(KAY6YI
e!sif #isin,Je%,e2(!*%22133 then
if 2%i#AY1Y3 then
temp.AtempZ1I
e!sif2%i#AY6Y3 then
temp.Atemp/1I
en% ifI
if2%i#AY1Y "n% tempAS1616S3 then
temp.AS6666SI t(KAY1YI
e!sif2%i#AY6Y "n% tempAS1111S3 then
temp.AS1661SI t(KAY1YI
e!se t(KAY6YI
en% ifI
en% ifI
=KAtempI
en% p#o(essI
en% Beh"-io#"!I
entit& +inJ"s is
0o#t 2 %i#,(!#,(!* . in STDJL9<ICI
= . ot STDJL9<ICJVECT9R 23 %o$nto 633I
en% +inJ"sI
"#(hite(t#e Beh"-io#"! of +inJ"s is
si,n"! (!*%.st%J!o,i(J-e(to#221 %o$nto 63I
+e,in
p#o(ess2(!*3
+e,in
HDL MANUAL EC Dept, RNSIT GC
HDL LAB IVth Sem EC
if #isin,Je%,e2(!*3 then
(!*%KA (!*% Z Y1YI
en% ifI
en% p#o(essI
p#o(ess2(!*%3
-"#i"+!e temp.st%J!o,i(J-e(to#23 %o$nto 63.AS6616SI
+e,in
if #isin,Je%,e2(!*%22133 then
if 2(!#AY6Y3 then
if 2%i#AY1Y3 then
temp.AtempZY1YI
e!se
temp.Atemp/Y1YI
en% ifI
e!se temp.AS6666SI
en% ifI
en% ifI
=KAtempI
en% p#o(essI
en% Beh"-io#"!I
entit& +in"#& is
0o#t 2 %i#,(!*,(!# . in STDJL9<ICI
= . ot STDJL9<ICJ-e(to#23 %o$nto 633I
en% +in"#&I
"#(hite(t#e Beh"-io#"! of +in"#& is
si,n"! (!*%.st%J!o,i(J-e(to#221 %o$nto 63I
+e,in
p#o(ess2(!*3
+e,in
if #isin,Je%,e2(!*3 then
(!*%KA (!*% Z Y1YI
en% ifI
en% p#o(essI
p#o(ess2(!*%,(!#3
-"#i"+!e temp.st%J!o,i(J-e(to#23 %o$nto 63.AS6616SI
+e,in
if 2(!#AY6Y3 then
if #isin,Je%,e2(!*%22133 then
if %i#AY1Y then
temp.AtempZY1YI
e!se
temp.Atemp/Y1YI
en% ifI
HDL MANUAL EC Dept, RNSIT GG
HDL LAB IVth Sem EC
e!se temp.AS6666SI
en% ifI
en% ifI
=KAtempI
en% p#o(essI
en% Beh"-io#"!I
entit& ,#"& is
0o#t 2 (!#,(!* . in STDJL9<ICI
= . ot STDJL9<ICJVECT9R 22 %o$nto 633I
en% ,#"&I
"#(hite(t#e Beh"-io#"! of ,#"& is
si,n"! (!*%.st%J!o,i(J-e(to#221 %o$nto 63I
+e,in
p#o(ess2(!*3
+e,in
if #isin,Je%,e2(!*3 then
(!*%KA (!*% Z Y1YI
en% ifI
en% p#o(essI
p#o(ess2(!#,(!*%3
-"#i"+!e temp.st%J!o,i(J-e(to#22 %o$nto 63I
+e,in
if2(!#AY6Y3 then
if #isin,Je%,e2(!*%22133 then
("se temp is
$hen S666SAU temp.AS661SI
$hen S661SAU temp.AS611SI
$hen S611SAU temp.AS616SI
$hen S616SAU temp.AS116SI
$hen S116SAU temp.AS111SI
$hen S111SAU temp.AS161SI
$hen S161SAU temp.AS166SI
$hen S166SAU temp.AS666SI
$hen othe#s AU n!!I
en% ("seI
en% ifI
e!se temp.AS666SI
en% ifI
=KAtempI
en% p#o(essI
en% Beh"-io#"!I
HDL MANUAL EC Dept, RNSIT GH
HDL LAB IVth Sem EC
entit& 1ohn( is
0o#t 2 (!*,(!# . in STDJL9<ICI

= . inot STDJL9<ICJVECT9R 23 %o$nto 633I
en% 1ohn(I
"#(hite(t#e Beh"-io#"! of 1ohn( is
si,n"! (!*%.st%J!o,i(J-e(to#221 %o$nto 63I
+e,in
p#o(ess2(!*3
+e,in
if #isin,Je%,e2(!*3 then
(!*%KA (!*% Z Y1YI
en% ifI
en% p#o(essI
p#o(ess2(!*%,(!#3
+e,in
if 2(!#AY1Y3 then =KAS6666SI
e!sif #isin,Je%,e2(!*%22133 then
=KA2not =2633F =23 %o$nto 13I
en% ifI
en% p#o(essI
en% Beh"-io#"!I
entit& #in, is
0o#t 2 (!*,(!#,! . in STDJL9<ICI

= . inot STDJL9<ICJVECT9R 23 %o$nto 633I
en% #in,I
"#(hite(t#e Beh"-io#"! of #in, is
si,n"! (!*%.st%J!o,i(J-e(to#221 %o$nto 63I
+e,in
p#o(ess2(!*3
+e,in
if #isin,Je%,e2(!*3 then
(!*%KA (!*% Z Y1YI
en% ifI
en% p#o(essI
p#o(ess2(!*%,(!#3
+e,in
if 2(!#AY1Y3 then =KAS6666SI
e!sif #isin,Je%,e2(!*%22133 then
HDL MANUAL EC Dept, RNSIT G8
HDL LAB IVth Sem EC
if 2!AY1Y3 then
=KAS1666SI
e!se
=KA=263 F =23 %o$nto 13I
en% ifI
en% ifI
en% p#o(essI
en% Beh"-io#"!I
mo%!e "!12",+,s,en,&3I
inpt L3.6M s,",+I
inpt enI
otpt #e, LH.6M &I
"!$"&sW2",+,s,en,&3
+e,in
if2enAA13
+e,in
("se2s3
4Y%6.&A"Z+I
4Y%1.&A"/+I
4Y%2.&A"]+I
4Y%3.&A[4Y%6,O"\I
4Y%4.&A[4Y%6,2"F+3\I
4Y%C.&A[4Y%6,2"N+3\I
4Y%G.&A[4Y%6,2"P+3\I
4Y%H.&A[4Y%6,O2"F+3\I
4Y%8.&A[4Y%6,O2"N+3\I
4Y%Q.&A[4Y%6,2O"P+3\I
%ef"!t.+e,in en%
en%("se
en%
e!se
&A8Y%6I
en%

en%mo%!e
mo%!e +(%2(!#,(!*,%i#, t(, =3I
inpt (!#,(!*,%i#I
otpt #e, t(I
otpt #e,L3.6M =I
"!$"&sW2pose%,e (!*,pose%,e (!#3
+e,in
if2(!#AA13
=A4Y%6I
e!se
+e,in
if 2%i#AA13
=A=Z1I
e!se if2%i#AA63
=A=/1I
if2%i#AA1 F =AA4Y%163
+e,in
=A4Y%6It(A1Y+1I
HDL MANUAL EC Dept, RNSIT GQ
HDL LAB IVth Sem EC
en%
e!se if2%i#AA6 F =AA4Y%1C3
+e,in
=A1Y%QIt(A1Y+1I
en%
e!se t(A1Y+6I
en%
en%

en%mo%!e
mo%!e +inJ"s2(!*,(!#,%i#, temp3I
inpt (!*,(!#,%i#I
otpt #e,L3.6M tempI
"!$"&sW2pose%,e (!*,pose%,e (!#3
+e,in
if2(!#AA63
+e,in
if2%i#AA63
tempAtempZ1I
e!se tempAtemp/1I
en%
e!se
tempA4Y%6I
en%
en%mo%!e
mo%!e +in"#&2(!*,(!#,%i#, temp3I
inpt (!*,(!#,%i#I
otpt #e,L3.6MtempI
"!$"&sW2pose%,e (!*3
+e,in
if2(!#AA63
+e,in
if2%i#AA63
tempAtempZ1I
e!se tempAtemp/1I
en%
e!se
tempA4Y%6I
en%
en%mo%!e
mo%!e ,#"&2(!#,(!*, =3I
inpt (!#,(!*I
otpt #e,L2.6M =I
#e, tempA3Y%6I
"!$"&sW2pose%,e (!*,pose%,e (!#3
+e,in
if2(!#AA63
+e,in
("se2temp3
3Y%6.=A3Y%1I
3Y%1.=A3Y%3I
3Y%2.=A3Y%GI
3Y%3.=A3Y%2I
3Y%G.=A3Y%HI
3Y%H.=A3Y%CI
HDL MANUAL EC Dept, RNSIT H6
HDL LAB IVth Sem EC
3Y%C.=A3Y%4I
3Y%4.=A3Y%6I
en%("se
en%
e!se =A3Y%6I
en%
en%mo%!e
mo%!e 1honson2(!*,(!#, =3I
inpt (!*,(!#I
otpt #e,L3.6M =I
"!$"&sW2pose%,e (!*,pose%,e (!#3
+e,in
if2(!#AA13
=A4Y%6I
e!se
=A[2O=L6M3, =L3.1M\I
en%
en%mo%!e
mo%!e #in,2(!*,(!#,!, =3I
inpt (!*,(!#,!I
otpt #e,L3.6M =I
"!$"&sW2pose%,e (!*,pose%,e (!#3
+e,in
if2(!#AA13
=A4Y%6I
e!se
+e,in
if 2!AA13
=A4Y%8I
e!se
=A[=L6M, =L3.1M\I
en%
en%
en%mo%!e
entit& +(% is
0o#t 2 (!#,(!*,%i# . in STDJL9<ICI
= . inot STDJL9<ICJVECT9R 23 %o$nto 63I
t( . ot STDJL9<IC3I
en% +(%I
"#(hite(t#e Beh"-io#"! of +(% is
si,n"! (!*%.st%J!o,i(J-e(to#221 %o$nto 63I
+e,in
p#o(ess2(!*3
+e,in
if #isin,Je%,e2(!*3 then
(!*%KA (!*% Z Y1YI
en% ifI
en% p#o(essI
p#o(ess2(!*%,(!#3
-"#i"+!e temp.st%J!o,i(J-e(to#23 %o$nto 63I
+e,in
if2(!#AY1Y3then
HDL MANUAL EC Dept, RNSIT H1
HDL LAB IVth Sem EC
temp.AS6666SIt(KAY6YI
e!sif #isin,Je%,e2(!*%22133 then
if 2%i#AY1Y3 then
temp.AtempZ1I
e!sif2%i#AY6Y3 then
temp.Atemp/1I
en% ifI
if2%i#AY1Y "n% tempAS1616S3 then
temp.AS6666SI t(KAY1YI
e!sif2%i#AY6Y "n% tempAS1111S3 then
temp.AS1661SI t(KAY1YI
e!se t(KAY6YI
en% ifI
en% ifI
=KAtempI
en% p#o(essI
en% Beh"-io#"!I
entit& +inJ"s is
0o#t 2 %i#,(!#,(!* . in STDJL9<ICI
= . ot STDJL9<ICJVECT9R 23 %o$nto 633I
en% +inJ"sI
"#(hite(t#e Beh"-io#"! of +inJ"s is
si,n"! (!*%.st%J!o,i(J-e(to#221 %o$nto 63I
+e,in
p#o(ess2(!*3
+e,in
if #isin,Je%,e2(!*3 then
(!*%KA (!*% Z Y1YI
en% ifI
en% p#o(essI
p#o(ess2(!*%3
-"#i"+!e temp.st%J!o,i(J-e(to#23 %o$nto 63.AS6616SI
+e,in
if #isin,Je%,e2(!*%22133 then
if 2(!#AY6Y3 then
if 2%i#AY1Y3 then
temp.AtempZY1YI
e!se
temp.Atemp/Y1YI
en% ifI
e!se temp.AS6666SI
en% ifI
en% ifI
=KAtempI
en% p#o(essI
en% Beh"-io#"!I
ntit& +in"#& is
0o#t 2 %i#,(!*,(!# . in STDJL9<ICI
= . ot STDJL9<ICJ-e(to#23 %o$nto 633I
en% +in"#&I
HDL MANUAL EC Dept, RNSIT H2
HDL LAB IVth Sem EC
"#(hite(t#e Beh"-io#"! of +in"#& is
si,n"! (!*%.st%J!o,i(J-e(to#221 %o$nto 63I
+e,in
p#o(ess2(!*3
+e,in
if #isin,Je%,e2(!*3 then
(!*%KA (!*% Z Y1YI
en% ifI
en% p#o(essI
p#o(ess2(!*%,(!#3
-"#i"+!e temp.st%J!o,i(J-e(to#23 %o$nto 63.AS6616SI
+e,in
if 2(!#AY6Y3 then
if #isin,Je%,e2(!*%22133 then
if %i#AY1Y then
temp.AtempZY1YI
e!se
temp.Atemp/Y1YI
en% ifI
e!se temp.AS6666SI
en% ifI
en% ifI
=KAtempI
en% p#o(essI
en% Beh"-io#"!I
entit& ,#"& is
0o#t 2 (!#,(!* . in STDJL9<ICI
= . ot STDJL9<ICJVECT9R 22 %o$nto 633I
en% ,#"&I
"#(hite(t#e Beh"-io#"! of ,#"& is
si,n"! (!*%.st%J!o,i(J-e(to#221 %o$nto 63I
+e,in
p#o(ess2(!*3
+e,in
if #isin,Je%,e2(!*3 then
(!*%KA (!*% Z Y1YI
en% ifI
en% p#o(essI
p#o(ess2(!#,(!*%3
-"#i"+!e temp.st%J!o,i(J-e(to#22 %o$nto 63I
+e,in
if2(!#AY6Y3 then
if #isin,Je%,e2(!*%22133 then
("se temp is
$hen S666SAU temp.AS661SI
$hen S661SAU temp.AS611SI
$hen S611SAU temp.AS616SI
$hen S616SAU temp.AS116SI
$hen S116SAU temp.AS111SI
$hen S111SAU temp.AS161SI
$hen S161SAU temp.AS166SI
$hen S166SAU temp.AS666SI
HDL MANUAL EC Dept, RNSIT H3
HDL LAB IVth Sem EC
$hen othe#s AU n!!I
en% ("seI
en% ifI
e!se temp.AS666SI
en% ifI
=KAtempI
en% p#o(essI
en% Beh"-io#"!I
entit& 1ohn( is
0o#t 2 (!*,(!# . in STDJL9<ICI

= . inot STDJL9<ICJVECT9R 23 %o$nto 633I
en% 1ohn(I
"#(hite(t#e Beh"-io#"! of 1ohn( is
si,n"! (!*%.st%J!o,i(J-e(to#221 %o$nto 63I
+e,in
p#o(ess2(!*3
+e,in
if #isin,Je%,e2(!*3 then
(!*%KA (!*% Z Y1YI
en% ifI
en% p#o(essI
p#o(ess2(!*%,(!#3
+e,in
if 2(!#AY1Y3 then =KAS6666SI
e!sif #isin,Je%,e2(!*%22133 then
=KA2not =2633F =23 %o$nto 13I
en% ifI
en% p#o(essI
en% Beh"-io#"!I
entit& #in, is
0o#t 2 (!*,(!#,! . in STDJL9<ICI

= . inot STDJL9<ICJVECT9R 23 %o$nto 633I
en% #in,I
"#(hite(t#e Beh"-io#"! of #in, is
si,n"! (!*%.st%J!o,i(J-e(to#221 %o$nto 63I
+e,in
p#o(ess2(!*3
+e,in
if #isin,Je%,e2(!*3 then
(!*%KA (!*% Z Y1YI
en% ifI
en% p#o(essI
p#o(ess2(!*%,(!#3
+e,in
if 2(!#AY1Y3 then =KAS6666SI
HDL MANUAL EC Dept, RNSIT H4
HDL LAB IVth Sem EC
e!sif #isin,Je%,e2(!*%22133 then
if 2!AY1Y3 then
=KAS1666SI
e!se
=KA=263 F =23 %o$nto 13I
en% ifI
en% ifI
en% p#o(essI
en% Beh"-io#"!I
>LI0 >L90S
entit& %ff is
0o#t 2 %,(!* . in STDJL9<ICI
=,=+ . ot STDJL9<IC3I
en% %ffI
"#(hite(t#e Beh"-io#"! of %ff is
si,n"! (!*%.st%J!o,i(J-e(to#221 %o$nto 63I
+e,in
p#o(ess2(!*%3
+e,in
if #isin,Je%,e2(!*3 then
(!*%KA (!*% Z Y1YI
en% ifI
en% p#o(essI
p#o(ess 2(!*3
-"#i"+!e temp. st%J!o,i(I
+e,in
if #isin,Je%,e2(!*3 then
temp.A%I
en% ifI
=KAtempI=+KAnot tempI
en% p#o(essI
en% Beh"-io#"!I
entit& 1*ff is
0o#t 2 1,*,#st,(!* . in STDJL9<ICI
=,=+ . ot STDJL9<IC3I
en% 1*ffI
"#(hite(t#e Beh"-io#"! of 1*ff is
si,n"! (!*%.st%J!o,i(J-e(to#221 %o$nto 63I
+e,in
p#o(ess2(!*%3
+e,in
if #isin,Je%,e2(!*3 then
(!*%KA (!*% Z Y1YI
en% ifI
en% p#o(essI
HDL MANUAL EC Dept, RNSIT HC
HDL LAB IVth Sem EC
p#o(ess2(!*,#st3
-"#i"+!e 1*.st%J!o,i(J-e(to#21 %o$nto 63I
-"#i"+!e temp.st%J!o,i(.AY6YI
+e,in
1*.A1F*I
if 2#st AY6Y3then
if #isin,Je%,e2(!*3 then
("se 1* is
$hen S61SAU temp.AY6YI
$hen S16SAU temp.AY1YI
$hen S11SAU temp.Anot tempI
$hen othe#sAU n!!I
en% ("seI
en% ifI
e!se temp.AY6YI
en% ifI
=KAtempI
=+KAnot tempI
en% p#o(essI
en% Beh"-io#"!I
entit& s#ff is
0o#t 2 s,#,#st,(!* . in STDJL9<ICI
=,=+ . ot STDJL9<IC3I
en% s#ffI
"#(hite(t#e Beh"-io#"! of s#ff is
si,n"! (!*%.st%J!o,i(J-e(to#221 %o$nto 63I
+e,in
p#o(ess2(!*%3
+e,in
if #isin,Je%,e2(!*3 then
(!*%KA (!*% Z Y1YI
en% ifI
en% p#o(essI
p#o(ess2(!*,#st3
-"#i"+!e s#.st%J!o,i(J-e(to#21 %o$nto 63I
-"#i"+!e temp1,temp2.st%J!o,i(.AY6YI
+e,in
s#.AsF#I
if 2#st AY6Y3then
if #isin,Je%,e2(!*3 then
("se s# is
$hen S61SAU temp1.AY6YI temp2.AY1YI
$hen S16SAU temp1.AY1YI temp2.AY6YI
$hen S11SAU temp1.AY1YI temp2.AY1YI
$hen othe#sAU n!!I
en% ("seI
en% ifI
e!se temp1.AY6YI temp2.AY1YI
en% ifI
=KAtemp1I=+KAtemp2I
en% p#o(essI
en% Beh"-io#"!I
HDL MANUAL EC Dept, RNSIT HG
HDL LAB IVth Sem EC
entit& tff is
0o#t 2 t,(!* . in STDJL9<ICI
=,=+ . ot STDJL9<IC3I
en% tffI
"#(hite(t#e Beh"-io#"! of tff is
si,n"! (!*%.st%J!o,i(J-e(to#221 %o$nto 63I
+e,in
p#o(ess2(!*%3
+e,in
if #isin,Je%,e2(!*3 then
(!*%KA (!*% Z Y1YI
en% ifI
en% p#o(essI
p#o(ess 2(!*3
-"#i"+!e temp.st%J!o,i(.AY6YI
+e,in
if #isin,Je%,e2(!*3 then
if 2tAY1Y3 then
temp.Anot tempI
e!se
temp.AtempI
en% ifI
en% ifI
=KAtempI=+KAnot tempI
en% p#o(essI
en% Beh"-io#"!I
VERIL9< >0
mo%!e %ff2%,(!*,#st,=,=+3I
inpt %,(!*,#stI
otpt =,=+I
#e, =,=+I
#e, tempA6I

"!$"&sW2pose%,e (!*,pose%,e #st3
+e,in
if 2#stAA63
tempA%I
e!se
tempAtempI
=AtempI
=+AO temp I
en%
en%mo%!e
mo%!e 1*ff21,*,(!*,#st, =,=+3I
inpt 1,*,(!*,#stI
otpt =,=+I
#e, =,=+I
#e, L1.6M1*I
"!$"&sW2pose%,e (!*,pose%,e #st3
+e,in
1*A[1,*\I
if2#stAA63
+e,in
("se 21*3
HDL MANUAL EC Dept, RNSIT HH
HDL LAB IVth Sem EC
2Y%1.=A1Y+6I
2Y%2.=A1Y+1I
2Y%3.=AO=I
%ef"!t. +e,in en%
en%("se
en%
e!se
=A1Y+6I
=+AO=I
en%
en%mo%!e
mo%!e s#ff2s,#,(!*,#st, =,=+3I
inpt s,#,(!*,#stI
otpt =,=+I
#e, =,=+I
#e, L1.6Ms#I
"!$"&sW2pose%,e (!*,pose%,e #st3
+e,in
s#A[s,#\I
if2#stAA63
+e,in
("se 2s#3
2Y%1.=A1Y+6I
2Y%2.=A1Y+1I
2Y%3.=A1Y+1I
%ef"!t. +e,in en%
en%("se
en%
e!se
+e,in
=A1Y+6I
en%
=+AO=I
en%
en%mo%!e
mo%!e tff2t,(!*,#st, =,=+3I
inpt t,(!*,#stI
otpt =,=+I
#e, =,=+I
#e, tempA6I
"!$"&sW2pose%,e (!*,pose%,e #st3
+e,in

if 2#stAA63 +e,in
if2tAA13 +e,in
tempAO tempI
en%
e!se
tempAtempI

en%
HDL MANUAL EC Dept, RNSIT H8
HDL LAB IVth Sem EC
=AtempI=+AOtempI
en%
en%mo%!e
mo%!e "!12",+,s,en,&3I
inpt L3.6M s,",+I
inpt enI
otpt #e, LH.6M &I
"!$"&sW2",+,s,en,&3
+e,in
if2enAA13
+e,in
("se2s3
4Y%6.&A"Z+I
4Y%1.&A"/+I
4Y%2.&A"]+I
4Y%3.&A[4Y%6,O"\I
4Y%4.&A[4Y%6,2"F+3\I
4Y%C.&A[4Y%6,2"N+3\I
4Y%G.&A[4Y%6,2"P+3\I
4Y%H.&A[4Y%6,O2"F+3\I
4Y%8.&A[4Y%6,O2"N+3\I
4Y%Q.&A[4Y%6,2O"P+3\I
%ef"!t.+e,in en%
en%("se
en%
e!se
&A8Y%6I
en%

en%mo%!e

HDL MANUAL EC Dept, RNSIT HQ

You might also like