Combinational Circuits Digital Logic (Materials taken primarily from: http://www.facstaff.bucknell.edu/mastascu/eLessonsHTML/EEIndex.html http://www.cs.Princeton.EDU/~cos126 ) Digital Systems What is a digital system? • Digital: signals are 0 or I • Analog: signals vary continuously Why digital systems? • Accuracy and reliability • Fast and cheap Basic abstractions. • On, off • Switch that con turn something on or off Characteristics • The signals can and usually will change with time Digital circuits you know • Computer microprocessors • Cell phones • Thermostat • Anti-lock brakes All digital systems are binary but not all binary systems are digital! Signals • A digital signal takes on values of 0 (FALSE, OFF) or 1 (TRUE, ON). – That signal might be a voltage, a switch closure, etc. • We think in terms of zeros and ones, not in terms of the values of the voltage---Logic Values • Wires propagate these logic values – Signals “flow” from right to left Operations on Signals Assume 2 signals are input to a circuit that has 1 output signal •The output, C, depends upon the inputs, A and B •It‘s a function of A & B A signal can be viewed as the truth value of a logic proposition. •A & B could each be either TRUE (a logical 1) or FALSE (a logical 0) C value depends on the values of A and B •Example: C is TRUE only when A is TRUE and B is TRUE. We can construct a truth table describing this relationship. •All possible combinations of A & B and the corresponding values of C Truth Tables Logic Gates Multi-way Gates One row for each possible input combination N inputs => 2N rows Boolean Algebra • An algebra in which the variables can take only one of two values. • Any Boolean function can be expressed using AND, OR, NOT – "Universal" – E.g., XOR(x,y) = ~x & y | x & ~y • Notation: – AND: &, xy, – OR: +, | – NOT: ~, x, ‘ Sum Of Products Any Boolean function can be expressed using AND, OR, NOT. • Sum-of-products is systematic procedure. – form AND term for each 1 in truth table of Boolean function – OR terms together Expressing any Boolean Function Using AND, OR and NOT • Ingredients. – AND gates. – OR gates. – NOT gates. – Wire. • Instructions. – Step 1: represent input and output signals with Boolean variables. – Step 2: construct truth table to carry out computation. – Step 3: derive (simplified) Boolean expression using sumof products. – Step 4: transform Boolean expression into circuit. Translate Boolean Formula to Boolean Circuits Majority: Y = ~ABC + A~BC + AB~C + ABC Axioms Translate Boolean Formula to Boolean Circuits DeMorgan’s Theorem A + B = A B and A B = A + B DeMorgan’s Law Translate Boolean Formula to Boolean Circuits (NAND-NAND form) Many representations for Each Function Many possible circuits for each Boolean function. • Sum-of-products not necessarily optimal in: – number of gates (space) – depth of circuit (time) • Majority Y = A‘BC + AB‘C + ABC' + ABC = AB + BC + AC Simplifying Boolean Expressions • A Karnaugh map is a method of grouping together expressions with common factors used to eliminate unwanted variables – one square in the map for every row in the truth table – any two adjacent cells differ by a change in one variable – each single cell with a 1 represents a minterm in the function Karnaugh Maps Examine the map: The term on the left in the gray area of the map corresponds to: A~BC •The term on the right in the gray area of the map corresponds to: •ABC •These two terms can be combined to give •AC •When only one variable changes, you can eliminate that variable! Simplifying Boolean Expressions Using Karnaugh Maps • Given a Boolean function described by a truth table or logic function – Draw the Karnaugh Map for the function. – Use the information in the Karnaugh Map to determine the smallest sum-of-products function • crossing a vertical or horizontal cell boundary is a change of only one variable • each single cell that contains a 1 represents a minterm in the function • to combine variables, use groups of 2, 4, 8, etc. – never use a group of 3, a group of 5, etc. f(A,B,C) = A B + B C + A C