logic gate level part 2. constructing boolean expression from truth table first method: write...

24
Logic Gate Level Part 2

Post on 19-Dec-2015

214 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Logic Gate Level Part 2. Constructing Boolean expression from truth table First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result

Logic Gate Level

Part 2

Page 2: Logic Gate Level Part 2. Constructing Boolean expression from truth table First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result

Constructing Boolean expression from truth table

• First method: write nonparenthesized OR of ANDs

• Each AND is a 1 in the result column of the truth table

• Works best for table with relatively few 1s in the result column

a b c x

0 0 0 0

0 0 1 1

0 1 0 0

0 1 1 1

1 0 0 0

1 0 1 0

1 1 0 0

1 1 1 0

In the truth table above, x=1 for abc = 001 or 011; so x= a’b’c + a’bc

Page 3: Logic Gate Level Part 2. Constructing Boolean expression from truth table First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result

Logic diagram for x= a’b’c + a’bc

Page 4: Logic Gate Level Part 2. Constructing Boolean expression from truth table First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result

Sum of products representation

• In Discrete Math (at least, back in the day), we call this representation (OR of ANDs) the sum of products expansion or disjunctive normal form

• This representation is a reflection of 2 fun facts:– Any Boolean function may be represented by a

Boolean sum of Boolean products of the variables and their complements

– All Boolean functions can be represented using only 1 operator (we’ll get back to this one!)

Page 5: Logic Gate Level Part 2. Constructing Boolean expression from truth table First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result

5

Sum-of-products example 1• Construct Boolean expressions representing

functions with the given values:

x y z F G1 1 1 0 01 1 0 1 01 0 1 0 11 0 0 0 00 1 1 0 00 1 0 0 10 0 1 0 00 0 0 0 0

F has value 1 only when x=1, y=1, and z=0; onesuch expression is the Boolean product xyz’

G has value 1 when either x and z are 1, y is 0 orwhen x and z are 0, y is 1The first condition is met by xy’zThe second is met by x’yz’So G can be represented by the Boolean sum ofthe 2 products:

xy’z + x’yz’

Page 6: Logic Gate Level Part 2. Constructing Boolean expression from truth table First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result

Logic diagrams from previous slide

xyz’

xy’z + x’yz’

Page 7: Logic Gate Level Part 2. Constructing Boolean expression from truth table First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result

7

Sum-of-products example 2

• Find the sum-of-products expansion for F(x,y,z) = (x+y)z’

x y z x+y z’ (x+y)z’1 1 1 1 0 01 1 0 1 1 11 0 1 1 0 01 0 0 1 1 10 1 1 1 0 00 1 0 1 1 10 0 1 0 0 00 0 0 0 1 0

The sum-of-products expansionis the Boolean sum of 3 mintermscorresponding to the rows thatshow 1 for the values of F:

xyz’ + xy’z’ + x’yz’

Page 8: Logic Gate Level Part 2. Constructing Boolean expression from truth table First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result

Logic diagram from previous slide

xyz’ + xy’z’ + x’yz’

Page 9: Logic Gate Level Part 2. Constructing Boolean expression from truth table First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result

Constructing Boolean expression from truth table

• Second method: dual technique

• Create AND of several ORs

• Each OR is a 0 in the results column

• Use complements of input combinations that produce the 0 result

In the table above, x=0 forabc = 011 and 110So x = (a+b’+c’)(a’+b’+c)

Page 10: Logic Gate Level Part 2. Constructing Boolean expression from truth table First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result

Logic gate for previous slide

(a+b’+c’)(a’+b’+c)

Page 11: Logic Gate Level Part 2. Constructing Boolean expression from truth table First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result

11

Conjunctive normal form

• Can find a Boolean expression that represents a Boolean function by taking a Boolean product of Boolean sums - this is the conjunctive normal form or product-of-sums expansion

• We can find the product-of-sums from sum-of-products by taking duals; for this function:

xyz’ + xy’z’ + x’yz’• The product-of-sums is:

(x’ + y’ + z)(x’ + y + z)(x + y’ + z)

Page 12: Logic Gate Level Part 2. Constructing Boolean expression from truth table First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result

Previous circuit (& its dual)

(x’ + y’ + z)(x’ + y + z)(x + y’ + z)

xyz’ + xy’z’ + x’yz’

Page 13: Logic Gate Level Part 2. Constructing Boolean expression from truth table First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result

13

Functional completeness

• Every Boolean function can be expressed as a Boolean sum of products

• Each product is the Boolean product of Boolean variables or their complements

• So every Boolean function can be represented using Boolean operators ., +, and ’

• We say that the set {., +, ’} is functionally complete

Page 14: Logic Gate Level Part 2. Constructing Boolean expression from truth table First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result

14

Functional completeness

• If one of the operators from the set {., +, ’} can be expressed in terms of the other two, we can find a smaller set of functionally complete operators

• We can do this using DeMorgan’s law:x + y = (x’y’)’(We obtain this by taking complements of both

sides of DeMorgan’s second law, then applying double complementation)

Page 15: Logic Gate Level Part 2. Constructing Boolean expression from truth table First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result

15

Functional completeness

• Using DeMorgan’s law, as stated on the previous slide, we can eliminate sums; this means the set { ., ’} is functionally complete

• Using DeMorgan’s first law we can similarly show that the set { +, ’} is functionally complete

Page 16: Logic Gate Level Part 2. Constructing Boolean expression from truth table First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result

16

Functionally complete sets containing one operator

• NAND: {|}1|1 = 0, 1|0 = 1, 0|1 = 1, 0|0 = 1

• NOR: {} 11 = 0, 10 = 0, 01 = 0, 00 = 1

• NAND is functionally complete, since:{ ., ’} is functionally complete andx’ = x|x andxy = (x|y)|(x|y)

• We can similarly show that NOR is functionally complete

Page 17: Logic Gate Level Part 2. Constructing Boolean expression from truth table First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result

Why do we care about this?

• Keeping circuits as simple as possible isn’t just a nice thing for humans – it improves performance of devices

• Gate delay: the time it takes for the output of a gate to respond to a change in its input

• Delay may be significant with a long string of gates – next example is a case in point

Page 18: Logic Gate Level Part 2. Constructing Boolean expression from truth table First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result

Logic diagram for (a’bc c + a + d)’

• This diagram is an abbreviated version, omitting the connector lines for a and a’ (the a’ symbol is understood to be input a passing through an inverter) and for input c to 2 different gates (AND and XOR) and shows input d only where it’s relevant (NOR gate)

• It’s a reasonable representation for the given expression, but it involves 3 gates (because b is a direct or indirect input to all 3); general rule is to try to keep circuits to 2 or less

Page 19: Logic Gate Level Part 2. Constructing Boolean expression from truth table First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result

Reducing number of gates reduces gate delay

• Because of functional completeness, any boolean expression can be written as an OR of ANDed terms – in other words, a two-level AND-OR network

• Therefore, any function can be implemented with a combinational net with no more than 2 gate delays

• Same principle applies to dual; can transform any expression into AND of ORed terms if this is more convenient: 2-level OR-AND network

Page 20: Logic Gate Level Part 2. Constructing Boolean expression from truth table First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result

Reducing the original expression• We apply the rules of Boolean algebra to transform expression to sum

of products:(a’bc c + a + d)’ – transforms, by definition of XOR, to:(a’bcc’ + (a’bc)’c + a + d)’ – we can lose the first term because cc’=0 by complementation, and

a’b0 = 0:((a’bc)’c + a + d)’ – applying DeMorgan’s law:((a+b’+c’)c + a + d)’– applying distribution, complement and identity:(ac + b’c + a + d)’

Page 21: Logic Gate Level Part 2. Constructing Boolean expression from truth table First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result

Reduction continued

(ac + b’c + a + d)’ – rearranging and applying absorption (ac+c = a):(a + b’c + d)’ – applying DeMorgan :a’(b’c)’d’ – and DeMorgan again:a’(b+c’)d’ – and then distribution:a’bd’ + a’c’d’ – which is a sum of products

Page 22: Logic Gate Level Part 2. Constructing Boolean expression from truth table First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result

Result of reduction: 2-level network

transforms to:

Page 23: Logic Gate Level Part 2. Constructing Boolean expression from truth table First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result

Equivalent gates

• Recall DeMorgan’s laws:(abc)’ = a’+b’+c’(a+b+c)’ = a’b’c’

• From these we can derive the equivalent gates shown below:

Page 24: Logic Gate Level Part 2. Constructing Boolean expression from truth table First method: write nonparenthesized OR of ANDs Each AND is a 1 in the result

Replacing AND-OR net with NAND-NAND net