Download Computer Organisation - Data Representation and more Study notes Computer Architecture and Organization in PDF only on Docsity!
Data Representation
Information in digital
computers
(^) Program instructions
(^) Data ▫Numeric data (^) Integers (^) Real numbers ▫Non-numeric (^) Letters of the alphabet (^) Other discrete symbols
Arbitrary r
(^) Decimal – Base 5
(85) 10
5
(^) Base 5 -> Decimal
(320) 5 -> 3 x 5 2 + 2 x 5 1 +0 x 5 0
Conversion
(^) Conversion of Decimal integer into base r ▫Successive division by r and accumulation of the remainders
(^) Conversion of Decimal fraction to radix r ▫Successive multiplication by r and accumulation of the integer digits so obtained
(r-1)’s Complement
(^) Subtract each digit of no from (r-1)
(^) example ▫ (^) 9's complement of 835 10 is 164 10 ▫ (^) 1's complement of 1010 2 is 0101 2
r’s Complement
(^) Add 1 to lower order digit of its (r-1)’s complement
(^) Example ▫10's complement of 835 10 is 164 10 + 1 = 165 10 ▫2's complement of 1010 2 is 0101 2 + 1 = 0110 2
Signed – Magnitude
Representation
Sign bit
2’s Complement
Representation
Addition and Subtraction in 2’s comp
(^) Addition ▫(+A)+(+B), (+A)+(-B), (-A)+(+B), (-A)+(-B) ▫-ve Numbers are in 2’s Comp. ▫Perform Sum using Adder on operand A and B
(^) Subtraction ▫(+A)-(+B), (+A)-(-B), (-A)-(+B), (-A)-(-B) ▫Convert B to 2’s Comp. Form ▫Perform Sum using Adder using operand A and 2’s Comp of B
Arithmetic operations using 2’s comp.
10
2
(27) 10
2
(^) 85-27->85+(-27)-
(01010101) 2
2 ->(( 1 )00111010) 2
10
(^) 27-85->27+(-85)-
(00011011) 2
2
Comparison of representations
(^) Easiness of negative conversion S + M > 1’s Complement > 2’s Complement
(^) Hardware
S+M: Needs an adder and a subtractor for Addition 1’s and 2’s Complement: Need only an adder
(^) Speed of Arithmetic 2’s Complement > 1’s Complement(end-around C)
(^) Recognition of Zero 2’s Complement is fast
BCD Representation
(^) Binary Coded Decimal ▫Good for External Representation ▫Used in Calculators and Small Business systems ▫Eliminate the need for conversion from Binary to decimal