540 likes | 554 Views
Learn to implement gadgets with binary input/output tables. Explore combinational logic units and their applications. Understand physical system representation of YES/NO values. Detailed gadget implementation.
E N D
A Prelude • Practice yourself, for heaven’s sake, in little things; and thence proceed to greater. – Epictetus • Today we are going to build simple systems satisfying binary input/output tables Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic Units / Prelude Input/output Spec Table: • Let us look at the pencil-and-paper assignment which was due today: • Describe a physical implementation of gadget which takes two inputs and one output.Each of the inputs can either take the value YES or the value NO.The same goes for the output. The gadget is specified by the input-output table to the left. Describe how the values NO and YES are represented in your physical system for the inputs as well as for the output. Moreover describe the implementation details of your gadget(system). Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic Units/Prelude Input/output Spec Table: • Discussion of some answers Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic Units / Prelude Input/output Spec Table: • Same question but for a different Inpu/Output Spec Table: • Describe a physical implementation of gadget which takes two inputs and one output.Each of the inputs can either take the value YES or the value NO.The same goes for the output. The gadget is specified by the input-output table to the left. Describe how the values NO and YES are represented in your physical system for the inputs as well as for the output. Moreover describe the implementation details of your gadget(system). Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic Units / Prelude Input/output Spec Table: • Disscussion of some answers Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic Units /Prelude Input/output Spec Table: • Let us look at the pencil-and-paper assignment which was due today: • Describe a physical implementation of gadget which takes two inputs and one output.Each of the inputs can either take the value YES or the value NO.The same goes for the output. The gadget is specified by the input-output table to the left. Describe how the values NO and YES are represented in your physical system for the inputs as well as for the output. Moreover describe the implementation details of your gadget(system). Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic Units /Prelude Input/output Spec Table: • Discussion of some answers Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic Units / Prelude How do implement the following Input/output Spec Table: Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic Units After the previous prelude we will discuss the following points: • Combinational Logic Units • Specifying a CLU with a Input/Output Tables • Reading off a Logic Diagram of a CLU from its 0-1 Specification Tables • Specifying a CLU with an Algebraic Expression of the Switching Algebra Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic UnitsSome Definitions • Combinational logic: a digital logic circuit in which logical decisions are made based only on combinations of the inputs. e.g. an adder. • Sequential logic: a circuit in which decisions are made based on combinations of the current inputs as well as the past history of inputs. e.g. a memory unit. • Finite state machine: a circuit which has an internal state, and whose outputs are functions of both current inputs and its internal state. e.g. a vending machine controller. Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic Units • Combinational logic: a digital logic circuit in which logical decisions are made based only on combinations of the inputs. e.g. an adder. Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic Unit • Translates a set of inputs into a set of outputs according to one or more mapping functions. • Inputs and outputs for a CLU normally have two distinct (binary) values: high and low, 1 and 0, 0 and 1, or 5 v. and 0 v. for example. • The outputs of a CLU are strictly functions of the inputs, and the outputs are updated immediately after the inputs change. A set of inputs i0 – in are presented to the CLU, which produces a set of outputs according to mapping functions f0 – fm Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic Unit Digital Techniques Fall 2007 André Deutz, Leiden University
i0 i1 . . . f(i0,...in) Combinational Logic Unit in Specifying Combinational Logic Unit Enough if you know how to handle the case of ONE output and arbitrary number of inputs: Digital Techniques Fall 2007 André Deutz, Leiden University
SpecifyingCombinational Logic Unit • CLU (with one output )is completely specified by an input/output table; if you have more than one output you will have an input/output table for each output • Since the inputs and outputs assume only two values: say 0 or 1 (low voltage or high voltage etc) a CLU can be specified by 0-1 Table or Truth Table Digital Techniques Fall 2007 André Deutz, Leiden University
SpecifyingCombinational Logic Unit 0-1 Table/Truth Table Truth Table Digital Techniques Fall 2007 André Deutz, Leiden University
Truth Tables Showing All Possible Functions of Two Binary Variables • The more frequently used functions : AND, XOR, OR, NOR, XOR, and NAND. (Always use upper case spelling.) See also handout Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic Unit • We have constructed an implementation of an AND, OR and NOT gate (“waterworks “) Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic Unit • We have constructed an implementation of an AND, OR and NOT gate (“waterworks “) Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic Unit • We have constructed an implementation of an AND, OR and NOT gate (“waterworks “) Digital Techniques Fall 2007 André Deutz, Leiden University
SpecifyingCombinational Logic Unit; Example One Bit Full Adder 1 1 + 1 ----- 11 Digital Techniques Fall 2007 André Deutz, Leiden University
from spec table to Logic Diagram (LD) for a CLU Output 2 inputs Output 1 Digital Techniques Fall 2007 André Deutz, Leiden University
from spec table to (LD) for a CLU inputs Output 1 Let us concentrate on the First output: the sum of the two input bits and the the carry_in. Digital Techniques Fall 2007 André Deutz, Leiden University
from spec table to (LD) for a CLU Given the Truth table we can implement a circuit as follows: For each input provide a line(wire) and a negated wire (by using inverters) Draw a multi-AND gate (that is, n-AND gate where n equals the number of inputs) for each 1 in the output column Wire the AND gates to the appropriate inputs (see next slides) Feed the output of all the AND gates into an OR gate In the next slides we show in detail how the above algorithm works. Digital Techniques Fall 2007 André Deutz, Leiden University
from spec table to LD Step 1 For each input we introduce a wire and a negated wire: inputs Output 1 A Cin B Digital Techniques Fall 2007 André Deutz, Leiden University Digital Techniques Fall 2007 André Deutz, Leiden University
from spec table to LD Step 2 Cin A B For each 1 in the output Column introduce a multi-way AND gate: inputs Output 1 Digital Techniques Fall 2007 André Deutz, Leiden University Digital Techniques Fall 2007 André Deutz, Leiden University
From spec table to LD Step 3 Cin Consider each (input) row of which the output is 1; connect the input lines to the AND gate appropriately: if 0 appears connect to neg line; for a 1 to the line itself A B inputs Output 1 Digital Techniques Fall 2007 André Deutz, Leiden University Digital Techniques Fall 2007 André Deutz, Leiden University
spec table to LD Step 3 (cont’d) Cin Consider each (input) row of which the output is 1; connect the input lines to the AND gate appropriately: if 0 appears connect to neg line; for a 1 to the line itself A B inputs Output 1 Digital Techniques Fall 2007 André Deutz, Leiden University Digital Techniques Fall 2007 André Deutz, Leiden University
spec table to LD Step 3 (cont’d) Cin Consider each (input) row of which the output is 1; connect the input lines to the AND gate appropriately: if 0 appears connect to neg line; for a 1 to the line itself A B inputs Output 1 Digital Techniques Fall 2007 André Deutz, Leiden University Digital Techniques Fall 2007 André Deutz, Leiden University
spec table to LD Step 3 (cont’d) Cin Consider each (input) row of which the output is 1; connect the input lines to the AND gate appropriately: if 0 appears connect to neg line; for a 1 to the line itself A B inputs Output 1 Digital Techniques Fall 2007 André Deutz, Leiden University Digital Techniques Fall 2007 André Deutz, Leiden University
spec table to LD Step 4 Cin A B Wire the AND gates to a multi OR gate (for this example a 4-OR gate): inputs Output 1 S Digital Techniques Fall 2007 André Deutz, Leiden University Digital Techniques Fall 2007 André Deutz, Leiden University
from spec table to LD for (CLU) • Does our 4-step algorithm produce the right Logic Diagram for the Combinational Logic Unit? Why? • This algorithm will generally not produce the most frugal combinational logic unit. • Despite the previous remark this algorithm is still very important! Why? • This algorithm convinced us that for each input/output table (0/1-table) there exists an LD ( or for that matter a CLU) satisfying it. Besides the LD (or for that matter also the CLU) produced by the algorithm there are, of course, many more LDs satisfying the 1/0-table (some of them will in general be more efficient) • Secondly: once you can translate your task into an input/output table you are home free (we can worry later about optimizing the circuit) Digital Techniques Fall 2007 André Deutz, Leiden University
Two more examples: a 4x1 Multiplexer and 1x4 Demultiplexer and the Music the pair can make Digital Techniques Fall 2007 André Deutz, Leiden University
Boolean Algebra Digital Techniques Fall 2007 André Deutz, Leiden University
Boolean Algebra • Actually a special kind of Boolean Algebra namely, Switching Algebra Digital Techniques Fall 2007 André Deutz, Leiden University
Intro to Boolean Algebra; Specifying • Sofar we can specify a CLU either by a Logic Diagram of NOT, AND and OR gates or by a 1/0-table • There is at least a third way of specifying CLU namely via Algebra (algebraic equations/expressions) • What is the advantage of Algebraic specifications? Among others: can simplify circuits by manipulating expressions with “pencil and paper” or computer programs Digital Techniques Fall 2007 André Deutz, Leiden University
Boolean Algebra • In order to analyze and design digital combinational logic units we need a mathematical system. • Binary logic system called Boolean Algebra is used. • George Boole (1815-1864): “An investigation of the laws of thought” – a book published in 1854 introducing the mathematical theory of logic. • Boolean Algebra deals with binary variables that take 2 discrete values (0 and 1), and with logic operations. • Binary/logic variables are typically represented as letters: A,B,C,…,X,Y,Z or a,b,c,…,x,y,z. • Three basic logic operations: • AND, OR, NOT(complementation or negation). Digital Techniques Fall 2007 André Deutz, Leiden University
Basic Logic Operations • AND operation is represented by operators “•” or “ ” or by the absence of an operator. • Z = X•Y or Z = X Y, or Z = XY is read “Z is equal to X AND Y” meaning that: • Z = 1 if and only if X = 1 and Y = 1; otherwise Z = 0. • AND resembles binary multiplication: 0 • 0 = 0, 0 • 1 = 0, 1 • 0 = 0, 1 • 1 = 1 • OR operation is represented by operators “+” or “ ”. • Z = X+Y or Z = X Y is read “Z is equal to X OR Y” meaning that: • Z = 1 if X = 1 or Y = 1, or if both X = 1 and Y = 1. Z = 0 if and only if X = 0 and Y = 0. • OR resembles binary addition, except in one case: 0 + 0 = 0, 0 + 1 = 1, 1 + 0 = 1, 1 + 1 = 1 (≠ 102) • NOT operation is represented by operator “ ’ ” or by a bar over a variable. • Z = X’ or Z = X is read “Z is equal to NOT X” meaning that: • Z = 1 if X = 0; but Z = 0 if X = 1 • NOT operation is also referred to as complement operation. Digital Techniques Fall 2007 André Deutz, Leiden University
Basic Identities of Boolean Algebra Let X be a boolean variable and 0,1 constants 1. X + 0 = X -- Zero Axiom 2. X • 1 = X -- Unit Axiom 3. X + 1 = 1 -- Unit Property 4. X • 0 = 0 -- Zero Property 5. X + X = X -- Idempotence 6. X • X = X -- Idempotence 7. X + X’ = 1 -- Complement 8. X • X’ = 0 -- Complement 9. (X’)’ = X -- Involution Digital Techniques Fall 2007 André Deutz, Leiden University
Boolean Algebra Properties Let X,Y, and Z be boolean variables • Commutative 10. X + Y = Y + X 11. X • Y = Y • X • Associative 12. X + (Y+Z) = (X+Y) + Z 13. X•(Y•Z) = (X•Y)•Z • Distributive 14. X•(Y+Z) = X•Y + X•Z 15. X+(Y•Z) = (X+Y) • (X+Z) • DeMorgan’s Theorem 16. (X + Y)’ = X’ • Y’ 17. (X • Y)’ = X’ + Y’ • In general for DeMorgan, • ( X1 + X2 + … + Xn )’ = X1’ • X2’ • … • Xn’, • ( X1 • X2 • … • Xn )’ = X1’ + X2’ + … + Xn’ Digital Techniques Fall 2007 André Deutz, Leiden University
The Duality Principle • The dual of an expression is obtained by exchanging (• and +), and (1 and 0) in it, provided that the precedence of operations is not changed. • Cannot exchange x with x’. • Example: • Find the dual of expression: x’yz’ + x’y’z • Answer: (x’ + y + z ’) •(x ’ + y’ + z) • Dual expression does not always equal the original expression. • If a Boolean equation/equality is valid, its dual is also valid. Digital Techniques Fall 2007 André Deutz, Leiden University
The Duality Principle (cont.) With respect to duality, Identities 1 – 8 and Properties 10 – 17 have the following relationship: 1. X + 0 = X 2. X • 1 = X (dual of 1) 3. X + 1 = 1 4. X • 0 = 0 (dual of 3) 5. X + X = X 6. X • X = X (dual of 5) 7. X + X’ = 1 8. X • X’ = 0 (dual of 7) 10. X + Y = Y + X 11. X • Y = Y • X (dual of 10) 12. X + (Y+Z) = (X+Y) + Z 13. X•(Y•Z) = (X•Y)•Z (dual of 12) 14. X•(Y+Z) = X•Y + X•Z 15. X+(Y•Z) = (X+Y) • (X+Z) (dual of14) 16. (X + Y)’ = X’ • Y’ 17. (X • Y)’ = X’ + Y’ (dual of16) Digital Techniques Fall 2007 André Deutz, Leiden University
Absorption Property (Covering) • X + X•Y = X -- (absorption property) • X•(X+Y) = X -- (dual absorption property) • Proof:X + X•Y = X•1 + X•Y = X • (1 + Y) = X • 1 = X • Can you prove the dual absorption property? Digital Techniques Fall 2007 André Deutz, Leiden University
Principle of duality:The dual of a Boolean function is gotten by replacing AND with OR and OR with AND, constant 1s by 0s,and 0s by 1s Occam’s Razor for Boolean Algebras A(A’+B) = AB A+A’B=A+B elimination of complement Digital Techniques Fall 2007 André Deutz, Leiden University
A more formal definition Boolean Algebras • A Boolean algebra is a set B on which two binary operations + and • and one unary operation ′ are defined and in which there are two distinct elements 0 and 1 such that the following properties hold for all x, y, z ∈ B: Digital Techniques Fall 2007 André Deutz, Leiden University
A more formal definition of Boolean Algebras (continued) 1a. x + y = y + x 1b. x • y = y • x (commutative properties) 2a. (x + y) + z = x + (y + z) 2b. (x • y) •z = x • (y • z) (associative properties) 3a. x + (y • z) = (x + y ) • (x + z) 3b. x • (y + z) = (x • y) + (x • z) (distributive properties) 4a. x + 0 = x 4b. x • 1 = x (identity properties) 5a. x +x’ = 1 5b. x • x’ = 0 (complement properties) Digital Techniques Fall 2007 André Deutz, Leiden University
The specific Boolean Algebra we use Example Let B = {0,1} ( the set of integers 0 and 1) define binary operations + and • on B by x + y = max(x,y ), x • y = min(x,y ) Then we can illustrate the operations of + and • by the tables • 0 1 + 0 1 0 0 0 0 0 1 1 0 1 1 1 1 A unary operation ′ can be defined as follows ′ 0 1 1 0 Thus 0′ = 1 and 1′ = 0. [B, +, •, ′, 0, 1] is a Boolean algebra We can verify the 10 properties by checking all possible cases Digital Techniques Fall 2007 André Deutz, Leiden University
Remark on Boolean Algebras • idempotent property: x + x = x • This holds in any Boolean algebra since x + x = (x + x) • 1 (4b) = (x + x) • (x + x′ ) (5a) = x + (x • x′) (3a) = x + 0 (5b) = x (4a) Digital Techniques Fall 2007 André Deutz, Leiden University
Non-Example on Boolean Algebra • The operations on integers share many of the properties of the operations for boolean algebras. • Idempotency is a property which is not shared. • Thus the set of integers is not a boolean algebra (aside from needing a complementation operation) Digital Techniques Fall 2007 André Deutz, Leiden University