Logic Design
• Boolean logic
• Digital logic circuits.
• Relationship b/w the two
• Design simple ones
Credit: Sangyeun Cho, Bruce Childers,Pat Teller Xu Jie all @ PITT;Garcia@UCB; song@bgsu; [Link]; Fenghui
1
Yao@TennesseeState;Sukumar@iowaState
Boolean Algebra (1’s and 0’s ONLY)
• Recap: AND, OR, NOT
[aka product, sum, complement]
• Boolean function has:
– variables (like X), operators (like AND),
input 0, 1.
• Boolean function output: 1 or 0
• Example: XY is a Boolean function
• NOTE (alternate notations):
• XY = X AND Y = X & Y
• X + Y = X OR Y = X | Y
• same as ~X same as X’
Truth table: AND, OR, NOT
as the overbar is a pain in ppt/Word
2
Boolean Algebra
• Some useful (perhaps, obvious) results
• DeMorgan’s Law (not obvious)
3
Boolean Algebra
• Truth table for a function F:
• Can be simplified (a bit later)
• Computers have circuits that
implement functions like F.
4
Boolean Algebra
• Concept question: Suppose
Show that F(X,Y,Z) simplifies to XZ
• Method 1 (you know from HS math): algebraic simplification
– Multiply the sets of parenthesis
– Use rules (see slide 3) to reduce it
• Method 2: K-map (may be later)
5
Logic Gates
• Three simple gates & their diagram: AND, OR, NOT
• Correspond directly to their respective Boolean
operations, as seen in the truth tables.
6
Three More Useful Logic Gates:
NAND, NOR, XOR
NAND: (XY)’ = X’ + Y’ (recap DeMorgan’s law);
XOR: Output true (or 1) implemented in 2 ways. Similarly, NOR
only when the values of
the inputs differ
Note the special symbol for the XOR
operation.
7
Digital Circuits
• Use gates to implement Boolean functions.
• Concept question: Implement the Boolean
function:
We simplify our Boolean expressions so that we can create simpler
circuits.
8
Two types of Circuits
Outputs
• Combinational
– Outputs depend only on the current input values
– Uses only logic gates.
– Produce a specified output (almost) at the instant when input values are
applied.
• Sequential
– Outputs depend on the current and past input values
– Uses logic gates and storage elements
– They have a delay
9
Combinational Circuits Applications
• Adders Multipliers Subtractors
• Multiplexers Decoders Encoders
• Comparators
• Let us see how to build a couple
10
Application: Half-adder
• Half-adder: find the sum of two bits.
• Half-adder’s truth table
• What is its circuit?
– Sum: looks like XOR (copied below)
– Carry: check its ‘1’ column,
corresponding input is just XY
11
Application: Full-adder
• Change half to Full adder
– Process carry bit.
• Truth table for a full adder
Sum:
x’ y’ C-in + x’ y C-in’ + x y’ C-in’ + x y C-in
Simplified to C-in XOR (x XOR y)
C-out:
x’ y C-in + x y’ C-in + x y C-in’ + x y C-in
Simplified to xy + C-in (x XOR B)
12
Application: 4-bit full-adder
• Just as we combined half adders to make a full
adder, full adders can be connected in series.
• The carry bit “ripples” from one adder to the next;
hence, this configuration is called a ripple-carry
adder.
• Four-bit full adder below
13
Application: Comparator
• Two (A, B) 4 bit inputs. Output 1 if A = B, else 0
14
Application: Decoder –
(select a memory location)
• How to build?
15