×

Close

- COMPUTER ARCHITECTURE ORGANISATION - CAO
- Note
- 6 Topics
**416 Views**- 6 Offline Downloads
- Uploaded 7 months ago

Touch here to read

Page-1

Topic:

Chapter 1 Data Representation Number System Number of digits used in a number system is called its base or radix. We can categorize number system as below: - Binary number system - Octal Number System - Decimal Number System - Hexadecimal Number system Conversion between number systems (do yourself) Representation of Decimal numbers We can normally represent decimal numbers in one of following two ways - By converting into binary - By using BCD codes By converting into binary Advantage Arithmetic and logical calculation becomes easy. Negative numbers can be represented easily. Disadvantage At the time of input conversion from decimal to binary is needed and at the time of output conversion from binary to decimal is needed. Therefore this approach is useful in the systems where there is much calculation than input/output. By using BCD codes Disadvantage Arithmetic and logical calculation becomes difficult to do. Representation of negative numbers is tricky. Advantage At the time of input conversion from decimal to binary and at the time of output conversion from binary to decimal is not needed. Therefore this approach is useful in the systems where there is much input/output than arithmetic and logical calculation. ©Er. Anil Shah Page | 1

Complements (R-1)'s Complement (R-1)'s complement of a number N is defined as (rn -1) –N Where N is the given number r is the base of number system n is the number of digits in the given number To get the (R-1)'s complement fast, subtract each digit of a number from (R1) Example - 9's complement of 83510 is 16410 - 1's complement of 10102 is 01012(bit by bit complement operation) R's Complement R's complement of a number N is defined as rn –N Where N is the given number r is the base of number system n is the number of digits in the given number To get the R's complement fast, add 1 to the low-order digit of its (R-1)'s complement - 10's complement of 83510 is 16410 + 1 = 16510 - 2's complement of 10102 is 01012 + 1 = 01102 Representation of Negative numbers There is only one way of representing positive numbers in computer but we can represent negative numbers in any one of following three ways: - Signed magnitude representation - Signed 1’s complement representation - Signed 2’s complement representation Signed magnitude representation Complement only the sign bit e.g. +9 ==> 0 001001 -9 ==> 1 001001 Signed 1’s complement representation Complement all the bits including sign bit e.g. +9 ==> 0 001001 -9 ==> 1 110110 ©Er. Anil Shah Page | 2

Signed 2’s complement representation Take the 2's complement of the number, including its sign bit. e.g. +9 ==> 0 001001 -9 ==> 1 110111 Overflow Detection If we add two n bit numbers, result may be a number with n+1 bit which can not be stored in n-bit register. This situation is called overflow. We can detect whether there is overflow or not as below: Case Unsigned numbers Consider a 4-bit register Maximum numbers that can be stored N<= 2n -1 = 15 If there is no end carry => No overflow e.g. 6 0110 9 1001 15 1111 If there is end carry => Overflow. e.g. 9 1001 9 1001 (1)0010 Overflow Case Signed Numbers: Consider a 5-bit register Maximum and Minimum numbers that can be stored -2n-1 =< N<= +2n-1 -1 -16 =<N<= +15 To detect the overflow we seed to see two carries. Carry into the sign bit position and carry out of the sign bit position. If both carries are same => No overflow 6 0 0110 9 0 1001 15 0 1111 Here carry in sign bit position =cn-1= 0 carry out of sign bit position =cn= 0 ©Er. Anil Shah Page | 3

(cn-1 cn) = 0 => No overflow If both carries are different => overflow 9 +9 18 0 1001 0 1001 1 0010 Here carry in sign bit position =cn-1= 1 carry out of sign bit position =cn= 0 (cn-1 cn) = 1 => overflow Floating Point Representation Floating points are represented in computers as the format given below: Sign Exponent mantissa Mantissa Signed fixed point number, either an integer or a fractional number Exponent Designates the position of the decimal point Decimal Value N=m*re Where m is mantissa r is base e is exponent Example Consider the number N= 1324.567 Now m = 0.1324567 ©Er. Anil Shah Page | 4

## Leave your Comments