0% found this document useful (0 votes)
17 views27 pages

ARh Sir (Logic Gate)

Logic gates are fundamental components in digital circuits that process binary inputs to produce a single output based on Boolean algebra. They include various types such as AND, OR, NOT, NAND, NOR, XOR, and XNOR, each serving specific logical functions and applications in technology. Additionally, quantum gates, like the Toffoli gate, extend these concepts into quantum computing, allowing for reversible operations on qubits.
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)
17 views27 pages

ARh Sir (Logic Gate)

Logic gates are fundamental components in digital circuits that process binary inputs to produce a single output based on Boolean algebra. They include various types such as AND, OR, NOT, NAND, NOR, XOR, and XNOR, each serving specific logical functions and applications in technology. Additionally, quantum gates, like the Toffoli gate, extend these concepts into quantum computing, allowing for reversible operations on qubits.
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/ 27

A logic gate is a simple switching circuit that determines whether an input pulse

can pass through to the output in digital circuits.


The building blocks of a digital circuit are logic gates, which execute numerous
logical operations that are required by any digital circuit. These can take two or
more inputs but only produce one output.
The mix of inputs applied across a logic gate determines its output. Logic gates
use Boolean algebra to execute logical processes. Logic gates are found in
nearly every digital gadget we use on a regular basis. Logic gates are used in
the architecture of our telephones, laptops, tablets, and memory devices.

Boolean Algebra
Boolean algebra is a type of logical algebra in which symbols represent logic
levels.
The digits(or symbols) 1 and 0 are related to the logic levels in this algebra; in
electrical circuits, logic 1 will represent a closed switch, a high voltage, or a
device’s “on” state. An open switch, low voltage, or “off” state of the device will
be represented by logic 0.
At any one time, a digital device will be in one of these two binary situations. A
light bulb can be used to demonstrate the operation of a logic gate. When logic
0 is supplied to the switch, it is turned off, and the bulb does not light up. The
switch is in an ON state when logic 1 is applied, and the bulb would light up. In
integrated circuits (IC), logic gates are widely employed.
Truth Table: The outputs for all conceivable combinations of inputs that may be
applied to a logic gate or circuit are listed in a truth table. When we enter values
into a truth table, we usually express them as 1 or 0, with 1 denoting True logic
and 0 denoting False logic.

Types of Logic Gates


A logic gate is a digital gate that allows data to be transferred. Logic gates, use
logic to determine whether or not to pass a signal. Logic gates, on the other
hand, govern the flow of information based on a set of rules. The following types
of logic gates are commonly used:
1. AND
2. OR
3. NOT
4. NOR
5. NAND
6. XOR
7. XNOR
Basic Logic Gates
AND Gate
An AND gate has a single output and two or more inputs.
1. When all of the inputs are 1, the output of this gate is 1.
2. The AND gate’s Boolean logic is Y=A.B if there are two inputs A and
B.
An AND gate’s symbol and truth table are as follows:

Input Output

A B A AND B

0 0 0

0 1 0

1 0 0

1 1 1
Symbol of AND gate

Therefore, in And gate, the output is high when all the inputs are high.

OR Gate
Two or more inputs and one output can be used in an OR gate.
1. The logic of this gate is that if at least one of the inputs is 1, the output
will be 1.
2. The OR gate’s output will be given by the following mathematical
procedure if there are two inputs A and B: Y=A+B

Input Output

A B A OR B

0 0 0

0 1 1

1 0 1

1 1 1

Symbol of OR gate

Therefore, in the OR gate, the output is high when any of the inputs is high.

NOT Gate
The NOT gate is a basic one-input, one-output gate.
1. When the input is 1, the output is 0, and vice versa. A NOT gate is
sometimes called an inverter because of its feature.
2. If there is only one input A, the output may be calculated using the
Boolean equation Y=A’.

Input Output

A Not A

0 1

1 0

Symbol of NOT gate

A NOT gate, as its truth table shows, reverses the input signal.

Universal Logic Gates


NOR Gate
A NOR gate, sometimes known as a “NOT-OR” gate, consists of an OR gate
followed by a NOT gate.
1. This gate’s output is 1 only when all of its inputs are 0. Alternatively,
when all of the inputs are low, the output is high.
2. The Boolean statement for the NOR gate is Y=(A+B)’ if there are two
inputs A and B.

Input Output

