Module-2Combinational Logic & Sequential Logic
Module-2Combinational Logic & Sequential Logic
Module-2
Combinational Logic
Syllabus:
Combinational Logic: Introduction, Combinational Circuits, Design Procedure, Binary Adder- Subtractor,
Decoders, Encoders, Multiplexers. HDL Models of Combinational Circuits – Adder, Multiplexer,
Encoder. Sequential Logic: Introduction, Sequential Circuits, Storage Elements: Latches, Flip-Flops.
Introduction
• Logic circuits for digital systems may be combinational or sequential.
• A combinational circuit consists of logic gates whose outputs at any time are
determined from only the present combination of inputs.
• A combinational circuit performs an operation that can be specified logically by a set
of Boolean functions.
• sequential circuits employ storage elements in addition to logic gates. Their outputs
are a function of the inputs and the state of the storage elements
• Because the state of the storage elements is a function of previous inputs, the outputs
of a sequential circuit depend not only on present values of inputs, but also on past
inputs, and the circuit behavior must be specified by a time sequence of inputs and
internal states.
combinational circuit
A combinational circuit consists of an interconnection of logic gates.
• Combinational logic gates react to the values of the signals at their inputs and
produce the value of the output signal, transforming binary information from the
given input data to a required output data.
The n input binary variables come from an external source; the m output variables are
produced by the internal combinational logic circuit and go to an external destination.
Each input and output variable exists physically as an analog signal whose values are
interpreted to be a binary signal that represents logic 1 and logic 0.
• If the registers are included with the combinational gates, then the total circuit must
be considered to be a sequential circuit.
• For n input variables, there are 𝟐𝒏 possible combinations of the binary inputs.
• For each possible input combination, there is one possible value for each output
variable. Thus, a combinational circuit can be specified with a truth table that lists the
output values for each combination of input variables.
Design procedure
The procedure to design combinational circiut involves the following steps:
1. From the specifications of the circuit, Determine the required number of inputs
and outputs and assign a symbol to each.
2. Derive the truth table that defines the required relationship between inputs and
outputs.
3. Obtain the simplified Boolean functions for each output as a function of the
input variables.
4. Draw the logic diagram and verify the correctness of the design (manually or by
simulation).
Example for design Procedure
Code Conversion (Convert BCD to Excess-3 Code)
• A code converter is a circuit that makes the two systems compatible even though
each uses a different binary code.
• Since each code uses four bits to represent a decimal digit, there must be four input
variables and four output variables. We designate the four input binary variables by
the symbols A, B, C, and D, and the four output variables by w, x, y , and z .
• ADD 3 to BCD to get Excess -3 Code
Note that four binary variables may have 16 bit combinations, but only 10 are listed
in the truth table. The six bit combinations not listed for the input variables are don’t-
care combinations.
The logic diagram of the half adder implemented in sum of products is shown in Fig.
4.5(a) . It can be also implemented with an exclusive-OR and an AND gate as shown in
Fig. 4.5(b)
Full Adder
• A full adder is a combinational circuit that forms the arithmetic sum of three bits. It
consists of three inputs and two outputs.
• Two of the input variables, denoted by x and y , represent the two significant bits to
be added. The third input, z , represents the carry from the previous lower significant
position. The two outputs are designated by the symbols S for sum and C for carry.
• The logic diagram for the full adder implemented in sum-of-products form is shown
in Fig. 4.7
Binary Adder:
A binary adder is a digital circuit that produces the arithmetic sum of two binary numbers.
It can be constructed with full adders connected in cascade, with the output carry from
each full adder connected to the input carry of the next full adder in the chain.
• n-bit numbers requires a chain of n full adders or a chain of one-half adder and n-1
full adders.
• Eg:4bit numbers requires a chain of 4 fulladders or one HA and 3FAs.
• interconnection of four full-adder (FA) circuits to provide a four-bit binary ripple
carry adder
• The augend bits of A and the addend bits of B are designated by subscript numbers
from right to left, with subscript 0 denoting the least significant bit. The carries are
connected in a chain through the full adders. The input carry to the adder is C0, and it
ripples through the full adders to the output carry C4.
1. write Verilog code for 4 bit parallel adder using full adder as component.
There are several techniques for reducing the carry propagation time in a parallel adder.
The most widely used technique employs the principle of carry lookahead logic .
Carry Propagation
• Carry Propagation The addition of two binary numbers in parallel implies that all the
bits of the augend and addend are available for computation at the same time.
• Consider the circuit of the full adder shown in Fig. 4.10 . If we define two new binary
variables.
• Gi is called a carry generate , and it produces a carry of 1 when both Ai and Bi are 1,
regardless of the input carry Ci .
• Pi is called a carry propagate , because it determines whether a carry into stage i will
propagate into stage i + 1
•
•
Binary ADDER-Subtractor
The addition and subtraction operations can be combined into one circuit with one
common binary adder by including an exclusive-OR gate with each full adder.
A four-bit adder–subtractor circuit is shown in Fig. 4.13 . The mode input M controls the
operation. When M = 0, the circuit is an adder, and when M = 1, the circuit becomes a
subtractor. Each exclusive-OR gate receives input M and one of the inputs of B.
When M = 0, we have B ⊕0 = B. The full adders receive the value of B , the input carry is
0, and the circuit performs A plus B . When M = 1, we have B ⊕ 1 = B’ and C0 = 1. The B
inputs are all complemented and a 1 is added through the input carry. The circuit performs
the operation A plus the 2’s complement of B . (The exclusive-OR with output V is for
detecting an overflow.)
DECODERS
• A Decoder is a combinational circuit that converts binary information from n input
lines to a maximum of 2𝑛 unique output lines.
• The decoders presented here are called n -to- m -line decoders, where m … 2𝑛 . Their
purpose is to generate the 2𝑛 (or fewer) minterms of n input variables.
• Each combination of inputs will assert a unique output. The name decoder is also
used in conjunction with other code converters, such as a BCD-to-seven-segment
decoder.
2:4 decoder ( 1 of 4 decoder)
A 2 to 4 decoder is a combinational logic circuit that takes two input lines, typically labeled
A and B, and generates four output lines, usually labeled Q0, Q1, Q2, and Q3. The decoder
analyzes the input combination and activates the corresponding output line
3:8 Decoder
• A 3 to 8 decoder has three inputs (x,y,z) and eight outputs (D0 to D7).
• Based on the 3 inputs one of the eight outputs is selected.
• The truth table for 3 to 8 decoder is shown in the below table.
• From the truth table, it is seen that only one of eight outputs (D0 to D7) is selected
based on three select inputs.
• From the truth table, the logic expressions for outputs can be written as follows:
Decoders with enable inputs can be connected together to form a larger decoder circuit.
Implement 4:16 decoder using 2 3:8 decoder.
two 3-to-8-line decoders with enable inputs connected to form a 4-to-16-line decoder.
When w =0, the top decoder is enabled and the other is disabled. The bottom decoder outputs
are all 0’s, and the top eight outputs generate minterms 0000 to 0111.
When w =1, the enable conditions are reversed: The bottom decoder outputs generate
minterms 1000 to 1111.
The decoder generates the eight minterms for x , y , and z . The OR gate for output S forms the logical sum
of minterms 1, 2, 4, and 7. The OR gate for output C forms the logical sum of minterms 3, 5, 6, and 7.
Exemplify(Implement) the following function using 3:8 decoder
i) f(a,b, c,d)=∑m (L,2, 3,4)
ii) f(a,b, c, d)=∑m (3,5,7 )
Encoder
4:2 Encoder
8:3 Encoder
• an encoder is the octal-to-binary encoder whose truth table is given in Table 4.7
• It has eight inputs (one for each of the octal digits) and three outputs that generate the corresponding
binary number. It is assumed that only one input has a value of 1 at any given time.
• The encoder can be implemented with OR gates whose inputs are determined directly from the truth
table
• Output z is equal to 1 when the input octal digit is 1, 3, 5, or 7.
• Output y is 1 for octal digits 2, 3, 6, or 7, and
• output x is 1 for digits 4, 5, 6, or 7.
• The encoder defined in Table 4.7 has the limitation that only one input can be active at any given
time. If two inputs are active simultaneously, the output produces an undefined combination. For
example, if D3 and D6 are 1 simultaneously, the output of the encoder will be 111 because all three
outputs are equal to 1.
• To resolve this ambiguity, encoder circuits must establish an input priority to ensure that only one
input is encoded.
• The output 111 does not represent either binary 3 or binary 6. To resolve this ambiguity, encoder
circuits must establish an input priority to ensure that only one input is encoded. If we establish a higher
priority for inputs with higher subscript numbers, and if both D3 and D6 are 1 at the same time, the output
will be 110 because D6 has higher priority than D3. Another ambiguity in the octal-to-binary encoder is
Prof. Anitha C S, Dept. of CSE (Data Science), SVIT Page 17
Digital Design and Computer Organization(BCS302)
that an output with all 0’s is generated when all the inputs are 0; but this output is the same as when D0 is
equal to 1. The discrepancy can be resolved by providing one more output to indicate whether at least one
input is equal to 1.
Priority Encoder
• In addition to the two outputs x and y , the circuit has a third output designated by V ; this is a
valid bit indicator that is set to 1 when one or more inputs are equal to 1.
• . If all inputs are 0, there is no valid input and V is equal to 0. The other two outputs are not
inspected when V equals 0 and are specified as don’t-care conditions.
• Input D3 has the highest priority, so, regardless of the values of the other inputs, when this input is
1, the output for xy is 11 (binary 3).
• D2 has the next priority level. The output is 10 if D2 = 1, provided that D3 = 0, regardless of the
values of the other two lower priority inputs. The output for D1 is generated only if higher priority
inputs are 0.
D0 D1 D2 D3 X Y V
0 0 0 0 X X 0
0 0 0 1 1 1 1
0 0 1 0 1 0 1
0 0 1 1 1 1 1
0 1 0 0 0 1 1
0 1 0 1 1 1 1
0 1 1 0 1 0 1
0 1 1 1 1 1 1
1 0 0 0 0 0 1
1 0 0 1 1 1 1
1 0 1 0 1 0 1
1 0 1 1 1 1 1
1 1 0 0 0 1 1
1 1 0 1 1 1 1
1 1 1 0 1 0 1
1 1 1 1 1 1 1
Multiplexer
• A multiplexer is a combinational circuit that selects binary information from one of many input lines
and directs it to a single output line
• The selection of a particular input line is controlled by a set of selection lines
• normally, there are 2𝑛 input lines and n selection lines whose bit combinations determine which input is
selected.
S Y
0 𝑰𝟎
1 𝑰𝟏
Truth Table
𝑦 = 𝑠 ′ 𝐼0 + 𝑠𝐼1
Boolean Expression
A 2-to-1 multiplexer consists of two inputs I0 and I1, one select input S and one output Y. Depending
on the select signal, the output is connected to either of the inputs. Since there are two input signals,
only two ways are possible to connect the inputs to the outputs, so one select is needed to do these
operations.
4:1 Multiplexer
Above figures represents block diagram ,truth table and implementation using basic gates of
4:1 multiplexer.
4x1 Multiplexer has four data inputs I0, I1, I2 & I3, two selection lines S0 & S1 and one output Y. One of
these 4 inputs will be connected to the output based on the combination of inputs present at these two
selection lines.
8:1 multiplexer
•
Design 4:1 MUX using only 2:1 MUX
n=3
Implement using multiplexer F (A, B, C, D) = (1, 3, 4, 11, 12, 13, 14, 15)
Three-State Gates
The buffer has a normal input, an output, and a control input that determines the state of the
output. When the control input is equal to 1, the output is enabled and the gate behaves like
a conventional buffer, with the output equal to the normal input. When the control input is
0, the output is disabled and the gate goes to a high-impedance state, regardless of the value
in the normal input. The high-impedance state of a three-state gate provides a special
Prof. Anitha C S, Dept. of CSE (Data Science), SVIT Page 24
Digital Design and Computer Organization(BCS302)
feature not available in other gates. Because of this feature, a large number of three-state
gate outputs can be connected with wires to form a common line without endangering
loading effects.
• The construction of multiplexers with three-state buffers is demonstrated in Fig. 4.30
. Figure 4.30(a) shows the construction of a two-to-one-line multiplexer with 2 three-state
buffers and an inverter. The two outputs are connected together to form a single output
line. (Note that this type of connection cannot be made with gates that do not have three-
state outputs.) When the select input is 0, the upper buffer is enabled by its control input
and the lower buffer is disabled. Output Y is then equal to input A . When the select input
is 1, the lower buffer is enabled and Y is equal to B .
Y=AS’+BS
s y
𝑦 = 𝑠 ′ 𝐼0 + 𝑠𝐼1
0 𝐼0
1 𝐼1
Timing Diagram
Sequential Logic
Sequential logic refers to a type of digital logic circuit that uses
memory elements to store information.
It consists of a combinational circuit to which storage elements are
connected to form a feedback path. The storage elements are devices
capable of storing binary information.
a sequential circuit is specified by a time sequence of inputs, outputs,
and internal states.
Storage Elements:
1)Latches:
Latches are digital circuits that serve as basic building blocks in the
construction of sequential logic circuits.
They are bistable, meaning they have two stable states and can be
used to store binary information. Latches are often used for
temporary storage of data within a digital system.
There are several types of latches, with the most common being the
• The SR latch has two inputs, S (Set) and R (Reset).It has two outputs,
Q and ~Q (complement of Q).
• When S is asserted, Q is set to 1, and when R is asserted, Q is reset
to 0.The SR latch is sensitive to the input conditions, and having both
S and R asserted simultaneously can lead to unpredictable behavior.
where S and R stand for set and reset. It can be constructed from a pair of cross-coupled NOR logic gates.
The stored bit is present on the output marked Q.
While the S and R inputs are both low, feedback maintains the Q and Q outputs in a constant state,
with Q the complement of Q. If S (Set) is pulsed high while R (Reset) is held low, then the Q output is forced
high, and stays high when S returns to low; similarly, if R is pulsed high while S is held low, then the Q output
is forced low, and stays low when R returns to low.
It consists of the basic SR latch and two additional NAND gates. The control input En
acts as an enable signal for the other two inputs. The outputs of the NAND gates stay
at the logic-1 level as long as the enable signal remains at 0. This is the quiescent
condition for the SR latch. When the enable input goes to 1, information from the S or
R input is allowed to affect the latch. The set state is reached with S = 1, R = 0, and
En = 1 active-high enabled). To change to the reset state, the inputs must be S = 0, R
= 1, and En = 1. In either case, when En returns to 0, the circuit remains in its
current state. The control input disables the circuit by applying 0 to En, so that the
state of the output does not change regardless of the values of S and R . Moreover,
when En = 1 and both the S and R inputs are equal to 0, the state of the circuit does
Prof. Anitha C S, Dept. of CSE (Data Science), SVIT Page 31
Digital Design and Computer Organization(BCS302)
not change. These conditions are listed in the function table accompanying the
diagram.
D latch(transparent latch)
A D latch can store a bit value, either 1 or 0. When its Enable pin is HIGH, the value
on the D pin will be stored on the Q output.
The D Latch is a logic circuit most frequently used for storing data in digital systems.
It is based on the S-R latch, but it doesn’t have an “undefined” or “invalid” state
problem.
One way to eliminate the undesirable condition of the indeterminate state in the
SR latch is to ensure that inputs S and R are never equal to 1 at the same time.
This is done in the D latch, shown in Fig. 5.6 . This latch has only two inputs: D
(data) and En (enable). The D input goes directly to the S input, and its
complement is applied to the R input. As long as the enable input is at 0, the
cross-coupled SR latch has both inputs at the 1 level and the circuit cannot
change state regardless of the value of D . The D input is sampled when En = 1.
The graphic symbols for the various latches are shown in Fig. 5.7 . A latch is
designated by a rectangular block with inputs on the left and outputs on the
right. One output designates the normal output, and the other (with the bubble
designation) designates the complement output
They are bistable multivibrators, like latches, but they are edge-
triggered and use a clock signal to control the timing of state changes.
Clk D S R Q Q’
0 1
Assume(previous output)
0 0 1 1 0 1
No Change
0 1 1 1 No Change
1 1 0 1 1 0
0 0 1 1 No change
1 0 1 0 0 1
JK FLIPFLOP
When both J = K = 1 and D = Q, the next clock edge complements the output.
When both J = K = 0 and D = Q, the clock edge leaves the output unchanged.
T Flipflop
T = 0 (J = K = 0), a clock edge does not change the output. When T = 1 (J = K = 1), a
clock edge complements the output. The complementing flip-flop is useful for
designing binary counters.
D=T^Q
D=T’Q+TQ’
Q(t) denotes the state of the flip-flop immediately before the clock edge, and
Q(t + 1) denotes the state that results from the clock transition.
Characteristic equation
It is the Boolean expression in terms of its input and output which determines
the next state of the flipflop.
T FF
DFF
JKFF
SR flipflop JK Flipflop
D flipflop T Flipflop
------------------------**************************************************--------------