You are on page 1of 7

9/16/2015

DigitalCombinational
Logic/ArithmeticCircuits
DigitalCombinational
Logic/ArithmeticCircuits

Arithmetic

Arithmetic
Adder/Subtractor
Converters
Decoder/Encoder/Comparator
Multiplexer/Demultiplexer
ParityCircuits
Generators
Checkers

ANDORLogic

Binaryarithmetic

2scomplementrepresentation
2scomplementarithmetic
Hexadecimalarithmetic
BCDarithmetic
Arithmeticcircuits
Adder/subtractor
4bitfulladder/subtractorICs

9/16/2015

ANDORInvertLogic

ExclusiveORlogic

HowaboutXNORlogic?

Complements(1)
Allowtherepresentationofnegativenumbers.
Complementsareusedindigitalcomputersfor
simplifyingthesubtractionoperation.
Twotypesofcomplementforbinarynumbers:
Onescomplement
Twoscomplement
The1scomplementofabinarynumberisformedby
changing1sto0sand0sto1s
Example:
The1scomplementof1011000is0100111
The1scomplementof0101101
is1010010

Complements(2)
The2scomplementofabinarynumberisformedby
adding1tothe1scomplement.
2scomplement=(1scomplement)+1

9/16/2015

Complements(3)
Alternativemethodtofind2scomplement:
StartattherightwiththeLSBandwritethe
bitsastheyareuptoincludingthefirst1.
Do1scomplementsoftheremainingbits.

Example:
The2scomplementof1101100is0010100
The2scomplementof0110111is1001001

CombinationalArithmeticCircuits
Addition:
HalfAdder(HA)
FullAdder(FA)
CarryRippleAdders

Subtraction:
HalfSubtractor
FullSubtractor
BorrowRippleSubtractors
Subtractionusingadders

BinaryArithmeticOperationsSubtraction
Twobinarynumbersaresubtractedbysubtractingeach
pairofbitstogetherwithborrowing,whereneeded.
Example:
001111100Borrow
X:22911100101
Y:4600101110
18310110111

HalfAdder
Addingtwosinglebitbinaryvalues,X,YproducesasumSbitanda
carryoutCoutbit.
Thisoperationiscalledhalfadditionandthecircuittorealizeitis
calledahalfadder.
S(X,Y) = (1,2)
S = XY + XY

Half Adder Truth Table:

X
0
0
1
1
X
Y

S = XY

Outputs

Inputs

S
0
1
1
0

Y
0
1
0
1
Half
Adder

C-out
0
0
0
1

C-out(x, y, C-in) = (3)


C-out = XY
X
Y

Sum S

C-out

S
C-OUT

9/16/2015

FullAdder(1)

Sum S

X
0
0
0
0
1
1
1
1

Y
0
0
1
1
0
0
1
1

C-in
0
1
0
1
0
1
0
1

00

C-in

Full Adder Truth Table


Inputs

FullAdder(2)

X
XY

Addingtwosinglebitbinaryvalues,X,Y
withacarryinputbitCinproducesasum
bitSandacarryoutCoutbit.

01

11
6

10

FullAdderCircuitUsingANDOR:

C-in

Outputs

S
0
1
1
0
1
0
0
1

C-out
0
0
0
1
0
1
1
1

X
X

Y
Y

X
Y
C-in
X
Y
C-in

S = XY(C-in) + XY(C-in) + XY(C-in) + XY(C-in)


S = X Y (C-in)

Carry C-out

X
Y
C-in

XY

00

C-in

0
1

01

11

S(X,Y, C-in) = (1,2,4,7)

1
1

10
4
5

C-in

C-out

Full
Adder

Sum S

XYC-in

XYC-in

XY

C-in

C-out(x, y, C-in) = (3,5,6,7)

XYC-in

X
Y
C-in

C-in
C-in

C-in

XYC-in

XC-in

C-out

C-in
Y

C-out = XY + X(C-in) + Y(C-in)

FullAdder(3)

