0% found this document useful (0 votes)
37 views

Discrete Mathematics Chapter 12_2 Logic Gates

This document discusses logic gates and their applications in combinational circuits using Boolean algebra. It introduces the basic types of gates: inverters, OR gates, and AND gates, and explains how to construct circuits using these elements. Additionally, it provides examples of circuits for specific functions, such as majority voting and light control with multiple switches, as well as the design of adders for binary addition.

Uploaded by

shoibbasil62
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

Discrete Mathematics Chapter 12_2 Logic Gates

This document discusses logic gates and their applications in combinational circuits using Boolean algebra. It introduces the basic types of gates: inverters, OR gates, and AND gates, and explains how to construct circuits using these elements. Additionally, it provides examples of circuits for specific functions, such as majority voting and light control with multiple switches, as well as the design of adders for binary addition.

Uploaded by

shoibbasil62
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

12.

3 Logic Gates
12.3.1 Introduction

Links
Boolean algebra is used to model the circuitry of electronic devices. Each input and each output
of such a device can be thought of as a member of the set {0, 1}. A computer, or other electronic
device, is made up of a number of circuits. Each circuit can be designed using the rules of
Boolean algebra that were studied in Sections 12.1 and 12.2. The basic elements of circuits
are called gates, and were introduced in Section 1.2. Each type of gate implements a Boolean
operation. In this section we define several types of gates. Using these gates, we will apply the
12.3 Logic Gates 859

x x x+y x xy
x
y y

(a) Inverter (b) OR gate (c) AND gate

FIGURE 1 Basic types of gates.

rules of Boolean algebra to design circuits that perform a variety of tasks. The circuits that we
will study in this chapter give output that depends only on the input, and not on the current
state of the circuit. In other words, these circuits have no memory capabilities. Such circuits are
called combinational circuits or gating networks.
We will construct combinational circuits using three types of elements. The first is an
inverter, which accepts the value of one Boolean variable as input and produces the comple-
ment of this value as its output. The symbol used for an inverter is shown in Figure 1(a). The
input to the inverter is shown on the left side entering the element, and the output is shown on
the right side leaving the element.
The next type of element we will use is the OR gate. The inputs to this gate are the val-
ues of two or more Boolean variables. The output is the Boolean sum of their values. The
symbol used for an OR gate is shown in Figure 1(b). The inputs to the OR gate are shown
on the left side entering the element, and the output is shown on the right side leaving the
element.
The third type of element we will use is the AND gate. The inputs to this gate are the
values of two or more Boolean variables. The output is the Boolean product of their values. The
symbol used for an AND gate is shown in Figure 1(c). The inputs to the AND gate are shown
on the left side entering the element, and the output is shown on the right side leaving the
element.
We will permit multiple inputs to AND and OR gates. The inputs to each of these gates are
shown on the left side entering the element, and the output is shown on the right side. Examples
of AND and OR gates with n inputs are shown in Figure 2.

x1 x1
x2 x1x2 · · · xn x2 x1 + x2 + · · · + xn
···

···

xn xn

FIGURE 2 Gates with n inputs.

12.3.2 Combinations of Gates


Combinational circuits can be constructed using a combination of inverters, OR gates, and AND
gates. When combinations of circuits are formed, some gates may share inputs. This is shown in
one of two ways in depictions of circuits. One method is to use branchings that indicate all the
gates that use a given input. The other method is to indicate this input separately for each gate.
Figure 3 illustrates the two ways of showing gates with the same input values. Note also that
output from a gate may be used as input by one or more other elements, as shown in Figure 3.
Both drawings in Figure 3 depict the circuit that produces the output xy + xy.

EXAMPLE 1 Construct circuits that produce the following outputs: (a) (x + y)x, (b) x (y + z), and (c) (x +
y + z)(x y z).

Solution: Circuits that produce these outputs are shown in Figure 4. ◂


860 12 / Boolean Algebra

x xy
y

xy + xy
x
x xy
y

x xy
y

xy + xy
x
xy

FIGURE 3 Two ways to draw the same circuit.

x x+y
y
(x + y) x
(a)
x
x

x
x
x (y + z )

(b) y y+z (y + z)

z
z

x
x+y+z
y
z

(x + y + z )x y z
x
(c) x

y xyz
y

z
z

FIGURE 4 Circuits that produce the outputs specified in Example 1.


12.3 Logic Gates 861

12.3.3 Examples of Circuits


We will give some examples of circuits that perform some useful functions.

EXAMPLE 2 A committee of three individuals decides issues for an organization. Each individual votes either
yes or no for each proposal that arises. A proposal is passed if it receives at least two yes votes.
Design a circuit that determines whether a proposal passes.

