Chapter 1 - Data Representation 1.1 - Data Types
Chapter 1 - Data Representation 1.1 - Data Types
Chapter 1 - Data Representation 1.1 - Data Types
A number system of base, or radix, r is a system that uses distinct symbols for r
digits
Numbers are represented by a string of digit symbols
The string of digits 724.5 represents the quantity
The string of digits 101101 in the binary number system represents the quantity
1 x 25 + 0 x 24 + 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20 = 45
(101101)2 = (45)10
We will also use the octal (radix 8) and hexidecimal (radix 16) number systems
ASCII:
The standard alphanumeric binary code is ASCII
ASCII stands for American Standard Code for Information Interchange.
This uses seven bits to code ie. 27 =128 characters.
However, Manufacturers have added an eight bit to this coding scheme, which
provide for 256 characters
This eight bit coding scheme is referred to as an 8 bit ASCII.
Binary codes are required since registers can hold binary information only.
It includes 128 characters: 33 are non printing control character that affect how text
and space is processed.
95 are printable characters, includingspace.
It is very well known fact that computers can manage internally only 0s (zeros) and
1s (ones).
Complements
Complements are used in digital computers for simplifying subtraction and logical
manipulation
Two types of complements for each base r system: r’s complement and (r – 1)’s
complement
Given a number N in base r having n digits, the (r – 1)’s complement of N is
defined as (rn – 1) – N
M = 72352
10’s comp. of N = +86750
Sum = 159282
Discard end carry = -100000
Answer = 59282
M = 13250
10’s comp. of N = +27468
Sum = 40718
No end carry
Answer = -59282 (10’s comp. of 40718)
X = 1010100
2’s comp. of Y = +0111101
Sum = 10010001
Discard end carry = -10000000
Answer X – Y = 0010001
Y = 1000011
2’s comp. of X = +0101100
Sum = 1101111
No end carry
Answer = -0010001 (2’s comp. of 1101111)
Fixed-Point Representation
When an integer is positive, the msb, or sign bit, is 0 and the remaining bits
represent the magnitude
When an integer is negative, the msb, or sign bit, is 1, but the rest of the number
can be represented in one of three ways
o Signed-magnitude representation
o Signed-1’s complement representation
o Signed-2’s complement representation
+6 00000110 -6 11111010
+13 00001101 +13 00001101
+19 00010011 +7 00000111
+6 00000110 -6 11111010
-13 11110011 -13 11110011
-7 11111001 -19 11101101
An overflow occurs when two numbers of n digits each are added and the sum
occupies n + 1 digits
Overflows are problems since the width of a register is finite
Therefore, a flag is set if this occurs and can be checked by the user
Detection of an overflow depends on if the numbers are signed or unsigned
For unsigned numbers, an overflow is detected from the end carry out of the msb
For addition of signed numbers, an overflow cannot occur if one is positive and
one is negative – both have to have the same sign
An overflow can be detected if the carry into the sign bit position and the carry
out of the sign bit position are not equal
Floating-Point Representation
The 2421 code and the excess-3 code are both self-complementing
The 9’s complement of each digit is obtained by complementing each bit in the
code
The 2421 code is a weighted code
The bits are multiplied by indicated weights and the sum gives the decimal digit
The excess-3 code is obtained from the corresponding BCD code added to 3
The P(odd) bit is chosen to make the sum of 1’s in all four bits odd
The even-parity scheme has the disadvantage of having a bit combination of all
0’s
Procedure during transmission:
o At the sending end, the message is applied to a parity generator
o The message, including the parity bit, is transmitted
o At the receiving end, all the incoming bits are applied to a parity checker
o Any odd number of errors are detected
Parity generators and checkers are constructed with XOR gates (odd function)
An odd function generates 1 iff an odd number if input variables are 1
11 Compiled By :- Er. Saroj Kr Yadav | Reference :- W. Stalling & M Mano
Computer Architecture And organization Unit –1 Data Representation