You are on page 1of 114

DI

GITALDEVI
CESANDLOGI
C
CI
RCUITS
Depar
tmentofEl
ect
ri
cal
,El
ect
roni
csandComput
erEngi
neer
ing,
Uni
versi
tyofUyo

Pr
epar
edby:
Emmanuel
Ogungbemi
CHAPTER1

NUMBERSYSTEMS
1.
1 Anal
oguev
ersusDi
git
al

Ther
ear
etwobasi
cway
sofr
epr
esent
ingt
henumer
ical
val
uesoft
hev
ari
ousphy
sical
quant
it
ieswi
th
whi
chweconst
ant
lydeal
inourday
-to-
dayl
i
ves.Oneoft
heway
s,r
efer
r oasanal
edt ogue,
ist
oexpr
esst
he
numer
ical
val
ueoft
hequant
it
yasacont
inuousr
angeofv
aluesbet
weent
het
woexpect
edext
remev
alues.
Forexampl
e,t
het
emper
atur
eofanov
enset
tabl
eany
wher
efr
om 0t
o100°
Cmaybemeasur
edt
obe65°
C
or64.
96°
Cor64.
958°
Corev
en64.
9579°
Candsoon,
dependi
ngupont
heaccur
acyoft
hemeasur
ing
i
nst
rument
.Si
mil
arl
y,v
olt
ageacr
ossacer
tai
ncomponenti
nanel
ect
roni
cci
rcui
tmaybemeasur
edas6.
5
Vor6.
49Vor6.
487Vor6.
4869V.Theunder
lyi
ngconcepti
nthi
smodeofr
epr
esent
ati
oni
sthatv
ari
ati
on
i
nthenumer
ical
val
ueoft
hequant
it
yiscont
inuousandcoul
dhav
eanyoft
hei
nfi
nit
etheor
eti
cal
l
ypossi
ble
v
aluesbet
weent
het
woext
remes.

Theot
herpossi
bleway
,ref
err oasdi
edt git
al,
repr
esent
sthenumer
ical
val
ueoft
hequant
it
yinst
eps
ofdi
scr
etev
alues.Thenumer
ical
val
uesar
emost
lyr
epr
esent
edusi
ngbi
nar
ynumber
s.Forexampl
e,t
he
t
emper
atur
eoft
heov
enmayber
epr
esent
edi
nst
epsof1°
Cas64°
C,65°
C,66°
Candsoon.

Tosummar
ize,
whi
l
eananal
oguer
epr
esent
ati
ongi
vesacont
inuousout
put
,adi
git
alr
epr
esent
ati
on
pr
oducesadi
scr
eteout
put
.Anal
oguesy
stemscont
aindev
icest
hatpr
ocessorwor
konv
ari
ousphy
sical
quant
it
iesr
epr
esent
edi
nanal
oguef
orm.Di
git
alsy
stemscont
aindev
icest
hatpr
ocesst
hephy
sical
quant
it
iesr
epr
esent
edi
ndi
git
alf
orm.

1.
2 I
ntr
oduct
iont
oNumberSy
stems

Wewi
l
lbegi
nourdi
scussi
ononv
ari
ousnumbersy
stemsbybr
ief
lydescr
ibi
ngt
hepar
amet
erst
hatar
e
commont
oal
lnumbersy
stems.Anunder
standi
ngoft
hesepar
amet
ersandt
hei
rrel
evancet
onumber
sy
stemsi
sfundament
alt
otheunder
standi
ngofhowv
ari
oussy
stemsoper
ate.Di
ff
erentchar
act
eri
sti
cs
t
hatdef
ineanumbersy
stem i
ncl
udet
henumberofi
ndependentdi
git
susedi
nthenumbersy
stem,
the
pl
acev
aluesoft
hedi
ff
erentdi
git
sconst
it
uti
ngt
henumberandt
hemaxi
mum number
sthatcanbewr
it
ten
wi
tht
hegi
vennumberofdi
git
s.Amongt
het
hreechar
act
eri
sti
cpar
amet
ers,
themostf
undament
ali
sthe
numberofi
ndependentdi
git
sorsy
mbol
susedi
nthenumbersy
stem.I
ti her
sknownast adi
xorbaseof
t
henumbersy
stem.Thedeci
mal
numbersy
stem wi
thwhi
chwear
eal
lsof
ami
l
iarcanbesai
dtohav
ea
r
adi
xof10asi
thas10i
ndependentdi
git
s,i
.e.0,
1,2,
3,4,
5,6,
7,8and9.

Si
mil
arl
y,t
hebi
nar
ynumbersy
stem wi
thonl
ytwoi
ndependentdi
git
s,0and1,
isar
adi
x-2number
sy
stem.Theoct
alandhexadeci
mal
numbersy
stemshav
ear
adi
x(orbase)of8and16r
espect
ivel
y.We

2|Page
wi
l
lseei
nthef
oll
owi
ngsect
ionst
hatt
her
adi
xoft
henumbersy
stem al
sodet
ermi
nest
heot
hert
wo
0 1 2 3
char
act
eri
sti
cs.Thepl
acev
aluesofdi
ff
erentdi
git
sint
hei
ntegerpar
toft
henumberar
egi
venbyr,r,
r,r
−1 −2 −3
andsoon,
star
ti
ngwi
tht
hedi
gitadj
acentt
other
adi
xpoi
nt.Fort
hef
ract
ional
par
t,t
hesear
er ,
r, r and
soon,
agai
nst
art
ingwi
tht
hedi
gitnextt
other
adi
xpoi
nt.Her
e,ri
sther
adi
xoft
henumbersy
stem.Al
so,
maxi
mum number
sthatcanbewr
it
tenwi
thndi
git
sinagi
vennumbersy
stem ar
eequal
tor
n.

1.
3 Deci
mal
NumberSy
stem

Thedeci
mal
numbersy
stem i
sar
adi
x-10numbersy
stem andt
her
efor
ehas10di
ff
erentdi
git
sor
sy
mbol
s.Thesear
e0,
1,2,
3,4,
5,6,
7,8and9.Al
lhi
ghernumber
saf
ter‘
9’ar
erepr
esent
edi
nter
msof
t
hese10di
git
sonl
y.Thepr
ocessofwr
it
inghi
gher
-or
dernumber
saf
ter‘
9’consi
stsi
nwr
it
ingt
hesecond
di
git(
i.
e.‘
1’
)fi
rst
,fol
l
owedbyt
heot
herdi
git
s,onebyone,
toobt
aint
henext10number
sfr
om ‘
10’
to‘
19’
.
Thenext10number
sfr
om ‘
20’
to‘
29’
areobt
ainedbywr
it
ingt
het
hir
ddi
git(
i.
e.‘
2’
)fi
rst
,fol
l
owedbydi
git
s

0’t
o‘9’
,onebyone.Thepr
ocesscont
inuesunt
ilwehav
eexhaust
edal
lpossi
blet
wo-
digi
tcombi
nat
ions
andr
eached‘
99’
.Thenwebegi
nwi
tht
hree-
digi
tcombi
nat
ions.Thef
ir
stt
hree-
digi
tnumberconsi
stsoft
he
l
owestt
wo-
digi
tnumberf
oll
owedby‘
0’(
i.
e.100)
,andt
hepr
ocessgoesonendl
essl
y.

Thepl
acev
aluesofdi
ff
erentdi
git
sinami
xeddeci
mal
number
,st
art
ingf
rom t
hedeci
mal
poi
nt,
are
100,
101,
102andsoon(
fort
hei
ntegerpar
t)and10−1,
10−2,
10−3andsoon(
fort
hef
ract
ional
par
t).The
v
alueormagni
tudeofagi
vendeci
mal
numbercanbeexpr
essedast
hesum oft
hev
ari
ousdi
git
smul
ti
pli
ed
byt
hei
rpl
acev
aluesorwei
ght
s.

Asani
l
lust
rat
ion,
int
hecaseoft
hedeci
mal
number3586.
265,
thei
ntegerpar
t(i
.e.3586)canbe
expr
essedas

3586=6×100+8×101+5×102+3×103= 6+80+500+3000=3586

andt
hef
ract
ional
par
tcanbeexpr
essedas

.265= 2×10−1+6×10−2+5×10−3= 0.
2+0.
06+0.
005=0.
265

Wehav
eseent
hatt
hepl
acev
aluesar
eaf
unct
ionoft
her
adi
xoft
heconcer
nednumbersy
stem and
t
heposi
ti
onoft
hedi
git
s.Wewi
l
lal
sodi
scov
eri
nsubsequentsect
ionst
hatt
heconceptofeachdi
git
hav
ingapl
acev
aluedependi
ngupont
heposi
ti
onoft
hedi
gitandt
her
adi
xoft
henumbersy
stem i
sequal
l
y
v
ali
dfort
heot
hermor
erel
evantnumbersy
stems.

1.
4 Bi
nar
yNumberSy
stem

Thebi
nar
ynumbersy
stem i
sar
adi
x-2numbersy
stem wi
th‘
0’and‘
1’ast
het
woi
ndependentdi
git
s.
Al
ll
argerbi
nar
ynumber
sar
erepr
esent
edi
nter
msof‘
0’and‘
1’
.Thepr
ocedur
eforwr
it
inghi
gheror
der
bi
nar
ynumber
saf
ter‘
1’i
ssi
mil
art
otheoneexpl
ainedi
nthecaseoft
hedeci
mal
numbersy
stem.

3|Page
Forexampl
e,t
hef
ir
st16number
sint
hebi
nar
ynumbersy
stem woul
dbe0,
1,10,
11,
100,
101,
110,
111,
1000,
1001,
1010,
1011,
1100,
1101,
1110and1111.

