Docsity

Combinational Logic - Design and Analysis - Lecture Notes, Study notes of Digital Systems Design

Toggle sidebar
bg1
1
COEN 312 DIGITAL SYSTEMS DESIGN - LECTURE NOTES
Chapter 4: Combinational Logic
NOTE: For more examples and detailed description of the material in the lecture
notes, please refer to the main textbook:
Digital Design 3rd Edition, By Morris Mano, Publisher Prentice Hall, 3rd Edition
All examples used in the lecture notes are from the above reference.
Combinational Circuits
- A combinational circuit consists of input variables, output variables, and logic gates
that transform binary information from the input data to the output.
Combinational
circuit
n inputs m outputs
- A combinational circuit cannot have any storage elements (registers) or any feedback
paths (connections from the output of one gate to the input of a second gate that
directly or indirectly affects the input to the first gate).
- As an example, consider the following combinational circuit with 3 inputs and 2
outputs (n = 3, m = 2):
F’2
A
B
C
A
B
C
A
B
A
C
B
C
T1
T2
T3
F2
F1
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26

Partial preview of the text

Download Combinational Logic - Design and Analysis - Lecture Notes and more Study notes Digital Systems Design in PDF only on Docsity!

COEN 312 DIGITAL SYSTEMS DESIGN - LECTURE NOTES

Chapter 4: Combinational Logic NOTE: For more examples and detailed description of the material in the lecture notes, please refer to the main textbook: Digital Design 3rd Edition, By Morris Mano, Publisher Prentice Hall, 3rd Edition All examples used in the lecture notes are from the above reference.

Combinational Circuits

  • A combinational circuit consists of input variables, output variables, and logic gates that transform binary information from the input data to the output.

Combinational n inputs circuit m outputs

  • A combinational circuit cannot have any storage elements (registers) or any feedback paths (connections from the output of one gate to the input of a second gate that directly or indirectly affects the input to the first gate).
  • As an example, consider the following combinational circuit with 3 inputs and 2 outputs ( n = 3, m = 2):

F ’ 2

A B C A B C A B A C B C

T 1

T 2

T 3

F 2

F 1

  • If there are more than two levels of gates to generate a function, label the output of the corresponding gates and determine the Boolean expression for each of them (here, we have used the labels T 1 , T (^) 2 , T (^) 3 , and F ’ 2 to find the Boolean expression for F 1 ).

1 3 2

3 2 1

2

1

2

F T T

T F T

T ABC

T A B C

F AB AC BC

  • By using the properties of Boolean algebra, the expression for F 1 will be equal to:

F 1 = A '. B. C '+ A '. B '. C + A. B '. C '+ A. B. C

  • The truth table for the outputs of this combinational circuit can be obtained by using the above expressions obtained for and , or by using the labeled gate outputs in the truth table and obtaining

F 1 F 2

F 1 (^) = T 3 + T 2 and F 2 (^) = A. B + A. C + B. C for different combinations of the input variables as follows:

A B C F 2 F ’ 2 T 1 T 2 T 3 F 1

X

X

CD

AB

D ’ D D ’

C ’ C

X

1 0 X

X

X

B ’

B ’

B

A ’

A

  • Simplified expression: z = D '

X

X

CD

AB

D ’ D D ’

C ’ C

X

1 0 X

X

X

B ’

B ’

B

A ’

A

  • Simplified expression: y = C. D + C '. D '

X

X

CD

AB

D ’ D D ’

C ’ C

X

0 1 X

X

X

B ’

B ’

B

A ’

A

  • Simplified expression: x = B '. C + B '. D + B. C '. D '

X

X

CD

AB

D ’ D D ’

C ’ C

X

1 1 X

X

X

B ’

B ’

B

A ’

A

  • Simplified expression: w^ = A + B. C^ + B.^ D