C-in

YC-in

nbitCarryRippleAdders

FullAdderCircuitUsingXOR:
X

Sum S

Y
C-in

Annbitadderusedtoaddtwonbitbinarynumberscanbuiltbyconnectingin
seriesnfulladders.
Eachfulladderrepresentsabitpositionj(from0ton1).
EachcarryoutCoutfromafulladderatpositionjisconnectedtothecarryin
Cinofthefulladderatthehigherpositionj+1.
Theoutputofafulladderatpositionjisgivenby:
Sj=XjYjCj

X
C-out

Full
Adder
S

C-in

Cj+1=Xj.Yj+Xj.Cj+Y.Cj

XY

IntheexpressionofthesumCjmustbegeneratedbythefulladderatthelower
positionj1.

Y
X

XC-in

C-in
Y
C-in

YC-in

C-out

Thepropagationdelayineachfulladdertoproducethecarryisequaltotwogate
delays=2
Sincethegenerationofthesumrequiresthepropagationofthecarryfromthe
lowestpositiontothehighestposition,thetotalpropagationdelayoftheadderis
approximately:
TotalPropagationdelay=2n

9/16/2015

LargerAdders

4bitCarryRippleAdderInputs to be added
Adds two 4-bit numbers:
X = X3 X2 X1 X0
Y = Y3 Y2 Y1 Y0
producing the sum S = S3 S2 S1 S0 ,
C-out = C4 from the most significant
position j=3

Total Propagation delay

X3X2X1X0

C4

C-out

Example:16bitadderusing4,4bitadders
Addstwo16bitinputsX(bitsX0toX15),Y(bitsY0toY15)producinga16bitSum
S(bitsS0toS15)andacarryoutC16frommostsignificantposition.

Y3Y2Y1Y0

4-bit
Adder

C-in

C0 =0

Data inputs to be added X (X0 to X15) , Y (Y0-Y15)

= 2 n8

X3X2X1X0

S3 S2 S1 S0

or 8 gate delays

Sum Output

C16

C4

C-out

Y3

Full
C3
C-in
Adder
S3

X2

C-out

Y2

Full
C2
C-in
Adder

X1

C-out

S2

Y1

Full
C-in
Adder

X0
C1

C-out

S1

Y0

Full
C-in
Adder

X3X2X1X0

S3 S2 S1 S0

Sum output

Forannbitbinarynumber:
Usethefirstbit(mostsignificantbit,MSB)positionto
representthesignwhere0ispositiveand1isnegative.

Ex:111111112=12710
Magnitude
Sign

Remainingn1bitsrepresentthemagnitudewhichmayrangefrom:

2(n1)+1to2(n1)1
Thisschemehastworepresentationsfor0;i.e.,bothpositiveandnegative0:
for8bits:00000000,10000000
Arithmeticunderthisschemeusesthesignbittoindicatethenatureofthe
operationandthesignoftheresult,butthesignbitisnotusedaspartofthe
arithmetic.

C-out

Y3Y2Y1Y0

4-bit
C-in
Adder
S3 S2 S1 S0

S3 S2 S1 S0

X3X2X1X0

C4

C-out

Y3Y2Y1Y0

4-bit
C-in
Adder

C0 =0

S3 S2 S1 S0

Propagation delay for 16-bit adder = 4 x propagation delay of 4-bit adder


= 4 x 2 n x8
or
32 gate delays

S0

SignedMagnitudeRepresentation:

X3X2X1X0

Sum output S (S0 to S15)

C0 =0

NegativeBinaryNumberRepresentations

Y3Y2Y1Y0

4-bit
4-bit
C12
C8
C-in
C-in
C-out
Adder
Adder

C-out

Data inputs to be added


X3

Y3Y2Y1Y0

HalfSubtractor
SubtractingasinglebitbinaryvalueYfromantherX(I.e.XY)producesa
differencebitDandaborrowoutbitBout.
Thisoperationiscalledhalfsubtractionandthecircuittorealizeitiscalleda
halfsubtractor.

