Download Fast Boolean Algebra - Department of Electronics

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Electronics technician (United States Navy) wikipedia , lookup

Opto-isolator wikipedia , lookup

Oscilloscope history wikipedia , lookup

Molecular scale electronics wikipedia , lookup

Mathematics of radio engineering wikipedia , lookup

Radio transmitter design wikipedia , lookup

Transistor–transistor logic wikipedia , lookup

CMOS wikipedia , lookup

Electronic engineering wikipedia , lookup

Digital electronics wikipedia , lookup

Integrated circuit wikipedia , lookup

Printed electronics wikipedia , lookup

Flexible electronics wikipedia , lookup

Transcript
Fast Boolean Algebra
ELEC 2607 notes with the overburden removed
A fast way to learn enough to get the prelab done honorably
Printed; 03/01/05
Modified; January 3, 2005
Slide 1
Department of Electronics, Carleton University
© John Knight
Digital Circuits p. 1
Fast Boolean Algebra
Fast Boolean Algebra
These are the lecture notes, with details left out that are not needed to prepare for the lab.
The example design of a 2-bit comparator, is not in the lecture notes.
The design of a full-adder is used in the second lab.
Printed; 03/01/05
Modified; January 3, 2005
Department of Electronics, Carleton University
© John Knight
Comment on Slide 1
Digital Circuits p. 2
Two Valued Algebra
Boolean Algebra
The algebra of
1 and 0
Two Valued Algebra
Values are called “1” and “0”
or True and False
or High and Low.
Variables
X=2
X = -1
X = 3+j6
X=1
X=0
A variable X can have only two values, 0 or 1.
Symbol
Operations
Complement, Not, or Inverse
X
Schematic
Truth Table
X
X
X is the opposite of X
AND
a•b
ab
X is 1 if a AND b are both 1.
OR
X-OR, XOR, Exclusive OR
X is 1 if exactly one of a or b is 1.
a⊕b
X
a
b
a+b
X is 1 if a OR b or both are 1.
Printed; 03/01/05
Modified; January 3, 2005
a
b
a
b
Department of Electronics, Carleton University
© John Knight
a
0
0
1
1
b
0
1
0
1
a
0
0
1
1
b
0
1
0
1
X
X
X
0
0
0
1 a
0
0
1
1
X
0
1
1
0
X X
0 1
1 0
b
0
1
0
1
X
0
1
1
1
Slide 2 onSlide63
Comment
Digital Circuits p. 3
Basic Boolean Algebra Operations
Basic Boolean Algebra Operations
Printed; 03/01/05
Modified; January 3, 2005
Department of Electronics, Carleton University
© John Knight
Comment on Slide 2
Digital Circuits p. 4
Operations (continued)
Symbol
Schematic
Truth Table
Operations (continued)
NAND
a
b
a•b
ab
NOT-AND
X
a
0
0
1
1
NOR
NOT-OR
a+b
a
b
X
X-NOR
Exclusive-NOR, NOT-XOR.
(Equivalence)
a⊕b
Multiple Input Operations
AND
“-” means either 1 or 0, (don’t care)
OR
a
b
a•b•c
abc
a + b+ c
a
bc
a
bc
b
0
1
0
1
X
a
0
1
X
b c
- 0- 0
11
a
0
0
1
X 1
1
0
0
0 a
0
0
1
1
X
0
0
0
1
X
Number
of “1”
X-OR
inputs
Exclusive-OR, XOR.
Printed; 03/01/05
Modified; January 3, 2005
a⊕b⊕c
a
bc
X
0
1
2
3
a
0
1
-
b
0
1
0
1
X
1
1
1
0
b
0
1
0
1
X
1
0
0
1
b
0
1
-
c
0
1
X
0
1
1
1
X
0
1
0
1
Slide 3
Department of Electronics, Carleton University
© John Knight
Digital Circuits p. 5
Boolean Operations
Boolean Operations
Common Mistake
a• b
is not the same as a •b
1.• PROBLEM
Prove the above statement by evaluating both expressions for a=1, b=0.
Multiple Input Operations
N-input Gates
In theory a gate can have any number of inputs. For transistor circuits, the gates become very
slow with more than four inputs. However theoretical circuits will often have more than four
inputs.
With transistors it is easier to build NAND and NOR than AND and OR. However people make
fewer mistakes if the design is done with AND and OR.
2.• PROBLEM
Is a+b is the same as a + b. If not, give a counter example.
Printed; 03/01/05
Modified; January 3, 2005
Department of Electronics, Carleton University
© John Knight
Comment on Slide 3
Digital Circuits p. 6
Multiple Input Operations
Basic Laws
Laws with Zeros and Ones
X+0=X
(Z1)
X+1=1
( O 1)
or just (Z)
or just (Z)
X•0 = 0
(Z2)
X•1 = X
(O 2)
(I1)
X•X = X
(I2)
or (I) for
(N2)
No 2nd form
(N1)
X•X = 0
(N2)
or (N)
(C1)
X•Y = Y•X
(C2)
or (C)
(A2)
or (A)
Indempotent
or just Z
for any of
these four
A variable is unchanged by operating with itself.
X+X=X
Double Negative
(X) =X
Negation Laws
X+X=1
Commutative Laws
X+Y=Y+X
Associative Laws
X + (Y + Z) = (X + Y) + Z
(A1)
X•(Y•Z) = (X•Y)•Z
Distributive Laws
(X + Y) Z = XZ + YZ
(D1)
(D2)
X Y + Z = (X + Z)(Y + Z)
Remember This
Printed; 03/01/05
Modified; January 3, 2005
Slide 4
Department of Electronics, Carleton University
© John Knight
Basic Laws
Digital Circuits p. 7
Multiple Input Operations
Basic Laws
Numbering System for the Laws
In this course one frequently needs to refer to these laws, hence they have been given numbers.
(Z1) stands for zero law number 1, (Z2) for zero law number 2.
(O 1) for one law number 1, etc., where O is a script letter “Oh”.
If you do not want to remember these numbers, most of the laws on these pages are simple enough to just write
a small example instead. On the next page both the number and an example are given.
The above laws will be taken as axioms
These laws are fairly obvious from the description of the gates (operators). The only strange on is the second
distributive law (D2). This one has to be memorized because it is very useful as well as strange.
We will treat all these laws as axioms except (D2). This will be proven very shortly.
Printed; 03/01/05
Modified; January 3, 2005
Department of Electronics, Carleton University
© John Knight
Comment on Slide 4
Digital Circuits p. 8
Basic Laws
Multiple Input Operations
Using Boolean Algebra
Prove:
AB + B = B
Simplification law (S)
Proof:
AB +B = AB + B·1
= ( A + 1)B
= (1)B
=B
Prove:
from (O 2)
from (D1)
from (O 1)
from (O 2)
AB + C = (A + C)(B + C)
X •1 = X
(X + Y)Z = XZ + YZ
X+1=1
X •1 = X
Second distributive law (D2)
Proof:
(A +C)(B + C) = Q(B + C)
= QB + QC
= (A + C)B + (A + C)C
= AB + CB + AC + CC
= AB + CB + AC + C
= AB + CB + C + AC + C
= AB + C
+C
= AB + C
Simplify:
let
Q = (A + C)
from (D1) (X + Y)Z = XZ + YZ
since
Q = (A + C)
from (D1)
from ( I )
XX=X
from ( I )
X+ X=X
use (S) twice XY + X = X
from ( I )
AB + AB + AB
AB +AB + AB = AB + AB + AB +AB
= A( B + B)+(A + A)B
= A(1) + (1)B
=A+B
Printed; 03/01/05
Modified; January 3, 2005
from ( I )
from (D1)
from (N1)
from (O 1)
X+ X=X
(X + Y)Z = XZ + YZ
X+X =1
X+1=1
Department of Electronics, Carleton University
© John Knight
Basic Laws
Slide 5
Digital Circuits p. 9
Useful Rule
Useful Rule
Simplification or Absorption Rule
x + xy = x is one of the most useful rules, and fairly easy to remember.
Printed; 03/01/05
Modified; January 3, 2005
Department of Electronics, Carleton University
© John Knight
Comment on Slide 5
Digital Circuits p. 10
Basic Laws
Boolean Algebra: Exhaustive Proofs
Boolean Algebra: Exhaustive Proofs
Good for a small number of inputs (up to about 4)
Make a table
a) List all possible inputs
b) Calculate all values of the left hand side
c) Calculate all values of the right hand side
d) See if they agree
Alternate Proof
Second distributive law:
(A + C)(B + C) = AB + C
Proof: Use a truth table and prove for all cases
LHS
RHS
ABC (A + C) (B + C)(A+C)(B+C) AB AB + C
000
001
011
010
100
101
111
110
0
1
1
0
1
1
1
1
0
1
1
1
0
1
1
1
0
1
1
0
0
1
1
1
Printed; 03/01/05
Modified; January 3, 2005
0
0
0
0
0
0
1
1
0
1
1
0
0
1
1
1
The two sides
are equal for
all combinations
of ABC.
Department of Electronics, Carleton University
© John Knight
Basic Laws
Slide 6
Digital Circuits p. 11
Useful Rule
Trying All Combinations
The method is good for proofs, with not very many variables.
It is not good for simplification.
Exhaustive Problems
3.• PROBLEM WITH XORS
Prove that A⊕B = A ⊕B = Α⊕Β
4.• PROBLEM
Prove that C + BC = C + B
Prove it (a) algebraically and (b) with a truth table.
5.• PROVE
Ab + bc + cA = Ab + cA
Consensus theorem
This is hard to prove algebraically.1
6.• PROVE
xA + xB = (x + A)(x +B) Swap rule
This is easy to prove algebraically after you have proven the consensus theorem.
7.• PROVE THAT: A ⊕B = A⊕B
1. Hint bc = bcA + bcA.
Printed; 03/01/05
Modified; January 3, 2005
Department of Electronics, Carleton University
© John Knight
Comment on Slide 6
Digital Circuits p. 12
Basic Laws
Boolean Algebra: Exhaustive Checking
Boolean Algebra: Exhaustive Checking
Checking An Answer
You think the following simplification is true:
(A + BC)(B + C)(B + C) = AB + C
Check it out.
ABC
000
001
011
010
100
101
111
110
(A + BC) (B + C) (B + C) (A+BC)(A+C)(B+C) AB AB + C
0
0
0
0
1
0
1
0
0
1
0
1
1
0
0
1
1
0
1
0
0
0
1
0
0
0
0
0
1
1
1
0
0
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
Not the same
With 3 inputs table has 8 entries
With 4 inputs table has 16 entries
With 5 inputs table has 32 entries
With 6 inputs table has 64 entries
With 7 inputs, algebra starts to look a lot easier.
Printed; 03/01/05
Modified; January 3, 2005
Slide 7
Department of Electronics, Carleton University
© John Knight
Digital Circuits p. 13
Basic Laws
Useful Rule
Circuit Problems
8.• PROBLEM: FOR CIRCUIT SHOWN
Simplify the circuit.
A
A
AA=A
F=
9.• PROBLEM
Simplify to 4 literals (letters)AD +AE + AF
B
10.• PROBLEM
Implement:ABCD + ABCE + ABCF
with one multi-input OR and one multi-input AND.
11.• PROBLEM
Simplify (A + B)(A + C)(A + D)
12.• PROBLEM
Implement:(A+B+C+D)(A+B+C+E)(A+B+C+F)
with one multi-input OR and one multi-input AND1
1. Hint; try Problem 11.• first.
Printed; 03/01/05
Modified; January 3, 2005
Department of Electronics, Carleton University
© John Knight
Comment on Slide 7
Digital Circuits p. 14
Basic Laws
Deriving Formulas From Truth Tables
Deriving Formulas From Truth Tables
A formulas for XOR using AND, OR and NOT
Truth Table
a
0
0
1
1
b
0
1
0
1
(a⊕b)
Equation for when (a⊕b) is “1”
0
1 a•b
1 a•b
0
(a⊕b) = a•b + a•b
(a⊕b) is “0” for all other combinations
XOR FORMULA
1. Write out the Truth Table
2. Look for where the result is “1”.
3. Write down the letters corresponding to the inputs
(a⊕b) = a•b + a•b
Thus a “0” in the “a” column is written as “a”.
a “1” in the “a” column is written as “a”.
4. AND the letters to make a term like a•b.
5. The equation is the OR of all the terms where the output is “1”.
Printed; 03/01/05
Modified; January 3, 2005
Department of Electronics, Carleton University
© John Knight
Basic Laws
Slide 8
Digital Circuits p. 15
Obtaining Formulas from Truth Tables
Obtaining Formulas from Truth Tables
This method will give formulas in what is called OR of ANDs or (SUM of PRODUCTs) form.
These formulas are letters or their inverses ANDed together and the resulting terms ORed together1, like
abc + acd + cf + ace + ....
We need only find all the terms that make the final answer “1”.
If no term make the formula “1”, then it defaults to “0”.
To Find the Formula
Go through the truth table and writes down each terms that make the result “1”.
Then OR all these terms together
That is the desired formula.
XOR and XNOR gates
These are more complex to implement than most other two-input gates. They are often implemented using
formula like the one derived above.
1. SUM of PRODUCTS form has no bracketed terms like ab(f + d) or the brackets implied by long inverting bars like ab = (ab)
Printed; 03/01/05
Modified; January 3, 2005
Department of Electronics, Carleton University
© John Knight
Comment on Slide 8
Digital Circuits p. 16
Basic Laws
Deriving Circuits From Truth Tables
Deriving Circuits From Truth Tables
Truth Table
The Comparator
A1A0 B1B0
This compares two, 2-bit numbers
A1
A0
z=1
B1
B0
z=1 If:
A1A0 >B1B0
z is “1” if any of the terms in the table are “1”.
z = A 1 •A 0 • B 1 •B 0 + A 1 •A 0 •B 1 •B 0 + A 1 •A 0 •B 1 •B 0 +
A 1 •A 0 •B 1 •B 0 + A 1 •A 0 •B 1 •B 0 + A 1 •A 0 •B 1 •B 0
(1)
To simplify z,
look for the terms with the most common factors
A 1 •A 0 •B 1 •B 0 + A 1 •A 0 •B 1 •B 0 + A 1 •A 0 •B 1 •B 0 + A 1 •A 0 •B 1 •B 0
0 0 0 0
0 1 0 1
0
1 0 1 0
0
1 1 1 1
0
0 1 0 0
1
A 1 •A 0 •B 1 •B 0
1 0 0 0
1
A 1 •A 0 •B 1 •B 0
1 0 0 1
1
A 1 •A 0 •B 1 •B 0
1 1 0 0
1
A 1 •A 0 •B 1 •B 0
1 1 0 1
1
A 1 •A 0 •B 1 •B 0
1 1 1 0
1
A 1 •A 0 •B 1 •B 0
0 0 0 1
0
0
= A1•B1•(A0•B0 + A0•B0 + A0•B0 + A0•B0)
(D1)
0 0 1 0
= A1•B1•(A0•(B0 + B0) + A0•(B0 + B0))
(D1)
0 1 1 0
0
X+X=1
0 0 1 1
0
= A1•B1•(A0 + A0)
X •1 = X
0 1 1 1
0
= A1•B1•(1)
X+X=1
1 0 1 1
0
= A1•B1•(A0•(1) + A0•(1))
= A 1 •B 1
Printed; 03/01/05
Modified; January 3, 2005
Boolean
Formula
z
0
X •1 = X
(2)
Slide 9
Department of Electronics, Carleton University
© John Knight
Digital Circuits p. 17
Basic Laws
Compare
Compare
Comparator circuits compare numbers. Here we only consider
non-negative binary numbers, further the examples are restricted
to two bits.
Decimal
A1A0 value
0
0
1
1
The “(1)” and “(2)” are equation numbers.
13.• PROBLEM ON COMPARE
Design a circuit which compares two 2-bit numbers A1A0 and
B1B0. It gives out Z=1 if the two numbers are equal. In this
problem please do not use XOR or XNOR gates.
0
1
0
1
0
1
2
3
A1
A0
B1
B0
z=1
z=1 If:
A 0=B0 , and
A1 =B1
Deriving Circuits From Truth Tables
Recall we only need consider cases which evaluate to “1”.
Boolean formulas default to “0” if they are not “1”.
If the output is “1” when A1, A0, B1,B0 = 1,0,1,0, this gives the term A1A 0B1B0
OR together all the terms that give an output of “1”, to get the complete formula.
The formulas so derived will not be in a reduced form.
Printed; 03/01/05
Modified; January 3, 2005
Department of Electronics, Carleton University
© John Knight
Comment on Slide 9
Digital Circuits p. 18
Basic Laws
Deriving Circuits From Truth Tables
Deriving Circuits From Truth Tables
The Comparator, reducing the equation.)
A1
A0
z=1
B1
B0
z=1 If:
A1A0 >B1B0
z = A1•A0•B1•B0 + A1•A0•B1•B0 + A1•A0•B1•B0 + A1•A0•B1•B0 + A1•A0•B1•B0 + A1•A0•B1•B0 (1)
Substitute equation (2) into (1)
= A 1 •A 0 •B 1 •B 0 + A 1 •B 1 + A 1 •A 0 •B 1 •B 0
(3)
Look for term(s) having the most common factors with terms A1•A0•B1•B0 and A1•A0•B1•B0
A1 •A0 •B1•B0 has 3 with the 1st, and gain A 1•A0 •B1 •B0 has 3 with the 2nd.
In (3), OR in 2 extra copies of A1•A 0•B 1•B0.
z = A 1 •A 0 •B 1 •B 0 + A 1 •B 1 + A 1 •A 0 •B 1 •B 0 + A 1 •A 0 •B 1 •B 0 + A 1 •A 0 •B 1 •B 0
(X = X + X)
= A 1 •B 1 + A 1 •A 0 •B 1 •B 0 + A 1 •A 0 •B 1 •B 0 + A 1 •A 0 •B 1 •B 0 + A 1 •A 0 •B 1 •B 0
(X +Y = Y + X)
= A 1 •B 1 + A 0 •B 1 •B 0 •A 1 + A 0 •B 1 •B 0 •A 1 + A 1 •A 0 •B 0 •B 1 + A 1 •B 0 •A 0 •B 1
(X•Y=Y •X)
= A1•B1 + A0•B1•B0•(A1 + A1) + A1•A0•B0•(B1 + B1)
= A1•B1 + A0•B1•B0•(1) + A1•A0•B0•(1)
= A 1 •B 1 + A 0 •B 1 •B 0 + A 1 •A 0 •B 0
(D1)
(X+X=1)
(X•1=X)
Final reduced answer
z = A 1 •B 1 + A 0 •B 1 •B 0 + A 1 •A 0 •B 0 )
Printed; 03/01/05
Modified; January 3, 2005
Department of Electronics, Carleton University
© John Knight
Basic Laws
Slide 10
Digital Circuits p. 19
The Comparator
The Comparator
The final formula is easy to understand.
Use “-” to mean either “1” or “0”.
The first term (A1B1) says A1A0 > B1B0 when A1A0 = 1 - and B1B0 = 0 -.
That is 1- > 0- .
1 - is either decimal 3 or decimal 2.
0 - is either decimal 1 or decimal 0.
Thus (A1B1) covers 3 > 1 or 0 and 2 > 1 or 0.
The second term (A0B1B0) says A1A0 > B1B0 when A1A0 = - 1 and B1B0 = 0 0.
In decimal 3 > 0 and 1 > 0.
Printed; 03/01/05
Modified; January 3, 2005
Department of Electronics, Carleton University
© John Knight
Comment on Slide 10
Digital Circuits p. 20
Basic Laws
Deriving Circuits From Truth Tables
Deriving Circuits From Truth Tables
(More)
a
0
0
0
0
1
1
1
1
The Full Adder
The full-adder adds 3 bits
A
B
Cy (out)
Cy(in)
Full
Adder
Result,
Σ Decimal
b Cy(in) Cy(out)
0 0
0
0 1
0
1 1
1
1 0
0
0 0
0
0 1
1
1 1
1
1 0
1
0
1
0
1
1
0
1
0
0
1
2
1
1
2
3
2
Σ (sum)
a
0
0
0
0
1
1
1
1
b Cy(in) Cy(out)
0 0
0
0 1
0
1 1
1 a•b•Cy
1 0
0
0 0
0
0 1
1 a•b•Cy
1 1
1 a•b•Cy
1 0
1 a•b•Cy
Printed; 03/01/05
Modified; January 3, 2005
Σ
Equation for when Cy(out) is “1”
0
1 a•b•Cy
0
1 a•b•Cy
1 a•b•Cy
0
1 a•b•Cy
0
Cy(out) = a•b•Cy + a•b•Cy + a•b•Cy + a•b•Cy
Cy(out) is “0” for all other combinations
Equation for when Σ is “1”
Σ = a•b•Cy + a•b•Cy + a•b•Cy + a•b•Cy
Department of Electronics, Carleton University
© John Knight
Basic Laws
Slide 11
Digital Circuits p. 21
The Comparator
The Adder1
0
0
00
0
1
01
1
0
01
A0
B0
The four results from
adding two bits
Cy
This upper circuit is called a half adder because it adds only two bits.
A full adder (lower box) can add three bits.
The third bit is the carry input from a previous stage.
Σ
For adding one-bit numbers, or the first bits of a multibit number, a
half added is all right. Otherwise a full adder is needed.
Half
Adder
Cy (out)
CY(IN)
A
B
1. We will use
which.
1
1
10
Full
Adder
Σ (sum)
for addition here, since + was used for OR. In many places + is used for both, and you have to figure out which is
Printed; 03/01/05
Modified; January 3, 2005
Department of Electronics, Carleton University
© John Knight
Comment on Slide 11
Digital Circuits p. 22
Basic Laws
Deriving Circuits From Truth Tables
The Full Adder (Cont)
Simplify the full adder equations O
Cy(out) = a•b•Cy + a•b•Cy + a•b•Cy + a•b•Cy
= a•b•Cy + a•b•Cy + a•b•Cy + a•b•Cy + a•b•Cy+ a•b•Cy
= (a + a)b•Cy + ( b + b)a•Cy + a•b(Cy+ Cy)
(D1) ay + by = (a + b)y
(N) x + x = 1
= (1)b•Cy + ( 1)a•Cy + a•b(1)
= b•Cy + a•Cy + a•b
= a majority gate
(I) x + x = x
(O ) x•1 = x
≥2
a
b
Cy(out)
Cy
Σ = a•b•Cy + a•b•Cy + a•b•Cy + a•b•Cy
= a•b•Cy + a•b•C y + a•b•C y + a•b•C y
(C)
x+y=y+x
= (a•b + a•b)•C y + (a•b + a•b)C y
(D1)
ay + by = (a + b)y
= (a•b + a•b)•C y + (a•b + a•b)C y
= (a ⊕ b)•Cy + (a ⊕ b)•Cy
= (a ⊕ b)⊕Cy
a
b
Cy
(Formula for XOR) a•b + a•b = (a ⊕ b)
Σ
Printed; 03/01/05
Modified; January 3, 2005
(Formula for XNOR) a•b + a•b = a•b + a•b
(Formula for XOR) u•Cy + u•Cy = (u ⊕ Cy)
u = (a ⊕ b)
Slide 12
Department of Electronics, Carleton University
© John Knight
Basic Laws
Digital Circuits p. 23
Simplifying the Full Adder
Simplifying the Full Adder
Carry Term
This is straightforward
Sum Term
This requires being aware of the various forms of XOR and XNOR.
A⊕B = A⊕B = Α⊕Β
a⊕b = ab+ab
a⊕ b
= a•b + ab
(a⊕b) c + (a⊕b)c = a⊕b⊕c
14.• PROBLEM
Starting on the second line of the simplification of the carry,
Cy(out) = a•b•Cy + a•b•Cy + a•b•Cy + a•b•Cy + a•b•Cy+ a•b•Cy
use the simplification rule to reduce the amount of writing to get the final answer.
Printed; 03/01/05
Modified; January 3, 2005
Department of Electronics, Carleton University
© John Knight
Comment on Slide 12
Digital Circuits p. 24
Basic Laws
Deriving Circuits From Truth Tables
Common Mistakes
1. Saying
a•b is the same as a•b
2. Not using
AB + A =A to simplify expressions before using more more complex rules.
Also not reducing using A + AE = A + E.
Simplifying and reducing first may save many lines of algebra.
3. Saying X + 1 = X
Everybody knows better than this, but they still do it.
Printed; 03/01/05
Modified; January 3, 2005
Slide 13
Department of Electronics, Carleton University
© John Knight
Digital Circuits p. 25
Basic Laws
Larger Adders
Larger Adders
The full adder only adds one-bit numbers. To add multibit numbers, one needs several full adders. A 4-bit adder
which adds two 4-bit numbers is shown.
4-Bit Adder
made from
four full-adders
A3 B3
C4
Full
adder
A2 B2
C3
C3
Σ3
A3+B3+C3
Σ3
Printed; 03/01/05
Modified; January 3, 2005
Full
adder
Σ2
A3 B3
C4
Full
adder
A1 B1
C2
C2
A2 B 2
C3
A2+B2+C2
A0 B0
C1
C1
Σ1
C2
Σ2
Department of Electronics, Carleton University
© John Knight
Σ1
C0
Σ0
A1 B1
A1+B1+C1
Full
adder
A0 B0
C1
A0+B0+C0
C0
0
Σ0
Comment on Slide 13
Digital Circuits p. 26
Basic Laws
DeMorgan’s Theorems, Simple Forms
DeMorgan’s Theorem
DeMorgan’s Theorems, Simple Forms
DeMorgan
The 2nd DeMorgan
A + B = A·B
(DeM1)
D+E
Inverse
The 2nd inverse
A + B = A·B
A
0
0
1
1
B
0
1
0
1
1
0
1
0
D· E = D + E
AB AB
A B A+B
1
1
0
0
(DeM2)
D·E
=
1
1
1
0
0
0
0
1
D
0
0
1
1
1
1
1
0
E D+E
0 1
1 0
0 0
1 0
D E D·E
1
1
0
0
1
0
1
0
1
0
0
0
Equivalent graphical forms:
A·B = K
A
K
B NAND
A·B
A
B
AND
= A+B
A
B
NAND
=
C
C
Printed; 03/01/05
Modified; January 3, 2005
=
A
B
D+E
D
E
K
NOR
=
G
G
=
D
E
D·E
G
NOR
A+B
AND
AND
D+E
C
D
E
OR
=
F
F
=
D
E
Department of Electronics, Carleton University
© John Knight
Basic Laws
D·E
F
OR
Slide 14
Digital Circuits p. 27
DeMorgan’s Theorems
DeMorgan’s Theorems
A theorem relating NANDs and NORs.
• An OR gate with inverted inputs is equivalent to an AND gate with an inverted output.
• An AND gate with inverted inputs is equivalent to an OR gate with an inverted output.
• Inverting inputs and outputs of an OR makes it an AND.
• Inverting inputs and outputs of an AND makes it an OR.
EXAMPLE
Convert (a + b)(a + c) to an expression with 3 letters and inversion bars only over single letters.
(a + b)(a + c) = (a + b) + (a + c)
= (a·b) + (a·c)
= a ·b + a ·c
= a(b + c)
41.• PROBLEM
(a+b) + a·b
Reduce
(DeM1)
(DeM2)
(Clear brackets)
(D1) xy + xz = x(y+z)
to four letters with inversion bars over single letters only.
42.• PROBLEM
d(de) + (de)e to four letters with inversion bars over single letters only.
Reduce
Printed; 03/01/05
Modified; January 3, 2005
Department of Electronics, Carleton University
© John Knight
Comment on Slide 14
Digital Circuits p. 28
Basic Laws
DeMorgan’s Theorems, Simple Forms
Using DeMorgan’s Theorem
Equivalent Gate Symbols
AND
NOR
OR
NOR
OR
NAND
AND
AND
NAND
Real Gates are NAND and NOR
Easy to Understand Gates
are AND and OR
NOR
NAND
OR
AND
One cannot make AND and
OR gates directly.
Circuit with real gates
a
b NAND
c
d NAND
NAND
Circuit with simple gates
a
b AND
F
c
d AND
F = (ab) • (cd)
OR
F
F = ab + cd
Which one is easier for you to understand?
Printed; 03/01/05
Modified; January 3, 2005
Department of Electronics, Carleton University
© John Knight
DeMorgan’s Theorem
Slide 15
Digital Circuits p. 29
DeMorgan’s Theorems
DeMorgan’s Theorem
The two expressions for the circuit with real gates and the circuit with simple gates, are equivalent
ab + cd = F = (ab) • (cd)
Use High-True And-Or Signals for Thinking
Thinking
•
Thinking in nand-nor logic is difficult. Just look at any industrial schematic used extensively for
maintenance. The margin will be full of “1”s and “0”s pencilled in by users.
These Notes
• If the logic is important ANDs and ORs will be used.
• If the gate design is important, as when we talk about CMOS gates, NANDs and NORs will be used.
43.• PROBLEM
Prove, using DeMorgan’s Theroem(s), that
Printed; 03/01/05
Modified; January 3, 2005
ab + cd = (ab) • (cd)
Department of Electronics, Carleton University
© John Knight
Comment on Slide 15
Digital Circuits p. 30
DeMorgan’s Theorem
DeMorgan Transfers Real Gates Into
DeMorgan Transfers Real Gates Into Simple Gates
Circuit with real gates
a
b NAND
c
d NAND
NAND
NAND
NAND
NAND
NAND
a
b AND
NAND
c
d AND
NAND
Use DeMorgan’s NAND
gate symbol at output
F = (ab) • (cd)
•
F
Circuit with simple gates
Inverting circles
cancel each other
OR
F
F = ab + cd
Circuits meant for understanding the logic use ANDs and ORs.
- Draw your circuits with ANDs and ORs.
•
Circuits for construction are drawn with NANDs and NORs.
- Lab circuits to be wired are drawn with NANDs and NORs
Draw construction diagrams by:
- transforming the understandable circuit into the real circuit
- using the DeMorgan alternate symbols.
NAND
•
NAND
Thus Compromise drawings have NANDS and NORs
with the circles are arranged to cancel each other.
Printed; 03/01/05
Modified; January 3, 2005
NAND
Department of Electronics, Carleton University
© John Knight
DeMorgan’s Theorem
alternate
NAND
symbol
Slide 16
Digital Circuits p. 31
Transforming NAND-NOR Diagrams into
Transforming NAND-NOR Diagrams into AND-OR Diagrams
•
•
•
Diagrams in this course will be drawn with ANDs and ORs as much as possible.
Diagrams for construction or maintainance, that want to show exactly what gates were used, will be
drawn with NANDs and NORs. This is particularly true of older diagrams.
A compromise method, which is almost as easy to follow, but shows
NOR
NAND
the real gates as used, is to make alternate gates with the alternate
symbols, the ones with the inverting circles on the inputs.
NOTE:
One output circle cancels all the input circles it feeds.
44.• PROBLEM
Transform this circuit into simple gates.
a)
Printed; 03/01/05
Modified; January 3, 2005
Department of Electronics, Carleton University
© John Knight
Comment on Slide 16
Digital Circuits p. 32
DeMorgan’s Theorem
Printed; 03/01/05
Modified; January 3, 2005
DeMorgan’s Theorem
Printed; 03/01/05
Modified; January 3, 2005
DeMorgan Transfers Real Gates Into
Department of Electronics, Carleton University
© John Knight
Slide 17
Digital Circuits p. 33
Transforming NAND-NOR Diagrams into
Department of Electronics, Carleton University
© John Knight
Comment on Slide 17
Digital Circuits p. 34