20
1 CSE20 Lecture 16 Boolean Algebra: Applications Professor CK Cheng CSE Dept. UC San Diego 1

1 CSE20 Lecture 16 Boolean Algebra: Applications Professor CK Cheng CSE Dept. UC San Diego 1

  • View
    214

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 1 CSE20 Lecture 16 Boolean Algebra: Applications Professor CK Cheng CSE Dept. UC San Diego 1

1

CSE20 Lecture 16Boolean Algebra: Applications

Professor CK Cheng

CSE Dept.

UC San Diego

1

Page 2: 1 CSE20 Lecture 16 Boolean Algebra: Applications Professor CK Cheng CSE Dept. UC San Diego 1

2

Outlines

• Introduction

• Light Switches

• Bit Counter

• Multiplication

• Multiplexer

• Priority Encoder

• Summary

Page 3: 1 CSE20 Lecture 16 Boolean Algebra: Applications Professor CK Cheng CSE Dept. UC San Diego 1

3

Introduction

• Language Description

• Truth Table

• Karnaugh Map

• Minimal Expression

• Digital Logic Networks

Page 4: 1 CSE20 Lecture 16 Boolean Algebra: Applications Professor CK Cheng CSE Dept. UC San Diego 1

4

Light Switches

Given two switches A, B with two states (Up, Down), the switches control one light emitter Y. Initially A=B=Down, and Y=Off. The light Y is turned between Off and On when one of the switch changes its state.

Describe Y as a function of A and B.

4

Assignment: A, B are in {0, 1} (Down, Up)Y is in {0,1} (Off, On)

Page 5: 1 CSE20 Lecture 16 Boolean Algebra: Applications Professor CK Cheng CSE Dept. UC San Diego 1

5

Light SwitchesTruth Table Karnaugh Map

5

Id A B Y

0 0 0 0

1 0 1 1

2 1 0 1

3 1 1 0

Y A=0 A=1

B=0 0 1

B=1 1 0

Page 6: 1 CSE20 Lecture 16 Boolean Algebra: Applications Professor CK Cheng CSE Dept. UC San Diego 1

6

Light Switches

Minimal Expression in sum of products format.

Y(A,B)=A’B+AB’

6

Page 7: 1 CSE20 Lecture 16 Boolean Algebra: Applications Professor CK Cheng CSE Dept. UC San Diego 1

7

Bit CounterInput: Three binary bits (A, B, C)

Output: (S1,S0) that counts the number of 1’s in (A, B, C).

Derive minimal expressions of (S1,S0).

For example:

(A,B,C)=(0,0,0) => (S1,S0)=(0,0) 0: Binary code

(A,B,C)=(1,1,0) => (S1,S0)=(1,0) 2: Binary code

(A,B,C)=(1,1,1) => (S1,S0)=(1,1) 3: Binary code

Page 8: 1 CSE20 Lecture 16 Boolean Algebra: Applications Professor CK Cheng CSE Dept. UC San Diego 1

8

Bit Counter

Id A B C S1 S0

0 0 0 0 0 0

1 0 0 1 0 1

2 0 1 0 0 1

3 0 1 1 1 0

4 1 0 0 0 1

5 1 0 1 1 0

6 1 1 0 1 0

7 1 1 1 1 1

Truth Table Karnaugh Map

8

S1 B,C

0,0

B,C

0,1

B,C

1,1

B,C

1,0

A=0 0 0 1 0

A=1 0 1 1 1

S0 B,C

0,0

B,C

0,1

B,C

1,1

B,C

1,0

A=0 0 1 0 1

A=1 1 0 1 0

Page 9: 1 CSE20 Lecture 16 Boolean Algebra: Applications Professor CK Cheng CSE Dept. UC San Diego 1

9

Bit CounterKarnaugh Map

9

S1 B,C

0,0

B,C

0,1

B,C

1,1

B,C

1,0

A=0 0 0 1 0

A=1 0 1 1 1

S0 B,C

0,0

B,C

0,1

B,C

1,1

B,C

1,0

A=0 0 1 0 1

A=1 1 0 1 0

S1=AB+BC+AC

S0=AB’C’+ABC+A’B’C+A’BC’

Page 10: 1 CSE20 Lecture 16 Boolean Algebra: Applications Professor CK Cheng CSE Dept. UC San Diego 1

10

MultiplicationInput: Two binary numbers (a1,a0), (b1,b0)

Output: (s3,s2,s1,s0) product of the two numbers.

Derive minimal expressions of (s3,s2,s1,s0).

For example: (a1,a0)×(b1,b0) = (s3,s2,s1,s0) (0,0)×(0,0) = (0,0,0,0)

(1,0)×(0,1) = (0,0,1,0)

(1,1)×(1,0) = (0,1,1,0)

(1,1)×(1,1) = (1,0,0,1)

Page 11: 1 CSE20 Lecture 16 Boolean Algebra: Applications Professor CK Cheng CSE Dept. UC San Diego 1

11

Multiplication: Truth Table

Karnaugh Maps are left as exercises.

Id a1 a0 b1 b0 s3 s2 s1 s0

0 0 0 0 0 0 0 0 0

1 0 0 0 1 0 0 0 0