Thenex
tnumberaf
ter1111i
s10000,
whi
chi
sthel
owestbi
nar
ynumberwi
thf
ivedi
git
s.Thi
sal
so
pr
ovest
hepoi
ntmadeear
li
ert
hatamaxi
mum ofonl =24)number
y16( scoul
dbewr
it
tenwi
thf
ourdi
git
s.
St
art
ingf
rom t
hebi
nar
ypoi
nt,
thepl
acev
aluesofdi
ff
erentdi
git
sinami
xedbi
nar e20,
ynumberar 21,
22and
soon(
fort
hei
ntegerpar
t)and2−1,
2−2,
2−3andsoon(
fort
hef
ract
ional
par
t).

Exampl
e1.
1

Consi
deranar
bit
rar
ynumbersy
stem wi
tht
hei
ndependentdi
git
sas0,
1andX.Whati
sther
adi
xof
t
hisnumbersy
stem?Li
stt
hef
ir
st10number
sint
hisnumbersy
stem.

Sol
uti
on

•Ther
adi
xoft
hepr
oposednumbersy
stem i
s3.
•Thef
ir
st10number
sint
hisnumbersy
stem woul
dbe0,
1,X,
10,
11,
1X,
X0,
X1,
XXand100.

1.
4.1 Adv
ant
ages
Logi
coper
ati
onsar
ethebackboneofanydi
git
alcomput
er,
alt
houghsol
vi
ngapr
obl
em oncomput
er
coul
dinv
olv
eanar
it
hmet
icoper
ati
ont
oo.Thei
ntr
oduct
ionoft
hemat
hemat
icsofl
ogi
cbyGeor
geBool
e
l
aidt
hef
oundat
ionf
ort
hemoder
ndi
git
alcomput
er.Her
educedt
hemat
hemat
icsofl
ogi
ctoabi
nar
y
not
ati
onof‘
0’and‘
1’
.Ast
hemat
hemat
icsofl
ogi
cwaswel
lest
abl
i
shedandhadpr
ovedi
tsel
ftobequi
te
usef
uli
nsol
vi
ngal
lki
ndsofl
ogi
cal
probl
em,
andal
soast
hemat
hemat
icsofl
ogi
c(al
soknownasBool
ean
al
gebr
a)hadbeenr
educedt
oabi
nar
ynot
ati
on,
thebi
nar
ynumbersy
stem hadacl
earedgeov
erot
her
numbersy
stemsf
orusei
ncomput
ersy
stems.
Yetanot
hersi
gni
fi
cantadv
ant
ageoft
hisnumbersy
stem wast
hatal
lki
ndsofdat
acoul
dbe
conv
eni
ent
lyr
epr
esent
edi
nter
msof0sand1s.Al
so,
basi
cel
ect
roni
cdev
icesusedf
orhar
dwar
e
i
mpl
ement
ati
oncoul
dbeconv
eni
ent
lyandef
fi
cient
lyoper
atedi
ntwodi
sti
nct
lydi
ff
erentmodes.For
exampl
e,abi
pol
art
ransi
storcoul
dbeoper
atedei
theri
ncut
-of
fori
nsat
urat
ionv
eryef
fi
cient
ly.
Last
ly,
theci
rcui
tsr
equi
redf
orper
for
mingar
it
hmet
icoper
ati
onssuchasaddi
ti
on,
subt
ract
ion,
mul
ti
pli
cat
ion,
div
isi
on,
etc.
,becomeasi
mpl
eaf
fai
rwhent
hedat
ainv
olv
edar
erepr
esent
edi
nthef
orm of
0sand1s.

1.
5 Oct
alNumberSy
stem

4|Page
Theoct
alnumbersy
stem hasar
adi
xof8andt
her
efor
ehasei
ghtdi
sti
nctdi
git
s.Al
lhi
gher
-or
der
number
sar
eexpr
essedasacombi
nat
ionoft
heseont
hesamepat
ter
nast
heonef
oll
owedi
nthecaseof
t
hebi
nar
yanddeci
mal
numbersy
stemsdescr
ibedi
nSect
ions1.
3and1.
4.Thei
ndependentdi
git
sar
e0,
1,
2,
3,4,
5,6and7.Thenext10number
sthatf
oll
ow‘
7’
,forexampl
e,woul
dbe10,
11,
12,
13,
14,
15,
16,
17,
20and21.I
nfact
,ifweomi
tal
lthenumber
scont
aini
ngt
hedi
git
s8or9,
orbot
h,f
rom t
hedeci
mal
number
sy
stem,
weendupwi
thanoct
alnumbersy
stem.Thepl
acev
aluesf
ort
hedi
ff
erentdi
git
sint
heoct
al
numbersy
st e80,
em ar 81,
82andsoon(
fort
hei
ntegerpar
t)and8−1,
8−2,
8−3andsoon(
fort
hef
ract
ional
par
t).
1.
6 Hexadeci
malNumberSy
stem
Thehexadeci
mal
numbersy
stem i
sar
adi
x-16numbersy
stem andi
ts16basi
cdi
git
sar
e0,
1,2,
3,4,
5,
6,
7,8,
9,A,
B,C,
D,EandF.Thepl
acev
aluesorwei
ght
sofdi
ff
erentdi
git
sinami
xedhexadeci
mal
number
e160,
ar 161,
162andsoon(
fort
hei
ntegerpar
t)and16−1,
16−2,
16−3andsoon(
fort
hef
ract
ional
par
t).The
deci
mal
equi
val
entofA,
B,C,
D,EandFar
e10,
11,
12,
13,
14and15r
espect
ivel
y,f
orobv
iousr
easons.
Thehexadeci
mal
numbersy
stem pr
ovi
desacondensedwayofr
epr
esent
ingl
argebi
nar
ynumber
s
st
oredandpr
ocessedi
nsi
det
hecomput
er.Onesuchexampl
eisi
nrepr
esent
ingaddr
essesofdi
ff
erent
memor
ylocat
ions.Letusassumet
hatamachi
nehas64Kofmemor
y.Suchamemor =216=
yhas64K(
65,
536)memor
ylocat
ionsandneeds65,
536di
ff
erentaddr
esses.Theseaddr
essescanbedesi
gnat
edas0
t
o65,
535i
nthedeci
mal
numbersy
stem and0000000000000000t
o1111111111111111i
nthebi
nar
y
numbersy
stem.Thedeci
mal
numbersy
stem i
snotusedi
ncomput
ersandt
hebi
nar
ynot
ati
onher
e
appear
stoocumber
someandi
nconv
eni
entt
ohandl
e.I
nthehexadeci
mal
numbersy
stem,
65,
536di
ff
erent
addr
essescanbeexpr
essedwi
thf
ourdi
git
sfr
om 0000t
oFFFF.Si
mil
arl
y,t
hecont
ent
soft
hememor
y
whenr
epr
esent
edi
nhexadeci
mal
for
m ar
ever
yconv
eni
entt
ohandl
e.

1.
7 NumberSy
stems–SomeCommonTer
ms
I
nthi
ssect
ionwewi
l
ldescr
ibesomecommonl
yusedt
ermswi
thr
efer
encet
odi
ff
erentnumber
sy
stems.1.
7.1Bi
nar
yNumberSy
stem
Bi
tisanabbr
evi
ati
onoft
het
erm‘
binar
ydi
git
’andi
sthesmal
l
estuni
tofi
nfor
mat
ion.I
tisei
ther‘
0’or
‘.Aby
1’ tei
sast
ri
ngofei
ghtbi
ts.Theby
tei
sthebasi
cuni
tofdat
aoper
ateduponasasi
ngl
euni
tin
comput
ers.Acomput
erwor
disagai
nast
ri
ngofbi
tswhosesi
ze,
cal
l
edt
he‘
wor
dlengt
h’or‘
wor
dsi
ze’
,i
s
f
ixedf
oraspeci
fi
edcomput
er,
alt
houghi
tmayv
aryf
rom comput
ert
ocomput
er.Thewor
dlengt
hmay
equal
oneby
te,
twoby
tes,
fourby
tesorbeev
enl
arger
.
The1’
scompl
ementofabi
nar
ynumberi
sobt
ainedbycompl
ement
ingal
li
tsbi
ts,
i.
e.byr
epl
aci
ng0s
wi
th1sand1swi
th0s.Forexampl
e,t
he1’
scompl
ementof(
10010110)
2is(
01101001)
2.The2’
s
compl
ementofabi
nar
ynumberi
sobt
ainedbyaddi
ng‘
1’t
oit
s1’
scompl
ement
.The2’
scompl
ementof

5|Page
(
10010110)
2is(
01101010)
2.

1.
7.2 Deci
malNumberSy
stem
Cor
respondi
ngt
othe1’
sand2’
scompl
ement
sint
hebi
nar
ysy
stem,
int
hedeci
mal
numbersy
stem
wehav
ethe9’
sand10’
scompl s.The9’
ement scompl
ementofagi
vendeci
mal
numberi
sobt
ainedby
subt
ract
ingeachdi
gitf
rom 9.Forexampl
e,t
he9’
scompl
ementof(
2496)
10woul
dbe(
7503)
10.The10’
s
compl
ementi
sobt
ainedbyaddi
ng‘
1’t
othe9’
scompl
ement
.The10’
scompl
ementof(
2496)
10i
s(7504)
10.

1.
7.3 Oct
alNumberSy
stem
I
ntheoct
alnumbersy
stem,
wehav
ethe7’
sand8’
scompl s.The7’
ement scompl
ementofagi
ven
oct
alnumberi
sobt
ainedbysubt
ract
ingeachoct
aldi
gitf
rom 7.Forexampl
e,t
he7’
scompl
ementof(
562)
8

woul
dbe(
215)
8.The8’
scompl
ementi
sobt
ainedbyaddi
ng‘
1’t
othe7’
scompl
ement
.The8’
scompl
ement
of(
562)
8woul
dbe(
216)
8.

1.
7.4 Hexadeci
malNumberSy
stem
The15’
sand16’
scompl
ement
sar
edef
inedwi
thr
espectt
othehexadeci
mal
numbersy
stem.The
15’
scompl
ementi
sobt
ainedbysubt
ract
ingeachhexdi
gitf
rom 15.Forexampl
e,t
he15’
scompl
ementof
(
3BF)
16woul
dbe(
C40)
16.The16’
scompl
ementi
sobt
ainedbyaddi
ng‘
1’t
othe15’
scompl
ement
.The16’
s
compl
ementof(
2AE)
16woul
dbe(
D52)
16.

1.
8 NumberRepr
esent
ati
oni
nBi
nar
y
Di
ff
erentf
ormat
susedf
orbi
nar
yrepr
esent
ati
onofbot
hposi
ti
veandnegat
ivedeci
mal
number
s
i
ncl
udet
hesi
gn-
bitmagni
tudemet
hod,
the1’
scompl
ementmet
hodandt
he2’
scompl
ementmet
hod.

1.
8.1 Si
gn-
BitMagni
tude
I
nthesi
gn-
bitmagni
tuder
epr
esent
ati
onofposi
ti
veandnegat
ivedeci
mal
number
s,t
heMSB
r
epr
esent
sthe‘
si
gn’
,wi
tha‘
0’denot
ingapl
ussi
gnanda‘
1’denot
ingami
nussi
gn.Ther
emai
ningbi
ts
r
epr
esentt
hemagni
tude.I
nei
ght
-bi
trepr
esent
ati
on,
whi
l
eMSBr
epr
esent
sthesi
gn,
ther
emai
ningsev
en
bi
tsr
epr
esentt
hemagni
tude.Forexampl
e,t
heei
ght
-bi
trepr
esent
ati
onof+9woul
dbe00001001,
andt
hat
f
or−9woul
dbe10001001.Ann−bi
tbi
nar
yrepr
esent
ati
oncanbeusedt
orepr
esentdeci
mal
number
sint
he
r 2n−1−1)t
angeof−( 2n−1−1)
o+( .Thati
s,ei
ght
-bi
trepr
esent
ati
oncanbeusedt
orepr
esentdeci
mal
number
s
i
nther
angef
rom −127t
o+127usi
ngt
hesi
gn-
bitmagni
tudef
ormat
.

1.
8.2 1’
sCompl
ement

6|Page
I
nthe1’
scompl
ementf
ormat
,theposi
ti
venumber
sremai
nunchanged.Thenegat
ivenumber
sar
e
obt
ainedbyt
aki
ngt
he1’
scompl
ementoft
heposi
ti
vecount
erpar
ts.Forexampl
e,+9wi
l
lber
epr
esent
edas
00001001i
nei
ght
-bi
tnot
ati
on,
and−9wi
l
lber
epr
esent
edas11110110,
whi
chi
sthe1’
scompl
ementof
00001001.Agai
n,n-
bitnot
ati
oncanbeusedt
orepr
esentnumber
sint
her
angef
r 2n−1−1)t
om −( 2n−1−1)
o+(
usi
ngt
he1’
scompl
ementf
ormat
.Theei
ght
-bi
trepr
esent
ati
onoft
he1’
scompl
ementf
ormatcanbeused
t
orepr
esentdeci
mal
number
sint
her
angef
rom −127t
o+127
1.
8.3 2’
sCompl
ement
I
nthe2’
scompl
ementr
epr
esent
ati
onofbi
nar
ynumber
s,t
heMSBr
epr
esent
sthesi
gn,
wit
ha‘
0’used
f
orapl
ussi
gnanda‘
1’usedf
orami
nussi
gn.Ther
emai
ningbi
tsar
eusedf
orr
epr
esent
ingmagni
tude.
Posi
ti
vemagni
tudesar
erepr
esent
edi
nthesamewayasi
nthecaseofsi
gn-
bitor1’
scompl
ement
r
epr
esent
ati
on.Negat
ivemagni
tudesar
erepr
esent
edbyt
he2’
scompl
ementoft
hei
rposi
ti
vecount
erpar
ts.
Forexampl
e,+9woul
dber
epr
esent
edas00001001,
and−9woul
dbewr
it
tenas11110111.Pl
easenot
e
t
hat
,ift
he2’
scompl
ementoft
hemagni
tudeof+9gi
vesamagni
tudeof−9,
thent
her
ever
sepr
ocesswi
l
l
al
sobet
rue,
i.
e.t
he2’
scompl
ementoft
hemagni
tudeof−9wi
l
lgi
veamagni
tudeof+9.Then-
bitnot
ati
on
oft
he2’
scompl
ementf
ormatcanbeusedt
orepr
esental
ldeci
mal
number
sint
her
angef
r 2n−1−1)t
om +( o
2n−1)
−( .The2’
scompl
ementf
ormati
sver
ypopul
arasi
tisv
eryeasyt
ogener
atet
he2’
scompl
ementofa
bi
nar
ynumberandal
sobecausear
it
hmet
icoper
ati
onsar
erel
ati
vel
yeasi
ert
oper
for
m whent
henumber
s
ar
erepr
esent
edi
nthe2’
scompl
ementf
ormat
.

1.
9 Fi
ndi
ngt
heDeci
malEqui
val
ent
Thedeci
mal
equi
val
entofagi
vennumberi
nanot
hernumbersy
stem i
sgi
venbyt
hesum ofal
lthe
di
git
smul
ti
pli
edbyt
hei
rrespect
ivepl
acev
alues.Thei
ntegerandf
ract
ional
par
tsoft
hegi
vennumber
shoul
dbet
reat
edsepar
atel
y.Bi
nar
y-t
o-deci
mal
,oct
al-
to-
deci
mal
andhexadeci
mal
-t
o-deci
mal
conv
ersi
ons
ar
eil
l
ust
rat
edbel
owwi
tht
hehel
pofexampl
es.

1.
9.1 Bi
nar
y-t
o-Deci
malConv
ersi
on
Thedeci
mal
equi
val
entoft
hebi
nar
ynumber(
1001.
0101)
2isdet
ermi
nedasf
oll
ows:

Thedeci
mal
par
t(1001)
=1×20+0×21+0×22+1×23=1+0+0+8=9
Thef
ract
ional
par
t(.
0101)
=0×2−1+1×2−2+0×2−3+1×2−4=0+0.
25+0+0.
0625=0.
3125
Ther
efor
e,t
hedeci
mal
equi
val
entof(
1001.
0101)
2 = 9.
3125 (
i.
e.9+0.
3125)

1.
9.2 Oct
al-
to-
Deci
malConv
ersi
on
7|Page
Thedeci
mal
equi
val
entoft
heoct
alnumber(
137.
21)
8isdet
ermi
nedasf
oll
ows:
Thei
ntegerpar
t(137)

=7×80+3×81+1×82=7+24+64=95

Thef
ract
ional
par
t(.
21) =2×8−1+1×8−2=0.
265

•Ther
efor
e,t
hedeci
mal
equi
val
entof(
137.
21)
8 =(
95.
265)
10

1.
9.3 Hexadeci
mal
-t
o-Deci
malConv
ersi
on

Thedeci
mal
equi
val
entoft
hehexadeci
mal
number(
1E0.
2A)16i
sdet
ermi
nedasf
oll
ows:

•Thei
ntegerpar
t(1E0)=0×160+14×161+1×162=0+224+256=480

•Thef
ract
ional
par
t(2A)=2×16−1+10×16−2=0.
164

•Ther
efor
e,t
hedeci
mal
equi
val
entof(
1E0.
2A)
16 =(
480.
164)
10

Exampl
e1.
2

Fi
ndt
hedeci
malequi
val
entoft
hef
oll
owi
ngbi
nar
ynumber
sexpr
essedi
nthe2’
scompl
ementf
ormat
:

(
a)00001110;
(b)10001110.

Sol
uti
on

(
a) TheMSBbi
tis‘
0’
,whi
chi
ndi
cat
esapl
ussi
gn.

Themagni
tudebi
tsar
e0001110.

Thedeci
mal
equi
v ent=0×20+1×21+1×22+1×23+0×24+0×25+0×26
al

=0+2+4+8+0+0+0=14

Ther
efor
e,00001110r
epr
esent
s+14

(
b) TheMSBbi
tis‘
1’
,whi
chi
ndi
cat
esami
nussi
gn

Themagni
tudebi
tsar
ether
efor
egi
venbyt
he2’
scompl
ementof0001110,
i.
e.1110010

Thedeci
mal
equi
v ent=0×20+1×21+0×22+0×23+1×24+1×25+1×26
al

=0+2+0+0+16+32+64=114

Ther
efor
e,10001110r
epr
esent
s114

1.
10 Deci
mal
-t
o-Bi
nar
yConv
ersi
on

Asout
li
nedear
li
er,
thei
ntegerandf
ract
ional
par
tsar
ewor
kedonsepar
atel
y.Fort
hei
ntegerpar
t,t
he

8|Page
bi
nar
yequi
val
entcanbef
oundbysuccessi
vel
ydi
vi
dingt
hei
ntegerpar
toft
henumberby2andr
ecor
ding
t
her
emai
nder
sunt
ilt
hequot
ientbecomes‘
0’
.Ther
emai
nder
swr
it
teni
nrev
erseor
derconst
it
utet
hebi
nar
y
equi
val
ent
.Fort
hef
ract
ional
par
t,i
tisf
oundbysuccessi
vel
ymul
ti
ply
ingt
hef
ract
ional
par
toft
hedeci
mal
numberby2andr
ecor
dingt
hecar
ryunt
ilt
her
esul
tofmul
ti
pli
cat
ioni
s‘0’
.Thecar
rysequencewr
it
teni
n
f
orwar
dor
derconst
it
utest
hebi
nar
yequi
val
entoft
hef
ract
ional
par
toft
hedeci
mal
number
.Ift
her
esul
tof
mul
ti
pli
cat
iondoesnotseem t
obeheadi
ngt
owar
dszer
oint
hecaseoft
hef
ract
ional
par
t,t
hepr
ocessmay
becont
inuedonl
yunt
ilt
her
equi
sit
enumberofequi
val
entbi
tshasbeenobt
ained.Thi
smet
hodof
deci
mal
–bi
nar
yconv
ersi
oni
spopul
arl
yknownast
hedoubl
e-dabbl
emet
hod.Thepr
ocesscanbebest
i
l
lust
rat
edwi
tht
hehel
pofanexampl
e.

Exampl
e1.
3
Wewi
l
lfi
ndt
hebi
nar
yequi
val
entof(
13.
375)
10.

Sol
uti
on
•Thei
ntegerpar
t=13
Divi
sor Divi
dend Remai
nder
2 13 —
2 6 1
2 3 0
2 1 1
— 0 1

• Thebi
nar
yequi
val
entof(13)10i
sther
efor
e( 1101)
2

• Thef
ract
ional
par
t=.
375
• 0.
375×2=0.
75 wi
thacar
ryof0
• 0.
75×2=0.
5 wi
thacar
ryof1
• 0.
5×2=0 wi
thacar
ryof1

Thebi
nar
yequi
val
entof(
0.375)
10 =(
.011)
2
Ther
efor
e,t
hebi
nar
yequi
val
entof(
13.
375)
10 =(
1101.
011)
2

1.
11 Deci
mal
-t
o-Oct
alConv
ersi
on

Thepr
ocessofdeci
mal
-t
o-oct
alconv
ersi
oni
ssi
mil
art
othatofdeci
mal
-t
o-bi
nar
yconv
ersi
on.The
pr
ogr
essi
vedi
vi
sioni
nthecaseoft
hei
ntegerpar
tandt
hepr
ogr
essi
vemul
ti
pli
cat
ionwhi
l
ewor
kingont
he
f
ract
ional
par
ther
ear
eby‘
8’whi
chi
sther
adi
xoft
heoct
alnumbersy
stem.Agai
n,t
hei
ntegerand
f
ract
ional
par
tsoft
hedeci
mal
numberar
etr
eat
edsepar
atel
y.Thepr
ocesscanbebesti
l
lust
rat
edwi
tht
he
9|Page
hel
pofanexampl
e.

Exampl
e1.
4:Wewi
l
lfi
ndt
heoct
alequi
val
entof(
73.
75)
10_

Sol
uti
on
• Thei
ntegerpar
t=73
Di
vi
sor Di
vi
dend Remai
nder
8 73 —
8 9 1
8 1 1
- 0 1
•Theoct
alequival
entof( 73)10 =(111) 8

• Thef r
act i
onal part=0.75
• 0.75×8=0wi t
hacar ryof6
• Theoct alequivalentof(0.75) 10 =(.6)8

• Theref
ore,theoct alequivalentof( 73.75)10 =(
111.
6)8

1.
12 Deci
mal
-t
o-Hexadeci
malConv
ersi
on

Thepr
ocessofdeci
mal
-t
o-hexadeci
mal
conv
ersi
oni
sal
sosi
mil
ar.Si
ncet
hehexadeci
mal
number
sy
stem hasabaseof16,
thepr
ogr
essi
vedi
vi
sionandmul
ti
pli
cat
ionf
act
ori
nthi
scasei
s16.Thepr
ocess
i
sil
l
ust
rat
edf
urt
herwi
tht
hehel
pofanexampl
e.

Exampl
e1.
5

Letusdet
ermi
net
hehexadeci
malequi
val
entof(
82.
25)
10_
Sol
uti
on
•Thei
ntegerpar
t=82
Di
vi
sor Di
vi
dend Remai
nder
16 82 —
16 5 2
— 0 5
•Thehexadeci
mal
equi
val
entof(
82)
10 =(
52)
16

•Thef
ract
ional
par
t=0.
25
0.
25×16=0wi
thacar
ryof4
•Ther
efor
e,t
hehexadeci
mal
equi
val
entof(
82.
25)
10 =(
52.
4)16

1.
13 Bi
nar
y–Oct
alandOct
al–Bi
nar
yConv
ersi
ons

10|
Page
Anoct
alnumbercanbeconv
ert
edi
ntoi
tsbi
nar
yequi
val
entbyr
epl
aci
ngeachoct
aldi
gitwi
thi
tst
hree
-
bitbi
nar
yequi
val
ent
.Wet
aket
het
hree-
bitequi
val
entbecauset
hebaseoft
heoct
alnumbersy
stem i
s8
andi
tist
het
hir
dpoweroft
hebaseoft
hebi
nar
ynumbersy
stem,
i.
e.2.Al
lwehav
ethent
orememberi
s
t
het
hree-
bitbi
nar
yequi
val
ent
soft
hebasi
cdi
git
soft
heoct
alnumbersy
stem.Abi
nar
ynumbercanbe
conv
ert
edi
ntoanequi
val
entoct
alnumberbyspl
i
tti
ngt
hei
ntegerandf
ract
ional
par
tsi
ntogr
oupsoft
hree
bi
ts,
star
ti
ngf
rom t
hebi
nar
ypoi
ntonbot
hsi
des.The0scanbeaddedt
ocompl
etet
heout
sidegr
oupsi
f
needed.

Exampl
e1.
6
Letusf
indt
hebi
nar
yequi
val
entof(
374.
26)
8andt
heoct
alequi
val
entof(
1110100.
0100111)
2

Sol
uti
on
•Thegi
venoct
alnumber=(
374.
26)
8

•Thebi
nar
yequi
val
ent=(
011111100.
010110)
2

=(
011111100.
010110)
2

Any0sont
heext
remel
eftoft
hei
ntegerpar
tandext
remer
ightoft
hef
ract
ional
par
toft
heequi
val
ent
bi
nar
ynumbershoul
dbeomi
tt
ed.Ther
efor
e,(
011111100.
010110)
2

=(
11111100.
01011)
2

•Thegi
venbi
nar
ynumber=(
1110100.
0100111)
2

(
1110100.
0100111)
2 =(
1110100.
0100111)
2

=(
001110100.
010011100)
2 =(
164.
234)
8

1.
14 Hex–Bi
nar
yandBi
nar
y–HexConv
ersi
ons

Ahexadeci
mal
numbercanbeconv
ert
edi
ntoi
tsbi
nar
yequi
val
entbyr
epl
aci
ngeachhexdi
gitwi
thi
ts
f
our
-bi
tbi
nar
yequi
val
ent
.Wet
aket
hef
our
-bi
tequi
val
entbecauset
hebaseoft
hehexadeci
mal
number
sy
stem i
s16andi
tist
hef
our
thpoweroft
hebaseoft
hebi
nar
ynumbersy
stem.Al
lwehav
ethent
o
r
ememberi
sthef
our
-bi
tbi
nar
yequi
val
ent
soft
hebasi
cdi
git
soft
hehexadeci
mal
numbersy
stem.Agi
ven
bi
nar
ynumbercanbeconv
ert
edi
ntoanequi
val
enthexadeci
mal
numberbyspl
i
tti
ngt
hei
ntegerand
f
ract
ional
par
tsi
ntogr
oupsoff
ourbi
ts,
star
ti
ngf
rom t
hebi
nar
ypoi
ntonbot
hsi
des.The0scanbeadded
t
ocompl
etet
heout
sidegr
oupsi
fneeded.

Exampl
e1.
7

11|
Page
Letusf
indt
hebi
nar
yequi
val
entof(
17E.
F6)
16andt
hehexequi
val
entof(
1011001110.
011011101)
2.

Sol
uti
on

•Thegi
venhexnumber=(
17E.
F6)
16

•Thebi
nar
yequi
val
ent=(
000101111110.
11110110)
2

=(
000101111110.
11110110)
2 =(
101111110.
1111011)
2

The0sont
heex
tremel
eftoft
hei
ntegerpar
tandont
heext
remer
ightoft
hef
ract
ional
par
thav
ebeen
omi
tt
ed.

•Thegi
venbi
nar
ynumber=(
1011001110.
011011101)
2 =(
1011001110.
011011101)
2

•Thehexequi
val
ent=(
001011001110.
011011101000)
2 =(
2CE.
6E8)
16

1.
15 Hex–Oct
alandOct
al–HexConv
ersi
ons

Forhexadeci
mal
–oct
alconv
ersi
on,
thegi
venhexnumberi
sfi
rst
lyconv
ert
edi
ntoi
tsbi
nar
yequi
val
ent
whi
chi
sfur
therconv
ert
edi
ntoi
tsoct
alequi
val
ent
.Anal
ter
nat
iveappr
oachi
sfi
rst
lyt
oconv
ertt
hegi
ven
hexadeci
mal
numberi
ntoi
tsdeci
mal
equi
val
entandt
henconv
ertt
hedeci
mal
numberi
ntoanequi
val
ent
oct
alnumber
.Thef
ormermet
hodi
sdef
ini
tel
ymor
econv
eni
entandst
rai
ght
for
war
d.For
oct
al–hexadeci
mal
conv
ersi
on,
theoct
alnumbermayf
ir
stbeconv
ert
edi
ntoanequi
val
entbi
nar
ynumber
andt
hent
hebi
nar
ynumbert
ransf
ormedi
ntoi
tshexequi
val
ent
.Theot
heropt
ioni
sfi
rst
lyt
oconv
ertt
he
gi
venoct
alnumberi
ntoi
tsdeci
mal
equi
val
entandt
henconv
ertt
hedeci
mal
numberi
ntoi
tshexequi
val
ent
.
Thef
ormerappr
oachi
sdef
ini
tel
ythepr
efer
redone.Twot
ypesofconv
ersi
onar
eil
l
ust
rat
edi
nthef
oll
owi
ng
exampl
e.

Exampl
e1.
8

Letusf
indt
heoct
alequi
val
entof(
2F.
C4)
16andt
hehexequi
val
entof(
762.
013)
8

Sol
uti
on

•Thegi
venhexnumber=(
2F.
C4)
16.

•Thebi
nar
yequi
val
ent=(
00101111.
11000100)
2

=(
00101111.
11000100)
2 =(
101111.
110001)
2

=(
101111.
110001)
2 =(
57.
61)
8.

•Thegi
venoct
alnumber=(
762.
013)
8.

12|
Page
•Theoct
alnumber=(
762.
013)
8

=(
111110010.
000001011)
2 =(
111110010.
000001011)
2

=(
000111110010.
000001011000)
2=(
1F2.
058)
16.

CHAPTER2

BI
NARYCODES
2.
1 Bi
nar
yCodedDeci
mal

Thebi
nar
ycodeddeci
mal
(BCD)i
sat
ypeofbi
nar
ycodeusedt
orepr
esentagi
vendeci
mal
numberi
n
anequi
val
entbi
nar
yfor
m.BCD-
to-
deci
mal
anddeci
mal
-t
o-BCDconv
ersi
onsar
ever
yeasyand
st
rai
ght
for
war
d.I
tisal
sof
arl
esscumber
someanexer
ciset
orepr
esentagi
vendeci
mal
numberi
nan
equi
val
entBCDcodet
hant
orepr
esenti
tint
heequi
val
entst
rai
ghtbi
nar
yfor
m di
scussedi
nthepr
evi
ous
chapt
er.

TheBCDequi
val
entofadeci
mal
numberi
swr
it
tenbyr
epl
aci
ngeachdeci
mal
digi
tint
hei
ntegerand
f
ract
ional
par
tswi
thi
tsf
our
-bi
tbi
nar
yequi
val
ent
.Asanexampl
e,t
heBCDequi
val
entof(
23.
15)
10i
swr
it
ten
as(
00100011.
00010101)BCD.TheBCDcodedescr
ibedabov
eismor
epr
eci
sel
yknownast
he8421BCD
code,
wit
h8,
4,2and1r
epr
esent
ingt
hewei
ght
sofdi
ff
erentbi
tsi
nthef
our
-bi
tgr
oups,
star
ti
ngf
rom MSB
andpr
oceedi
ngt
owar
dsLSB.Thi
sfeat
uremakesi
tawei
ght
edcode,
whi
chmeanst
hateachbi
tint
hef
our
-
bi
tgr
oupr
epr
esent
ingagi
vendeci
mal
digi
thasanassi
gnedwei
ght
.Ot
herwei
ght
edBCDcodesi
ncl
udet
he
4221BCDand5421BCDcodes.Agai
n,4,
2,2and1i
nthe4221BCDcodeand5,
4,2and1i
nthe5421BCD
coder
epr
esentwei
ght
soft
her
elev
antbi
ts.

13|
Page
Tabl
e2.
1showsacompar
isonof8421,
4221and5421BCDcodes.Asanexampl
e,(
98.
16)
10wi
l
lbe
wr
it
tenas11111110.
00011100i
n4221BCDcodeand11001011.
00011001i
n5421BCDcode.Si
ncet
he
8421codei
sthemostpopul
arofal
ltheBCDcodes,
iti
ssi
mpl
yref
err
edt
oast
heBCDcode.

2.
1.1 BCD-
to-
Binar
yConv
ersi
on

Agi
venBCDnumbercanbeconv
ert
edi
ntoanequi
val
entbi
nar
ynumberbyf
ir
stwr
it
ingi
tsdeci
mal
equi
val
entandt
henconv
ert
ingi
tint
oit
sbi
nar
yequi
val
ent
.Thef
ir
stst
epi
sst
rai
ght
for
war
d,andt
hesecond
st
epwasexpl
ainedi
nthepr
evi
ouschapt
er.Asanexampl
e,wewi
l
lfi
ndt
hebi
nar
yequi
val
entoft
heBCD
number00101001.
01110101:

 BCDnumber
:00101001.
01110101.

 Cor
respondi
ngdeci
mal
number
:29.
75.

 Thebi
nar
yequi
val
entof29.
75canbedet
ermi
nedt
obe11101f
ort
hei
ntegerpar
tand.
11f
or
t
hef
ract
ional
par
t.

 Ther
efor
e,(
00101001.
01110101)BCD=(
11101.
11)
2.

2.
1.2 Bi
nar
y-t
o-BCDConv
ersi
on

Thepr
ocessofbi
nar
y-t
o-BCDconv
ersi
oni
sthesameast
hepr
ocessofBCD-
to-
binar
yconv
ersi
on
execut
edi
nrev
erseor
der
.Agi
venbi
nar
ynumbercanbeconv
ert
edi
ntoanequi
val
entBCDnumberbyf
ir
st
det
ermi
ningi
tsdeci
mal
equi
val
entandt
henwr
it
ingt
hecor
respondi
ngBCDequi
val
ent
.Asanexampl
e,we
wi
l
lfi
ndt
heBCDequi
val
entoft
hebi
nar
ynumber10101011.
101:

14|
Page
 Thedeci
mal
equi
val
entoft
hisbi
nar
ynumbercanbedet
ermi
nedt
obe171.
625.

 TheBCDequi
val
entcant
henbewr
it
tenas000101110001.
011000100101.

2.
2 Excess-
3Code

Theexcess-
3codei
sanot
heri
mpor
tantBCDcode.I
tispar
ti
cul
arl
ysi
gni
fi
cantf
orar
it
hmet
ic
oper
ati
onsasi
tov
ercomest
heshor
tcomi
ngsencount
eredwhi
l
eusi
ngt
he8421BCDcodet
oaddt
wo
deci
mal
digi
tswhosesum exceeds9.Theexcess-
3codehasnosuchl
i
mit
ati
on,
andi
tconsi
der
abl
y
si
mpl
i
fiesar
it
hmet
icoper
ati
ons.Tabl
e2.
2li
stst
heexcess-
3codef
ort
hedeci
mal
number
s0–9.The
excess-
3codef
oragi
vendeci
mal
numberi
sdet
ermi
nedbyaddi
ng‘
3’t
oeachdeci
mal
digi
tint
hegi
ven
numberandt
henr
epl
aci
ngeachdi
gitoft
henewl
yfounddeci
mal
numberbyi
tsf
our
-bi
tbi
nar
yequi
val
ent
.It
maybement
ionedher
ethat
,ift
headdi
ti
onof‘
3’t
oadi
gitpr
oducesacar
ry,
asi
sthecasewi
tht
hedi
git
s7,
8and9,
thatcar
ryshoul
dnotbet
akenf
orwar
d.Ther
esul
tofaddi
ti
onshoul
dbet
akenasasi
ngl
eent
it
yand
subsequent
lyr
epl
acedwi
thi
tsexcess-
3codeequi
val
ent
.Asanexampl
e,l
etusf
indt
heexcess-
3codef
or
t
hedeci
mal
number597:

 Theaddi
ti
onof‘
3’t
oeachdi
gity
iel
dst
het
hreenewdi
git
s/number
s‘8’
,‘
12’
and‘
10’
.

 Thecor
respondi
ngf
our
-bi
tbi
nar
yequi
val
ent
sar
e1000,
1100and1010r
espect
ivel
y.

 Theexcess-
3codef
or597i
sther
efor
egi
venby
:100011001010=100011001010.

Al
so,
iti
snor
mal
pract
icet
orepr
esentagi
vendeci
mal
digi
tornumberusi
ngt
hemaxi
mum numberof
di
git
sthatt
hedi
git
alsy
stem i
scapabl
eofhandl
i
ng.Forexampl
e,i
nfour
-di
gitdeci
mal
ari
thmet
ic,
5and37
woul
dbewr
it
tenas0005and0037r
espect
ivel
y.Thecor
respondi
ng8421BCDequi
val
ent
swoul
dbe
0000000000000101and0000000000110111andt
heexcess-
3codeequi
val
ent
swoul
dbe
0011001100111000and0011001101101010.

Cor
respondi
ngt
oagi
venexcess-
3code,
theequi
val
entdeci
mal
numbercanbedet
ermi
nedbyf
ir
st

15|
Page
spl
i
tti
ngt
henumberi
ntof
our
-bi
tgr
oups,
star
ti
ngf
rom t
her
adi
xpoi
nt,
andt
hensubt
ract
ing0011f
rom each
f
our
-bi
tgr
oup.Thenewnumberi
sthe8421BCDequi
val
entoft
hegi
venexcess-
3code,
whi
chcan
subsequent
lybeconv
ert
edi
ntot
heequi
val
entdeci
mal
number
.Asanexampl
e,f
oll
owi
ngt
hesest
eps,
the
deci
mal
equi
val
entofexcess-
3number01010110.
10001010woul
dbe23.
57.

Anot
hersi
gni
fi
cantf
eat
uret
hatmakest
hiscodeat
tract
ivef
orper
for
mingar
it
hmet
icoper
ati
onsi
s
t
hatt
hecompl
ementoft
heexcess-
3codeofagi
vendeci
mal
numbery
iel
dst
heexcess-
3codef
or9’
s
compl
ementoft
hedeci
mal
number
.Asaddi
ng9’
scompl
ementofadeci
mal
numberBt
oadeci
mal
numberAachi
evesA–B,
theexcess-
3codecanbeusedef
fect
ivel
yforbot
haddi
ti
onandsubt
ract
ionof
deci
mal
number
s.

Exampl
e2.
3

Fi
nd(
a)t
heexcess-
3equi
val
entof(
237.
75)
10and(
b)t
hedeci
malequi
val
entoft
heexcess-
3number
110010100011.
01110101.

Sol
uti
on

(
a)I
ntegerpar
t=237.

Theexcess-
3codef
or(
237)
10i
sobt
ainedbyr
epl
aci
ng2,
3and7wi
tht
hef
our
-bi
tbi
nar
y
equi
val
ent
sof5,
6and10r
espect
ivel
y.Thi
sgi
vest
heexcess-
3codef
or(
237)
10as:
01010110
1010=010101101010.

Fr
act
ional
par
t=.
75.Theexcess-
3codef
or(
.75)
10i
sobt
ainedbyr
epl
aci
ng7and5wi
tht
hef
our
-bi
t
bi
nar
yequi
val
ent
sof10and8r
espect
ivel
y.Thati
s,t
heexcess-
3codef
or(
.75)
10

=.
10101000.

Combi
ningt
her
esul
tsoft
hei
ntegr
alandf
ract
ional
par
ts,
theexcess-
3codef
or

(
237.
75)
10 =010101101010.
10101000.

(
b)Theexcess-
3code=110010100011.
01110101=110010100011.
01110101.

Subt
ract
ing0011f
rom eachf
our
-bi
tgr
oup,
weobt
aint
henewnumberas:
100101110000.
0100
0010.

Ther
efor
e,t
hedeci
mal
equi
val
ent =(
970.
42)
10.

2.
3 Gr
ayCode

16|
Page
TheGr
aycodewasdesi
gnedbyFr
ankGr
ayatBel
lLabsandpat
ent
edi
n1953.I
tisanunwei
ght
ed
bi
nar
ycodei
nwhi
cht
wosuccessi
vev
aluesdi
ff
eronl
yby1bi
t.Owi
ngt
othi
sfeat
ure,
themaxi
mum er
ror
t
hatcancr
eepi
ntoasy
stem usi
ngt
hebi
nar
yGr
aycodet
oencodedat
aismuchl
esst
hant
hewor
st-
case
er
rorencount
eredi
nthecaseofst
rai
ghtbi
nar
yencodi
ng.Tabl
e2.
3li
stst
hebi
nar
yand

Gr
aycodeequi
val
ent
sofdeci
mal
number
s0–15.Anexami
nat
ionoft
hef
our
-bi
tGr
aycodenumber
s,
asl
i
stedi
nTabl
e2.
3,showst
hatt
hel
astent
ryr
oll
sov
ert
othef
ir
stent
ry.Thati
s,t
hel
astandt
hef
ir
st
ent
ryal
sodi
ff
erbyonl
y1bi
t.Thi
si hecy
sknownast cli
cpr
oper
tyoft
heGr
aycode.Al
thought
her
ecanbe
mor
ethanoneGr
aycodef
oragi
venwor
dlengt
h,t
het
erm wasf
ir
stappl
i
edt
oaspeci
fi
cbi
nar
ycodef
or
non-
negat
ivei
nteger
sandcal
l hebi
edt nar
y-r
efl
ect
edGr
aycodeorsi
mpl
ytheGr
aycode.

17|
Page
Ther
ear
evar
iousway
sbywhi
chGr
aycodeswi
thagi
vennumberofbi
tscanber
emember
ed.One
suchwayi
stor
emembert
hatt
hel
eastsi
gni
fi
cantbi
tfol
l
owsar
epet
it
ivepat
ter
nof‘
2’(
11,
00,
11,
___)
,
t
henexthi
gheradj
acentbi
tfol
l
owsapat
ter
nof‘
4’(
1111,
0000,
1111,
___)andsoon.Wecanal
so
gener
atet
hen-
bitGr
aycoder
ecur
siv
elybypr
efi
xi
nga‘
0’t
otheGr
aycodef
orn−1bi
tst
oobt
aint
hef
ir
st2n
−1number
s,andt
henpr
efi
xi
ng‘
1’t
other
efl
ect
edGr
aycodef
orn−1bi
tst
oobt
aint
her
emai
ning2n−1
number
s.Ther
efl
ect
edGr
aycodei
snot
hingbutt
hecodewr
it
teni
nrev
erseor
der
.Thepr
ocessof
gener
ati
onofhi
gher
-bi
tGr
aycodesusi
ngt
her
efl
ect
-and-pr
efi
xmet
hodi
sil
l
ust
rat
edi
nTabl
e2.
4.The
col
umnsofbi
tsbet
weent
hoser
epr
esent
ingt
he

Gr
aycodesgi
vet
hei
nter
medi
atest
epofwr
it
ingt
hecodef
oll
owedbyt
hesamewr
it
teni
nrev
erseor
der
.

2.
3.1 Bi
nar
y–Gr
ayCodeConv
ersi
on

Agi
venbi
nar
ynumbercanbeconv
ert
edi
ntoi
tsGr
aycodeequi
val
entbygoi
ngt
hrought
hef
oll
owi
ngst
eps:

1.Begi
nwi
tht
hemostsi
gni
fi
cantbi
t(MSB)oft
hebi
nar
ynumber
.TheMSBoft
heGr
aycodequi
val
ent
i
sthesameast
heMSBoft
hegi
venbi
nar
ynumber
.

2.Thesecondmostsi
gni
fi
cantbi
t,adj
acentt
otheMSB,
int
heGr
aycodenumberi
sobt
ainedbaddi
ng
t
heMSBandt
hesecondMSBoft
hebi
nar
ynumberandi
gnor
ingt
hecar
ry,
ifany
.Thati
sift
heMSB
andt
hebi
tadj
acentt
oitar
ebot
h‘1’
,t
hent
hecor
respondi
ngGr
aycodebi
twoul
dbe‘
0’
.

3.Thet
hir
dmostsi
gni
fi
cantbi
t,adj
acentt
othesecondMSB,
int
heGr
aycodenumberi
sobt
ainedby
addi
ngt
hesecondMSBandt
het
hir
dMSBi
nthebi
nar
ynumberandi
gnor
ingt
hecar
ry,
ifany
.

4.Thepr
ocesscont
inuesunt
ilweobt
aint
heLSBoft
heGr
aycodenumberbyt
headdi
ti
onoft
heLSB
andt
henexthi
gheradj
acentbi
toft
hebi
nar
ynumber
.Theconv
ersi
onpr
ocessi
sfur
theri
l
lust
rat
ed
wi
tht
hehel
pofanexampl
eshowi
ngst
ep-
by-
stepconv
ersi
onof(
1011)
2int
oit
sGr
aycode
equi
val
ent
:

Bi
nar
y1011
Gr
aycode1---
Bi
nar
y1011
Gr
aycode11--
Bi
nar
y1011
Gr
aycode111-
Bi
nar
y1011
Gr
aycode1110

2.
3.2 Gr
ayCode–Bi
nar
yConv
ersi
on

Agi
venGr
aycodenumbercanbeconv
ert
edi
ntoi
tsbi
nar
yequi
val
entbygoi
ngt
hrought
hef
oll
owi
ng
st
eps:

1.Begi
nwi
tht
hemostsi
gni
fi
cantbi
t(MSB)
.TheMSBoft
hebi
nar
ynumberi
sthesameast
he
18|
Page
MSBoft
heGr
aycodenumber
.

2.Thebi
tnextt
otheMSB(
thesecondMSB)i
nthebi
nar
ynumberi
sobt
ainedbyaddi
ngt
heMSB
i
nthebi
nar
ynumbert
othesecondMSBi
ntheGr
aycodenumberanddi
sregar
dingt
hecar
ry,
if
any
.

3.Thet
hir
dMSBi
nthebi
nar
ynumberi
sobt
ainedbyaddi
ngt
hesecondMSBi
nthebi
nar
y
numbert
othet
hir
dMSBi
ntheGr
aycodenumber
.Agai
n,car
ry,
ifany
,ist
obei
gnor
ed.

4.Thepr
ocesscont
inuesunt
ilweobt
aint
heLSBoft
hebi
nar
ynumber
.Theconv
ersi
onpr
ocess
i
sfur
theri
l
lust
rat
edwi
tht
hehel
pofanexampl
eshowi
ngst
ep-
by-
stepconv
ersi
onoft
heGr
ay
codenumber1110i
ntoi
tsbi
nar
yequi
val
ent
:

Gr
aycode1110
Bi
nar
y1---
Gr
aycode1110
Bi
nar
y10--
Gr
aycode1110
Bi
nar
y101
Gr
aycode1110
Bi
nar
y1011

2.
3.4 Appl
icat
ionsofGr
ayCodes

1.TheGr
aycodei
susedi
nthet
ransmi
ssi
onofdi
git
alsi
gnal
sasi
tmi
nimi
zest
heoccur
renceof
er
ror
s.

2.TheGr
aycodei
spr
efer
redov
ert
hest
rai
ghtbi
nar
ycodei
nangl
e-measur
ingdev
ices.Useoft
he
Gr
aycodeal
mostel
i
minat
est
hepossi
bil
i
tyofanangl
emi
sread,
whi
chi
sli
kel
yift
heangl
eis
r
epr
esent
edi
nst
rai
ghtbi
nar
y.Thecy
cli
cpr
oper
tyoft
heGr
aycodei
sapl
usi
nthi
sappl
i
cat
ion.

3.TheGr
aycodei
susedf
orl
abel
i
ngt
heaxesofKar
naughmaps,
agr
aphi
cal
techni
queusedf
or
mi
nimi
zat
ionofBool
eanexpr
essi
ons.

4.TheuseofGr
aycodest
oaddr
esspr
ogr
am memor
yincomput
ersmi
nimi
zespower
consumpt
ion.Thi
sisduet
ofeweraddr
essl
i
neschangi
ngst
atewi
thadv
ancesi
nthepr
ogr
am
count
er.

5.Gr
aycodesar
eal
sov
eryusef
uli
ngenet
ical
gor
it
hmssi
ncemut
ati
onsi
nthecodeal
l
owf
or
most
lyi
ncr
ement
alchanges.Howev
er,
occasi
onal
l
yaone-
bitchangecanr
esul
tinabi
gleap,
t
husl
eadi
ngt
onewpr
oper
ti
es.

2.
4 Al
phanumer
icCode

Forpr
opercommuni
cat
ionweneedt
orepr
esentnumber
s,l
ett
ersandsy
mbol
s.Al
phanumer
iccodecan

19|
Page
r
epr
esental
ltheset
hree.

2.
4.1 ASCI
ICODE

I
tisasev
enbi
tcodeusedext
ensi
vel
yforpr
int
ersandt
ermi
nal
sofsmal
lcomput
ersy
stem.Manyl
arge
comput
ersy
stemscanal
soaccommodat
ethi
scode.Thechar
act
ersar
eassi
gnedi
nascendi
ngbi
nar
y
number
s.Somet
imesanei
ghtbi
tisal
soaddedandbi
tisei
ther1or0usedaspar
it
ybi
t

Thet
abl
ebel
owshowst
heASCI
I(Amer
icanSt
andar
dCodef
orI
nfor
mat
ionI
nter
change)
.Asseeni
ts
f
ormati
s7bi
teachofwhi
chcanbe0or1e.
g.,
let
terBi
scodedas1000010.Thecodei
ncl
udedeci
mal
number0-
9,capi
tal
alphabet
s,l
owercaseal
phabet
sandsomeot
hersy
mbol
s

2.
4.2 EBCDI
CCODE

20|
Page
EBCDI
C(Ext
endedBi
nar
yCodedDeci
mal
Int
erchangeCode)i
susedi
nmostofl
argecomput
ersf
or
communi
cat
ion.I
tisei
ghtbi
tcodeandusesBCD(
Binar
yCodedDeci
mal
).
Thi
scodeal
soi
ncl
udescapi
tal
al
phabet
s,l
owercaseal
phabet
s,number
s0-
9andot
hersy
mbol
s.

2.
4.3 ERRORDETECTI
ONCODES

Ev
erydi
gitofadi
git
alsy
stem mustbecor
rect
.Aner
rori
nanydi
gitcancauseapr
obl
em becauset
he
comput
ermayr
ecogni
zei
tassomet
hingel
se.Fori
nst
ance,
thecor
rectASCI
Icodef
orAi
s1000001.An
er
rori
nonebi
t(l
et’
ssay1000011)woul
dmeanC.Manymet
hodshav
ebeendev
isedt
odet
ectsucher
ror
s.

2.
4.3.
1 Par
it
y

Par
it
yref
erst
othenumberof1si
nthebi
nar
ywor
d.Whent
henumberof1si
nthebi
nar
ywor
disoddi
s
sai
dtohav
eoddpar
it
y.Whent
henumberofwor
dsi
sev
en,
iti
ssai
dtohav
eev
enpar
it
y.E.
g.1100110i
s
ev
enpar
it
ywhi
l
e1000011i
soddpar
it
y.

Onemet
hodf
orer
rordet
ect
ioni
stouse7bi
tsf aand8th(
ordat mostsi
gni
fi
cant
)bi
tforpar
it
y.The
par
it
ybi
tcanbe1or0.Tomakeoddpar
it
y,t
hepar
it
ybi
tissett
o1or0.I
fthewor
dhasoddnumberof1s,
t
hepar
it
ybi
tissett
o0.I
fthewor
dhasev
ennumberof1s,
thepar
it
ybi
tissett
o1soast
omaket
het
otal
of1sodd.E.
g.,

Par
it
y Dat
a Tot
alnumberof1s

0 1100111 5

0 1101011 5

1 1000010 3

1 0000011 3

Att
her
ecei
vi
ngpoi
ntt
hepar
it
yischeckedsoseet
hati
tisodd.I
fiti
sev
en,
aner
rorhasbeen
commi
tt
edandt
hedat
aisr
equi
redt
obet
ransmi
tt
edagai
n.I
nsomecomput
ersy
stemsev
enpar
it
yisal
so
usedi
e.Par
it
ybi
tissetsoast
omaket
het
otal
numberof1sev
en

2.
4.3.
1 CheckSums

Theabov
edi
scussedpar
it
ycheckcannotdet
ectt
woer
ror
sint
hesamewor
d.I
f01000011or01010111
i
str
ansmi
tt
edi
nst
eadof01100111,
theer
rorwi
l
lnotbedet
ect
ed.
Onemet
hodt
odet
ectsuchcasesi
sthe
checksums.Aseachwor
dist
ransmi
tt
ed,
iti
saddedt
othepr
evi
ouswor
dandt
hesum i
sret
ainedatt
he
sendi
ngende.
g.,

Wor
dA 00010011

21|
Page
Wor
dB 10010100

SUM 101001111

Eachsuccessi
vewor
disaddedt
othesum oft
hepr
evi
ouswor
ds.Att
heendoft
ransmi
ssi
on,
thesum
(
knownaschecksum)i
sal
sosentandcheckedatt
her
ecei
vi
ngpoi
nt.Checksum met
hodi
scommonl
y
usedi
ntel
e-pr
ocessi
ng

CHAPTER3

DI
GITALARI
THEMETI
C
3.
1 Basi
cRul
esofBi
nar
yAddi
ti
onandSubt
ract
ion

Thebasi
cpr
inci
plesofbi
nar
yaddi
ti
onandsubt
ract
ionar
esi
mil
art
owhatweal
lknowsowel
li
nthecase
oft
hedeci
mal
numbersy
stem.I
nthecaseofaddi
ti
on,
addi
ng‘
0’t
oacer
tai
ndi
gitpr
oducest
hesamedi
git
ast
hesum,
and,
whenweadd‘
1’t
oacer
tai
ndi
gitornumberi
nthedeci
mal
numbersy
stem,
ther
esul
tis
t
henexthi
gherdi
gitornumber
,ast
hecasemaybe.Forexampl
e,6+1i
ndeci
mal
equal
s‘7’
because‘
7’
i
mmedi
atel
yfol
l
ows‘
6’i
nthedeci
mal
numbersy
stem.Al
so,
7+1i
noct
alequal
s‘10’
as,
int
heoct
al
numbersy
stem,
thenextadj
acenthi
ghernumberaf
ter‘
7’i
s‘10’
.Si
mil
arl
y,9+1i
nthehexadeci
mal
number
sy
stem i
s‘A’
.Wi
tht
hisbackgr
ound,
wecanwr
it
ethebasi
crul
esofbi
nar
yaddi
ti
onasf
oll
ows:

1. 0+0=0.

2. 0+1=1.

3. 1+0=1.

22|
Page
4. 1+1=0wi
thacar
ryof‘
1’t
othenextmor
esi
gni
fi
cantbi
t.

5. 1+1+1=1wi
thacar
ryof‘
1’t
othenextmor
esi
gni
fi
cantbi
t.

Tabl
e3.
1summar
izest
hesum andcar
ryout
put
sofal
lpossi
blet
hree-
bitcombi
nat
ions.Wehav
etaken
t
hree-
bitcombi
nat
ionsas,
inal
lpr
act
ical
sit
uat
ionsi
nvol
vi
ngt
headdi
ti
onoft
wol
argerbi
tnumber
s,we
needt
oaddt
hreebi
tsatat
ime.Twooft
het
hreebi
tsar
ethebi
tst
hatar
epar
toft
het
wobi
nar
ynumber
sto
beadded,
andt
het
hir
dbi
tist
hecar
ry-
inf
rom t
henextl
esssi
gni
fi
cantbi
tcol
umn.

Thebasi
cpr
inci
plesofbi
nar
ysubt
ract
ioni
ncl
udet
hef
oll
owi
ng:

1.0−0=0.

2.1−0=1.

3.1−1=0.

4.0−1=1wi
thabor
rowof1f
rom t
henextmor
esi
gni
fi
cantbi
t.

Theabov
e-ment
ionedr
ulescanal
sobeexpl
ainedbyr
ecal
l
ingr
ulesf
orsubt
ract
ingdeci
mal
number
s.
Subt
ract
ing‘
0’f
rom anydi
gitornumberl
eav
est
hedi
gitornumberunchanged.Thi
sexpl
ainst
hef
ir
stt
wo
r
ules.Subt
ract
ing‘
1’f
rom anydi
gitornumberi
ndeci
mal
producest
hei
mmedi
atel
ypr
ecedi
ngdi
gitor
numberast
heanswer
.Ingener
al,
thesubt
ract
ionoper
ati
onofl
arger
-bi
tbi
nar
ynumber
sal
soi
nvol
vest
hree
bi
ts,
incl
udi
ngt
het
wobi
tsi
nvol
vedi
nthesubt
ract
ion,
cal
l
edt
hemi
nuend(
theupperbi
t)andt
he
subt
rahend(
thel
owerbi
t)
,andt
hebor
row-
in.Thesubt
ract
ionoper
ati
onpr
oducest
hedi
ff
erenceout
put
andbor
row-
out
,ifany
.Tabl
e3.
2summar
izest
hebi
nar
ysubt
ract
ionoper
ati
on.Theent
ri
esi
nTabl
e3.
2can
beexpl
ainedbyr
ecal
l
ingt
hebasi
crul
esofbi
nar
ysubt
ract
ionment
ionedabov
e,andt
hatt
hesubt
ract
ion
oper
ati
oni
nvol
vi
ngt
hreebi
ts,
thati
s,t
hemi
nuend(
A),
thesubt
rahend(
B)andt
hebor
row-
in(
Bin)
,pr
oduces
adi
ff
erenceout
putequal
to(
A−B−Bin)
.Itmaybement
ionedher
ethat
,int
hecaseofsubt
ract
ionofl
arger
-
bitbi
nar
ynumber
s,t
hel
eastsi
gni
fi
cantbi
tcol
umnal
way
sinv
olv
est
wobi
tst
opr
oduceadi
ff
erenceout
put

23|
Page
bi
tandt
hebor
row-
outbi
t.Thebor
row-
outbi
tpr
oducedher
ebecomest
hebor
row-
inbi
tfort
henextmor
e
si
gni
fi
cantbi
tcol
umn,
andt
hepr
ocesscont
inuesunt
ilwer
eacht
hemostsi
gni
fi
cantbi
tcol
umn.

3.
2.1 Addi
ti
onUsi
ngt
he2’
sCompl
ementMet
hod

The2’
scompl
ementi
sthemostcommonl
yusedcodef
orpr
ocessi
ngposi
ti
veandnegat
ivebi
nar
y
number
s.I
tfor
mst
hebasi
sofar
it
hmet
icci
rcui
tsi
nmoder
ncomput
ers.Whent
hedeci
mal
number
stobe
addedar
eexpr
essedi
n2’
scompl
ementf
orm,
theaddi
ti
onoft
hesenumber
s,f
oll
owi
ngt
hebasi
clawsof
bi
nar
yaddi
ti
on,
giv
escor
rectr
esul
ts.Fi
nal
car
ryobt
ained,
ifany
,whi
l
eaddi
ngMSBsshoul
dbedi
sregar
ded.
Toi
l
lust
rat
ethi
s,wewi
l
lconsi
dert
hef
oll
owi
ngf
ourdi
ff
erentcases:

1.Bot
hthenumber
sar
eposi
ti
ve.

2.Lar
geroft
het
wonumber
sisposi
ti
ve.

3.Thel
argeroft
het
wonumber
sisnegat
ive.

4.Bot
hthenumber
sar
enegat
ive.

Case1

 Consi
dert
hedeci
mal
number
s+37and+18.

 The2’
scompl
ementof+37i
nei
ght
-bi
trepr
esent
ati
on=00100101.

24|
Page
 The2’
scompl
ementof+18i
nei
ght
-bi
trepr
esent
ati
on=00010010.

 Theaddi
ti
onoft
het
wonumber
s,t
hati
s,+37and+18,
isper
for
medasf
oll
ows

00100101

+00010010
00110111

Thedeci
mal
equi
val
entof(
00110111)
2is(
+55)
,whi
chi
sthecor
rectanswer
.

Case2

Consi
dert
het
wodeci
mal
number
s+37and-
18.

• The2’
scompl
ementr
epr
esent
ati
onof+37i
nei
ght
-bi
trepr
esent
ati
on=00100101.

• The2’
scompl
ementr
epr
esent
ati
onof−18i
nei
ght
-bi
trepr
esent
ati
on=11101110.

• Theaddi
ti
onoft
het
wonumber
s,t
hati
s,+37and−18,
isper
for
medasf
oll
ows:

00100101

+11101110
00010011

• Thef
inal
car
ryhasbeendi
sregar
ded.

• Thedeci
mal
equi
val
entof(
00010011)
2is+19,
whi
chi
sthecor
rectanswer
.

Case3

• Consi
dert
het
wodeci
mal
number
s+18and−37.

• −37i
n2’
scompl
ementf
ormi
nei
ght
−bi
trepr
esent
ati
on=11011011.

• +18i
n2’
scompl
ementf
ormi
nei
ght
−bi
trepr
esent
ati
on=00010010.

• Theaddi
ti
onoft
het
wonumber
s,t
hati
s,−37and+18,
isper
for
medasf
oll
ows:

11011011
+00010010
11101101

• Thedeci
mal
equi
val
entof(
11101101)
2,whi
chi
sin2’
scompl
ementf
orm,
is−19,
whi
chi
sthe
cor
rectanswer
.2’
scompl
ementr
epr
esent
ati
onwasdi
scussedi
ndet
ail
inChapt
er1onnumber
sy
stems.

Case4

• Consi
dert
het
wodeci
mal
number
s−18and−37.
25|
Page
• −18i
n2’
scompl
ementf
ormi
s11101110.

• −37i
n2’
scompl
ementf
ormi
s11011011.

• Theaddi
ti
onoft
het
wonumber
s,t
hati
s,−37and−18,
isper
for
medasf
oll
ows:

11011011
+11101110
11001001

• Thef
inal
car
ryi
ntheni
nthbi
tposi
ti
oni
sdi
sregar
ded.

• Thedeci
mal
equi
val
entof(
11001001)
2,whi
chi
sin2’
scompl
ementf
orm,
is−55,
whi
chi
sthe
cor
rectanswer
.

I
tmayal
sobement
ionedher
ethat
,ingener
al,
2’scompl
ementnot
ati
oncanbeusedt
oper
for
m addi
ti
on
whent
heexpect
edr
esul
tofaddi
ti
onl
i
esi
nther
angef
rom −2n−1t 2n−1−1)
o+( ,nbei
ngt
henumberofbi
ts
usedt
orepr
esentt
henumber
s.Asanexampl
e,ei
ght
-bi
t2’
scompl
ementar
it
hmet
iccannotbeusedt
o
per
for
m addi
ti
oni
fther
esul
tofaddi
ti
onl
i
esout
sidet
her
angef
rom −128t
o+127.

Di
ff
erentst
epst
obef
oll
owedt
odoaddi
ti
oni
n2’
scompl
ementar
it
hmet
icar
esummar
izedasf
oll
ows:

1.Repr
esentt
het
wonumber
stobeaddedi
n2’
scompl
ementf
orm.

2.Dot
headdi
ti
onusi
ngbasi
crul
esofbi
nar
yaddi
ti
on.

3.Di
sregar
dthef
inal
car
ry,
ifany
.

4.Ther
esul
tofaddi
ti
oni
sin2’
scompl
ementf
orm.

Exampl
e3.
1

Per
for
mthef
oll
owi
ngaddi
ti
onoper
ati
ons:

1.(
275.
75)
10+(
37.
875)
10

2.(
AF1.
B3)
16+(
FFF.
E)16

Sol
uti
on

1.Asaf
ir
stst
ep,
thet
wogi
vendeci
mal
number
swi
l
lbeconv
ert
edi
ntot
hei
requi
val
entbi
nar
ynumber
s
(
deci
mal
-t
o-bi
nar
yconv
ersi
onhasbeencov
eredatl
engt
hinChapt
er1,
andt
her
efor
ethedeci
mal
-t
o-bi
nar
y
conv
ersi
ondet
ail
swi
l
lnotbegi
venher
e):

(
275.
75)
10=(
100010011.
11)
2and(
37.
875)
10=(
100101.
111)
2

Thet
wobi
nar
ynumber
scanber
ewr
it
tenas(
100010011.
110)
2and(
000100101.
111)
2tohav
ethesame
numberofbi
tsi
nthei
rint
egerandf
ract
ional
par
ts.Theaddi
ti
onoft
wonumber
sisper
for
medasf
oll
ows:

26|
Page
100010011.
110
000100101.
111
100111001.
101
Thedeci
mal
equi
val
entof(
100111001.
101)
2is(
313.
625)
10.

2. (
AF1.
B3)
16

=(
101011110001.
10110011)
2and(
FFF.
E)16

=(
111111111111.
1110)
2.(
111111111111.
1110)
2canal
sobewr
it
tenas(
111111111111.
11100000)
2to
hav
ethesamenumberofbi
tsi
nthei
ntegerandf
ract
ional
par
ts.Thet
wonumber
scannowbeaddedas
f
oll
ows:

0101011110001.
10110011
0111111111111.
11100000
1101011110001.
10010011
Thehexadeci
mal
equi
val
entof(
1101011110001.
10010011)
2is(
1AF1.
93)
16,
whi
chi
sequal
tot
hehex
addi
ti
onof(
AF1.
B3)
16and(
FFF.
E)16.

27|
Page
CHAPTER4

LOGI
CGATES
Logi
cgat
esar
eel
ect
roni
cci
rcui
tst
hatcanbeusedt
oimpl
ementt
hemostel
ement
aryl
ogi
c
expr
essi
ons,
alsoknownasBool
eanexpr
essi
ons.Thel
ogi
cgat
eist
hemostbasi
cbui
l
dingbl
ockof
combi
nat
ional
logi
c.Ther
ear
ethr
eebasi
clogi
cgat
es,
namel
ytheORgat
e,t
heANDgat
eandt
heNOTgat
e.
Ot
herl
ogi
cgat
est
hatar
eder
ivedf
rom t
hesebasi
cgat
esar
etheNANDgat
e,t
heNORgat
e,t
he
EXCLUSI
VEORgat
eandt
heEXCLUSI
VE-
NORgat
e.

4.
1 Posi
ti
veandNegat
iveLogi
c

Thebi
nar
yvar
iabl
es,
asweknow,
canhav
eei
theroft
het
wost
ates,
i.
e.t
hel
ogi
c‘0’
stat
eort
hel
ogi
c‘1’
st
ate.Thesel
ogi
cst
atesi
ndi
git
alsy
stemssuchascomput
ers,
fori
nst
ance,
arer
epr
esent
edbyt
wo
di
ff
erentv
olt
agel
evel
sort
wodi
ff
erentcur
rentl
evel
s.I
fthemor
eposi
ti
veoft
het
wov
olt
ageorcur
rent
l
evel
srepr
esent
sal
ogi
c‘1’
andt
hel
essposi
ti
veoft
het
wol
evel
srepr
esent
sal
ogi
c‘0’
,t
hent
hel
ogi
c
sy
stem i
sref
err oasaposi
edt ti
vel
ogi
csy
stem.I
fthemor
eposi
ti
veoft
het
wov
olt
ageorcur
rentl
evel
s
r
epr
esent
sal
ogi
c‘0’
andt
hel
essposi
ti
veoft
het
wol
evel
srepr
esent
sal
ogi
c‘1’
,t
hent
hel
ogi
csy
stem i
s
r
efer
r oasanegat
edt ivel
ogi
csy
stem.Thef
oll
owi
ngexampl
esf
urt
heri
l
lust
rat
ethi
sconcept
.

I
fthet
wov
olt
agel
evel
sar
e0Vand+5V,
theni
ntheposi
ti
vel
ogi
csy
stem t
he0Vr
epr
esent
sal
ogi
c‘0’
andt
he+5Vr
epr
esent
sal
ogi
c‘1’
.I
nthenegat
ivel
ogi
csy
stem,
0Vr
epr
esent
sal
ogi
c‘1’
and+5V
r
epr
esent
sal
ogi
c‘0’
.I
fthet
wov
olt
agel
evel
sar
e0Vand−5V,
theni
ntheposi
ti
vel
ogi
csy
stem t
he0V
r
epr
esent
sal
ogi
c‘1’
andt
he−5Vr
epr
esent
sal
ogi
c‘0’
.I
nthenegat
ivel
ogi
csy
stem,
0Vr
epr
esent
sal
ogi
c

0’and−5Vr
epr
esent
sal
ogi
c‘1’
.I
tisi
nter
est
ingt
onot
e,aswewi
l
ldi
scov
eri
nthel
att
erpar
toft
he
chapt
er,
thataposi
ti
veORi
sanegat
iveAND.Thati
s,ORgat
ehar
dwar
eint
heposi
ti
vel
ogi
csy
stem
behav
esl
i
keanANDgat
eint
henegat
ivel
ogi
csy
stem.Ther
ever
sei
sal
sot
rue.Si
mil
arl
y,aposi
ti
veNORi
s
anegat
iveNAND,
andv
icev
ersa.

4.
2 Logi
cGat
es

Thel
ogi
cgat
eist
hemostbasi
cbui
l
dingbl
ockofanydi
git
alsy
stem,
incl
udi
ngcomput
ers.Eachoneof
t
hebasi
clogi
cgat
esi
sapi
eceofhar
dwar
eoranel
ect
roni
cci
rcui
tthatcanbeusedt
oimpl
ementsome
basi
clogi
cexpr
essi
on.Whi
l
elawsofBool
eanal
gebr
acoul
dbeusedt
odomani
pul
ati
onwi
thbi
nar
y
v
ari
abl
esandsi
mpl
i
fyl
ogi
cexpr
essi
ons,
thesear
eact
ual
l
yimpl
ement
edi
nadi
git
alsy
stem wi
tht
hehel
pof
el
ect
roni
cci
rcui
tscal
l
edl
ogi
cgat
es.Thet
hreebasi
clogi
cgat
esar
etheORgat
e,t
heANDgat
eandt
he
NOTgat
e.

28|
Page
4.
2.1 ORGat
e

AnORgat
eper
for
msanORi
ngoper
ati
onont
woormor
ethant
wol
ogi
cvar
iabl
es.TheORoper
ati
onon
t
woi
ndependentl
ogi
cvar
iabl
esAandBi
swr
it
tenasY=A+Bandr
eadsasYequal
sAORBandnotasA
pl
usB.AnORgat
eisal
ogi
cci
rcui
twi
tht
woormor
einput
sandoneout
put
.Theout
putofanORgat
eis
LOW onl
ywhenal
lofi
tsi
nput
sar
eLOW.Foral
lot
herpossi
blei
nputcombi
nat
ions,
theout
puti
sHI
GH.Thi
s
st
atementwheni
nter
pret
edf
oraposi
ti
vel
ogi
csy
stem meanst
hef
oll
owi
ng.

Theout
putofanORgat
eisal
ogi
c‘0’
onl
ywhenal
lofi
tsi
nput
sar
eatl
ogi
c‘0’
.Foral
lot
herpossi
ble
i
nputcombi
nat
ions,
theout
puti
sal
ogi
c‘1’
.Fi
gur
eshowst
heci
rcui
tsy
mbol
andt
het
rut
htabl
eofat
wo-
i
nputORgat
e.Theoper
ati
onofat
wo-
inputORgat
eisexpl
ainedbyt
hel
ogi
cexpr
essi
on

Y=A+B (
4.1)

Asani
l
lust
rat
ion,
ifwehav
efourl
ogi
cvar
iabl
esandwewantt
oknowt
hel
ogi
cal
out
putof(
A+B+C+D)
,
t
heni
twoul
dbet
heout
putofaf
our
-i
nputORgat
ewi
thA,
B,CandDasi
tsi
nput
s.

29|
Page
Fi
gur
es4.
4(a)and(
b)showt
heci
rcui
tsy
mbol
oft
hree-
inputandf
our
-i
nputORgat
es.Fi
gur
e4.
4(c)
showst
het
rut
htabl
eofat
hree-
inputORgat
e.Logi
cexpr
essi
onsexpl
aini
ngt
hef
unct
ioni
ngoft
hreei
nput
andf
our
-i
nputORgat
esar
eY=A+B+CandY=A+B+C+D.

Exampl
e4.
1

Howwoul
dyouhar
dwar
e-i
mpl
ementaf
our
-i
nputORgat
eusi
ngt
wo-
inputORgat
esonl
y?

Sol
uti
on

Fi
gur
e4.
5(a)showsonepossi
blear
rangementoft
wo-
inputORgat
est
hatsi
mul
atesaf
our
-i
nputORgat
e.
A,
B,CandDar
elogi
cinput
sandY3i
stheout
put
.Fi
gur
e4.
5(b)showsanot
herpossi
blear
rangement
.In
t
hecaseofFi
g.4.
5(a)
,theout
putofORgat
e1i
sY1=(
A+B)
.ThesecondORgat
epr
oducest
heout
putY2

30|
Page
=(
Y1+C)=(
A+B+C)
.Si
mil
arl
y,t
heout
putofORgat
e3i
sY3=(
Y2+D)=(
A+B+C+D)
.Int
hecaseofFi
g.
4.
5(b)
,theout
putofORgat
e1i
sY1=(
A+B)
.

ThesecondORgat
epr
oducest
heout
putY2=(
C+D)
.Out
putY3oft
het
hir
dORgat
eisgi
venby(
Y1+Y2)
=(
A+B+C+D)
.

4.
2.2 ANDGat
e

AnANDgat
eisal
ogi
cci
rcui
thav
ingt
woormor
einput
sandoneout
put
.Theout
putofanANDgat
eis
HI
GHonl
ywhenal
lofi
tsi
nput
sar
eint
heHI
GHst
ate.I
nal
lot
hercases,
theout
puti
sLOW.When
i
nter
pret
edf
oraposi
ti
vel
ogi
csy
stem,
thi
smeanst
hatt
heout
putoft
heANDgat
eisal
ogi
c‘1’
onl
ywhen
al
lofi
tsi
nput
sar
einl
ogi
c‘1’
stat
e.I
nal
lot
hercases,
theout
puti
slogi
c‘0’
.Thel
ogi
csy
mbol
andt
rut
h
t
abl
eofat
wo-
inputANDgat
ear
eshowni
nFi
gs4.
7(a)and(
b)r
espect
ivel
y.Fi
gur
es4.
8(a)and(
b)showt
he
l
ogi
csy
mbol
soft
hree-
inputandf
our
-i
nputANDgat
esr
espect
ivel
y.Fi
gur
e4.
8(c)gi
vest
het
rut
htabl
eofa
f
our
-i
nputANDgat
e.

TheANDoper
ati
onont
woi
ndependentl
ogi
cvar
iabl
esAandBi
swr
it
tenasY=A_
Bandr
eadsasY
equal
sAANDBandnotasAmul
ti
pli
edbyB.Her
e,AandBar
einputl
ogi
cvar
iabl
esandYi
stheout
put
.An
ANDgat
eper
for
msanANDi
ngoper
ati
on:

31|
Page
32|
Page
 f
orat
wo-
inputANDgat
e,Y=A.
B;

 f
orat
hree-
inputANDgat
e,Y=A.
B.C;

 f
oraf
our
-i
nputANDgat
e,Y=A.
B.C.
D.

I
fwei
nter
prett
hebasi
cdef
ini
ti
onofORandANDgat
esf
oranegat
ivel
ogi
csy
stem,
wehav
ean
i
nter
est
ingobser
vat
ion.Wef
indt
hatanORgat
einaposi
ti
vel
ogi
csy
stem i
sanANDgat
einanegat
ive
l
ogi
csy
stem.Al
so,
aposi
ti
veANDi
sanegat
iveOR.

Exampl
e4.
3

Showt
hel
ogi
car
rangementf
ori
mpl
ement
ingaf
our
-i
nputANDgat
eusi
ngt
wo-
inputANDgat
esonl
y.

Sol
uti
on

Fi
gur
e4.
9showst
hehar
dwar
eimpl
ement
ati
onofaf
our
-i
nputANDgat
eusi
ngt
wo-
inputANDgat
es.
Theout
putofANDgat
e1i
sY1=A.
B.ThesecondANDgat
epr
oducesanout
putY2gi
venbyY2=Y1.
C=
A.
B.C.Si
mil
arl
y,t
heout
putofANDgat
e3i
sY=Y2.
D=A.
B.C.
Dandhencet
her
esul
t.

4.
3.3 NOTGat
e

ANOTgat
eisaone-
input
,one-
out
putl
ogi
cci
rcui
twhoseout
puti
sal
way
sthecompl
ementoft
hei
nput
.
Thati
s,aLOW i
nputpr
oducesaHI
GHout
put
,andv
icev
ersa.Wheni
nter
pret
edf
oraposi
ti
vel
ogi
csy
stem,
al
ogi
c‘0’
att
hei
nputpr
oducesal
ogi
c‘1’
att
heout
put
,andv
icev
ersa.I
tisal
soknownasa

compl
ement
ingci
rcui
t’oran‘
i
nver
ti
ngci
rcui
t’
.Fi
gur
e4.
10showst
heci
rcui
tsy
mbol
andt
het
rut
htabl
e.
TheNOToper
ati
ononal
ogi
cvar
iabl
eXi
sdenot
edas XorX’
.Thati
s,i
fXi
sthei
nputt
oaNOTci
rcui
t,
t
heni
tsout
putYi
sgi
venbyY=XorX’
.andr
eadsasYequal
sNOTX.Thus,
ifX=0.
Y=1andi
fX=1.
Y=0.

Exampl
e4.
4

Fort
hel
ogi
cci
rcui
tar
rangement
sofFi
gs4.
11(
a)and(
b),
drawt
heout
putwav
efor
m.

Sol
uti
on

I
nthecaseoft
heORgat
ear
rangementofFi
g.4.
11(
a),
theout
putwi
l
lbeper
manent
lyi
nlogi
c‘1’
stat
e
ast
het
woi
nput
scannev
erbei
nlogi
c‘0’
stat
etoget
herowi
ngt
othepr
esenceoft
hei
nver
ter
.Int
hecase
oft
heANDgat
ear
rangementofFi
g.4.
11(
b),
theout
putwi
l
lbeper
manent
lyi
nlogi
c‘0’
stat
east
het
wo
i
nput
scannev
erbei
nlogi
c‘1’
stat
etoget
herowi
ngt
othepr
esenceoft
hei
nver
ter
.

33|
Page
34|
Page
4.
2.4 EXCLUSI
VE-
ORGat
e

TheEXCLUSI
VE-
ORgat
e,commonl
ywr
it
tenasEX-
ORgat
e,i
sat
wo-
input
,one-
out
putgat
e.Fi
gur
es
4.
12(
a)and(
b)r
espect
ivel
yshowt
hel
ogi
csy
mbol
andt
rut
htabl
eofat
wo-
inputEX-
ORgat
e.Ascanbe
seenf
rom t
het
rut
htabl
e,t
heout
putofanEX-
ORgat
eisal
ogi
c‘1’
whent
hei
nput
sar
eunl
i
keandal
ogi
c‘0’
whent
hei
nput
sar
eli
ke.Al
thoughEX-
ORgat
esar
eav
ail
abl
eini
ntegr
atedci
rcui
tfor
m onl
yast
wo-
input
gat
es,
unl
i
keot
hergat
eswhi
char
eav
ail
abl
einmul
ti
plei
nput
sal
so,
mul
ti
ple-
input

EX-
ORl
ogi
cfunct
ionscanbei
mpl
ement
edusi
ngmor
ethanonet
wo-
inputgat
es.Thet
rut
htabl
eofa
mul
ti
ple-
inputEX-
ORf
unct
ioncanbeexpr
essedasf
oll
ows.Theout
putofamul
ti
ple-
inputEX-
ORl
ogi
c
f
unct
ioni
sal
ogi
c‘1’
whent
henumberof1si
nthei
nputsequencei
soddandal
ogi
c‘0’
whent
henumber
of1si
nthei
nputsequencei
sev
en,
incl
udi
ngzer
o.Thati
s,anal
l0si
nputsequenceal
sopr
oducesal
ogi
c‘0’
att
heout
put
.Fi
gur
e4.
12(
c)showst
het
rut
htabl
eofaf
our
-i
nputEX-
ORf
unct
ion.Theout
putofat
wo-
input
EX-
ORgat
eisexpr
essedby

Y =(
A⊕B)=AB+AB (
4.2)

35|
Page
Exampl
e4.
5
Howdoyoui
mpl
ementt
hree-
inputandf
our
-i
nputEX-
ORl
ogi
cfunct
ionswi
tht
hehel
poft
wo-
inputEX-
OR
gat
es?
Sol
uti
on
Fi
gures4.
13(a)and(
b)showtheimpl
ement
ati
onofat
hree-
inputEX-
ORl
ogi
cfunct
ionandaf
our
-i
nputEX-
ORlogicf
uncti
onusi
ngtwo-
inputl
ogi
cgat
es:
• ForFi
g.4.
13(
a),
theout
putY1i
sgi
venbyA⊕B.Thef
inal
out
putYi
sgi
venbyY=(
Y1⊕C)=(
A⊕B
)⊕C)=A⊕B⊕C.
• •Fi
gur
e4.
13(
b)canbeexpl
ainedonsi
mil
arl
i
nes.

