SlideShare a Scribd company logo
1
William Stallings
Computer Organization
and Architecture
Chapter 8
Computer Arithmetic
2
Arithmetic & Logic Unit
aDoes the calculations
aEverything else in the computer is there to
service this unit
aHandles integers
aMay handle floating point (real) numbers
aMay be separate FPU (maths co-processor)
aMay be on chip separate FPU (486DX +)
3
ALU Inputs and Outputs
4
Integer Representation
aOnly have 0 & 1 to represent everything
aPositive numbers stored in binary
`e.g. 41=00101001
aNo minus sign
aNo period
aSign-Magnitude
aTwo’s compliment
5
Sign-Magnitude
aLeft most bit is sign bit
a0 means positive
a1 means negative
a+18 = 00010010
a -18 = 10010010
aProblems
`Need to consider both sign and magnitude in
arithmetic
`Two representations of zero (+0 and -0)
6
Two’s Compliment
a+3 = 00000011
a+2 = 00000010
a+1 = 00000001
a+0 = 00000000
a -1 = 11111111
a -2 = 11111110
a -3 = 11111101
7
Benefits
aOne representation of zero
aArithmetic works easily (see later)
aNegating is fairly easy
`3 = 00000011
`Boolean complement gives 11111100
`Add 1 to LSB 11111101
8
Geometric Depiction of Twos
Complement Integers
9
Negation Special Case 1
a 0 = 00000000
aBitwise not 11111111
aAdd 1 to LSB +1
aResult 1 00000000
aOverflow is ignored, so:
a- 0 = 0 √
10
Negation Special Case 2
a-128 = 10000000
abitwise not 01111111
aAdd 1 to LSB +1
aResult 10000000
aSo:
a-(-128) = -128 X
aMonitor MSB (sign bit)
aIt should change during negation
11
Range of Numbers
a8 bit 2s compliment
`+127 = 01111111 = 27 -1
` -128 = 10000000 = -27
a16 bit 2s compliment
`+32767 = 011111111 11111111 = 215 - 1
` -32768 = 100000000 00000000 = -215
12
Conversion Between Lengths
aPositive number pack with leading zeros
a+18 = 00010010
a+18 = 00000000 00010010
aNegative numbers pack with leading ones
a-18 = 10010010
a-18 = 11111111 10010010
ai.e. pack with MSB (sign bit)
13
Addition and Subtraction
aNormal binary addition
aMonitor sign bit for overflow
aTake twos compliment of substahend and add
to minuend
`i.e. a - b = a + (-b)
aSo we only need addition and complement
circuits
14
Hardware for Addition and
Subtraction
15
Multiplication
aComplex
aWork out partial product for each digit
aTake care with place value (column)
aAdd partial products
16
Multiplication Example
a 1011 Multiplicand (11 dec)
a 1101 Multiplier (13 dec)
a 1011 Partial products
a 0000 Note: if multiplier bit is 1 copy
a 1011 multiplicand (place value)
a 1011 otherwise zero
a 10001111 Product (143 dec)
a Note: need double length result
17
Unsigned Binary Multiplication
18
Execution of Example
19
Flowchart for Unsigned Binary
Multiplication
20
Multiplying Negative Numbers
aThis does not work!
aSolution 1
`Convert to positive if required
`Multiply as above
`If signs were different, negate answer
aSolution 2
`Booth’s algorithm
21
Booth’s Algorithm
22
Example of Booth’s Algorithm
23
Division
aMore complex than multiplication
aNegative numbers are really bad!
aBased on long division
24
001111
Division of Unsigned Binary
Integers
1011
00001101
10010011
1011
001110
1011
1011
100
Quotient
Dividend
Remainder
Partial
Remainders
Divisor
25
start
A = 0
M = Divisor
Q = Dividend
Count = n
Division Algorithm
Shift Left A,Q
A = A - M
A<0
?
Q0 = 0
A = A + M
Q0 = 1
Count = Count - 1
Count = 0
?
Stop
Y
N
N Y
26
Example
A Q M = 0011
0000 0111 Initial value
0000 1110 Shift
1101 Subtract
0000 1110 Restore
0001 1100 Shift
1110 Subtract
0001 1100 Restore
0011 1000 Shift
0000 Subtract
0000 1001 Set Q0 = 1
0001 0010 Shift
1110 Subtract
0001 0010 Restore
27
Real Numbers
aNumbers with fractions
aCould be done in pure binary
`1001.1010 = 24 + 20 +2-1 + 2-3 =9.625
aWhere is the binary point?
aFixed?
`Very limited
aMoving?
`How do you show where it is?
28
Floating Point
a+/- .significand x 2exponent
aMisnomer
aPoint is actually fixed between sign bit and body
of mantissa
aExponent indicates place value (point position)
Sign
bit
Biased
Exponent
Significand or Mantissa
29
Floating Point Examples
30
Signs for Floating Point
aMantissa is stored in 2s compliment
aExponent is in excess or biased notation
`e.g. Excess (bias) 128 means
`8 bit exponent field
`Pure value range 0-255
`Subtract 128 to get correct value
`Range -128 to +127
31
Normalization
aFP numbers are usually normalized
ai.e. exponent is adjusted so that leading bit
(MSB) of mantissa is 1
aSince it is always 1 there is no need to store it
a(c.f. Scientific notation where numbers are
normalized to give a single digit before the
decimal point
ae.g. 3.123 x 103)
32
FP Ranges
aFor a 32 bit number
`8 bit exponent
`+/- 2256 ≈ 1.5 x 1077
aAccuracy
`The effect of changing lsb of mantissa
`23 bit mantissa 2-23 ≈ 1.2 x 10-7
`About 6 decimal places
33
Expressible Numbers
34
IEEE 754
aStandard for floating point storage
a32 and 64 bit standards
a8 and 11 bit exponent respectively
aExtended formats (both mantissa and exponent)
for intermediate results
35
FP Arithmetic +/-
aCheck for zeros
aAlign significands (adjusting exponents)
aAdd or subtract significands
aNormalize result
36
FP Arithmetic x/÷
aCheck for zero
aAdd/subtract exponents
aMultiply/divide significands (watch sign)
aNormalize
aRound
aAll intermediate results should be in double
length storage
37
Floating
Point
Multiplication
38
Floating
Point
Division
39
Required Reading
aStallings Chapter 8
aIEEE 754 on IEEE Web site

