COMBINATIONAL AND SEQUENTIAL CIRCUITS-unit-2
COMBINATIONAL AND SEQUENTIAL CIRCUITS-unit-2
SEQUENTIAL CIRCUITS
COMBINATIONAL AND SEQUENTIAL
CIRCUITS
in digital systems
• Define the terms adder, Mux Dmux, Alu, Latch, Flip-Flop
Digital Design
Combinational
Sequential
Combinational Logic
Unlike Combinational Logic circuits that change state depending upon the
actual signals being applied to their inputs at that time, Sequential Logic
circuits have some form of inherent "Memory" built in to them as they are
able to take into account their previous input state as well as those actually
present, a sort of "before" and "after" is involved with sequential circuits.
In other words, the output state of a "sequential logic circuit" is a function of
the following three states, the "present input", the "past input" and/or the
"past output". Sequential Logic circuits remember these conditions and stay
fixed in their current state until the next clock signal changes one of the
states, giving sequential logic circuits "Memory".
HALF ADDER
• Logic device that adds
Input Output Logic
two binary numbers Symbol:
A (sum)
• Only adds Least Half
Significant Digit (LSD) B Adder C0 (carry out)
column (1s column) in
binary addition
Logic
Diagram:
S = A`B+AB` = A⊕B
C = AB
o To implement half adder using NAND gates; we
require 5 NAND gates.
FULL ADDER
Used for adding binary place values other than the 1s place
Input Output
Logic Cin (sum)
Symbol: Full
A
B Adder C0 (carry out)
Logic
Diagram:
Full Adder
• Sum S X
Adding two single-bit binary values, X, Y
XY
with a carry input bit C-in produces a C-in 00 01 11 10
sum bit S and a carry out C-out bit. 0 2 6 4
Full Adder Truth Table 0 1 1
Inputs Outputs 1 3 7 5
1 1 1 C-in
X Y C-in S C-out
0 0 0 0 0 Y
S = X’Y’(C-in) + XY’(C-in)’ + XY’(C-in)’ + XY(C-in)
0 0 1 1 0 S = X Å Y Å (C-in)
0 1 0 1 0 Carry C-out X
0 1 1 0 1 XY
1 0 0 1 0 C-in 00 01 11 10
0 2 6 4
1 0 1 0 1 0 1
1 1 0 0 1 1 3 7 5
1 1 1 1 C-in
1 1 1 1 1
S(X,Y, C-in) = S (1,2,4,7) Y
C-out(x, y, C-in) = S (3,5,6,7) C-out = XY + X(C-in) + Y(C-in)
Full Adder Circuit Using AND-OR
X’ X’Y’C-in
X Y’
X X’ C-in
X’
Y
X’YC-in’ Sum S
Y C-in’
Y Y’ X
Y
C-in C-in’ X
Y
C-in’ XYC-in
X Y X XY
Y
Full
C-out C-in X
XC-in
Adder C-out
C-in
Y
S
C-in YC-in
Cont..
Sum-2 gates
Carry 3- gates
HALF SUBTRACTOR
Subtracts LSD column in binary subtraction
Input Output
Logic A Di (difference)
Symbol: Half
Subtractor
B B0 (borrow out)
Logic
Diagram:
FULL SUBTRACTOR
Input Output
Logic Bin Di (difference)
Symbol: Full
A
Subtractor
B B0 (borrow out)
Full Subtractor
Difference D X
XY
Subtracting two single-bit binary values, Y, B-in from
B-in 00 01 11 10
a single-bit value X produces a difference bit D and a 6
0 2 4
borrow out B-out bit. This is called full subtraction. 0 1 1
Full Subtractor Truth Table 1 3 7 5
Inputs Outputs 1 1 1 B-in
X Y B-in D B-out Y
0 0 0 0 0 S = X’Y’(B-in) + XY’(B-in)’ + XY’(B-in)’ + XY(B-in)
S = X Å Y Å (C-in)
0 0 1 1 1
0 1 0 1 1 Borrow B-out X
0 1 1 0 1 XY
1 0 0 1 0 B-in 00 01 11 10
0 2 6 4
1 0 1 0 0 0 1
1 1 0 0 0 1 3 7 5
1 1 1 1 B-in
1 1 1 1 1
Y
S(X,Y, C-in) = S (1,2,4,7)
B-out = X’Y + X’(B-in) + Y(B-in)
C-out(x, y, C-in) = S (1,2,3,7)
Full Subtractor Circuit Using AND-OR
X X’ X’Y’B-in
X X’ Y’
B-in
Y X’
X’YB-in’ Difference D
Y
Y Y’ B-in’
X
B-in Y
B-in B-in’ B-in’ XY’B-in’
X
Y
B-in’ XYB-in
X Y X’ X’Y
Y
Full
B-out B-in X’
X’B-in
Subtractor B-out
B-in
Y
D
B-in YB-in
Full Subtractor Circuit Using XOR
Y Difference D
X Y B-in
Full X’ X’Y
B-out B-in
Subtractor Y
X’
X’B-in
B-out
D B-in
Y
B-in YB-in
Full Subtractor
Addition
Adding bits:
0+0= 0
0+1= 1
1+0= 1
carry
1 + 1 = (1) 0
Adding integers:
1 1 0
0 0 0...... 0 1 1 1 two = 7ten
+ 0 0 0...... 0 1 1 0 two = 6ten
= 0 0 0 . . . . . . 1 (1)1 (1)0 (0)1 two = 13ten
Ripple Carry Adder (RCA)
x3 y3 x2 y2 x1 y1 x0 y0
cout=c4 FA FA FA FA c0=cin
s3 s2 s1 s0
1
0 1 1 0 = 6
1
In subtraction also borrow will be passed to next stage like addition
Complements
n
(r 1) N r-1 complement
n
r N r complement
9’s and 10’s Complements
M–N
• Add M to r’s complement of N
Sum = M+(rn – N) = M – N+ rn
• If M > N, Sum will have an end carry r , discard it
n
65438 - 5623
65438
10’s complement of 05623 +94377
159815
Discard end carry 105 -100000
Answer 59815
Subtraction with Complements of
Unsigned
5623 - 65438
05623
10’s complement of 65438 +34562
40185
There is no end carry =>
-(10’s complement of 40185)
-59815
Subtraction with Complements of Unsigned
10110010 - 10011111
10110010
2’s complement of 10011111 +01100001
100010011
Discard end carry 2^8 -100000000
Answer 000010011
Subtraction with Complements of
Unsigned
10011111 -10110010
10011111
2’s complement of 10110010 +01001110
11101101
There is no end carry =>
-(2’s complement of 11101101)
Answer = -00010011
Adder
X Y C S
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
Adder
X Y C S
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
Half Adder
X Y C S
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
Full Adder
A combinational circuit that adds 3 input bits to generate a Sum bit and a Carry
bit
Full Adder
A combinational circuit that adds 3 input bits to generate a Sum bit and a Carry
bit
Sum YZ
X Y Z C S
X 00 01 11 10
0 0 0 0 0 0 0 1 0 1 S = X’Y’Z +
0 0 1 0 1 X’YZ’ + XY’Z’
1 1 0 1 0 +XYZ
0 1 0 0 1
Carry =XYZ
0 1 1 1 0
YZ
1 0 0 0 1 X 00 01 11 10
1 0 1 1 0 0 0 0 1 0
1 1 0 1 0 1 0 1 1 1
1 1 1 1 1 C = XY + YZ + XZ
Full Adder = 2 Half Adders
Think of
Z as a
carry in
1 0 0 0
0101
0110
1011
Binary Parallel Adder
S = A + ( -B)
Adder/Subtractor
0 : Add
1: subtract
N Log2(N) N Log2(N)
2 1 512 9
4 2 1024 10
8 3 2048 11
16 4 4096 12
32 5 8192 13
64 6 16384 14
128 7 32768 15
256 8 65536 16
Combinatorial Logic
Select Data
When A D0 D1 Out
A=0, 0 0 0 0
Out is 0 0 1 0
same 0 1 0 1
as D0, 0 1 1 1
when
1 0 0 0
A=1,
1 0 1 1
Out is
same 1 1 0 0
as D1 1 1 1 1
Algebra for 2-to-1 MUX
A B\S 0 1
0 0 0 0
0 1 0 1
1 1 1 1
1 0 1 0
Gates for 2-to-1 MUX
V1
5V
J5
Key = A
U1
NOT
X1
J1
U2
2.5 V
Key = 0 AND2 U4
J2
U3 OR2
Key = 1 AND2
4-to-1 MUX: truth table
Select Data
Out
A B D0 D1 D2 D3
0 0 D0 D1 D2 D3 D0
0 1 D0 D1 D2 D3 D1
1 0 D0 D1 D2 D3 D2
1 1 D0 D1 D2 D3 D3
V1
5V
J5
Key = A
U1
NOT
J6
Key = B
U2
NOT
J1
U3
Key = 0 AND3
X1
J2
U4
Key = 1
U7
2.5 V
One output
Many inputs
AND3
J3
U5
OR4
Key = 2 AND3
J4
U6
Key = 3 AND3
Addresses
If any of several signals was put onto a single carrier, then at the
other end the signals must be separated and each sent to the
appropriate destination.
One input (the shared channel) is routed to one of several outputs.
• Like mail, it is possible for me to send a message to any individual one of
you. So there must be a set of paths from me to each of you, and there must
be a mechanism for selecting one of those paths in a particular instance.
In addition to data input, there must be select inputs.
• To select from 2 N
data outputs requires N select inputs.
Demultiplexing
J5
Key = A
U1
NOT
J6
Key = B
U2
NOT
J1 X1
U3
Many outputs
2.5 V
U4 X2
AND3 2.5 V
U5 X3
AND3 2.5 V
U6 X4
AND3 2.5 V
Decoder
Decoding - the
• Conversion of n-bit input to m-bit output
• Given n £ m £ 2 n
variables
Decoder Examples
1-to-2-Line Decoder A D0 D1
D0 5 A
0 1 0
1 0 1 A D1 5 A
2-to-4-Line Decoder (a) (b)
A0
A1 A0 D 0 D1 D2 D3
A1
0 0 1 0 0 0 D0 5 A 1 A 0
0 1 0 1 0 0
1 0 0 0 1 0
1 1 0 0 0 1 D1 5 A 1 A 0
(a)
D2 5 A 1 A 0
Note that the 2-4-line
made up of 2 1-to-2- D3 5 A 1 A 0
D0
A0
D1
A1
D2
2-to-4-Line D3
decoder
D4
A2 D5
1-to-2-Line decoders D6
D7
A
demultiplexer 0
D 0
EN A 1 A 0 D0 D1 D2 D3 D1
0 X X 0 0 0 0
1 0 0 1 0 0 0 D2
1 0 1 0 1 0 0
1 1 0 0 0 1 0
D3
1 1 1 0 0 0
(b)
The circuit functionality of a 1 bit ALU is shown here,
depending upon the control signal S1 and S0 the circuit operates
as follows:
Flip=Flo
p
Latch
Latches and Flip-flops
"load"
"data" "stored bit"
LATCH
Set Reset
Two Type
(SR)
Reset (R)
input : LOW
NOR Gate
or 0 state Latch
NAND GATE LATCH
Flip-flops
Latches
A latch is a temporary storage device that has two stable states
(bistable). It is a basic form of memory.
The S-R (Set-Reset) latch is the most basic type. It can be constructed
from NOR gates or NAND gates. With NOR gates, the latch responds to
active-HIGH inputs; with NAND gates, it responds to active-LOW inputs.
OR
Latches
A gated latch is a variation on the basic latch.
The gated latch has an additional input, called enable (Clk) that must be
HIGH in order for the latch to respond to the S and R inputs.
Keep in mind that S and R are only active when Clk is HIGH.
D Latches
The D latch is an variation of the S-R latch but combines the S
and R inputs into a single D input as shown:
A simple rule for the D latch is: Q follows D when the Enable is active.
Asynchronous (Ripple) Counters
J Q0 J Q1
CLK C C
Q0
K K
FF0 FF1
CLK 1 2 3 4
Q0 Timing diagram
00 01 10 11 00 ...
Q0 0 1 0 1 0
Q1 0 0 1 1 0
Asynchronous (Ripple) Counters
J Q0 J Q1 J Q2
CLK C Q0 C Q1 C
K K K
FF0 FF1 FF2
CLK 1 2 3 4 5 6 7 8
Q0 0 1 0 1 0 1 0 1 0
Q1 0 0 1 1 0 0 1 1 0
Q2 0 0 0 0 1 1 1 1 0
Recycles back to 0
Registers
Register – a collection of binary storage elements
In theory, a register is sequential logic, i.e. can be defined by a state
table
But more often, we think of a register as an array of n flip flops
(possibly with some extra gates) that store a vector of n binary bits
Used to perform simple data storage, movement, manipulation and
processing operations (e.g. load, increment, shift, add, etc.)
The computer processes data by performing operations on
registers, e.g. ADD A, B where A and B are say 32-bit registers