Professional Documents
Culture Documents
Module:2
Computer Arithmetic ( 5 Hours)
Data Representation, Hardware and software implementation of arithmetic
unit for common arithmetic operations: addition, subtraction, multiplication,
division( Fixed point and floating point)-floating point IEEE standards
Complements
* Data
- Numeric Data
Numbers( Integer, real)
- Non-numeric Data
Letters, Symbols
* Program (Instruction)
Prepared by Dr.I. Mala Serene, SITE,VIT University
Numeric Data Representation
Data
Numeric data - numbers(integer, real)
Non-numeric data - symbols, letters
Number System
Non positional number system
- Roman number system
Positional number system
- Each digit position has a value called a weight
associated with it
- Decimal, Octal, Hexadecimal, Binary
Base (or radix) R number
- Uses R distinct symbols for each digit
- Example AR = an-1 an-2 ... a1 a0 .a-1…a-m
n 1
Radix point(.) separates the integer
- V(AR ) =
a R
i m
i
i
portion and the fractional portion
- Following 3 representations
Signed Magnitude
Max: 2n - 2-m 011 ... 11.11 ... 1
Min: -(2n - 2-m) 111 ... 11.11 ... 1
Zero: +0 000 ... 00.00 ... 0
-0 100 ... 00.00 ... 0
Example
6 0 0110 -6 1 1010
+) 9 0 1001 +) 9 0 1001
15 0 1111 3 0 0011
6 0 0110 -9 1 0111
+) -9 1 0111 +) -9 1 0111
-3 1 1101 -18 (1)0 1110
x’n-1y’n-1sn-1
(cn-1 cn)
9 0 1001 overflow
+) 9 0 1001 2 operands have the same sign
18 1 0010 and the result sign changes
xn-1yn s’n-1 xn-1yn-1s’n-1 + x’n-1y’n-1sn-1 = cn-1 cn
(cn-1 cn)
COMPARISON OF REPRESENTATIONS
* Easiness of negative conversion
* Hardware
* Speed of Arithmetic
* Recognition of Zero
Note:
•8 bit result that should have been positive has a negative sign bit
•8 bit result that should have been negative has a positive sign bit.
Detection of Overflow:
•By observing the carry into the sign bit position and the carry out of the sign
bit position.
•If the two carries are applied to an exclusive-OR gate, an overflow will be
detected when the output of the gate is equal to 1
Overflow of Signed Numbers
F = EM
- Mantissa
Signed fixed point number, either an integer or a fractional number
- Exponent
Designates the position of the radix point
Decimal Value
Example
A binary number +1001.11 in 16-bit floating point number representation
(6-bit exponent and 10-bit fractional mantissa)
0 0 00100 100111000
Sign Exponent Mantissa
or
0 0 00101 010011100
Normal Form