Chapter 4 final
Chapter 4 final
Combinational Logic
• Use the Boolean Algebra and the
minimization techniques to design useful
circuits
• No feedback, no memory
• Just n inputs, m outputs and an arbitrary truth
table
Analysis Procedure
• We need to analyze digital circuits to verify
our designs (as well as understand designs
without documentation)
• Assume we have the logic diagram (and
some minimal info about the inputs)
Steps in Analysis
• Label all the outputs of the gates that are
connected directly to the inputs with (short)
arbitrary names
• Label all the outputs of the gates that are
connected directly to the previous set
• Repeat till all gates are done.
Symbolic Manipulation
• Substitute symbolically till all intermediate
symbols are gone
• Build the truth table
• HDL compiler packages have good tools to
speed this up
Design
• The purpose is to translate a high level
description of the circuit to a logic diagram
or something that is directly implementable
• Normally we are expected to minimize some
cost measure
Design Procedure
• Give short names to all inputs and outputs
• Derive truth table from the specification
• Simplify
• Draw diagram
HDLs
• The first two steps cannot be handled by
HDLs
– but the compiler packages provide tools
– there are libraries that can be reused or modified
• The other two are handled very well by
HDLs
Example: BCD-Exc3
• We design a converter from BCD to Excess-
3
• Excess-3 is essentially BCD+3
Truth Table
ABCD wxyz
0000 0011
0001 0100
0010 0101
0011 0110
0100 0111
0101 1000
0110 1001
0111 1010
1000 1011
1001 1100
1010 xxxx
1011 xxxx
1100 xxxx
1101 xxxx
1110 xxxx
1111 xxxx
Handicraft...
• The boolean expressions are
– w = A + BC + BD = A + B(C + D)
– x = B’C + B’D + BC’D’=B’(C+D)+B(C+D)’
– y = CD + C’D’ = CD + (C+D)’
– z = D’
• Notice that (C+D) and its negation appear 4
times
Half Adder
• 2 inputs, 2 outputs
• So simple that can be done without maps etc
– S = x’y + xy’
– C = xy
Half Adder Truth Table
xy CS
00 00
01 01
10 01
11 10
Full Adder
• A bit more interesting
• Adds 3 bits (2 bits plus a carry-in)
• Produces 2 outputs
• Needs maps
Full Adder Truth Table
xyz CS
000 00
001 01
010 01
011 10
100 01
101 10
110 10
111 11
Decoder
• A standard and quite useful MSI chip
• Has n input and 2^n outputs
• The output with number that corresponds to
the binary value of the input is high and the
rest are low
• Produces all the minterms
Enable pin
• Decoders usually have an ENABLE pin
• Very often ENABLE pins have negative
logic (active low)
• Without the ENABLE one of the decoder
outputs is always true
Many uses
• The main advantage of the ENABLE is that
it allows us to build big decoders out of
smaller ones.
• E.g. build a 4x16 decoder out of two 3x8 and
a 1x2.
Combinational Logic
• Decoders produce all the minterms
• So can be used to implement functions
• Very good for hard to minimize functions
• Very good for MSI-SSI implementations
MULTIPLEXERS
Combinational Logic using MUX
• Really useful things for implementing
complex logic
• When the MSIs ruled the world, MUXes
were kings
General Procedure
• The simplest way to design a combinational
circuit with N inputs is to use an N x (2^N)
MUX
– Connect the inputs to the control inputs
– Assign 1 to the data inputs that correspond to the
minterms, zero o/w
Too simple...
• Too simple to be mentally satisfying
• We could use a smaller MUX and very little
other hardware (or have more inputs)
General Procedure
• Assign the N control inputs of the MUX to
the first N inputs to the circuit we want to
design
• Separate the truth table to 2^N blocks
• Treat each block as an individual truth table
and minimize it
Advantages
• We can implement efficiently quite large
combinational circuits
– with a 16x4 MUX we can implement a 10 input
circuit using nothing but maps.
• Can attempt to minimize further by assigning
different inputs to the control inputs of the
MUX
Disadvantages
• It is not always a standard form (AND-OR
or OR-AND)
• The advantages are less significant if we do
not use MSI
Combinational Circuits
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, as an aggregate, generate the binary code
corresponding to the input value.
An example of 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
Combinational Circuits
Combinational Circuits
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. 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
Combinational Circuits
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 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
Combinational Circuits
Priority Encoder
A priority encoder is an encoder circuit that includes the
priority function.
The operation of the priority encoder is such that if two or
more inputs are equal to 1 at the same time, the input having
the highest priority will take precedence.
The truth table of a four-input priority encoder is given in
Table 4.8.
Combinational Circuits
Nested Modules
Two or more modules can be combined to build a
hierarchical description of a design.
A module can instantiate other modules. Instantiation
means allocation of needed hardware
HDL Models of Combinational Circuits
HDL Models of Combinational Circuits
HDL Models of Combinational Circuits
HDL Models of Combinational Circuits
2. Dataflow Modeling
Dataflow modeling of combinational logic uses a
number of operators that act on binary operands to
produce a binary result.
Verilog HDL provides about 30 different operators.
HDL Models of Combinational Circuits
3. Behavioral Modeling
Behavioral modeling represents digital circuits at a
functional and algorithmic level.
It is used mostly to describe sequential circuits, but can
also be used to describe combinational circuits.
HDL Models of Combinational Circuits
Uses the keyword always and C-like procedural
assignments (blocking) to entities of type reg
HDL Example 4.7 shows the behavioral description of a
two-to-one-line multiplexer.
Since variable m_out is a target output, it must be
declared as reg data (in addition to the output
declaration).
HDL Models of Combinational Circuits