Extra Solution: Let x = 1 if the first individual votes yes, and x = 0 if this individual votes no;
Examples let y = 1 if the second individual votes yes, and y = 0 if this individual votes no; let z = 1 if
the third individual votes yes, and z = 0 if this individual votes no. Then a circuit must be
designed that produces the output 1 from the inputs x, y, and z when two or more of x, y,
and z are 1. One representation of the Boolean function that has these output values is
xy + xz + yz (see Exercise 12 in Section 12.1). The circuit that implements this function is
shown in Figure 5. ◂

x xy
y
x xz
xy + xz + yz
z
y yz
z

FIGURE 5 A circuit for majority voting.

EXAMPLE 3 Sometimes light fixtures are controlled by more than one switch. Circuits need to be designed
so that flipping any one of the switches for the fixture turns the light on when it is off and turns
the light off when it is on. Design circuits that accomplish this when there are two switches and
when there are three switches.

TABLE 1 Solution: We will begin by designing the circuit that controls the light fixture when two dif-
ferent switches are used. Let x = 1 when the first switch is closed and x = 0 when it is open,
x y F(x, y) and let y = 1 when the second switch is closed and y = 0 when it is open. Let F(x, y) = 1 when
1 1 1 the light is on and F(x, y) = 0 when it is off. We can arbitrarily decide that the light will be
1 0 0 on when both switches are closed, so that F(1, 1) = 1. This determines all the other values
0 1 0
of F. When one of the two switches is opened, the light goes off, so F(1, 0) = F(0, 1) = 0.
When the other switch is also opened, the light goes on, so F(0, 0) = 1. Table 1 displays
0 0 1
these values. Note that F(x, y) = xy + x y. This function is implemented by the circuit shown in
Figure 6.

x xy
y

x xy + xy
x
xy

y
y

FIGURE 6 A circuit for a light controlled by two switches.


862 12 / Boolean Algebra

x xyz
y
z
x

y xyz
y

z
z
x y z + x y z + x y z + x yz
x
x
xyz
y

z
z

x
x

y xyz
y

FIGURE 7 A circuit for a fixture controlled by three switches.

TABLE 2 We will now design a circuit for three switches. Let x, y, and z be the Boolean variables that
indicate whether each of the three switches is closed. We let x = 1 when the first switch is closed,
x y z F(x, y, z)
and x = 0 when it is open; y = 1 when the second switch is closed, and y = 0 when it is open;
1 1 1 1 and z = 1 when the third switch is closed, and z = 0 when it is open. Let F(x, y, z) = 1 when the
1 1 0 0 light is on and F(x, y, z) = 0 when the light is off. We can arbitrarily specify that the light be on
1 0 1 0 when all three switches are closed, so that F(1, 1, 1) = 1. This determines all other values of F.
1 0 0 1 When one switch is opened, the light goes off, so F(1, 1, 0) = F(1, 0, 1) = F(0, 1, 1) = 0. When
0 1 1 0 a second switch is opened, the light goes on, so F(1, 0, 0) = F(0, 1, 0) = F(0, 0, 1) = 1. Finally,
when the third switch is opened, the light goes off again, so F(0, 0, 0) = 0. Table 2 shows the
0 1 0 1
values of this function.
0 0 1 1
The function F can be represented by its sum-of-products expansion as F(x, y, z) =
0 0 0 0
xyz + xy z + xyz + x yz. The circuit shown in Figure 7 implements this function. ◂

Links
12.3.4 Adders
We will illustrate how logic circuits can be used to carry out addition of two positive integers
TABLE 3 from their binary expansions. We will build up the circuitry to do this addition from some
Input and component circuits. First, we will build a circuit that can be used to find x + y, where x and y
Output for the
Half Adder.
are two bits. The input to our circuit will be x and y, because these each have the value 0 or
the value 1. The output will consist of two bits, namely, s and c, where s is the sum bit and c
Input Output is the carry bit. This circuit is called a multiple output circuit because it has more than one
output. The circuit that we are designing is called the half adder, because it adds two bits,
x y s c
without considering a carry from a previous addition. We show the input and output for the half
1 1 0 1 adder in Table 3. From Table 3 we see that c = xy and that s = xy + xy = (x + y)(xy). Hence,
1 0 1 0 the circuit shown in Figure 8 computes the sum bit s and the carry bit c from the bits x and y.
0 1 1 0 We use the full adder to compute the sum bit and the carry bit when two bits and a carry
0 0 0 0 are added. The inputs to the full adder are the bits x and y and the carry ci . The outputs are the
sum bit s and the new carry ci+1 . The inputs and outputs for the full adder are shown in Table 4.
12.3 Logic Gates 863

x x+y
y s = xyci + xyci + xyci + xyci
Sum = (x + y)(xy) ci
Half
(x + y)(xy)
adder
xy
(x y)
ci+1 = xyci + xyci +
x Half xyci + xyci
Carry = xy xy
y adder