More Related Content

PPT
09 Arithmetic
PPT
Computer Arithmetic_Computer_Architecture.ppt
PPT
09 arithmetic
PPT
arithmetic
PPTX
Computer Organization - Arithmetic & Logic Unit.pptx
PPTX
PPTX
2 Computer Arithmetic_hhbyhbjhhjjjjjb41.pptx
PPT
09 arithmetic
09 Arithmetic
Computer Arithmetic_Computer_Architecture.ppt
09 arithmetic
arithmetic
Computer Organization - Arithmetic & Logic Unit.pptx
2 Computer Arithmetic_hhbyhbjhhjjjjjb41.pptx
09 arithmetic

Similar to Organisasi dan Arsitektur Komputer MO-08 (20)

PPT
09 arithmetic
PPT
09 arithmetic 2
PDF
DigitalLogic_NumberRepresentation.pdf advanced
DOCX
Computer organization and architecture lab manual
PPS
Arithmetic Operations
PPS
Arithmetic Process in Computer Systems
PPTX
Number system
PPT
Number system on various number tyoes decimal
PDF
Datarepresentation2
PPT
Data representation moris mano ch 03
PPTX
PPT
Counit2
PDF
Binaty Arithmetic and Binary coding schemes
PPT
100_2_digitalSystem_Chap1 (2).ppt
PPT
digital systems and information
PPTX
Data Representation.pptx
PPT
Number_Systems decimal, binary, octal, and hexadecimal
PPT
Number_Systems _binary_octal_hex_dec.ppt
PPT
An introduction to the different number systems
PPT
Number Systems and its effectiveness .ppt
09 arithmetic
09 arithmetic 2
DigitalLogic_NumberRepresentation.pdf advanced
Computer organization and architecture lab manual
Arithmetic Operations
Arithmetic Process in Computer Systems
Number system
Number system on various number tyoes decimal
Datarepresentation2
Data representation moris mano ch 03
Counit2
Binaty Arithmetic and Binary coding schemes
100_2_digitalSystem_Chap1 (2).ppt
digital systems and information
Data Representation.pptx
Number_Systems decimal, binary, octal, and hexadecimal
Number_Systems _binary_octal_hex_dec.ppt
An introduction to the different number systems
Number Systems and its effectiveness .ppt
Ad