Exampl
e4.
6

Howcany
oui
mpl
ementaNOTci
rcui
tusi
ngat
wo-
inputEX-
ORgat
e?

Sol
uti
on

Refertothet
ruthtableofatwo-
inputEX-ORgatereproducedinFi
g.4.14(a).I
tiscl
earf
rom t
hetr
uthtabl
e
that
, i
foneoftheinputsoft
hegat ei
spermanentl
ytiedtologic‘
1’l
evel,
thent heot
heri
nputandout
put
perfor
mt hefunct
ionofaNOTci rcui
t.Fi
gur
e4.14(b)showst hei
mplement ati
on.

36|
Page
4.
2.5 NANDGat
e

NANDst
andsf
orNOTAND.AnANDgat
efol
l
owedbyaNOTci
rcui
tmakesi
taNANDgat
e[Fi
g.4.
15(
a)]
.
Fi
gur
e4.
15(
b)showst
heci
rcui
tsy
mbol
ofat
wo-
inputNANDgat
e.Thet
rut
htabl
eofaNANDgat
eis
obt
ainedf
rom t
het
rut
htabl
eofanANDgat
ebycompl
ement
ingt
heout
putent
ri
es[
Fig.4.
15(
c)]
.Theout
put
ofaNANDgat
eisal
ogi
c‘0’
whenal
li
tsi
nput
sar
eal
ogi
c‘1’
.Foral
lot
heri
nputcombi
nat
ions,
theout
puti
s
al
ogi
c‘1’
.NANDgat
eoper
ati
oni
slogi
cal
l
yexpr
essedas

