Computer System Architecture
,UNIT I
1. Data Representation
1.1 Introduction
1.2 Number System
1.2.1 Decimal Number System
1.2.2 Bi-stable Devices
1.2.3 Binary Number System
1.2.4 Octal number System
1.2.5 Hexadecimal Number System
1.3 Conversions
1.3.1 Decimal to Binary
1.3.2 Decimal to Octal
1.3.3 Decimal to Hexadecimal
1.3.4 Binary to Decimal
1.3.5 Binary to Octal
1.3.6 Binary to Hexadecimal
1.3.7 Octal to Decimal
1.3.8 Octal to Binary
1.3.9 Octal to Hexadecimal
1.3.10 Hexadecimal to Binary
1.3.11 Hexadecimal to Octal
1.3.12 Hexadecimal to Decimal
1.4 Complements
1.4.1 The (r-1)’s Complement
1.4.2 The r’s Complement
1.5 Binary Coded Decimal Number Representation
1.6 Excess 3 Code
1.7 Gray Code
,1.1 INTRODUCTION
As a mathematician, Laplace could well appreciate the decimal number system. He was
fully aware of the centuries of mental effort and sheer good luck, which had gone into the
development of the number system we use, and he was in a position to appreciate its advantages.
Our present number system provides modern mathematicians and scientists with a great
advantage over those of previous civilizations and is an important factor in our rapid
advancement.
Since hands are the most convenient tools nature has provided, human beings have
always tended to use them in counting. So the decimal number system followed naturally from
this usage.
As even simpler system, the binary number system has proved the most natural and
efficient system for computer use, however, and this chapter develops this number system along with
other systems used by computer technology.
1.2 NUMBER SYSTEM
A number system of base (also called radix) r is a system, which have r distinct symbols
for r digits. A number is represented by a string of these symbolic digits. To determine the
quantity that the number represents, we multiply the number by an integer power of r depending on the
place it is located and then find the sum of weighted digits.
1.2.1 DECMAL NUMBER SYSTEM
Decimal system is the most commonly used number system. Our present system of
numbers has 10 separate symbols namely 0,1,2,3,4,5,6,7,8 and 9, which are called Arabic
numerals. We would be forced to stop at 9 or to invent more symbols if it were not for the use of
positional notation.
The digit of a number system is a symbol, which represents an integral quantity.
The base or radix of a number system is defined as the number of different digits, which
can occur in each position in the number system. The decimal system has a base or radix
of 10.
An example of earlier types of notation can be found in Roman Numerals, which are
essential additive: III=I+I+I, XXV=X+X+V. The only importance of position in Roman
numerals lies in whether a symbol precedes or follows another symbol (IV= 4, while VI=6).
The actual meaning of 168 can be seen more clearly if we notice that it is spoken as “one
hundred and sixty eight”. Basically, the number is a contraction of 1*100+6*10+8. The
important point is that the value of each digit is determined by its position. Written numbers are
always contracted, however, and only the basic 10 numerals are used, regardless of the size of the
integer written. The general rule for representing numbers in the decimal system by using positional
notation is as follows:
a n-1 10n-1 + a n-2 10n-2 + ……. + a 0 is expressed as a n-1, a n-2 ….. a 0
where n is the number of digits to the left of the decimal point.
1.2.2 BISTABLE DEVICES
The basic elements in early computer are relays and switches. The operation of a switch
or relay can be seen to be essentially bi stable, or binary in nature; that is, the switch is either on
(1) or off (0). The principal circuit elements in modern computers are transistors. Because of the
large number of electronic parts used in computers, it is highly desirable to utilize them in such a
manner that slight changes in their characteristics will not affect their performance. The best way
of accomplishing this is to use circuits, which are basically bi stable (have two possible states).
, 1.2.3 BINARY NUMBER SYSTEM
Digital computers use the binary number system, which has only two symbols: 0 and 1.
The numbers in binary system are represented as combinations of these two symbols. The
decimal system uses power of 10 and binary system uses powers of 2.
The binary digit is also referred to as Bit (the acronym for Binary Digit). A string of 4
bits is called a nibble and a string of 8 bits is called a byte. A byte is the basic unit of data in
computers. The number 125 actually means 1* 102 + 2* 101 +5*100 . In binary system, the same
number (125) is represented as 1111101 meaning
1*26 +1* 25 +1* 24 +1*23 +1* 22 +0* 21 +1*2 0 The table 1.1 lists the first 20 binary numbers.
Decimal Binary Decimal Binary
1 1 11 1011
2 10 12 1100
3 11 13 1101
4 100 14 1110
5 101 15 1111
6 110 16 10000
7 111 17 10001
8 1000 18 10010
9 1001 19 10011
10 1010 20 10100
Table 1.1 First 20 Binary Numbers
To express the value of a binary number, therefore, a n-1 2n-1 + a n-2 2n-2 + ……. + a 0 is
expressed as a n-1, a n-2 ….. a 0 where ai is either 1 or 0 and n is the number of digits to the left of the
binary (radix) point.
1.2.4 OCTAL NUMBER SYSTEM
The octal number system has a base, or radix as 8: eight different symbols are used to
represent numbers. These are commonly 0,1,2,3,4,5,6,7. We show the first 20 octal numbers and their
decimal equivalents in the table 1.2.
DECIMAL OCTAL DECIMAL OCTAL
0 0 11 13
1 1 12 14
2 2 13 15
3 3 14 16
4 4 15 17
5 5 16 20
6 6 17 21
7 7 18 22
8 10 19 23
9 11 20 24
10 12 21 25
Table 1.2 First 20 Octal Numbers
,UNIT I
1. Data Representation
1.1 Introduction
1.2 Number System
1.2.1 Decimal Number System
1.2.2 Bi-stable Devices
1.2.3 Binary Number System
1.2.4 Octal number System
1.2.5 Hexadecimal Number System
1.3 Conversions
1.3.1 Decimal to Binary
1.3.2 Decimal to Octal
1.3.3 Decimal to Hexadecimal
1.3.4 Binary to Decimal
1.3.5 Binary to Octal
1.3.6 Binary to Hexadecimal
1.3.7 Octal to Decimal
1.3.8 Octal to Binary
1.3.9 Octal to Hexadecimal
1.3.10 Hexadecimal to Binary
1.3.11 Hexadecimal to Octal
1.3.12 Hexadecimal to Decimal
1.4 Complements
1.4.1 The (r-1)’s Complement
1.4.2 The r’s Complement
1.5 Binary Coded Decimal Number Representation
1.6 Excess 3 Code
1.7 Gray Code
,1.1 INTRODUCTION
As a mathematician, Laplace could well appreciate the decimal number system. He was
fully aware of the centuries of mental effort and sheer good luck, which had gone into the
development of the number system we use, and he was in a position to appreciate its advantages.
Our present number system provides modern mathematicians and scientists with a great
advantage over those of previous civilizations and is an important factor in our rapid
advancement.
Since hands are the most convenient tools nature has provided, human beings have
always tended to use them in counting. So the decimal number system followed naturally from
this usage.
As even simpler system, the binary number system has proved the most natural and
efficient system for computer use, however, and this chapter develops this number system along with
other systems used by computer technology.
1.2 NUMBER SYSTEM
A number system of base (also called radix) r is a system, which have r distinct symbols
for r digits. A number is represented by a string of these symbolic digits. To determine the
quantity that the number represents, we multiply the number by an integer power of r depending on the
place it is located and then find the sum of weighted digits.
1.2.1 DECMAL NUMBER SYSTEM
Decimal system is the most commonly used number system. Our present system of
numbers has 10 separate symbols namely 0,1,2,3,4,5,6,7,8 and 9, which are called Arabic
numerals. We would be forced to stop at 9 or to invent more symbols if it were not for the use of
positional notation.
The digit of a number system is a symbol, which represents an integral quantity.
The base or radix of a number system is defined as the number of different digits, which
can occur in each position in the number system. The decimal system has a base or radix
of 10.
An example of earlier types of notation can be found in Roman Numerals, which are
essential additive: III=I+I+I, XXV=X+X+V. The only importance of position in Roman
numerals lies in whether a symbol precedes or follows another symbol (IV= 4, while VI=6).
The actual meaning of 168 can be seen more clearly if we notice that it is spoken as “one
hundred and sixty eight”. Basically, the number is a contraction of 1*100+6*10+8. The
important point is that the value of each digit is determined by its position. Written numbers are
always contracted, however, and only the basic 10 numerals are used, regardless of the size of the
integer written. The general rule for representing numbers in the decimal system by using positional
notation is as follows:
a n-1 10n-1 + a n-2 10n-2 + ……. + a 0 is expressed as a n-1, a n-2 ….. a 0
where n is the number of digits to the left of the decimal point.
1.2.2 BISTABLE DEVICES
The basic elements in early computer are relays and switches. The operation of a switch
or relay can be seen to be essentially bi stable, or binary in nature; that is, the switch is either on
(1) or off (0). The principal circuit elements in modern computers are transistors. Because of the
large number of electronic parts used in computers, it is highly desirable to utilize them in such a
manner that slight changes in their characteristics will not affect their performance. The best way
of accomplishing this is to use circuits, which are basically bi stable (have two possible states).
, 1.2.3 BINARY NUMBER SYSTEM
Digital computers use the binary number system, which has only two symbols: 0 and 1.
The numbers in binary system are represented as combinations of these two symbols. The
decimal system uses power of 10 and binary system uses powers of 2.
The binary digit is also referred to as Bit (the acronym for Binary Digit). A string of 4
bits is called a nibble and a string of 8 bits is called a byte. A byte is the basic unit of data in
computers. The number 125 actually means 1* 102 + 2* 101 +5*100 . In binary system, the same
number (125) is represented as 1111101 meaning
1*26 +1* 25 +1* 24 +1*23 +1* 22 +0* 21 +1*2 0 The table 1.1 lists the first 20 binary numbers.
Decimal Binary Decimal Binary
1 1 11 1011
2 10 12 1100
3 11 13 1101
4 100 14 1110
5 101 15 1111
6 110 16 10000
7 111 17 10001
8 1000 18 10010
9 1001 19 10011
10 1010 20 10100
Table 1.1 First 20 Binary Numbers
To express the value of a binary number, therefore, a n-1 2n-1 + a n-2 2n-2 + ……. + a 0 is
expressed as a n-1, a n-2 ….. a 0 where ai is either 1 or 0 and n is the number of digits to the left of the
binary (radix) point.
1.2.4 OCTAL NUMBER SYSTEM
The octal number system has a base, or radix as 8: eight different symbols are used to
represent numbers. These are commonly 0,1,2,3,4,5,6,7. We show the first 20 octal numbers and their
decimal equivalents in the table 1.2.
DECIMAL OCTAL DECIMAL OCTAL
0 0 11 13
1 1 12 14
2 2 13 15
3 3 14 16
4 4 15 17
5 5 16 20
6 6 17 21
7 7 18 22
8 10 19 23
9 11 20 24
10 12 21 25
Table 1.2 First 20 Octal Numbers