Implementing Any Circuit Using NAND Gate Only - GeeksforGeeks
Implementing Any Circuit Using NAND Gate Only - GeeksforGeeks
A universal gate is such a gate that we can implement any Boolean function, no
matter how complex, using a circuit that consists of only that particular universal
gate. The NAND & NOR gates are the most commonly encountered universal
gates in digital logic.
In this article, we will take a look at how to convert any circuit into a circuit that
consists only of NAND gates. Since the NAND gate is a universal gate, we can
convert any circuit into a circuit consisting only of NAND gates. We first start by
showing how other gates(AND, OR, Inverter) can be implemented using only
NAND gates, then we use this knowledge to discuss how to convert any circuit into
only a NAND circuit.
Truth Table:
A B Output
0
0 1
0
1 1
1
0 1
1
1 0
In this table it can be observed that the output is false only when both inputs A and
B are true. For the output in all other cases, the value is true.
Objective:
Given a circuit, our task is to implement a circuit that is equivalent to the given
circuit and consists of only NAND gates.
Examples:
Example 1:
Given Circuit:
AB+CD
Example 2:
Given Circuit:
(A+B)C + DE
Before we get to how to convert any circuit to a NAND-only circuit, we will take a
look at how to implement Complement, AND & OR operation using NAND gates.
We also will need to take a look at how to implement NAND operation using OR
gate.
(AA)’ = A’
Evaluates to AB
This is quite straightforward, we wish to obtain AB but the NAND gate gives an
output (AB)’ so we complement the output of the NAND gate using another NAND
gate to obtain ((AB)’)’ which is AB.
OR Using NAND
Evaluates to A+B
We first complement the inputs A and B. Then we perform the NAND operation on
these complemented inputs. We get (A’B’)’.
To implement NAND operation using OR gate, we first complement the inputs and
then perform OR on the complemented inputs.
We get A’ + B’.
We have:
Suppose what happens if we insert two inverters between each AND gate and OR
gate.
This circuit is completely equivalent to the original one as the output of each AND
gate is being complemented twice before the signal reaches the OR gate. These
inverters will play a key role in the process of conversion.
The gates in each highlighted area can be easily combined into one NAND gate
since it is basically just an AND gate followed by an inverter.
We get:
Now we only have to take care of the blue highlighted area. Recall the
implementation of a NAND operation using OR & inverter gates we have covered
above, the gates in the blue area implement a NAND operation. Therefore we can
just replace all the gates in the blue area with a single NAND gate!
You can verify for yourself that this circuit implements the function AB + CD, same
as that of the original circuit.
Another Example:
Original Circuit:
(A+B + CD)E
Method 1
First, we start by replacing the first AND gate(highlighted yellow) with a NAND
gate. To do this we insert two inverters after this AND gate.
Remember that this circuit is the same as two complement operations resulting in
the original signal. The AND gate and the inverter that follows it can be combined
into a single NAND gate(see yellow highlighted area).
Next, we replace the OR gate in the blue highlighted area with NAND gates. We
have seen how to implement OR operation using NAND gates, we put that
knowledge to use now.
We then proceed to replace the last AND gate(highlighted yellow) with NAND
gates. Just like we replaced the OR gate in the previous step, we replace the AND
gate with its equivalent NAND gate circuit.
We now are left with an OR Gate and an Inverter Gate. A NAND gate can be
implemented by an OR gate with complemented inputs. Here we have only one
complemented input to the OR gate. To meet the condition that both the inputs are
complemented, we insert two inverters between the highlighted OR gate and the
preceding NAND gate.
We get:
Now both the inputs to the OR gate are complemented. The gates in the blue area
represent a NAND operation so we can replace them with a NAND gate.
We are now only left with an Inverter. An Inverter gate is basically a one-input
NAND gate. We make the necessary replacement and obtain our final circuit.
We get: AE + BE + CDE.
Since this Boolean equation is now in SOP form, the circuit for this equation will be
in a standard two-level implementation, meaning there will be a series of AND
gates followed by a single OR gate.
Just like in example 1, we insert two inverter gates between each AND gate and
OR gate.
You can probably now figure out what we will do next. We combine the gates in the
Yellow areas into one single NAND gate. Also, we know that an OR gate with
complemented inputs implements a NAND operation. So we replace the gates in
the blue area with a NAND gate.
We can conclude that whenever a circuit has a series of AND gates at the first
level followed by a single OR gate, we can blindly replace each gate with a NAND
gate and the circuit will still implement the same Boolean function.
In this case Method 2, took a lot less effort than Method 1, one might wonder why
even bother learning Method 1 when Method 2 seems easier? The answer is that
Method 2 requires that the Boolean equation must be represented in Sum of
Products form. In this case, it was easy to convert our equation into SOP from, but
this is not always the case.
Suppose you have a circuit that implements the Boolean function : (A+B)(C+D)
(E+F)(G+H)
Converting this to SOP form will be complicated, and better with Method 1 in this
case.
Advantages
It can support any Boolean function.
Reduces circuit complexity.
It is cost effective because it reduces the variety of gates needed.
Has flexibility for using various type of circuits.
Aids in the development of standard digital circuit design.
Disadvantages
May result into designs that require more circuits and complex ones because
several NAND gates are needed for the simplest functions.
It may result to higher propagation delays due to more number of gate levels.
It might use more power compared to the circuits utilizing fewer types of gates.
Needs more chip space because more gates are needed.
Design may be slightly less ‘automatic’ and ‘natural’ for some of the logic
operations
Applications
It is utilized in forming digital circuits.
Significant for constructing the microprocessor and the memory unit.
Used in error detection and correction techniques.
Used in signal processing in Communication and Digital systems.
Used in many digital circuits and in every type of logic families.
Conclusion
This article shows the effectiveness of the NAND gate in the field of digital logic
design as explained before. This is desirable since by converting circuits to use
only NAND gates, it is possible to simplify the designs for circuits, even if some
penalties may be incurred in the process like the complexity of the gates. The
NAND gate still continues to be significant because it is general-purpose.
These NAND gates are capable of being employed in the formation of any
digital logic circuit, including, but not limited to, memory and arithmetic units.
What are the reasons for the widespread use of NAND gates in
applications of digital circuits?
They are favored because they can carry out any Boolean function and the
circuit can be made uncomplicated since only one kind of gate is used.
What sort of practical use can be made of NAND gates in the field of
electronics?
NAND gates are applied in memory devices for instance, RAMs and in digital
integrated circuits.
S swar… 14
Similar Reads
NAND Gate
Logic Gates are one of the most important topics in electronics, especially digital
electronics. The concept of logic gates relies on the concept of Boolean functions.…
Logic gates take one or multiple binary values as input and return one binary value as
7 min read
output after doing the logical calculation on them. There are several kinds of GATEs
available