Y=AB (
4.3)

I
ngener
al,
theBool
eanexpr
essi
onf
oraNANDgat
ewi
thmor
ethant
woi
nput
scanbewr
it
tenas

Y=ABCD (
4.4)

4.
2.6 NORGat
e

NORst
andsf
orNOTOR.AnORgat
efol
l
owedbyaNOTci
rcui
tmakesi
taNORgat
e[Fi
g.4.
16(
a)]
.The
t
rut
htabl
eofaNORgat
eisobt
ainedf
rom t
het
rut
htabl
eofanORgat
ebycompl
ement
ingt
heout
put
ent
ri
es.Theout
putofaNORgat
eisal
ogi
c‘1’
whenal
li
tsi
nput
sar
elogi
c‘0’
.Foral
lot
heri
nput
combi
nat
ions,
theout
puti
sal
ogi
c‘0’
.Theout
putofat
wo-
inputNORgat
eisl
ogi
cal
l
yexpr
essedas

Y=(
A+B) (
4.5)

37|
Page
38|
Page
I
ngener
al,
theBool
eanexpr
essi
onf
oraNORgat
ewi
thmor
ethant
woi
nput
scanbewr
it
tenas

Y=(
A+B+C+D+…) (
4.6)

4.
2.7EXCLUSI
VE-
NORGat
e

EXCLUSI
VE-
NOR(
commonl
ywr
it
tenasEX-
NOR)meansNOTofEX-
OR,
i.
e.t
hel
ogi
cgat
ethatwegetby
compl
ement
ingt
heout
putofanEX-
ORgat
e.Fi
gur
e4.
17showsi
tsci
rcui
tsy
mbol
alongwi
thi
tst
rut
htabl
e.

Thet
rut
htabl
eofanEX-
NORgat
eisobt
ainedf
rom t
het
rut
htabl
eofanEX-
ORgat
ebycompl
ement
ing
t
heout
putent
ri
es.Logi
cal
l
y,

Y=(
A⊕B)= (
AB+A B) (
4.7)

Theout
putofat
wo-
inputEX-
NORgat
eisal
ogi
c‘1’
whent
hei
nput
sar
eli
keandal
ogi
c‘0’
whent
hey
ar
eunl
i
ke.I
ngener
al,
theout
putofamul
ti
ple-
inputEX-
NORl
ogi
cfunct
ioni
sal
ogi
c‘0’
whent
henumberof
1si
nthei
nputsequencei
soddandal
ogi
c‘1’
whent
henumberof1si
nthei
nputsequencei
sev
en
i
ncl
udi
ngzer
o.Thati
s,anal
l0si
nputsequenceal
sopr
oducesal
ogi
c‘1’
att
heout
put
.

4.
3 Uni
ver
salGat
es

OR,
ANDandNOTgat
esar
ethet
hreebasi
clogi
cgat
esast
heyt
oget
hercanbeusedt
oconst
ructt
he
l
ogi
cci
rcui
tforanygi
venBool
eanexpr
essi
on.NORandNANDgat
eshav
ethepr
oper
tyt
hatt
heyi
ndi
vi
dual
l
y
canbeusedt
ohar
dwar
e-i
mpl
emental
ogi
cci
rcui
tcor
respondi
ngt
oanygi
venBool
eanexpr
essi
on.Thati
s,
i
tispossi
blet
ouseei
theronl
yNANDgat
esoronl
yNORgat
est
oimpl
ementanyBool
eanexpr
essi
on.Thi
s

39|
Page
i
ssobecauseacombi
nat
ionofNANDgat
esoracombi
nat
ionofNORgat
escanbeusedt
oper
for
m
f
unct
ionsofanyoft
hebasi
clogi
cgat
es.I
tisf
ort
hisr
easont
hatNANDandNORgat
esar
euni
ver
sal
gat
es.

Asani
l
lust
rat
ion,
Fig.4.
24showshowt
wo-
inputNANDgat
escanbeusedt
oconst
ructaNOTci
rcui
t
[
Fig.4.
24(
a)]
,at
wo-
inputANDgat
e[Fi
g.4.
24(
b)]andat
wo-
inputORgat
e[Fi
g.4.
24(
c)]
.Fi
gur
e4.
25shows
t
hesameusi
ngNORgat
es.Under
standi
ngt
heconv
ersi
onofNANDt
oORandNORt
oANDr
equi
rest
heuse
ofDeMor
gan’
stheor
em,
whi
chi
sdi
scussedl
ateronBool
eanal
gebr
a.

40|
Page
41|
Page
CHAPTER5

BOOLEANALGEBRAANDSI
MPLI
FICATI
ONTECHNI
QUES
Bool
eanal
gebr
aismat
hemat
icsofl
ogi
c.I
tisoneoft
hemostbasi
ctool
sav
ail
abl
etot
hel
ogi
cdesi
gner
andt
huscanbeef
fect
ivel
yusedf
orsi
mpl
i
ficat
ionofcompl
exl
ogi
cexpr
essi
ons.Ot
herusef
ulandwi
del
y
usedt
echni
quesbasedonBool
eant
heor
emsi
ncl
udet
heuseofKar
naughmapsi
nwhati
sknownast
he
mappi
ngmet
hodofl
ogi
csi
mpl
i
ficat
ionandt
het
abul
armet
hodgi
venbyQui
ne–McCl
uskey
.

5.
1 I
ntr
oduct
iont
oBool
eanAl
gebr
a

Bool
eanal
gebr
a,qui
tei
nter
est
ingl
y,i
ssi
mpl
ert
hanor
dinar
yal
gebr
a.I
tisal
socomposedofasetof
sy
mbol
sandasetofr
ulest
omani
pul
atet
hesesy
mbol
s.Howev
er,
thi
sist
heonl
ysi
mil
ari
tybet
weent
he
t
wo.Thedi
ff
erencesar
emany
.Thesei
ncl
udet
hef
oll
owi
ng:

1.I
nor
dinar
yal
gebr
a,t
hel
ett
ersy
mbol
scant
akeonanynumberofv
aluesi
ncl
udi
ngi
nfi
nit
y.I
n
Bool
eanal
gebr
a,t
heycant
akeonei
theroft
wov
alues,
thati
s,0and1.

2.Thev
aluesassi
gnedt
oav
ari
abl
ehav
eanumer
ical
signi
fi
cancei
nor
dinar
yal
gebr
a,wher
easi
nit
s
Bool
eancount
erpar
ttheyhav
eal
ogi
cal
signi
fi
cance.

3.Whi
l
e‘.
’and‘
+’ar
erespect
ivel
ythesi
gnsofmul
ti
pli
cat
ionandaddi
ti
oni
nor
dinar
yal
gebr
a,i
n
Bool
eanal
gebr
a‘.
’meansanANDoper
ati
onand‘
+’meansanORoper
ati
on.Fori
nst
ance,
A+Bi
n
or
dinar
yal
gebr
aisr
eadasApl
usB,
whi
l
ethesamei
nBool
eanal
gebr
aisr
eadasAORB.Basi
c
l
ogi
coper
ati
onssuchasAND,
ORandNOThav
eal
readybeendi
scussedatl
engt
hinChapt
er4.

4.Mor
especi
fi
cal
l
y,Bool
eanal
gebr
acapt
urest
heessent
ial
proper
ti
esofbot
hlogi
coper
ati
onssuch
asAND,
ORandNOTandsetoper
ati
onssuchasi
nter
sect
ion,
uni
onandcompl
ement
.Asan
i
l
lust
rat
ion,
thel
ogi
cal
asser
ti
ont
hatbot
hast
atementandi
tsnegat
ioncannotbet
ruehasa
count
erpar
tinsett
heor
y,whi
chsay
sthatt
hei
nter
sect
ionofasubsetandi
tscompl
ementi
sanul
l
(
orempt
y)set
.

5.Bool
eanal
gebr
amayal
sobedef
inedt
obeasetAsuppl
i
edwi
tht
wobi
nar
yoper
ati
onsofl
ogi
cal

42|
Page
AND,
logi
cal
OR,
aunar
yoper
ati
onofl
ogi
cal
NOTandt
woel
ement
s,namel
ylogi
cal
FALSE(
0)and
l
ogi
cal
TRUE(
1).Thi
sseti
ssucht
hat
,foral
lel
ement
soft
hisset
,thepost
ulat
esoraxi
omsr
elat
ing
t
otheassoci
ati
ve,
commut
ati
ve,
dist
ri
but
ive,
absor
pti
onandcompl
ement
ati
onpr
oper
ti
esoft
hese
el
ement
shol
dgood.Thesepost
ulat
esar
edescr
ibedi
nthef
oll
owi
ngpages.

5.
1.1Commut
ati
veLaw

I
timpl
i
est
hatt
heor
deri
nwhi
chv
ari
abl
esar
eaddedorORedi
simmat
eri
al.Thati
s,t
her
esul
tofAORB
i
sthesameast
hatofBORA.Theor
em (
b)i
mpl
i
est
hatt
heor
deri
nwhi
chv
ari
abl
esar
eANDedi
sal
so
i
mmat
eri
al.Ther
esul
tofAANDBi
ssameast
hatofBANDA.

a.A+B=B+A b. A.
B=B.A

5.
1.2 Associ
ati
veLaw

Thet
heor
em (
a)say
sthat
,whent
hreev
ari
abl
esar
ebei
ngORed,
iti
simmat
eri
alwhet
herwedot
hisby
ORi
ngt
her
esul
toft
hef
ir
standsecondv
ari
abl
eswi
tht
het
hir
dvar
iabl
eorbyORi
ngt
hef
ir
stv
ari
abl
ewi
th
t
her
esul
tofORi
ngoft
hesecondandt
hir
dvar
iabl
esorev
enbyORi
ngt
hesecondv
ari
abl
ewi
tht
her
esul
tof
ORi
ngoft
hef
ir
standt
hir
dvar
iabl
es.Accor
dingt
otheor
em 6(
b),
whent
hreev
ari
abl
esar
ebei
ngANDed,
it
i
simmat
eri
alwhet
hery
oudot
hisbyANDi
ngt
her
esul
tofANDi
ngoft
hef
ir
standsecondv
ari
abl
eswi
tht
he
t
hir
dvar
iabl
eorbyANDi
ngt
her
esul
tofANDi
ngoft
hesecondandt
hir
dvar
iabl
eswi
tht
hef
ir
stv
ari
abl
eor
ev
enbyANDi
ngt
her
esul
tofANDi
ngoft
het
hir
dandf
ir
stv
ari
abl
eswi
tht
hesecondv
ari
abl
e.

a.A+(
B+C)=(
A+B)+C b. (
A.B).C=A.(
B.C)

43|
Page
5.
1.3 Di
str
ibut
iveLaw

Thedi
str
ibut
ionl
awi
mpl
i
est
hataBool
eanexpr
essi
oncanal
way
sbeexpandedt
erm byt
erm.Al
so,
in
t
hecaseoft
heex
pressi
onbei
ngt
hesum oft
woormor
ethant
wot
ermshav
ingacommonv
ari
abl
e,t
he
commonv
ari
abl
ecanbet
akenascommonasi
nthecaseofor
dinar
yal
gebr
a.

a.A +(
B .C)=(
A+B).(
A+C) b. A.(
B+C)=(A.B)+(
A.C)

Thef
igur
ebel
owshowst
het
rut
htabl
eforDi
str
ibut
ivel
aw

44|
Page
TheTabl
ebel
owshowsot
herbool
an’
slaws

45|
Page
5.
1.4 Demor
ganTheor
ems:

I
npr
oposi
ti
onal
logi
candBool
eanal
gebr
a,DeMor
gan’
slawsar
epai
roft
ransf
ormat
ionr
ulest
hatar
ebot
h
v
ali
drul
esofi
nfer
ence.Theyar
enamedaf
terAugust
usDeMor a19thcent
gan, uryBr
it
ishmat
hemat
ici
an.
Ther
ulesal
l
owt
heexpr
essi
onofconj
unct
ionsanddi
sjunct
ionspur
elyi
nter
msofeachot
herv
ianegat
ion.
Ther
ulesar
eshownbel
ow.

46|
Page
5.
2 Si
mpl
if
icat
ionTechni
ques

Bef
orewemov
eont
odi
scusst
heset
echni
quesi
ndet
ail
,i
twoul
dber
elev
antbr
ief
lyt
odescr
ibesum-
of
-
product
sandpr
oduct
-of
-sumsBool
eanexpr
essi
ons.Thegi
venBool
eanexpr
essi
onwi
l
lbei
nei
theroft
he
t
wof
orms,
andt
heobj
ect
ivewi
l
lbet
ofi
ndami
nimi
zedexpr
essi
oni
nthesameort
heot
herf
orm.

5.
2.1 Sum-
of-
Product
sBool
eanExpr
essi
ons

Asum-
of-
product
sexpr
essi
oncont
ainst
hesum ofdi
ff
erentt
erms,
wit
heacht
erm bei
ngei
therasi
ngl
e
l
i
ter
alorapr
oductofmor
ethanonel
i
ter
al.I
tcanbeobt
ainedf
rom t
het
rut
htabl
edi
rect
lybyconsi
der
ing
t
hosei
nputcombi
nat
ionst
hatpr
oduceal
ogi
c‘1’
att
heout
put
.Eachsuchi
nputcombi
nat
ionpr
oducesa
t
erm.Di
ff
erentt
ermsar
egi
venbyt
hepr
oductoft
hecor
respondi
ngl
i
ter
als.

Thesum ofal
lter
msgi
vest
heexpr
essi
on.Forexampl
e,t
het
rut
htabl
einTabl
e6.
5canber
epr
esent
ed
byt
heBool
eanex
pressi
on

(
6.33)

Consi
der
ingt
hef
ir
stt
erm,
theout
puti
s‘1’
whenA=0,
B=0andC=0.Thi
sispossi
bleonl
ywhenA,
B
andCar
eANDed.Al
so,
fort
hesecondt
erm,
theout
puti
s‘1’
onl
ywhenB,
CandAar
eANDed.Ot
hert
erms
canbeexpl
ainedsi
mil
arl
y.Asum-
of-
product
sexpr
essi
oni soknownasami
sal nter
m expr
essi
on.

5.
2.2 Pr
oduct
-of
-SumsExpr
essi
ons

47|
Page
Apr
oduct
-of
-sumsexpr
essi
oncont
ainst
hepr
oductofdi
ff
erentt
erms,
wit
heacht
erm bei
ngei
thera
si
ngl
eli
ter
alorasum ofmor
ethanonel
i
ter
al.I
tcanbeobt
ainedf
rom t
het
rut
htabl
ebyconsi
der
ingt
hose
i
nputcombi
nat
ionst
hatpr
oduceal
ogi
c‘0’
att
heout
put
.Eachsuchi
nputcombi
nat
iongi
vesat
erm,
and
t
hepr
oductofal
lsucht
ermsgi
vest
heexpr
essi
on.Di
ff
erentt
ermsar
eobt
ainedbyt
aki
ngt
hesum oft
he
cor
respondi
ngl
i
ter
als.Her
e,‘
0’and‘
1’r
espect
ivel
ymeant
heuncompl
ement
edandcompl
ement
ed
v
ari
abl
es,
unl
i
kesum-
of-
product
sexpr
essi
onswher
e‘0’
and‘
1’r
espect
ivel
ymeancompl
ement
edand
uncompl
ement
edv
ari
abl
es.

Toi
l
lust
rat
ethi
sfur
ther
,consi
deronceagai
nthet
rut
htabl
einTabl
e6.
5.Si
nceeacht
ermi
nthecaseof
t
hepr
oduct
-of
-sumsexpr
essi
oni
sgoi
ngt
obet
hesum ofl
i
ter
als,
thi
simpl
i
est
hati
tisgoi
ngt
obe
i
mpl
ement
edusi
nganORoper
ati
on.Now,
anORgat
epr
oducesal
ogi
c‘0’
onl
ywhenal
li
tsi
nput
sar
eint
he
l
ogi
c‘0’
stat
e,whi
chmeanst
hatt
hef
ir
stt
erm cor
respondi
ngt
othesecondr
owoft
het
rut
htabl
ewi
l
lbe
A+B+C.Thepr
oduct
-of
-sumsBool
eanexpr
essi
onf
ort
hist
rut
htabl
eisgi
venby(
A+B+C)
.(A+B+C)
.
(
A+B+C)
.

Tr
ansf
ormi
ngt
hegi
venpr
oduct
-of
-sumsexpr
essi
oni
ntoanequi
val
entsum-
of-
product
sexpr
essi
oni
sa
st
rai
ght
for
war
dpr
ocess.Mul
ti
ply
ingoutt
hegi
venexpr
essi
onandcar
ryi
ngoutt
heobv
ioussi
mpl
i
ficat
ion
pr
ovi
dest
heequi
val
entsum-
of-
product
sex
pressi
on:

Agi
vensum-
of-
product
sexpr
essi
oncanbet
ransf
ormedi
ntoanequi
val
entpr
oduct
-of
-sumsexpr
essi
on
by(
a)t
aki
ngt
hedual
oft
hegi
venexpr
essi
on,
(b)mul
ti
ply
ingoutdi
ff
erentt
ermst
ogett
hesum-
of-
product
s
f
orm,
(c)r
emov
ingr
edundancyand(
d)t
aki
ngadual
togett
heequi
val
entpr
oduct
-of
-sumsexpr
essi
on.As
ani
l
lust
rat
ion,
letusf
indt
heequi
val
entpr
oduct
-of
-sumsexpr
essi
onoft
hesum-
of-
product
sexpr
essi
on

48|
Page
5.
2.3 ExpandedFor
msofBool
eanExpr
essi
ons

Expandedsum-
of-
product
sandpr
oduct
-of
-sumsf
ormsofBool
eanexpr
essi
onsar
eusef
ulnotonl
yin
anal
ysi
ngt
heseexpr
essi
onsbutal
soi
ntheappl
i
cat
ionofmi
nimi
zat
iont
echni
quessuchast
he
Qui
ne–McCl
uskeyt
abul
armet
hodandt
heKar
naughmappi
ngmet
hodf
orsi
mpl
i
fyi
nggi
venBool
ean
expr
essi
ons.Theexpandedf
orm,
sum-
of-
product
sorpr
oduct
-of
-sums,
isobt
ainedbyi
ncl
udi
ngal
lpossi
ble
combi
nat
ionsofmi
ssi
ngv
ari
abl
es.

Asani
l
lust
rat
ion,
consi
dert
hef
oll
owi
ngsum-
of-
product
sexpr
essi
on:

A.
B+B.
C+A.
B.C+A.
C

I
tisat
hreev
ari
abl
eexpr
essi
on.Expandedv
ersi
onsofdi
ff
erentmi
nter
mscanbewr
it
tenasf
oll
ows:

49|
Page
5.
2.4 Canoni
calFor
m ofBool
eanExpr
essi
ons

Anexpandedf
orm ofBool
eanexpr
essi
on,
wher
eeacht
erm cont
ainsal
lBool
eanv
ari
abl
esi
nthei
rtr
ueor
compl
ement
edf
orm,
isal hecanoni
soknownast calf
orm oft
heexpr
essi
on.Asani
l
lust
rat
ion,
f(A,
B,C)=A
BC+A.
. B.C+A.
B.C.i
saBool
eanf
unct
ionoft
hreev
ari
abl
esexpr
essedi
ncanoni
cal
for
m.Thi
sfunct
ion
af
tersi
mpl
i
ficat
ionr
educest
oA.
B+A.
B.Candl
osesi
tscanoni
cal
for
m.

5.
2.5 ∑andπNomencl
atur
e

∑andπ not
ati
onsar
erespect
ivel
yusedt
orepr
esentsum-
of-
product
s(SOP)andpr
oduct
-of
-sums(
POS)
Bool
eanexpr
essi
ons.Wewi
l
lil
l
ust
rat
ethesenot
ati
onswi
tht
hehel
pofexampl
es.Letusconsi
dert
he
f
oll
owi
ng

Bool
eanf
unct
ion:

Wewi
l
lrepr
esentt
hisf
unct
i ng∑not
onusi ati
on.Thef
ir
stst
epi
stowr
it
etheexpandedsum-
of-
product
s
gi
venby

Di
ff
erentt
ermsar
ethenar
rangedi
nascendi
ngor
deroft
hebi
nar
ynumber
srepr
esent
edbyv
ari
ous
t
erms,
wit
htr
uev
ari
abl
esr
epr
esent
inga‘
1’andacompl
ement
edv
ari
abl
erepr
esent
inga‘
0’
.Theexpr
essi
on
becomes

Thedi
ff
erentt
ermsr
epr
esent0001,
0101,
1000,
1001and1111.Thedeci
mal
equi
val
entoft
heset
erms
encl
osedi
nthe∑t
hengi
v he∑not
est ati
onf
ort
hegi
venBool
eanf
unct
ion.Thati
s,f
(A, D)=∑1,
B,C, 5,8,9,
15.

ementoff
Thecompl (A,
B,C,
D),
thati
s,f
’(
A,B,
C,D)
,canbedi
rect
lydet
ermi
nedf
rom ∑not
ati
onby
i
ncl
udi
ngt
hel
eft
-outent
ri
esf
rom t
hel
i
stofal
lpossi
blenumber
sforaf
our
-var
iabl
efunct
ion.Thati
s,

f
’(
A,B,
C,D)=∑0,
2,3,
4,6,
7,10,
11,
12,
13,
14

50|
Page
Letusnowt
aket
hecaseofapr
oduct
-of
-sumsBool
eanf
unct
ionandi
tsr
epr
esent
ati
oni

nomencl
atur
e.Letusconsi
dert
heBool
eanf
unct
ion

Theexpandedpr
oduct
-of–sumsi
sgi
venby

Thebi
nar
ynumber
srepr
esent
edbyt
hedi
ff
erentsum t
ermsar
e0011,
1011,
1100and0111(
trueand
compl
ement
edv
ari
abl
esher
erepr
esent0and1r
espect
ivel
y).Whenar
rangedi
nascendi
ngor
der
,these
number
sar
e0011,
0111,
1011and1100.Ther
efor
e,

Ani
nter
est
ingcor
oll
aryofwhatwehav
edi
scussedabov
eist
hat
,ifagi
venBool
eanf
unct
ionf
(A,
B,C)i
s
gi
venbyf
(A,
B,C)=∑0,
1,4,
7,t
hen

Opt
ional
combi
nat
ionscanal
sobei
ncor
por
atedi
nto∑andπnomencl
atur
eusi
ngsui
tabl
eident
if
ier
s;Ø
ordar
eusedasi
dent
if
ier
s.Forexampl
e,i
f ar
eopt
ional
combi
nat
ions,
then

Exampl
e5.
1

51|
Page
5.
3 Kar
naughMapMet
hod

AKar
naughmapi
sagr
aphi
cal
repr
esent
ati
onoft
hel
ogi
csy
stem.I
tcanbedr
awndi
rect
lyf
rom ei
ther
mi
nter
m(sum-
of-
product
s)ormaxt
erm(
product
-of
-sums)Bool
eanexpr
essi
ons.Dr
awi
ngaKar
naughmap
f
rom t
het
rut
htabl
einv
olv
esanaddi
ti
onal
stepofwr
it
ingt
hemi
nter
m ormaxt
erm expr
essi
ondependi
ng
uponwhet
heri
tisdesi
redt
ohav
eami
nimi
zedsum-
of-
product
sorami
nimi
zedpr
oduct
-of
-sums
expr
essi
on.

