SlideShare a Scribd company logo
Carnegie Mellon
1
Design of Digital Circuits 2014
Srdjan Capkun
Frank K. Gürkaynak
Adapted from Digital Design and Computer Architecture, David Money Harris & Sarah L. Harris ©2007 Elsevier
http://www.syssec.ethz.ch/education/Digitaltechnik_14
Arithmetic Circuits
Carnegie Mellon
2
In This Lecture
 Why are arithmetic circuits so important
 Adders
 Adding two binary numbers
 Adding more than two binary numbers
 Circuits Based on Adders
 Multipliers
 Functions that do not use adders
 Arithmetic Logic Units
Carnegie Mellon
3
Motivation: Arithmetic Circuits
 Core of every digital circuit
 Everything else is side-dish, arithmetic circuits are the heart of the digital
system
 Determines the performance of the system
 Dictates clock rate, speed, area
 If arithmetic circuits are optimized performance will improve
 Opportunities for improvement
 Novel algorithms require novel combinations of arithmetic circuits, there
is always room for improvement
Carnegie Mellon
4
Example: ARM Microcontroller
 Most popular embedded
micro controller.
 Contains:
 Multiplier
 Accumulator
 ALU/Adder
 Shifter
 Incrementer
Carnegie Mellon
5
Example: ARM Instructions
Carnegie Mellon
6
Arithmetic Based Instructions of ARM
Carnegie Mellon
7
Types of Arithmetic Circuits
 In order of complexity:
 Shift / Rotate
 Compare
 Increment / Decrement
 Negation
 Addition / Subtraction
 Multiplication
 Division
 Square Root
 Exponentation
 Logarithmic / Trigonometric Functions
Carnegie Mellon
8
Relation Between Arithmetic Operators
Carnegie Mellon
9
Addition
 Addition is the most important operation in computer
arithmetic. Our topics will be:
 Adding 1-bit numbers : Counting bits
 Adding two numbers : Basics of addition
 Circuits based on adders : Subtractors, Comparators
 Adding multiple numbers : Chains of Adders
 Later we will also talk about fast adder architectures
Carnegie Mellon
10
Half-Adder (2,2) Counter
 The Half Adder (HA) is the simplest arithmetic block
 It can add two 1-bit numbers, result is a 2-bit number
 Can be realized easily
Carnegie Mellon
11
Full-Adder (3,2) Counter
 The Full Adder (FA) is the essential
arithmetic block
 It can add three 1-bit numbers, result
is a 2-bit number
 There are many realizations both at
gate and transistor level.
 Since it is used in building many
arithmetic operations, the
performance of one FA influences the
overall performance greatly.
Carnegie Mellon
12
Adding Multiple 1-bit Numbers
Carnegie Mellon
13
Adding Multiple Digits
 Similar to decimal addition
 Starting from the right, each digit is added
 The carry from one digit is added to the digit to the left
Carnegie Mellon
14
Adding Multiple Digits
 Similar to decimal addition
 Starting from the right, each digit is added
 The carry from one digit is added to the digit to the left
Carnegie Mellon
15
Ripple Carry Adder (RCA)
Carnegie Mellon
16
Curse of the Carry
The most significant outputs of the adder
depends on the least significant inputs
Carnegie Mellon
17
Adding Multiple Numbers
 Multiple fast adders not a good idea
 If more than 2 numbers are to be added, multiple fast adders are not
really efficient
 Use an array of ripple carry adders
 Popular and efficient solution
 Use carry save adder trees
 Instead of using carry propagate adders (the adders we have seen so far),
carry save adders are used to reduce multiple inputs to two, and then a
single carry propagate adder is used to sum up.
Carnegie Mellon
18
Array of Ripple Carry Adders
Carnegie Mellon
19
Carry Save Principle
 Reduces three numbers to two with a single gate delay
C + S = E + F + G
Carnegie Mellon
20
Carry Save Principle
Z = D + E + F + G + H
 An array of carry save
adders reduce the inputs to
two
 A final (fast) carry propagate
adder (CPA) merges the two
numbers
 Performance mostly
dictated by CPA
Carnegie Mellon
21
Multipliers
 Largest common arithmetic block
 Requires a lot of calculation
 Has three parts
 Partial Product Generation
 Carry Save Tree to reduce partial products
 Carry Propagate Adder to finalize the addition
 Adder performance (once again) is important
 Many optimization alternatives
