0% found this document useful (0 votes)
57 views6 pages

Logic Gates From Computer Science-Paper 2-Logo - 2023-2025

Uploaded by

Hoda
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)
57 views6 pages

Logic Gates From Computer Science-Paper 2-Logo - 2023-2025

Uploaded by

Hoda
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/ 6

1.

2 Logic Gates

1.2.1 Logic Gates


A logic gate takes in binary inputs and produces a binary output.
Logic circuits are made up of several logic gates and are designed to carry out a specific
function.
Many electronic circuits have to make decisions.
The process of doing this uses electroniclogic, which is based on digital switches called
Logical Gates.
Logic gates are devices that can combine multiple inputs at independent logic levels and come
up with an output accordingly. They are used by implementing Boolean algebra. Logic gates have
two or more input and one output except NOT Gate which has one input and one output.
The most common Logical Gates are given below:

For example, the most obvious use is for simple control. Imagine designing a microwave machine
so that the heat only turns on using electromagnetic waves when the microwave is loaded
(logic-1), the door is closed (logic -1) but the food/drink are not yet vibrate (logic -0). This can be
done by ANDing the first two conditions, and inverting the third. Now, AND these together, and you
get a high only when all three conditions are satisfied.
Two or more logic gates can be connected to produce a logic circuit with one or more outputs
from two or more inputs.

Truth Tables:
“A truth table is used to show the output of a logic gate or circuit for all possible combinations of
input values.”
Usually the binary values are use d, 1 and 0, as shorthand for True and False.

The truth table for a two-input gate needs four rows (22=4) while for 3-input gate needs eight rows
(23=8).
1.2 Logic Gates

Gates and their Truth tables


1) NOT Gate (Inverter):
A NOT gate or an inverter is the simplest kind of logic gate. Its function is to give the opposite
output to its input - if it gets a high (1), it gives a low (0), and vice versa.
This is equivalent to saying that the output is not the input.
NOT Gate
Input A Output X
0 1
1 0
The output X) =1 if
INPUT A is NOT 1(i.e. 0 or OFF).
𝑿=𝑨
2) AND Gate
An AND gate gives an output 1 only when both inputs are 1.
If one or more inputs are 0, then the output is also 0.

Input A Input B Output x


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

The output (called X) is true (i.e. 1 or ON ) only if the ( INPUT A AND INPUT B) are both true (i.e. 1
or ON).
The x=1 if
INPUT A is 1 AND INPUT B is 1
𝑿 = 𝑨 .𝑩

3) OR Gate
An OR gate
is low (0).
Input A Input B Output x
0 0 0
0 1 1
1 0 1
1 1 1

The output (called X) is true (i.e. 1 or ON) if the (INPUT A OR INPUT B ) are true (i.e. 1 or ON ).
The OUTPUT X=1 IF
Either INPUT A is 1
OR INPUT B is 1
𝑿 = 𝑨+𝑩
1.2 Logic Gates

4) NAND Gate
This NOT AND combination is shortened to just NAND. A NAND gate gives a 0 output only when
both inputs are 1. If one or more inputs are 0, then the output is 1.
Input A Input B A AND B OUTPUT X
0 0 0 1
0 1 0 1
1 0 0 1
1 1 1 0
The output (called X) is true (i.e. 1 or ON) if
(INPUT A AND INPUT B) are NOT both true (i.e. 1 or ON). Is 1
𝑿=𝑨. 𝑩

5) NOR Gate
This NOT OR combination is shortened to just NOR. A NOR gate gives a 1 output only if no inputs
are 1. If an input is 0, then the output is 0.

Input A Input B A OR B OUTPUT X


0 0 0 1
0 1 1 0
1 0 1 0
1 1 1 0
The OUTPUT x=0 IF
Either INPUT A is 1 OR INPUT B is 1
𝑿= 𝑨+ 𝑩

6) XOR Gate
The 'Exclusive-OR' gate is a circuit which will give a 1 output if either, but not both, of its two
inputs are 1. If both inputs are same then output will be 0 else output will be 1

Input A Input B Output x


0 0 0
0 1 1
1 0 1
1 1 0
The OUTPUT X=1 IF
Either A is 1 AND B is NOT 1
OR A is NOT 1 AND B is 1
Or it may be said that X=1 If A is 1 OR B is 1 BUT NOT BOTH
𝑿 = (𝑨 . 𝑩) + (𝑨 . 𝑩)
1.2 Logic Gates

1.2.2 Logic Circuits


Two or more logic gates can be connected to produce a logic circuit with one or more outputs from
two or more inputs. A logic circuit can process logical expressions and binary numbers.
When producing a truth table for a logic circuit:
• it is helpful to add a column for each intermediate output as well as for the final output
• as for a single logic gate with two inputs, a logic circuit with two inputs needs four rows.
Combinational logic circuits with three inputs
We only need to be able to produce a truth table for a logic circuit with a maximum of three inputs
and six gates.
The truth table for a three-input logic circuit needs eight rows.
Designing simple logic circuits
Sometimes, it is cheaper to design and hard-wire a logic circuit for a simple automated system that
only requires a fixed pattern of output depending on the current values of the inputs, than to
program a microcontroller or computer.
We can use the words AND, OR, NOT, NAND and NAND as operators in a logical equation, such
as L = (A AND B) OR NOT B. We use brackets to indicate that the logical operation within the
brackets takes priority.
We can design a logic circuit to solve a written statement of a logical problem. First, we rewrite the
statement using brackets to clarify the binary value of each variable and the priority of the logical
operations. Then we can write the logical equation. From the logical equation, if not an earlier
stage in the rewriting process, it should be possible to draw the required logic circuit and a truth
table to confirm that it has the required behaviour.
1.2 Logic Gates

Logic Building Block

It is possible to build up any logic gate, using NAND or NOR gates only.
NAND and NOR Gates can be used to build any other gates, and called „logic building block‟. It is
cost effective for manufacturer to use a single gate to build any logic circuit.
For example, the AND, OR and NOT gates can be built from these gates as shown below:
NAND as NOT:
If single input is given to NAND or NOT gate output will inverted

NAND as AND:
NAND on NAND will become AND

NAND as OR:

NAND as NOR

NAND as XOR
1.2 Logic Gates

Example 1
Produce a truth table for the following logic circuit (note the use of • at junctions):

There are three inputs to this logic circuit, therefore there will be eight possible binary values which
can be input.

To show step-wise how the truth table is produced, the logic circuit has been split up into three parts
and intermediate values are shown as P, Q and R.

Part 1
This is the first part of the logic circuit; the first task is to find the intermediate values
P and Q.

Figure
truth table for part 1:

The value of P is found from the AND gate where the inputs are A and B. The value of Q is found from
the NOR gate where the inputs are B and C.

You might also like