Chapter 3-CombinationalLogicDesign
Chapter 3-CombinationalLogicDesign
Combinational Logic
Design
M. Morris Mano, Charles R. Kime. (2015). Logic and computer design fundamentals (5th ed.). Pearson.
1
Contents
2
Contents
3
1. Combinational Functional Blocks
7
Enabling
9
3. Decoding
10
3. Decoding
• 2-to-4-Line Decoder
𝐴1 𝐴0
• 3-to-8-Line Decoder
A2 A1 A0 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
12
Decoder and Enabling Combinations
13
Structural Verilog Description of 2–to–4-Line
Decoder
A1_n
A0_n
N0
N1
N2
N3 14
Dataflow Verilog Description of 2–to–4-Line
Decoder
A1_n
A0_n
N0
N1
N2
N3 15
Decoder-Based Combinational Circuits
16
Decoder-Based Combinational Circuits
17
4. Encoding
18
4. Encoding
19
Priority Encoder
• A priority encoder is a
combinational circuit that
implements a 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 takes
precedence.
• The valid output designated by V
is set to 1 only when one or more
of the inputs are equal to 1. Among the 1s that appear, it selects
the most significant input position.
20
5. Selecting
23
2-to-1-Line Multiplexer
24
2n-to-1-Line Multiplexer
25
4-to-1-Line Multiplexer
• 2-to-22-line decoder
• 22 2 AND-OR
26
Structural Verilog Description for a 4-to-1-Line
Multiplexer
Not_S[0]
Not_S[1] D[0]
N[0]
D[1]
N[1]
D[2]
N[2]
D[3]
N[3]
27
Dataflow Verilog Description for a 4-to-1-Line
Multiplexer
28
6. Iterative Combinational Circuits
• Arithmetic functions
• Operate on binary vectors
• Use the same subfunction in each bit position
• Can design functional block for subfunction and repeat to obtain
functional block for overall function
• Cell - subfunction block
• Iterative array - a array of interconnected cells
• An iterative array can be in a single dimension (1D) or multiple
dimensions
29
6. Iterative Combinational Circuits
30
6. Binary Adders
31
Half Adder
Y Y
S C
0 1 0 1
0 1 0
X X
1 1 1 1
K-Maps
33
Full Adder
35
Binary Ripple Carry Adder Description Subscript Name
3210
Carry In 0110 Ci
Augend 1011 Ai
• Example: 4-bit ripple carry adder Addend 0011 Bi
• A four-bit Ripple Carry Adder made Sum 1110 Si
from four 1-bit Full Adders Carry out 0011 Ci+1
C0 is assumed
to be zero, or
we can use a
half adder for
A0 and B0
36
full_adder
37
8. Binary Subtraction
38
8. Binary Subtraction
• 0 1 End Borrow
1001 0100
- 0111 - 0111
00010 1101
Step 3
10000
- 1101
(-) 0011
39
Complements
• There are two types of complements for each base-r system: the radix complement, and the
diminished radix complement.
• Diminished Radix Complement of N
• (r - 1)’s complement for radix r
• 1’s complement for radix 2
• Defined as (rn - 1) – N
• Obtained by complementing each individual bit (bitwise NOT).
• Radix Complement
• r’s complement for radix r
• 2’s complement in binary
• Defined as rn – N
• Is the 1's complement plus 1, a fact that can be used in designing hardware
40
Unsigned Subtraction with 2’s Complement
41
Unsigned Subtraction with 2’s Complement
43
Signed Integers
• Positive numbers and zero can be represented by unsigned n-digit, radix r numbers.
We need a representation for negative numbers.
• To represent a sign (+ or –) we need exactly one more bit of information (1 binary
digit gives 21 = 2 elements which is exactly what is needed).
• Since computers use binary numbers, by convention, the most significant bit is
interpreted as a sign bit:
• s an–2 … a2a1a0
where:
s = 0 for Positive numbers
s = 1 for Negative numbers
and ai = 0 or 1 represent the magnitude in some form.
44
Signed Integers
45
Signed Integers
• Addition:
1. Add the numbers including the sign bits, discarding a carry out of the
sign bits
2. If the sign bits were the same for both numbers and the sign of the
result is different, an overflow has occurred.
3. The sign of the result is computed in step 1.
• Subtraction:
• Take the 2’s complement of the subtrahend (including the sign bit) and add it to the
minuend (including the sign bit). A carry out of the sign bit position is discarded.
47
Signed 2’s Complement Arithmetic
49
C4 S3 S2 S1 S0
Overflow Detection
• Overflow occurs if n + 1 bits are required to contain the result from an n-bit
addition or subtraction
• Unsigned numbers
• When two unsigned numbers are added, an overflow is detected from the end carry
out of the most significant position. In unsigned subtraction, the magnitude of the
result is always equal to or smaller than the larger of the original numbers, making
overflow impossible.
• Signed Numbers
• Overflow can occur for:
• Addition of two operands with the same sign
• Subtraction of operands with different signs
50
Overflow Detection
Overflow Overflow
• An overflow condition can be detected by observing the carry into the sign
bit position and the carry out of the sign bit position. If these two carries are
not equal, an overflow has occurred.
If V = 0 after a signed
addition or subtraction, it
indicates that no overflow
has occurred and the result
is correct. If V = 1, then an
51
overflow has occurred.
Verilog HDL Models of Adders
hs
hc tc
52
Behavioral Verilog for a 4-Bit Ripple Carry
Adder
53