Carnegie Mellon
22
Decimal Multiplication
Carnegie Mellon
23
Binary Multiplication
Carnegie Mellon
24
For n-bit Multiplier m-bit Multiplicand
 Generate Partial Products
 For each bit of the multiplier the partial product is either
 when ‘0’: all zeroes
 when ‘1’: the multiplicand
achieved easily by AND gates
 Reduce Partial Products
 This is the job of a carry save adder
 Generate the Result (n + m bits)
 This is a large, fast Carry Propagate Adder
Carnegie Mellon
25
Parallel Multiplier
Carnegie Mellon
26
Parallel Multiplier
Carnegie Mellon
27
Operations Based on Adders
 Several well-known arithmetic operation are based on adders:
 Negator
 Incrementer
 Subtracter
 Adder Subtracter
 Comparator
Carnegie Mellon
28
Negating Two’s Complement Numbers
 To negate a two’s
complement number
-A = A + 1
 All bits are inverted
 One is added to the result
 Can be realized easily by an
adder.
 B input is optimized away
Carnegie Mellon
29
Incrementer
 B input is zero
 Carry In (Cin) of the adder
can be used as the
Increment (Inc) input
 Decrementer similar in
principle
Carnegie Mellon
30
Subtracter
 B input is inverted
 Cin of the adder is used to
complement B
Carnegie Mellon
31
Subtracter
 B input is inverted
 Cin of the adder is used to
complement B
 It can be made
programmable so that both
additions and subtractions
can be performed at the
same time
Carnegie Mellon
32
Comparator
 Based on a Subtractor
(A = B) = EQ
(A != B) = EQ
(A > B) = GE EQ
(A >= B) = GE
(A < B) = GE
(A <= B) = GE + EQ
Carnegie Mellon
33
Functions Realized Without Adders
 Not all arithmetic functions are realized by using adders
 Shift / Rotate Units
 Binary Logic functions are also used by processors
 AND
 OR
 XOR
 NOT
These are implemented very easily
Carnegie Mellon
34
Shifters
 Logical shifter: shifts value to left or right and fills empty
spaces with 0’s
 Ex: 11001 >> 2 = ??
 Ex: 11001 << 2 = ??
 Arithmetic shifter: same as logical shifter, but on right shift,
fills empty spaces with the old most significant bit (msb).
 Ex: 11001 >>> 2 = ??
 Ex: 11001 <<< 2 = ??
 Rotator: rotates bits in a circle, such that bits shifted off one
end are shifted into the other end
 Ex: 11001 ROR 2 = ??
 Ex: 11001 ROL 2 = ??
Carnegie Mellon
35
Shifters
 Logical shifter: shifts value to left or right and fills empty
spaces with 0’s
 Ex: 11001 >> 2 = 00110
 Ex: 11001 << 2 = 00100
 Arithmetic shifter: same as logical shifter, but on right shift,
fills empty spaces with the old most significant bit (msb).
 Ex: 11001 >>> 2 = 11110
 Ex: 11001 <<< 2 = 00100
 Rotator: rotates bits in a circle, such that bits shifted off one
end are shifted into the other end
 Ex: 11001 ROR 2 = 01110
 Ex: 11001 ROL 2 = 00111
Carnegie Mellon
36
Shifter Design
A3:0 Y3:0
shamt1:0
>>
2
4 4
A3
A2
A1
A0
Y3
Y2
Y1
Y0
shamt1:0
00
01
10
11
S1:0
S1:0
S1:0
S1:0
00
01
10
11
00
01
10
11
00
01
10
11
2
Carnegie Mellon
37
Shifters as Multipliers and Dividers
 A left shift by N bits multiplies a number by 2N
 Ex: 00001 << 2 = 00100 (1 × 22 = 4)
 Ex: 11101 << 2 = 10100 (-3 × 22 = -12)
 The arithmetic right shift by N divides a number by 2N
 Ex: 01000 >>> 2 = 00010 (8 ÷ 22 = 2)
 Ex: 10000 >>> 2 = 11100 (-16 ÷ 22 = -4)
Carnegie Mellon
38
Other Functions
 We have covered 90% of the arithmetic functions commonly
