chap4 DLD
chap4 DLD
Combinational Circuits
Analysis Procedure
Design Procedure
Binary Adder-Subtractor
Decimal Adder
Binary Multiplier
Magnitude Comparator
Decoders
Encoders
Priority Encoder
Multiplexers
Tri-state gates
Combinational Circuits
• Logic circuits for digital system may be combinational
or sequential
– A combinational circuit consists of logic gates whose outputs are a
function of the current inputs
– Sequential circuits
» contain storage elements in addition to logic gates
» the outputs are a function of the current inputs and 1
Half adder
Binary Adder
• A binary adder is a digital circuit that produces the
arithmetic sum of two binary numbers.
• A binary adder can be implemented using multiple full
adders (FA) connected in cascade with the output
carry from each full adder to the input carry of the
next full adder in the chain
Binary 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 S outputs generate the required sum bits
Binary Adder
• Consider the two binary numbers, A= 1011 and B= 0011
• Their sum S= 1110 is formed with four-bit adders
• The bits are added with full adders, starting from the
least significant position (subscript 0), to form the sum
bit and carry bit
• The input carry C0 in the least significant position must
be 0
• The value of Ci+1 in a significant position is the output
carry of the full adder Subscript i 3 2 1 0
Augend 1 0 1 1 A
input carry of the full adder that Addend i
0 0 1 1 B
i
Output carry 0 0 1 1 C
position to the left i+1
Binary Adder
• The sum bits are thus generated starting from the
rightmost position and are available as soon as the
corresponding previous carry bit is generated
• All the carries must be generated for the correct sum
bits to appear at the outputs
Subscript i 3 2 1 0
Input carry 0 1 1 0 Ci
Augend 1 0 1 1 Ai
Addend 0 0 1 1 Bi
Sum 1 1 1 0 Si
Output carry 0 0 1 1 Ci+1
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
• In any combinational circuit, the signal must
propagate through the gates before the correct output
is available in the output terminals.
• The Total propagation time = propagation delay of a
typical gate X the number of gate levels
• The longest propagation delay time in a binary adder
is the time it takes the carry to propagate through the
full adders.
• This is because each bit of the sum output depends
on the value of the input carry. This makes the binary
adder very slow.
Carry Propagation
• Since each bit of the sum output depends on the value
of input carry, the value of Si in any given stage in the
adder will be in its steady state final value only after
the input carry to the stage has been propagated
• Consider output S3 in Figure 4-9. Inputs A3 and B3 are
available as soon as input signals are applied to the
adder, however input carry C3 doesn’t settle to its final
value until C2 is available from the previous stage
• Similarly C2 has to wait for C1 and so on down to C0
• In this way only after the carry propagates and ripples
through all stages will the last output S3 and carry C4
settle to their final correct value
Carry Propagation
• The number of gate levels for the carry propagation
can be found from the circuit of the full adder
• The input and output variables use the subscript i to
denote a typical stage in the adder
• The signals at Pi and Gi settle to their steady state
values after they propagate through their respective
gates
Carry Propagation
• These two signals are common to all full adders and
depend only on the augend and addend bits
• The signal from the input carry Ci to the output carry
Ci+1 propagates through an AND gate and an OR gate,
which constitutes two gate levels
• If there are four full adders in the adder, the output
carry C4 would have 2 x 4 = 8 gate levels from C0 to C4.
• For an n-bit adder, there are 2n gate levels for the
carry to propagate from input to output
• The outputs of a combinational circuit will not be
correct unless the signals are given enough time to
propagate through the gates connected from inputs to
outputs
• All other arithmetic operations are implemented by
successive additions, the time consumed during the
addition process is very critical.
Carry Propagation
• One choice to reduce the carry propagation delay is to
employ faster gates but the most widely used
technique for reducing the carry propagation time in
parallel adder is principle of carry lookahead
• Consider the circuit of full adder shown in fig 4-10
• If we define two binary variables
– carry propagate: Pi = AiBi (Term associated with the propagation of
carry from Ci to Ci+1)
– carry generate: Gi = AiBi (Produces 1 when both Ai and Bi are 1)
• Output sum and carry can be expressed as
– sum: Si = PiCi
– carry: Ci+1 = Gi+PiCi
Carry Propagation
• We now write the Boolean functions for the carry
outputs of each stage and substitute for each Ci, its
value from the previous equation
– Co= input carry
– C1 = G0+P0C0
– C2 = G1+P1C1
– = G1+P1(G0+P0C0)
– = G1+P1G0+P1P0C0
– C3 = G2+P2C2
– = G2+P2G1+P2P1G0+ P2P1P0C0
– C4 = G3+P3C3
– =G3+P3G2+P3P2G1+P3P2P1G0+P3P2P1P0C0
• Since the Boolean function for each output carry is
expressed in sum of products, each function can be
implemented with one level of AND gates followed by
an OR gate (or by two-level NAND )
Carry Look ahead Generator
• The four Boolean functions for C1, C2, C3 ,and C4 are
implemented in the carry look ahead generator shown
in Figure 4-11
• Here C4 doesn’t have to wait for C3, C2 and C1 to
propagate and C4 is propagated at the same time as
C1, C2, and C3.
Carry Look ahead Generator
Decides to add 6
Adds 6
BCD Adder
Numbers that need correction (add 6) are:
K Z8 Z4 Z2 Z1
0 1 0 1 0 (10)
0 1 0 1 1 (11)
0 1 1 0 0 (12)
0 1 1 0 1 (13)
0 1 1 1 0 (14)
0 1 1 1 1 (15)
1 0 0 0 0 (16)
1 0 0 0 1 (17)
1 0 0 1 0 (18)
1 0 0 1 1 (19)
C = K + Z8Z4 +Z8Z2
Binary Multiplier
• Multiplication of the binary number is performed in
the same way as in decimal numbers. The
multiplicand is multiplied by each bit of the multiplier
starting from the least significant bit
• Each such such multiplication forms a partial product.
Successive partial products are shifted one position
to the left. The final product is obtained from the sum
of the partial products
• Consider the binary multiplication of 2-bit numbers
where B1 and B2 are multiplicand bits and A1 and A0
are multiplier bits. C3 C2 C1 C0 are the product bits
Binary Multiplier
• The first partial product is formed by multiplying A0
by B1 B0. The multiplication of any two bits produces a
1 if both bits are 1, otherwise it produces a 0. This is
identical to AND operation. Therefore partial product
can be implemented with an AND gates as shown in
figure 4-15
• The second partial product is formed by multiplying
A1 by B1 B0 and shifted one position to the left
• The two partial products are added with two half adder
(HA) circuits. If there are more bits in the partial
products then we use full adders to produce the sum
of the partial products
• The least significant bit of the partial product doesn’t
have to go through an adder since it is formed by the
output of the first AND gate
K-bit by J-bit Binary Multiplier
• A combinational circuit for binary multiplier with
more bits can be constructed in a similar way. A bit
of the multiplier is ANDed with each bit of the
multiplicand in as many levels as there are bits in the
multiplier
• The binary output in each level of AND gate is added
with the partial product of the previous level to form
a new partial product. The last level produces the
product
• For J multiplier bits and K multiplicand bits we need
(J x K) AND gates and (J – 1) K bit adders to produce
a product of J + K bits
4-bit by 3-bit binary multiplier
• Consider a multiplier circuit that multiplies a binary
number of four bits by a number of three bits.
• Let the multiplicand is represented by B3 B2 B1 B0
and the multiplier by A2 A1 A0
• Since K = 4 and J = 3, we need 12 AND gates and
two 4 – bit adders to produce a product of seven
bits
B3 B2 B1 B0 Multiplicand
X A2 A 1 A0 Multiplier
C6 C5 C4 C3 C2 C1 C0 Final Product
Magnitude Comparator
• The comparison of two numbers is an operation that
determines if one number is greater than, less than or
equal to the other number
• A magnitude comparator is a combinational circuit
that compares two numbers, A and B and determines
their relative magnitudes
• The outcome of the comparison is specified by three
binary variables that indicates whether A>B, A=B or
A<B
Magnitude Comparator
• If we follow the traditional design approach of truth
table then comparing two n-bit numbers will have 22n
entries in the truth table and becomes too
complicated for large values of n.
• However, a comparator circuit possess a certain
amount of regularity. Digital functions that possess an
inherent well defined regularity can usually be
designed by means of algorithmic procedure. This
reduce design efforts and reduce human errors
• An algorithm is a procedure that specifies a finite set
of steps, if followed, give the solution to a problem.
The algorithm is direct application of the procedure a
person uses to compare the relative magnitude of two
numbers
Developing Algorithm
• Consider the two numbers A and B, with four digits
each, the coefficients of numbers with descending
significance can be written as:
– A = A3A2A1A0 and B = B3B2B1B0
• The two numbers are equal if all pairs of significant
digits are equal:
– A=B if A3=B3, A2=B2, A1=B1and A0=B0
• For binary (either 1 or 0) digits the equality relation of
each pair of bits can be expressed logically with
exclusive-NOR function to test if Ai = Bi as
– xi = (Ai Bi)' = (AiBi'+Ai'Bi)' = AiBi+Ai'Bi' for i = 0,1,2,3
– xi = 1 only if the pair of bits in position i are equal otherwise x i = 0
• Therefore we can can check if A = B by
– (A=B) = x3x2x1x0
• The symbol (A=B) is binary output variable that is equal
to 1 only if all pair of digits of the two numbers are equal
Developing Algorithm
• To determine if A>B or A<B, we inspect the relative
magnitudes of pairs of significant digits starting from the
most significant position. If the two digits are equal, we
compare the next lower significant pair of digits. This
comparison continues until a pair of unequal digits is
reached
• If the corresponding digit of A is 1 and that of B is 0, we
conclude that A>B. If the corresponding digit of A is 0
and that of B is 1, we conclude that A<B
• The sequential comparison can be expressed logically by
the two Boolean functions
– (A>B) = A3B3'+x3A2B2'+x3x2A1B1'+x3x2x1 A0B0'
– (A<B) = A3'B3+x3A2'B2+x3x2A1'B1+x3x2x1 A0'B0
• The symbols (A>B) and (A<B) are binary output variables
that are equal to 1when A>B or A<B respectively
Developing Algorithm
• The gate implementation for a magnitude comparator
involves a certain amount of repetition so it is
simpler than it seems.
• The unequal outputs can use the same gates that are
needed to generate the equal output
• The logic diagram of the 4-bit magnitude comparator
is shown in Figure 4 – 17
• The four x outputs are generated with exclusive-NOR
circuits and applied to an AND gate to give the
output binary variable (A=B)
• The other two outputs use the x variable to generate
the Boolean functions
• The procedure for obtaining magnitude comparator
circuits for binary numbers with more than four bits
is obvious from the above steps
Decides if A3=B3
x3 = (A3B3'+A3'B3)'
=(A3 B3)'
x3A2'B2
= A3'B3+x3A2'B2+x3x2A1'B1+x3x2x1 A0'B0
= A3B3'+x3A2B2'+x3x2A1B1'+x3x2x1 A0B0'
Decoders
• A decoder is a combinational circuit that converts binary
information from n input lines to a maximum of 2n unique
output lines. Only one output can be active (high) at any time.
• Decoders are a class of combinational logic circuits that
convert a set of input variables representing a code into a set
of output variables representing a different code. The
relationship between the input and output codes can be
expressed in a truth table i.e 4-to-10-lines decoder circuit.
• If the n-bit coded information has unused combinations, the
decoder has fewer than 2n outputs
Decoder Applications
• Generate minterms/complement of minterms and are used for
functions implementation.
• Memory addressing- Decoders are widely used in the memory
system of a computer where they respond to the address code
generated by the central processor to activate a particular memory
location.
• Code Conversion. Example is BCD-to-7-segment decoder.
• DeMUX function.
• Used in conjunction with counters to decode (detect) counter
states and provide timing or sequencing signals.
• Provide enabling inputs when used in the design of MUXs with tri-
state gates.
• Computers communicate with peripheral devices (printers,
modems, scanners, keyboards, video monitors, external disk
drives and other computers) by sending and/or receiving data
through I/O ports. Decoders are used to select I/O as determined
by the computer to receive or send data.
Decoder Example (Code Converter)
• BCD-to-seven-segment display converter is one
common example of code converters, which converts
one BCD digit into information suitable for driving a
digit-oriented display.
3-to-8-Line Decoder
• A 3-to-8-Line Decoder is a decoder in which three
inputs are decoded into eight outputs, each
representing one of the minterms of the three
input variables.
• Each one of the eight AND gates generates one
of the minterms.
• A particular application of this decoder is binary-
to-octal conversion, however 3-to-8-line decoder
can be used for decoding any 3-bit code to
provide eight outputs, one for each element of
the code
3-to-8-Line Decoder Truth Table
Inputs Outputs
X Y Z D0 D1 D2 D3 D4 D5 D6 D7
0 0 0 1 0 0 0 0 0 0 0
0 0 1 0 1 0 0 0 0 0 0
0 1 0 0 0 1 0 0 0 0 0
0 1 1 0 0 0 1 0 0 0 0
1 0 0 0 0 0 0 1 0 0 0
1 0 1 0 0 0 0 0 1 0 0
1 1 0 0 0 0 0 0 0 1 0
1 1 1 0 0 0 0 0 0 0 1
Decoders with NAND gates
• Some decoders are constructed with NAND gates.
Since a NAND gate produces the AND operation with
inverted output, it becomes more economical to
generate the decoder minterms in their complemented
form. Decoder include one or more enable inputs to
control the circuit operation
• A 2-to4-line decoder with an enable input is shown
next. (see Fig).
– The circuit operates with complement outputs and a complement
enable input.
– The decoder is enabled when E is equal to 0 and disabled when E = 1
– The output whose value is equal to 0 represents the minterm selected
by inputs A and B.
– Only one output can be zero at any given time, all other outputs are 1
• Some decoders have two or more enable inputs that
must satisfy a given logic condition
Decoders with NAND gates
Demultiplexer
• A demultiplexer is a circuit that receives information
from a single line and directs it to one of 2n possible
output lines.
• The selection of a specific output is controlled by the
bit combination of n selection lines.
Demultiplexer
• A decoder with an enable input (Figure 4-19) can
function as demultiplexer (1-to-4-line demultiplexer)
– E is taken as data input line and A and B are takes as selection inputs
Constructing large Decoders
• Decoders with enable inputs can be connected
together to form a larger decoder circuit.
– two 3-to-8 decoder can be connected to form a 4-to-16 decoder
– The top decoder outputs generates minterms 0000 to 0111 and
the bottom decoder outputs generate minterms 1000 to 1111.
Generates from
0000 to 0111
Generates from
1000 to 1111
Encoders
• An encoder is a digital circuit that performs the
inverse operation of a decoder.
• An encoder has 2n (or fewer) input lines and n output
lines.
• The output lines generate the binary code
corresponding to the input value
Encoder Design Example
• An example of encoder is octal-to-binary encoder
• It has eight inputs (one for each 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. These conditions can
be expressed as by the Boolean functions as shown
in the next slide.
Truth Table: Octal to Binary Encoder
Outputs Inputs
X Y Z D0 D1 D2 D3 D4 D5 D6 D7
0 0 0 1 0 0 0 0 0 0 0
0 0 1 0 1 0 0 0 0 0 0
0 1 0 0 0 1 0 0 0 0 0
0 1 1 0 0 0 1 0 0 0 0
1 0 0 0 0 0 0 1 0 0 0
1 0 1 0 0 0 0 0 1 0 0
1 1 0 0 0 0 0 0 0 1 0
1 1 1 0 0 0 0 0 0 0 1
0 0 0 0 x x 0
1 0 0 0 0 0 1
x 1 0 0 0 1 1
x x 1 0 1 0 1
x x x 1 1 1 1