CH 2
CH 2
-- Sequential logic
• Outputs depend on both the current inputs and
on previous inputs and outputs
• Storage elements that record the state of the
circuit
• The same inputs may generate different outputs
and different new states, depending on the
circuit’s current state.
Boolean algebra
• A boolean value can be either true or false;
• In digital logic, 1 is usually used to represent true.
0 to represent false.
• Boolean functions produce a boolean output
based on one or more boolean inputs.
• common functions:
AND , OR , NOT
NAND , NOR
XOR , XNOR
Boolean algebra
-- AND Output is 1 iff every input has a value of 1
x y x^y
0 0 0
0 1 0
1 0 0
1 1 1
-- OR Output is 1 if any of its inputs is 1
x y xy
0 0 0
0 1 1
1 0 1
1 1 1
Boolean algebra
-- NOT
a single Boolean value.
output is the complement of inputs
x x’
0 1
1 0
Boolean algebra
-- NAND(NOT AND)
output is 1 if no inputs are not all of its inputs 1.
x y x NAND y
0 0 1
0 1 1
1 0 1
-- NOR(NOT OR)
1 1 0
output is 1 if no inputs are equal to 1.
x y x NOR y
0 0 1
0 1 0
1 0 0
1 1 1
Boolean algebra
-- XOR(exclusive OR)
• The number of input that are 1 does matter.
• If two inputs are equal to 1,output is 0 else 1
• in general , the output is equal to 1 if an odd
number of input values are 1, and 0 if an even
number of inputs are 1.
x y x XOR y
0 0 0
0 1 1
1 0 1
1 1 0
Boolean algebra
-- XNOR(equivalence function)
• the output is equal to 1 if an even number of
input values are 1.
x y x XNOR y
0 0 1
0 1 0
1 0 0
1 1 1
Manipulating Boolean Functions
• DeMorgan’s Law allows a digital designer to convert
an AND function to an equivalent OR function and vice
versa. (ab)’=a’+b’
(a+b)’=a’b’
• each possible set of input values is called a minterm.
• An useful device for minimizing logic is the karnaugh
map or K-map.
Manipulating Boolean Functions
x’y’z’+x’y’z=x’y’(z+z’)=x’y’(1)=x’y’
Multiplexers
• A multiplexer ,or MUX, is a selector.
•It chooses one of its data inputs and passes it through to
its output.
4-to-1 Mux.
Multiplexers
2-to-4
DEC.
Decoders
A 4-to-2 encoder.
Encoders
A 1-bit comparator.
Adders
•Adders are not only perform addition ,but also to
perform subtraction, multiplication, and division.
• Half adder inputs two 1-bit values, X and Y ,and
outputs their 2-bit sum as bits C and S.Bit C is the carry
and bit S is the sum.
Adders
• Full adder has three inputs: the two data inputs and a
carry input C X iYi X i Cin Yi Cin and S X i Yi Cin .
Adders
• With the carry input, full adders can be cascaded to
produce an n-bit adder by connecting output C of an
adder to Cin of the next adder called ripple adder.
A 4-bit ripple-adder.
Adders
• Each full adder has a small propagation delay;these delays
add up as the carry bits are propagated.
•One solution to the delay problem is the carry lookahead
adder. The generate part ,g, g X Y ;The second part is the
propagate,p, p X Y
•In general, this can be expressed by the equation
Ci 1 g i pi Ci
D flip-flop D latch
SR latch
• SR latch,sometimes called the RS latch,has two data
inputs.
•The S input set the latch to one,and the R input reset it
to zero.
•Must ensure the S and R are never set to 1 at the same
time,or the circuit may exhibit unpredictable behavior.
JK Flip-Flop
• Jk flip-flop resolves the problem of undefined output
associated with the SR latch.
•J=1 set the output to 1 and K=1 reset the output to 0
•JK=11 inverts the current value.
T Flip-Flop
• T,or toggle, flip-flop
• The T input does not specify a value for this flip-flop’s
output only whether or not it should be changed.
Sequential Components
•Flip-flops and latches may be combined in parallel to
store data with more than one bit.
•4-bit D flip-flop
Counters
•A counter stores a binary value and, when signaled
to arithmetically increments or decrements its value.
•4-bit up counter.
Counters
•Another variant allows the counter to count up or down.
•Any of these counters may have ability to load external
data and count to as parallel load capability.
•A 4-bit up/down counter with parallel load
Shift Registers
•A shift register can shift its data one bit position to
the right or left.
•Several variants, shifting left ,shifting right, either
direction under external control
•4-bit left shift register
PLA
•the Programmable Logic Array ,or PLA, contains
one or more AND-OR arrays
•The inputs and their complements are made
available to several AND gates.
•The outputs of the AND gate are then input to OR
gates, which produce the chip’s output.
PAL
•the Programmable Array of Logic ,or PAL, is
similar to PLA but its OR block is not programmable.
•The AND inputs are programmable.
PLD
•the Programmable Logic Device ,or PLD,
encompass PLAs and PALs and more.
• Field Programmable Gate Arrays,FPGAs, are
among the most complex PLDs available.
•FPGAs contain an array of cells, each of which can
be programmed to realize a function.
•FPGAs often contain the equivalent of 10,000 or
more simple logic gates on a single chip.