510 likes | 828 Views
EEL 3705 / 3705L Digital Logic Design. Fall 2006 Instructor: Dr. Michael Frank Module #4: Boolean Algebra. Topics for Today (Fri. 9/22). Administrivia: HW#1 has been graded. HW#2 is due Wed. next week Midterm exam #1 (lecs.1-7, CIOs 1-3): will be on Mon., Oct. 2 nd
E N D
EEL 3705 / 3705LDigital Logic Design Fall 2006Instructor: Dr. Michael FrankModule #4: Boolean Algebra M. Frank, EEL3705 Digital Logic, Fall 2006
Topics for Today (Fri. 9/22) • Administrivia: • HW#1 has been graded. • HW#2 is due Wed. next week • Midterm exam #1 (lecs.1-7, CIOs 1-3): • will be on Mon., Oct. 2nd • Design Project #1 will be posted soon. • planned to be due Fri., Oct. 13th • design document examples are already posted • Demonstrate & explain latest example circuit: • Color ASCII table display on VGA monitor • Topic #3: Basics of Boolean Algebra M. Frank, EEL3705 Digital Logic, Fall 2006
Topics for Today (Mon. 9/25) • Administrivia: • HW#1 has been graded. • HW#2 is due Wed. • Midterm exam #1 (lecs.1-7, CIOs 1-3): • will be on Mon., Oct. 2nd • Design Project #1 will be posted soon. • planned to be due Fri., Oct. 13th • design document examples are already posted • Topic 3.4: Basic Combinational Logic M. Frank, EEL3705 Digital Logic, Fall 2006
Design Projects:Preview M. Frank, EEL3705 Digital Logic, Fall 2006
Structured Engineering Design Process SystemRequirementsSpecification(SRS) InformalStatementof Needs System-LevelDesignSpecification(SLDS) CG&SReport System-LevelDesign RequirementsAnalysis Concept Generation & Selection Detailed Design(to component level) TestingReport TestingPlan DesignFiles DetailedDesignSpecification SimulationTesting ProductManufacture PrototypeSystem PrototypeTesting PrototypeManufacture M. Frank, EEL3705 Digital Logic, Fall 2006
Design Projects in This Course • During the semester, we will have 1 or 2 small design projects, • and one larger term project at semester end. • In each project, you will go through a simplified version of the structured engineering design process… • Turing in deliverables for the different reports • with the later projects being more complex. M. Frank, EEL3705 Digital Logic, Fall 2006
Basic Boolean Logic:Review M. Frank, EEL3705 Digital Logic, Fall 2006
Boolean Logic: Review • For reasoning about whether propositions (statements) are true (T) or false (F). • The truth value of the proposition. • The important functional operators of Boolean logic include: • NOT(x) = {T iff x=F (otherwise F)} • AND(x,y) = {T iff both x=T and y=T} • OR(x,y) = {T iff either x=T or y=T, or both} • XOR(x,y) = {T iff either x=T or y=T, but not both} George Boole1815-1864 iff = “ifand only if” “exclusive OR” M. Frank, EEL3705 Digital Logic, Fall 2006
Boolean Logic Notations • You should be aware that any given expression of Boolean logic could be written in several styles: • Writing operators as functions: • XOR(OR(AND(a,b),NOT(c)),d) • Using operator names “infix” (between their operands): • ((a AND b) OR (NOT c)) XOR d • Using mathematical logic operator symbols: • [(a b) ¬c] d • Using C programming language operators: • ((a & b) | ~c) ^ d • Using Boolean algebra notation: These are applied to all of the bits of a word in parallel We’ll use this notation M. Frank, EEL3705 Digital Logic, Fall 2006
Topic Area #3:Boolean Algebra Algebraic Methods for the Analysis and Synthesis of Digital Logic Circuits M. Frank, EEL3705 Digital Logic, Fall 2006
What is Boolean Algebra? • A minor generalization of propositional logic. • In general, an algebra is any mathematical structure satisfying certain standard algebraic axioms. • Such as associative/commutative/transitive laws, etc. • General theorems that are proved about an algebra then apply to any structure satisfying these axioms. • Boolean algebra just generalizes the rules of propositional logic to sets other than {T,F}. • E.g., to the set {0,1} of base-2 digits, or the set {VL, VH} of low and high voltage levels in a circuit. • We will see that this algebraic perspective is useful for the analysis and synthesis of digital logic circuits. Claude Shannon’sMaster’s thesis! M. Frank, EEL3705 Digital Logic, Fall 2006
Boolean Algebra Subtopics • 3.1. Basics of Boolean Algebraic Functions • 3.2. Representing Boolean Functions • 3.3. Logic Gates • Covered earlier, but we go into a bit more depth • 3.4. Combinational Logic Circuits • 3.5. Minimization of Circuits M. Frank, EEL3705 Digital Logic, Fall 2006
3.1. Boolean Functions: Subtopics • 3.1.1. Boolean complement, sum, product. • 3.1.2. Boolean expressions and functions. • 3.1.3. Boolean algebra identities. • 3.1.4. Duality. • 3.1.5. Abstract definition of a Boolean algebra. M. Frank, EEL3705 Digital Logic, Fall 2006
Complement, Sum, Product • Correspond to logical NOT, OR, and AND. • We will denote the two logic values as0:≡F and 1:≡T, instead of False and True. • Using numbers encourages algebraic thinking. • New, more algebraic-looking notation for the most common Boolean operators: Decreasing precedence order→ M. Frank, EEL3705 Digital Logic, Fall 2006
Boolean Functions • Let B = {0, 1}, the set of Boolean values. • For all nZ+, any function f:Bn→B is called a Boolean function of degree n. • There are 22ⁿ (wow!) distinct Boolean functions of degree n. • Because 2n rows in truth table; 0 or 1 in each. DegreeHow manyDegreeHow many 0 2 4 65,536 1 4 5 4,294,967,296 2 16 6 18,446,744,073,709,551,616. 3 256 M. Frank, EEL3705 Digital Logic, Fall 2006
Boolean Expressions • Let x1, …, xn be n different Boolean variables. • n may be as large as desired. • A Boolean expression (recursive definition) is a string of one of the following forms: • Base cases: 0, 1, x1, …, or xn. • Recursive cases: E1, (E1E2), or (E1+E2), where E1 and E2 are Boolean expressions. • A Boolean expression represents a Boolean function. • Furthermore, every Boolean function (of a given degree) can be represented by a Boolean expression. M. Frank, EEL3705 Digital Logic, Fall 2006
Hypercube Representation • A Boolean function of degree n can be represented by an n-cube (hypercube) with the corresponding function value at each vertex. (a, b, c) (1,1,0) (1,1,1) 1 0 1 (0,1,0) 1 (0,1,1) (1,0,0) (1,0,1) 0 0 1 0 (0,0,0) (0,0,1) M. Frank, EEL3705 Digital Logic, Fall 2006
Boolean equivalents, operations on Boolean expressions • Two Boolean expressions e1 and e2 that represent the exact same function f are called equivalent. • We write e1e2, or just e1=e2. • This means that the two expressions have the same value for all values of the free variables appearing in e1 and e2. • The operators ¯, +, and · can be extended from just operating on expressions to operating on the functions that they represent, in the obvious way. M. Frank, EEL3705 Digital Logic, Fall 2006
Double complement: x = x Idempotent laws: x + x = x, x · x = x Identity laws: x + 0 = x, x · 1 = x Domination laws: x + 1 = 1, x · 0 = 0 Commutative laws: x + y = y + x, x · y = y · x Associative laws: x + (y + z) = (x + y) + z x· (y · z) = (x· y) · z Distributive laws: x + y·z = (x + y)·(x + z) x · (y + z) = x·y + x·z De Morgan’s laws: (x · y) = x + y, (x + y) = x · y Absorption laws: x + x·y = x, x · (x + y) = x Some popular Boolean identities Note: The laws circled in red depart from ordinary numerical algebras! also, the Unit Property: x + x = 1 and Zero Property: x· x = 0 M. Frank, EEL3705 Digital Logic, Fall 2006
Duality • The dualed of a Boolean expression e representing function f is obtained by exchanging + with ·, and 0 with 1 in e. • The function represented by ed is denoted fd. • Duality principle: If e1e2 then e1de2d. • Example: The equivalence x(x+y) = ximplies (and is implied by) x + xy = x. M. Frank, EEL3705 Digital Logic, Fall 2006
Boolean Algebra, in the abstract • A general Boolean algebra is any set B having elements 0, 1, two binary operators ,, and a unary operator that satisfies the following laws: • Identity laws: x0 = x, x1 = x • Complement laws: x x = 1, x x = 0 • Associative laws:(xy)z = x(yz), (xy)z = x(yz) • Commutative laws: x y = y x, x y = y x • Distributive laws: x(yz) = (xy)(xz), x(yz)=(xy)(xz). Note that B may generally have other elements besides 0, 1, and we have not fully defined any of the operators! M. Frank, EEL3705 Digital Logic, Fall 2006
More about Boolean algebras • Any Boolean algebra (in the general sense) can be proven to satisfy all the theorems of “ordinary” Boolean algebra! • An example of another Boolean algebra: • For any set U, let B = 2U, 0=, 1=U, =, =, and =¯ (set complement). • Then, (B,0,1,,,) is a Boolean algebra! • Boolean algebras can also be defined in terms of lattices (in chapter 7, though we skipped it). • A poset where every pair x,y has a lub and a glb. • A complemented, distributed lattice is a Boolean alg. M. Frank, EEL3705 Digital Logic, Fall 2006
Topic 3.2: Representing Boolean Functions M. Frank, EEL3705 Digital Logic, Fall 2006
3.2 – Representing Boolean Functions • 3.2.1. Sum-of-products Expansions • A.k.a. Disjunctive Normal Form (DNF) • 3.2.2. Product-of-sums Expansions • A.k.a. Conjunctive Normal Form (CNF) • 3.2.3. Functional Completeness • Minimal functionally complete sets of operators. M. Frank, EEL3705 Digital Logic, Fall 2006
3.2.1. Sum-of-Products Expansions • Theorem: Any Boolean function can be represented as a sum of products of variables and their complements. • Proof: By construction from the function’s truth table. For each row that is 1, include a term in the sum that is a product representing the condition that the variables have the values given for that row. Show an example on the board. M. Frank, EEL3705 Digital Logic, Fall 2006
Literals, Minterms, DNF • A literal is a Boolean variable or its complement. • A minterm of Boolean variables x1,…,xn is a Boolean product of n literals y1…yn, where yi is either the literal xi or its complement xi. • Note that at most one minterm can have the value 1. • The disjunctive normal form (DNF) of a degree-n Boolean function f is the unique sum of minterms of the variables x1,…,xn that represents f. • A.k.a. the sum-of-products expansion of f. M. Frank, EEL3705 Digital Logic, Fall 2006
3.2.2. Conjunctive Normal Form • A maxterm is a sum of literals. • CNF is a product-of-maxterms representation. • Or, product-of-sums. • To find the CNF representation for f, • take the DNF representation for complement f, f = ∑i∏j yi,j • and then complement both sides & apply DeMorgan’s laws to get: f = ∏i∑jyi,j Can also get CNF moredirectly, using the 0rows of the truth table. M. Frank, EEL3705 Digital Logic, Fall 2006
3.2.3. Functional Completeness • Since every Boolean function can be expressed in terms of ·,+,¯, we say that the set of operators {·,+,¯} is functionally complete. • There are smaller sets of operators that are also functionally complete. • We can eliminate either · or + using DeMorgan’s law. • NAND | and NOR ↓ are also functionally complete, each by itself (as a singleton set). • E.g., x = x|x, and xy = (x|y)|(x|y). M. Frank, EEL3705 Digital Logic, Fall 2006
Reversible Boolean Logic • A reversible Boolean function of degree n is a bijective function f:Bn↔Bn. • Also corresponds to a permutation of Bn. • Reversible unary and binary Boolean operators are bijective operators on B and B2, respectively. • Unary f:B↔B, binary f:B2↔B2. • It turns out that no set of reversible unary and binary Boolean operators is functionally complete! • However, there are many ternary reversible operators that are functionally complete, even as singletons. M. Frank, EEL3705 Digital Logic, Fall 2006
A little Quantum Logic • A quantum Boolean function is a bijective and linear function f:C2ⁿ↔C2ⁿ. • That is, it maps vectors of 2n complex numbers (one for each n-bit string of Boolean values) reversibly and linearly. • Any reversible Boolean function corresponds to a quantum Boolean function where a string in Bn is represented by c=1 for that string, c=0 for all others. • Any quantum Boolean function can be built out of quantum operators operating on just C and C2. • Quantization removes the need for ternary gates! M. Frank, EEL3705 Digital Logic, Fall 2006
Topic 3.3: Basic Logic Gates M. Frank, EEL3705 Digital Logic, Fall 2006
3.3 – Logic Gates • 3.3.1. Inverter, Or, And gate symbols. • You’ve already seen these; this is just review • 3.3.2. Multi-input gates. • 3.3.3. Inverting gates (NAND, etc.) • 3.3.4. Alternative gate symbols • Bubbled representations for active-low functions • 3.3.4. Buffers M. Frank, EEL3705 Digital Logic, Fall 2006
Logic Gate Icons • Inverter • Logical NOT,Boolean complement • AND gate • Boolean product • OR gate • Boolean sum • XOR gate • exclusive-OR, sum mod 2 x x x·y y x+y x y x xy y M. Frank, EEL3705 Digital Logic, Fall 2006
Multi-input AND, OR • Can extend these gates to arbitrarilymany inputs. • Two commonlyseen drawing styles: • Note that the second style keeps the gate icon relatively small. x1 x1x2x3 x2 x3 x1⋮ x5 x1…x5 M. Frank, EEL3705 Digital Logic, Fall 2006
Multi-input XOR • There is a small subtlety here… • You might expect that XOR(a,b,c) should mean, “a or b or c, but not all three.” • But actually, that’s not how it’s usually defined. • Or, how about, “a or b or c, but not more than one?” • No, it’s not that either! a • XOR(a,b,c) is defined as • (a⊕b)⊕c= (a+b+c) mod 2. • “An odd number of a, b,and c are true.” b a⊕b⊕c c M. Frank, EEL3705 Digital Logic, Fall 2006
NAND, NOR, XNOR • Just like the earlier icons,but with a small circle onthe gate’s output. • Denotes that the output is complemented. • Circles could also be placed on inputs. • Means, input is complementedbefore being used. x y x y x y M. Frank, EEL3705 Digital Logic, Fall 2006
CMOS NAND gate implementation • A NAND gate is particularly easyto implement in CMOS: • Simple 4-transistor circuit • A NOR gate is equally simple, • but slower, • due to series pFETs • If we wanted to, we could buildany computer using nothingbut NAND gates and wires! Vdd x y xy Vss = GND M. Frank, EEL3705 Digital Logic, Fall 2006
Bubbled Inputs and DeMorgan Substitutions • We’re also allowed to draw inversion bubbles on the inputs to a gate. • Example: The below gate computes : • Note that DeMorgan’s Law allows us to swap AND↔OR by toggling bubbles on inputs & outputs • E.g., the above gate equals • I.e., an AND of active-low signals implements OR. x y x+y x y M. Frank, EEL3705 Digital Logic, Fall 2006
Buffer x x • What about an invertersymbol without a circle? • This is called a buffer. It is the identity function. • It serves no logical purpose, but… • It represents an explicit delay in the circuit. • This is sometimes useful for timing purposes. • All gates, when physically implemented, incur a non-zero delay between when their inputs are seen and when their outputs are ready. • Often called the propagation delay. M. Frank, EEL3705 Digital Logic, Fall 2006
Topic 3.4: Basic Combinational Logic Examples of Some Basic Circuits M. Frank, EEL3705 Digital Logic, Fall 2006
3.4. Combinational Logic Circuits • 3.4.1. Basic Combinational Logic Concepts • 3.4.2. Examples of Some Simple Combinational Circuits • 3-input majority function • XOR constructions • half adder • full adder • n-bit ripple-carry adder M. Frank, EEL3705 Digital Logic, Fall 2006
Combinational Logic Circuits • Note: The correct word to use here is “combinational,” NOT “combinatorial!” • Many sloppy authors get this wrong. • These are circuits composed of Boolean gates whose outputs depend only on their most recent inputs, not on earlier inputs. • Thus these circuits have no useful memory. • Their state persists while the inputs are constant, but is irreversibly lost when the input signals change. • Later we’ll discuss sequential circuits that have memory. M. Frank, EEL3705 Digital Logic, Fall 2006
Majority Voting Circuit • 3-input majority voter: • Output is true if 2 or more inputs are. • Truth table shown at right. • Boolean expression: m = ab + ac + bc • Logic circuit: M. Frank, EEL3705 Digital Logic, Fall 2006
XOR from AND/OR/NOT • Boolean algebra expression: • XOR can be implemented combinationally using more basic gates, as shown below. M. Frank, EEL3705 Digital Logic, Fall 2006
3-input XOR from MAJ, NAND, etc. • We can express XOR(a,b,c) as M. Frank, EEL3705 Digital Logic, Fall 2006
Half Adder • Circuit to add any 2 given bits a,b to produce their 2-bit sum (002, 012, or 102) • Two bits of output: s1s0, given by s1 = ab, s0 = a⊕b • Called a “half adder” because two of them can be used to make a “full adder” (next slide) a (s1) (s0) b M. Frank, EEL3705 Digital Logic, Fall 2006
Full Adder • Given bits a,b,c, computes (s1s0)2 = a + b + c. • Can build it using two half adders to compute the low-order bit of the sum as s0 = (a⊕b)⊕c. • Plus an extra OR gate needed to combine the carries. M. Frank, EEL3705 Digital Logic, Fall 2006
Another Full Adder Implementation • This one uses 3-input XOR and MAJ subcircuits. M. Frank, EEL3705 Digital Logic, Fall 2006
Ripple-Carry Adder • Uses a “carry chain” of 1-bit full adders to add two n-bit numbers carry bits a3a2a1a0+ b3b2b1b0cs3 s2 s1 s0 • The structure of the hardware reflects the flow of information in the ordinary hand-algorithm for binary addition M. Frank, EEL3705 Digital Logic, Fall 2006
Closeup of One Stage of the Ripple-Carry Adder Structure • Each stage has: • input c used for “carry in” from previous stage • output s1 used for “carry out” to next stage • output s0 is one bit of the sum carry out carry in M. Frank, EEL3705 Digital Logic, Fall 2006