2 0 0 1 0 0 0 0 0

3 0 0 1 1 0 0 0 0

4 0 1 0 0 0 0 0 0

5 0 1 0 1 0 0 0 1

6 0 1 1 0 0 0 1 0

7 0 1 1 1 0 0 1 1

8 1 0 0 0 0 0 0 0

9 1 0 0 1 0 0 1 0

10 1 0 1 0 0 1 0 0

11 1 0 1 1 0 1 1 0

12 1 1 0 0 0 0 0 0

13 1 1 0 1 0 0 1 1

14 1 1 1 0 0 1 1 0

15 1 1 1 1 1 0 0 1 11

Page 12: 1 CSE20 Lecture 16 Boolean Algebra: Applications Professor CK Cheng CSE Dept. UC San Diego 1

12

MultiplicationInput: Two binary numbers (a1,a0), (b1,b0)

Output: (s3,s2,s1,s0) product of the two numbers. A minimal expression:

s3=a1a0b1b0

s2=a1b1b0’+a1a0’b1

s1=a1’a0b1+a0b1b0’+a1a0’b0+a1b1’b0

s0=a0b0

Verification: (a1,a0), (b1,b0) are symmetric in the expressions.

Page 13: 1 CSE20 Lecture 16 Boolean Algebra: Applications Professor CK Cheng CSE Dept. UC San Diego 1

13

MultiplexerInput: Three binary bits S (select), A, B (data)

Output: Y

If S=0, then Y=B; else Y=A.

For example:

(S,A,B)=(0,1,0) => Y= 0.

(S,A,B)=(1,1,0) => Y= 1.

(S,A,B)=(1,0,1) => Y= 0.

Page 14: 1 CSE20 Lecture 16 Boolean Algebra: Applications Professor CK Cheng CSE Dept. UC San Diego 1

14

MultiplexerTruth Table Karaugh Map

Id S A B Y

0 0 0 0 0

1 0 0 1 1

2 0 1 0 0

3 0 1 1 1

4 1 0 0 0

5 1 0 1 0

6 1 1 0 1

7 1 1 1 1

Y AB

0,0

AB

0,1

AB

1,1

AB

1,0

S=0 0 1 1 0

S=1 0 0 1 1

Y=S’B+SA

Page 15: 1 CSE20 Lecture 16 Boolean Algebra: Applications Professor CK Cheng CSE Dept. UC San Diego 1

15

MultiplexerInput: Three binary bits S (select), A, B (data)

Output: Y

If S=0, then Y=B; else Y=A.

Minimal Expression:

Y=S’B+SA

Page 16: 1 CSE20 Lecture 16 Boolean Algebra: Applications Professor CK Cheng CSE Dept. UC San Diego 1

16

Priority EncoderInput: Three binary bits E (Enable), D1, D0 (Devices IDs)Output: A, Y

If E=0, then A=Y=0;

Else if D0=1, A=1, Y=0; (Let Device 0 take higher priority)

Else if D1=1, A=1, Y=1;Else A=0, Y=0.

For example:

(E,D1,D0)=(0,1,0) => Y= 0, A=0.

(E,D1,D0)=(1,0,1) => Y= 0, A=1.

(E,D1,D0)=(1,1,0) => Y= 1, A=1.

(E,D1,D0)=(1,0,0) => Y= 0, A=0.

Page 17: 1 CSE20 Lecture 16 Boolean Algebra: Applications Professor CK Cheng CSE Dept. UC San Diego 1

17

Priority EncoderTruth Table Karaugh Maps

Id E D1 D0 A Y

0 0 0 0 0 0

1 0 0 1 0 0

2 0 1 0 0 0

3 0 1 1 0 0

4 1 0 0 0 0

5 1 0 1 1 0

6 1 1 0 1 1

7 1 1 1 1 0

Y D1D0

0,0

D1D0 0,1

D1D0 1,1

D1D0 1,0

E=0 0 0 0 0

E=1 0 0 0 1

A D1D0

0,0

D1D0 0,1

D1D0 1,1

D1D0 1,0

E=0 0 0 0 0

E=1 0 1 1 1

Page 18: 1 CSE20 Lecture 16 Boolean Algebra: Applications Professor CK Cheng CSE Dept. UC San Diego 1

18

Priority EncoderInput: Three binary bits E (Enable), D1, D0

Output: A, Y

If E=0, then A=Y=0;

Else if D0=1, A=1, Y=0;

Else if D1=1, A=1, Y=1;

Else A=0, Y=0.

Minimal Expression:

Y=ED1D0’

A=ED1+ED0

Page 19: 1 CSE20 Lecture 16 Boolean Algebra: Applications Professor CK Cheng CSE Dept. UC San Diego 1

Quiz

• For the above Priority Encoder, let D1 take higher priority. Derive the minimal expression of the outputs A and Y.

19

Page 20: 1 CSE20 Lecture 16 Boolean Algebra: Applications Professor CK Cheng CSE Dept. UC San Diego 1

2020

Summary

•Language Description•Combinatorial Systems

•Truth Table•#variables <7

•Karnaugh Maps•Two level optimization

•Minimal Expressions•Logic Networks