Академический Документы
Профессиональный Документы
Культура Документы
Flip-Flops
Sequential Logic
• The outputs of sequential logic circuits depend not only on the present state but also on the
past sequence of inputs.
• They must “remember” the past history of the inputs in order to produce the present output.
• Sequential logic circuits have feedback loops and/or timing delays.
• Flip-flops are the most commonly used memory devices in sequential networks.
• A flip-flop is a device that can assume one of two stable states.
• It has a pair of complementary outputs known as Q and Qbar.
• It has one or more inputs that can cause the output state to change.
• There are several types of flip-flops in common use, the most common being the S-R, the D-
type, the J-K and the T-type.
S-R Flip-Flop
• Instead of the output changing immediately the inputs are changed the output changes when the next clock
pulse is applied.
• S-R flip-flops are available in chip form.
• Can be represented by a truth table and a Boolean equation
• Q+ is the value of Q after the clock pulse
R S Q Q+
0 0 0 0 No Change
1 1
0 1 0 1 Set to ‘1’
1 1 Q +=S +RQ
1 0 0 0 Reset to ‘0’
1 0
1 1 ? ? Forbidden
D Q Q+
0 0 0 Q output
1 0 always
1 0 1 follows
1 1 D input
• D-type flip-flop often fitted with two extra terminals S and R which SET (S) the output to ‘1’ or RESET (R)
the output to ‘0’ without the action of the clock.
• These terminals should not be confused with the S and R terminals on the S-R flip-flop.
• D-type Flip-flops and latches are available as ICs. The 7474 is a dual edge triggered flip-flop and the 7475
is a quad D-type latch.
J-K Flip-Flop
J K Q Q+
0 0 0 0 No
0 0 1 1 Change Q + =J.K.Q +J. K.Q +J KQ +JK Q
0 1 0 0 RESET to
or
0 1 1 0 ‘0’
1 0 0 1 SET to Q + =Q .K +Q .J
1 0 1 1 ‘1’
1 1 0 1 Toggle
1 1 1 0
• Dual J-K flip-flops are available in both 14 and 16 pin packages. Quad J-K flip-flop ICs are also available.
T Q Q+
0 0 0 No change Q +=TQ +T Q
0 1 1 No change or
1 0 1 Toggle Q +=T ⊕Q
1 1 0 Toggle
• Asynchronous or ‘ripple through’ counters can be constructed from T-Type flip-flops, or from J-K or D-
Type wired as T-Type.
• The count sequence ‘ripples through’ by connecting the Q output of the first flip-flop to the clock input of
the second flip-flop, and so on.
• Positive or negative edge triggered or master-slave flip-flops can be used to construct counters.
• The operation of the counters is such that the natural counting sequence is in binary.
• Additional circuitry has to be added to design counters to count in decimal or to any other base.
• Counter operation is based on the fact that the flip-flop halves the frequency of the pulse train passing
through it.
Negative
Edge
Clock Input
Q Output
• The Q output wave is twice the period and therefore half the frequency of the clock input.
• If you look at the truth table for a 4-bit binary counter, you will see that the frequency of 0s and 1s halves
each time you move one column to the left.
• Four flip-flops can therefore be used to construct a 4-bit binary counter.
• Notice that the counter counts up to 15, resets to zero and starts again.
• Two flip-flops will count 22 = 4 states i.e. 0 1 2 3; three flip-flops will count 23 = 8 states i.e. 0 1 2 3 4 5 6
• Positive edge
triggered flip-flops can be used, but in this case a NOT gate is used to invert the clock and the clock inputs
taken from the Qbar outputs.
• The circuit could have also been designed using J-K flip-flops wired as T-Types.
• The reset terminals are used to initially set the starting point to 0000.
• In order to convert this circuit to a decade counter, i.e. one that will count 0 to 9 and then reset, additional
logic has to be added.
• A decade or binary coded decimal (BCD) counter can be made by stopping the count after 9 and resetting
the counter to zero.
• Nine must be displayed, but instead of ten (in binary) being displayed the counter must reset to zero; i.e. the
counter must zero on the tenth pulse.
• Examination of the truth table shows that the tenth pulse occurs when 1010 is displayed, i.e. Q3 =’1’ and Q1
= ‘1’
• Since the reset terminals are active low, a NAND gate connected between these Q outputs and the reset line
will make the counter reset after 9.
Q3 Q2 Q1 Q0 Q3 Q2 Q1 Q0 Q3 Q2 Q1 Q0
Down Counters
• Ripple counters can be made that will count down rather than up.
• In the case of negatively triggered flip-flops the clock input is taken from the Qbar rather than Q outputs.
• In the case of positively triggered flip-flops the clock input is taken from the Q rather than Qbar outputs.
Reversible Counters
Counter ICs
Q0 Q1 Q2 Q3
Serial
Serial Output
Input D Q D Q D Q D Q
_ _ _ _
Q Q Q D
Q
A B C
Clock
Serial Input
A B C D Serial Output
Clock
Clock 0 1 2 3 4 5
Clock A B C D
0 0 0 0 0
Data
1 1 0 0 0
2 0 1 0 0
A
3 0 0 1 0
4 0 0 0 1
B
5 0 0 0 0
C
• The logic date pulse is moved one place to the right for each rising edge of the clock.
• A falling edge triggered flip-flop would move the date on the falling or trailing edge of the clock.
• The fifth clock pulse moves the logic ‘1’ out of the register.
• The above register is known as a serial-in, serial-out register.
• Parallel data inputs can be added to give it a more universal application.
• The Set (Pre-set) and Reset (Clear) connections can be used to load parallel data
Input
Test
Pattern Chip
under
Test
Reference
Chip
• In order to thoroughly test the chip, all possible combinations of input patterns should really be applied, a
method known as ‘exhaustive testing’.
• In practice this is impossible for complex devices, as the number of possible test patterns would run into
hundreds of millions.
• Random pattern testing is a cheap method of obtaining some degree of confidence that the chip is working
OK.
• The input test pattern is just a random pattern to try and pick up any possible faults in the chip.
• The test pattern has to be easy to generate, and in order to ensure that the same test pattern is applied to the
next chip on test, the pattern has to be repeatable.
• A shift register with feedback connections through an XOR gate can produce a series of patterns that appear
to be random, but which in fact are repeatable.
• This circuit arrangement is known as a linear feedback shift register or LFSR.
• The test patterns are applied to both the inputs of the chip or circuit on test and the reference (control) chip.
• If the chips are identical, the output patterns will be the same.
• If the chip on test is faulty, however, the difference between corresponding outputs on the two circuits will
be picked up by the XOR gate, which in turn feeds an Or gate.
• If a logic ‘1’ appears on the final OR gate the chip on test is faulty.
• Note that this test merely tells us that there is something wrong with the chip on test. It doesn’t say what is
wrong with it.
Qo Q1 Q2 Q3
A B C D
Clock
• The Q outputs appear quite random and are not following any particular counting sequence.
• After 2n-1 patterns the pattern sequence repeats itself.
• The XOR of 0 and 0 is 0. If the start (or seed value) is 0000, the pattern would stay 0000 even when the
circuit was clocked.
• The seed value cannot therefore be 0000.
• Apart from 0000 any seed value can be used. The pattern length would remain the same.
• Not all tap-offs will give the maximal length. Other tap-offs will give a sub-set of the maximal length.
B A O1 O2 O3 O4 O1 =A B
0 0 1 0 0 0 O2 =A B
0 1 0 1 0 0 O3 =AB
1 0 0 0 1 0 O4 =AB
1 1 0 0 0 1
• BCD to Decimal decoder will select one line from ten. For ten outputs four input select lines are required.
• This could be designed using logic gates as above.
• The 7442 IC is a single chip solution.
Encoders
I1 I2 I3 I4 B A
1 A = 0 I1.I02. I3.I40 + 0
I1.I2.I3.I04
0 B= 1 I1.I20.I3.I40 + I1.I2.I3.I14
0
0 0 1 0 1 0
Digital Electronics
0 0 2 – Outline
0 Lecture
1 Notes
1 1 12
• A logic diagram can be constructed from the Boolean equations.
Multiplexers
• These have several data inputs, but allow only one of them at a time to be connected to the output.
• The ‘select’ inputs determine which input is routed through to the output.
• Two select lines can select up to four inputs; three select lines can select up to eight inputs.
• In general n select inputs can select up to 2n inputs.
I1
S I2 I1 Out
0 0 0 0
I
0 0 1 1 n
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 0 Select Lines
1 1 0 1
1 1 1 1