Logic Gates For AME Students
Logic Gates For AME Students
NAND and NOR logic gates are the two pillars of logic, in that all other types of Boolean logic gates (i.e., AND, OR, NOT, XOR,
XNOR) can be created from a suitable network of just NAND or just NOR gate(s). They can be built from relays or transistors, or any
other technology that can create an inverter and a two-input AND or OR gate. Hence the NAND and NOR gates are called the
universal gates.
For an input of 2 variables, there are 16 possible boolean algebraic functions. These 16 functions are enumerated below, together with
their outputs for each combination of inputs variables.
0 0 1 1
0 1 0 1
0 0 0 0
A AND B
0 0 0 1
A> B*
0 0 1 0
0 0 1 1
A< B*
0 1 0 0
0 1 0 1
A XOR B
0 1 1 0
A OR B
0 1 1 1
A NOR B
1 0 0 0
INPUT
OUTPUT
A XNOR B 1 0 0 1
NOT B
1 0 1 0
AB*
1 0 1 1
NOT A
1 1 0 0
AB*
1 1 0 1
A NAND B 1 1 1 0
1 1 1 1
The four functions labeled with a "*" are the logical implication functions: "A B" can be read as "A implies B"; it follows that "A >
B" is "A does not imply B". These four functions are less common and are usually not implemented directly as logic gates.
There are two sets of symbols in common use, both now defined by ANSI/IEEE Std 91-1984 and its supplement ANSI/IEEE Std 91a1991. The "distinctive shape" set, based on traditional schematics, is used for simple drawings and is quicker to draw by hand. It is
sometimes unofficially described as "military", reflecting its origin if not its modern usage. The "rectangular shape" set, based on IEC
60617-12, has rectangular outlines for all types of gate, and allows representation of a much wider range of devices than is possible
with the traditional symbols. The IEC's system has been adopted by other standards, such as EN 60617-12:1999 in Europe and BS EN
60617-12:1999 in the United Kingdom.
In the 1980s, schematics were the predominant method to design both circuit boards and custom ICs known as gate arrays. Today
custom ICs and the field-programmable gate array are typically designed with Hardware Description Languages (HDL) such as
Verilog or VHDL. The need for complex logic symbols has diminished and distinctive shape symbols are still the predominate style.
[citation needed]
Type
Distinctive shape
Rectangular shape
Boolean algebra
between A & B
Truth table
INPUT OUTPUT
AND
A AND B
INPUT OUTPUT
OR
A OR B
A+B
INPUT OUTPUT
NOT
NOT A
In electronics a NOT gate is more commonly called an inverter. The circle on the symbol is called a bubble, and is generally used in
circuit diagrams to indicate an inverted (active-low) input or output. [1][2]
INPUT OUTPUT
NAND
B A NAND B
INPUT OUTPUT
NOR
A NOR B
.
Two more gates are the exclusive-OR or XOR function and its inverse, exclusive-NOR or XNOR. The two input Exclusive-OR is true
only when the two input values are different, false if they are equal, regardless of the value. If there are more than two inputs, the gate
generates a true at its output if the number of trues at its input is odd ([2]). In practice, these gates are built from combinations of
simpler logic gates.
INPUT OUTPUT
XOR
A XOR B
INPUT OUTPUT
XNOR
B A XNOR B
OR N
OREXOREXNORO B
utput of
each
gate A
0A
ND
0
NA
ND
Inputs
Q = A AND NOT B
Inputs
Working out the function of a combination of gates
Truth tables can be used to work out the function of a combination of gates.
For example the truth table on the right show the intermediate outputs D and E as well as the
final output Q for the system shown below.
Outputs
D = NOT (A OR B)
E = B AND C
Q = D OR E = (NOT (A OR B)) OR (B AND C)
To change the type of gate, such as changing OR to AND, you must do three things:
For example an OR gate can be built from NOTed inputs fed into a NAND (AND + NOT) gate.
NOT
AND
OR
NOR
Then simplify the system by deleting adjacent pairs of NOT gates (marked X above). This can be done because the
second NOT gate cancels the action of the first.
The final system is shown on the right. It has five NAND gates and requires two ICs (with four gates on each IC). This is
better than the original system which required three ICs (one for each type of gate).
Substituting NAND (or NOR) gates does not always increase the number of gates, but when it does (as in this example)
the increase is usually only one or two gates. The real benefit is reducing the number of ICs required by using just one
type of gate.
Introduction
Boolean functions may be practically implemented by using electronic gates. The following points are important to understand.
Logic gates
Digital systems are said to be constructed by using logic gates. These gates are the AND, OR, NOT, NAND, NOR, EXOR and
EXNOR gates. The basic operations are described below with the aid of truth tables.
AND gate
The AND gate is an electronic circuit that gives a high output (1) only if all its inputs are high. A dot (.) is used to show
the AND operation i.e. A.B. Bear in mind that this dot is sometimes omitted i.e. AB
OR gate
The OR gate is an electronic circuit that gives a high output (1) if one or more of its inputs are high. A plus (+) is used to
show the OR operation.
NOT gate
The NOT gate is an electronic circuit that produces an inverted version of the input at its output. It is also known as an
inverter. If the input variable is A, the inverted output is known as NOT A. This is also shown as A', or A with a bar over
the top, as shown at the outputs. The diagrams below show two ways that the NAND logic gate can be configured to
produce a NOT gate. It can also be done using NOR logic gates in the same way.
NAND gate
This is a NOT-AND gate which is equal to an AND gate followed by a NOT gate. The outputs of all NAND gates are high
if any of the inputs are low. The symbol is an AND gate with a small circle on the output. The small circle represents
inversion.
NOR gate
This is a NOT-OR gate which is equal to an OR gate followed by a NOT gate. The outputs of all NOR gates are low if any
of the inputs are high.
The symbol is an OR gate with a small circle on the output. The small circle represents inversion.
EXOR gate
The 'Exclusive-OR' gate is a circuit which will give a high output if either, but not both, of its two inputs are high. An
encircled plus sign ( ) is used to show the EOR operation.
EXNOR gate
The 'Exclusive-NOR' gate circuit does the opposite to the EOR gate. It will give a low output if either, but not both, of its two inputs
are high. The symbol is an EXOR gate with a small circle on the output. The small circle represents inversion.
The NAND and NOR gates are called universal functions since with either one the AND and OR functions and NOT can be generated.
Note:
A function in sum of products form can be implemented using NAND gates by replacing all AND and OR gates by NAND gates.
A function in product of sums form can be implemented using NOR gates by replacing all AND and OR gates by NOR gates.
Table 1: Logic gate symbols
Table 2 is a summary truth table of the input/output combinations for the NOT gate together with all possible input/output
combinations for the other gate functions. Also note that a truth table with 'n' inputs has 2n rows. You can compare the outputs of
different gates.
Table 2: Logic gates representation using the Truth table
Example
A NAND gate can be used as a NOT gate using either of the following wiring configurations.