Professional Documents
Culture Documents
COD Lecture 3 - Students
COD Lecture 3 - Students
ORGANIZATION &
DESIGN
SE – CIS Batch 2018
Spring 2020
Lecture Plan
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
3
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
4
Notion Used
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 2- Computer Arithmetic
5
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
6
1 0 1 0
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
7
Sign bit is
retained 1 1 0 1 0
discarded
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
8
Example : - 7 x - 8 (4-bits)
A Q Q-1 Count Remarks
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
9
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
10
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
11
• Product is
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
14
Homework 3.1
1. Use Booth’s Algorithm to multiply following
decimal numbers: (Use only as many bits as
required for 2’s complement representation of
operands)
a) (+4) x (-5)
b) (-9) x (+3)
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
16
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
17
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
18
applications
Downside
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
19
in hardware
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
21
• Time consuming
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
22
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
23
111.101 x 𝟐 𝟓
= 111101 x 𝟐𝟐
= 1.11101 x 𝟐𝟕
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
24
representation in computers
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
25
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
26
Binary Representation
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
27
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
28
S (Sign bit)
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
29
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
30
Fraction Field
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
31
Example
Represent 101.1 x 2 19 in IEEE 754 Binary 32 Format
Sign Bit
• Sign of number is positive
31 30 23 22 2 1 0
Example
Represent 101.1 x 2 19 in IEEE 754 Binary 32 Format
Sign Bit
• Sign of number is positive
31 30 23 22 2 1 0
0
S Biased Exponent Fraction
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
33
Example – 101.1 x 2 19
Normalizing Significand
101.1x2 19
31 30 23 22 2 1 0
0
S Biased Exponent Fraction
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
34
Example – 101.1 x 2 19
Normalizing Significand
101.1x2 19
=1.011x2 19+2
31 30 23 22 2 1 0
0
S Biased Exponent Fraction
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
35
Example – 101.1 x 2 19
Normalizing Significand
101.1x2 19
31 30 23 22 2 1 0
0
S Biased Exponent Fraction
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
36
Example – 101.1 x 2 19
Normalizing Significand
101.1x2 19
Fraction : 0 1 1
31 30 23 22 2 1 0
0
S Biased Exponent Fraction
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
37
Example – 101.1 x 2 19
Normalizing Significand
101.1x2 19
Fraction : 0 1 1
31 30 23 22 2 1 0
0 0 11
S Biased Exponent Fraction
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
38
Example – 101.1 x 2 19
Normalizing Significand
101.1x2 19
Fraction : 0 1 1
remaining bits are filled up with 0
31 30 23 22 2 1 0
0 0 1100000000000000000000
S Biased Exponent Fraction
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
39
Example – 101.1 x 2 19
Biased Exponent
No : 1.011x2 21
31 30 23 22 2 1 0
0 0 1100000000000000000000
S Biased Exponent Fraction
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
40
Example – 101.1 x 2 19
Biased Exponent
No : 1.011x2 21
= 21 + 127 = 148
31 30 23 22 2 1 0
0 0 1100000000000000000000
S Biased Exponent Fraction
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
41
Example – 101.1 x 2 19
Biased Exponent
No : 1.011x2 21
= 21 + 127 = 148
= 10010100 )2
31 30 23 22 2 1 0
0 0 1100000000000000000000
S Biased Exponent Fraction
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
42
Example – 101.1 x 2 19
Biased Exponent
No : 1.011x2 21
= 21 + 127 = 148
= 10010100 )2
31 30 23 22 2 1 0
0 1 0 01010 0 0 1100000000000000000000
S Biased Exponent Fraction
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
43
Example – 101.1 x 2 19
101.1 x 2 19
31 30 23 22 2 1 0
0 1 0 0 1 0 10 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
S Biased Exponent Fraction
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
44
Example – 101.1 x 2 19
101.1 x 2 19
31 30 23 22 2 1 0
0 1 0 0 1 0 10 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
S Biased Exponent Fraction
In hexadecimal form
0x 4A300000
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
45
Class Activity
Represent given number using IEEE 754 Binary
32 Format (Single Precision Format)
111001.1001x2 -60
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
47
-1 1 1 0 0 1 . 1 0 0 1 x 2 -60
31 30 23 22 2 1 0
1 0 1 0 0 1 00 0 1 1 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
S Biased Exponent Fraction
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
48
Advantages of Normalization
1. Prevents multiple representation of same floating point
number
111.101 x 𝟐𝟓
= 111101 x 𝟐𝟐
= 1.11101 x 𝟐𝟕
Normalized Form
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
49
Advantages of Normalization
1. Prevents multiple representation of same floating point
number
111.101 x 𝟐𝟓
= 111101 x 𝟐𝟐
= 1.11101 x 𝟐𝟕
Normalized Form
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
50
Advantages of Normalization
2. Avoids storing 1 to the left of binary point
(also known as hidden 1 / implicit 1)
1.11101 x 𝟐𝟕
31 30 23 22 2 1 0
1 1101
S Biased Exponent Fraction
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
51
Advantages of Normalization
3. Avoids representing the position of the radix(binary) point
1.11101 x 𝟐 𝟕
31 30 23 22 2 1 0
1 1101
S Biased Exponent Fraction
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
52
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
53
• It is an unsigned notation
number
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
55
Comparison/Sorting of FP Numbers
• After biasing comparison/sorting can proceed in 3
steps
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
56
Homework 3.3
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
57
Recap
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
58
Reading Assignment
• Go through all relevant sections from
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali
CS-221 Computer Organization & Design Lecture 3- Computer Arithmetic
59
Stay Home
Stay Safe
Department of Computer & Information Systems Engineering, NED University Instructor: Anita Ali