slide 1-1 digital techniques fall 2007 andré deutz, leiden university a prelude practice yourself,...
TRANSCRIPT
Slide 1-1
Digital Techniques Fall 2007 André Deutz, Leiden University
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
Slide 1-2
Digital Techniques Fall 2007 André Deutz, Leiden University
Slide 1-3
Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic Units / Prelude
• 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).
In1 In1 Out
No No No
No Yes No
Yes No No
Yes Yes Yes
Input/output Spec Table:
Slide 1-4
Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic Units/Prelude
• Discussion of some answers In1 In1 Out
No No No
No Yes No
Yes No No
Yes Yes Yes
Input/output Spec Table:
Slide 1-5
Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic Units / Prelude
• 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).
In1 In1 Out
No No No
No Yes Yes
Yes No Yes
Yes Yes Yes
Input/output Spec Table:
Slide 1-6
Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic Units / Prelude
• Disscussion of some answers In1 In1 Out
No No No
No Yes Yes
Yes No Yes
Yes Yes Yes
Input/output Spec Table:
Slide 1-7
Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic Units /Prelude
• 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).
Input/output Spec Table:
In Out
No Yes
Yes No
Slide 1-8
Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic Units /Prelude
• Discussion of some answers
Input/output Spec Table:
In Out
No Yes
Yes No
Slide 1-9
Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic Units / Prelude
How do implement the following Input/output Spec Table:
In1 In2 In3 Out
No No No No
No No Yes No
No Yes No No
No Yes Yes No
Yes No No No
Yes No Yes No
Yes Yes No No
Yes Yes Yes Yes
Slide 1-10
Digital Techniques Fall 2007 André Deutz, Leiden University
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
Combinational Logic Units
Slide 1-11
Digital Techniques Fall 2007 André Deutz, Leiden University
• 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.
Combinational Logic UnitsSome Definitions
Slide 1-12
Digital Techniques Fall 2007 André Deutz, Leiden University
• Combinational logic: a digital logic circuit in which logical decisions are made based only on combinations of the inputs. e.g. an adder.
Combinational Logic Units
Slide 1-13
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
Slide 1-14
Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic Unit
Slide 1-15
Digital Techniques Fall 2007 André Deutz, Leiden University
Specifying Combinational Logic Unit
Enough if you know how to handle the case of ONE output and arbitrary number of inputs:
f(i0,...in)
i0
i1
in
.
.
.
CombinationalLogic Unit
Slide 1-16
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
Slide 1-17
Digital Techniques Fall 2007 André Deutz, Leiden University
A B Out
0 0 0
0 1 0
1 0 0
1 1 1
A B Out
F F F
0 T F
T F F
T T T
A B Out
No No No
No Yes No
Yes No No
Yes Yes Yes
SpecifyingCombinational Logic Unit
0-1 Table/Truth Table Truth Table
Slide 1-18
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
Slide 1-19
Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic Unit
• We have constructed an implementation of an AND, OR and NOT gate (“waterworks “)
A B OR
0 0 0
0 1 1
1 0 1
1 1 1
Slide 1-20
Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic Unit
• We have constructed an implementation of an AND, OR and NOT gate (“waterworks “)
A B AND
0 0 0
0 1 1
1 0 1
1 1 1
Slide 1-21
Digital Techniques Fall 2007 André Deutz, Leiden University
Combinational Logic Unit
• We have constructed an implementation of an AND, OR and NOT gate (“waterworks “)
A NOT
0 1
1 0
Slide 1-22
Digital Techniques Fall 2007 André Deutz, Leiden University
SpecifyingCombinational Logic Unit; Example One Bit Full Adder
1 1+ 1----- 11
Slide 1-23
Digital Techniques Fall 2007 André Deutz, Leiden University
from spec table to Logic Diagram (LD) for a CLU
A B Cin
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
S
0
1
1
0
1
0
0
1
Cout
0
0
0
1
0
1
1
1
inputs Output 1 Output 2
Slide 1-24
Digital Techniques Fall 2007 André Deutz, Leiden University
from spec table to (LD) for a CLU
A B Cin
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
S
0
1
1
0
1
0
0
1
inputs Output 1
Let us concentrate on the First output: the sum of the two input bits and the the carry_in.
Slide 1-25
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.
Slide 1-26
Digital Techniques Fall 2007 André Deutz, Leiden UniversityDigital Techniques Fall 2007 André Deutz, Leiden University
from spec table to LD Step 1
A B Cin
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
S
0
1
1
0
1
0
0
1
inputsOutput 1
For each input we introducea wire and a negated wire:
A B Cin
Slide 1-27
Digital Techniques Fall 2007 André Deutz, Leiden UniversityDigital Techniques Fall 2007 André Deutz, Leiden University
from spec table to LD Step 2
A B Cin
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
S
0
1
1
0
1
0
0
1
inputsOutput 1
For each 1 in the outputColumn introduce a multi-way AND gate:
A B Cin
Slide 1-28
Digital Techniques Fall 2007 André Deutz, Leiden UniversityDigital Techniques Fall 2007 André Deutz, Leiden University
From spec table to LD Step 3
A B Cin
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
S
0
1
1
0
1
0
0
1
inputsOutput 1
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 Cin
Slide 1-29
Digital Techniques Fall 2007 André Deutz, Leiden UniversityDigital Techniques Fall 2007 André Deutz, Leiden University
spec table to LD Step 3 (cont’d)
A B Cin
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
S
0
1
1
0
1
0
0
1
inputsOutput 1
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 Cin
Slide 1-30
Digital Techniques Fall 2007 André Deutz, Leiden UniversityDigital Techniques Fall 2007 André Deutz, Leiden University
spec table to LD Step 3 (cont’d)
A B Cin
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
S
0
1
1
0
1
0
0
1
inputsOutput 1
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 Cin
Slide 1-31
Digital Techniques Fall 2007 André Deutz, Leiden UniversityDigital Techniques Fall 2007 André Deutz, Leiden University
spec table to LD Step 3 (cont’d)
A B Cin
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
S
0
1
1
0
1
0
0
1
inputsOutput 1
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 Cin
Slide 1-32
Digital Techniques Fall 2007 André Deutz, Leiden UniversityDigital Techniques Fall 2007 André Deutz, Leiden University
spec table to LD Step 4
A B Cin
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
S
0
1
1
0
1
0
0
1
inputsOutput 1
Wire the AND gates to a multi OR gate (for this example a 4-OR gate):
A B Cin
S
Slide 1-33
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
Slide 1-34
Two more examples: a 4x1 Multiplexer and 1x4
Demultiplexer and the Music the pair can make
Digital Techniques Fall 2007 André Deutz, Leiden University
Slide 1-35
Boolean Algebra
Digital Techniques Fall 2007 André Deutz, Leiden University
Slide 1-36
Boolean Algebra
• Actually a special kind of Boolean Algebra namely, Switching Algebra
Digital Techniques Fall 2007 André Deutz, Leiden University
Slide 1-37Intro 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
Slide 1-38
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).
Slide 1-39
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.
Slide 1-40
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
Slide 1-41
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’
Slide 1-42
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.
Slide 1-43
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)
Slide 1-44
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?
Slide 1-45
Digital Techniques Fall 2007 André Deutz, Leiden University
Occam’s Razor for Boolean Algebras
A(A’+B) = AB A+A’B=A+B elimination of complement
Slide 1-46
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
Slide 1-47A 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
Slide 1-48
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
The specific Boolean Algebra we use
Slide 1-49
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
Slide 1-50Non-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
Slide 1-51Transition from 1/0 table to LD to Boolean expression
• Combinational Logic Units with one output can be specified by – A Boolean equation– A Logical Diagram– 1/0 table– We already saw how to get a Logic Diagram (LD) from
a 1/0 table; it is clear that from the Logic Diagram you can read off a 1/0 table
– It is also clear how you get a Boolean expression from a 1/0 table:
Digital Techniques Fall 2007 André Deutz, Leiden University
Slide 1-52
Digital Techniques Fall 2007 André Deutz, Leiden University
A B Cin
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
S
0
1
1
0
1
0
0
1
From 1/0 table to Boolean expression
S = A ′ B ′ C + A ′ B C ′ + AB ′ C ′ +ABC
Slide 1-53
Digital Techniques Fall 2007 André Deutz, Leiden University
A B C
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
F
0
1
1
1
0
0
1
1
From Boolean expression to 1/0 table?
F= A ′ B ′ C + B
Slide 1-54
To remember:
With Boolean expressions (BE), or Logic Diagrams(LD) or Truth tables(TT) you can specify CLU with one output.
The transition between any of the two of ( BEs, TTs or LDs) can be readily done