A B A NOR B
0 0 1

0 1 0

1 0 0

1 1 0

Symbol of NOR gate

By comparing the truth tables, we can observe that the outputs of the NOR gate
are the polar opposite of those of an OR gate. The NOR gate is sometimes
known as a universal gate since it may be used to implement the OR, AND, and
NOT gates.

NAND Gate
A NAND gate, sometimes known as a ‘NOT-AND’ gate, is essentially a Not gate
followed by an AND gate.
1. This gate’s output is 0 only if none of the inputs is 0. Alternatively,
when all of the inputs are not high and at least one is low, the output
is high.
2. If there are two inputs A and B, the Boolean expression for the NAND
gate is Y=(A.B)’

Input Output

A B A NAND B
0 0 1

0 1 1

1 0 1

1 1 0

Symbol of NAND gate

By comparing their truth tables, we can observe that their outputs are the polar
opposite of an AND gate. The NAND gate is known as a universal gate because
it may be used to implement the AND, OR, and NOT gates.

Other Logic Gates


XOR Gate
The Exclusive-OR or ‘Ex-OR’ gate is a digital logic gate that accepts more than
two inputs but only outputs one value.
1. If any of the inputs is ‘High,’ the output of the XOR Gate is ‘High.’ If
both inputs are ‘High,’ the output is ‘Low.’ If both inputs are ‘Low,’ the
output is ‘Low.’
2. The Boolean equation for the XOR gate is Y=A’.B+A.B’ if there are two
inputs A and B.

Input Output

A B A XOR B

0 0 0
0 1 1

1 0 1

1 1 0

Symbol of XOR gate

Its outputs are based on OR gate logic, as we can see from the truth table.

XNOR Gate
The Exclusive-NOR or ‘EX-NOR’ gate is a digital logic gate that accepts more
than two inputs but only outputs one.
1. If both inputs are ‘High,’ the output of the XNOR Gate is ‘High.’ If both
inputs are ‘Low,’ the output is ‘High.’ If one of the inputs is ‘Low,’ the
output is ‘Low.’
2. If there are two inputs A and B, then the XNOR gate’s Boolean equation
is: Y=A.B+A’B’.

Input Output

A B A XNOR B

0 0 1

0 1 0

1 0 0
1 1 1

Symbol of XNOR gate

The truth table shows that its outputs are based on NOR gate logic.

Uses of Logic Gates


1. Logic gates are utilized in a variety of technologies. These are
components of chips (ICs), which are components of computers,
phones, laptops, and other electronic devices.
2. Logic gates may be combined in a variety of ways, and a million of
these combinations are necessary to make the newest gadgets,
satellites, and even robots.
3. Simple logic gate combinations can also be found in burglar alarms,
buzzers, switches, and street lights. Because these gates can make a
choice to start or stop based on logic, they are often used in a variety
of sectors.
4. Logic gates are also important in data transport, calculation, and data
processing. Even transistor-transistor logic and CMOS circuitry make
extensive use of logic gates.

Some Common Applications of Logic Gates


During the course of discussion about various digital logic gates, we have
mainly discussed about the design, property and operation of them. In this
article we will look at various applications of logic gates. Their applications
are determined mainly based upon their truth table i.e. their mode of
operations. In the following discussion we will look at the applications of
basic logic gates as well as many other normal logic gates as well.
Application of OR gate
Wherever the occurrence of any one or more than one event is needed to be
detected or some actions are to be taken after their occurrence, in all those
cases OR gates can be used. It can be explained with an example.

Suppose in an industrial plant if one or more than one parameter exceeds the
safe value, some protective measure is needed to be done. In that case OR gate
is used. We are going to show this with the help of a diagram.

The above figure is a typical schematic diagram where an OR gate is used to


detect exceed of temperature or pressure and produce command signal for the
system to take required actions.
Application of AND Gate
There are mainly two applications of AND gate as Enable gate and Inhibit
gate. Enable gate means allowance of data through a channel and Inhibit gate
is just the reverse of that process i.e. disallowance of data through a channel.
We are going to show an enabling operation to understand it in an easier way.
Suppose in the measurement of frequency of a pulsed waveform. For
measurement of frequency a gating pulse of known frequency is sent to
enable the passage of the waveform whose frequency is to be measured. The
diagram below shows the arrangement of the above explained operation.

