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

Implementing Any Circuit Using NAND Gate Only - GeeksforGeeks

The document discusses the implementation of any digital circuit using only NAND gates, highlighting the NAND gate's status as a universal gate capable of constructing any Boolean function. It provides methods for converting circuits to NAND-only configurations, including examples and procedures for implementing basic operations like AND, OR, and NOT using NAND gates. The article also outlines the advantages, disadvantages, and applications of using NAND gates in digital circuit design.

Uploaded by

gizemgultoprak04
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Implementing Any Circuit Using NAND Gate Only - GeeksforGeeks

The document discusses the implementation of any digital circuit using only NAND gates, highlighting the NAND gate's status as a universal gate capable of constructing any Boolean function. It provides methods for converting circuits to NAND-only configurations, including examples and procedures for implementing basic operations like AND, OR, and NOT using NAND gates. The article also outlines the advantages, disadvantages, and applications of using NAND gates in digital circuit design.

Uploaded by

gizemgultoprak04
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Aptitude Engineering Mathematics Discrete Mathematics Operating System DBMS Computer Networks Digit

Implementing Any Circuit Using NAND Gate Only


Last Updated : 23 Aug, 2024

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.

What is NAND Gate?


The NAND gate is a simple form of a Digital Logic gate which gives a False output
if all the inputs are True. The device is an inverse of the AND gate. In Boolean
algebra the NAND operation is represented as (AB)’. NAND gates are common in
digital electronics since it is simple and can be used as a basis of most of the
circuits. With gates NAND has one special feature which is that from them it is
possible to construct any other function, it really works as a universal gate. This
implies that, in principle, an entire digital circuit can be built using only NAND gates
and this explains why they are very useful in circuit design.

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

Same Boolean Function with NAND only Circuit

Example 2:

Given Circuit:

(A+B)C + DE

Same Boolean Function with NAND only gate circuit:

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.

COMPLEMENT Using NAND

(AA)’ = A’

AND Using NAND

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’)’.

Using De-Morgan’s law we can show that (A’B’)’ = A + B.

NAND using OR & Inverter

To implement NAND operation using OR gate, we first complement the inputs and
then perform OR on the complemented inputs.

We get A’ + B’.

A’ + B’ is equivalent to (AB)’ which can be shown to be true by using De-Morgan’s


law.

Procedure for Conversion

Consider the following circuit.

We have:

We have to somehow re-implement this circuit using only NAND gates.

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.

Now take a look at the highlighted areas.

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!

Our Final Result:

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.

Our Final NAND gate-only circuit:

You can verify that this circuit implements : (A+B + CD)E

Method 2 (SOP Method):

The original circuit implements the Boolean function : (A+B+CD)E

We first manipulate this Boolean equation so that it is in the Sum of


Products(SOP).

In this case, we simply multiply each term in the parenthesis by E.

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.

We draw the circuit:

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.

Our final circuit:

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.

Frequently Asked Questions on Implementing Any Circuit


Using NAND Gate Only-FAQs

In what way will NAND gates be useful in the Digital Systems?

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

Previous Article Next Article


Realization of Logic Gate Using Universal
gates

Similar Reads

Implementation of AND Gate from NAND Gate


It is worth mentioning that Boolean algebra is a fundamental part of the digital
electronics field that uses binary variables and logical operations. Think of it as the…
mind that makes the computers work effectively. Then, imagine that logic gates (AND,
5 min read
OR, and NOT) could be the necessary helpers in the digital world. These gates are
the components

Implementation of OR Gate from NAND Gate


Logic gates are an essential component of digital electronics and are used to handle
binary data. Because of its universal nature, the NAND gate is particularly significa…
among these gates. This article explores the use of NAND gates to implement an OR
4 min read
gate, demonstrating the adaptability and usefulness of these fundamental building
blocks. In th

Implementation of XOR Gate from NAND Gate


Logic Gates are the building blocks of digital circuits, taking binary values as input
and returning a binary value as output after performing a logical operation. There ar…
several kinds of gates available in Digital Electronics like basic gates, and universal
5 min read
gates. Implementation of the XOR gate from the NAND gate is possible because the
NAND ga

Difference Between NAND GATE and NOR GATE