used in a CPU
 Division
 Dedicated architectures not very common
 Mostly implemented by existing hardware (multipliers, subtractors
comparators) iteratively
 Exponential, Logarithmic, Trigonometric Functions
 Dedicated hardware (less common)
 Numerical approximations:
exp(x) = 1 + x2/2! + x3/3! + …
 Look-up tables (more common)
Carnegie Mellon
39
Arithmetic Logic Unit
The reason why we study digital circuits:
the part of the CPU that does something (other than copying data)
 Defines the basic operations that the CPU can perform directly
 Other functions can be realized using the existing ones iteratively. (i.e.
multiplication can be realized by shifting and adding)
 Mostly, a collection of resources that work in parallel.
 Depending on the operation one of the outputs is selected
Carnegie Mellon
40
Example: Arithmetic Logic Unit (ALU), pg243
ALU
N N
N
3
A B
Y
F
F2:0 Function
000 A & B
001 A | B
010 A + B
011 not used
100 A & ~B
101 A | ~B
110 A - B
111 SLT
Carnegie Mellon
41
Example: ALU Design
+
2
0
1
A B
Cout
Y
3
0
1
F2
F1:0
[N-1] S
N
N
N
N
N N
N
N
N
2
Zero
Extend F2:0 Function
000 A & B
001 A | B
010 A + B
011 not used
100 A & ~B
101 A | ~B
110 A - B
111 SLT
Carnegie Mellon
42
Set Less Than (SLT) Example
 Configure a 32-bit ALU for the set if
less than (SLT) operation. Suppose
A = 25 and B = 32.
 A is less than B, so we expect Y to be the
32-bit representation of 1
(0x00000001).
+
2
0
1
A B
Cout
Y
3
0
1
F2
F1:0
[N-1] S
N
N
N
N
N N
N
N
N
2
Zero
Extend
Carnegie Mellon
43
Set Less Than (SLT) Example
 Configure a 32-bit ALU for the set if
less than (SLT) operation. Suppose
A = 25 and B = 32.
 A is less than B, so we expect Y to be the
32-bit representation of 1
(0x00000001).
 For SLT, F2:0 = 111.
 F2 = 1 configures the adder unit as a
subtracter. So 25 - 32 = -7.
 The two’s complement representation of
-7 has a 1 in the most significant bit, so
S31 = 1.
 With F1:0 = 11, the final multiplexer
selects
Y = S31 (zero extended) = 0x00000001
+
2
0
1
A B
Cout
Y
3
0
1
F2
F1:0
[N-1] S
N
N
N
N
N N
N
N
N
2
Zero
Extend
Carnegie Mellon
44
What Did We Learn?
 How can we add, subtract, multiply binary numbers
 What other circuits depend on adders
 Subtracter
 Incrementer
 Comparator
 Important part of Multiplier
 Other functions (shifting)
 How is an Arithmetic Logic Unit constructed

More Related Content

Similar to ArithmeticCircuits.Ivy Nile vs. Rhea Ripley

5. Arithmaticn combinational Ckt.ppt
5. Arithmaticn combinational Ckt.ppt5. Arithmaticn combinational Ckt.ppt
5. Arithmaticn combinational Ckt.ppt
abhishekchakraborty788933
 
100_2_digitalSystem_Chap1 (2).ppt
100_2_digitalSystem_Chap1 (2).ppt100_2_digitalSystem_Chap1 (2).ppt
100_2_digitalSystem_Chap1 (2).ppt
namraashraf56
 
Chapter 07 Digital Alrithmetic and Arithmetic Circuits
Chapter 07 Digital Alrithmetic and Arithmetic CircuitsChapter 07 Digital Alrithmetic and Arithmetic Circuits
Chapter 07 Digital Alrithmetic and Arithmetic Circuits
SSE_AndyLi
 
IRJET-Design and Implementation of LNS based Approximate Multiplier using Mit...
IRJET-Design and Implementation of LNS based Approximate Multiplier using Mit...IRJET-Design and Implementation of LNS based Approximate Multiplier using Mit...
IRJET-Design and Implementation of LNS based Approximate Multiplier using Mit...
IRJET Journal
 
