Sie sind auf Seite 1von 61

Digital Logic & Design

Analogue Quantities
Continuous Quantity

Intensity of Light

Temperature

Velocity

Digital Values

Discrete set of values

Continuous Signal
45
40

temperature 0C

35
30
25
20
15
10
5
0
1

8
time

10

11

12

13

14

15

Continuous Signal
45
42

40

temperature 0C

35

35

34

41

37

30

29

25

25

20

25

23

22

18

15
10
7

5
1

0
1

2
2

8
time

10

11

12

13

14

15

Digital Representation
45
42

40

temperature 0C

35

35

34

41

37

30

29

25

25

20

25

23

22

18

15
10
7

5
1

0
1

2
2

samples

10

11

12

13

14

15

Under Sampling
45
40

temperature 0C

35
30
25
20
15
10
5
0
1

samples

11

13

15

Digital Systems

Two Voltage Levels


Two States
On/Off
Black/White
Hot/Cold
Stationary/Moving

Binary Number System

Binary Numbers

Representing Multiple Values

Advantages of Digital Systems

Efficient Processing & Data Storage


Efficient & Reliable Transmission
Detection and Correction of Errors
Precise & Accurate Reproduction
Easy Design and Implementation
Occupy minimum space

Information Processing

Numbers
Text
Formula and Equations
Drawings and Pictures
Sound and Music

Number Systems and Codes

Decimal Number System


Binary Number System
Hexadecimal Number System
Octal Number System

Decimal Number System

Ten unique numbers 0,1..9


Combination of digits
Positional Number System
275 = 2 x 102 + 7 x 101 + 5 x 100
Base or Radix 10
Weight 1, 10, 100, 1000 .

Representing Fractions

Fractions can be represented in decimal number


system in a manner
= 3 x 102 + 8 x 101 + 2 x 100 + 9 x 10-1
+ 1 x 10-2
= 300 + 80 + 2 + 0.9 + 0.01
= 382.91

Binary Number System

Two unique numbers 0 and 1


Base 2
A binary digit is a bit
Combination of bits to represent larger values

Binary Number System


Decimal Number

Binary Number

Decimal Number

Binary Number

10

1010

11

1011

10

12

1100

11

13

1101

100

14

1110

101

15

1111

110

16

10000

111

17

10001

1000

18

10010

1001

19

10011

Combination of Binary Bits

Combination of Bits
100112 = 1910
= (1 x 24) + (0 x 23) + (0 x 22) + (1 x 21)
+ (1 x 20)
= (1 x 16) + (0 x 8) + (0 x 4) + (1 x 2)
+ (1 x 1)
= 16 + 0 + 0 + 2 + 1
= 19

Fractions in Binary

Fractions in Binary
1011.1012 = 11.625
= (1 x 23) + (0 x 22) + (1 x 21) + (1 x 20)
+ (1 x 2-1) + (0 x 2-2) + (1 x 2-3)
= (1 x 8) + (0 x 4) + (1 x 2) + (1 x 1)
+ (1 x 1/2) + (0 x 1/4) + (1 x 1/8)
= 8 + 0 + 2 + 1 + 0.5 + 0 + 0.125
= 11.625
Floating Point Notations

Decimal-Binary Conversion

Binary to Decimal Conversion


Sum-of-Weights
Adding weights of non-zero terms

100112
(1 24 ) (0 23 ) (0 2 2 ) (1 21 )
(1 2 )
0

Terms 16,0,0.2 and 1


19

Decimal-Binary Conversion

Binary to Decimal Conversion


Sum-of-Weights
Adding weights of non-zero terms

Decimal-Binary Conversion

Binary to Decimal Conversion


Sum-of-Weights
Adding weights of non-zero terms

100112 16 2 1 19
1011.1012 8 2 1 1
2
8
11 5
8
11.625

Binary to Decimal Conversion

Sum-of-Weights
Expression base number & weights
Sum terms
Paper and pencil method
Sum of non-zero terms
Mental Arithmetic, quick method
Sum of weights of non-zero terms

Binary to Decimal Conversion

Sum-of-Weights
100112
(1 x 24) + (0 x 23) + (0 x 22) + (1 x 21)
+ (1 x 20)
Terms 16, 0, 0, 2 and 1
19

Binary to Decimal Conversion

Add weights of non-zero terms


Weights increase/decrease by power of 2
100112 = 16 + 2 + 1 = 19
1011.1012 = 8 + 2 + 1 + 1/2 + 1/8
= 11 + 5/8
= 11.625

Decimal to Binary Conversion

Sum-of-Weights method used in reverse


Highest binary weight less than the decimal
number
Subsequent smaller weights that add up to
decimal number
Repeated division by 2
Paper and pencil method
Number repeatedly divided by 2

Binary-Decimal fraction conversion

Binary to Decimal Conversion


Sum-of-Weights method
Weights decrease by a factor of 2
0.11012 weights , , 1/16
Sum up to 0.8125
Decimal to Binary Conversion
Repeated Multiplication by 2
example

Decimal-Binary fraction conversion

Decimal to Binary Conversion


Repeated multiplication by 2
Number

Mult. By 2

Integer

0.8125

1.625

(b-1)

0.625

1.250

(b-2)

0.250

0.500

(b-3)

0.500

1.000

(b-4)

Binary Arithmetic

Binary Addition
Binary Subtraction
Binary Multiplication
Binary Division

Binary Addition

Four Basic rules for binary addition

1st digit
0
0
1
1

2nd digit Sum


0
0
1
1
0
1
1
0

Carry
0
0
0
1

Addition of multiple binary numbers

Binary Addition

Carry

