Vous êtes sur la page 1sur 6

Arithmetic Circuits

TUTORIAL OBJECTIVES

TUTORIAL OBJECTIVES Usedataflip-flopstoconvertbetweenserialandparallelsignals. Createshiftregisters.

Usedataflip-flopstoconvertbetweenserialandparallelsignals.

Createshiftregisters.

Binary Addition

1

1

Thehardwareofourcomputerneedstoperformbinaryarithmetic.Thesimplestisbinaryad-

dition.Inordertoaddtwobinarynumberstogether,wefirstneedtodesignacircuitthatcan

addtwobitstogether.

Forexample,ifwewanttoaddtogetherthebinarynumbers:101101and1100,thenwefirst

needtotackleadding1and0.Fornowwewillleavethiscircuitasacomponenttobede-

signedlater.

101101 1100 1 0 BitAdder 1
101101
1100
1
0
BitAdder
1

1

Similarlyifwewantedtoaddtogetherthefollowing:

0 1 0 1 BitAdder
0
1
0
1
BitAdder

TheBitAdderwouldoutputtheresult

2

1
1

Asdescribedbelow.

0 1 0 1 BitAdder 1
0 1
0
1
BitAdder
1

1

Andsimilarlyforaddingthebits0and0:

0 0

BitAdder0 1 BitAdder 1 1 Andsimilarlyforaddingthebits0and0: 0 0 TheoutputfromtheBitAdderwouldbe 3 0 Asdescribedbelow. 0

TheoutputfromtheBitAdderwouldbe

3

0
0

Asdescribedbelow.

0 1 0 0 BitAdder 0
0 1
0
0
BitAdder
0

0

Butnowwerunintoaproblem.Whatdowedowhenwetrytoaddthebits1and1to-

gether?

1 1 1 1 BitAdder ?
1 1
1
1
BitAdder
?

10?

Obviouslytheansweris10,buthowcanweoutputtwobitsonasingleline?Wecan’t.A

lineindigitalcircuitrycanobviouslyonlyhavethevalues1or0.

Tosolvethisproblemwesimplyintroduceasecondlineusedforthecasewhenwetryto

addtogetherthebits1and1.

1 1 1 1 BitAdder NewOutput 1 0
1
1
1
1
BitAdder
NewOutput
1 0

1 0

Sonowtheoutputis10.Thisnewoutputactsasasecondcolumnforthebinaryrepresenta-

tionofouroutput.

4

4

Sofinally,theBitAdderlookslikethis:

BitA

BitB

BitAdder4 Sofinally,theBitAdderlookslikethis: BitA BitB Column1 Column0

Column1 Column0

Andtherearefourpossibleinputsandoutputstothiscircuit:

0 0 0 0 BitAdder 0 0
0 0
0 0
BitAdder
0 0

0

0

0 1 0 1 BitAdder 0 1
0 1
0 1
BitAdder
0 1

0

1

1 0 1 0 BitAdder 0 1
1 0
1 0
BitAdder
0 1

0

1

1 1 1 1 BitAdder 1 0
1 1
1 1
BitAdder
1 0

1

0

5

5

Sonowthatwehaveacircuitthatcanaddtwobitstogether,howdowegoaboutaddingto-

gethertheentirebinarynumber.Letsconsideraddingtogether:1010and0100.

1010

0100 BitAdder 0 0
0100
BitAdder
0
0
0100 BitAdder 0 1 0 0
0100
BitAdder
0
1
0 0

1010

1010 BitAdder 1 10 0 00
1010
BitAdder
1 10
0
00

0100

1010 BitAdder 1 110 0 000
1010
BitAdder
1 110
0
000

0100

Whatwearedoinghereisaddingupthebitsfromlefttoright.Noticethattheleft-handbit

fromtheBitAdderisusedasa‘carry’inouraddition(hencewhyweputitbelow).

Similarly,ifwewantedtoaddtogether1000and0110wewouldstartbydoing

1000

0110 BitAdder
0110
BitAdder

Weinput0and1intothebitadder,theoutputfromthebitadderwillgiveusthetwobits

and

6

6 0and0

0and0

6 0and0

Whichwouldlooklike:

1000

0110 BitAdder 0 0
0110
BitAdder
0
0

Nextwemoveontothenextcolumn.

0110 BitAdder 0 0
0110
BitAdder
0
0

1000

Weinput0and1intothebitadder,theoutputfromthebitadderwillgiveusthetwobits

and

7

7 0and1

0and1

7 0and1

Whichnowgivesus:

0110 BitAdder 1 0 0 0
0110
BitAdder
1
0
0 0

1000

Andifwecontinueaddtogetherthebitsfromtheremainingtwocolumns:

1000 0110 1000 0110 BitAdder BitAdder 10 10 00 00
1000
0110
1000
0110
BitAdder
BitAdder
10
10
00
00

thenwewillgetthecompleteddiagramsof

8 1000 0110 1000 0110 BitAdder BitAdder 1 10 1 110 000 0 000
8
1000
0110
1000
0110
BitAdder
BitAdder
1
10
1
110
000
0
000

Alltheexamplessofarhavehadcarrybitsof0-thelefthandbitoftheBitAdder’soutput

wasalways0.Butifweconsideradding010and010,werunintoaproblem.

010 010 BitAdder 0 0
010 010
BitAdder
0
0
010 010 BitAdder 00 10
010 010
BitAdder
00
10
010 BitAdder 000 0 10
010
BitAdder
000
0 10

010

Thisisok.

TheBitAdderoutputis1and0.Theleftbitof

theoutput(thecarry)is1.Thisisok.

Wedidn’taddthecarry!Thisisnotok!

Obviously010+010isnot000.Theproblemisthatwedon’thaveacircuitthatcanhandle

addingonthecarry.Sonowwearegoingtocreateasecondcircuitthatwillbeusedwith

ourBitAddercircuit.

Thisnewcircuitshouldbeusedtoaddtogethertwobitsandalsothecarry.

010 010 NewCircuit 00 10
010
010
NewCircuit
00
10

Thenewcircuitwilloutputthesumofthebitsandthecarrybutalsoadifferentcarryfrom

thissum.Inthisexample,theoutputwillbe0+0+1andthecarryfromthiswillbe0.

010 010 NewCircuit 100 0 10
010 010
NewCircuit
100
0 10

9

9

BitA

BitB

BitA

BitB

Carry

BitAdder Column1 Column0
BitAdder
Column1 Column0
Bit/CarryAdder
Bit/CarryAdder
Bit/CarryAdder
Bit/CarryAdder
Bit/CarryAdder
Bit/CarryAdder
Bit/CarryAdder
Bit/CarryAdder
Bit/CarryAdder
Bit/CarryAdder

Bit/CarryAdder

Bit/CarryAdder
Bit/CarryAdder
Bit/CarryAdder
Bit/CarryAdder
Bit/CarryAdder
Bit/CarryAdder
Bit/CarryAdder

Column1 Column0

BitA

BitB

Carry

Sum

 

BitA

BitB

Carry

Carry

Sum

0

0

0

 

0 0

 

0

0

0

0

0

1

0

 

1 0

 

0

1

0

1

1

0

0

 

1 0

 

1

0

0

1

1

1

1

 

1 0

 

1

1

1

0

 

1

0

0

0

1

1

0

1

1

0

1

1

0

1

0

1

1

1

1

1