BECE102L-Digital Systems Design: Course Instructor
BECE102L-Digital Systems Design: Course Instructor
Course Instructor
6
▪ A sequential circuit consists of a feedback path,
and employs some memory elements.
Combinational
outputs Memory outputs
Combinational Memory
logic elements
External inputs
◆ ASynchronous
➢ The circuit behavior is determined by the signals
at any instant of time
➢ It is also affected by the order the inputs change
8
IN short……..
Memory Q
command element stored value
▪ Characteristic table:
Command Q(t) Q(t+1)
(at time t) Q(t): current state
Set X 1
Q(t+1) or Q+: next state
Reset X 0
Memorise / 0 0
No Change 1 1
Memory Elements
▪ Memory element with clock. Flip-flops are memory
elements that change state on clock signals.
Memory Q
command element stored value
clock
▪ Pulse-triggered
❖ latches
❖ ON = 1, OFF = 0
▪ Edge-triggered
❖ flip-flops
❖ positive edge-triggered (ON = from 0 to 1; OFF = other
time)
❖ negative edge-triggered (ON = from 1 to 0; OFF = other
time)
Flip-Flops
◆ They are memory elements
◆ They can store binary information
Clock:
◆ It emits a series of pulses
with a precise pulse width
and precise interval
between consecutive
pulses
◆ Timing interval between the
corresponding edges of
two consecutive pulses is
known as the clock cycle
time, or period
15
Flip-Flops
◆ Can keep a binary state until an input
signal to switch the state is received
◆ There are different types of flip-flops
depending on the number of inputs
and how the inputs affect the binary
state
16
Latches
◆ The most basic flip-flops
➢ They operate with signal levels
◆ The flip-flops are constructed from
latches
◆ They are not useful for synchronous
sequential circuits
◆ They are useful for asynchronous
sequential circuits
17
Summary: Memory Elements
➢ SR latches
➢ D latches
• Flip-Flop — a clocked 1-bit memory element
➢Master-slave flip-flop
➢Edge-triggered flip-flop
• RAM and ROM — a mass memory element
+
𝑄+ , 𝑄 indicates the
response of the latch at the
𝑄, 𝑄 output terminals as a
consequence of applying
the various inputs.
𝑄+ is called the next state of
the latch.
The 𝑆 𝑅 Latch
• Cross-coupling of two nand-gates
• When 𝑆 = 𝑅 = 1 logic diagram reverts to the basic bistable
element.
• Device has 2 stable states.
The Gated SR Latch
• Inputs for SR Latch and 𝑆 𝑅 Latch are
asynchronous.
– A change in the value of the inputs causes an
immediate change of the outputs.
• Frequently desirable to prevent input
activation signals from affecting the state of
the latch immediately.
• “gated SR latch” or “SR latch with enable” is
used.
The Gated SR Latch
• 𝑆 𝑅 Latch along with 2 additional NAND gates and a control input C.
– C is referred to as enable, gate or clock input.
• C determines when the S and R inputs become effective.
• C = 0:
– Master is disabled. Any changes to S,R ignored.
– Slave is enabled. Is in the same state as the master.
• C = 1:
– Slave is disabled (retains state of master)
– Master is enabled, responds to inputs. Changes in state of master are not reflected in disabled
slave.
• C = 0:
– Master is disabled.
– Slave is enabled and takes on new state of the master.
• Important: For short periods during rising and falling edges, both master and slave
are disabled.
Master-Slave SR Flip-Flop
• Assume in 1-state, C = 0, J = K = 1.
– Due to feedback, the output of the J-gate is 0, output of K-gate is 1.
– If clock is changed to C = 1 then master is reset.
• Assume in 0-state, C = 0, J = K = 1.
– Due to feedback, the output of the J-gate is 1, output of K-gate is 0.
– If clock is changed to C = 1 then master is set.
• 1 on J input line, 0 on K input line sets the flip-flop.
– If in 1-state, unchanged b/c S,R set to 0.
– If in 0-state, S set to 1, R set to 0.
• 0 on J input, 1 on K input line resets the flip-flop. Why?
Master-Slave JK Flip-Flop
Timing Diagram for
Master-Slave JK Flip-Flop
0’s and 1’s Catching
• The master is enabled during the entire period the control-signal is
1.
• If the slave latch is in its 1-state, then a logic-1 on K-input line
causes the master-latch to reset. Slave becomes reset when control
signal returns to 0.
• This is known as 0’s catching (2nd pulse).
– Note: if a subsequent 1-signal on J input line and C is still 1, master
does not become set again (due to feedback not changing).
• If slave latch is in 0-state, logic-1 on J input line while control signal
is 1 causes the master latch to be set and slave will be set upon
occurrence of the falling edge.
• This is known as 1’s catching (3rd pulse).
• In many applications, 0’s and 1’s catching behavior is undesirable.
Normally recommended that the J and K input values should be
held fixed during the entire interval the master is enabled.
• Any changes in J, K must occur while the control signal is 0.
0’s Catching
• Assume in 1-state 𝑄 = 1, 𝑄 = 0 , C = 1, J = 0, K = 0
• 𝐾 gets set to 1 briefly.
– Master gets reset, Slave will become reset when Clock goes to 0.
• 𝐾 goes to 0.
• 𝐽 goes to 1. What happens?
• Nothing! Slave will still become reset when Clock goes to 0.
• Why?
Problems of Master-Slave F/F
• Master-slave flip-flops are also referred as pulse triggered
flip-flops
• May cause errors when the delay of combinational
feedback path is too long
To solve:
• Ensure the delay of combinational block is short enough
• Use edge-triggered flip-flops instead
Excitation table - shows the minimum inputs that are required to generate a
particular next state or to "excite" it to the next state, when the current state is
known.
They are similar to truth tables, except for the rearrangement of the data.
Here, the current state and next state are next to each other on the left-hand
side of the table, and the inputs needed to make that state change happen are
shown on the right side of the table.
70
Excitation Table of T F/F
71
Flip – flop Conversions
▪ Generally, JK ffs and D ffs are the most widely used ffs. And so their availability in the
form of IC’s is abundant. Numerous varieties of JK ff and D ff are available in the
semiconductor market. The less popular SR ff and T ff are not available in the market as
IC’s (even though a very few number of SR ffs are available as IC’s, they are not
frequently used).
▪ There might be a situation where the less popular flip – flops are required in order to
implement a logic circuit. In order use the less popular flip – flops, we will convert one
type of flip – flop into another. Some of the most common flip – flop conversions are
▪ In order to convert one flip – flop to other type of flip – flop, we should design a
combinational circuit(comb-ckt) that is connected to the actual flip – flop. Inputs to comb-
ckt are same as the inputs of the desired ff. Outputs of comb-ckt are same as the inputs of
the available ff. So the output of comb-ckt is connected to the input of our available flip –
flop.
▪ SR ff to JK ff
▪ SR ff to D ff
▪ SR ff to T ff
▪ JK ff to SR ff
▪ JK ff to D ff
▪ JK ff to T ff
▪ D ff to SR ff
▪ D ff to JK ff
SR Flip – flop to JK Flip – flop conversion
Let’s write a truth table for the two inputs, J and K. For two inputs along with the
QP, we get 8 possible combinations in truth table.
Consider that when the two inputs are applied, QP is the present state and QN is
the next state. For every combination of J, K ,QP , we find the corresponding QN
state. Here QN will give the state values that to which the output of the JK flip –
flop will jump after the present state, on applying the inputs.
Now we write all the combinations of S and R in the truth table to get each
QN value from corresponding QP. Hence these are the values of S and R that are
used to change the state of flip flop from QP to QN.
Conversion Table
The K – map for S S = JQ’P.
The K – map for R
R = KQP.
The Boolean equations of S and R in terms of J, K and QP are: S = JQ’P and R = KQP
Steps for Conversion of flip-flops:
Conversion of flip-flops causes one type of flip-flop to behave like another type of flip-flop. In
order to make one flip-flop mimic the behavior of another certain additional circuitry and/or
connections become necessary.
Step 2: Obtain the Excitation Table for the given Flip-Flop from its Truth Table
Excitation tables provide the details regarding the inputs which must be provided to the flip-flop to
obtain a definite next state (Qn+1) from the known current state (Qn).
Step 3: Append the Excitation Table of the given Flip-Flop to the Truth Table of the Desired Flip-Flop
Appropriately to obtain Conversion Table
Step 4: Simplify the Expressions for the Inputs of the given Flip-Flop
Conversion table=Desired FF
truth table + Given FF
excitation table
S=D
R = D’
The expression for the D input is
The expression for the D input is
Another way to describe a JK flip-flop. Here, we describe the flip-flop by using the
characteristic table rather than the characteristic equation.
Registers
• A collection of flip-flops taken as an entity.
• Function: Hold information within a digital
system so that it is available to the logic elements
during the computing process.
• Each combination of stored information is known
as the state or content of the register.
• Shift register: Registers that are capable of
moving information upon the occurrence of a
clock-signal.
– Unidirectional
– bidirectional
Registers
• Two basic ways in which information can be
entered/outputted
– Parallel: All 0/1 symbols handled simultaneously. Require
as many lines as symbols being transferred.
– Serial: Involves the symbol-by-symbol availability of
information in a time sequence.
• Four possible ways registers can transfer information:
– Serial-in/serial-out
– Serial-in/parallel-out
– Parallel-in/parallel-out
– Parallel-in/serial-out
Introduction: Registers
▪ An n-bit register has a group of n flip-flops and some
logic gates and is capable of storing n bits of
information.
▪ The flip-flops store the information while the gates
control when and how new information is transferred
into the register.
▪ Some functions of register:
❖ retrieve data from register
❖ store/load new data into register (serial or parallel)
❖ shift the data within register (left or right)
Introduction: Registers 82
Simple Registers
▪ No external gates.
▪ Example: A 4-bit register. A new 4-bit data is loaded
every clock cycle.
A3 A2 A1 A0
Q Q Q Q
D D D D
CP
I3 I2 I1 I0
Simple Registers 83
Simple Registers
▪ No external gates.
▪ Example: A 4-bit register. A new 4-bit data is loaded
every clock cycle.
Simple Registers 84
Registers With Parallel Load
▪ Instead of loading the register at every clock pulse,
we may want to control when to load.
▪ Loading a register: transfer new information into the
register. Requires a load control input.
▪ Parallel loading: all bits are loaded simultaneously.
D Q A1
I1
D Q A2
I2
D Q A3
I3
CLK
CLEAR
Register Combin-
Clock ational
circuit
Inputs Outputs
Shift Registers 90
▪ The short oversimplified answer is that it sees the data that was present at D prior
to the clock.
▪ That is what is transferred to Q at clock time t1. The correct waveform is QC. At t1 Q
goes to a zero if it is not already zero.
The D register does not see a one until time t2, at which time Q goes high.
Shift Registers
▪ Basic data movement in shift registers (four bits are
used for illustration).
(a) Serial in/shift right/serial out (b) Serial in/shift left/serial out
Data in Data in
Data in
Data out
Data out
(c) Parallel in/serial out (d) Serial in/parallel out
Data out
(e) Parallel in /
parallel out
Shift Registers 92
Serial In/Serial Out Shift Registers
▪ Accepts data serially – one bit at a time – and also
produces output serially.
CLK
SI SO SI SO
Shift register A Shift register B
Clock CP
Shift control
Clock
Shift Wordtime
control
CP
T1 T2 T3 T4
CLK
Q0 Q1 Q2 Q3
Q0 Q1 Q2 Q3
▪ In general, there is no
SO pin. The last stage
(QD above) serves as
SO and is cascaded to
the next package if it
exists.
▪ Note the serial data
1011 pattern
presented at the SI
input. This data is
synchronized with the
clock CLK.
VERILOG CODE FOR SIPO AND TESTBENCH
module sipot_b;
module sipomod(clk,clear, si, po); reg clk;
input clk, si,clear; reg clear;
output [3:0] po; reg si;
reg [3:0] tmp; wire [3:0] po;
reg [3:0] po; sipomod uut
always @(posedge clk) (.clk(clk),.clear(clear), .si(si),.po(po) );
begin initial begin
if (clear) clk = 0;
tmp <= 4’b0000; clear = 0;
else si = 0;
tmp <= tmp << 1; #5 clear=1’b1;
tmp[0] <= si; #5 clear=1’b0;
po = tmp; #10 si=1’b1;
end #10 si=1’b0;
endmodule #10 si=1’b0;
#10 si=1’b1;
#10 si=1’b0;
#10 si=1’bx;
end
always #5 clk = ~clk;
initial #150 $stop;
endmodule
Parallel In/Serial Out Shift Registers
▪ Bits are entered simultaneously, but output is serial.
Data input
D0 D1 D2 D3
SHIFT/LOAD
Serial
D Q D Q D Q D Q data
Q0 Q1 Q2 Q3 out
C C C C
CLK
SHIFT.Q0 + SHIFT'.D1
Data in
D0 D1 D2 D3
SHIFT/LOAD SRG 4
Serial data out
CLK C
Logic symbol
D0 D1 D2 D3
D Q D Q D Q D Q
C C C C
CLK
Q0 Q1 Q2 Q3
RIGHT/LEFT
Serial
data in
RIGHT.Q0 + D Q D Q D Q D Q Q3
RIGHT'.Q2 Q1 Q2
C C C C
Q0
CLK
A4 A3 A2 A1
Q Q Q Q
Clear
D D D D
CLK
Serial
input for Serial
shift-right input for
I4 I3 I2 I1 shift-left
Parallel inputs
Bidirectional Shift Registers 108
Bidirectional Shift Registers
▪ 4-bit bidirectional shift register with parallel load.
Mode Control
s1 s0 Register Operation
0 0 No change
0 1 Shift right
1 0 Shift left
1 1 Parallel load
Clear
CS1104-13 An Application – Serial Addition 110
An Application – Serial Addition
▪ A = 0100; B = 0111. A + B = 1011 is stored in A
after 4 clock pulses.
Initial: A: 0 1 0 0 Q: 0
B: 0 1 1 1
Step 1: 0 + 1 + 0 A: 1 0 1 0 Q: 0
S = 1, C = 0 B: x 0 1 1
Step 2: 0 + 1 + 0 A: 1 1 0 1 Q: 0
S = 1, C = 0 B: x x 0 1
Step 3: 1 + 1 + 0 A: 0 1 1 0 Q: 1
S = 0, C = 1 B: x x x 0
Step 4: 0 + 0 + 1 A: 1 0 1 1 Q: 0
S = 1, C = 0 B: x x x x
A bidirectional shift register. Capable of shifting contents either left or right depending upon the
signals present on appropriate control input lines.
Universal shift register: Depending on the signal values on the select lines of the multiplexers, the
register can retain its current state, shift right, shift left or be loaded in parallel. Each operation is
the result of a positive edge on the clock line.