Professional Documents
Culture Documents
Logic Circuit & Switching Theory Sequencial Logic Circuits
Logic Circuit & Switching Theory Sequencial Logic Circuits
Logic Circuit & Switching Theory Sequencial Logic Circuits
COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRICAL ENGINEERING
Unclocke
d Sequential Circuit
Applications
Synchronous sequential circuits are implemented in the design of flip-flops, counters
and to develop MOORE-MEALY state-controlled machines.
2). Asynchronous Sequential Circuits
Asynchronous sequential circuits perform their operation without depending on the
clock signal but use the input pulses and generate the output. As there is no clock pulse
dependency, these circuits can switch to the next state quickly when the input signal is
changed. So, there is a faster operation with asynchronous sequential circuits.
Applications
Asynchronous sequential circuits are cost-effective to be used in small independent
systems that need only a few elements. The communication between two elements, each hold
its own independent clock, and this will be achieved by these circuits.
The defining characteristic of a combinational circuit is that its output depends only on
the current inputs applied to the circuit. The output of a sequential circuit, on the other hand,
depends both on the current input values as well as the past inputs. This dependence on past
inputs gives the property of “memory” for sequential circuits.
In general, the sequence of past inputs is encoded into a set of state variables. There is a
feedback path that feeds these variables to the input of a combinational circuit as shown in
Figure 4.1. Sometimes, this feedback consists of a simple interconnection of some outputs of
the combinational circuit to its inputs. For the most part, however, the feedback circuit consists
of elements such as flip-flops that we discuss later in this chapter. These elements themselves
are sequential circuits that can remember or store the state information. Once we introduce
feedback, we also introduce potential instability into the system. As a simple example, consider
the circuit shown in Figure 4.2. This circuit is stable in the sense that the output of each inverter
can stay at a particular level. However, this circuit is in deterministic as we cannot say what the
output level of each inverter is. Outputs of the first and second inverters could be 0 and 1,
respectively. The outputs could also be 1 and 0, instead. In contrast, you can verify that the
circuit in Figure 4.2 is unstable.
In combinational logic circuits the output levels at any instant are dependent purely on
the levels present at the input at that time. In sequential logic circuits the output levels are
dependent also on the previous states, and include some form of memory elements. The
most widely used memory element is the flip-flop.
The RS Flip-flop A simple RS bi stable may not be constructed using two NOR gates
interconnected as shown in Fig. 14.1. As may be seen from the truth table, when both inputs
are low, the Q-output is stable in whichever state it was at previously. Pulsing the Sin put high
sets the Q output low and the Q output high. Pulsing the R input has just the opposite effect.
However, when both inputs go from high to low together then the output state is
unpredictable.
The simple RS flip-flop has two disadvantages for certain applications: (a) its operation
out of the 1, 1 state is unpredictable. (b) It is transparent (i.e. when enabled, the output
changes whenever the input changes).
The JK Flip-flop as shown in Fig. 14.2 overcomes both of these difficulties. As well as
having I and K inputs, it has the addition of a clock. As may be seen from the truth table, the 1,
1 state, rather than being unpredictable, causes the flip-flop to toggle, such that, on receipt of a
clock input, the output changes to the opposite state. JK flip-flops are available with preset and
clear inputs. This provides a means of setting the flip-flop into a known condition independent
of the clock and the JK inputs. There are two ways in which the clock input may be arranged to
control the transitions. These are described in (c) and (d).
Edge-triggered Flip-flops In this case, one edge is used to define the time at which the
output changes. Either the rising or the falling edge may be used, depending on the device. The
JK inputs must be present for a minimum time (the set-up time) before the clock edge occurs,
and remain for a minimum time (the hold time) after the clock edge. The output will be delayed
for a period of time after the clock edge (the propagation delay).
Pulse-triggered Flip-flops In this case the device is pulse-triggered. It is referred to as the
master-slave flip flop. Its operation may be understood by considering the two edge-triggered
flip-flops in series as shown in Fig. 14.3, although it is not necessarily made in this way. On the
rising edge of the clock, data enters the first flip-flop. On the falling edge, data is transferred to
the output. At no time is the input connected through to the output, and feedback oscillations
are impossible. The edge-triggered and master-slave flip-flops operate by clock levels, and are
not dependent on the clock edge speed.
SR Flip-flop circuit:
A flip-flop is a sequential circuit which samples the input and changes the output at a
particular instance of time. It has two stable states and can be used to store the state
information. Signals are applied to one or more control inputs to change the state of the circuit
and will have one or two outputs.
It is the basic storage element in sequential logic and fundamental building blocks of
digital electronic systems. They can be used to keep a record of the value of a variable. Flip-flop
is also used to control the functionality of a circuit.
Master-slave JK flip-flop:
The Master-Slave Flip-Flop is basically a combination of two JK flip-flops connected
together in a series configuration. Out of these, one acts as the “master” and the other as a
“slave”. The output from the master flip flop is connected to the two inputs of the slave flip flop
whose output is fed back to inputs of the master flip flop.
In addition to these two flip-flops, the circuit also includes an inverter. The inverter is
connected to clock pulse in such a way that the inverted clock pulse is given to the slave flip-
flop. In other words, if CP=0 for a master flip-flop, then CP=1 for a slave flip-flop and if CP=1 for
master flip flop then it becomes 0 for slave flip flop.
Prerequisite – Flip-flop types and their Conversion
Race Around Condition In JK Flip-flop – For J-K flip-flop, if J=K=1, and if clk=1 for a long period
of time, then Q output will toggle as long as CLK is high, which makes the output of the flip-flop
unstable or uncertain. This problem is called race around condition in J-K flip-flop. This problem
(Race around Condition) can be avoided by ensuring that the clock input is at logic “1” only for a
very short time. This introduced the concept of Master Slave JK flip flop.
Master Slave flip flop are the cascaded combination of two flip-flops among which the
first is designated as master flip-flop while the next is called slave flip-flop (Figure 1). Here the
master flip-flop is triggered by the external clock pulse train while the slave is activated at its
inversion i.e. if the master is positive edge-triggered, then the slave is negative-edge triggered
and vice-versa. This means that the data enters into the flip-flop at leading/trailing edge of the
clock pulse while it is obtained at the output pins during trailing/leading edge of the clock pulse.
Hence a master-slave flip-flop completes its operation only after the appearance of one full
cloclock pulse for which they are also known pulse-triggered flip-flops.
The internal structure of a master-slave JK flip-flop in terms of NAND gates and an inverter (to
complement the clock signal) is shown in Figure 2. Here it is seen that the NAND gate 1 (N1) has three
inputs viz., external clock pulse (Clock), input J and output Q̅ ; while the NAND gate 2 (N 2) has external
clock pulse (Clock), input K and output Q as its inputs.
Further the outputs of N1 and N2 gates are connected as the inputs for the criss-cross
connected gates N3 and N4. These four gates together (N1, N2, N3 and N4) form the master-part
of the flip-flop while a similar arrangement of the other four gates N 5, N6, N7 and N8 form the
slave-part of it.
From figure it is also evident that the slave is driven by the outputs of the master (M 1
and M2), which is in accordance with its name master-slave flip-flop. Further the master is
active during the positive edge of the clock due to which M 1 and M2 change their states;
depending on the values of J and K. However at this instant the outputs of the overall system
(master-slave JK flip-flop) remains unchanged as the slave will be inactive due to positive-edge
of the clock pulse. Similar to this, the slave decides on its outputs Q and Q̅ depending on its
inputs M1 and M2, during the negative edge of the clock during which the master will be
inactive.
The truth table corresponding to the working of the flip-flop shown in Figure 2 is given
by Table I. Here it is seen that the outputs at the master-part of the flip-flop (data enclosed in
red boxes) appear during the positive-edge of the clock (red arrow). However at this instant the
slave-outputs remain latched or unchanged. The same data is transferred to the output pins of
the master-slave flip-flop (data enclosed in blue boxes) by the slave during the negative edge of
the clock pulse (blue arrow). The same principle is further emphasized in the timing diagram of
master-slave flip-flop shown by Figure 3. Here the green arrows are used to indicate that the
slave-output is nothing but the master-output delayed by half-a-clock cycle.
Moreover it is to be noted that the working of any other type of master-slave flip-flop is
analogous to that of the master slave JK flip-flop explained here.
Delay Flip-flop:
We remember that a simple SR flip-flop requires two inputs, one to “SET” the output and one to
“RESET” the output. By connecting an inverter (NOT gate) to the SR flip-flop we can “SET” and “RESET”
the flip-flop using just one input as now the two input signals are complements of each other. This
complement avoids the ambiguity inherent in the SR latch when both inputs are LOW, since that state is
no longer possible.
Thus this single input is called the “DATA” input. If this data input is held HIGH the flip
flop would be “SET” and when it is LOW the flip flop would change and become “RESET”.
However, this would be rather pointless since the output of the flip flop would always change
on every pulse applied to this data input.
To avoid this an additional input called the “CLOCK” or “ENABLE” input is used to isolate
the data input from the flip flop’s latching circuitry after the desired data has been stored. The
effect is that D input condition is only copied to the output Q when the clock input is active.
This then forms the basis of another sequential device called D Flip Flop.
The “D flip flop” will store and output whatever logic level is applied to its data terminal
so long as the clock input is HIGH. Once the clock input goes LOW the “set” and “reset” inputs
of the flip-flop are both held at logic level “1” so it will not change state and store whatever
data was present on its output before the clock transition occurred. In other words the output
is “latched” at either logic “0” or logic “1”.
D-type Flip-Flop Circuit
Clock Circuits:
Clock and Timing Signals
Most sequential logic circuits are driven by a clock oscillator. This usually consists of an
as table circuit producing regular pulses that should ideally:
1. be constant in frequency
Many clock oscillators use a crystal to control the frequency. Because crystal oscillators
generate normally high frequencies, where lower frequencies are required the original
oscillator frequency is divided down from a very high frequency to a lower one using counter
circuits.
2. Have fast rising and falling edges to its pulses.
It is the edges of the pulses that are important in timing the operation of many
sequential circuits, the rise and fall times are usually be less than 100ns. The outputs of clock
circuits will typically have to drive more gate than any other output in a given system. To
prevent this load distorting the clock signal, it is usual for clock oscillator outputs to be fed via a
buffer amplifier.
3. Have the correct logic levels
The signals produced by the clock circuits must have appropriate the logic levels for the
circuits being supplied.
Suppose the gate input is at logic 0, because the gate is an inverter, the output must be
at logic 1, and C will therefore charge up via R from the output. This will happen with the
normal CR charging curve. Once Vt+ is reached at the gate input, the gate output will rapidly
switch to 0. The resistor is now connected effectively between the positive plate of C and zero
volts. Thus the capacitor now discharges via R until the gate input voltage reduces to Vt- when
the output will change to logic 1 once more, starting the charging and discharging cycle over
again.
This Schmitt RC oscillator can produce a pulse waveform with an excellent wave shape
and very fast rise and fall times. The mark to space ratio, as shown in Fig 5.1.2 is approximately
1:3.
The frequency of oscillation depends on the time constant of R and C, but is also
affected by the characteristics of the logic family used. For the 74HC14 the frequency (ƒ) is
calculated by:
1
f=
0.8 RC
CMOS Flip-Flop
Fig 5.5.2 shows a basic circuit for a single flip-flop, which operates as a level triggered D
Type flip-flop. Apart from the NOT gate (N1) and the buffer (B1) controlling the CK input, the
basic flip-flop uses only two NOT gates (N2 and N3) and two transmission gates (TG1 and TG2).
Fig. 5.5.2 Basic CMOS Flip-flop Circuit
Fig. 5.5.5 CMOS Positive Edge Triggered JK Flip-flop with SET and RESET
Counters:
Asynchronous Counters
Counters, consisting of a number of flip-flops, count a stream of pulses applied to the
counter’s CK input. The output is a binary value whose value is equal to the number of pulses
received at the CK input.
Each output represents one bit of the output word, which, in 74 series counter ICs is
usually 4 bits long, and the size of the output word depends on the number of flip-flops that
make up the counter. The output lines of a 4-bit counter represent the values 2 0, 21, 22 and 23,
or 1, 2, 4 and 8 respectively. They are normally shown in schematic diagrams in reverse order,
with the least significant bit at the left, this is to enable the schematic diagram to show the
circuit following the convention that signals flow from left to right, therefore in this case the CK
input is at the left.
Clock Ripple
The effect of clock ripple in asynchronous counters is illustrated in Fig. 5.6.4, which is a
magnified section (pulse 8) of Fig. 5.6.2.
Fig. 5.6.4 shows how the propagation delays created by the gates in each flip-flop
(indicated by the blue vertical lines) add, over a number of flip-flops, to form a significant
amount of delay between the time at which the output changes at the first flip flop (the least
significant bit), and the last flip flop (the most significant bit).
As the Q0 to Q3 outputs each change at different times, a number of different output
states occur as any particular clock pulse causes a new value to appear at the outputs.At CK
pulse 8 for example, the outputs Q0 to Q3 should change from 11102 (710) to 00012 (810),
however what really happens (reading the vertical columns of 1s and 0s in Fig. 5.6.4) is that the
outputs change, over a period of around 400 to 700ns, in the following sequence:
11102 = 710
01102 = 610
00102 = 410
00002 = 010
00012 = 810
At CK pulses other that pulse 8 of course, different sequences will occur, therefore there
will be periods, as a change of value ripples through the chain of flip-flops, when unexpected
values appear at the Q outputs for a very short time. However this can cause problems when a
particular binary value is to be selected, as in the case of a decade counter, which must count
from 00002 to 10012 (910) and then reset to 00002 on a count of 10102 (1010).
These short-lived logic values will also because a series of very short spikes on the Q
outputs, as the propagation delay of a single flip-flop is only about 100 to 150ns. These spikes
are called ‘runt spikes’ and although they may not all reach to full logic 1 value every time, as
well as possibly causing false counter triggering, they must also be considered as a possible
cause of interference to other parts of the circuit.
Although this problem prevents the circuit being used as a reliable counter, it is still
valuable as a simple and effective frequency divider, where a high frequency oscillator provides
the input and each flip-flop in the chain divides the frequency by two.
Registers:
Parallel In - Parallel Out (PIPO) Registers
An electronic register is a form of memory that uses a series of flip-flops to store the
individual bits of a binary word, such as a byte (8 bits) of data. The length of the stored binary
word depends on the number of flip-flops that make up the register. A simple 4-bit register is
illustrated in Fig. 5.7.1 and consists of four D Type flip-flops, sharing a common clock input,
providing synchronous operation ensuring all bits are stored at exactly the same time.
The binary word to be stored is applied to the four D inputs and is remembered by the
flip-flops at the rising edge of the next clock (CK) pulse. The stored data can then be read from
the Q outputs at any time, as long as power is maintained, or until a change of data on the D
inputs is stored by a further clock pulse, which overwrites the previous data.
Fig. 5.7.1 Parallel In/Parallel Out (PIPO) Register
Shift Registers
Shift registers have a similar structure to the PIPO register but have the added ability to
shift the stored binary word left or right, one bit at a time. This makes them extremely useful
for many applications. They are used in handling serial data and converting it to parallel form or
back again to serial form, and therefore are an essential component in communication systems.
Shift registers are also essential in arithmetic circuits where binary numbers may be shifted
right (and so divided by two), or left (multiplied by two) as part of a calculation. Shift registers
can be used to delay the passage of data at a particular point in a circuit. As the data is shifted
one bit at a time from input to output, the amount of delay will depend on the number of flip-
flops in the register and the frequency of the clock pulses driving the shift register. Because a
number of serial bits of data are stored as they enter the input, and are then recovered from
the output at some later time, this action can also be described as a serial memory, or as a
digital delay line.
The simple storage register shown in Fig. 5.7.1 can be modified to a shift register by
connecting the output of one flip-flop into the input of the next, as shown in Fig. 5.7.2. The
basis of shift register circuits is the D-type flip-flop, but the clocked SR or the JK flip-flop may
also be converted to D-types by the inclusion of an inverter between S and R or between J and
K. In all cases the clock input is in synchronous mode.
The serial input of the shift register in Fig. 5.7.2 is the D input of the first flip-flop, and
the serial output is the Q output of the last flip-flop in the chain. The logic state at the serial
input appears at the output, a number of clock pulses (equal to the number of flip flops) later.
PISO
If use is also made of the Q output, and the additional pre-set (PR) and clear (CLR) inputs
available on many flip-flops, the shift register could be made more versatile still.
Fig. 5.7.5 shows a shift register modified to enable it to be loaded with a 4-bit parallel
number, which may then be shifted right to appear at the serial output one bit at a time. As the
‘Parallel In/Serial Out’ or PISO register also has a serial input, it can also be used as a SISO
register, and if extra outputs from each Q output were also included, the register would also
have Serial In/Parallel out (SIPO) operation.
Fig. 5.7.5 Multiple Mode (SISO, SIPO, PISO, PIPO) Shift Register
A Simple ALU:
Connecting Digital Circuits Together
Digital Electronics Modules 2 to 5 have described how basic logic gates may be
combined, not only to perform standard logic functions, but to build circuits that can perform
complex logic tasks. Both small scale integrated (SSI) and medium scale integrated (MSI) chips
are available in many forms, that can be directly connected together to make very complex
circuits. It is this inter-connectivity that makes digital electronics so powerful and so versatile.
The standard circuits described in modules 2 to 5, both combinational and sequential, can be
used to perform arithmetic operations such as addition, subtraction and counting, as well as
logical operations such as combining data sources (multiplexing) and shifting bits left or right
within a binary word.
Multiplexers
MUX 1 and MUX 3 are identical 8 bit multiplexers that select either the input data word
A (MUX 1) or data word B (MUX 3) or their internally generated complement, as shown in Fig.
5.8.3.
MUX 2 is a similar design but selects either the data word B or the zero value 00 HEX , as
shown in Fig. 5.8.4.
8-Bit Adder
The adder component is an 8-bit ripple carry adder; real ALUs would normally feature a
‘carry-look-ahead’ adder, allowing for high-speed operation. However for this example the
much simpler ripple carry adder is adequate, as the operation is totally manual.
The adder component is illustrated in Fig. 5.8.5 and consists of eight full-adder circuits
with additional logic consisting of an XOR gate to neither detect over flow errors, and an 8-input
NOR gate to detect a zero result.
Negative results are indicated by sampling the most significant bit of the ‘sum’ output,
and a ‘carry’ is indicated by sampling the carry output of the most significant full adder.
Four D type flip-flops are used as ‘flag’ outputs to indicate the current state of the ALU after
each operation.
Fig.5.8.4 MUX 2
ALU Operation
Addition
To perform an addition, input data B is added to A. This is achieved by putting logic 1 on
the control inputs of multiplexers 1, 2 and 3. This causes data A and B to be applied to the
adder inputs. Also, to allow any carry bit from the C IN input to be included in the addition, the 1
bit carry multiplexer must have logic 0 on its control input. The shift register is only used as a
PIPO register in addition mode, so its input lines R/~L and ROTATE must be at logic 0. SHIFT/~LE
must also be at logic 0 to enable parallel loading of the shift register, which will hold the result
of the addition (A plus B) after the application of a single CK pulse.
Subtraction
Subtraction is performed using twos complement arithmetic. That is, to subtract B from
A, input B is complemented and 1 added to the complemented value to form the twos
complement. Then the twos complement of B is added to A in the adder to find the result. To
achieve this action with data A and data B present at the inputs, logic 1 is applied to the control
inputs of MUX 1 and MUX 2. MUX 3 has logic 0 applied to its control input to complement data
B, while the CARRY MUX has a logic 1 applied to its control line so that the carry-in (C IN) to the
adder is forced to logic 1. This adds 1 to the result so that the twos complement of data B is
added to data A. The result at the adder output is a two complement number representing A -
B. The flags are again set by the result as in the addition operation.
Incrementing
Data A can be incremented if logic 1 is applied to the control inputs of MUX 1 and MUX
3. This will add B to A, with data B made zero by applying logic 0 to the control input of MUX 2.
The 1 that must be added to data A is supplied by making the control input of the CARRY
SELECT block logic 1, causing the carry input to the adder to be logic 1. The result at the adder
output is therefore A + 1, again the flags are set by the result.
Decrementing
To decrement data A, 1 must be subtracted from A. Because the ALU uses twos
complement arithmetic, the twos complement of 1 added to A will in effect subtract 1 from A.
The twos complement of 1 is minus 1, which in 8-bit twos complement notation is 11111111 2.
Therefore to subtract 1 from data A, data B must equal minus 1 (all bits = 1). To do this, and to
make sure that the correct result is not changed by any data appearing on the data B input,
logic 0 is applied to the control input of MUX 2 to make sure all data B bits = 0.
Logic 0 is also applied to the control input of MUX 3. This inverts data B, (which is
000000002) to give 111111112 at the adder input.
MUX 1 must have logic 1 on its control line, to apply data A to the other adder input.
The adder’s carry input is set to 1 by applying logic 0 to the control line of the CARRY MUX. This
ensures that, provided there is no carry-in on the C IN input, the correct result at the adder
output will be A − 1.
Negation
Negation is simply the inverse of a value; therefore any value and its inverse will add to
produce zero. In binary arithmetic the additive inverse of a value is its twos complement. The
ALU can be used to negate (find the twos complement of) data A by complementing data A and
then adding 1. This involves a similar process to decrementing, except that data B is treated
differently, as follows:
The control input of MUX 1 is set to logic 0, which complements data A, also data B is
made zero by putting logic 0 on MUX 2 control, and logic 1 on MUX 3. The Carry Select control
input is set at logic 1, to add 1 to data A in the adder.
The shift register is used as a simple PIPO register by applying logic 0 to the three shift
controls and logic 1 to the ~CLC input to make sure the carry is not cleared. This gives a final
result of A+1, which is the twos complement of A.
Rotate right
When data in the shift register is rotated right, it leaves the register via bit 0 and is
returned directly to bit 7 via an internal link, without passing through the carry flag.
There are a number of other operations, such as performing 8 bit logic functions, commonly
found on microprocessors that this ALU is not designed to do. The purpose of this design is to
illustrate how the circuits described in Digital Electronics Modules 1 to 5 are really just part of a
bigger picture; they can be inter-connected in many ways to make many different circuits. This
ALU design is one example.
IMPORTANT FORMULAS:
SR Flip-flop
Block Diagram
Circuit Diagram
Master slave JK flip-flop
The circuit diagram and truth-table of a J-K flip flop is shown below.
Delay Flip-flop
TRUTH TABLE:
D Q Q
LOW X 0 1
HIGH 0 0 1
HIGH 1 1 0
The D(Data) is the input state for the D flip-flop. The Q and Q’ represents the output
states of the flip-flop. According to the table, based on the inputs the output changes its state.
But, the important thing to consider is all these can occur only in the presence of the clock
signal. This, works exactly like SR flip-flop for the complimentary inputs alone.
TRUTH TABLE:
INPUT OUTPUT
0 0 1
0 1 1
1 0 1
1 1 0
Thus, comparing the NAND gate truth table and applying the inputs as given in D flip-
flop truth table the output can be analyzed. Analyzing the above assembly as a three stage
structure considering previous state (Q’) to be 0
Clk D Q Description
↓»0 X Q Q Memory
no change
↑»1 0 0 1 Reset Q » 0
As mentioned earlier, T flip – flop is an edge triggered device. For example, consider a T
flip – flop made of NAND SR latch as shown below.
If the output Q = 0, then the upper NAND is in enable state and lower NAND gate is in
disable condition. This allows the trigger to pass the S inputs to make the flip – flop in SET state
i.e. Q = 1.
If the output Q = 1, then the upper NAND is in disable state and lower NAND gate is in
enable condition. This allows the trigger to pass the R inputs to make the flip – flop in RESET
state i.e. Q =0.
In simple terms, the operation of the T flip – flop is
When the T input is low, then the next sate of the T flip flop is same as the present state.
T = 0 and present state = 0 then the next state = 0
T = 1 and present state = 1 then the next state = 1
When the T input is high and during the positive transition of the clock signal, the next
state of the T flip – flop is the inverse of present state.
T = 1 and present state = 0 then the next state = 1
T = 1 and present state = 1 then the next state = 0
As each incoming trigger alternately changes the set and reset inputs, the flip – flop
toggles. So to complete one full cycle of output wave form it need two triggers. This means that
the T flip flop produces the output at exactly half of the frequency of input frequency. So a T flip
– flops will act as “Frequency Divider Circuit”.
The main disadvantage of T flip – flop is that the state of the flip – flop at an applied
trigger pulse is known only when the previous state is known.
Generally, T flip flops are not available as ICs. So they can be constructed by using JK flip –
flop and SR flip – flop and D flip – flop. The symbol of T flip – flop made from JK flip – flop is
shown below.
PROBLEMS:
SR Flip-flop
(Easy)
1). (SR latch) Draw the output and timing diagram of a (a) NOR and (b) NAND implementation of
an SR latch for the input signals depicted in Figure P6.2.
Figure P6.2
Answer:
2). Explain how the addition of a propagation-delay-based one-shot circuit to the enable input
of an S-R latch changes its behavior:
Specifically, reference your answer to a truth table for this circuit.
Answer:
The outputs of this device are allowed to change state only when the “clock” signal (C)
is transitioning from low to high:
3).
(Moderate)
1.) Determine the output states for this S-R flip-flop, given the pulse inputs shown:
SOLUTION:
Answer:
2.) If the clock frequency driving this flip-flop is 240 Hz, what is the
Frequency of the flip-flop’s output signals (either Q or Q)?
VDD
240 HZ
SOLUTION:
FOUT = 240/2
FOUT = 120 HZ
Answer:
Fout = 120 Hz
a. NOR gates
b. NAND gates
c. AND, OR and INVERT gates
Answer:
a.
b.
Q(next) = ((RC)'(Q')')''
Q'(next) = ((SC)'Q')''
c.
SOLUTION:
QN QN+1 A B
0 0
0 1
1 0
1 1
Answer:
QN QN+1 A B
0 0 ----- 0
0 1 0 1
1 0 1 0
1 1 0 ---------
Write the characteristics equation for the storage element A-B. Qn+1=.
solution and answer:
Qn+1= AB Qn + B Qn
(Difficult)
1.) Plain S-R latch circuits are “set” by activating the S input and de-activating the R input.
Conversely, they are “reset” by activating the R input and de-activating the S input. Gated
latches and flip-flops, however, are a little more complex:
Describe what input conditions have to be present to force each of these multi vibrator circuits
to set and to reset.
For the S-R gated latch:
Set by . . .
Reset by . . .
For the S-R flip-flop:
Set by . . .
Reset by . . .
Answer:
For the S-R gated latch:
Set by making S high, R low, and E high.
Reset by making R high, S low, and E high.
For the S-R flip-flop:
Set by making S high, R low, and C transition from low to high.
Reset by making R high, S low, and C transition from low to high.
2.) The flip-flop circuit shown here is classified as synchronous because both flip-flops receive
clock pulses at the exact same time:
Answer:
The clock frequency must be slow enough that there is adequate set-up time before the next
clock pulse. The propagation delay time of FF1 must also be larger than the hold time of FF2.
And, of course, the pulse width of the clock signal must be long enough for both flip-flops to
reliably “clock.”
3.) Explain how the addition of a propagation-delay-based one-shot circuit to the enable input
of an S-R latch changes its behavior:
For each of your proposed faults, explain why it causes the described problem.
Answer:
Phototransistor Q1 failed shorted
Resistor R2 failed open
Flip flop U1 output failed high
5.) Determine the output states for this S-R flip-flop, given the pulse inputs shown:
Answer:
Master-slave JK flip-flop
(Easy)
1). (JK flip-flops) Derive the output waveforms of a master-slave JK flip-flop for the input
waveforms depicted in Figure P6.6.
Figure P6.6
Answer:
J K Q(next)
0 0 Q
0 1 0
1 0 1
1 1 Q'
2. According to the characteristic table and the J, K and Clk waveform, draw the Q
waveform
3. Indicate delays on the timing diagram.
2). A student has an idea to make a J-K flip-flop toggle: why not just connect the J, K, and Clock
inputs together and drive them all with the same square-wave pulse? If the inputs are active-
high and the clock is positive edge-triggered, the J and K inputs should both go “high” at the
same moment the clock signal transitions from low to high, thus establishing the necessary
conditions for a toggle (J=1, K=1, clock transition)
Unfortunately, the J-K flip-flop refuses to toggle when this circuit is built. No matter how many
clock pulses it receives, the Q and [Q] outputs remain in their original states - the flip-flop
remains “latched.” Explain the practical reason why the student’s flip-flop circuit idea will not
work.
Answer:
With all inputs tied together, there is zero setup time on the J and K inputs before the clock
pulse rises.
3). Determine the output states for this J-K flip-flop, given the pulse inputs shown:
Answer:
4). Flip - Flops can be used to build counters, JK-FF are the ideal elements for that purpose .
What is the truth table for the circuit above?
Answer:
CLK J K Q
X 0 0 Last state
0 1 0
1 0 1
1 1 toggle
5)
(Moderate)
1.) Determine what input conditions are necessary to set, reset, and toggle these two J-K flip-
flops:
Answer:
Set by activating J, deactivating K, and clocking C.
Reset by activating K, deactivating J, and clocking C.
Toggle by activating J and K simultaneously, and clocking C.
For the J-K flip-flop with active-high inputs:
Set by making J high, K low, and C transition from low to high.
Reset by making K high, J low, and C transition from low to high.
Toggle by making J high, K high and C transition from low to high.
For the J-K flip-flop with active-low inputs:
Set by making K high, J low, and C transition from high to low.
Reset by making J high, K low, and C transition from high to low.
Toggle by making J low, K low, and C transition from high to low.
2.) Determine the output states for this J-K flip-flop, given the pulse inputs shown:
3.) Flip-flops often come equipped with asynchronous input lines as well as synchronous input
lines. This J-K flip-flop, for example, has both “preset” and “clear” asynchronous inputs:
Describe the functions of these inputs. Why would we ever want to use them in a circuit?
Explain what the “synchronous” inputs are, and why they are designated by that term.
Also, note that both of the asynchronous inputs are active-low. As a rule, asynchronous inputs
are almost always active-low rather than active-high, even if all the other inputs on the flip-flop
are active-high. Why do you suppose this is?
4.) An extremely popular variation on the theme of an S-R flip-flop is the so-called J-K flip-flop
circuit shown here:
Note that an S-R flip-flop becomes a J-K flip-flop by adding another layer of feedback from the
outputs back to the enabling NAND gates (which are now three-input, instead of two-input).
What does this added feedback accomplish? Express your answer in the form of a truth table.
Figure P6.6
J K Q(next)
0 0 Q
0 1 0
1 0 1
1 1 Q'
2. According to the characteristic table and the J, K and Clk waveform, draw the Q
waveform
3. Indicate delays on the timing diagram.
(Difficult)
1.) (Sequential Synthesis) Design a simplified traffic-light controller that switches traffic lights on
a crossing where a north-south (NS) street intersects an east-west (EW) street. The input to the
controller is the WALK button pushed by pedestrians who want to cross the street. The outputs
are two signals NS and EW that control the traffic lights in NS and EW directions. When NS or
EW is 0, the red light is on and when they are 1, the green light is on. When there are no
pedestrians, NS=0 and EW=1 for 1 minute, followed by NS=1 and EW=0 for 1 minute and so on.
When a WALK button is pushed, NS and EW both come 1 for a minute when the present minute
expires. After that the NS and EW signals continue alternating. For the traffic-light controller:
S0: (NS = 0, EW = 1)
S1: (NS = 1, EW = 0)
S2: (NS = 1, EW = 1)
S0 S1/01 S2/01
S1 S0/10 S2/10
S2 S0/11 S2/11
S0 = 00
S1 = 01
S2 = 10
Walk = 0 Walk = 1
00 01/01 10/01
01 00/10 10/10
11 XX/XX XX/XX
10 00/11 10/11
D0 = Q1'Q0'Walk'
D1 = Walk
NS = Q0 + Q1
EW = Q0'
3.) Consider the following sequential logic circuit containing a JK flip-flop and a D flip-flop (not
all connections are shown to keep the schematic simple):
Solution and answer:
The D flip-flop has output X. Its input has no name, so let's call its input DX. The JK flip-flop has
output Y. Its inputs also have no names so let's call them JY, and KY. We can then give formulas
for the combinational logic inputs of each flip-flop input as follows:
DX = A nand B
JY = X or Y
KY = A nand B
4.) (JK flip-flops) derive the output waveforms of a master-slave JK flip-flop for the input
waveforms depicted in Figure P6.6.
Figure P6.6
0 0 Q
0 1 0
1 0 1
1 1 Q'
2. According to the characteristic table and the J, K and Clk waveform, draw the Q waveform
Solution:
1. In order to implement this modulo-10 counter, we will need four flip-flops labeled: Q 3, Q2,
Q1, and Q0. Using natural binary encoding, we can derive a state transitions table:
2. from the transitions table, write transitions equations.
Q3 (next) = Q2Q1Q0 + Q3Q1'Q0'
Q2 (next) = Q2'Q1Q0 + Q2Q1' + Q2Q0'
Q1 (next) = Q3'Q1'Q0 +Q1Q0'
Q0 (next) = Q0'
Answer:
Delay Flip-flop
(easy)
1). In PROBLEM 1 learners are tasked to investigate the function and operation of the D type
flip flop and to consider:
• How does the flip flop operate and what is its purpose?
• What are each of the inputs and outputs?
• In what type of applications are flip flops used?
Solutions
• The D type flip flop is a latching device with outputs that have two stable states. This means
that the output can be switched from logic 0 to logic 1, or logic 1 to logic 0 when required. Once
set into either of these states it will remain there indefinitely so long as power is maintained to
the device. For this reason it is often termed a ‘bistable’.
• The purpose of a D type flip flop is to act as a latch or memory or storage device. It can store
the information present on its inputs.
• The terminals are as follows:
• Typical applications of the D type flip flop are: Latches, Counters, Memory Devices, Shift
Registers.
Answer:
2). In PROBLEM 2, learners are asked to complete timing diagrams for a positive edge triggered
D type flip flop. Solutions to Activity 2 are given below. Note that input signal D is captured on
positive transitions of CK only. Learners are tasked to complete Q and Q.
Answer :
3). In PROBLEM 3, learners are asked to complete timing diagrams for a negative edge triggered
D type flip flop. Solutions to Activity 3 are given below. Note that input signal D is captured on
negative transitions of CK only. Learners are tasked to complete Q and Q.
Answer:
4). Construct a JK flip-flop using a D Flip-flop, a 2-to-1 line multiplexer and an inverter.
Answer:
5). Determine the final output states over time for the following circuit, built from D-type gated
latches:
At what specific times in the pulse diagram does the final output assume the input’s state? How
does this behavior differ from the normal response of a D-type latch?
Answer :
The final output assumes the same logic state as the input only when the enable input signal (B)
transitions from “high” to “low”.
(Moderate)
1.) Determine the final output states over time for the following circuit, built from D-type gated
latches:
At what specific times in the pulse diagram does the final output assume the input’s state? How
does this behavior differ from the normal response of a D-type latch?
Solution:
Answer:
The final output assumes the same logic state as the input only when the enable input signal (B)
transition from “high” to “low”.
2.)
Now, suppose we add a propagation-delay-based one-shot circuit to the Enable line of this D-
type gated latch. Re-analyze the output of the circuit, given the same input conditions:
Comment on the differences between these two circuits’ responses, especially with reference
to the enabling input signal (B).
Answer:
3.) Determine the output states for this D flip-flop, given the pulse inputs shown:
Answer:
4.) A scientist is using a microprocessor system to monitor the Boolean (“high” or “low”) status
of a particle sensor in her high-speed nuclear experiment. The problem is, the nuclear events
detected by the sensor come and go much faster than the microprocessor is able to sample
them. Simply put, the pulses output by the sensor are too brief to be “caught” by the
microprocessor every time:
She asks several technicians to try and fix the problem. One tries altering the microprocessor’s
program to achieve a faster sampling rater, to no avail. Another recalibrates the particle sensor
to react slower, but this only results in missed data (because the real world data does not slow
down accordingly!). No solution tried so far works, because the fundamental problem is that
the microprocessor is just too slow to “catch” the extremely short pulse events coming from
the particle sensor. What is required is some kind of external circuit to “read” the sensor’s state
at the leading edge of a sample pulse, and then hold that digital state long enough for the
microprocessor to reliably register it.
Finally, another electronics technician comes along and proposes this solution, but then goes
on vacation, leaving you to implement it:
Explain how this D-type flip-flop works to solve the problem, and what action the
microprocessor has to take on the output pin to make the flip-flop function as a detector for
multiple pulses.
Answer:
The flip-flop becomes “set” every time a pulse comes from the sensor. The microprocessor
must clear the flip-flop after reading the captured pulse, so the flip-flop will be ready to capture
and hold a new pulse.
5.) (Sequential Synthesis) Design a counter that counts in the sequence 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
0... by using natural binary encoding and D-type flip-flops.
Answer:
In order to implement this modulo-10 counter, we will need four flip-flops labeled: Q3, Q2, Q1,
and Q0. Using natural binary encoding, we can derive a state transitions table:
(Difficult)
1.) (Sequential Synthesis) Design a counter that counts in the sequence 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
0,..., using natural binary encoding and D-type flip-flops.
SOLUTION:
1. In order to implement this modulo-10 counter, we will need four flip-flops labeled: Q3, Q2,
Q1, and Q0. Using natural binary encoding, we can derive a state transitions table:
2.) Design a recognizer that recognizes an input sequence that has at least three 1's. The
recognizer has a single input X, and a single output Y, in addition to an asynchronous Reset
signal. The recognizer sets the output Y to 1 if the input signal X was equal to 1 in at least 3
clock cycles after the Reset was disserted. For the above recognizer described above:
a. Devise the state diagram.
b. Minimize the number of states.
c. Encode the states to minimize the combinatorial logic.
d. Draw a schematic diagram using D flip-flops
SOLUTION:
1. Define the states as the following:
S0: 0 ones received,
S1: 1 ones received,
S2: 2 ones received,
S3: 3 or more ones received.
The state diagram is:
3.) Determine the output states for this D flip-flop, given the pulse inputs shown:
ANSWER:
4.) Given the input waveforms shown below, sketch the output, Q, of a:
a) D latch
b) Positive-edge triggered D flip-flop
SOLUTION:
Digital Logic Design Worked Example:
D Latch Explanation:
D latch output behavior can be most simply described as mirroring that of the input Q
while CLK is high and retaining its most recent value while CLK is low. Thus, the output Q of a D
latch should simply reflect D while CLK is high and hold whatever value it had every time CLK
transitions from high to low for the duration of the low value for CLK. This behavior is illustrated
in the given solutions.
In this module, the value of Q could be either high or low at the very beginning,
so both states are shown. As soon as CLK goes high, the output Q conforms to the value of the
input D. Thereafter, Q follows the D latch behavior described above, mirroring D when CLK is
high and retaining its stored value when CLK is low, ignoring D during these intervals.
D Flip-Flop Explanation:
D flip-flop behavior is similar to that of D latches, except that instead of mirroring the
behavior of the input D whenever CLK is high, the output Q of a positive-edge triggered D flip-
flop will only accept a new value whenever the CLK transitions from low to high. This value will
be retained throughout the rest of the CLK cycle until a new value is read, whereupon a new
value (which may be the same as the old value) will be copied to the output.
In this module, the behavior of the D flip-flop is unexciting. As it is not stated whether
the output was high or low at the beginning of the period examined in this problem, both
possible
States are shown. On the first positive edge of the clock, the value for D is low, so the
value for the output Q of the D flip-flop will become low. On the two subsequent positive edges
of the clock, the value of the input D happens to be low, so the output Q remains low. It is only
on the final positive edge that the value of D happens to be high, so the output Q becomes
high.
Answer:
There is no particular relationship between CLK and the input D. CLK is varying periodically and
D is some input signal not directly related to CLK.
CLK is portrayed behaving periodically, as is generally the case, but the described behavior for D
latches and D flip-flops would hold even if it were not. D latches would copy the input D to the
output Q whenever CLK was high and D flip-flops would do the same on every low-to-high
transition.
The solution displayed has some delay between the transition of CLK or D and any change in Q;
as delay is not the point of this problem, submitted answers would not need to include this
delay.
5.) Determine the Q and [Q] output states of this D-type gated latch, given the following input
conditions:
Now, suppose we add a propagation-delay-based one-shot circuit to the Enable line of this D-
type gated latch. Re-analyze the output of the circuit, given the same input conditions:
ANSWER:
REFERENCES:
Mano, M. Morris, and Kime, Charles R. Logic and Computer Design Fundamentals. 2nd
Edition. Prentice Hall, 2000.
link.springer.com/chapter/10.1007/0-387-21566-2_4
www.allaboutcircuits.com/worksheets/flip-flop-circuits/
www.ibiblio.org/kuphaldt/socratic/output/flipflop.pdf
www2.nau.edu/~sh295/EE110/PracticeProbs208sols.pdf
www.ece.ucdavis.edu/~vojin/CLASSES/EEC180A/W2005/protected/problems/eec180a_practic
e-final_w06.pdf
www.geeksforgeeks.org/master-slave-jk-flip-flop/
www.electronics-tutorials.ws/sequential/seq_2.html
www.daenotes.com/electronics/digital-electronics/flip-flops-types-applications-woking
www.electrical4u.com/master-slave-flip-flop/
bwrcs.eecs.berkeley.edu/Classes/IcBook/SLIDES/slides6.pdf
www.cecs.uci.edu/~gajski/eecs31/homeworks/hw5_solutions.html
www.allaboutcircuits.com/worksheets/flip-flop-circuits/
www.geeksforgeeks.org/master-slave-jk-flip-flop/
www.electrical4u.com/master-slave-flip-flop/
learn.circuitverse.org/docs/flipflop/masterslave_jk_flipflop.html
www.cecs.uci.edu/~gajski/eecs31/homeworks/hw5_solutions.html
www.cecs.uci.edu/~gajski/eecs31/homeworks/hw5_solutions.html
www.electronics-tutorials.ws/sequential/seq_4.html
circuitdigest.com/electronic-circuits/d-flip-flops
cnx.org/contents/VelCLRnF@4/Digital-Logic-Worked-Example-D-Latch-and-D-Flip-Flop-
Behavior
www.electronics-tutorials.ws/sequential/seq_1.html
learn.adafruit.com/digital-circuits-4-sequential-circuits/flip-flops
www.allaboutcircuits.com/worksheets/flip-flop-circuits/
www.circuitstoday.com/flip-flops
www.indiabix.com/digital-electronics/flip-flops/
www.sanfoundry.com/digital-circuits-questions-answers-master-slave-flip-flops/?
fbclid=IwAR02Ui0Bwtj2pZC748dflm5oqPl6RWa2En7HwQo4uYRla2ZM33QMmcwi89Y
www.electronics-tutorials.ws/sequential/seq_2.html?fbclid=IwAR3_b2_eYU1z_dEBgaD-
k8JRKCsd_g3gdbxnQvEFx4HxXZ3SQJhDLxtrOYM
www.youtube.com/watch?v=sxSeKlxdxSc
www.youtube.com/watch?v=NgHdSqy1YKw
learnabout-electronics.org/Digital/dig51.php
learnabout-electronics.org/Digital/dig55.php
learnabout-electronics.org/Digital/dig56.php
earnabout-electronics.org/Digital/dig57.php
learnabout-electronics.org/Digital/dig58.php