Chapter 4- Iinformation Representation
Chapter 4- Iinformation Representation
Representation
• Introduction
• Decimal, binary, octal and hexadecimal system
• Conversion from one number system to another
system .
• Operations in binary, octal and hexadecimal.
1
Vocabulary
• Weight: This is the value of a bit. This value depends on the position
of the bit starting from the right, from weakest to strongest.
2
What is the system used in digital machines?
5v
Tension Binary Binary: 1
(logic ) 2.8v
0V 0 Unused
0.8v
5V 1
Binary: 0
0v
3
Introduction
• We usually represent numbers using ten (10) different symbols: 0,
1, 2, 3, 4, 5, 6, 7, 8, 9
• This system is called the decimal system (deci means ten).
• There are, however, other forms of numbering that operate using a
number of distinct symbols.
– Example :
• The binary system (bi: two),
• The octal system ( oct : eight),
• The hexadecimal system (hex: sixteen).
• In fact, any number of different symbols (not necessarily numbers)
can be used.
• In a numbring system: the number of distinct symbols is called the
base of the number system.
4
The decimal system
• We use ten different symbols:
{0,1,2,3,4,5,6,7,8,9}
• Any combination of the symbols {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} gives us a
number.
7654332
Low weight
Heavyweight
345, 567
Fractional part
Whole part 5
Polynomial expansion of a number in the
decimal system
• Given the number 1954, this number can be written in the following
form:
1954 1000 900 50 4
1954 1*1000 9 *100 5 *10 4 *1
1954 1*103 9 *10 2 5 *101 4 *10 0
6
The binary system
• In the binary system, to express any value we only use 2
symbols: { 0 , 1}
The base
One bit 2 )1101(
2 )1 0 1 1(
The most significant The least significant bit
bits
7
Binary counting
Decimal Binary
0 000
:On 2 bits . 1 001
2 010
Decimal Binary 3 011
0 00 4 100
1 01 5 101
2 10 6 110
3 11 7 111
combinations = 2 2 4
combinations = 2 3 8 8
The octal system (base 8)
• Example 1:
(127) 8 1* 82 2 * 81 7 * 80
:Example 2
The number (1289) does not exist in base 8 since the symbols 8 and 9 do not
.belong to the base
9
The hexadecimal system (base 16)
Hexadecimal Decimal
0 0
1 1
• Sixteen (16) different symbols 2 2
are used: 3 3
4 4
5 5
6 6
(17)16 1*161 7 *160 7 7
(AB)16 A *161 B *160 10 *161 11 *1 8 8
9 9
A 10
B 11
C 12
D 13
E 14
F 15
10
Summary
11
Converting base X to base 10
: Example
12
Exercise
13
Converting from decimal to base X
43 16
43 8
8 11 2 16
3 5
2 0
5 0
)2B(
8 )53(
16
15
Converting from a base b1 to a base b2
?
b1 b2
Polynomial
developpement Successive divisions
10
16
Example: (34) 5 =(?) 7
19 7
7 )25( = 10 )19(
5 2 7
7 )25(= 5 )34(
2 0
17
Conversion: Octal binary
Binary Octal
In octal, each base symbol is written on 3 bits in . 000 0
. binary 001 1
The basic idea is to replace each symbol in the . 010 2
octal base by its value in 3-bit binary (do 3-bit 011 3
.bursting) 100 4
101 5
110 6
:Examples
111 7
2 ) 101 100 011 (= 8 )345(
18
Conversion: Binary Octal
The basic idea is to make 3 -bit groupings starting from the least .
.significant
Subsequently replace each grouping with the corresponding octal .
.value
: Example
19
Conversion: hexadecimal binary
Hexadecimal Decimal
0 0
1 1
2 2
. In Hexa each symbol of the base is written on 4 bits . 3
4
3
4
. The basic idea is to replace each symbol 5 5
by its 4-bit binary value (make 4-bit bursting). 6 6
7 7
8 8
9 9
HAS 10
B 11
VS 12
: Example
D 13
16 =( 0011 0100 0101 1011 ) 2 )345B( E 14
F 15
20
Conversion: binary hexadecimal
.The basic idea is to make 4-bit groupings starting from the least significant .
: Example
16 )32A6(= 2 ) 0110 1010 0010 11 00 (= 2 )11001010100110(
21
4. Arithmetic operations in binary
0 0 1 1
+ + + +
0 1 0 1
0 1 1 0 1
1 1
1 1 0 0 0 1 1
+
1 1 0 1 0 0 0 1
1 1 1 0 1 1 1 0
22
Binary multiplication
We will start with (1010) 2 times (101010) 2 :
23
Arithmetic operations in octal
1 1
5 6 3 4
+
1 5 4
5 8 11 6
5 6 8 4
+
A 5 1 7
12 18 11 6
C En hexa 11 is written B
In hex 18 is written 12
B
2
26