More from EriekOrlando (20)

PDF
Pertemuan 04 - Media Transmisi Wire dan Wireless.pdf
PDF
Pertemuan 07 - Subnetting Cara Cepat.pdf
PPTX
Komunikasi Data dan Jaringan Komputer (Network Security)
PPT
Bab 1 Keamanan Jaringa Komputer (Network Security)
PDF
Organisasi dan Arsitektur Komputer MO-05
PDF
Organisasi dan Arsitektur Komputer MO-04
PDF
Organisasi dan Arsitektur Komputer MO-03
PDF
Organisasi dan Arsitektur Komputer MO-02
PDF
Organisasi dan Arsitektur Komputer MO-01
PDF
Organisasi dan Arsitektur Komputer MO-09
PDF
Organisasi dan Arsitektur Komputer MO-07
PDF
Organisasi dan Arsitektur Komputer MO-06
PDF
pert_ke_9_sistem_cerdas pert_ke_9_sistem_cerdas pert_ke_9_sistem_cerdas pert_...
PPT
Algoritma Kriptografi Modern bagian 1 - Kriptografi Digital
PPT
Keamanan Sistem Informasi Pengamanan Sistem Website
PPTX
PPT-UEU-Kecerdasan-Buatan-Pertemuan-1 SI
PPT
Pengantar Organisasi dan Arsitektur Komputer Pertemuan I
PPT
regresi-linier_file_2013-06-01_102244_mukhamad_taufik_hidayat_se._m.si__akt__...
PDF
Pendahuluan Komunikasi Data Karateristik Dasar Komunikasi
PDF
Modul Komunikasi Data - Topologi Jaringan
Pertemuan 04 - Media Transmisi Wire dan Wireless.pdf
Pertemuan 07 - Subnetting Cara Cepat.pdf
Komunikasi Data dan Jaringan Komputer (Network Security)
Bab 1 Keamanan Jaringa Komputer (Network Security)
Organisasi dan Arsitektur Komputer MO-05
Organisasi dan Arsitektur Komputer MO-04
Organisasi dan Arsitektur Komputer MO-03
Organisasi dan Arsitektur Komputer MO-02
Organisasi dan Arsitektur Komputer MO-01
Organisasi dan Arsitektur Komputer MO-09
Organisasi dan Arsitektur Komputer MO-07
Organisasi dan Arsitektur Komputer MO-06
pert_ke_9_sistem_cerdas pert_ke_9_sistem_cerdas pert_ke_9_sistem_cerdas pert_...
Algoritma Kriptografi Modern bagian 1 - Kriptografi Digital
Keamanan Sistem Informasi Pengamanan Sistem Website
PPT-UEU-Kecerdasan-Buatan-Pertemuan-1 SI
Pengantar Organisasi dan Arsitektur Komputer Pertemuan I
regresi-linier_file_2013-06-01_102244_mukhamad_taufik_hidayat_se._m.si__akt__...
Pendahuluan Komunikasi Data Karateristik Dasar Komunikasi
Modul Komunikasi Data - Topologi Jaringan
Ad

Recently uploaded (20)

PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
Web App vs Mobile App What Should You Build First.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Getting Started with Data Integration: FME Form 101
PDF
Hybrid model detection and classification of lung cancer
PDF
Approach and Philosophy of On baking technology
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Mushroom cultivation and it's methods.pdf
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
cloud_computing_Infrastucture_as_cloud_p
NewMind AI Weekly Chronicles - August'25-Week II
1 - Historical Antecedents, Social Consideration.pdf
DP Operators-handbook-extract for the Mautical Institute
Web App vs Mobile App What Should You Build First.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Accuracy of neural networks in brain wave diagnosis of schizophrenia
OMC Textile Division Presentation 2021.pptx
Encapsulation_ Review paper, used for researhc scholars
MIND Revenue Release Quarter 2 2025 Press Release
Getting Started with Data Integration: FME Form 101
Hybrid model detection and classification of lung cancer
Approach and Philosophy of On baking technology
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Mushroom cultivation and it's methods.pdf
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Group 1 Presentation -Planning and Decision Making .pptx

Organisasi dan Arsitektur Komputer MO-08