boolean algebra and digital circuits reading: chapter 8 (138-162) from the text book 1

32
Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Upload: bryan-bradford

Post on 28-Dec-2015

221 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Boolean Algebra and Digital Circuits

Reading: Chapter 8 (138-162) from the text book

1

Page 2: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Defn of a Boolean Algebra

A Boolean algebra consists of:• a set B={0, 1},• 2 binary operations on B (denoted by + & ×),• a unary operation on B (denoted by '), such

that :0 + 0 = 0 0 × 0 = 01 + 0 = 1 0 × 1 = 00 + 1 = 1 1 × 0 = 01 + 1 = 1 1 × 1 = 1

0’=1 and 1’=0. 2

Page 3: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Rules of a Boolean AlgebraThe following axioms (‘rules’) are satisfied for all elements x, y& z of B:

(1) x + y = y + x (commutative axioms) x× y = y × x

(2) x + (y + z) = (x + y) + z (associative axioms) x × (y × z) = (x × y) × z

(3) x × (y + z) = (x × y) + (x × z) x + (y × z) = (x + y) × (x + z) (distributive axioms)

(4) x + 0 = x x × 1 = x (identity axioms)(5) x + x' = 1 x × x' = 0 (inverse axioms) 3

Page 4: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Duality

• To form the dual of an expression, replace all + operators with × operators, all × operators with + operators, all 1’s with 0’s, and all 0’s with 1’s.

• The principle of duality says that if an expression is valid in Boolean algebra, the dual of that expression is also valid.

4

Page 5: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Duality

Exercise: Form the dual of the expressiona + (bc) = (a + b)(a + c)

Solution: Following the replacement rules…a(b + c) = ab + ac

• Take care not to alter the location of the parentheses if they are present.

5

Page 6: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Laws of Boolean Algebra

• In addition to the laws given by the axioms of Boolean Algebra, we can show the following laws

x'' = x (double complement)x + x = x x× x = x (idempotent )(x + y)' = x' × y' (x × y)' = x' + y' (de Morgan’s

laws)x + 1 = 1 x × 0 = 0 (annihilation)x + (x × y) = x x× (x + y) = x (absorption)0' = 1 1' = 0 (complement)

6

Page 7: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Exercise

Simplify the Boolean expression(x' × y) + (x × y)

Solution: (x' × y) + (x × y)= (y × x') + (y × x) (commutative)= y × (x' + x) (distributive)= y × (x + x') (commutative)= y × 1 (inverse)= y (identity)Thus (x' × y) + (x × y) = y 7

Page 8: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Digital Circuits

• The circuitry in a digital computer operates with signals that can take only 2 values ‘on/off’ (i.e. 0/1).

• We’ll use the particular Boolean Algebra where B has just the 2 elts 0 & 1, and where

• Boolean addition corresponds to parallel switch contacts:

8

Page 9: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Boolean Addition

9

Page 10: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Boolean Multiplication• Boolean multiplication corresponds to series

switch contacts:

10

Page 11: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Boolean Notation

• This means that in effect we’ll be employing Boolean Algebra notation.

• The truth tables can be rewritten as

11

Page 12: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Notational Short-cuts

We will employ short-cuts in notation:

(1) In ‘multiplication’ we’ll omit the symbol ×, & write xy for x × y (just as in ordinary algebra)

(2) The associative law says that x + (y + z) = (x + y) + z

So we’ll write this as simply x + y + z, because the brackets aren’t necessary.

12

Page 13: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Notational Short-cuts

Similarly, write the product of 3 terms as xyz

(3) In ordinary algebra, the expression x + y × z means x + (y × z), because of the convention that multiplication takes precedence over addition.

e.g. x + yz means x + (y × z), and not (x + y) × zSimilarly, ab + cd means (a × b) + (c × d)

13

Page 14: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Digital Circuits• A digital circuit (or logic gate circuit) is an

electronic device for carrying out digital computations (e.g. addition of 2 numbers)

• It accepts 1 or more inputs, each of which has 2 possible states (0 for ‘off’ & 1 for ‘on’)

• For each possible combination of inputs,one or more outputs are produced

.

...

LogicCircuitInputs Outputs

14

Page 15: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Describing Circuit Functionality: Inverter

• Truth table completely specifies outputs for all input combinations.

• The above circuit is an inverter. – An input of 0 is inverted to a 1.– An input of 1 is inverted to a 0.

AY

01

10

Input Output

A Y

Symbol

Truth Table

15

Page 16: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

The AND Gate

• This is an AND gate. • So, if the two inputs signals

are asserted (high (ON)) the output will also be asserted (ON).

• Otherwise, the output willbe asserted (low (OFF)).

ABY

000

010

100

111

A

BY

Truth Table

Input 1 input2 output

16

Page 17: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

The OR Gate

• This is an OR gate. • So, if at least one of the two

input signals is asserted (ON), then output will be asserted (ON).

• Otherwise, the output willbe asserted (low (OFF)).

ABY

000

011

101

111

AB

Y

Input 1 Input 2 Output

17

Page 18: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Consider Three-input Gate

3 Input OR Gate

18

Page 19: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Boolean Functions

• Boolean algebra deals with binary variables and logic operations.

• Function results in binary 0 or 1

x00001111

y00110011

z01010101

F00001011 F = x(y+z’)

xy

zz’

y+z’ F = x(y+z’)

19

Page 20: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Boolean Functions

x00001111

y00110011

z01010101

xy00000011

x

y

z

G = xy +yz

yz

xy

We will learn how to transform between expression and truth table.

yz00010001

G00010011

20

Page 21: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Truth Table to ExpressionConverting a truth table to an expression– Each row with output of 1 becomes a product term– Sum product terms together to have the Boolean

function.

x00001111

y00110011

z01010101

G00010011

xyz + xyz’ + x’yz

Any Boolean Expression can be represented in sum of products form!

21

Page 22: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Equivalent Representations of Circuits

• Number of 1’s in truth table output column equals ANDterms for Sum-Of-Products (SOP)

x y z

x00001111

y00110011

z01010101

G00010011

G = xyz + xyz’ + x’yz

G

x x xx x

xx

x x

22

Page 23: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Reducing Boolean Expressions

• Is this the smallest possible implementation of this expression? No!

• Use Boolean Algebra rules to reduce complexity while preserving functionality.

• Step 1: Use idempotent law (a + a = a). So xyz + xyz’ + x’yz = xyz + xyz + xyz’ + x’yz

G = xyz + xyz’ + x’yz

23

Page 24: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Reducing Boolean Expressions

• Step 2: Use distributive law a(b + c) = ab + ac. So xyz + xyz + xyz’ + x’yz = xy(z + z’) + yz(x + x’)

• Step 3: Use Inverse law (a + a’ = 1). So xy(z + z’) + yz(x + x’) = xy.1 + yz.1

• Step 4: Use Identity law (a . 1 = a). So xy + yz = xy.1 + yz.1 = xyz + xyz’ + x’yz

24

Page 25: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Reduced Hardware Implementation• Reduced equation requires less hardware!• Same function implemented!

x y z

x00001111

y00110011

z01010101

G00010011

G = xyz + xyz’ + x’yz = xy + yz

G

x x

x x

25

Page 26: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

x y F

0 0 1

0 1 1

1 0 0

1 1 0

Karnaugh maps

• Alternate way of representing Boolean function–All rows of truth table represented with a

square– Each square represents a minterm

0 1y

x

0

1

1

0 0

1

0 1y

x

0

1

x’y’

xy’ xy

x’y

26

Page 27: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Karnaugh maps

• Easy to convert between truth table, K-map, and SOP.

–Unoptimized form: number of 1’s in K-map equals number of minterms (products) in SOP.

–Optimized form: reduced number of minterms

27

F(x,y) = x’y + x’y’ = x’

Page 28: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Karnaugh Maps• A Karnaugh map is a graphical tool for assisting in the general

simplification procedure.• Two variable maps.

0A

1 01

B 0 101

F=AB +A’B 0A

1 11

B 0 101

• Three variable maps.

0A

1 11

00 01

01

BC

01 1

111 10

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

F=AB +AB +AB

A B C F0 0 0 00 0 1 10 1 0 10 1 1 01 0 0 11 0 1 11 1 0 11 1 1 1

+

28

Page 29: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Rules for K-Maps We can reduce functions by circling 1’s in

the K-map.

Each circle represents minterm reduction.

Following circling, we can deduce minimizedand-or form.

F(x,y) = x’y + x’y’ = x’

29

0 1y

x

0

1

1

0 0

1

Page 30: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Rules for K-Maps

Rules to consider

1. Every cell containing a 1 must be included at least once.

2. The largest possible “power of 2 rectangle” must be enclosed.

30

Page 31: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

Karnaugh Maps

• A Karnaugh map is a graphical tool for assisting in thegeneral simplification procedure.

• Two variable maps.

0A

1 01

B 0 101

F=AB +A’B 0A

1 11

B 0 101 F=A+B

• Three variable maps.

F=A+B C +BC 0

A

1 11

00 01

01

BC

01 1

111 10

F=AB +AB +AB

F=AB’C’ +AB C +ABC +ABC + A’B’C + A’BC’ 31

Page 32: Boolean Algebra and Digital Circuits Reading: Chapter 8 (138-162) from the text book 1

More Karnaugh Map Examples

Examples

g = b'

0 101

ab

cab

00 01 11 1001

0 101

ab

cab

00 01 11 1001

0 10 1f = a

0 0 1 00 1 1 1

cout = ab + bc + ac

1 10 0

0 0 1 10 0 1 1

f = a

1. Circle the largest groups possible.2. Group dimensions must be a power of 2. 3. Remember what circling means!

32