Bt0064 logic design-de
Bt0064 logic design-deBt0064 logic design-de
Bt0064 logic design-de
smumbahelp
 
UNIT - II.pptx
UNIT - II.pptxUNIT - II.pptx
UNIT - II.pptx
amudhak10
 
LCDF3_Chap_10_P1.ppt
LCDF3_Chap_10_P1.pptLCDF3_Chap_10_P1.ppt
LCDF3_Chap_10_P1.ppt
brainxMagic
 
digital systems and information
digital systems and informationdigital systems and information
digital systems and information
Kamran Zafar
 
2 Computer Arithmetic_hhbyhbjhhjjjjjb41.pptx
2 Computer Arithmetic_hhbyhbjhhjjjjjb41.pptx2 Computer Arithmetic_hhbyhbjhhjjjjjb41.pptx
2 Computer Arithmetic_hhbyhbjhhjjjjjb41.pptx
MtikuTadesse
 
Binary parallel adder, decimal adder
Binary parallel adder, decimal adderBinary parallel adder, decimal adder
Binary parallel adder, decimal adder
shahzad ali
 
Development of an Algorithm for 16-Bit WTM
Development of an Algorithm for 16-Bit WTMDevelopment of an Algorithm for 16-Bit WTM
Development of an Algorithm for 16-Bit WTM
IOSR Journals
 
L010137986
L010137986L010137986
L010137986
IOSR Journals
 
BOOTH ALGO, DIVISION(RESTORING _ NON RESTORING) etc etc
BOOTH ALGO, DIVISION(RESTORING _ NON RESTORING) etc etcBOOTH ALGO, DIVISION(RESTORING _ NON RESTORING) etc etc
BOOTH ALGO, DIVISION(RESTORING _ NON RESTORING) etc etc
Abhishek Rajpoot
 
105_2_digitalSystem_Chap_3_part_3.ppt
105_2_digitalSystem_Chap_3_part_3.ppt105_2_digitalSystem_Chap_3_part_3.ppt
105_2_digitalSystem_Chap_3_part_3.ppt
Jeanie Delos Arcos
 
computer arithmatic
computer arithmaticcomputer arithmatic
computer arithmatic
mahesh kumar prajapat
 
Chapter-04.pdf
Chapter-04.pdfChapter-04.pdf
Chapter-04.pdf
ssuserf7cd2b
 
Alu1
Alu1Alu1
21bx21b booth 2 multiplier
21bx21b booth 2 multiplier21bx21b booth 2 multiplier
21bx21b booth 2 multiplier
Bharat Biyani
 

Similar to ArithmeticCircuits.Ivy Nile vs. Rhea Ripley (20)

5. Arithmaticn combinational Ckt.ppt
5. Arithmaticn combinational Ckt.ppt5. Arithmaticn combinational Ckt.ppt
5. Arithmaticn combinational Ckt.ppt
 
Lec20
Lec20Lec20
Lec20
 
100_2_digitalSystem_Chap1 (2).ppt
100_2_digitalSystem_Chap1 (2).ppt100_2_digitalSystem_Chap1 (2).ppt
100_2_digitalSystem_Chap1 (2).ppt
 
Chapter 07 Digital Alrithmetic and Arithmetic Circuits
Chapter 07 Digital Alrithmetic and Arithmetic CircuitsChapter 07 Digital Alrithmetic and Arithmetic Circuits
Chapter 07 Digital Alrithmetic and Arithmetic Circuits
 
IRJET-Design and Implementation of LNS based Approximate Multiplier using Mit...
IRJET-Design and Implementation of LNS based Approximate Multiplier using Mit...IRJET-Design and Implementation of LNS based Approximate Multiplier using Mit...
IRJET-Design and Implementation of LNS based Approximate Multiplier using Mit...
 
Bt0064 logic design-de
Bt0064 logic design-deBt0064 logic design-de
Bt0064 logic design-de
 
Dpsd lecture-notes
Dpsd lecture-notesDpsd lecture-notes
Dpsd lecture-notes
 
UNIT - II.pptx
UNIT - II.pptxUNIT - II.pptx
UNIT - II.pptx
 
LCDF3_Chap_10_P1.ppt
LCDF3_Chap_10_P1.pptLCDF3_Chap_10_P1.ppt
LCDF3_Chap_10_P1.ppt
 
