Professional Documents
Culture Documents
Text Books:
1. M. Morris Mano, “Computer System Architecture”, Prentice-Hall of India, Pvt. Ltd.,Third
edition, 2007
References Books:
1. William Stallings, “Computer Organization and Architecture”, Prentice-Hall of India,Pvt.
Ltd., Seventh edition, 2005.
2. Vincent P. Heuring and Harry F. Jordan, “Computer System Design and Architecture”,
Prentice-Hall of India, Pvt. Ltd., Second edition, 2003.
Soch college of IT - Hari K.C.
Chapter 01: Data Representation
Number System
• Number of digits used in a number system is called its base or radix (r).
We can categorize number system as below:
- Binary number system (r = 2)
- Octal Number System (r = 8)
- Decimal Number System (r = 10)
- Hexadecimal Number system (r = 16)
• Digital computer is a digital system that perform various
computational tasks
• The word “digital” implies that information in computer is
represented by variables that take discrete values.
• For example: 0,1,2,3,4,5........,8,9 provide 10 discrete values.
• For example: 0,1 provide 2 discrete values
• It is easier to realize computing machine with a logic that has only
two states.
• True –False, 1 -0, high – low, on-off etc.
• Digital computers use binary number system which has two states: 0
and 1
• A binary digit is called a bit.
• Information is represented in digital computer using group of bits.
• Data representation refer to the internal method used to represent
various types of data stored in the digital computer.
• Computer used different types of codes to represent data such as
text, images, video and sound.
• 1 or 0 = bits
• 8 bits = 1 byte
• 2 or more bytes = 1 word
Data Types
• Registers and Main memory are the effective way to store the data in
the computers
• Data type refer to the size and types of data used in computer.
• It can be classified as :
a) Numbers= integers, decimal
b) Letters= A, F,
c) Discrete symbols: IV
They are used as needed for arithmetic computation, data processing
and other specific purposes.
Number systems
• Number system is the way to represent the numbers.
• A number system of base or radix , r is a system that uses distinct symbols
for r digits.
• Basically there are two types of number system
a) Non positional number system: It uses the limited number of symbols in
which each symbol has a value. Each symbol represent the same value
regardless of its position in the number. The roman number system is a
good example of a non-positional number system.
b) Positional number system: A positional (numeral) system is a system for
representation of numbers by an ordered set of numerals symbols
(called digits) . The value of a numeral symbol depends on its position.
For each position a unique symbol or a limited set of symbols is used.
Number system used in Computers
• Binary Number system ( 0,1)
(11010.011)2
=1×24 + 1×23 + 0×22 + 1×21 + 0×20 + 0 x 2-1 + 1x 2-2 + 1x 2-3
= 16 + 8 + 0 + 2 + 0 + 0 + 0.25 + 0.125
=26 + 0.375
=26.37510
• Binary to Octal conversion
Convert binary number (10010110)2 into octal number.
(10010110)2 = ( ?)8
1) (10010110)2 = ( ?)8
= 11 0111 1101
= 0011 0111 1101
= (3 7 D )16
Convert (294) 10 to ( ?) 2
Þ29410
Þ1001001102
• Convert ( 4.47)10 to ( ?) 2
Decimal to octal number system
Follow the steps given below to learn the decimal to octal conversion:
• Write the given decimal number
• If the given decimal number is less than 8 the octal number is the same.
• If the decimal number is greater than 7 then divide the number by 8.
• Note the remainder we get after division
• Repeat step 3 and 4 with the quotient till it is less than 8
• Now, write the remainders in reverse order(bottom to top)
• The resultant is the equivalent octal number to the given decimal number.
• Convert (1792)10 to ( ? )8
= (3400)8
• Exercise 1: Convert (127.56)10 to Octal.
• Exercise 2: Convert 5210 to octal.
• Exercise 3: Convert 10010 to octal.
Decimal to Hexadecimal Number system
Conversion steps:
• Divide the number by 16.
• Get the integer quotient for the next iteration.
• Get the remainder for the hex digit.
• Repeat the steps until the quotient is equal to 0.
Convert (7562)10 to Hexadecimal:
756210 = 1D8A16
Convert 3563110 to hexadecimal
3563110 = 8B2F16
Octal to other number system conversion
1) Octal to Binary number conversion
There are various direct or indirect methods to convert a octal number
into binary number.
In an indirect method, you need to convert an octal number into other
number system (e.g., decimal or hexadecimal), then you can convert
into binary number by converting each digit into binary number from
hexadecimal system and using conversion system from decimal to
binary number.
Convert octal number 205 into binary
number.
= 133
• There is a simple direct method to convert an octal number to binary
number. Since there are only 8 symbols (i.e., 0, 1, 2, 3, 4, 5, 6, and 7)
in octal representation system and its base (i.e., 8) is equivalent of
23=8.
• So, you can represent each digit of octal in group of 3 bits in binary
number.
5 à 101
3 à 011
2 à 010
Types of codes
• BCD codes
• XS3 codes
• Gray codes
• ASCII codes
BCD codes
• Binary Coded Decimal or BCD is simply the 4-bit binary code
representation of a decimal digit with each decimal digit replaced in
the integer and fractional parts with its binary equivalent.
• BCD Code uses four bits to represent the 10 decimal digits of 0 to 9.
• Standard binary coded decimal code is commonly known as a
weighted 8421 BCD code, with 8, 4, 2 and 1 representing the weights
of the different bits starting from the most significant bit (MSB) and
proceeding towards the least significant bit (LSB).
• The weights of the individual positions of the bits of a BCD code
are: 23 = 8, 22 = 4, 21 = 2, 20 = 1.
• But do not get confused, binary coded decimal is not the same as hexadecimal.
• The most common BCD code is the 8421 BCD code.
• Here 8, 4, 2 and 1 represent the weights of different bits in the four-bit groups, starting from the
(MSB) most significant bit (to extreme left) and proceeding towards the least significant (LSB) bit.
• The 4221 BCD and 5421 BCD are other weighted BCD codes shown in table. The numbers 4, 2, 2, 1
in 4221 BCD and 5, 4, 2 and 1 in 5421 BCD represent weights of the relevant bits.
• Now let us consider some examples, where we convert the given
decimal numbers to BCD.
• The 8421 BCD code for 9.2 is 1001.0010.
=( 0 1 1 0 1) graycode
Gray code to Binary conversion
1) ( 01101)gray = (? ) 2
Solution: 0 1 1 0 1
0 1 0 0 1
=( 0 1 0 0 1) 2
ASCII code
• ASCII, stands for American Standard Code for Information
Interchange.
• It's a 7-bit character code where every single bit represents a unique
character.
• Text files stored in ASCII format are sometimes called ASCII files.
• Text editors and word processors are usually capable of storing data
in ASCII format, although ASCII format is not always
the default storage format.
• Most data files, particularly if they contain numeric data, are not
stored in ASCII format. Executable programs are never stored in ASCII
format.
• It is a code for representing 128 English characters as numbers, with
each letter assigned a number from 0 to 127.
• For example, the ASCII code for uppercase M is 77.
Most computers use ASCII codes to represent text, which makes it
possible to transfer data from one computer to another.
Complements
• Complements are used in the digital computers in order to simplify
the subtraction operation and for the logical manipulations.
• For each radix-r system (radix r represents base of number system)
there are two types of complements.
S.N. Complement Description
1 Radix Complement The radix complement is
referred to as the r's
complement
2 Diminished Radix The diminished radix
Complement complement is referred to
as the (r-1)'s complement
Binary system complements
• 1's complement
• The 1's complement of a number is found by changing all 1's to 0's
and all 0's to 1’s.
• This is called as taking complement or 1's complement. Example of 1's
Complement is as follows:
2's complement
100101
101011 – 111001
Solution:
1’s complement of 111001 is 000110. Hence
Minued - 101011
1’s complement - 000110
110001
1 10110 Minuend
1 01010 2’s complement of subtrahend
Carry over 1 1 00000 Result of addition
After dropping the carry over we get the result of subtraction to be 100000.
10110 – 11010
Solution:
2’s complement of 11010 is (00101 + 1) i.e. 00110. Hence
Minued - 10110
2’s complement of subtrahend - 00110
Result of addition - 11100
After dropping the carry over we get the result of subtraction as 1.10.
9’s Complement and 10’s Complement
• The complements are used to make the
arithmetic operations in digital system
easier.
• To obtain the 9’s complement of any
number we have to subtract the number
with (10n – 1) where n = number of
digits in the number.
• i.e (10n -1 – N)
where N is the Number
• It is relatively easy to find out the 10’s complement after finding out
the 9’s complement of that number.
• We have to add 1 with the 9’s complement of any number to obtain
the desired 10’s complement of that number.
• Let us take a decimal number 456, 9’s complement of this number
will be:
• Example: 1 110
=-6
1’s complement form
e = (p⊕x⊕y⊕z )’