Number Systems
Number Systems
“Introduction to Digital
Systems”
Resources
2
Topics
3
Digital Systems
4
Computing Devices Everywhere!
“Embedded Systems”
PDA Car
PC
Home Networking
Communication
6
The VLSI Design Cycle
Specification SYSTEM
Logic design
GATE
Circuit design
CIRCUIT
Physical design
Test/Fabrication G DEVICE
S D
n+ n+
1.3 VLSI Design Styles Vdd Contact
Metal layer
© KLMH
Vdd IN2 Poly layer
IN2
IN1 OUT Diffusion layer
OUT
IN1 p-type
transistor
n-type
GND
transistor
GND
IN1
OUT
IN2 Power (Vdd)-Rail
Ground (GND)-Rail
8
Lienig
Signals
9
Signals
An information variable represented by a
physical quantity (speech, Temp, humidty,
noise, …)
10
Signals
11
Analog Signals
Time
Analog Continuous
in value &
time
12
Digital Signals
Time
Digital
Discrete in
value
13
Signal Examples Over Time
Time Discrete in
value &
Asynchronous continuous
Digital in time
Discrete in
Synchronous
value &
time 14
Binary Values: Other Physical Quantities
What are other physical quantities represent 0
and 1?
CPU: Voltage Hard Drive: Magnetic Field Direction
15
A Digital Computer Example
Data/Instructions/code
All in 01010010010
Memory
clock
Control
CPU unit Datapath
Inputs:
Input/Output
Outputs: CRT,
Keyboard,
LCD, modem,
mouse, modem,
speakers
microphone
16
Number
Representation
17
Number Systems – Representation
20
Octal Number System: Example
For Example,
(27) can be expressed as: ( )10
8
21
Hexadecimal Number System
Base = 16
● 16 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F }
Weights 256 16 1 1/16 1/256
22
Hex to Decimal Dec Hex
0 0
1 1
2 2
Just multiply each hex digit by
3 3
decimal value, and add the results.
4 4
5 5
6 6
(2ac)16 7 7
8 8
2 • 256 + 10 • 16 + 12 • 1 = (684)10 9 9
10 a
11 b
12 c
163 162 161 160 13 d
4096 256 16 1 14 e
15 f
23
Binary Numbers
24
Binary Number System
Base = 2
● 2 digits { 0, 1 }, called binary digits or “bits”
Position 1 0 1 0 1
● Weight = (Base)
2 1 0 -1 -2
Magnitude 2 1 0 -1
1 *2 +0 *2 +1 *2 +0 *2 +1 *2
-2
7 6 5 4 3 2 1 0 position
27 26 25 24 23 22 21 20 value
128 64 32 16 8 4 2 1
1 0 0 1 1 1 0 0 Binary #
128 + 0 + 0 + 16 + 8 + 4 + 0 + 0 = (156)
26
Binary Numbers
Examples:
(00)2 (0)10
(01)2 (1)10
(0000001)2 (1)10
(10)2 (2)10
(010)2 (2)10
(11)2 (3)10
(100)2 (4)10
(1001010101000)2
2i
2i-1
4 Integer Values
2
1
bi bi-1 ... b2 b1 b0 b-1 b-2 b-3 … b-j
1/2
Fractional Values 1/4
1/8
2-j
decimal number =
28
Example 1
1 1 0 . 1 12
6 and 3/4
29
Example 2
0 . 1 1 1 1 1 12
63/64
Note: (1) Numbers of the form 0.11111…2 are just below 1.0
(2) Short form notation for such numbers is 1.0 - ε
30
Why Binary?
This is easier to implement in hardware than a unit
that can take on 10 different values.
● For instance, it can be represented by a transistor being
off (0) or on (1).
● Alternatively, it can be a magnetic stripe that is
magnetized with North in one direction (0) or the
opposite (1).
Binary also has a convenient and natural
association with logical values of:
● False (0) and
● True (1).
31
The Power of 2
n 2n n 2n
0 20=1 8 28=256
1 21=2 9 29=512
2 22=4 10 210=1024 Kilo
3 23=8 11 211=2048
4 24=16 12 212=4096
5 25=32 20 220=1M Mega
33
Number Base Conversions
Evaluate
Magnitude
Octal
(Base 8)
Evaluate
Magnitude
Decimal Binary
(Base 10) (Base 2)
Hexadecimal
(Base 16)
Evaluate
Magnitude 34
Conversion Between Bases
35
Decimal to Binary Conversion
Decimal (Integer) to Binary Conversion
Example: (13)10
Quotient Remainder Coefficient
13/ 2 = 6 1 a0 = 1
6 /2= 3 0 a1 = 0
3 /2= 1 1 a2 = 1
1 /2= 0 1 a3 = 1
Answer: (13)10 = (a3 a2 a1 a0)2 = (1101)2
MSB LSB
37
Decimal (Fraction) to Binary Conversion
Example: (0.625)10
Integer Fraction Coefficient
0.625 * 2 = 1 . 25 a-1 = 1
0.25 * 2 = 0 . 5 a-2 = 0
0.5 *2= 1 . 0 a-3 = 1
Answer: (0.625)10 = (0.a-1 a-2 a-3)2 = (0.101)2
MSB LSB
38
Decimal to Octal Conversion
Example: (175)10
Quotient Remainder Coefficient
175 / 8 = 21 7 a0 = 7
21 / 8 = 2 5 a1 = 5
2 /8= 0 2 a2 = 2
Answer: (175)10 = (a2 a1 a0)8 = (257)8
Example: (0.3125)10
Integer Fraction Coefficient
0.3125 * 8 = 2 . 5 a-1 = 2
0.5 *8= 4 . 0 a-2 = 4
Answer: (0.3125)10 = (0.a-1 a-2 a-3)8 = (0.24)8
39
Decimal to Hex Dec Hex
0 0
1 1
2 2
3 3
(684)10 4 4
684/16 = 42 rem 12=c c 5 5
6 6
7 7
42/16 = 2 rem 10=a ac 8 8
9 9
10 a
2/16 = 0 rem 2 2ac 11 b
12 c
13 d
163
16 2
16
1
16 0
14 e
4096 256 16 1 15 f
40
Hexadecimal (Base 16)
Strings of 0’s and 1’s too hard to write
Use base-16 or hexadecimal – 4 bits
42
Binary − Hexadecimal Conversion
16 = 24 Hex Binary
0 0000
Each group of 4 bits represents 1
2
0001
0010
a hexadecimal digit 3 0011
4 0100
5 0101
Pad with Zeros 6 0110
Example:
7 0111
8 1000
( 1 0 1 1 0 . 0 1 )2 9 1001
A 1010
B 1011
C 1100
D 1101
(1 6 . 4 )16 E 1110
F 1111
Works both ways (Binary to Hex & Hex to Binary)
43
Binary to Hex Bin Hex
0000 0
0001 1
0010 2
Just convert groups of 4 bits
0011 3
0100 4
(101001101111011)2 0101 5
0110 6
44
Octal − Hexadecimal Conversion
Convert to Binary as an intermediate step
Example:
( 2 6 . 2 )8
( 0 1 0 1 1 0 . 0 1 0 )2
(1 6 . 4 )16