NAND and NOR gates are the prime building blocks of digital electronics. Both of
them can be taken as universal, since they can be derived from any of the logic gat…
already existing, and the list runs as follows: AND, OR, NOT, XOR, etc. And it is
6 min read
crucial for the designing of almost all possible digital circuits like computers, mobile
phones, and

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

Implementation of Full Adder using NAND Gates


In Digital Logic Circuit, Full Adder is a Digital Logic Circuit that can add three inputs
and give two outputs. The three inputs such as A, B, and input carry as Cin. The…
output carry is represented as Cout and the normal output is represented as S, Sum.
9 min read
The Cout is also known as the majority 1’s detector, whose output goes high when
more than one

Half Adder and Half Subtractor using NAND NOR gates


Introduction : A Half Adder is a digital circuit that adds two single-bit binary numbers
and outputs the sum and carry. It can be implemented using either NAND gates or…
with5 min
NOR gates. When using NAND gates : The sum output is given by A AND B.
read
The carry output is given by the complement of A AND B. When NOR gate is used :
The sum output is NOR

Differences Between NAND vs NOR Flash Memory


Flash memory is a critical factor in cutting-edge digital devices, serving as the spine
for storing data persistently. Among the diverse forms of flash reminiscence, NAND…
and9 NOR flash are outstanding variations with awesome characteristics. This article
min read
delves into the fundamental variations among NAND and NOR flash memory,
elucidating their archi

Circuit (Combinational and Sequential) Implementation using Prolog


Prerequisite - Prolog | An Introduction Overview :Digital circuits or digital electronics
is a branch of electronics which deals with digital signals to perform the various tas…
to meet various requirement. The input signal applied to these circuits is of digital
4 min read
form, which is represented in 0’s and 1’s binary language format. These circuits are d

Solving multiplexer circuit


The procedure for solving and finding the output function of the given multiplexer is
quite simple. Firstly we will discuss the procedure and then illustrate it with exampl…
Procedure: Firstly truth table is constructed for the given multiplexer. Select lines in
2 min read
multiplexer are considered as input for the truth table. Output in truth table can be

Article Tags : Computer Subject Digital Logic GATE CS

Corporate & Communications


Address:- A-143, 9th Floor, Sovereign
Corporate Tower, Sector- 136, Noida,
Uttar Pradesh (201305) | Registered
Address:- K 061, Tower K, Gulshan
Vivante Apartment, Sector 137,
Noida, Gautam Buddh Nagar, Uttar
Pradesh, 201305

Company Languages DSA Data Science Web Python


About Us Python Data Structures & ML Technologies Tutorial
Legal Java Algorithms Data Science With HTML Python
In Media C++ DSA for Beginners Python CSS Programming
Contact Us PHP Basic DSA Data Science For JavaScript Examples
Advertise with us GoLang Problems Beginner TypeScript Python Projects
GFG Corporate SQL DSA Roadmap Machine Learning ReactJS Python Tkinter
Solution R Language Top 100 DSA ML Maths NextJS Web Scraping
Placement Android Tutorial Interview Data Visualisation Bootstrap OpenCV Tutorial
Training Program Tutorials Archive Problems Pandas Web Design Python Interview
GeeksforGeeks DSA Roadmap by NumPy Question
Community Sandeep Jain NLP Django
All Cheat Sheets Deep Learning

Computer DevOps System Inteview School GeeksforGeeks


Science Git Design Preparation Subjects Videos
Operating Linux High Level Design Competitive Mathematics DSA
Systems AWS Low Level Design Programming Physics Python
Computer Network Docker UML Diagrams Top DS or Algo for Chemistry Java
Database Kubernetes Interview Guide CP Biology C++
Management Azure Design Patterns Company-Wise Social Science Web Development
System GCP OOAD Recruitment English Grammar Data Science
Software DevOps Roadmap System Design Process Commerce CS Subjects
Engineering Bootcamp Company-Wise World GK
Digital Logic Interview Preparation
Design Questions Aptitude
Engineering Maths Preparation
Software Puzzles
Development
Software
We Testingto ensure you have the best browsing experience on our website. By using our
use cookies
site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy Got It !
Cookies are not collected in the
@GeeksforGeeks, GeeksforGeeks
Sanchhaya mobile
Education applications.
Private Limited, All rights reserved

You might also like