FIGURE 8 The half adder. FIGURE 9 A full adder.

TABLE 4 The two outputs of the full adder, the sum bit s and the carry ci+1 , are given by the sum-of-
Input and products expansions xyci + xy ci + xyci + x yci and xyci + xyci + xyci + xyci , respectively. How-
Output for ever, instead of designing the full adder from scratch, we will use half adders to produce the
the Full Adder. desired output. A full adder circuit using half adders is shown in Figure 9.
Finally, in Figure 10 we show how full and half adders can be used to add the two three-bit
Input Output
integers (x2 x1 x0 )2 and (y2 y1 y0 )2 to produce the sum (s3 s2 s1 s0 )2 . Note that s3 , the highest-order
x y ci s ci+1 bit in the sum, is given by the carry c2 .
1 1 1 1 1
1 1 0 0 1 x0 s0
Half c0
1 0 1 0 1 y0 adder
s1
1 0 0 1 0 x1
Full
0 1 1 0 1 adder
ci
y1 s2
0 1 0 1 0
Full
0 0 1 1 0 x2
adder
0 0 0 0 0 y2 c2 = s3

FIGURE 10 Adding two three-bit


integers with full and half adders.

Exercises

In Exercises 1–5 find the output of the given circuit. 3. x


y
1. x
y
z

x
4. x
y
y
z
2. x

x
y

y z
864 12 / Boolean Algebra

5. x Two gates that are often used in circuits are NAND and NOR
y gates. When NAND or NOR gates are used to represent cir-
z cuits, no other types of gates are needed. The notation for
these gates is as follows:
x
y x NAND y x NOR y
x x
z
y y
x

y
∗ 15. Use NAND gates to construct circuits with these out-
puts.
z a) x b) x + y
c) xy d) x ⊕ y
6. Construct circuits from inverters, AND gates, and OR ∗ 16. Use NOR gates to construct circuits for the outputs given
gates to produce these outputs.
in Exercise 15.
a) x + y b) (x + y)x
∗ 17. Construct a half adder using NAND gates.
c) xyz + x y z d) (x + z)(y + z)
7. Design a circuit that implements majority voting for five ∗ 18. Construct a half adder using NOR gates.
individuals. A multiplexer is a switching circuit that produces as output
8. Design a circuit for a light fixture controlled by four one of a set of input bits based on the value of control bits.
switches, where flipping one of the switches turns the
light on when it is off and turns it off when it is on. 19. Construct a multiplexer using AND gates, OR gates, and
inverters that has as input the four bits x0 , x1 , x2 , and x3
9. Show how the sum of two five-bit integers can be found
and the two control bits c0 and c1 . Set up the circuit so
using full and half adders.
that xi is the output, where i is the value of the two-bit
10. Construct a circuit for a half subtractor using AND gates, integer (c1 c0 )2 .
OR gates, and inverters. A half subtractor has two bits
as input and produces as output a difference bit and a bor- The depth of a combinatorial circuit can be defined by speci-
row. fying that the depth of the initial input is 0 and if a gate has n
11. Construct a circuit for a full subtractor using AND gates, different inputs at depths d1 , d2 , … , dn , respectively, then its
OR gates, and inverters. A full subtractor has two bits outputs have depth equal to max(d1 , d2 , … , dn ) + 1; this value
and a borrow as input, and produces as output a difference is also defined to be the depth of the gate. The depth of a com-
bit and a borrow. binatorial circuit is the maximum depth of the gates in the
circuit.
12. Use the circuits from Exercises 10 and 11 to find the dif-
ference of two four-bit integers, where the first integer is 20. Find the depth of
greater than the second integer. a) the circuit constructed in Example 2 for majority vot-
∗ 13. Construct a circuit that compares the two-bit integers ing among three people.
(x1 x0 )2 and (y1 y0 )2 , returning an output of 1 when the first b) the circuit constructed in Example 3 for a light con-
of these numbers is larger and an output of 0 otherwise. trolled by two switches.
∗ 14. Construct a circuit that computes the product of the two-
bit integers (x1 x0 )2 and (y1 y0 )2 . The circuit should have c) the half adder shown in Figure 8.
four output bits for the bits in the product. d) the full adder shown in Figure 9.

12.4 Minimization of Circuits


12.4.1 Introduction
The efficiency of a combinational circuit depends on the number and arrangement of its gates.
The process of designing a combinational circuit begins with the table specifying the output for
each combination of input values. We can always use the sum-of-products expansion of a circuit
to find a set of logic gates that will implement this circuit. However, the sum-of-products expan-
sion may contain many more terms than are necessary. Terms in a sum-of-products expansion
that differ in just one variable, so that in one term this variable occurs and in the other term the
complement of this variable occurs, can be combined. For instance, consider the circuit that has

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy