cs 150 - fall 2005 – lec #2: combinational logic - 1 combinational logic (mostly review!) zlogic...

Download CS 150 - Fall 2005 – Lec #2: Combinational Logic - 1 Combinational Logic (mostly review!) zLogic functions, truth tables, and switches yNOT, AND, OR, NAND,

Post on 20-Dec-2015

213 views

Category:

Documents

1 download

Embed Size (px)

TRANSCRIPT

  • Slide 1
  • CS 150 - Fall 2005 Lec #2: Combinational Logic - 1 Combinational Logic (mostly review!) zLogic functions, truth tables, and switches yNOT, AND, OR, NAND, NOR, XOR,... yMinimal set zAxioms and theorems of Boolean algebra yProofs by re-writing yProofs by perfect induction zGate logic yNetworks of Boolean functions yTime behavior zCanonical forms yTwo-level yIncompletely specified functions
  • Slide 2
  • CS 150 - Fall 2005 Lec #2: Combinational Logic - 2 XY16 possible functions (F0F15) 000000000011111111 010000111100001111 100011001100110011 110101010101010101 X Y F X Y X nor Y not (X or Y) X nand Y not (X and Y) 10 not X X and Y X or Y not Y X xor Y X = Y Possible Logic Functions of Two Variables z16 possible functions of 2 input variables: y2**(2**n) functions of n inputs
  • Slide 3
  • CS 150 - Fall 2005 Lec #2: Combinational Logic - 3 Cost of Different Logic Functions zSome are easier, others harder, to implement yEach has a cost associated with the number of switches needed y0 (F0) and 1 (F15): require 0 switches, directly connect output to low/high yX (F3) and Y (F5): require 0 switches, output is one of inputs yX' (F12) and Y' (F10): require 2 switches for "inverter" or NOT-gate yX nor Y (F4) and X nand Y (F14): require 4 switches yX or Y (F7) and X and Y (F1): require 6 switches X = Y (F9) and X Y (F6): require 16 switches yBecause NOT, NOR, and NAND are the cheapest they are the functions we implement the most in practice
  • Slide 4
  • CS 150 - Fall 2005 Lec #2: Combinational Logic - 4 XYX nand Y 001 110 XYX nor Y 001 110 X nand Y not ( (not X) nor (not Y) ) X nor Y not ( (not X) nand (not Y) ) Minimal Set of Functions zImplement any logic functions from NOT, NOR, and NAND? yFor example, implementing X and Y is the same as implementing not (X nand Y) zDo it with only NOR or only NAND yNOT is just a NAND or a NOR with both inputs tied together yand NAND and NOR are "duals", i.e., easy to implement one using the other zBased on the mathematical foundations of logic: Boolean Algebra
  • Slide 5
  • CS 150 - Fall 2005 Lec #2: Combinational Logic - 5 Algebraic Structure zConsists of ySet of elements B yBinary operations { +, } yUnary operation { ' } yFollowing axioms hold: 1. set B contains at least two elements, a, b, such that a b 2. closure:a + b is in Ba b is in B 3. commutativity:a + b = b + a a b = b a 4. associativity:a + (b + c) = (a + b) + ca (b c) = (a b) c 5. Identity:a + 0 = aa 1 = a 6. distributivity:a + (b c) = (a + b) (a + c)a (b + c) = (a b) + (a c) 7. complementarity:a + a' = 1 a a' = 0
  • Slide 6
  • CS 150 - Fall 2005 Lec #2: Combinational Logic - 6 Boolean Algebra zBoolean algebra yB = {0, 1} y+ is logical OR, is logical AND y' is logical NOT zAll algebraic axioms hold
  • Slide 7
  • CS 150 - Fall 2005 Lec #2: Combinational Logic - 7 X, Y are Boolean algebra variables XYX Y 000 010 100 111 XYX'Y'X YX' Y'( X Y ) + ( X' Y' ) 0011011 0110000 1001000 1100101 ( X Y ) + ( X' Y' ) X = Y XYX'X' Y 0010 0111 1000 1100 Boolean expression that is true when the variables X and Y have the same value and false, otherwise Logic Functions and Boolean Algebra zAny logic function that can be expressed as a truth table can be written as an expression in Boolean algebra using the operators: ', +, and
  • Slide 8
  • CS 150 - Fall 2005 Lec #2: Combinational Logic - 8 Axioms and Theorems of Boolean Algebra zIdentity 1. X + 0 = X1D. X 1 = X zNull 2. X + 1 = 12D. X 0 = 0 zIdempotency: 3. X + X = X3D. X X = X zInvolution: 4. (X')' = X zComplementarity: 5. X + X' = 15D. X X' = 0 zCommutativity: 6. X + Y = Y + X6D. X Y = Y X zAssociativity: 7. (X + Y) + Z = X + (Y + Z)7D. (X Y) Z = X (Y Z)
  • Slide 9
  • CS 150 - Fall 2005 Lec #2: Combinational Logic - 9 Axioms and Theorems of Boolean Algebra (contd) zDistributivity: 8. X (Y + Z) = (X Y) + (X Z) 8D. X + (Y Z) = (X + Y) (X + Z) zUniting: 9. X Y + X Y' = X9D. (X + Y) (X + Y') = X zAbsorption: 10. X + X Y = X10D. X (X + Y) = X 11. (X + Y') Y = X Y11D. (X Y') + Y = X + Y zFactoring: 12. (X + Y) (X' + Z) =12D. X Y + X' Z = X Z + X' Y (X + Z) (X' + Y) zConsensus: 13. (X Y) + (Y Z) + (X' Z) = 13D. (X + Y) (Y + Z) (X' + Z) = X Y + X' Z (X + Y) (X' + Z)
  • Slide 10
  • CS 150 - Fall 2005 Lec #2: Combinational Logic - 10 Axioms and Theorems of Boolean Algebra (contd) zdeMorgan's: 14. (X + Y +...)' = X' Y'...14D. (X Y...)' = X' + Y' +... zGeneralized de Morgan's: 15. f'(X1,X2,...,Xn,0,1,+,) = f(X1',X2',...,Xn',1,0,,+) zEstablishes relationship between and +
  • Slide 11
  • CS 150 - Fall 2005 Lec #2: Combinational Logic - 11 Axioms and Theorems of Boolean Algebra (contd) zDuality yDual of a Boolean expression is derived by replacing by +, + by, 0 by 1, and 1 by 0, and leaving variables unchanged yAny theorem that can be proven is thus also proven for its dual! yMeta-theorem (a theorem about theorems) zDuality: 16. X + Y +... X Y... zGeneralized duality: 17. f (X1,X2,...,Xn,0,1,+,) f(X1,X2,...,Xn,1,0,,+) zDifferent than deMorgans Law yThis is a statement about theorems yThis is not a way to manipulate (re-write) expressions
  • Slide 12
  • CS 150 - Fall 2005 Lec #2: Combinational Logic - 12 Proving Theorems (Rewriting Method) zUsing the axioms of Boolean algebra: ye.g., prove the theorem: X Y + X Y' = X ye.g., prove the theorem: X + X Y = X distributivity (8)X Y + X Y'= X (Y + Y') complementarity (5)X (Y + Y') = X (1) identity (1D)X (1)= X identity (1D)X + X Y= X 1 + X Y distributivity (8)X 1 + X Y= X (1 + Y) identity (2)X (1 + Y)= X (1) identity (1D)X (1) = X
  • Slide 13
  • CS 150 - Fall 2005 Lec #2: Combinational Logic - 13 (X + Y)' = X' Y' NOR is equivalent to AND with inputs complemented (X Y)' = X' + Y' NAND is equivalent to OR with inputs complemented XYX'Y'(X + Y)'X' Y' 0011 0110 1001 1100 XYX'Y'(X Y)'X' + Y' 0011 0110 1001 1100 Proving Theorems (Perfect Induction) zUsing perfect induction (complete truth table): ye.g., de Morgan's: 10001000 11101110 10001000 11101110
  • Slide 14
  • CS 150 - Fall 2005 Lec #2: Combinational Logic - 14 Simple Example z1-bit binary adder yInputs: A, B, Carry-in yOutputs: Sum, Carry-out A B Cin Cout S ABCinSCout 000 001 010 011 100 101 110 111 0110100101101001 0001011100010111 Cout = A' B Cin + A B' Cin + A B Cin' + A B Cin S = A' B' Cin + A' B Cin' + A B' Cin' + A B Cin
  • Slide 15
  • CS 150 - Fall 2005 Lec #2: Combinational Logic - 15 Apply the Theorems to Simplify Expressions zTheorems of Boolean algebra can simplify Boolean expressions ye.g., full adder's carry-out function (same rules apply to any function) Cout = A' B Cin + A B' Cin + A B Cin' + A B Cin = A' B Cin + A B' Cin + A B Cin' + A B Cin + A B Cin = A' B Cin + A B Cin + A B' Cin + A B Cin' + A B Cin = (A' + A) B Cin + A B' Cin + A B Cin' + A B Cin = (1) B Cin + A B' Cin + A B Cin' + A B Cin = B Cin + A B' Cin + A B Cin' + A B Cin + A B Cin = B Cin + A B' Cin + A B Cin + A B Cin' + A B Cin = B Cin + A (B' + B) Cin + A B Cin' + A B Cin = B Cin + A (1) Cin + A B Cin' + A B Cin = B Cin + A Cin + A B (Cin' + Cin) = B Cin + A Cin + A B (1) = B Cin + A Cin + A B
  • Slide 16
  • CS 150 - Fall 2005 Lec #2: Combinational Logic - 16 XYZ000010100111XYZ000010100111 XY0110XY0110 XYZ000011101111XYZ000011101111 X Y X X Y Y Z Z From Boolean Expressions to Logic Gates zNOTX'X~X zANDX YXYX Y zORX + YX Y
  • Slide 17
  • CS 150 - Fall 2005 Lec #2: Combinational Logic - 17 X Y Z XYZ001011101110XYZ001011101110 XYZ001010100110XYZ001010100110 Z X Y X Y Z XYZ001010100111XYZ001010100111 XYZ000011101110XYZ000011101110 Z X Y X xor Y = X Y' + X' Y X or Y but not both ("inequality", "difference") X xnor Y = X Y + X' Y' X and Y are the same ("equality", "coincidence") From Boolean Expressions to Logic Gates (contd) zNAND zNOR XOR X Y zXNOR X = Y
  • Slide 18
  • CS 150 - Fall 2005 Lec #2: Combinational Logic - 18 T1 T2 use of 3-input gate A B C D T2 T1 Z A B C D Z From Boolean Expressions to Logic Gates (contd) zMore than one way to map expressions to gates ye.g., Z = A' B' (C + D) = (A' (B' (C + D)))
  • Slide 19
  • CS 150 - Fall 2005 Lec #2: Combinational Logic - 19 time change in Y takes time to "propagate" through gates Waveform View of Logic Functions zJust a sideways truth table yBut note how edges don't line up exactly yIt takes time for a gate to switch its output!
  • Slide 20
  • CS 150 - Fall 2005 Lec #2: Combinational Logic - 20 ABCZ00000011010001111000101111011110ABCZ00000011010001111000101111011110 Choosing Different Realizations of a Function two-level realization (we don't count NOT gates) XOR gate (easier to draw but costlier to build) multi-level realization (gates with fewer inputs)
  • Slide 21
  • CS 150 - Fall 2005 Lec #2: Combinational Logic - 21 Which Realization is Best? zReduce number of inputs yliteral: input variable (complemented or not) xcan approximate cost of logic gate as 2 transistors per literal xwhy not count inverters? yFewer literals means less transistors xsmaller circuits yFewer inputs implies faster gates xgates are smaller and thus also faster yFan-ins (# of gate inputs) are limited in some technologies zReduce number of gates yFewer gates (and the packages they come in) means smaller circuits xdirectly influences manufacturing costs
  • Slide 22
  • CS 150 - Fall 2005 Lec #2: Combinational Logic - 22 Which is the Best Realization? (contd) zReduce number of levels of gates yFewer level of gates implies reduced signal pro

Recommended

View more >