5.
3.1 Const
ruct
ionofaKar
naughMap

Ann-
var
iabl naughmaphas2nsquar
eKar es,
andeachpossi
blei
nputi
sal
l
ott
edasquar
e.I
nthecaseof
ami
nter
m Kar
naughmap,
‘1’
ispl
acedi
nal
lthosesquar
esf
orwhi
cht
heout
puti
s‘1’
,and‘
0’i
spl
acedi
nal
l
t
hosesquar
esf
orwhi
cht
heout
puti
s‘0’
.0sar
eomi
tt
edf
orsi
mpl
i
cit
y.An‘
X’i
spl
acedi
nsquar
es
cor
respondi
ngt
o‘don’
tcar
e’condi
ti
ons.I
nthecaseofamaxt
erm Kar
naughmap,
a‘1’
ispl
acedi
nal
lthose
squar
esf
orwhi
cht
heout
puti
s‘0’
,anda‘
0’i
spl
acedf
ori
nputent
ri
escor
respondi
ngt
oa‘
1’out
put
.Agai
n,
0sar
eomi
tt
edf
orsi
mpl
i
cit
y,andan‘
X’i
spl
acedi
nsquar
escor
respondi
ngt
o‘don’
tcar
e’condi
ti
ons.

Thechoi
ceoft
ermsi
dent
if
yingdi
ff
erentr
owsandcol
umnsofaKar
naughmapi
snotuni
quef
oragi
ven
numberofv
ari
abl
es.Theonl
ycondi
ti
ont
obesat
isf
iedi
sthatt
hedesi
gnat
ionofadj
acentr
owsand
adj
acentcol
umnsshoul
dbet
hesameexceptf
oroneoft
hel
i
ter
alsbei
ngcompl
ement
ed.Al
so,
theext
reme
r
owsandext
remecol
umnsar
econsi
der
edadj
acent
.Someoft
hepossi
bledesi
gnat
ionst
ylesf
ort
wo-
,
t
hree-andf
our
-var
iabl
emi
nter
m Kar
naughmapsar
egi
veni
nFi
gs5.
6,5.
7and5.
8respect
ivel
y.

Thest
yleofr
owi
dent
if
icat
ionneednotbet
hesameast
hatofcol
umni
dent
if
icat
ionasl
ongasi
tmeet
s
t
hebasi
crequi
rementwi
thr
espectt
oadj
acentt
erms.I
tis,
howev
er,
accept
edpr
act
icet
oadoptauni
for
m
st
yleofr
owandcol
umni
dent
if
icat
ion.Al
so,
thest
yleshowni
nFi
gs5.
6(a)
,5.
7(a)and5.
8(a)i
smor
e

52|
Page
commonl
yused.Somemor
est
ylesar
eshowni
nFi
g.5.
9.Asi
mil
ardi
scussi
onappl
i
esf
ormaxt
erm
Kar
naughmaps.

Hav
ingdr
awnt
heKar
naughmap,
thenex
tst
epi
stof
orm gr
oupsof1saspert
hef
oll
owi
nggui
del
i
nes:

1. Eachsquar
econt
aini
nga‘
1’mustbeconsi
der
edatl
eastonce,
alt
houghi
tcanbeconsi
der
ed
asof
tenasdesi
red.

2. Theobj
ect
iveshoul
dbet
oaccountf
oral
lthemar
kedsquar
esi
nthemi
nimum numberof
gr
oups.

3. Thenumberofsquar
esi
nagr
oupmustal
way
sbeapowerof2,
i.
e.gr
oupscanhav
e1,
2,4,
8,
16,
squar
es.

4. Eachgr
oupshoul
dbeasl
argeaspossi
ble,
whi
chmeanst
hatasquar
eshoul
dnotbe
account
edf
orbyi
tsel
fifi
tcanbeaccount
edf
orbyagr
oupoft
wosquar
es;
agr
oupoft
wo
squar
esshoul
dnotbemadei
fthei
nvol
vedsquar
escanbei
ncl
udedi
nagr
oupoff
our
squar
esandsoon.

5. ‘
Don’
tcar
e’ent
ri
escanbeusedi
naccount
ingf
oral
lof1-
squar
est
omakeopt
imum gr
oups.
Theyar
emar
ked‘
X’i
nthecor
respondi
ngsquar
es.I
tis,
howev
er,
notnecessar
ytoaccountf
or
al
l‘
don’
tcar
e’ent
ri
es.Onl
ysuchent
ri
est
hatcanbeusedt
oadv
ant
ageshoul
dbeused.

Fi
gur
e5.
6:Twov
ari
abl
eKmap

53|
Page
54|
Page
Hav
ingaccount
edf
orgr
oupswi
thal
l1s,
themi
nimum ‘
sum-
of-
product
s’or‘
product
-of
-sums’
expr
essi
ons
canbewr
it
tendi
rect
lyf
rom t
heKar
naughmap.Fi
gur
e5.
10showst
het
rut
htabl
e,mi
nter
m Kar
naughmap
andmaxt
erm Kar
naughmapoft
heBool
eanf
unct
ionofat
wo-
inputORgat
e.Themi
nter
m andmaxt
erm
Bool
eanexpr
essi
onsf
ort
het
wo-
inputORgat
ear
easf
oll
ows:

55|
Page
Fi
gur
e5.
11showst
het
rut
htabl
e,mi
nter
m Kar
naughmapandmaxt
erm Kar
naughmapoft
het
hree-
v
ari
abl
eBool
eanf
unct
ion

Fi
gur
e5.
12showst
het
rut
htabl
e,mi
nter
m Kar
naughmapandmaxt
erm Kar
naughmapoft
hef
our
-var
iabl
e
Bool
eanf
unct
ion

56|
Page
Toi
l
lust
rat
ethepr
ocessoff
ormi
nggr
oupsandt
henwr
it
ingt
hecor
respondi
ngmi
nimi
zedBool
ean
expr
essi
on,
Figs5.
13(
a)and(
b)r
espect
ivel
yshowmi
nter
m andmaxt
erm Kar
naughmapsf
ort
heBool
ean
f
unct
ionsexpr
essedbyequat
ions(
5.50)and(
5.51)
.Themi
nimi
zedexpr
essi
onsasdeducedf
rom
Kar
naughmapsi
nthet
wocasesar
egi
venbyEquat
ion(
5.52)i
nthecaseoft
hemi
nter
m Kar
naughmap
andEquat
ion(
5.53)i
nthecaseoft
hemaxt
erm Kar
naughmap:

57|
Page
CHAPTER6

ARI
THEMETI
CCI
RCUI
T
Begi
nni
ngwi
tht
hischapt
er,
andi
nthet
wochapt
ersf
oll
owi
ng,
wewi
l
ltakeacompr
ehensi
vel
ookat
v
ari
ousbui
l
dingbl
ocksusedt
odesi
gnmor
ecompl
excombi
nat
ional
cir
cui
ts.Acombi
nat
ional
logi
cci
rcui
t
i
sonewher
etheout
putorout
put
sdependupont
hepr
esentst
ateofcombi
nat
ionoft
hel
ogi
cinput
s.The
l
ogi
cgat
esdi
scussedi
nChapt
er4const
it
utet
hemostf
undament
albui
l
dingbl
ockofacombi
nat
ional
ci
rcui
t.Mor
ecompl
excombi
nat
ional
cir
cui
tssuchasadder
sandsubt
ract
ors,
mul
ti
plexer
sand
demul
ti
plexer
s,magni
tudecompar
ator
s,et
c.,
canbei
mpl
ement
edusi
ngacombi
nat
ionofl
ogi
cgat
es.
Howev
er,
theaf
oresai
dcombi
nat
ional
logi
cfunct
ionsandmanymor
e,i
ncl
udi
ngmor
ecompl
exones,
are
58|
Page
av
ail
abl
einmonol
i
thi
cICf
orm.Ast
il
lmor
ecompl
excombi
nat
ional
cir
cui
tmaybei
mpl
ement
edusi
nga
combi
nat
ionoft
hesef
unct
ionsav
ail
abl
einI
Cfor
m.I
nthi
schapt
er,
wewi
l
lcov
erdev
icesusedt
oper
for
m
ar
it
hmet
icandot
herr
elat
edoper
ati
ons.Thesei
ncl
udeadder
s,subt
ract
ors,
magni
tudecompar
ator
sand
l
ook-
aheadcar
rygener
ator
s.Par
ti
cul
aremphasi
sispl
acedupont
hef
unct
ioni
nganddesi
gnoft
hese
combi
nat
ional
cir
cui
ts.Thet
exthasbeenadequat
elyi
l
lust
rat
edwi
tht
hehel
pofal
argenumberofsol
ved
pr
obl
ems,
themaj
ori
tyofwhi
char
edesi
gnor
ient
ed.

6.
1 Combi
nat
ionalCi
rcui
ts

Acombi
nat
ionalci
rcui
tisonewher
etheout
putatanyt
imedependsonl
yont
hepr
esentcombi
nat
ion
ofi
nput
satt
hatpoi
ntoft
imewi
tht
otal
disr
egar
dtot
hepastst
ateoft
hei
nput
s.Thel
ogi
cgat
eist
he
mostbasi
cbui
l
dingbl
ockofcombi
nat
ional
logi
c.Thel
ogi
cal
funct
ionper
for
medbyacombi
nat
ional
ci
rcui
tisf
ull
ydef
inedbyasetofBool
eanexpr
essi
ons.Theot
hercat
egor
yofl
ogi
cci
rcui
ts,
cal
l
ed
sequent
iall
ogi
cci
rcui
ts,
compr
isesbot
hlogi
cgat
esandmemor
yel
ement
ssuchasf
li
p-f
lops.Owi
ngt
o
t
hepr
esenceofmemor
yel
ement
s,t
heout
puti
nasequent
ial
cir
cui
tdependsuponnotonl
ythepr
esent
butal
sot
hepastst
ateofi
nput
s.Basi
cbui
l
dingbl
ocksofsequent
ial
logi
cci
rcui
tsar
edescr
ibedi
ndet
ail
in
l
ater
.

Fi
gur
e6.
1showst
hebl
ockschemat
icr
epr
esent
ati
onofagener
ali
zedcombi
nat
ional
cir
cui
thav
ingn
i
nputv
ari esandm out
abl putv
ari
abl
esorsi
mpl
yout
put
s.Si
ncet
henumberofi
nputv
ari
abl
esi
sn,
ther
e
ar
e2npossi
blecombi
nat
ionsofbi
tsatt
hei
nput
.Eachout
putcanbeexpr
essedi
nter
msofi
nputv
ari
abl
es
byaBool
eanexpr
essi
on,
wit
hther
esul
tthatt
hegener
ali
zedsy
stem ofFi
g.6.
1canbeexpr
essedbym
Bool
eanexpr
essi
ons.

Asani
l
lust
rat
ion,
Bool
eanexpr
essi
onsdescr
ibi
ngt
hef
unct
ionofaf
our
-i
nputOR/
NORgat
ear
egi
ven
as

Al
so,
eachoft
hei
nputv
ari
abl
esmaybeav
ail
abl
easonl
ythenor
mal
inputont
hei
nputl
i
ne

59|
Page
desi
gnat
edf
ort
hepur
pose.I
nthatcase,
thecompl
ement
edi
nput
,ifdesi
red,
canbegener
atedbyusi
ngan
i
nver
ter
,asshowni
nFi
g.6.
2(a)
,whi
chi
l
lust
rat
est
hecaseofaf
our
-i
nput
,two-
out
putcombi
nat
ional
f
unct
ion.Al
so,
eachoft
hei
nputv
ari
abl
esmayappeari
ntwowi
res,
oner
epr
esent
ingt
henor
mal
li
ter
aland
t
heot
herr
epr
esent
ingt
hecompl
ement
edone,
asshowni
nFi
g.6.
2(b)
.

I
ncombi
nat
ional
cir
cui
ts,
inputv
ari
abl
escomef
rom anext
ernal
sour
ceandout
putv
ari
abl
esf
eedan
ext
ernal
dest
inat
ion.Bot
hsour
ceanddest
inat
ioni
nthemaj
ori
tyofcasesar
est
orager
egi
ster
s,andt
hese
st
oragedev
icespr
ovi
debot
hnor
mal
aswel
lascompl
ement
edout
put
soft
hest
oredbi
nar
yvar
iabl
e.

Fi
gur
e6.
2Combi
nat
ional
cir
cui
twi
thnor
mal
andcompl
ement
edi
nput
s.

Asani
l
lust
rat
ion,
Fig.6.
3showsasi
mpl
etwo-
input(
A,B)
,four
-out
put(
Y1,
Y2,
Y3,
Y4)combi
nat
ional
l
ogi
cci
rcui
tdescr
ibedbyt
hef
oll
owi
ngBool
eanexpr
essi
ons

60|
Page
Thei
mpl
ement
ati
onoft
heseBool
eanexpr
essi
onsneedsbot
hnor
mal
aswel
lascompl
ement
ed
i
nput
s.I
nci
dent
all
y,t
hecombi
nat
ional
cir
cui
tshowni
sthatofahal
f-
adder
–subt
ract
or,
wit
hAandB
r
epr
esent
ingt
het
wobi
tst
obeaddedorsubt
ract
edandY1_
Y2,
Y3,
Y4r
epr
esent
ingSUM,
DIFFERENCE,
CARRYandBORROW out
put
srespect
ivel
y.Adderandsubt
ract
orci
rcui
tsar
edi
scussedi
nSect
ions6.
3,6.
4
and6.
5.

6.
2 I
mpl
ement
ingCombi
nat
ionalLogi
c

Thedi
ff
erentst
epsi
nvol
vedi
nthedesi
gnofacombi
nat
ional
logi
cci
rcui
tar
easf
oll
ows:

1. St
atementoft
hepr
obl
em.

2. I
dent
if
icat
ionofi
nputandout
putv
ari
abl
es.

3. Expr
essi
ngt
her
elat
ionshi
pbet
weent
hei
nputandout
putv
ari
abl
es.

4. Const
ruct
ionofat
rut
htabl
etomeeti
nput
–out
putr
equi
rement
s.

5. Wr
it
ingBool
eanexpr
essi
onsf
orv
ari
ousout
putv
ari
abl
esi
nter
msofi
nputv
ari
abl
es.

6. Mi
nimi
zat
ionofBool
eanexpr
essi
ons.

7. I
mpl
ement
ati
onofmi
nimi
zedBool
eanexpr
essi
ons.

Thesedi
ff
erentst
epsar
esel
f-
expl
anat
ory
.Oneort
wopoi
nts,
howev
er,
arewor
thment
ioni
ngher
e.
Ther
ear
evar
ioussi
mpl
i
ficat
iont
echni
quesav
ail
abl
eformi
nimi
zi
ngBool
eanexpr
essi
ons,
whi
chhav
ebeen
di
scussedi
nthepr
evi
ouschapt
er.Thesei
ncl
udet
heuseoft
heor
emsandi
dent
it
ies,
Kar
naughmappi
ng,
andsoon.Al
so,
ther
ear
evar
iouspossi
blemi
nimi
zedf
orm ofBool
eanexpr
essi
ons.Thef
oll
owi
ng
gui
del
i
nesshoul
dbef
oll
owedwhi
l
echoosi
ngt
hepr
efer
redf
ormf
orhar
dwar
eimpl
ement
ati
on:

1.Thei
mpl
ement
ati
onshoul
dhav
ethemi
nimum numberofgat
es,
wit
hthegat
esusedhav
ingt
he
mi
nimum numberofi
nput
s.

2.Ther
eshoul
dbeami
nimum numberofi
nter
connect
ions,
andt
hepr
opagat
iont
imeshoul
dbet
he
shor
test
.

3.Li
mit
ati
onont
hedr
ivi
ngcapabi
l
ityoft
hegat
esshoul
dnotbei
gnor
ed.

I
tisdi
ff
icul
ttogener
ali
zeast
owhatconst
it
utesanaccept
abl
esi
mpl
i
fiedBool
eanexpr
essi
on.The
i
mpor
tanceofeachoft
heabov
e-ment
ionedaspect
sisgov
ernedbyt
henat
ureofappl
i
cat
ion.

6.
3 Ar
it
hmet
icCi
rcui
ts–Basi
cBui
ldi
ngBl
ocks

I
nthi
ssect
ion,
wewi
l
ldi
scusst
hosecombi
nat
ional
logi
cbui
l
dingbl
ockst
hatcanbeusedt
oper
for
m
addi
ti
onandsubt
ract
ionoper
ati
onsonbi
nar
ynumber
s.Addi
ti
onandsubt
ract
ionar
ethet
womost
commonl
yusedar
it
hmet
icoper
ati
ons,
ast
heot
hert
wo,
namel
ymul
ti
pli
cat
ionanddi
vi
sion,
arer
espect
ivel
y
61|
Page
t
hepr
ocessesofr
epeat
edaddi
ti
onandr
epeat
edsubt
ract
ion,
aswasout
li
nedi
nChapt
er2deal
i
ngwi
th
bi
nar
yar
it
hmet
ic.Wewi
l
lbegi
nwi
tht
hebasi
cbui
l
dingbl
ockst
hatf
ormt
hebasi
sofal
lhar
dwar
eusedt
o
per
for
mtheaf
oresai
dar
it
hmet
icoper
ati
onsonbi
nar
ynumber
s.Thesei
ncl
udehal
f-
adder
,ful
ladder
,hal
f-
subt
ract
or,
ful
lsubt
ract
orandcont
rol
l
edi
nver
ter
.

6.
3.1 Hal
f-
Adder

Ahal
f-
adderi
sanar
it
hmet
icci
rcui
tbl
ockt
hatcanbeusedt
oaddt
wobi
ts.Suchaci
rcui
tthushast
wo
i
nput
sthatr
epr
esentt
het
wobi
tst
obeaddedandt
woout
put
s,wi
thonepr
oduci
ngt
heSUM out
putandt
he
ot
herpr
oduci
ngt
heCARRY.Fi
gur
e6.
4showst
het
rut
htabl
eofahal
f-
adder
,showi
ngal
lpossi
blei
nput
combi
nat
ionsandt
hecor
respondi
ngout
put
s.

TheBool
eanexpr
essi
onsf
ort
heSUM andCARRYout
put
sar
egi
venbyt
heequat
ions

Anexami
nat
ionoft
het
woexpr
essi
onst
ell
sthatt
her
eisnoscopef
orf
urt
hersi
mpl
i
ficat
ion.Whi
l
ethef
ir
st
oner
epr
esent
ingt
heSUM out
puti
sthatofanEX-
ORgat
e,t
hesecondoner
epr
esent
ingt
heCARRYout
put
i
sthatofanANDgat
e.

62|
Page
Howev
er,
theset
woexpr
essi
onscancer
tai
nlyber
epr
esent
edi
ndi
ff
erentf
ormsusi
ngv
ari
ousl
awsand
t
heor
emsofBool
eanal
gebr
atoi
l
lust
rat
ethef
lexi
bil
i
tyt
hatt
hedesi
gnerhasi
nhar
dwar
e-i
mpl
ement
ingas
si
mpl
eacombi
nat
ional
funct
ionast
hatofahal
f-
adder
.

Wehav
est
udi
edi
nChapt
er5onBool
eanal
gebr
ahowv
ari
ousl
ogi
cgat
escanbei
mpl
ement
edi
nthef
orm
ofei
theronl
yNANDgat
esorNORgat
es.Al
thought
hesi
mpl
estwayt
ohar
dwar
e-i
mpl
ementahal
f-
adder
woul
dbet
ouseat
wo-
inputEX-
ORgat
efort
heSUM out
putandat
wo-
inputANDgat
efort
heCARRYout
put
,
asshowni
nFi
g.6.
5,i
tcoul
dal
sobei
mpl
ement
edbyusi
nganappr
opr
iat
ear
rangementofei
therNANDor
NORgat
es.Fi
gur
e6.
6showst
hei
mpl
ement
ati
onofahal
f-
adderwi
thNANDgat
esonl
y.

Acl
osel
ookatt
hel
ogi
cdi
agr
am ofFi
g.6.
6rev
eal
sthatonepar
toft
heci
rcui
timpl
ement
sat
wo-
inputEX-
ORgat
ewi
tht
wo-
inputNANDgat
es.EX-
ORi
mpl
ement
ati
onusi
ngNANDwasdi
scussedi
nthepr
evi
ous
chapt
er.TheANDgat
erequi
redt
ogener
ateCARRYout
puti
simpl
ement
edbycompl
ement
inganal
ready
av
ail
abl
eNANDout
putoft
hei
nputv
ari
abl
es.

6.
3.2 Ful
lAdder

Af
ulladderci
rcui
tisanar
it
hmet
icci
rcui
tbl
ockt
hatcanbeusedt
oaddt
hreebi
tst
opr
oduceaSUM anda
CARRYout
put
.Suchabui
l
dingbl
ockbecomesanecessi
tywheni
tcomest
oaddi
ngbi
nar
ynumber
swi
tha
l
argenumberofbi
ts.Thef
ull
adderci
rcui
tov
ercomest
hel
i
mit
ati
onoft
hehal
f-
adder
,whi
chcanbeusedt
o
addt
wobi
tsonl
y.Letusr
ecal
lthepr
ocedur
eforaddi
ngl
argerbi
nar
ynumber
s.Webegi
nwi
tht
headdi
ti
on
ofLSBsoft
het
wonumber
s.Wer
ecor
dthesum undert
heLSBcol
umnandt
aket
hecar
ry,
ifany
,for
war
dto
t
henexthi
ghercol
umnbi
ts.Asar
esul
t,whenweaddt
henextadj
acenthi
ghercol
umnbi
ts,
wewoul
dbe
r
equi
redt
oaddt
hreebi
tsi
fther
ewer
eacar
ryf
rom t
hepr
evi
ousaddi
ti
on.Wehav
easi
mil
arsi
tuat
ionf
or
t
heot
herhi
ghercol
umnbi
tsal
sount
ilwer
eacht
heMSB.Af
ull
adderi
sther
efor
eessent
ial
fort
he
har
dwar
eimpl
ement
ati
onofanadderci
rcui
tcapabl
eofaddi
ngl
argerbi
nar
ynumber
s.Ahal
f-
addercanbe
usedf
oraddi
ti
onofLSBsonl
y.

63|
Page
Fi
gur
e6.
7showst
het
rut
htabl
eofaf
ull
adderci
rcui
tshowi
ngal
lpossi
blei
nputcombi
nat
ionsand
cor
respondi
ngout
put
s.I
nor
dert
oar
ri
veatt
hel
ogi
cci
rcui
tforhar
dwar
eimpl
ement
ati
onofaf
ull
adder
,we
wi
l
lfi
rst
lywr
it
etheBool
eanexpr
essi
onsf
ort
het
woout
putv
ari
abl
es,
thati
s,t
heSUM andCARRYout
put
s,
i
nter
msofi
nputv
ari
abl
es.Theseexpr
essi
onsar
ethensi
mpl
i
fiedbyusi
nganyoft
hesi
mpl
i
ficat
ion
t
echni
quesdescr
ibedi
nthepr
evi
ouschapt
er.TheBool
eanexpr
essi
onsf
ort
het
woout
putv
ari
abl
esar
e
gi
veni
nEquat
ion(
6.7)f
ort
heSUM out
put(
S)andi
nEquat
ion(
6.8)f
ort
heCARRYout
put(
Cout
):

Thenextst
epi
stosi
mpl
i
fyt
het
woexpr
essi
ons.Wewi
l
ldosowi
tht
hehel
poft
heKar
naughmappi
ng
t
echni
que.Kar
naughmapsf
ort
het
woexpr
essi
onsar
egi
veni
nFi
g.6.
8(a)f
ort
heSUM out
putandFi
g.
6.
8(b)f
ort
heCARRYout
put
.Asi
scl
earf
rom t
het
womaps,
theexpr
essi
onf
ort
heSUM (
S)out
putcannot
besi
mpl
i
fiedanyf
urt
her
,wher
east
hesi
mpl
i
fiedBool
eanexpr
essi
onf
orCouti
sgi
venbyt
heequat
ion

Fi
gur
e6.
9showst
hel
ogi
cci
rcui
tdi
agr
am oft
hef
ull
adder
.Af
ull
addercanal
sobeseent
ocompr
iset
wo
hal
f-
adder
sandanORgat
e.Theexpr
essi
onsf
orSUM andCARRYout
put
scanber
ewr
it
tenasf
oll
ows:

Si
mil
arl
y,t
heexpr
essi
onf
orCARRYout
putcanber
ewr
it
tenasf
oll
ows:

64|
Page
Bool
eanexpr
essi
on(
6.10)canbei
mpl
ement
edwi
that
wo-
inputEX-
ORgat
epr
ovi
dedt
hatoneoft
hei
nput
s
i
sCinandt
heot
heri
nputi
stheout
putofanot
hert
wo-
inputEX-
ORgat
ewi
thAandBasi
tsi
nput
s.Si
mil
arl
y,
Bool
eanexpr
essi
on(
6.11)canbei
mpl
ement
edbyORi
ngt
womi
nter
ms.Oneoft
hem i
stheANDout
putof
AandB.Theot
heri
sal
sot
heout
putofanANDgat
ewhosei
nput
sar
eCi
nandt
heout
putofanEX-
OR
oper
ati
ononAandB.Thewhol
eideaofwr
it
ingt
heBool
eanexpr
essi
onsi
nthi
smodi
fi
edf
orm wast
o
demonst
rat
etheuseofahal
f-
adderci
rcui
tinbui
l
dingaf
ull
adder
.Fi
gur
e6.
10(
a)showsl
ogi
c
i
mpl
ement
ati
onofEquat
ions(
6.10)and(
6.11)
.Fi
gur
e6.
10(
b)i
snot
hingbutFi
g.6.
10(
a)r
edr
awnwi
tht
he
por
ti
onoft
heci
rcui
trepr
esent
ingahal
f-
adderr
epl
acedwi
thabl
ock.

Thef
ull
adderoft
het
ypedescr
ibedabov
efor
mst
hebasi
cbui
l
dingbl
ockofbi
nar
yadder
s.Howev
er,
a
si
ngl
eful
ladderci
rcui
tcanbeusedt
oaddone-
bitbi
nar
ynumber
sonl
y.Acascadear
rangementoft
hese
adder
scanbeusedt
oconst
ructadder
scapabl
eofaddi
ngbi
nar
ynumber
swi
thal
argernumberofbi
ts.For
exampl
e,af
our
-bi
tbi
nar
yadderwoul
drequi
ref
ourf
ull
adder
soft
het
ypeshowni
nFi
g.6.
10t
obe
connect
edi
ncascade.Fi
gur
e6.
11showssuchanar
rangement
.(A3A2A1A0)and(
B3B2B1B0)ar
ethet
wo

65|
Page
bi
nar
ynumber
stobeadded,
wit
hA0andB0r
epr
esent
ingLSBsandA3andB3r
epr
esent
ingMSBsoft
he
t
wonumber
s.

6.
3.3Hal
f-
Subt
ract
or

Wehav
eseeni
nChapt
er3ondi
git
alar
it
hmet
ichowsubt
ract
ionoft
wogi
venbi
nar
ynumber
scanbe
car
ri
edoutbyaddi
ng2’
scompl
ementoft
hesubt
rahendt
othemi
nuend.Thi
sal
l
owsust
odoasubt
ract
ion
oper
ati
onwi
thadderci
rcui
ts.Wewi
l
lst
udyt
heuseofadderci
rcui
tsf
orsubt
ract
ionoper
ati
onsi
nthe
f
oll
owi
ngpages.Bef
orewedot
hat
,wewi
l
lbr
ief
lyl
ookatt
hecount
erpar
tsofhal
f-
adderandf
ull
adder
ci
rcui
tsi
nthehal
f-
subt
ract
orandf
ull
subt
ract
orf
ordi
recti
mpl
ement
ati
onofsubt
ract
ionoper
ati
onsusi
ng
l
ogi
cgat
es.
66|
Page
Ahal
f-
subt
ract
ori
sacombi
nat
ional
cir
cui
tthatcanbeusedt
osubt
ractonebi
nar
ydi
gitf
rom anot
hert
o
pr
oduceaDI
FFERENCEout
putandaBORROW out
put
.TheBORROW out
puther
especi
fi
eswhet
hera‘
1’
hasbeenbor
rowedt
oper
for
mthesubt
ract
ion.Thet
rut
htabl
eofahal
f-
subt
ract
or,
asshowni
nFi
g.6.
12,
expl
ainst
hisf
urt
her
.TheBool
eanexpr
essi
onsf
ort
het
woout
put
sar
egi
venbyt
heequat
ions

