Boolean Laws and Logic Design
Simplify expressions, reason with truth tables, draw circuits, and describe them in HDL.
Boolean Laws
| Law | OR | AND |
|---|---|---|
| Commutative | x + y = y + x | x · y = y · x |
| Associative | x + (y + z) = (x + y) + z | x · (y · z) = (x · y) · z |
| Distributive | x + y · z = (x + y)(x + z) | x(y + z) = x · y + x · z |
| Identity | x + 0 = x | x · 1 = x |
| Annihilator | x + 1 = 1 | x · 0 = 0 |
| Idempotence | x + x = x | x · x = x |
| Absorption | x + x · y = x | x(x + y) = x |
x · x = 0
x + x = 1
x = x
Take-home exercise: Verify all the laws using truth tables.
De Morgan's Laws Move Negation Across an Operation
x + y = x · y
NOT OR becomes AND of the negated inputs.x · y = x + y
NOT AND becomes OR of the negated inputs.De Morgan's laws are consequences of the Boolean laws on the previous page.
Check the Laws Using Truth Tables
Verify x + x · y = x.
Verify x + y = x · y.
Verify x + y · z = (x+y)(x+z).
Next: Use these laws to make expressions simpler.
Replace Part of an Expression with an Equivalent Form
a subexpression that matches a Boolean law
only that subexpression with its equivalent
until no further useful simplification is visible
Every step must preserve the function for every possible input.
Simplify: y + x · x
y + x · x
y + 0
because x · x = 0y
because y + 0 = yNow simplify and name each law used
x + x · y
= x by absorption.
x + x · y
=(x+x)(x+y)=1(x+y)=x+y.
(x+y)(x+z)
= x + y · z by distributivity.
Simplify These Without Revealed Answers
x · y + x · y
x · y + x(y+z)
x + xy + x · y
(x+y)(x+y)
xy + x(y+z) + y(y+c)
(xy(z+ya) + x · y)z
(x+y+z)(x+y+z)
x(y+yz) + xz
Do not expand everything automatically. Look first for complement, absorption, or a common factor.
Write the Boolean Expression
A logic circuit is the same as a gate diagram: it shows how gates are connected to implement a Boolean function.
Write w1, w2, and out.
Then write HDL for a chip named CircuitB.
w1 = a+b
w2 = c
out = (a+b) · c
Draw and Describe DMux
sel=0, then a=in and b=0; else a=0 and b=in.- Write Boolean expressions for
aandb. - Draw the gate diagram using AND and NOT.
- Write
DMux.hdl.
a = in · sel
b = in · sel
Build DMux4Way from DMux Gates
| sel | a | b | c | d |
|---|---|---|---|---|
| 00 | in | 0 | 0 | 0 |
| 01 | 0 | in | 0 | 0 |
| 10 | 0 | 0 | in | 0 |
| 11 | 0 | 0 | 0 | in |
- Use one DMux controlled by
sel[1]to choose the upper or lower pair. - Use two more DMux gates controlled by
sel[0]. - Draw the full diagram and label intermediate wires.
- Write
DMux4Way.hdl.
Stage 1: split in into two intermediate wires.
Stage 2: split each intermediate wire into two outputs.
Specify and Design Each Chip
Output 1 when at least two of a,b,c are 1.
Output 1 when inputs a and b are equal.
Use only AND, OR, and NOT gates.
Output 1 when at least one bit in in[4] is 1.
Output 1 when exactly one of a,b,c is 1.
Output 1 when exactly two of a,b,c,d are 1.
Select one of four 16-bit inputs using sel[2].
Route in to one of eight outputs using sel[3].
Equivalent Forms Let Us Choose a Better Design
justify algebraic transformations
verify that two forms agree on every input
show the structure of a circuit
records the same structure precisely
Next lecture: Begin Boolean Arithmetic with binary representation, addition, and two's complement.