digital systems and information
digital systems and informationdigital systems and information
digital systems and information
 
2 Computer Arithmetic_hhbyhbjhhjjjjjb41.pptx
2 Computer Arithmetic_hhbyhbjhhjjjjjb41.pptx2 Computer Arithmetic_hhbyhbjhhjjjjjb41.pptx
2 Computer Arithmetic_hhbyhbjhhjjjjjb41.pptx
 
Binary parallel adder, decimal adder
Binary parallel adder, decimal adderBinary parallel adder, decimal adder
Binary parallel adder, decimal adder
 
Development of an Algorithm for 16-Bit WTM
Development of an Algorithm for 16-Bit WTMDevelopment of an Algorithm for 16-Bit WTM
Development of an Algorithm for 16-Bit WTM
 
L010137986
L010137986L010137986
L010137986
 
BOOTH ALGO, DIVISION(RESTORING _ NON RESTORING) etc etc
BOOTH ALGO, DIVISION(RESTORING _ NON RESTORING) etc etcBOOTH ALGO, DIVISION(RESTORING _ NON RESTORING) etc etc
BOOTH ALGO, DIVISION(RESTORING _ NON RESTORING) etc etc
 
105_2_digitalSystem_Chap_3_part_3.ppt
105_2_digitalSystem_Chap_3_part_3.ppt105_2_digitalSystem_Chap_3_part_3.ppt
105_2_digitalSystem_Chap_3_part_3.ppt
 
computer arithmatic
computer arithmaticcomputer arithmatic
computer arithmatic
 
Chapter-04.pdf
Chapter-04.pdfChapter-04.pdf
Chapter-04.pdf
 
Alu1
Alu1Alu1
Alu1
 
21bx21b booth 2 multiplier
21bx21b booth 2 multiplier21bx21b booth 2 multiplier
21bx21b booth 2 multiplier
 

Recently uploaded

Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
BrazilAccount1
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
SupreethSP4
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 

Recently uploaded (20)

Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 