Application of Ex-OR/Ex-NOR Gate


These type of logic gates are used in generation of parity generation and
checking units. The two diagrams below shows the even and odd parity
generator circuits respectively for a four data.

With the help of these gates parity check operation can be also performed. The
diagrams below show even and odd parity check.
Figure (a) shows the parity check using Ex-OR gates and the figure (b) shows
the parity check using Ex-NOR gates.

Application of NOT gate or Inverters


NOT gates are also known as inverter because they invert the output given to
them and show the reverse result. Now the CMOS inverters are commonly
used to build square wave oscillators which are used for generating clock
signals. The advantage of using these is they consume low power and their
interfacing is very easy compared to other logic gates.

The above figure shows the most fundamental circuit made of ring
configuration to generate square wave oscillator. The frequency of this type
generator is given by

Where, n represents the number of inverters and tp shows the propagation


delay per gate.
Quantum Gates
By TecnoProfesor in TeachersCoding
1,522
5
1
Featured

DownloadFavorite

Introduction: Quantum Gates


"In the late twentieth century it was discovered that quantum theory
applies not only to atoms and molecules, but to bits and logic operations
in a computer..."

"Our everyday computers perform calculations and process information


using the standard (or classical) model of computation...In this model,
all information is reducible to bits, which can take the values of either 0
or 1..."

"The power of the quantum computer, meanwhile, lies in its much richer
repertoire of states. A quantum computer also has bits — but instead of
0 and 1, its quantum bits, or qubits, can represent a 0, 1, or linear
combination of both ..."

"While today’s quantum processors are modest in size, their complexity


grows continuously. We believe this is the right time to build and engage
a community of new quantum learners, spark further interest in those
who are curious, and foster a quantum intuition in the greater
community. By making quantum concepts more widely understood —
even on a general level — we can more deeply explore all the
possibilities quantum computing offers, and more rapidly bring its
exciting power to a world whose perspective is limited by classical
physics."

(IBM Introduction to quantum computing)

In this instructable I try to show you an easy introduction to the quantum


computing and how to create your first quantum circuits in the IBM
Quantum Composer.

Moreover we will create several quantum gates and we will learn how
to use an universal and reversible quantum gate, the Toffoli gate, to
create in a easy way the OR, AND, NOR and NAND quantum gates to
compute any arbitrary no reversible classsical boolean functions.

I hope you like it.


Add TipAsk QuestionCommentDownload
Step 1: The Qubit
What we have described here is the abstract notion of a qubit. The
quantum computers you interact with in IBM Quantum use a physical
type of qubit.

For a superconducting qubit to behave as the abstract notion of the


qubit, we must have the device at drastically low temperatures.

Once a system has cooled to the target temperature, which takes


several days, the qubit reaches equilibrium at the ground state |0>.

In the image you can see a circuit with one qubit (q0) initialize to the
ground state and its Q-sphere.

Open in IBM Quantum Composer


Add TipAsk QuestionCommentDownload
Step 2: The Standard Measurement
Here, the reset operation prepares the qubit in the |0> state, and is
followed by the standard measurement.

As you can see the probability our circuit was in the ground state is
100%

Open in IBM Quantum Composer


Add TipAsk QuestionCommentDownload
Step 3: The NOT Quantum Gate
As you may have guessed, we need to be able to put the qubit in
other states. To do this, we require the concept of a quantum gate.

Quantum gates must be reversible and preserve probability


amplitudes

Quantum gates are a convenient way in which to describe the


evolution of a quantum state. The action of a gate is to transform an
initial state into a final state.

The simplest gate is the NOT gate: it flips the 0 to a 1, or vice versa

Open in IBM Quantum Composer


Add TipAsk QuestionCommentDownload
Step 4: FAN-OUT Gate

After the execution of this gate, the qubit 1, initialized to the state |0>,
will have the same value as qubit 0

Open in IBM Quantum Composer


Add TipAsk QuestionCommentDownload
Step 5: The Toffoli Quantum Gate
A quantum gate or quantum logic gate is a rudimentary quantum
circuit operating on a small number of qubits.

They are the analogues for quantum computers to classical logic


gates for conventional digital computers.

Quantum logic gates are reversible, unlike many classical logic gates.

Some universal classical logic gates, such as the Toffoli gate, provide
reversibility and can be directly mapped onto quantum logic gates.
The Toffoli gate has 3-qubits inputs and outputs.

