0% found this document useful (0 votes)
21 views45 pages

Number Systems

NumberSystems

Uploaded by

dn1932011
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views45 pages

Number Systems

NumberSystems

Uploaded by

dn1932011
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 45

Digital Design

“Introduction to Digital
Systems”
Resources

 Chapter #1, Mano Sections


 1.1 Digital Computers
 1.2 Number Systems
 1.3 Arithmetic Operations
 1.4 Decimal Codes
 1.5 Alphanumeric Codes

2
Topics

 Computing Devices and VLSI Design


 Signals (Digital vs. Analog)
 Digital Systems and Computers
 Number systems [binary, octal, hex]
 Base Conversion
 Arithmetic Operations
 Decimal Codes [BCD]
 Alphanumeric Codes

3
Digital Systems

4
Computing Devices Everywhere!
“Embedded Systems”

PDA Car
PC

Home Networking

Game console Household


Body

Super Computer Medicine


Entertainment

Communication

What is the main enabler to such digital systems? 5


The Transistor Revolution

Bipolar logic • Intel 4004 processor


First transistor • Designed in 1971
Bell Labs, 1948 1960’s
• Almost 3000 transistors
• Speed:1 MHz operation

6
The VLSI Design Cycle
Specification SYSTEM

Functional design MODULE


+

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

Signals can be analog or digital:

1.Analog signals can have an infinite number of values in a


range;

2.Digital signals can have only a limited number of values.

11
Analog Signals

Time

Analog Continuous
in value &
time

12
Digital Signals

 For digital systems, the variable takes


on discrete values (i.e., not continuous)

Time

Digital
Discrete in
value
13
Signal Examples Over Time

 Digital (Binary) values are represented by:


 digits 0 and 1 / False (F) and True (T)
 words (symbols) Low (L) and High (H)
 words On and Off.

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

CD: Surface Pits/Light


Dynamic Ram: Electric Charge

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

 A number with radix r is represented by a


string of digits:
An - 1An - 2 … A1A0 . A- 1 A- 2 … A- m  1 A- m
in which 0 Ai < r and “.” is the radix
point.
 The string of digits represents the power series:
 r   r
i=n-1 j=-1
(Number)r = i j
Ai Aj
i=0 j=-m
(Integer Portion) + (Fraction Portion)
18
Decimal Number System

 Base (also called radix) = 10


● 10 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
 Digit Position 2 1 0 -1 -2

● Integer & fraction 5 1 2 7 4

 Formal Notation (512.74)10


100 10 1 0.1 0.01
 Digit Weight
● Weight = (Base) Position
500 10 2 0.7 0.04
 Magnitude
● Sum of “Digit x Weight” d2*B2+d1*B1+d0*B0+d-1*B-1+d-2*B-2
19
Octal Number System
 Base = 8
● 8 digits { 0, 1, 2, 3, 4, 5, 6, 7 }
 Weights 64 8 1 1/8 1/64

● Weight = (Base) Position 5 1 2 7 4


2 1 0 -1 -2

 Formal Notation (512.74)8


 Magnitude 5 *8 2+1 *8 1+2 *8 0+7 *8- 1+4 *8 -2

● Sum of “Digit x Weight” =(330.9375)10

20
Octal Number System: Example

 For Example,
 (27) can be expressed as: ( )10
8

 (17.1)8 can be expressed as: ( )10

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

● Weight = (Base) Position 1 E 5 7 A


2 1 0 -1 -2
 Formal Notation
(1E5.7A)16
 Magnitude 1 *162+14 *161+5 *160+7 *16-1+10 *16-2

● Sum of “Digit x Weight” =(485.4765625)10

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”

 Weights 4 2 1 1/2 1/4

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

● Sum of “Bit x Weight” =(5.25)10


 Formal Notation (101.01)2
 Groups of bits 4 bits = Nibble 1011

8 bits = Byte 11000101


25
Binary  Decimal: Example

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

What is 10011100 in decimal?


7 6 5 4 3 2 1 0 position

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

Strings of binary digits (“bits”)


 One bit can store a number from 0 to 1
 n bits can store numbers from 0 to 2 n-1
27
Binary Fractions

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

1 x 22 + 1 x 21 + 0x20 + 1x2-1 + 1x2-2

6 and 3/4

29
Example 2

0 . 1 1 1 1 1 12

0 x 20 + 1 x 2-1 + 1x2-2 + 1x2-3 + 1x2-4 + 1x2-5 + 1x2-6

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

6 26=64 30 230=1G Giga

7 27=128 40 240=1T Tera


32
Base Conversion

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

 To convert from one base to another:


1) Convert the Integer Part
2) Convert the Fraction Part
3) Join the two results with a radix point

35
Decimal to Binary Conversion
Decimal (Integer) to Binary Conversion

 Divide the number by the ‘Base’ (=2)


 Take the remainder (either 0 or 1) as a coefficient
 Take the quotient and repeat the division

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

 Multiply the number by the ‘Base’ (=2)


 Take the integer (either 0 or 1) as a coefficient
 Take the resultant fraction and repeat multiplication

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

Dec Bin Hex Dec Bin Hex


0 0000 0 8 1000 8
1 0001 1 9 1001 9
2 0010 2 10 1010 a Why use
3 0011 3 11 1011 b base 16?
4 0100 4 12 1100 c
5 0101 5 13 1101 d •Power of 2
6 0110 6 14 1110 e •Size of byte
7 0111 7 15 1111 f
41
Hex to Binary Bin
0000
Hex
0
0001 1
0010 2
 Convention – write 0x (prefix)
0011 3
before number 0100 4
 Hex to Binary – just convert digits 0101 5
0110 6
0111 7

0x2ac (2ac)16 1000


1001
8
9
1010 a
1011 b
0010 1010 1100 1100 c
1101 d
0x2ac = (001010101100)2 1110 e

No magic – remember hex digit = 4 bits 1111 f

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

0101  0011  0111  1011 0111


1000
7
8
1001 9
1010 a
5 3 7 b 1011 b
1100 c
1101 d
(101001101111011)2 = 0x537b = (537b)16 1110 e
1111 f

44
Octal − Hexadecimal Conversion
 Convert to Binary as an intermediate step
Example:
( 2 6 . 2 )8

Assume Zeros Assume Zeros

( 0 1 0 1 1 0 . 0 1 0 )2

(1 6 . 4 )16

Works both ways (Octal to Hex & Hex to Octal)


45

You might also like