67|
Page
I
tisobv
ioust
hatt
her
eisnof
urt
herscopef
oranysi
mpl
i
ficat
ionoft
heBool
eanexpr
essi
onsgi
venby
Equat
ions(
6.12)and(
6.13)
.Whi
l
etheexpr
essi
onf
ort
heDI
FFERENCE(
D)out
puti
sthatofanEX-
ORgat
e,
t
heexpr
essi
onf
ort
heBORROW out
put(
Bo_i
sthatofanANDgat
ewi
thi
nputAcompl
ement
edbef
orei
tis
f
edt
othegat
e.

68|
Page
Fi
gur
e6.
13showst
hel
ogi
cimpl
ement
ati
onofahal
f-
subt
ract
or.Compar
ingahal
f-
subt
ract
orwi
tha
hal
f-
adder
,wef
indt
hatt
heexpr
essi
onsf
ort
heSUM andDI
FFERENCEout
put
sar
ejustt
hesame.The
expr
essi
onf
orBORROW i
nthecaseoft
hehal
f-
subt
ract
ori
sal
sosi
mil
art
owhatwehav
eforCARRYi
nthe
caseoft
hehal
f-
adder
.Ift
hei
nputA,
thati
s,t
hemi
nuend,
iscompl
ement
ed,
anANDgat
ecanbeusedt
o
i
mpl
ementt
heBORROW out
put
.Not
ethesi
mil
ari
ti
esbet
weent
hel
ogi
cdi
agr
amsofFi
g.6.
5(hal
f-
adder
)
andFi
g.6.
13(
hal
f-
subt
ract
or)
.

6.
3.4 Ful
lSubt
ract
or

Af
ullsubt
ract
orper
for
mssubt
ract
ionoper
ati
onont
wobi
ts,
ami
nuendandasubt
rahend,
andal
so
t
akesi
ntoconsi
der
ati
onwhet
hera‘
1’hasal
readybeenbor
rowedbyt
hepr
evi
ousadj
acentl
owermi
nuend
bi
tornot
.Asar
esul
t,t
her
ear
ethr
eebi
tst
obehandl
edatt
hei
nputofaf
ull
subt
ract
or,
namel
ythet
wobi
ts
t
obesubt
ract
edandabor
rowbi
tdesi
gnat
edasBi
n.Ther
ear
etwoout
put
s,namel
ytheDI
FFERENCE
out
putDandt
heBORROW out
putBo.TheBORROW out
putbi
ttel
l
swhet
hert
hemi
nuendbi
tneedst
o
bor
rowa‘
1’f
rom t
henextpossi
blehi
ghermi
nuendbi
t.Fi
gur
e6.
14showst
het
rut
htabl
eofaf
ull
subt
ract
or.

69|
Page
TheBool
eanexpr
essi
onsf
ort
het
woout
putv
ari
abl
esar
egi
venbyt
heequat
ions

70|
Page
TheKar
naughmapsf
ort
het
woexpr
essi
onsar
egi
veni
nFi
g.6.
15(
a)f
orDI
FFERENCEout
putDandi
n
Fi
g.6.
15(
b)f
orBORROW out
putBo.Asi
scl
earf
rom t
het
woKar
naughmaps,
nosi
mpl
i
ficat
ioni
spossi
ble
f
ort
hedi
ff
erenceout
putD.Thesi
mpl
i
fiedexpr
essi
onf
orBoi
sgi
venbyt
heequat
ion

71|
Page
I
fwecompar
etheseexpr
essi
onswi
tht
hoseder
ivedear
li
eri
nthecaseofaf
ull
adder
,wef
indt
hatt
he
expr
essi
onf
orDI
FFERENCEout
putDi
sthesameast
hatf
ort
heSUM out
put
.Al
so,
theexpr
essi
onf
or
BORROW out
putBoi
ssi
mil
art
otheexpr
essi
onf
orCARRY-
OUTCo.I
nthecaseofahal
f-
subt
ract
or,
theA
i
nputi
scompl
ement
ed.Byasi
mil
aranal
ysi
sitcanbeshownt
hataf
ull
subt
ract
orcanbei
mpl
ement
ed
wi
thhal
f-
subt
ract
orsi
nthesamewayasaf
ull
adderwasconst
ruct
edusi
nghal
f-
adder
s.

Rel
evantl
ogi
cdi
agr
amsar
eshowni
nFi
gs6.
16(
a)and(
b)cor
respondi
ngt
oFi
gs6.
10(
a)and(
b)
r
espect
ivel
yforaf
ull
adder
.Agai
n,mor
ethanonef
ull
subt
ract
orcanbeconnect
edi
ncascadet
oper
for
m
subt
ract
ionont
wol
argerbi
nar
ynumber
s.Asani
l
lust
rat
ion,
Fig.6.
17showsaf
our
-bi
tsubt
ract
or.

6.
3.5 Cont
rol
ledI
nver
ter

Acont
rol
l
edi
nver
teri
sneededwhenanadderi
stobeusedasasubt
ract
or.Asout
li
nedear
li
er,
subt
ract
ioni
snot
hingbutaddi
ti
onoft
he2’
scompl
ementoft
hesubt
rahendt
othemi
nuend.Thus,
thef
ir
st

72|
Page
st
ept
owar
dspr
act
ical
impl
ement
ati
onofasubt
ract
ori
stodet
ermi
net
he2’
scompl
ementoft
he
subt
rahend.Andf
ort
his,
oneneedsf
ir
stl
ytof
ind1’
scompl
ement
.Acont
rol
l
edi
nver
teri
susedt
ofi
nd1’
s
compl
ement
.Aone-
bitcont
rol
l
edi
nver
teri
snot
hingbutat
wo-
inputEX-
ORgat
ewi
thoneofi
tsi
nput
s
t
reat
edasacont
rol
input
,asshowni
nFi
g.6.
18(
a).Whent
hecont
rol
inputi
sLOW,
thei
nputbi
tispassed
assucht
otheout
put
.(Recal
lthet
rut
htabl
eofanEX-
ORgat
e.)Whent
hecont
rol
inputi
sHI
GH,
thei
nputbi
t
get
scompl
ement
edatt
heout
put
.Fi
gur
e6.
18(
b)showsanei
ght
-bi
tcont
rol
l
edi
nver
teroft
hist
ype.When
t
hecont
rol
inputi
sLOW,
theout
put(
Y7Y6Y5Y4Y3Y2Y1Y0)v
ist
hesameast
hei
nput(
A7A6A5A4A3A2A1
A0)
.Whent
hecont
rol
inputi
sHI
GH,
theout
puti
s1’
scompl
ementoft
hei
nput
.Asanexampl
e,11010010at
t
hei
nputwoul
dpr
oduce00101101att
heout
putwhent
hecont
rol
inputi
sinal
ogi
c‘1’
stat
e.

73|
Page
6.
4 Ar
it
hmet
icLogi
cUni
t(ALU)

Thear
it
hmet
icl
ogi
cuni
t(ALU)i
sadi
git
albui
l
dingbl
ockcapabl
eofper
for
mingbot
har
it
hmet
icaswel
l
asl
ogi
coper
ati
ons.Ar
it
hmet
icl
ogi
cuni
tst
hatcanper
for
m av
ari
etyofar
it
hmet
icoper
ati
onssuchas
addi
ti
on,
subt
ract
ion,
etc.
,andl
ogi
cfunct
ionssuchasANDi
ng,
ORi
ng,
EX-
ORi
ng,
etc.
,ont
wof
our
-bi
t
number
sar
eusual
l
yav
ail
abl
einI
Cfor
m.Thef
unct
iont
obeper
for
medi
ssel
ect
abl
efom f
r unct
ionsel
ect
pi
ns.Someoft
hepopul
art
ypenumber
sofALUi
ncl
ude74181,
74381,
74382,
74582(
all
from t
heTTLl
ogi
c
f
ami
l
y)and40181(
from t
heCMOSl
ogi
cfami
l
y).Funct
ional
det
ail
soft
heseI
Csar
egi
veni
nthel
att
erpar
t
oft
hechapt
erundert ngofAppl
heheadi i
cat
ion-
Rel
evantI
nfor
mat
ion.Mor
ethanonesuchI
Ccanal
way
sbe
connect
edi
ncascadet
oper
for
m ar
it
hmet
icandl
ogi
coper
ati
onsonl
argerbi
tnumber
s.

6.
5 Mul
ti
pli
ers

Mul
ti
pli
cat
ionofbi
nar
ynumber
sisusual
l
yimpl
ement
edi
nmi
cropr
ocessor
sandmi
crocomput
ersby
ngr
usi epeat
edaddi
ti
onandshi
ftoper
ati
ons.Si
ncet
hebi
nar
yadder
sar
edesi
gnedt
oaddonl
ytwobi
nar
y
number
satat
ime,
inst
eadofaddi
ngal
lthepar
ti
alpr
oduct
satt
heend,
theyar
eaddedt
woatat
imeand
t
hei
rsum i
saccumul
atedi
nar
egi
stercal
l heaccumul
edt atorr
egi
ster
.Al
so,
whent
hemul
ti
pli
erbi
tis‘
0’
,
t
hatv
erypar
ti
alpr
oducti
signor
ed,
asanal
l‘
0’l
i
nedoesnotaf
fectt
hef
inal
resul
t.
74|
Page
Thebasi
char
dwar
ear
rangementofsuchabi
nar
ymul
ti
pli
erwoul
dcompr
iseshi
ftr
egi
ster
sfort
he
mul
ti
pli
candandmul
ti
pli
erbi
ts,
anaccumul
atorr
egi
sterf
orst
ori
ngpar
ti
alpr
oduct
s,abi
nar
ypar
all
eladder
andacl
ockpul
segener
atort
oti
mev
ari
ousoper
ati
ons.
Binar
ymul
ti
pli
ersar
eal
soav
ail
abl
einI
Cfor
m.
Someoft
hepopul
art
ypenumber
sint
heTTLf
ami
l
yincl
ude74261whi
chi
sa2×4bi
tmul
ti
pli
er(
afour
-bi
t
mul
ti
pli
canddesi
gnat
edasB0,
B1,
B2,
B3andB4,
andat
wo-
bitmul
ti
pli
erdesi
gnat
edasM0,
M1andM2)
.

TheMSBsB4andM2ar
eusedt
orepr
esentsi
gns.74284and74285ar
e4×4bi
tmul
ti
pli
ers.Theycan
beusedt
oget
hert
oper
for
m hi
gh-
speedmul
ti
pli
cat
ionoft
wof
our
-bi
tnumber
s.Fi
gur
e6.
35showst
he
ar
rangement
.Ther
esul
tofmul
ti
pli
cat
ioni
sof
tenr
equi
redt
obest
oredi
nar
egi
ster
.Thesi
zeoft
his
r
egi
ster(
accumul
ator
)dependsupont
henumberofbi
tsi
nther
esul
t,whi
chatt
hemostcanbeequal
tot
he
sum oft
henumberofbi
tsi
nthemul
ti
pli
erandmul
ti
pli
cand.Somemul
ti
pli
erI
Cshav
eani
n-bui
l
tregi
ster
.

Manymi
cropr
ocessor
sdonothav
eint
hei
rALUt
hehar
dwar
ethatcanper
for
m mul
ti
pli
cat
ionorot
her

75|
Page
compl
exar
it
hmet
icoper
ati
onssuchasdi
vi
si
on,
det
ermi
ningt
hesquar
eroot
,tr
igonomet
ri
cfunct
ions,
etc.
Theseoper
ati
onsi
nthesemi
cropr
ocessor
sar
eexecut
edt
hroughsof
twar
e.Forexampl
e,amul
ti
pli
cat
ion
oper
ati
onmaybeaccompl
i
shedbyusi
ngasof
twar
epr
ogr
am t
hatdoesmul
ti
pli
cat
iont
hroughr
epeat
ed
execut
ionofaddi
ti
onandshi
fti
nst
ruct
ions.Ot
hercompl
exoper
ati
onsment
ionedabov
ecanal
sobe
execut
edwi
thsi
mil
arpr
ogr
ams.Al
thought
heuseofsof
twar
ereducest
hehar
dwar
eneededi
nthe
mi
cropr
ocessor
,thecomput
ati
ont
imei
ngener
ali
shi
gheri
nthecaseofsof
twar
e-execut
edoper
ati
ons
whencompar
edwi
tht
heuseofhar
dwar
etoper
for
mthoseoper
ati
ons.

76|
Page
CHAPTER7

FLI
PFLOPSANDRELATEDDEVI
CES
7.
1 R-
SFl
ip-
Flop

Af
li
p-f
lop,
isabi
stabl
eci
rcui
t.Bot
hofi
tsout
putst
atesar
est
abl
e.Theci
rcui
tremai
nsi
napar
ti
cul
ar
out
putst
atei
ndef
ini
tel
yunt
ilsomet
hingi
sdonet
ochanget
hatout
putst
atus.Ref
err
ingt
othebi
stabl
e
mul
ti
vi
brat
orci
rcui
t,t
heset
wost
ateswer
ethoseoft
heout
putt
ransi
stori
nsat
urat
ion(
repr
esent
ingaLOW
out
put
)andi
ncut
-of
f(r
epr
esent
ingaHI
GHout
put
).I
ftheLOW andHI
GHout
put
sar
erespect
ivel
yregar
ded
as‘
0’and‘
1’
,t
hent
heout
putcanei
therbea‘
0’ora‘
1’
.Si
nceei
thera‘
0’ora‘
1’canbehel
dindef
ini
tel
yunt
il
t
heci
rcui
tisappr
opr
iat
elyt
ri
gger
edt
ogot
otheot
herst
ate,
theci
rcui
tissai
dtohav
ememor
y.I
tiscapabl
e
ofst
ori
ngonebi
nar
ydi
gitoronebi
tofdi
git
ali
nfor
mat
ion.I
nabi
stabl
emul
ti
vi
brat
orci
rcui
t,whenoneof
t
het
ransi
stor
swasi
nsat
urat
ion,
theot
herwasi
ncut
-of
f.Thi
simpl
i
est
hat
,ifwehadt
akenout
put
sfr
om
t
hecol
l
ect
orsofbot
htr
ansi
stor
s,t
hent
het
woout
put
swoul
dbecompl
ement
ary
.Int
hef
li
p-f
lopsofv
ari
ous
t
ypest
hatar
eav
ail
abl
einI
Cfor
m,wewi
l
lseet
hatal
lthesedev
icesof
fercompl
ement
aryout
put
susual
l
y
̅
desi edasQandQ
gnat

TheR-
Sfl
i
p-f
lopi
sthemostbasi
cofal
lfl
i
p-f
lops.Thel
ett
ers‘
R’and‘
S’her
est
andf
orRESETandSET.
̅
Whent
hef
li
p-f
lopi
sSET,
itsQout
putgoest
oa‘
1’st
ate,
andwheni
tisRESETi
tgoest
oa‘
0’st
ate.TheQ
out
puti
sthecompl
ementoft
heQout
putatal
lti
mes.

7.
1.1 R-
SFl
ip-
Flopwi
thAct
iveLOW I
nput
s

Fi
gur
e7.
17(
a)showsaNANDgat
eimpl
ement
ati
onofanR-
Sfl
i
p-f
lopwi
thact
iveLOW i
nput
s.Thent
wo
NANDgat
esar
ecr
oss-
coupl
ed.Thati
s,t
heout
putofNAND1i
sfedbackt
ooneoft
hei
nput
sofNAND2,
andt
heout
putofNAND2i
sfedbackt
ooneoft
hei
nput
sofNAND1.Ther
emai
ningi
nput
sofNAND1and
̅
NAND2ar
etheSandRi
nput
s.Theout
put
sofNAND1andNAND2ar
erespect
ivel
yQandQout
put
s.

Thef
actt
hatt
hisconf
igur
ati
onf
oll
owst
hef
unct
iont
abl
eofFi
g.6.
17(
c)canbeexpl
ained.Wewi
l
llook
atdi
ff
erentent
ri
esoft
hef
unct
iont
abl
e,oneatat
ime.

Letust
aket
hecaseofR=S=1(
thef
ir
stent
ryi
nthef
unct
iont
abl
e).Wewi
l
lpr
ovet
hat
,forR=S=1,
t
heQout
putr
emai
nsi
nit
sexi
sti
ngst
ate.I
nthet
rut
htabl
e,Qnr
epr
esent
stheexi
sti
ngst
ateandQn+1
r
epr
esent
sthest
ateoft
hef
li
p-f
lopaf
teri
thasbeent
ri
gger
edbyanappr
opr
iat
epul
seatt
heRorSi
nput
.

77|
Page
̅
Letusassumet
hatQ=0i
nit
ial
l
y.Thi
s‘0’
stat
efedbackt
ooneoft
hei
nput
sofgat
e2ensur hatQ=1.
est
̅
The‘
1’st
ateofQfedbackt
ooneoft
hei
nput
sofgat
e1al
ongwi
thS=1ensur
est
hatQ=0.Thus,
R=S=
1hol
dst
heex
ist
ingst
age.Now,
ifQwasi
nit
ial
l
yint
he‘
1’st
ateandnott
he‘
0’st
ate,
thi
s‘1’
fedbackt
oone
̅
oft
hei
nput
sofgat
e2al
ongwi
thR=1f
orcesQtobei
nthe‘
0’st
ate.The‘
0’st
ate,
whenf
edbackt
ooneof
t
hei
nput
sofgat
e1,
ensur
est
hatQr
emai
nsi
nit
sexi
sti
ngst
ateofl
ogi
c‘1’
.Thus,
what
evert
hest
ateofQ,
R
=S=1hol
dst
heexi
sti
ngst
ate.

Letusnowl
ookatt
hesecondent
ryoft
hef
unct
iont
abl
ewher
eS=0andR=1.Wecanseet
hatsuch
ani
nputcombi
nat
ionf
orcest
heQout
putt
othe‘
1’st
ate.Onsi
mil
arl
i
nes,
thei
nputcombi
nat
ionS=1andR
=0(
thi
rdent
ryoft
het
rut
htabl
e)f
orcest
heQout
putt
othe‘
0’st
ate.I
twoul
dbei
nter
est
ingt
oanal
yzewhat
̅
happenswhenS=R=0.Thi
simpl
i
est hQandQout
hatbot put
sshoul
dgot
othe‘
1’st
ate,
asoneoft
he
i
nput
sofaNANDgat
ebei
ngal
ogi
c‘0’
shoul
dfor
cei
tsout
putt
othel
ogi
c‘1’
stat
eir
respect
iveoft
hest
atus
̅
oft
heot
heri
nput
.Thi
sisanundesi
redst
ateasQandQout
put
sar
etobet
hecompl
ementofeachot
her
.
Thei
nputcondi
ti
on(
i.
e.R=S=0)t
hatcausessuchasi
tuat
ioni
sther
efor
econsi
der
edt
obeani
nval
i
d
condi
ti
onandi
sfor
bidden.Fi
gur
e7.
17(
b)showst
hel
ogi
csy
mbol
ofsuchaf
li
p-f
lop.TheRandSi
nput
s
her
ehav
ebeenshownasact
iveLOW i
nput
s,whi
chi
sobv
iousast
hisf
li
p-f
lopofFi
g.7.
17(
a)i
sSET(
thati
s,
Q=1)whenS=0andRESET(
thati
s,Q=0)

whenR=0.Thus,
RandSar
eact
ivewhenLOW.Thet
erm CLEARi
nputi
sal
sousedsomet
imesi
npl
ace
ofRESET.Theoper
ati
onoft
heR-
Sfl
i
p-f
lopofFi
g.7.
17(
a)canbesummar
izedasf
oll
ows:

1. SET=RESET=1i
sthenor
mal
rest
ingcondi
ti
onoft
hef
li
p-f
lop.I
thasnoef
fectont
heout
putst
ate
̅
oft
hef
li
p-f
l hQandQout
op.Bot put
sremai
nint
hel
ogi
cst
atet
heywer
einpr
iort
othi
sinput
condi
ti
on.

̅
2. SET=0andRESET=1set
sthef
li
p-f
lop.QandQrespect
ivel
ygot
othe‘
1’and‘
0’st
ate.

̅
3. SET=1andRESET=0r
eset
sorcl
ear
sthef
li
p-f
lop.QandQrespect
ivel
ygot
othe‘
0’and‘
1’st
ate.

̅
4. SET=RESET=0i
sfor
biddenassuchacondi
ti
ont
ri
est
oset(
thati
s,Q=1)andr
eset(
thati
s,Q
=1)t
hef
li
p-f
lopatt
hesamet
ime.Tobemor
epr
eci
se,
SETandRESETi
nput
sint
heR-
Sfl
i
p-f
lop
cannotbeact
iveatt
hesamet
ime.

TheR-
Sfl
i
p-f
lopofFi
g.7.
17(
a)i
sal
sor
efer
redt
oasanR-
Slat
ch.Thi
sisbecauseanycombi
nat
ionat
t
hei
nput
simmedi
atel
ymani
fest
sit
sel
fatt
heout
putaspert
het
rut
htabl
e.

78|
Page
7.
1.2 R-
SFl
ip-
Flopwi
thAct
iveHI
GHI
nput
s

Fi
gur
e7.
18(
a)showsanot
herNANDgat
eimpl
ement
ati
onoft
heR-
Sfl
i
p-f
lop.Fi
gur
es7.
18(
b)and(
c)
r
espect
ivel
yshowi
tsci
rcui
tsy
mbol
andf
unct
iont
abl
e.Suchaci
rcui
twoul
dhav
eact
iveHI
GHi
nput
s.The
i
nputcombi
nat
ionR=S=1woul
dbef
orbi
ddenasSETandRESETi
nput
sinanR-
Sfl
i
p-f
lopcannotbe
act
iveatt
hesamet
ime.

79|
Page
TheR-
Sfl
i
p-f
lops(
orl
atches)ofFi
gs7.
17(
a)and7.
18(
a)mayal
sobei
mpl
ement
edwi
thNORngat
es.
TheNORgat
ecount
erpar
tsofFi
g.7.
17(
a)andFi
g.7.
18(
a)ar
erespect
ivel
yshowni
nFi
gs7.
19(
a)and(
b).

Sof
arwehav
edi
scussedt
heoper
ati
onofanR-
Sfl
i
p-f
lopwi
tht
hehel
pofi
tsl
ogi
cdi
agr
am andt
he
f
unct
iont
abl
eonl
i
nessi
mil
art
othecaseofcombi
nat
ional
cir
cui
ts.Wedo,
howev
er,
appr
eci
atet
hata
sequent
ial
cir
cui
twoul
dbebet
terexpl
ainedi
fweexpr
essedi
tsout
put(
immedi
atel
yaf
teri
twascl
ocked)i
n
t
ermsofi
tspr
esentout
putandi
tsi
nput
s.Thef
unct
iont
abl
esofFi
gs7.
17(
c)and7.
18(
c)mayber
edr
awn
asshowni
nFi
gs7.
20(
a)and(
b)r
espect
ivel
y.Thi
snewf
orm ofr
epr
esent
ati
oni
sknownast
he
char
act
eri
sti
ctabl
e.

80|
Page
Hav
ingdonet
his,
wecoul
dev
enwr
it
esi
mpl
i
fiedBool
eanexpr
essi
ons,
cal
l
edchar
act
eri
sti
cequat
ions,
usi
nganyoft
hemi
nimi
zat
iont
echni
ques,
suchasKar
naughmappi
ng.TheK-
mapsf
ort
hechar
act
eri
sti
c
t
abl
esofFi
gs7.
20(
a)and(
b)ar
egi
veni
nFi
gs7.
20(
c)and(
d)r
espect
ivel
y.Char
act
eri
sti
cequat
ionsf
orR-
S
f
li
p-f
lopswi
thact
iveLOW andact
iveHI
GHi
nput
sar
egi
venbyt
heequat
ions

81|
Page
S+R=1i
ndi
cat
est
hatR=S=0i
sapr
ohi
bit
edent
ry.Si
mil
arl
y,S_
R=0onl
yindi
cat
est
hatR=S=1i
sa
pr
ohi
bit
edent
ry.

7.
1.3 Cl
ockedR-
SFl
ip-
Flop

I
nthecaseofacl
ockedR-
Sfl
i
p-f
lop,
orf
ort
hatmat
teranycl
ockedf
li
p-f
lop,
theout
put
schangest
ates
aspert
hei
nput
sonl
yont
heoccur
renceofacl
ockpul
se.Thecl
ockedf
li
p-f
lopcoul
dbeanl
evel
-t
ri
gger
ed
oneoranedge-
tr
igger
edone.Thet
wot
ypesar
edi
scussedi
nthenextsect
ion.Fort
het
imebei
ng,
letus
f
ir
stseehowt
hef
li
p-f
lopoft
hepr
evi
oussect
ioncanbet
ransf
ormedi
ntoacl
ockedf
li
p-f
lop.Fi
gur
e7.
21(
a)
showst
hel
ogi
cimpl
ement
ati
onofacl
ockedf
li
p-f
lopt
hathasact
iveHI
GHi
nput
s.Thef
unct
iont
abl
efor
t
hesamei
sshowni
nFi
g.7.
21(
b)andi
ssel
f-
expl
anat
ory
.

Figure7.20(a)Char
acter
ist
ict
abl
eofanR-Sfl
ip-
fl
opwit
hacti
veLOW i
nput
s,(
b)thecharact
eri
sti
ctableofanR-
Sfli
p-f
lopwi
thacti
veHIGH
i
nput
s,(c)theK-mapsolut
ionofanR-Sfl
i
p-f
lopwi
thacti
veLOW i
nput
sand(d)t
heK-mapsoluti
onofanR- Sfl
ip-
fl
opwit
hactiv
eHIGHinput
s.

82|
Page
Thebasi
cfl
i
p-f
lopi
sthesameast
hatshowni
nFi
g.7.
17(
a).Thet
woNANDgat
esatt
hei
nputhav
e
beenusedt
ocoupl
etheRandSi
nput
stot
hef
li
p-f
lopi
nput
sundert
hecont
rol
oft
hecl
ocksi
gnal
.When
t
hecl
ocksi
gnal
isHI
GH,
thet
woNANDgat
esar
eenabl
edandt
heSandRi
nput
sar
epassedont
ofl
i
p-f
lop
i
nput
swi
tht
hei
rst
atuscompl
ement
ed.Theout
put
scannowchangest
atesaspert
hest
atusofRandSat
t
hef
li
p-f
lopi
nput
s.Fori
nst
ance,
whenS=1andR=0i
twi
l
lbepassedonas0and1r
espect
ivel
ywhent
he
cl
ocki
sHI
GH.Whent
hecl
ocki
sLOW,
thet
woNANDgat
espr
oducea‘
1’att
hei
rout
put
s,i
rr
espect
iveof
t
heSandRst
atus.Thi
spr
oducesal
ogi
c‘1’
atbot
hinput
soft
hef
li
p-f
lop,
wit
hther
esul
tthatt
her
eisno
ef
fectont
heout
putst
ates.Fi
gur
e7.
22(
a)showst
hecl
ocked

R-
Sfl
i
p-f
lopwi
thact
iveLOW RandSi
nput
s.Thel
ogi
cimpl
ement
ati
onher
eisamodi
fi
cat
ionoft
he
basi
cR-
Sfl
i
p-f
lopi
nFi
g.7.
18(
a).Thet
rut
htabl
eoft
hisf
li
p-f
lop,
asgi
veni
nFi
g.7.
22(
b),
issel
f-
expl
anat
ory
.

83|
Page
7.
2 Lev
el-
Tri
gger
edandEdge-
Tri
gger
edFl
ip-
Flops

nal
I evel
-t
ri
gger
edf
li
p-f
lop,
theout
putr
espondst
othedat
apr
esentatt
hei
nput
sdur
ingt
het
imet
he
cl
ockpul
sel
evel
isHI
GH(
orLOW)
.Thati
s,anychangesatt
hei
nputdur
ingt
het
imet
hecl
ocki
sact
ive
(
HIGHorLOW)ar
eref
lect
edatt
heout
putasperi
tsf
unct
iont
abl
e.Thecl
ockedR-
Sfl
i
p-f
lopdescr
ibedi
n
t
hepr
ecedi
ngpar
agr
aphsi
sal
evel
-t
ri
gger
edf
li
p-f
lopt
hati
sact
ivewhent
hecl
ocki
sHI
GH.

nanedge-
I tr
igger
edf
li
p-f
lop,
theout
putr
espondst
othedat
aatt
hei
nput
sonl
yonLOW-
to-
HIGHor
HI
GH-
to-
LOW t
ransi
ti
onoft
hecl
ocksi
gnal
.Thef
li
p-f
lopi
nthet
wocasesi
sref
err
edt
oasposi
ti
veedge

84|
Page
t
ri
gger
edandnegat
iveedget
ri
gger
edr
espect
ivel
y.Anychangesi
nthei
nputdur
ingt
het
imet
hecl
ockpul
se
i
sHI
GH(
orLOW)donothav
eanyef
fectont
heout
put
.Int
hecaseofanedge-
tr
igger
edf
li
p-f
lop,
anedge
det
ect
orci
rcui
ttr
ansf
ormst
hecl
ocki
nputi
ntoav
erynar
rowpul
set
hati
saf
ewnanosecondswi
de.Thi
s
nar
rowpul
secoi
nci
deswi
thei
therLOW-
to-
HIGHorHI
GH-
to-
LOW t
ransi
ti
onoft
hecl
ocki
nput
,dependi
ng
uponwhet
heri
tisaposi
ti
veedge-
tr
igger
edf
li
p-f
loporanegat
iveedge-
tr
igger
edf
li
p-f
lop.Thi
spul
sei
sso
nar
rowt
hatt
heoper
ati
onoft
hef
li
p–f
lopcanbeconsi
der
edt
ohav
eoccur
redont
heedgei
tsel
f.

Fi
gur
e7.
23showst
hecl
ockedR-
Sfl
i
p-f
lopofFi
g.7.
21wi
tht
heedgedet
ect
orbl
ocki
ncor
por
atedi
nthe
cl
ockci
rcui
t.Fi
gur
es7.
24(
a)and(
b)r
espect
ivel
yshowt
ypi
cal
edgedet
ect
orci
rcui
tsf
orposi
ti
veand
negat
iveedget
ri
gger
ing.Thewi
dthoft
henar
rowpul
segener
atedbyt
hisedgedet
ect
orci
rcui
tisequal
to
t
hepr
opagat
iondel
ayoft
hei
nver
ter
.Fi
gur
e7.
25showst
heci
rcui
tsy
mbol
fort
hef
li
p-f
lopofFi
g.7.
23f
or
t
heposi
ti
veedge-
tr
igger
edmode[
Fig.7.
25(
a)]andt
henegat
iveedge-
tr
igger
edmode[
Fig.7.
25(
b)]
.

85|
Page
Fi
gure7.24(a)Posi
ti
veedge-
tr
igger
ededgedetect
orci
rcui
tsand(
b)
negat
iveedge-
tri
gger
ededgedetect
orci
rcui
ts.

86|
Page
Fi
gur
e7.
25(
a)Ci
rcui
tsy
mbol
ofaposi
ti
veedge-
tr
igger
edR-
Sfl
i
p-f
lopand(
b)t
heci
rcui
tsy
mbol
ofanegat
iveedge-
tr
igger
edR-
Sfl
i
p-f
lop.

7.
3 J-
KFl
ip-
Flop

AJ-
Kfl
i
p-f
lopbehav
esi
nthesamef
ashi
onasanR-
Sfl
i
p-f
lopexceptf
oroneoft
heent
ri
esi
nthe
f
unct
iont
abl
e.I
nthecaseofanR-
Sfl
i
p-f
lop,
thei
nputcombi
nat
ionS=R=1(
int
hecaseofaf
li
p-f
lopwi
th
act
iveHI
GHi
nput
s)andt
hei
nputcombi
nat
ionS=R=0(
int
hecaseofaf
li
p-f
lopwi
thact
iveLOW i
nput
s)
ar
epr
ohi
bit
ed.I
nthecaseofaJ-
Kfl
i
p-f
lopwi
thact
iveHI
GHi
nput
s,t
heout
putoft
hef
li
p-f
lopt
oggl
es,
that
i
s,i
tgoest
otheot
herst
ate,
forJ=K=1.Theout
putt
oggl
esf
orJ=K=0i
nthecaseoft
hef
li
p-f
lophav
ing
act
iveLOW i
nput
s.Thus,
aJ-
Kfl
i
p-f
lopov
ercomest
hepr
obl
em ofaf
orbi
ddeni
nputcombi
nat
ionoft
heR-
S
f
li
p-f
lop.Fi
gur
es7.
26(
a)and(
b)r
espect
ivel
yshowt
heci
rcui
tsy
mbol
ofl
evel
-t
ri
gger
edJ-
Kfl
i
p-f
lopswi
th
act
iveHI
GHandact
iveLOW i
nput
s,al
ongwi
tht
hei
rfunct
iont
abl
es.Fi
gur
e7.
27showst
her
eal
i
zat
ionofa
J-
Kfl
i
p-f
lopwi
thanR-
Sfl
i
p-f
lop.

Thechar
act
eri
sti
ctabl
esf
oraJ-
Kfl
i
p-f
lopwi
thact
iveHI
GHJandKi
nput
sandaJ-
Kfl
i
p-f
lopwi
th
act
iveLOW JandKi
nput
sar
erespect
ivel
yshowni
nFi
gs7.
28(
a)and(
b).
Thecor
respondi
ngKar
naugh
mapsar
eshowni
nFi
g.7.
28(
c)f
ort
hechar
act
eri
sti
cst
abl
eofFi
g.7.
28(
a)andi
nFi
g.7.
28(
d)f
ort
he
char
act
eri
sti
ctabl
eofFi
g.7.
28(
b).Thechar
act
eri
sti
cequat
ionsf
ort
heKar
naughmapsofFi
gs7.
28(
c)and
(
d)ar
erespect
ivel
y

87|
Page
88|
Page
Fi
gur
e7.
28

(
a)Character
ist
ictabl
eofaJ- Kfli
p-fl
opwi thacti
veHI
GHi nput
s,(
b)
t
hecharacter
ist
ictabl
eof
aJ-Kfl
ip-
fl
opwi t
hactiveLOW inputs,(c)theK-mapsoluti
onofaJ-K
f
li
p-f
lopwithacti
veHIGHi nput
sand( d)t heK-mapsoluti
onofaJ-K
f
li
p-f
lopwithacti
veLOW inputs.

7.
3.1 J-
KFl
ip-
Flopwi
thPRESETandCLEARI
nput
s

I
tisof
tennecessar
ytocl
earaf
li
p-f
lopt
oal
ogi
c‘0’
stat
e(Qn=0)orpr
eseti
ttoal
ogi
c‘1’
stat
e(Qn=1)
.
Anexampl
eofhowt
hisi
sreal
i
zedi
sshowni
nFi
g.7.
29(
a).Thef
li
p-f
lopi
scl
ear
ed(
thati
s,Qn=0)
whenev
ert
heCLEARi
nputi
s‘0’
andt
hePRESETi
nputi
s‘1’
.Thef
li
p-f
lopi
spr
esett
othel
ogi
c‘1’
stat
e
whenev
ert
hePRESETi
nputi
s‘0’
andt
heCLEARi
nputi
s‘1’
.Her
e,t
heCLEARandPRESETi
nput
sar
eact
ive
whenLOW.Fi
gur
e7.
29(
b)showst
heci
rcui
tsy
mbol
oft
hispr
eset
tabl
e,cl
ear
abl
e,cl
ockedJ-
Kfl
i
p-f
lop.
Fi
gur
e7.
29(
c)showst
hef
unct
iont
abl
eofsuchaf
li
p-f
lop.I
tisev
identf
rom t
hef
unct
iont
abl
ethat
,
89|Page
whenev
ert
hePRESETi
nputi
sact
ive,
theout
putgoest
othe‘
1’st
atei
rr
espect
iveoft
hest
atusoft
hecl
ock,
JandKi
nput
s.Si
mil
arl
y,whent
hef
li
p-f
lopi
scl
ear
ed,
thati
s,t
heCLEARi
nputi
sact
ive,
theout
putgoest
o
t
he‘
0’st
atei
rr
espect
iveoft
hest
atusoft
hecl
ock,
JandKi
nput
s.I
naf
li
p-f
lopoft
hist
ype,
bot
hPRESET
andCLEARi
nput
sshoul
dnotbemadeact
iveatt
hesamet
ime.

90|
Page
7.
3.2 Mast
er–Sl
aveFl
ip-
Flops

Whenev
ert
hewi
dthoft
hepul
secl
ocki
ngt
hef
li
p-f
lopi
sgr
eat
ert
hant
hepr
opagat
iondel
ayoft
hef
li
p-
f
lop,
thechangei
nst
ateatt
heout
puti
snotr
eli
abl
e.I
nthecaseofedge-
tr
igger
edf
li
p-f
lops,
thi
spul
se
wi
dthwoul
dbet
het
ri
ggerpul
sewi
dthgener
atedbyt
heedgedet
ect
orpor
ti
onoft
hef
li
p-f
lopandnott
he
pul
sewi
dthoft
hei
nputcl
ocksi
gnal
.Thi
sphenomenoni
sref
err
edt her
oast acepr
obl
em.Ast
he
pr
opagat
iondel
aysar
enor
mal
l
yver
ysmal
l
,thel
i
kel
i
hoodoft
heoccur
renceofar
acecondi
ti
oni
s
r
easonabl
yhi
gh.Onewayt
ogetov
ert
hispr
obl
em i
stouseamast
er–sl
aveconf
igur
ati
on.
Figur
e7.
30(
a)
showsamast
er–sl
avef
li
p-f
lopconst
ruct
edwi
tht
woJ-
Kfl
i
p-f
lops.Thef
ir
stf
li
p-f
lopi
scal
l
edt
hemast
er
f
li
p-f
lopandt
hesecondi
scal
l
edt
hesl
ave.Thecl
ockt
othesl
avef
li
p-f
lopi
sthecompl
ementoft
hecl
ock
t
othemast
erf
li
p-f
lop.
Whent
hecl
ockpul
sei
spr
esent
,themast
erf
li
p-f
lopi
senabl
edwhi
l
ethesl
avef
li
p-
f
lopi
sdi
sabl
ed.Asar
esul
t,t
hemast
erf
li
p-f
lopcanchangest
atewhi
l
ethesl
avef
li
p-f
lopcannot
.Whent
he
cl
ockgoesLOW,
themast
erf
li
p-f
lopget
sdi
sabl
edwhi
l
ethesl
avef
li
p-f
lopi
senabl
ed.Ther
efor
e,t
hesl
ave
J-
Kfl
i
p-f
lopchangesst
ateaspert
hel
ogi
cst
atesati
tsJandKi
nput
s.

Thecont
ent
soft
hemast
erf
li
p-f
lopar
ether
efor
etr
ansf
err
edt
othesl
avef
li
p-f
lop,
andt
hemast
erf
li
p-
f
lop,
bei
ngdi
sabl
ed,
canacqui
renewi
nput
swi
thoutaf
fect
ingt
heout
put
.Aswoul
dbecl
earf
rom t
he
descr
ipt
ionabov
e,amast
er–sl
avef
li
p-f
lopi
sapul
se-
tr
igger
edf
li
p-f
lopandnotanedge-
tr
igger
edone.

91|
Page
Fi
gur
e7.
30(
b)showst
het
rut
htabl
eofamast
er–sl
aveJ-
Kfl
i
p-f
lopwi
thact
iveLOW PRESETandCLEAR
i
nput
sandact
iveHI
GHJandKi
nput
s.Themast
er–sl
aveconf
igur
ati
onhasbecomeobsol
ete.Thenewer
I
Ctechnol
ogi
essuchas74LS,
74AS,
74ALS,
74HCand74HCTdonothav
emast
er–sl
avef
li
p-f
lopsi
nthei
r
ser
ies.

Exampl
e7.
3
Dr
awt
heci
rcui
tsy
mboloft
hef
li
p-f
lopr
epr
esent
edbyt
hef
unct
iont
abl
ebel
ow.

92|
Page
Sol
uti
on
Thefir
stthreeent r
iesofthef uncti
ontableindicatethattheJ-Kf l
ip-fl
ophasact i
veHIGHPRESETand
CLEARi nputs.Referr
ingtothef ourt
handf i
fthent ri
esoft hefunctiontable,i
thasacti
veLOW JandK
i
nputs.Thesev enthrowoft hef uncti
ontableconf ir
mst his.Theout putrespondstopositi
ve(LOW-to-
HIGH)
edgesoft heclockinput.Thus, t
hefli
p-fl
oprepr esentedbyt hegivenfunctiontabl
eisapr eset
tabl
e,
cl
earabl
e, posit
iveedge-tr
iggeredfli
p-f
lopwi t
hact iveHIGHPRESETandCLEARandact iveLOW JandK
i
nputs.Figurebelowshowst hecircui
tsy mboloft hef l
i
p-f
lopr epr
esent edbythistr
uthtable.

7.
4 Toggl
eFl
ip-
Fl TFl
op( ip-
Flop)

putofat
Theout oggl
efl
i
p-f
lop,
alsocal
l
edaTf
li
p-f
lop,
changesst
ateev
eryt
imei
tist
ri
gger
edati
tsT

93|
Page
i
nput
,cal
l
edt
het
oggl
einput
.Thati
s,t
heout
putbecomes‘
1’i
fitwas‘
0’and‘
0’i
fitwas‘
1’
.Fi
gur
es7.
34(
a)
and(
b)r
espect
ivel
yshowt
heci
rcui
tsy
mbol
sofposi
ti
veedge-
tr
igger
edandnegat
iveedge-
tr
igger
edTf
li
p-
f
lops,
alongwi
tht
hei
rfunct
iont
abl
es.I
fweconsi
dert
heTi
nputasact
ivewhenHI
GH,
thechar
act
eri
sti
c
t
abl
eofsuchaf
li
p-f
lopi
sshowni
nFi
g.7.
34(
c).I
ftheTi
nputwer
eact
ivewhenLOW,
thent
he
char
act
eri
sti
ctabl
ewoul
dbeasshowni
nFi
g.7.
34(
d).TheKar
naughmapsf
ort
hechar
act
eri
sti
ctabl
esof
Fi
gs7.
34(
c)and(
d)ar
eshowni
nFi
gs7.
34(
e)and(
f)r
espect
ivel
y.Thechar
act
eri
sti
cequat
ionsaswr
it
ten
f
rom t
heKar
naughmapsar
easf
oll
ows:

I
tisobv
iousf
rom t
heoper
ati
onal
pri
nci
pleoft
heTf
li
p-f
lopt
hatt
hef
requencyoft
hesi
gnal
att
heQ
out
puti
shal
fthef
requencyoft
hesi
gnal
appl
i
edatt
heTi
nput
.Acascadedar
rangementofnTf
li
p-f
lops,
wher
etheout
putofonef
li
p-f
lopi
sconnect
edt
otheTi
nputoft
hef
oll
owi
ngf
li
p-f
lop,
canbeusedt
odi
vi
de
t
hei
nputsi
gnal
frequencybyaf orof2n.Fi
act gur
e7.
35showsadi
vi
de-
by-
16ci
rcui
tbui
l
tar
ounda
cascadedar
rangementoff
ourTf
li
p-f
lops.

94|
Page
Fi
gure7.34( a)Posi
ti
veedge-t
ri
gger
edtoggl
efli
p-f
lop,
(b)anegati
veedge-t
ri
ggeredtoggl
efl
ip-
fl
op,
(c,
d)char
act
eri
sti
ctabl
es
ofl
evel
-t
riggeredt
ogglef
li
p-f
lopsand(e,
f)Kar
naughmapsf orchar
acter
ist
ictabl
es(c,d).

7.
4.1 J-
KFl
i
p-Fl
opasaToggl
eFl
ip-
Flop

I
fwer
ecal
lthef
unct
iont
abl
eofaJ-
Kfl
i
p-f
lop,
wewi
l
lseet
hat
,whenbot
hJandKi
nput
soft
hef
li
p-f
lop
ar
eti
edt
othei
ract
ivel
evel
(‘1’
lev
eli
fJandKar
eact
ivewhenHI
GH,
and‘
0’l
evel
whenJandKar
eact
ive
whenLOW)
,thef
li
p-f
lopbehav
esl
i
keat
oggl
efl
i
p-f
lop,
wit
hit
scl
ocki
nputser
vingast
heTi
nput
.Inf
act
,
t
heJ-
Kfl
i
p-f
lopcanbeusedt
oconst
ructanyot
herf
li
p-f
lop.Thati
swhyi
tisal
sosomet
imesr
efer
redt
oas
auni
ver
salf
li
p-f
lop.Fi
gur
e7.
36showst
heuseofaJ-
Kfl
i
p-f
lopasaTf
li
p-f
lop.

95|
Page
7.
5 DFl
ip-
Flop

ADf
li
p-f
lop,
al edadel
socal
l ayf
li
p-f
lop,
canbeusedt
opr
ovi
det
empor
aryst
orageofonebi
tof
i
nfor
mat
ion.Fi
gur
e7.
39(
a)showst
heci
rcui
tsy
mbol
andf
unct
iont
abl
eofanegat
iveedge-
tr
igger
edDf
li
p-
f
lop.Whent
hecl
ocki
sact
ive,
thedat
abi
t(0or1)pr
esentatt
heDi
nputi
str
ansf
err
edt
otheout
put
.Int
he
Df
li
p-f
lopofFi
g.7.
39,
thedat
atr
ansf
erf
rom Di
nputt
oQout
putoccur
sont
henegat
ive-
goi
ng(
HIGH-
to-
LOW)t
ransi
ti
onoft
hecl
ocki
nput
.TheDi
nputcanacqui
renewst
atuswhent
hecl
ocki
sinact
ive,
whi
chi
s
t
het
imeper
iodbet
weensuccessi
veHI
GH-
to-
LOW t
ransi
ti
ons.TheDf
li
p-f
lopcanpr
ovi
deamaxi
mum del
ay
ofonecl
ockper
iod.Thechar
act
eri
sti
ctabl
eandt
hecor
respondi
ngKar
naughmapf
ort
heDf
li
p-f
lopofFi
g.
7.
39(
a)ar
eshowni
nFi
gs7.
39(
c)and(
d)r
espect
ivel
y.Thechar
act
eri
sti
cequat
ioni
sasf
oll
ows:

96|
Page
7.
5.1 J-
KFl
i
p-Fl
opasDFl
ip-
Flop

Fi
gur
e7.
40showshowaJ-
Kfl
i
p-f
lopcanbeusedasaDf
li
p-f
lop.Whent
heDi
nputi
sal
ogi
c‘1’
,t
heJ
andKi
nput
sar
eal
ogi
c‘1’
and‘
0’r
espect
ivel
y.Accor
dingt
othef
unct
iont
abl
eoft
heJ-
Kfl
i
p-f
lop,
under
t
hesei
nputcondi
ti
ons,
theQout
putwi
l
lgot
othel
ogi
c‘1’
stat
ewhencl
ocked.Al
so,
whent
heDi
nputi
sa
l
ogi
c‘0’
,t
heJandKi
nput
sar
eal
ogi
c‘0’
and‘
1’r
espect
ivel
y.Agai
n,accor
dingt
othef
unct
iont
abl
eoft
heJ-
Kf
li
p-f
lop,
undert
hesei
nputcondi
ti
ons,
theQout
putwi
l
lgot
othel
ogi
c‘0’
stat
ewhencl
ocked.Thus,
in
bot
hcases,
theDi
nputi
spassedont
otheout
putwhent
hef
li
p-f
lopi
scl
ocked.

97|
Page
7.
5.2 DLat
ch

I
naDl
atch,
theout
putQf
oll
owst
heDi
nputasl
ongast
hecl
ocki
nput(
alsocal
l
edt
heENABLEi
nput
)is
HI
GHorLOW,
dependi
ngupont
hecl
ockl
evel
towhi
chi
tresponds.Whent
heENABLEi
nputgoest
othe
i
nact
ivel
evel
,theout
puthol
dsont
othel
ogi
cst
atei
twasi
njustpr
iort
otheENABLEi
nputbecomi
ng
i
nact
ivedur
ingt
heent
ir
eti
meper
iodt
heENABLEi
nputi
sinact
ive.

ADf
li
p-f
lopshoul
dnotbeconf
usedwi
thaDl
atch.I
naDf
li
p-f
lop,
thedat
aont
heDi
nputar
e
t
ransf
err
edt
otheQout
putont
heposi
ti
ve-ornegat
ive-
goi
ngt
ransi
ti
onoft
hecl
ocksi
gnal
,dependi
ngupon
t
hef
li
p-f
lop,
andt
hisl
ogi
cst
atei
shel
datt
heout
putunt
ilwegett
henextef
fect
ivecl
ockt
ransi
ti
on.The
di
ff
erencebet
weent
het
woi
sfur
theri
l
lust
rat
edi
nFi
gs7.
41(
a)and(
b)depi
cti
ngt
hef
unct
ioni
ngofaD
l
atchandaDf
li
p-f
lopr
espect
ivel
y.

98|
Page
7.
6 Sy
nchr
onousandAsy
nchr
onousI
nput
s

Mostf
li
p-f
lopshav
ebot
hsy
nchr
onousandasy
nchr
onousi
nput
s.Sy
nchr
onousi
nput
sar
ethosewhose
ef
fectont
hef
li
p-f
lopout
puti
ssy
nchr
oni
zedwi
tht
hecl
ocki
nput
.R,
S,J,
KandDi
nput
sar
eal
lsy
nchr
onous
i
nput
s.Asy
nchr
onousi
nput
sar
ethoset
hatoper
atei
ndependent
lyoft
hesy
nchr
onousi
nput
sandt
hei
nput

99|
Page
cl
ocksi
gnal
.Thesear
einf
actov
err
idei
nput
sast
hei
rst
atusov
err
idest
hest
atusofal
lsy
nchr
onousi
nput
s
andal
sot
hecl
ocki
nput
.Theyf
orcet
hef
li
p-f
lopout
putt
ogot
oapr
edef
inedst
atei
rr
espect
iveoft
hel
ogi
c
st
atusoft
hesy
nchr
onousi
nput
s.PRESETandCLEARi
nput
sar
eexampl
esofasy
nchr
onousi
nput
s.When
act
ive,
thePRESETandCLEARi
nput
spl
acet
hef
li
p-f
lopQout
puti
nthe‘
1’and‘
0’st
ater
espect
ivel
y.Usual
l
y,
t
hesear
eact
iveLOW i
nput
s.Wheni
tisdesi
redt
hatt
hef
li
p-f
lopf
unct
ionsaspert
hest
atusofi
ts
sy
nchr
onousi
nput
s,t
heasy
nchr
onousi
nput
sar
ekepti
nthei
rinact
ivest
ate.Al
so,
bot
hasy
nchr
onous
i
nput
s,i
fav
ail
abl
eonagi
venf
li
p-f
lop,
arenotmadeact
ivesi
mul
taneousl
y.

7.
7 Fl
ip-
FlopAppl
icat
ions

Fl
i
p-f
lopsar
eusedi
nav
ari
etyofappl
i
cat
ionci
rcui
ts,
themostcommonamongt
hesebei
ngt
he
f
requencydi
vi
sionandcount
ingci
rcui
tsanddat
ast
orageandt
ransf
erci
rcui
ts.Bot
htheseappl
i
cat
ionsuse
acascadedar
rangementoff
li
p-f
lopswi
thorwi
thoutsomeaddi
ti
onal
combi
nat
ional
logi
ctoper
for
mthe
desi
redf
unct
ion.Count
ersandr
egi
ster
sar
eav
ail
abl
einI
Cfor
mforav
ari
etyofdi
git
alci
rcui
tappl
i
cat
ions.
Ot
herappl
i
cat
ionsoff
li
p-f
lopsi
ncl
udet
hei
rusef
orswi
tchdebounci
ng,
wher
eev
enanuncl
ockedf
li
p-f
lop
(
suchasaNANDoraNORl
atch)canbeused,
forsy
nchr
oni
zi
ngasy
nchr
onousi
nput
swi
tht
hecl
ocki
nput
andf
ori
dent
if
icat
ionofedgesofsy
nchr
onousi
nput
s.Thesear
ebr
ief
lydescr
ibedi
nthef
oll
owi
ng
par
agr
aphs.

7.
7.1 Swi
tchDebounci
ng

Owi
ngt
otheswi
tchbouncephenomenon,
themechani
cal
swi
tchcannotbeusedassucht
opr
oducea
cl
eanv
olt
aget
ransi
ti
on.Ref
ert
oFi
g.7.
47(
a).Whent
heswi
tchi
smov
edf
rom posi
ti
on1t
oposi
ti
on2,
what
i
sdesi
redatt
heout
puti
sacl
eanv
olt
aget
ransi
ti
onf
rom 0t
o+Vv
olt
s,asshowni
nFi
g.7.
47(
b).What
act
ual
l
yhappensi
sshowni
nFi
g.7.
47(
c).Theout
putmakessev
eral
transi
ti
onsbet
ween0and+Vv
olt
sfor
af
ewmi
l
li
secondsowi
ngt
ocont
actbouncebef
orei
tfi
nal
l
yset
tl
esat+Vv
olt
s.Si
mil
arl
y,wheni
tismov
ed
f
rom posi
ti
on2backt
oposi
ti
on1,
itmakessev
eral
transi
ti
onsbef
orecomi
ngt
orestat0V.Al
thought
his
r
andom behav
iourl
ast
sonl
yforaf
ewmi
l
li
seconds,
iti
sunaccept
abl
eformanydi
git
alci
rcui
tappl
i
cat
ions.
ANANDoraNORl
atchcansol
vet
hispr
obl
em andpr
ovi
deacl
eanout
putt
ransi
ti
on.Fi
gur
e7.
48showsa
t
ypi
cal
swi
tchdebounceci
rcui
tbui
l
tar
oundaNANDl
atch.Theci
rcui
tfunct
ionsasf
oll
ows.

100|Page
Whent
heswi
tchi
sinposi
ti
on1,
theout
puti
sata‘
0’l
evel
.Wheni
tismov
edt
oposi
ti
on2,
theout
put
goest
oa‘
1’l
evel
wit
hinaf
ewnanoseconds(
dependi
ngupont
hepr
opagat
iondel
ayoft
heNANDgat
e)
af
teri
tsf
ir
stcont
actwi
thposi
ti
on2.Whent
heswi
tchcont
actbounces,
itmakesandbr
eakscont
actwi
th
posi
ti
on2bef
orei
tfi
nal
l
yset
tl
esatt
hei
ntendedposi
ti
on.Maki
ngofcont
actal
way
sleadst
oa‘
1’l
evel
at
t
heout
put
,andbr
eaki
ngofcont
actal
sol
eadst
oa‘
1’l
evel
att
heout
putowi
ngt
othef
actt
hatt
hecont
act
br
eakpr
oducesa‘
1’l
evel
atbot
hinput
soft
hel
atchwhi
chf
orcest
heout
putt
ohol
dit
sexi
sti
ngl
ogi
cst
ate.
Thef
actt
hatwhent
heswi
tchi
sbr
oughtbackt
oposi
ti
on1t
heout
putmakesaneatt
ransi
ti
ont
oa‘
0’l
evel

101|Page
canbeexpl
ainedonsi
mil
arl
i
nes.

7.
7.2 Fl
ip-
FlopSy
nchr
oni
zat
ion

Consi
derasi
tuat
ionwher
eacer
tai
ncl
ocki
nput
,whi
chwor
ksi
nconj
unct
ionwi
thv
ari
oussy
nchr
onous
i
nput
s,i
stobegat
edwi
thanasy
nchr
onousl
ygener
atedgat
ingpul
se,
asshowni
nFi
g.7.
49.Theout
puti
n
t
hiscasehast
hecl
ockpul
sesatoneorbot
hendsshor
tenedi
nwi
dth,
asshowni
nFi
g.7.
49.Thi
spr
obl
em
canbeov
ercomeandt
hegat
ingoper
ati
onsy
nchr
oni
zedwi
tht
hehel
pofaf
li
p-f
lop,
asshowni
nFi
g.7.
50.

102|Page
7.
7.3 Det
ect
ingt
heSequenceofEdges

Fl
i
p-f
lopscanal
sobeusedt
odet
ectt
hesequenceofoccur
renceofr
isi
ngandf
all
i
ngedges.Fi
gur
e7.
51
showshowaf
li
p-f
lopcanbeusedt
odet
ectwhet
heraposi
ti
ve-
goi
ngedgeAf
oll
owsorpr
ecedesanot
her
posi
ti
ve-
goi
ngedgeB.Thet
woedgesar
erespect
ivel
yappl
i
edt
oDandcl
ocki
nput
sofaposi
ti
vel
yedge-
t
ri
gger
edDf
li
p-f
lop.I
fedgeAar
ri
vesf
ir
st,
then,
onar
ri
val
ofedgeB,
theout
putgoesf
rom 0t
o1.I
fiti
s
ot
her
wise,
itst
aysata‘
0’l
evel
.

CHAPTER8

COUNTERSANDREGI
STERS
Count
ersandr
egi
ster
sbel
ongt
othecat
egor
yofMSIsequent
ial
logi
cci
rcui
ts.Theyhav
esi
mil
ar
ar
chi
tect
ure,
asbot
hcount
ersandr
egi
ster
scompr
iseacascadedar
rangementofmor
ethanonef
li
p-f
lop
wi
thorwi
thoutcombi
nat
ional
logi
cdev
ices.Bot
hconst
it
utev
eryi
mpor
tantbui
l
dingbl
ocksofsequent
ial
l
ogi
c,anddi
ff
erentt
ypesofcount
erandr
egi
sterav
ail
abl
eini
ntegr
atedci
rcui
t(I
C)f
orm ar
eusedi
nawi
de
r
angeofdi
git
alsy
stems.Whi
l
ecount
ersar
emai
nlyusedi
ncount
ingappl
i
cat
ions,
wher
etheyei
ther

103|Page
measur
ethet
imei
nter
val
bet
weent
wounknownt
imei
nst
ant
sormeasur
ethef
requencyofagi
vensi
gnal
,
r
egi
ster
sar
epr
imar
il
yusedf
ort
het
empor
aryst
orageofdat
apr
esentatt
heout
putofadi
git
alci
rcui
t
bef
oret
heyar
efedt
oanot
herdi
git
alci
rcui
t.Wear
eal
lfami
l
iarwi
tht
her
oleofdi
ff
erentt
ypesofr
egi
ster
usedi
nsi
deami
cropr
ocessor
,andal
sot
hei
rusei
nmi
cropr
ocessor
-basedappl
i
cat
ions.

Becauseoft
hev
erynat
ureofoper
ati
onofr
egi
ster
s,t
heyf
ormt
hebasi
sofav
eryi
mpor
tantcl
assof
count
er edshi
scal
l ftcount
ers.I
nthi
schapt
er,
wewi
l
ldi
scussdi
ff
erentt
ypesofcount
erandr
egi
steras
r
egar
dst
hei
roper
ati
onal
basi
cs,
desi
gnmet
hodol
ogyandappl
i
cat
ion-
rel
evantaspect
s.Desi
gnaspect
s
hav
ebeenadequat
elyi
l
lust
rat
edwi
tht
hehel
pofal
argenumberofsol
vedexampl
es.Acompr
ehensi
ve
f
unct
ional
indexofal
argenumberofi
ntegr
atedci
rcui
tcount
ersandr
egi
ster
sisgi
vent
owar
dst
heendof
t
hechapt
er.

8.
1 Ri
ppl
e(Asy
nchr
onous)Count
er

Ar
ippl
ecount
eri
sacascadedar
rangementoff
li
p-f
lopswher
etheout
putofonef
li
p-f
lopdr
ivest
he
cl
ocki
nputoft
hef
oll
owi
ngf
li
p-f
lop.Thenumberoff
li
p-f
lopsi
nthecascadedar
rangementdependsupon
t
henumberofdi
ff
erentl
ogi
cst
atest
hati
tgoest
hroughbef
orei
trepeat
sthesequence,
apar
amet
erknown
ast
hemodul
usoft
hecount
er.

I
nar
ippl
ecount
er,
al edanasy
socal
l nchr
onouscount
eroraser
ialcount
er,
thecl
ocki
nputi
sappl
i
ed
onl
ytot
hef
ir
stf
li
p-f
lop,
alsocal
l
edt
hei
nputf
li
p-f
lop,
int
hecascadedar
rangement
.Thecl
ocki
nputt
oany
subsequentf
li
p-f
lopcomesf
rom t
heout
putofi
tsi
mmedi
atel
ypr
ecedi
ngf
li
p-f
lop.Fori
nst
ance,
theout
put
oft
hef
ir
stf
li
p-f
lopact
sast
hecl
ocki
nputt
othesecondf
li
p-f
lop,
theout
putoft
hesecondf
li
p-f
lopf
eeds
t
hecl
ocki
nputoft
het
hir
dfl
i
p-f
lopandsoon.I
ngener
al,
inanar
rangementofnf
li
p-f
lops,
thecl
ocki
nput
t
othent
hfl
i
p-f
lopcomesf
rom t
heout
putoft
he(
n−1)
thf
li
p-f
lopf
orn>1.

Fi
gur
e8.
1showst
hegener
ali
zedbl
ockschemat
icar
rangementofann-
bitbi
nar
yri
ppl
ecount
er.Asa
nat
ural
consequenceoft
his,
notal
lfl
i
p-f
lopschangest
ateatt
hesamet
ime.Thesecondf
li
p-f
lopcan
changest
ateonl
yaf
tert
heout
putoft
hef
ir
stf
li
p-f
lophaschangedi
tsst
ate.Thati
s,t
hesecondf
li
p-f
lop
woul
dchangest
ateacer
tai
nti
medel
ayaf
tert
heoccur
renceoft
hei
nputcl
ockpul
seowi
ngt
othef
actt
hat
i
tget
sit
sowncl
ocki
nputf
rom t
heout
put

104|Page
oft
hef
ir
stf
li
p-f
lopandnotf
rom t
hei
nputcl
ock.Thi
sti
medel
ayher
eequal
sthesum ofpr
opagat
iondel
ays
oft
wof
li
p-f
lops,
thef
ir
standt
hesecondf
li
p-f
lops.I
ngener
al,
thent
hfl
i
p-f
lopwi
l
lchangest
ateonl
yaf
tera
del
ayequal
tont
imest
hepr
opagat
iondel
ayofonef
li
p-f
lop.Thet
erm‘
ri
ppl
ecount
er’
comesf
rom t
he
modei
nwhi
cht
hecl
ocki
nfor
mat
ionr
ippl
est
hrought
hecount
er.I
tisal
socal
l
edan‘
asy
nchr
onouscount
er’
asdi
ff
erentf
li
p-f
lopscompr
isi
ngt
hecount
erdonotchangest
atei
nsy
nchr
oni
zat
ionwi
tht
hei
nputcl
ock.

I
nacount
erl
i
ket
his,
aft
ert
heoccur
renceofeachcl
ocki
nputpul
se,
thecount
erhast
owai
tforat
ime
per
iodequal
tot
hesum ofpr
opagat
iondel
aysofal
lfl
i
p-f
lopsbef
oret
henextcl
ockpul
secanbeappl
i
ed.
Thepr
opagat
iondel
ayofeachf
li
p-f
lop,
ofcour
se,
wil
ldependupont
hel
ogi
cfami
l
ytowhi
chi
tbel
ongs.

8.
1.1 Pr
opagat
ionDel
ayi
nRi
ppl
eCount
ers

Amaj
orpr
obl
em wi
thr
ippl
ecount
ersar
isesf
rom t
hepr
opagat
iondel
ayoft
hef
li
p-f
lopsconst
it
uti
ngt
he
count
er.Asment
ionedi
nthepr
ecedi
ngpar
agr
aphs,
theef
fect
ivepr
opagat
iondel
ayi
nar
ippl
ecount
eri
s
equal
tot
hesum ofpr
opagat
iondel
aysduet
odi
ff
erentf
li
p-f
lops.Thesi
tuat
ionbecomeswor
sewi
th
i
ncr
easei
nthenumberoff
li
p-f
lopsusedt
oconst
ructt
hecount
er,
whi
chi
sthecasei
nlar
gerbi
tcount
ers.
Comi
ngbackt
other
ippl
ecount
er,
ani
ncr
easedpr
opagat
iondel
ayput
sal
i
mitont
hemaxi
mum f
requency
usedascl
ocki
nputt
othecount
er.Wecanappr
eci
atet
hatt
hecl
ocksi
gnal
timeper
iodmustbeequal
toor
gr
eat
ert
hant
het
otal
propagat
iondel
ay.Themaxi
mum cl
ockf
requencyt
her
efor
ecor
respondst
oat
ime
per
iodt
hatequal
sthet
otal
propagat
iondel
ay.I
ftpdi
sthepr
opagat
iondel
ayi
neachf
li
p-f
lop,
then,
ina
count
erwi
thNf
li
p-f
lopshav
ingamodul
usofl
esst
hanorequal
to2N,
themaxi
mum usabl
ecl
ockf
requency
i
sgi
venbyf
max=1/
(N×t
pd)
.Of
ten,
twopr
opagat
iondel
ayt
imesar
especi
fi
edi
nthecaseoff
li
p-f
lops,
one
f
orLOW-
to-
HIGHt
ransi
ti
on(
tpLH)andt
heot
herf
orHI
GH-
to-
LOW t
ransi
ti
on(
tpHL)
att
heout
put
.Insucha
case,
thel
argeroft
het
woshoul
dbeconsi
der
edf
orcomput
ingt
hemaxi
mum cl
ockf
requency
.

105|Page
Asanexampl
e,i
nthecaseofar
ippl
ecount
erI
Cbel
ongi
ngt
othel
ow-
powerSchot
tkyTTL(
LSTTL)
f
ami
l
y,t
hepr
opagat
iondel
ayperf
li
p-f
lopt
ypi
cal
l
yisoft
heor
derof25ns.Thi
simpl
i
est
hataf
our
-bi
tri
ppl
e
count
erf
rom t
hisl
ogi
cfami
l
ycannotbecl
ockedf
ast
ert
han10MHz.Theupperl
i
mitont
hecl
ock
f
requencyf
urt
herdecr
easeswi
thi
ncr
easei
nthenumberofbi
tst
obehandl
edbyt
hecount
er.

8.
2 Sy
nchr
onousCount
er

nasy
I nchr
onouscount
er,
alsoknownasapar
all
elcount
er,
all
thef
li
p-f
lopsi
nthecount
erchangest
ate
att
hesamet
imei
nsy
nchr
oni
sm wi
tht
hei
nputcl
ocksi
gnal
.Thecl
ocksi
gnal
int
hiscasei
ssi
mul
taneousl
y
appl
i
edt
othecl
ocki
nput
sofal
lthef
li
p-f
lops.Thedel
ayi
nvol
vedi
nthi
scasei
sequal
tot
hepr
opagat
ion
del
ayofonef
li
p-f
loponl
y,i
rr
espect
iveoft
henumberoff
li
p-f
lopsusedt
oconst
ructt
hecount
er.I
not
her
wor
ds,
thedel
ayi
sindependentoft
hesi
zeoft
hecount
er.

8.
3 Modul
usofaCount
er

Themodul
us(
MODnumber
)ofacount
eri
sthenumberofdi
ff
erentl
ogi
cst
atesi
tgoest
hroughbef
ore
i
tcomesbackt
othei
nit
ial
stat
etor
epeatt
hecountsequence.Ann-
bitcount
ert
hatcount
sthr
oughal
li
ts
nat
ural
stat
esanddoesnotski
panyoft
hest
at usof2n.Wecanseet
eshasamodul hatsuchcount
ers
hav
eamodul
ust
hati
sani
ntegr
alpowerof2,
thati
s,2,
4,8,
16andsoon.Thesecanbemodi
fi
edwi
tht
he
hel
pofaddi
ti
onal
combi
nat
ional
logi
ctogetamodul
usofl han2n.
esst

Todet
ermi
net
henumberoff
li
p-f
lopsr
equi
redt
obui
l
dacount
erhav
ingagi
venmodul
us,
ident
if
ythe
smal
l
esti
ntegerm t
hati
sei
therequal
toorgr
eat
ert
hant
hedesi
redmodul
usandi
sal
soequal
toan
i
ntegr
alpowerof2.Fori
nst
ance,
ift
hedesi
redmodul
usi
s10,
whi
chi
sthecasei
nadecadecount
er,
the
smal
l
esti
ntegergr
eat
ert
hanorequal
to10andwhi
chi
sal
soani
ntegr
alpowerof2i
s16.Thenumberof
f
li
p-f
lopsi
nthi
scasewoul as16=24.Ont
dbe4, hesamel
i
nes,
thenumberoff
li
p-f
lopsr
equi
redt
o
const
ructcount
erswi
thMODnumber
sof3,
6,14,
28and63woul
dbe2,
3,4,
5and6r
espect
ivel
y.I
n
gener
al,
thear
rangementofami
nimum numberofNf
li
p-f
lopscanbeusedt
oconst
ructanycount
erwi
tha
modul
usgi
venbyt
heequat
ion

8.
4 Bi
nar
yRi
ppl
eCount
er–Oper
ati
onalBasi
cs

Theoper
ati
onofabi
nar
yri
ppl
ecount
ercanbebestexpl
ainedwi
tht
hehel
pofat
ypi
cal
count
eroft
his
t
ype.Fi
gur
e8.
2(a)showsaf
our
-bi
tri
ppl
ecount
eri
mpl
ement
edwi
thnegat
iveedge-
tr
i edJ-
gger Kfl
i
p-f
lops
wi
redast
oggl
efl
i
p-f
lops.Theout
putoft
hef
ir
stf
li
p-f
lopf
eedst
hecl
ocki
nputoft
hesecond,
andt
he
out
putoft
hesecondf
li
p-f
lopf
eedst
hecl
ocki
nputoft
het
hir
d,t
heout
putofwhi
chi
ntur
nfeedst
hecl
ock
i
nputoft
hef
our
thf
li
p-f
lop.Theout
put
soft
hef
ourf
li
p-f
lopsar
edesi
gnat
edasQ0(
LSBf
li
p-f
lop)
,Q1,
Q2and

106|Page
Q3(
MSBf
li
p-f
lop)
.Fi
gur
e8.
2(b)showst
hewav
efor
msappear
ingatQ0,
Q1,
Q2andQ3out
put
sast
hecl
ock
si
gnal
goest
hroughsuccessi
vecy
clesoft
ri
ggerpul
ses.Thecount
erf
unct
ionsasf
oll
ows.

Letusassumet
hatal
lthef
li
p-f
lopsar
eini
ti
all
ycl
ear
edt
othe‘
0’st
ate.OnHI
GH-
to-
LOW t
ransi
ti
onof
t
hef
ir
stcl
ockpul
se,
Q0goesf
rom ‘
0’t
o‘1’
owi
ngt
othet
oggl
i
ngact
ion.Ast
hef
li
p-f
lopsusedar
enegat
ive
edge-
tr
igger
edones,
the‘
0’t
o‘1’
transi
ti
onofQ0doesnott
ri
ggerf
li
p-f
lopFF1.FF1,
alongwi
thFF2andFF3,
r
emai
nsi
nit
s‘0’
stat
e.So,
ont
heoccur
renceoft
hef
ir
stnegat
ive-
goi
ngcl
ockt
ransi
ti
on,
Q0=1,
Q1=0,
Q2=
0andQ3=0.

107|Page
Ont
heHI
GH-
to-
LOW t
ransi
ti
onoft
hesecondcl
ockpul
se,
Q0t
oggl
esagai
n.Thati
s,i
tgoesf
rom ‘
1’t
o

0’
.Thi
s‘1’
to‘
0’t
ransi
ti
onatt
heQ0out
putt
ri
gger
sFF1,
theout
putQ1ofwhi
chgoesf
rom ‘
0’t
o‘1’
.TheQ2
andQ3out
put
sremai
nunaf
fect
ed.Ther
efor
e,i
mmedi
atel
yaf
tert
heoccur
renceoft
hesecondHI
GH-
to-
LOW t
ransi
ti
onoft
hecl
ocksi
gnal
,Q0=0,
Q1=1,
Q2=0andQ3=0.Onsi
mil
arl
i
nes,
wecanexpl
aint
hel
ogi
c
st
atusofQ0,
Q1,
Q2andQ3out
put
simmedi
atel
yaf
tersubsequentcl
ockt
ransi
ti
ons.Thel
ogi
cst
atusof
out
put
sfort
hef
ir
st16r
elev
ant(
HIGH-
to-
LOW i
nthepr
esentcase)cl
ocksi
gnal
transi
ti
onsi
ssummar
ized
i
nTabl
e11.
1.

Thus,
weseet
hatt
hecount
ergoest
hrough16di
sti
nctst
atesf
rom 0000t
o1111andt
hen,
ont
he
occur
renceoft
hedesi
redt
ransi
ti
onoft
hesi
xteent
hcl
ockpul
se,
itr
eset
stot
heor
igi
nal
stat
eof0000f
rom
wher
eithadst
art
ed.I
ngener
al,
ifwehadNf
li
p-f
lops,
wecoul o2N pul
dcountupt sesbef
oret
hecount
er
r
eset
stot
hei
nit
ial
stat
e.Wecanal
soseef
rom t
heQ0,
Q1,
Q2andQ3wav
efor
ms,
asshowni
nFi
g.8.
2(b)
,
t
hatt
hef
requenci
esoft
heQ0,
Q1,
Q2andQ3wav
efor
msar
ef/
2,f
/4,
f/8andf
/16r
espect
ivel
y.Her
e,fi
sthe
f
requencyoft
hecl
ocki
nput
.Thi
simpl
i
est
hatacount
eroft
hist
ypecanbeusedasadi
vi
de-
by2N ci
- rcui
t,
wher
eNi
sthenumberoff
li
p-f
lopsi
nthecount
erchai
n.I
nfact
,suchacount
erpr
ovi
desf
requency
-di
vi
ded
out
put
soff
/2N ,
f/2N−1,
f/2N−2,
f/2N−3,
___,
f/2att
heout
put
soft
heNt
h,(
N−1)
th,
(N−2)
th,
(N−3)
th,
___,
f
ir
stf
li
p-f
lops.I
nthecaseofaf
our
-bi
tcount
eroft
het
ypeshowni
nFi
g.8.
2(a)
,out
put
sar
eav
ail
abl
eatf
/2
f
rom t
heQ0out
put
,atf
/4f
rom t
heQ1out
put
,atf
/8f
rom t
heQ2out
putandatf
/16f
rom t
heQ3out
put
.It
maybenot
edt
hatf
requencydi
vi
sioni
soneoft
hemaj
orappl
i
cat
ionsofcount
ers.

108|Page
Fur
therr
eadi
ng:

Bi
nar
yRi
ppl
eCount
erswi
thaModul
usofLesst
han2N
Sy
nchr
onous(
orPar
all
elCount
ers)
UpdownCount
ers
Pr
eset
abl
ecount
erset
c

8.
5 Shi
ftRegi
ster

Ashi
ftr
egi
steri
sadi
git
aldev
iceusedf
orst
orageandt
ransf
erofdat
a.Thedat
atobest
oredcoul
dbe
t
hedat
aappear
ingatt
heout
putofanencodi
ngmat
ri
xbef
oret
heyar
efedt
othemai
ndi
git
alsy
stem f
or
pr
ocessi
ngort
heymi
ghtbet
hedat
apr
esentatt
heout
putofami
cropr
ocessorbef
oret
heyar
efedt
othe
dr
iverci
rcui
tr
yoft
heout
putdev
ices.Theshi
ftr
egi
stert
husf
ormsani
mpor
tantl
i
nkbet
weent
hemai
n
di
git
alsy
stem andt
hei
nput
/out
putchannel
s.Theshi
ftr
egi
ster
scanal
sobeconf
igur
edt
oconst
ructsome
speci
alt
ypesofcount
ert
hatcanbeusedt
oper
for
m anumberofar
it
hmet
icoper
ati
onssuchas
subt
ract
ion,
mul
ti
pli
cat
ion,
div
isi
on,
compl
ement
ati
on,
etc.Thebasi
cbui
l
dingbl
ocki
nal
lshi
ftr
egi
ster
sis
t
hef
li
pfl
op,
mai
nlyaD-
typef
li
p-f
lop.Al
thoughi
nmanyoft
hecommer
cial
shi
ftr
egi
sterI
Cst
hei
rint
ernal
ci
rcui
tdi
agr
am mi
ghti
ndi
cat
etheuseofR-
Sfl
i
p-f
lops,
acar
eful
exami
nat
ionwi
l
lrev
eal
t heseR-
hatt Sfl
i
p-
f
lopshav
ebeenwi
redasDf
li
p-f
lopsonl
y.

Thest
oragecapaci
tyofashi
ftr
egi
sterequal
sthet
otal
numberofbi
tsofdi
git
aldat
aitcanst
ore,
whi
ch
i
ntur
ndependsupont
henumberoff
li
p-f
lopsusedt
oconst
ructt
heshi
ftr
egi
ster
.Si
nceeachf
li
p-f
lopcan
st
oreonebi
tofdat
a,t
hest
oragecapaci
tyoft
heshi
ftr
egi
sterequal
sthenumberoff
li
p-f
lopsused.Asan
exampl
e,t
hei
nter
nal
archi
tect
ureofanei
ght
-bi
tshi
ftr
egi
sterwi
l
lhav
eacascadear
rangementofei
ghtf
li
p-
f
lops.

Basedont
hemet
hodusedt
oloaddat
aont
oandr
eaddat
afr
om shi
ftr
egi
ster
s,t
heyar
ecl
assi
fi
edas
ser
ial
-i
nser
ial
-out(
SISO)shi
ftr
egi
ster
s,ser
ial
-i
npar
all
el-
out(
SIPO)shi
ftr
egi
ster
s,par
all
el-
inser
ial
-out
(
PISO)shi
ftr
egi
ster
sandpar
all
el-
inpar
all
el-
out(
PIPO)shi
ftr
egi
ster
s.Fi
gur
e8.
34showsaci
rcui
t
r
epr
esent
ati
onoft
heabov
e-ment
ionedf
ourt
ypesofshi
ftr
egi
ster
.

109|Page
8.
5.1Ser
ial
-I
nSer
ial
-OutShi
ftRegi
ster

Fi
gur
e8.
35showst
hebasi
cfour
-bi
tser
ial
-i
nser
ial
-outshi
ftr
egi
steri
mpl
ement
edusi
ngDf
li
p-f
lops.
Theci
rcui
tfunct
ionsasf
oll
ows.Ar
esetappl
i
edt
otheCLEARi
nputofal
lthef
li
p-f
lopsr
eset
sthei
rQ
out
put
sto0s.Ref
ert
othet
imi
ngwav
efor
msofFi
g.8.
36.Thewav
efor
msshowni
ncl
udet
hecl
ockpul
se
t
rai
n,t
hewav
efor
mrepr
esent
ingt
hedat
atobel
oadedont
otheshi
ftr
egi
sterandt
heQout
put
sofdi
ff
erent
f
li
p-f
lops.

Thef
li
p-f
lopsshownr
espondt
otheLOW-
to-
HIGHt
ransi
ti
onoft
hecl
ockpul
sesasi
ndi
cat
edbyt
hei
r
l
ogi
csy
mbol
s.Dur
ingt
hef
ir
stcl
ockt
ransi
ti
on,
theQAout
putgoesf
rom l
ogi
c‘0’
tol
ogi
c‘1’
.Theout
put
sof
t
heot
hert
hreef
li
p-f
lopsr
emai
nint
hel
ogi
c‘0’
stat
east
hei
rDi
nput
swer
eint
hel
ogi
c‘0’
stat
eatt
het
ime
ofcl
ockt
ransi
ti
on.Dur
ingt
hesecondcl
ockt
ransi
ti
on,
theQAout
putgoesf
rom l
ogi
c‘1’
tol
ogi
c‘0’
andt
he
QBout
putgoesf
rom l
ogi
c‘0’
tol
ogi
c‘1’
,agai
ninaccor
dancewi
tht
hel
ogi
cst
atusoft
heDi
nput
satt
he
t
imeofr
elev
antcl
ockt
ransi
ti
on.

Thus,
wehav
eseent
hatal
ogi
c‘1’
thatwaspr
esentatt
hedat
ainputpr
iort
otheoccur
renceoft
hef
ir
st
cl
ockt
ransi
ti
onhasr
eachedt
heQBout
putatt
heendoft
wocl
ockt
ransi
ti
ons.Thi
sbi
twi
l
lreacht
heQD
out
putatt
heendoff
ourcl
ockt
ransi
ti
ons.I
ngener
al,
inaf
our
-bi
tshi
ftr
egi
steroft
het
ypeshowni
nFi
g.

110|Page
8.
35,
adat
abi
tpr
esentatt
hedat
ainputt
ermi
nal
att
het
imeoft
hent
hcl
ockt
ransi
ti
onr
eachest
heQD
out
putatt
heendoft
he(
n+4)
thcl
ockt
ransi
ti
on.Dur
ingt
hef
if
thandsubsequentcl
ockt
ransi
ti
ons,
dat
abi
ts
cont
inuet
oshi
ftt
other
ight
,andatt
heendof

t
heei
ght
hcl
ockt
ransi
ti
ont
heshi
ftr
egi
steri
sagai
nresett
oal
l0s.Thus,
inaf
our
-bi
tser
ial
-i
nser
ial
-out
shi
ftr
egi
ster
,itt
akesf
ourcl
ockcy
clest
oloadt
hedat
abi
tsandanot
herf
ourcy
clest
oreadt
hedat
abi
ts
outoft
her
egi
ster
.

111|Page
Thecont
ent
soft
her
egi
sterf
ort
hef
ir
stei
ghtcl
ockcy
clesar
esummar
izedi
nTabl
e8.
14.Wecansee
t
hatt
her
egi
steri
sloadedwi
tht
hef
our
-bi
tdat
ainf
ourcl
ockcy
cles,
andal
sot
hatt
hest
oredf
our
-bi
tdat
a
ar
ereadouti
nthesubsequentf
ourcl
ockcy
cles.I
C7491i
sapopul
arei
ght
-bi
tser
ial
-i
nser
ial
-outshi
ft
r
egi
ster
.Fi
gur
e8.
37showsi
tsi
nter
nal
funct
ional
diagr
am,
whi
chi
sacascadear
r ghtR-
angementofei Sfl
i
p
-
fl
ops.Owi
ngt
othei
nver
terbet
weent
heRandSi
nput
soft
hedat
ainputf
li
p-f
lop,
iti
sfunct
ional
l
ythe
sameasaDf
li
p-f
lop.

Thedat
atobel
oadedi
ntot
her
egi
sterser
ial
l
ycanbeappl
i
edei
theratAorBi
nputoft
heNANDgat
e.
Theot
heri
nputi
sthenkepti
nthel
ogi
cHI
GHst
atet
oenabl
etheNANDgat
e.I
nthatcase,
dat
apr
esentatA
orBgetcompl
ement
edast
heyappearatt
heNANDout
put
.Anot
heri
nver
sionpr
ovi
dedbyt
hei
nver
ter
,
howev
er,
rest
orest
heor
igi
nal
stat
ussot
hatf
oral
ogi
c‘1’
att
hedat
ainputt
her
eisal
ogi
c‘1’
att
heSET

112|Page
i
nputoft
hef
li
p-f
lopandal
ogi
c‘0’
att
heRESETi
nputoft
hef
li
p-f
lop,
andf
oral
ogi
c‘0’
att
hedat
ainput
t
her
eisal
ogi
c‘0’
att
heSETi
nputandal
ogi
c‘1’
att
heRESETi
nputoft
hef
li
p-f
lop.TheNANDgat
e
pr
ovi
desonl
yagat
ingf
unct
ion,
and,
ifi
tisnotr
equi
red,
thet
woi
nput
soft
heNANDcanbeshor
tedt
ohav
e
asi
ngl
e-l
i
nedat
ainput
.Theshi
ftr
egi
sterr
espondst
otheLOW-
to-
HIGHt
ransi
ti
onsoft
hecl
ockpul
ses.

8.
5.2Ser
ial
-I
nPar
all
el-
OutShi
ftRegi
ster

Aser
ial
-i
npar
all
el-
outshi
ftr
egi
steri
sar
chi
tect
ural
l
yident
ical
toaser
ial
-i
nser
ial
-outshi
ftr
egi
ster
exceptt
hati
nthecaseoft
hef
ormeral
lfl
i
p-f
lopout
put
sar
eal
sobr
oughtoutont
heI
Cter
minal
s.Fi
gur
e
8.
38showst
hel
ogi
cdi
agr
am ofat
ypi
cal
ser
ial
-i
npar
all
el-
outshi
ftr
egi
ster
.Inf
act
,thel
ogi
cdi
agr
am
showni
nFi
g.8.
38i
sthatofI
C74164,
apopul
arei
ght
-bi
tser
ial
-i
npar
all
el-
outshi
ftr
egi
ster
.Thegat
edser
ial
i
nput
sAandBcont
rol
thei
ncomi
ngser
ial
dat
a,asal
ogi
cLOW atei
theroft
hei
nput
sinhi
bit
sent
ryofnew
dat
aandal
sor
eset
sthef
ir
stf
li
p-f
lopt
othel
ogi
cLOW l
evel
att
henextcl
ockpul
se.Logi
cHI
GHatei
therof
t
hei
nput
senabl
est
heot
heri
nput
,whi
cht
hendet
ermi
nest
hest
ateoft
hef
ir
stf
li
p-f
lop.

Fur
therr
eadi
ng:

Par
all
el-
InSer
ial
-OutShi
ftRegi
ster

Par
all
el-
InPar
all
el-
OutShi
ftRegi
ster

Uni
ver
salShi
ftRegi
ster

113|Page
Shi
ftRegi
sterCount
ers

REFERENCES
 Ani
lK.M (
2007)
,Di
git
alEl
ect
roni
csPr
inci
ples,
Dev
icesandAppl
i
cat
ion,Engl
and:
JohnWi
l
ey&
SonsLi
mit
ed,
ISBN:
978-
0-470-
03214-
5

 Gupt
aB.
RandSi
nghal
V.( Di
2012), gi
talEl
ect
roni
cs,
Indi
a:S.
KKat
ari
aandSons,I
SBN
81815749604

 ThomasFl
oyds(
2009)
,Di
git
alFundament
als,
8thEdt
n,London:
Char
lesMer
ri
ll
,I
SBN
0675098769

114|Page

You might also like