Half Subtractor Truth Table:


Inputs

X
0
0
1
1

Y
0
1
0
1

Outputs

D(X,Y) = (1,2)
D = XY + XY
D = XY

D B-out
0
0
1
1
0
1
0
0

B-out(X, Y) = (1)
B-out = XY
X

X
Y

Half
Subtractor

D
B-OUT

Difference
D

B-out

9/16/2015

Difference D
FullSubtractor(1)

Subtractingtwosinglebitbinaryvalues,Y,
BinfromasinglebitvalueXproducesa
differencebitDandaborrowoutBout
bit.Thisiscalledfullsubtraction.

00

B-in

0
1

01

11

Full Subtractor Truth Table:


Inputs

X
0
0
0
0
1
1
1
1

Y
0
0
1
1
0
0
1
1

10

1
B-in

Outputs

D
0
1
1
0
1
0
0
1

B-in
0
1
0
1
0
1
0
1

FullSubtractor(2)

XY

X
X

Y
Y

D = XY(B-in) + XY(B-in) + XY(B-in) + XY(B-in)


D = X Y (B-in)

B-out
0
1
1
1
0
0
0
1

XY

00

B-in

0
1

0
1

01
2

11
6

10

B-in

B-out(x, y, B-in) = (1,2,3,7)

Full
Subtractor

Difference D

Y
B-in

B-in

Difference D

XYB-in

XYB-in

XY

B-out

Full
Subtractor
D

B-in

XB-in

B-out

B-in
Y
B-in

YB-in

nbitSubtractors

B-out

XYB-in

FullAdderCircuitUsingANDOR

FullSubtractor(3)

X
Y
B-in

XYB-in

B-out = XY + X(B-in) + Y(B-in)

S(X,Y, B-in) = (1,2,4,7)

X
Y
B-in

X
Y
B-in

B-in
B-in

B-in
Borrow B-out

X
Y
B-in

EachborrowoutBoutfromafullsubtractoratpositionjis
connectedtotheborrowinBinofthefullsubtractoratthehigher
positionj+1.

XY

Y
X

XB-in

B-in

B-out

Byusingannbitadderandninverters:

FindtwoscomplementofYby:

Y
B-in

AnnbitsubtractorusedtosubtractannbitnumberYfrom
anothernbitnumberX(i.eXY)canbebuiltinoneoftwoways:
Byusingnfullsubtractorandconnectingtheminseries,creating
aborrowripplesubtractor:

YB-in

InvertingallthebitsofYusingtheninverters.
Adding1bysettingthecarryinoftheleastsignificantpositionto1

Full Subtractor Circuit Using XOR

Theoriginalsubtraction(XY)nowbecomesan
additionofXtotwoscomplementofYusingthen
bit adder

9/16/2015

4bitBorrowRippleSubtractor
Inputs

Subtracts two 4-bit numbers:


Y = Y3 Y2 Y1 Y0 from
X = X3 X2 X1 X0
Y = Y3 Y2 Y1 Y0
producing the difference D = D3 D2 D1
D0 ,
B-out = B4 from the most significant
position j=3

X3X2X1X0

4bitSubtractorUsing4bitAdder

Y3Y2Y1Y0

Inputs to be subtracted
B4

B-out

4-bit B-in
Subtractor

B4

B-out Full

Y3

B-in

Subtractor

D3

X2
B3

Y2

Y0

D3 D2 D1 D0

Difference Output D

X1

C4

Y1

B2
B-out Full B-in
B-out Full B-in
Subtractor
Subtractor

D2

Y1

X3 X2 X1 X0

Data inputs to be subtracted


X3

Y3 Y2

B0 =0

D1
Difference output D

X0
B1

B-out Full

Y0

B-in

Subtractor

D0

B0 =0

C-out

4-bit
Adder

C-in

S3

S2

S1

S0

D3

D2

D1

D0

C0 = 1

Difference Output

You might also like