Toffoli (q0,q1,q2) = (q0),(q1),(XOR (q2, AND (q0,q1))

INPUTS OUTPUTS

q0 q1 q2 q0 q1 q2

0 0 0 0 0 0

0 0 1 0 0 1

0 1 0 0 1 0

0 1 1 0 1 1

1 0 0 1 0 0

1 0 1 1 0 1

1 1 0 1 1 1

1 1 1 1 1 0

The inputs in the image are red colored and the outputs are green
colored.

The barriers is just only for visualization purpose. To separate the


initial inputs from the rest of the circuit.

Please, pay attention how this final state is represented in the


probabilities graph.

Go to the composer and proof how the outputs change when you
change the inputs

Open in IBM Quantum Composer


Add TipAsk QuestionCommentDownload
Step 6: The NAND (AND) Gates From the Toffoli Gate
The classical NAND gate is not reversible, so we have to use the
universal reversible Toffoli gate to create the quantum NAND gate.

Let us have a look to the truth table of the Toffoli gate.

INPUTS OUTPUTS

q0 q1 q2 q0 q1 q2

0 0 0 0 0 0

0 0 1 0 0 1
0 1 0 0 1 0

0 1 1 0 1 1

1 0 0 1 0 0

1 0 1 1 0 1

1 1 0 1 1 1

1 1 1 1 1 0

If you pay attention, the inputs q0 and q1 (red) are all the possibles
values for two classical bits and the output q2 (blue) implements the
NAND gate. The input q2 (red) always is 1 and the ouputs q0 and q1
(blue) replicate the inputs values.

In the circuit in the image you can see the qubit q2 initialized to the
ground state and after that a NOT gate to flip its state to |1>.

So, the quantum circuit implements:

Toffoli (q0,q1,1) = (q0),(q1),(XOR (1, AND (q0, q1))) = (q0),(q1),


(NAND (q0,q1))

To implement the AND gate just only apply a NOT gate to the qubit
q2.

AND (q0,q1) = NOT (NAND (q0,q1))

Open in IBM Quantum Composer


Add TipAsk QuestionCommentDownload
Step 7: The OR (NOR) Gates From the Toffoli Gate
Again, the classical OR gate is not reversible, so we have to use the
universal reversible Toffoli gate to create the quantum OR gate.

We can obtain it in the following way:

Toffoli (1,q1,Toffoli (q2,q1,q2)) = (1),(q1),(XOR (q2, AND (q2, q1)))


= (1),(q1), (OR (q2,q1))

In the circuit:

• q0 is always |1>
• The circuit implement1 OR (q1,q2) and the result is present in q3
• In the image the gate is showing OR (1, 0) = 1

To implement the NOR gate just only apply a NOT gate to the qubit q3

NOR (q1,q2) = NOT (OR (q1,q2))

Open in IBM Quantum Composer


Add TipAsk QuestionCommentDownload
Step 8: The XOR Gate From the Toffoli Gate
We can obtain the XOR gate from the Toffoli gate in the next way:

Toffoli (1,q1,q2) = (1),(q1),(XOR (q2, AND (1, q1))) = (1),(q1), (XOR


(q2,q1))

In the circuit:

• q0 is always |1>
• The gate implement XOR (q1,q2) and the result is present in q3
• In the image the gate is showing XOR (1, 1) = 0

Open in IBM Quantum Composer


Add TipAsk QuestionCommentDownload
Step 9: Quantum Circuit to Implement a Boolean
Function
One we have create the OR, AND and NOT gate we have a set of
universal quantum gates to implement whatever logical boolean
function.

In the image you can see the circuit that implements:

f = (q0 AND q1) OR q4

In the circuit:

• q3 is always |1>
• The circuit implements f (q0,q1,q4) and the result is present in q5
• In the image the gate is showing f (1, 1, 0) = 1

Open in IBM Quantum Composer


Add TipAsk QuestionCommentDownload
Step 10: Futures Projects
With this instructable you can implement whatever logical function
using a quantum circuit because we have created at least three set of
universal quantum gates: (NOT, AND OR), NAND, NOR.

But the real power of a quantum computer are the superposition and
the entanglement.

Two properties we have not used for in this instructable.

It is still very difficult to create clear and intuitive quantum circuits to


demostrate its powerful.

You might also like