Binary Adder-Subtractor

  • A combinational circuit that implements the addition of two bits is referred to as a half adder.
  • A combinational circuit that implements the addition of three bits (two significant bits and a previous carry) is referred to as a full adder.
  • A full adder can be implemented by using two half adders.
  • Assuming that S and C denote the sum and the carry (the higher significant bit in the binary sum) of the two input variables of a half adder, we will have:

x y C S 0 0 0 0 0 1 0 1 1 0 0 1 1 1 1 0

C x y

x y

S x y xy

.

S

C

x y ’ x ’ y x y

x y S

C

  • For a full adder, where the third input z denotes the carry corresponding to the addition of the previous lower significant position we have:

x y z C S 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1

yz x x ’

x

z ’ z z ’

y ’ y

  • Simplified expression: S = x '. y '. z + x '. y. z '+ x. y '. z '+ x. y. z or: S = x āŠ• y āŠ• z
  • One can construct an n -bit binary adder with n full adders in series, by connecting each output carry to the input carry of the next higher-order full adder.
  • For example, a four-bit binary adder is given below:

FA

S 3

B 3 A 3

FA C 0

S 0

B 0 A 0

FA^ C^1

S 1

B 1 A 1

FA^ C^2

S 2

B 2 A 2

C 3

C 4

  • For A = A 3 A 2 A 1 A 0 = 1011 and B = B 3 B 2 B 1 B 0 = 0011 , we will have:

Subscript i : 3 2 1 0 Input Carry 0 1 1 0 Ci Augend 1 0 1 1 Ai Addend 0 0 1 1 B B i Sum 1 1 1 0 Si Output Carry 0 0 1 1 Ci +

  • Note that in this circuit we have nine inputs and , and

so the implementation of the corresponding circuit using the method of Chapter 3 would require a truth table with rows (if we ignore the input carry since it must be zero, we will have 256 rows).

A 0 , A 1 , A 2 , A 3 , B 0 , B 1 , B 2 , B 3 , C 0

2 9 = 512 C 0

  • The signal must propagate through the gates before the correct output sum is available and the longest propagation delay time in an adder is the time it takes for the carry to propagate through the full adders.
  • The output of each full adder will not settle to its final value until the input carry is available from the previous stage.

A (^) i Pi Bi

Ci

Ci +

Si

Gi

  • For a full adder, the carry propagates through an AND gate and an OR gate which constitutes two gate levels, which implies that in an n -bit adder, the carry propagates from input to output through 2 n gate levels.
  • Use faster gates with reduced delays.
  • Reduce the carry delay time by increasing the equipment complexity properly.
  • One of the popular methods for this purpose is to use carry lookahead as follows:

i i i

i i i G A B

P A B

  • Pi and Gi are referred to as carry propagate and carry generate respectively.
  • The output sum and carry can then be written as:

i i i i

i i i C G PC

S P C

1 = +^.

  • We now use iterations to obtain each output carry directly from the input carry

as follows:

Ci + 1 C 0

  • Binary subtraction A āˆ’ B can be done by adding A to the 2’s complement of B (which can be obtained by adding one to the 1’s complement).
  • The logic circuit for a 4-bit adder subtractor is given as follows:

FA

S 3

B 3 A 3

FA C 0

S 0

B 0 A 0

FA^ C^1

S 1

B 1 A 1

FA^ C^2

S 2

B 2 A 2

C 3

C 4

M

  • The mode input M controls the output.
  • When M is 0, then and the input carry is 0 which means that the output of the circuit is equal to

B āŠ• 0 = B

A plus B.

  • When M is 1, we have B āŠ• 1 = B ' and the input carry is 1, which implies that the output is equal to A plus the 1’s complement of B plus 1. This means that the output is A minus B (provided that there is no overflow).
  • Addition of two n -bit numbers which are both positive or both negative, may result in an overflow, i.e., the result may exceed the capacity of an n -bit register. This is shown for 8-bit registers below:

Carries: 0 1 +70 0 1000110 +80 0 1010000 +150 1 0010110

Carries: 1 0 -70 1 0111010 -80 1 0110000 -150 0 1101010

  • In general, an overflow can be detected by applying exclusive-OR operation on the input carry and output carry of the sign bit position (the leftmost digit).
  • Note that if the last two carries were equal, there would be no overflow.
  • For example, for the 4-bit adder subtractor, we will have:

C 4

C 3^ V

  • If the numbers are unsigned (the numbers are considered positive and the leftmost bit does not represent the sign), the circuit performs A minus B if A ≄ B or the 2’s complement of B^ minus A^ if A^ ≤ B.
  • For two unsigned numbers, the output carry of the leftmost bits detects a carry after addition or a borrow after subtraction.

Carry: 1 70 1000110 80 1010000 150 0010110

Decimal Adder

  • The most common way to code a decimal number is binary coded decimal (BCD), where the decimal number is represented by encoding each digit in binary form.
  • Applying two BCD digits to a 4-bit binary adder will result in a number ranging from 0 to 9+9+1=19 as shown in the following table:

C = K + Z 8. Z 4 + Z 8. Z 2

  • It can be easily seen that a correction can be made by adding 0110 to the binary sum and providing an output carry for the next stage.
  • The following figure shows a BCD adder (the input and the output are BCD digits).

Output carry C

S 8 S 4 S 2 S 1

K 4-bit binary adder Z 8 Z 4 Z 2 Z 1

Addend Augend

4-bit binary adder

Carry in

  • From this circuit it can be seen that if the output carry ( C ) is equal to 1, binary number 0110 is added to the binary sum.
  • The output carry ( C ) is, in fact, equal to the output carry generated from the bottom adder.

Binary Multiplier

  • Multiplication of binary numbers is similar to the multiplication of decimal numbers as shown below for a 2-bit binary number:

B B 1 B B 0 A (^) 1 A 0 A (^) 0. B (^) 1 A (^) 0. B 0 A (^) 1. B (^) 1 A (^) 1. B 0 C (^) 3 C (^) 2 C (^) 1 C 0

  • So, multiplication of two 2-bit numbers can be implemented by a combinational circuit with two half adders as follows:

B 1

B 1

HA HA

A 0

A 1 B 0

B 0

C 3 C 2 C 1 C 0

  • Assume now that the multiplier has 3 bits and the multiplicand has 4 bits.
  • In general, if the multiplier has J bits and the multiplicand has K bits, we will need J āˆ’ 1 K -bit adders and J Ɨ K AND gates and the product will have J + K bits.

Magnitude Comparator

  • A magnitude comparator is a combinational circuit that compares two numbers A and B and determines whether A > B , A = B , or A < B.
  • Comparison operation should start by comparing the most significant bits of A and B.
  • For example, consider two numbers A and B as follows:

3 2 1 0

3 2 1 0 B BBB B

A AAAA

  • Define the following functions (which are the bib-by-bit exclusive-NOR operations on A and B ):

x (^) i = Ai. Bi + Ai '. Bi ' for i = 0 , 1 , 2 , 3

  • It can easily be verified that:

3 ' 3 3 ' 2 2 3 2 1 ' 1 3 2 1 0 ' 0

3 3 ' 3 2 2 ' 3 2 1 1 ' 3 2 1 0 0 '

3 2 1 0

< ⇒ + + + =

A B A B x A B x x A B x x x A B

A B A B x A B x x A B x x x A B

A B x x x x

  • In the equations for inequalities, the most significant bits (with the same significance) in the two numbers are compared and if one of them is 1 and the other one is 0, the comparison is finished and only if they are equal, the next significant bits in the two numbers will be compared (this is represented by ANDing the ’s with corresponding terms in the inequalities).

x i

  • A 4-bit magnitude comparator logic circuit is given below:

( A = B )

( A > B )

( A < B )

x 2

A 2

B 2

x 3

A 3

B 3

x 1

A 1

B 1

x 0

A 0

B 0

Decoders

  • Decoder circuits are used to decode encoded information.
  • A decoder is a combinational circuit that has n inputs and a maximum of 2 n outputs.
  • The truth table for a 3-to-8-line decoder is as follows: