Number System'
Number System'
Contents:
1.
2.
3.
4.
5.
6.
7.
8.
INFORMATION REPRESENTATION
Binary Numbers
Number Base Conversions
Octal and Hexadecimal Numbers
Complements
Signed Binary Numbers
Binary Codes
Binary Logic
INFORMATION
REPRESENTATION:
1.
2.
3.
4.
5.
6.
7.
8.
9.
INFORMATION REPRESENTATION
Binary Numbers
Number Base Conversions
Octal and Hexadecimal Numbers
Complements
Signed Binary Numbers
Binary Codes
Binary Storage and Registers
Binary Logic
INFORMATION
REPRESENTATION
INFORMATION
REPRESENTATION
Numbers are important to computers
Represent information precisely
Can be processed
Examples
Represent yes or no: use 0 and 1
Represent the 4 seasons: 0, 1, 2 and 3
INFORMATION
REPRESENTATION
Bit (Binary digit)
0 and 1
Represent false and true in logic
Represent the low and high states in
electronic
devices
Other units
Byte: 8 bits
Nibble: 4 bits (seldom used)
Word: Multiples of byte (e.g. 1 byte, 2
bytes, 4 bytes, 8 bytes, etc.), depending
on the architecture of the computer
system
INFORMATION REPRESENTATION
N bits can represent up to 2N values.
Examples:
2 bits represent up to 4 values (00, 01, 10,
11)
3 bits rep. up to 8 values (000, 001, 010, ,
110, 111)
4 bits rep. up to 16 values (0000, 0001, 0010,
., 1111)
Binary Numbers:
1.
2.
3.
4.
5.
6.
7.
8.
Information Representation
Binary Numbers
Number Base Conversions
Octal and Hexadecimal Numbers
Complements
Signed Binary Numbers
Binary Codes
Binary Logic
100)
Decimal
number 7392:
number representation:
In general,
(base 2)
Weights in powers of 2
Binary digits (bits): 0, 1
Octal
(base 8)
Weights in powers of 8
Octal digits: 0, 1, 2, 3, 4, 5, 6, 7.
Hexadecimal
(base 16)
Weights in powers of 16
Hexadecimal digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A,
B, C, D, E, F.
Base/radix
R:
Weights in powers of R
Digital Systems
Binary Numbers
Number Base Conversions
Octal and Hexadecimal Numbers
Complements
Signed Binary Numbers
Binary Codes
Binary Logic
o Method 2
Repeated Division-by-2 Method (for
whole
numbers)
Repeated Multiplication-by-2 Method (for
fractions)
SUM-OF-WEIGHTS METHOD
Determine
= 8 + 1 = 23 + 20 = (1001)2
(18)10
= 16 + 2 = 24 + 21 = (10010)2
(58)10
= 32 + 16 + 8 + 2 = 25 + 24 + 23 + 21 =
(111010)2
(0.625)10
REPEATED DIVISION-BY-2
To convert a whole number to binary, use
successive division by 2 until the quotient is
0. The remainders form the answer, with
the first remainder as the least significant
bit (LSB) and the last as the most significant
2 43
bit (MSB).
2 21 rem 1 LSB
(43)10 = (101011)2
2
2
2
2
10
5
2
1
0
rem 1
rem 0
rem 1
rem 0
rem 1 MSB
REPEATED MULTIPLICATION-BY-2
To convert decimal fractions to binary,
repeated multiplication by 2 is used, until the
fractional product is 0 (or until the desired
number of decimal places). The carried
digits, or carries, produce the answer, with
the first carry as the MSB, and the last as the
LSB.
(0.3125)10 = (.0101)
0.31252 2=0.625
0.6252=1.25
0.252=0.50
0.52=1.00
Carry
0
1
0
1
MSB
LSB
1.
2.
3.
4.
5.
6.
7.
8.
Digital Systems
Binary Numbers
Number Base Conversions
Octal and Hexadecimal Numbers
Complements
Signed Binary Numbers
Binary Codes
Binary Logic
BINARY TO OCTAL/HEXADECIMAL
CONVERSION
Binary Octal: partition in groups of
3
(10 111 011 001 . 101 110)2 =
Complements
1.
2.
3.
4.
5.
6.
7.
8.
INFORMATION REPRESENTATION
Binary Numbers
Number Base Conversions
Octal and Hexadecimal Numbers
Complements
Signed Binary Numbers
Binary Codes
Binary Logic
COMPLEMENTS
Complements are used in digital computers
for
simplifying the subtraction operation and
for
logical manipulation.
1. The radix complement
----- Given a number N in base-r having n
digits, the rs complement of N:
rn - N, for N0
0, for N=0
2. The diminished radix complement.
----- Given a number Nin base-r having n digits,
the (r-1)s complement of N : (rn-1) -N
1s and 2s Complements
The 2's complement and l's complement for
binary numbers.
1s complement of N = (2n-1) N (N is a
binary #)
1s complement can be formed by changing
1s to 0s and 0s to 1s.
2s complement of a number is obtained by
leaving all
least significant 0s and the first
unchanged, and replacing 1s with 0s and 0s
with 1 in all higher significant digits.
The 1s complement of 1101011 = 0010100
The 2s complement of 0110111 = 1001001
9s complement of546700 is
999999 -546700 = 453299
10s
1010100
+
Sum =
0111101
10010001
end carry
10000000
0010001
INFORMATION REPRESENTATION
Binary Numbers
Number Base Conversions
Octal and Hexadecimal Numbers
Complements
Signed Binary Numbers
Binary Codes
Binary Logic
values.
Signed numbers: include all values (positive
and negative)
The sign is represented by a sign bit
0 for + 1 for -
E.g : a 1-bit sign and 7-bit magnitude format.
sign
magnitu
de
BINARY CODES
1.
2.
3.
4.
5.
6.
7.
8.
INFORMATION REPRESENTATION
Binary Numbers
Number Base Conversions
Octal and Hexadecimal Numbers
Complements
Signed Binary Numbers
Binary Codes
Binary Logic
BINARY CODES
Decimal Digit
0
1
2
3
4
5
6
7
8
9
BCD
8421
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
Excess-3 84-2-1
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
0000
0111
0110
0101
0100
1011
1010
1001
1000
1111
2*421
0000
0001
0010
0011
0100
1011
1100
1101
1110
1111
Biquinary
5043210
0100001
0100010
0100100
0101000
0110000
1000001
1000010
1000100
1001000
1010000