ArithmeticCircuits.Ivy Nile vs. Rhea Ripley

  • 1. Carnegie Mellon 1 Design of Digital Circuits 2014 Srdjan Capkun Frank K. Gürkaynak Adapted from Digital Design and Computer Architecture, David Money Harris & Sarah L. Harris ©2007 Elsevier http://www.syssec.ethz.ch/education/Digitaltechnik_14 Arithmetic Circuits
  • 2. Carnegie Mellon 2 In This Lecture  Why are arithmetic circuits so important  Adders  Adding two binary numbers  Adding more than two binary numbers  Circuits Based on Adders  Multipliers  Functions that do not use adders  Arithmetic Logic Units
  • 3. Carnegie Mellon 3 Motivation: Arithmetic Circuits  Core of every digital circuit  Everything else is side-dish, arithmetic circuits are the heart of the digital system  Determines the performance of the system  Dictates clock rate, speed, area  If arithmetic circuits are optimized performance will improve  Opportunities for improvement  Novel algorithms require novel combinations of arithmetic circuits, there is always room for improvement
  • 4. Carnegie Mellon 4 Example: ARM Microcontroller  Most popular embedded micro controller.  Contains:  Multiplier  Accumulator  ALU/Adder  Shifter  Incrementer
  • 7. Carnegie Mellon 7 Types of Arithmetic Circuits  In order of complexity:  Shift / Rotate  Compare  Increment / Decrement  Negation  Addition / Subtraction  Multiplication  Division  Square Root  Exponentation  Logarithmic / Trigonometric Functions
  • 8. Carnegie Mellon 8 Relation Between Arithmetic Operators
  • 9. Carnegie Mellon 9 Addition  Addition is the most important operation in computer arithmetic. Our topics will be:  Adding 1-bit numbers : Counting bits  Adding two numbers : Basics of addition  Circuits based on adders : Subtractors, Comparators  Adding multiple numbers : Chains of Adders  Later we will also talk about fast adder architectures
  • 10. Carnegie Mellon 10 Half-Adder (2,2) Counter  The Half Adder (HA) is the simplest arithmetic block  It can add two 1-bit numbers, result is a 2-bit number  Can be realized easily
  • 11. Carnegie Mellon 11 Full-Adder (3,2) Counter  The Full Adder (FA) is the essential arithmetic block  It can add three 1-bit numbers, result is a 2-bit number  There are many realizations both at gate and transistor level.  Since it is used in building many arithmetic operations, the performance of one FA influences the overall performance greatly.
  • 13. Carnegie Mellon 13 Adding Multiple Digits  Similar to decimal addition  Starting from the right, each digit is added  The carry from one digit is added to the digit to the left
  • 14. Carnegie Mellon 14 Adding Multiple Digits  Similar to decimal addition  Starting from the right, each digit is added  The carry from one digit is added to the digit to the left
  • 16. Carnegie Mellon 16 Curse of the Carry The most significant outputs of the adder depends on the least significant inputs
  • 17. Carnegie Mellon 17 Adding Multiple Numbers  Multiple fast adders not a good idea  If more than 2 numbers are to be added, multiple fast adders are not really efficient  Use an array of ripple carry adders  Popular and efficient solution  Use carry save adder trees  Instead of using carry propagate adders (the adders we have seen so far), carry save adders are used to reduce multiple inputs to two, and then a single carry propagate adder is used to sum up.
  • 18. Carnegie Mellon 18 Array of Ripple Carry Adders
  • 19. Carnegie Mellon 19 Carry Save Principle  Reduces three numbers to two with a single gate delay C + S = E + F + G
  • 20. Carnegie Mellon 20 Carry Save Principle Z = D + E + F + G + H  An array of carry save adders reduce the inputs to two  A final (fast) carry propagate adder (CPA) merges the two numbers  Performance mostly dictated by CPA
  • 21. Carnegie Mellon 21 Multipliers  Largest common arithmetic block  Requires a lot of calculation  Has three parts  Partial Product Generation  Carry Save Tree to reduce partial products  Carry Propagate Adder to finalize the addition  Adder performance (once again) is important  Many optimization alternatives
  • 24. Carnegie Mellon 24 For n-bit Multiplier m-bit Multiplicand  Generate Partial Products  For each bit of the multiplier the partial product is either  when ‘0’: all zeroes  when ‘1’: the multiplicand achieved easily by AND gates  Reduce Partial Products  This is the job of a carry save adder  Generate the Result (n + m bits)  This is a large, fast Carry Propagate Adder
  • 27. Carnegie Mellon 27 Operations Based on Adders  Several well-known arithmetic operation are based on adders:  Negator  Incrementer  Subtracter  Adder Subtracter  Comparator
  • 28. Carnegie Mellon 28 Negating Two’s Complement Numbers  To negate a two’s complement number -A = A + 1  All bits are inverted  One is added to the result  Can be realized easily by an adder.  B input is optimized away
  • 29. Carnegie Mellon 29 Incrementer  B input is zero  Carry In (Cin) of the adder can be used as the Increment (Inc) input  Decrementer similar in principle
  • 30. Carnegie Mellon 30 Subtracter  B input is inverted  Cin of the adder is used to complement B
  • 31. Carnegie Mellon 31 Subtracter  B input is inverted  Cin of the adder is used to complement B  It can be made programmable so that both additions and subtractions can be performed at the same time
  • 32. Carnegie Mellon 32 Comparator  Based on a Subtractor (A = B) = EQ (A != B) = EQ (A > B) = GE EQ (A >= B) = GE (A < B) = GE (A <= B) = GE + EQ
  • 33. Carnegie Mellon 33 Functions Realized Without Adders  Not all arithmetic functions are realized by using adders  Shift / Rotate Units  Binary Logic functions are also used by processors  AND  OR  XOR  NOT These are implemented very easily
  • 34. Carnegie Mellon 34 Shifters  Logical shifter: shifts value to left or right and fills empty spaces with 0’s  Ex: 11001 >> 2 = ??  Ex: 11001 << 2 = ??  Arithmetic shifter: same as logical shifter, but on right shift, fills empty spaces with the old most significant bit (msb).  Ex: 11001 >>> 2 = ??  Ex: 11001 <<< 2 = ??  Rotator: rotates bits in a circle, such that bits shifted off one end are shifted into the other end  Ex: 11001 ROR 2 = ??  Ex: 11001 ROL 2 = ??
  • 35. Carnegie Mellon 35 Shifters  Logical shifter: shifts value to left or right and fills empty spaces with 0’s  Ex: 11001 >> 2 = 00110  Ex: 11001 << 2 = 00100  Arithmetic shifter: same as logical shifter, but on right shift, fills empty spaces with the old most significant bit (msb).  Ex: 11001 >>> 2 = 11110  Ex: 11001 <<< 2 = 00100  Rotator: rotates bits in a circle, such that bits shifted off one end are shifted into the other end  Ex: 11001 ROR 2 = 01110  Ex: 11001 ROL 2 = 00111
  • 36. Carnegie Mellon 36 Shifter Design A3:0 Y3:0 shamt1:0 >> 2 4 4 A3 A2 A1 A0 Y3 Y2 Y1 Y0 shamt1:0 00 01 10 11 S1:0 S1:0 S1:0 S1:0 00 01 10 11 00 01 10 11 00 01 10 11 2
  • 37. Carnegie Mellon 37 Shifters as Multipliers and Dividers  A left shift by N bits multiplies a number by 2N  Ex: 00001 << 2 = 00100 (1 × 22 = 4)  Ex: 11101 << 2 = 10100 (-3 × 22 = -12)  The arithmetic right shift by N divides a number by 2N  Ex: 01000 >>> 2 = 00010 (8 ÷ 22 = 2)  Ex: 10000 >>> 2 = 11100 (-16 ÷ 22 = -4)
  • 38. Carnegie Mellon 38 Other Functions  We have covered 90% of the arithmetic functions commonly used in a CPU  Division  Dedicated architectures not very common  Mostly implemented by existing hardware (multipliers, subtractors comparators) iteratively  Exponential, Logarithmic, Trigonometric Functions  Dedicated hardware (less common)  Numerical approximations: exp(x) = 1 + x2/2! + x3/3! + …  Look-up tables (more common)
  • 39. Carnegie Mellon 39 Arithmetic Logic Unit The reason why we study digital circuits: the part of the CPU that does something (other than copying data)  Defines the basic operations that the CPU can perform directly  Other functions can be realized using the existing ones iteratively. (i.e. multiplication can be realized by shifting and adding)  Mostly, a collection of resources that work in parallel.  Depending on the operation one of the outputs is selected
  • 40. Carnegie Mellon 40 Example: Arithmetic Logic Unit (ALU), pg243 ALU N N N 3 A B Y F F2:0 Function 000 A & B 001 A | B 010 A + B 011 not used 100 A & ~B 101 A | ~B 110 A - B 111 SLT
  • 41. Carnegie Mellon 41 Example: ALU Design + 2 0 1 A B Cout Y 3 0 1 F2 F1:0 [N-1] S N N N N N N N N N 2 Zero Extend F2:0 Function 000 A & B 001 A | B 010 A + B 011 not used 100 A & ~B 101 A | ~B 110 A - B 111 SLT
  • 42. Carnegie Mellon 42 Set Less Than (SLT) Example  Configure a 32-bit ALU for the set if less than (SLT) operation. Suppose A = 25 and B = 32.  A is less than B, so we expect Y to be the 32-bit representation of 1 (0x00000001). + 2 0 1 A B Cout Y 3 0 1 F2 F1:0 [N-1] S N N N N N N N N N 2 Zero Extend
  • 43. Carnegie Mellon 43 Set Less Than (SLT) Example  Configure a 32-bit ALU for the set if less than (SLT) operation. Suppose A = 25 and B = 32.  A is less than B, so we expect Y to be the 32-bit representation of 1 (0x00000001).  For SLT, F2:0 = 111.  F2 = 1 configures the adder unit as a subtracter. So 25 - 32 = -7.  The two’s complement representation of -7 has a 1 in the most significant bit, so S31 = 1.  With F1:0 = 11, the final multiplexer selects Y = S31 (zero extended) = 0x00000001 + 2 0 1 A B Cout Y 3 0 1 F2 F1:0 [N-1] S N N N N N N N N N 2 Zero Extend
  • 44. Carnegie Mellon 44 What Did We Learn?  How can we add, subtract, multiply binary numbers  What other circuits depend on adders  Subtracter  Incrementer  Comparator  Important part of Multiplier  Other functions (shifting)  How is an Arithmetic Logic Unit constructed