10

1st Number

2nd Number
3rd Number

4th Number
Result

Binary Subtraction

Four Basic rules for binary subtraction

1st digit
0
0
1
1

2nd digit Difference


0
0
1
1
0
1
1
0

Borrow
0
1
0
0

Binary Subtraction

Borrow
1st Number

1
1

2nd Number

Result

Binary Multiplication

Four Basic rules for binary multiplication

1st digit
0
0
1

2nd digit Product


0
0
1
0
0
0

Example of Binary Multiplication

Binary Multiplication

1st product term


2nd product term
3rd product term
Product

1101
x
101
1101
0000
1101
1000001

(13)
(5)

(65)

Binary Division
10
101 | 1101
101
011
000
11

Hexadecimal Number System

Base 16
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
Representing Binary in compact form
11011000001102 = 1B06 H

Counting in Hexadecimal
Decimal Binary

Hexadecimal

Decimal Binary

Hexadecimal

0000

1000

0001

1001

0010

10

1010

0011

11

1011

0100

12

1100

0101

13

1101

0110

14

1110

0111

15

1111

Counting in Hexadecimal
Decimal HexaDecimal
16
10

Decimal HexaDecimal
24
18

Decimal HexaDecimal
32
20

17

11

25

19

33

21

18

12

26

1A

34

22

19

13

27

1B

35

23

20

14

28

1C

36

24

21

15

29

1D

37

25

22

16

30

1E

38

26

23

17

31

1F

39

27

Binary-Hexadecimal Conversion

Binary to Hexadecimal Conversion


11010110101110010110
1101 0110 1011 1001 0110
D
6
B
9
6

Hexadecimal to Binary Conversion


FD13
1111 1101 0001 0011

Decimal-Hexadecimal Conversion

Decimal to Hexadecimal Conversion


Indirect Method
Decimal Binary Hexadecimal
Repeated Division by 16

Decimal-Hexadecimal Conversion

Hexadecimal to Decimal Conversion


Indirect Method
Hexadecimal Binary Decimal
Sum-of-Weights

Hexadecimal Addition & Subtraction

Hexadecimal Addition
Carry generated
Hexadecimal Subtraction
Borrow weight 16

Repeated Division by 16

Number

Quotient

Remainder

2096

131

131

Sum-of-Weights
CA02
(C x 163) + (A x 162) + (0 x 161) + (2 x 160)
(12 x 163) + (10 x 162) + (0 x 161) + (2 x 160)
(12 x 4096) + (10 x 256) + (0 x 16) + (2 x 1)
49152 + 2560 + 0 + 2
51714

Hexadecimal Addition
Carry
+

1
2AC6
92B5
BD7B

6+5=11d Bh
C+B=23d 17h
A+2+1=13d Dh
2+9=11d Bh

Hexadecimal Subtraction
Borrow
-

111
92B5
2AC6
67EF

21-6=15d Fh
26-C=14d Eh
17-A=7d 7h
8-2=6d 6h

Octal Number System

Base 8
0, 1, 2, 3, 4, 5, 6, 7
Representing Binary in compact form
11011000001102 = 154068

Counting in Octal
Decimal
0
1
2
3
4
5
6
7

Binary
000
001
010
011
100
101
110
111

Octal
0
1
2
3
4
5
6
7

Counting in Octal
Decimal Octal Decimal Octal
8
10
16
20
9
11
17
21

Decimal Octal
24
30
25
31

10
11
12
13
14
15

26
27
28
29
30
31

12
13
14
15
16
17

18
19
20
21
22
23

22
23
24
25
26
27

32
33
34
35
36
37

Binary-Octal Conversion

Binary to Octal Conversion


11010110101110010110
011 010 110 101 110 010 110
3
2
6 5 6 2
6

Octal to Binary Conversion


1726
001 111 010 110

Decimal-Octal Conversion

Decimal to Octal Conversion


Indirect Method
Decimal Binary Octal
Repeated Division by 8

Decimal-Octal Conversion

Octal to Decimal Conversion


Indirect Method
Octal Binary Decimal
Sum-of-Weights

Octal Addition & Subtraction

Octal Addition
Carry generated
Octal Subtraction
Borrow weight 8

Repeated Division by 8

Number

Quotient

Remainder

2075

259

(O0)

259

32

(O1)

(O2)

(O3)

Sum-of-Weights
4033
(4 x 83) + (0 x 82) + (3 x 81) + (3 x 80)
(4 x 512) + (0 x 64) + (3 x 8) + (3 x 1)
2048 + 0 + 24 + 3
2075

Octal Addition
Carry

1
7602
+ 5771
15573

2+1=3d 3O
0+7=7d 7O
6+7=13d 15O
1+7+5=13d 15O

Octal Subtraction
Borrow
-

11
7602
5771
1611

2-1=1d 1O
8-7=1d 1O
13-7=6d 6O
6-5=1d 1O

Alternate Representations

BCD Code
BCD Addition
Gray Code

Alternate Representations

BCD (Binary Coded Decimal) Code

Decimal
0
1
2
3
4

BCD
0000
0001
0010
0011
0100

Decimal
5
6
7
8
9

BCD
0101
0110
0111
1000
1001

BCD Addition

Multi-digit BCD numbers can be added together


23
0010 0011
45
0100 0101
68
0110 1000
23
0010 0011
48
0100 1000
71
0110 1011
1011 is illegal BCD number

BCD Addition

Add a 0110 (6) to an invalid BCD number


Carry added to the most significant BCD digit
23
48
71

0010 0011
0100 1000
0110 1011
0110
0111 0001

Das könnte Ihnen auch gefallen