01-02 - Number Syst
01-02 - Number Syst
01-02 - Number Syst
LOGIC DESIGN
NUMBER SYSTEMS
9 1001
A 1010
Decimal/ Octal/ Hexadecimal Systems
7
Decimal system
coefficients are from {0,1, …, 9}
and coefficients are multiplied by powers of 10
Because the digits have 10 possible values and each digit is
weighted as a power of 10, we say that
decimal numbers are base-10 or radix-10 numbers
Octal Hexadecimal
Base 8 = base 23 Base 16
digits {0,1, …, 7} digits {0, 1, …, 9, A, B, C, D, E, F}
Example: (31.5)8 Example: (19.A)16
Numbers
in
different
systems
9
Powers of 2
210 = 1,024 (K)
220 = 1,048,576 (M) 1 byte = 8 bits
230 (G)
240 (T)
250 (P)
exa, zetta, yotta, …
(exbi, zebi, yobi, ...)
Similar !
But Base is 2 instead of 10
Base Conversions: From base-r to decimal
12
expand the number in power series and add all the terms
Reverse operation requires division
Simple idea:
Divide the decimal number successively by r
&
Accumulate the remainders
If fraction :
integer and fraction parts are handled separately.
Base Conversions: From base-r to binary
(55)10 = ( )2
* Decimal to octal
* Decimal to Hexadecimal
* Hexadecimal to octal
* ...
Base Conversions…
18
ADDITION
Decimal Binary
20
21
Arithmetic with Binary Numbers
22
Subtraction Multiplication
More Exp
Examples: Examples:
( 011)2 + (001) 2 = ( ?) 2 ( 011)2 + (001) 2 = ( ?) 2
23
Complement Arithmetic
26
Two types
1. Radix complement when r = 2
(r’s complement) 1. 2’s complement
2. Diminished complement
((r-1)’s complement) 2. 1’s complement
3= (0011)
2 = (0010)
-2 1101
+ 1
1110 ignore carry
Taking One’s Complement
31
Diminished complement ((r-1)’s complement) : Tt-1
Exp:
N=(1,27)8 diminished compliment in base 8 : T7= (6,50)
Exp:
10’s complement of Exp:
9’s complement
(9)10 = ?
of (9)10 = ?
0 +1 1 0
Exp:
10’s complement of Exp:
9’s complement
(009)10 = ? of (009)10 = ?
990
990 + 1 991
“signed-magnitude
method” rarely used in
digital systems.
Signed-complement system:
Dec +1 001
-1 101
Dec +2 010
-2 110
Dec +3 011
-3 111
Arithmetic Addition
sign+magnitude notation according to Radix notation ( Tt)
37
With complements
Subtraction with compliments
42
X = 11001 (25)
Y = 10011 (19) X-Y = ?
result: (00110)2
Subtraction with compliments
43
X = 11001 (25)
Y = 10011 (19) X-Y = ?
Result: 00101
+ 1
( 00110)2