Logic Gates
Logic Gates
Logic Gates
We have seen that the foundation of logic design is seated in a well defined
axiomatic system called Boolean algebra, which was shown to be what is known as
a “Huntington system”. In this axiomatic system the definition of AND and OR
operators or functions was set forth and these were found to be well defined
operators having certain properties that allow us to extend their definition to
Hardware applications. These AND and OR operators, sometimes referred to as
connectives, actually suggest a function that can be emulated by some H/w logic
device. The logic Hardware devices just mentioned are commonly referred to as
“gates”.
Keep in mind that the usage of “gate” refers to an actual piece of Hardware
where “function” or “operation” refers to a logic operator AND. On the other hand,
when we refer to a “gate” we are referring directly to a piece of hardware called a
gate. The main point to remember is ‘Don’t confuse gates with logic operators’.
The binary signals at the inputs or outputs of any gate can have one of the
two values except during transition. One signal levels represents logic 1 and the
other logic 0. Since two signal values are assigned two to logic values, there exist
two different assignments of signals to logic.
The terms positive and negative are somewhat misleading since both signal
values may be positive or both may be negative. Therefore, it is not signal polarity
that determines the type of logic, but rather the assignment of logic values
according to the relative amplitudes of the signals.
The effect of changing from one logic designation to the other equivalent to
complementing the logic functions because of the principle of duality of Boolean
algebra.
Gate Definition
The term “logic” is usually used to refer to a decision making process. A logic
gate, then, is a circuit that can decide to say yes or no at the output based upon
inputs. We apply voltage as the input to any gate, therefore the Boolean (logic) 0
and 1 do not represent actual number but instead represent the state of a voltage
variable or what is called its logic level. Sometimes logic 0 and logic 1 may be called
as shown in table below:
Table 2.5.2
a. OR Gate
The OR gate is sometimes called the “any or all gate”. To show the OR gate
we use the logical symbol in Fig. 2.5.4(a).
b.
c. Fig. 2.5.4 (a) OR gate logic symbol . (b) Practical OR gate circuit.
d.
e. A truth-table for the ‘OR’ gate is shown below according to Fig. 2.5.4(b).
The truth-table lists the switch and light conditions for the OR gate. The
unique output from the OR gate is a LOW only when all inputs are low. The
output column in Table (2.5.4) shows that only the first line generates a 0
while all others are 1.
Table 2.5.4
f.
g. Fig. 2.5.4(c) shows the ways to express that input A is ORed with input B to
produce output Y.
h.
i. Fig. 2.5.4 (c)
j. Example. Determine the output Y from the OR gate for the given input
waveform shown in Fig. 2.5.4(d).
k.
l. Fig. 2.5.4 (d)
m. Solution. The output of an OR gate is determined by realizing that it will
be low only when both inputs are low at the same time. For the inputs the
outputs is low only during period t2. In remaining time output is 1 as shown
in Fig. 2.5.4(e).
n.
o. Fig. 2.5.4 (e)
p. We are now familiar with AND and OR gates. At this stage, to illustrate at
least in part how a word statement can be formulated into a mathematical
statement (Boolean expression) and then to hardware network, consider
the following example:
q. Example. Utkarsha will go to school if Anand and Sawan go to school, or
Anand and Ayush go to school.
r. Solution. This statement can be symbolized as a Boolean expression as
follows:
s.
t. The next step is to transform this Boolean expression into a Hardware
network and this is where AND and OR gates are used.
u.
v. The output of gate 1 is high only if both the inputs A and S are high (mean
both Anandand Sawan go to school). This is the first condition for Utkarsha
to go to school.
w. The output of gate 2 is high only if both the inputs A and A.Y are high
(means both Anand and Ayush go to school). This is the second condition
for Utkarsha to go to school.
x. According to example atleast one condition must be fullfilled in order that
Utkarsha goesto school. The output of gate 3 is high when any of the input
to gate 3 is high means at leastone condition is fulfilled or both the inputs
to gate 3 are high means both the conditions are fulfilled.
y. The example also demonstrates that Anand has to go to school in any
condition otherwise Utkarsha will not go to school.
z.
b. AND Gate
The AND gate is sometimes called the “all or nothing gate”. To show the AND
gate we use the logic symbol in Fig. 2.5.3(a). This is the standard symbol to
memorize and use from now on for AND gates.
Fig.
2.5.3 (a) AND Gate logic symbol. (b) Practical AND gate circuit.
Now, let us consider Fig. 2.5.3(b). The AND gate in this figure is connnected
to input switches A and B. The output indicator is an LED. If a low voltage (Ground,
GND) appears at inputs, A and B, then the output LED is not bit. This situation is
illustrated in table (). Line 1 indicates that if the inputs are binary 0 and 0, then the
output will be binary 0. Notice that only binary 1s at both A and B will produce a
binary 1 at the output.
output Y.
Pulsed Operation
In many applications, the inputs to a gate may be voltage that change with time
between
the two logic levels and are called as pulsed waveforms. In studying the pulsed
operation of an AND gate, we consider the inputs with respect to each other in order
to determine the output level at any given time. Following example illustrates this
operation:
Example. Determine the output Y from the AND gate for the given input waveform
c. NOT Gate
In digital logic, an inverter or NOT gate is a logic gate which implements logical negation.
The truth table is shown on the right.
This represents perfect switching behavior, which is the defining assumption in Digital
electronics. In practice, actual devices have electrical characteristics that must be carefully
considered when designing inverters. In fact, the non-ideal transition region behavior of a
CMOS inverter makes it useful in analog electronics as a class A amplifier (e.g., as the output
stage of an operational amplifier[1
NOT gates are often called inverters. A NOT gate's output signal is the opposite of its input
signal. Note that the symbol of the NOT gate is the same as that of the buffer, except for the
small circle near its output. Small circles at input or output lines of a gate's schematic symbol
denote the fact that the signal is inverted.
Input Output
L H
H L
a. NAND Gate
The NAND gate is a NOT AND, or an inverted AND function. The standard
logic symbol for the NAND gate is shown in Fig. (2.5.7a). The little invert
bubble (small circle) on the right end of the symbol means to invert the
output of AND.
b.
Fig. 2.5.7 (a) NAND gate logic symbol (b) A Boolean expression for the
output of a NAND gate.
Figure 2.5.7(b) shows a separate AND gate and inverter being used to
produce the NAND logic function. Also notice that the Boolean expression for
the AND gate, (A.B) and the NAND (A.B)are shown on the logic diagram of
Fig. 2.5.7(b).
The truth-table for the NAND gate is shown in Fig. 2.5.7(c). The truth-table for
the NAND gate is developed by inverting the output of the AND gate. ‘The
unique output from the NAND gate is a LOW only when all inputs are HIGH.
c.
d. Fig. 2.5.7 (c) Truth-table for AND and NAND gates.
Fig. 2.5.7 (d) shows the ways to express that input A is NANDed with input B
yielding output Y.
e.
f. Fig. 2.5.7 (d)
Example. Determine the output Y from the NAND gate from the given input
waveform
g.
h. Fig. 2.5.7 (e)
Solution. The output of NAND gate is determined by realizing that it will be
low only
when both the inputs are high and in all other conditions it will be high. The
ouput Y is
i.
j. Fig. 2.5.7 (f)
The NAND gate as a UNIVERSAL Gate
The chart in Fig. 2.5.7(g) shows how would you wire NAND gates to create
any of the other basic logic functions. The logic function to be performed is
listed in the left column of the table; the customary symbol for that function
is listed in the center column. In the right column, is a symbol diagram of how
NAND gates would be wired to perform the logic function.
k.
l. Fig. 2.5.7 (g)
m. The NOR gate. The NOR gate is actually a NOT OR gate or an inverted
OR function.
n. The standard logic symbol for the NOR gate is shown in Fig. 2.5.7(h)
o.
p. Fig. 2.5.7 (h) NOR gate logic symbol (i) Boolean expression for the output
of NOR gate. Note that the NOR symbol is an OR symbol with a small
invert bubble on the right side. The NOR function is being performed by an
OR gate and an inverter in Fig. 2.5.7(i). The Boolean function for the OR
function is shown (A + B), the Boolean expression for the final NOR
function is (A + B).
q. The truth-table for the NOR gate is shown in Fig. 2.5.7(j). Notice that the
NOR gate truth table is just the complement of the output of the OR gate.
The unique output from the NOR gate is a HIGH only when all inputs are
LOW.
r.
s. Fig. 2.5.7 (j) Truth-table for OR and NOR gates.
t. Figure 2.5.7(k) shows the ways to express that input A is ORed with input
B yielding
u. output Y.
v.
w.
x. Fig. 2.5.7 (k)
y. Example. Determine the output Y from the NOR gate from the given
input waveform shown in Fig. 2.5.7(l).
z.
aa. Fig. 2.5.7 (l)
bb.Solution. The output of NOR gate is determined by realizing that it will be
HIGH only when both the inputs are LOW and in all other conditions it will
be high. The output Y is shown in Fig. 2.5.7(m).
cc.
dd.Fig. 2.5.7 (m)
B . NOR Gate
The NOR gate as a UNIVERSAL gate.
The chart in Fig. 2.5.7(n) shows how would your wire NOR gates to create any
of the other basic logic functions.
The exclusive OR gate is sometimes referred to as the “Odd but not the even
gate”. It is often shortend as “XOR gate”. The logic diagram is shown in Fig. 2.5.8
(a) with its Boolean expression. The symbol means the terms are XORed together.
The truth table for XOR gate is shown in Fig. 2.5.8 (b). Notice that if any but
not all the inputs are 1, then the output will be 1. ‘The unique characteristic of the
XOR gates that it produces a HIGH output only when the odd no. of HIGH inputs are
present.’
Fig. 2.5.8 (b)
To demonstrate this, Fig. 2.5.8 (c) shows a three input XOR gate logic symbol
and the truth table Fig. 2.5.8 (d). The Boolean expression for a three input XOR gate
can be written as
The HIGH outputs are generated only when odd number of HIGH inputs are
present (see T.T.)
Fig. 2.5.8 (e) shows the ways to express that input A is XORed with input B yielding
output Y.
As we know NAND and NOR are universal gates means any logic diagram can
be made using only NAND gates or using only NOR gates.
Example. Determine the output Y from the XOR gate from the given input
waveform shown in Fig. 2.5.8 (f).
Solution. The output XOR gate is determined by realizing that it will be HIGH
only when the odd number of high inputs are present therefore the output Y is high
for time period t2 and t5 as shown in Fig. 2.5.8 (g).
b. The Exclusive NOR gate
c.
d. The Exclusive NOR gate is sometimes reffered to as the ‘COINCIDENCE’ or
‘EQUIVALENCE’ gate. This is often shortened as ‘XNOR’ gate. The logic
diagram is shown in Fig. 2.5.9 (a).
e.
f. Fig. 2.5.9 (a)
g. Observe that it is the XOR symbol with the added invert bubble on the
output side. The Boolean expression for XNOR is therefore, the invert of
XOR function denoted by symbol O.
h.
i.
j. The truth table for XNOR gate is shown in Fig. 2.5.9 (b).
k.
l. Fig. 2.5.9 (b)
m. Notice that the output of XNOR gate is the complement of XOR truth table.
n. ‘The unique output of the XNOR gate is a LOW only when an odd number of
input are HIGH’.
o.
p. Fig. 2.5.9 (c)
q.
r. Fig. 2.5.9 (d)
s. To demonstrate this, Fig. 2.5.9 (c) shows a three input XNOR gate logic
symbol and the truth-table 2.5.9 (d).
t. Figure 2.5.9 (e) shows the ways to express that input A is XNORed with
input B yielding
u. output Y.
v.
w.
x. Fig. 2.5.9 (e)
y. Now at this point, it is left as an exercise for the reader to make XNOR gate
using ANDOR-NOT gates, using NAND gates only and using NOR gates
only.
z. Example. Determine the output Y from the XNOR gate from the given
input waveform shown in Fig. 2.5.9 (f).
aa.
bb.Fig. 2.5.9 (f)
cc. Solution. The output of XNOR gate is determined by realizing that it will
be HIGH only when the even-number of high inputs are present, therefore
the output Y is high for time period t2 and t5 as shown in Fig. 2.5.9 (g).
dd.
ee.F ig. 2.5.9 (g)
ff.
a.The Exclusive NOR gate
gg.
hh.Fig. 2.5.9 (a)
ii. Observe that it is the XOR symbol with the added invert bubble on the
output side. The Boolean expression for XNOR is therefore, the invert of
XOR function denoted by symbol O.
jj.
kk.
ll. The truth table for XNOR gate is shown in Fig. 2.5.9 (b).
mm.
nn.Fig. 2.5.9 (b)
oo. Notice that the output of XNOR gate is the complement of XOR truth table.
pp.‘The unique output of the XNOR gate is a LOW only when an odd number of
input are HIGH’.
qq.
rr. Fig. 2.5.9 (c)
ss.
tt. Fig. 2.5.9 (d)
uu.To demonstrate this, Fig. 2.5.9 (c) shows a three input XNOR gate logic
symbol and the truth-table 2.5.9 (d).
vv. Figure 2.5.9 (e) shows the ways to express that input A is XNORed with
input B yielding
ww.output Y.
xx.
yy.
zz. Fig. 2.5.9 (e)
aaa.Now at this point, it is left as an exercise for the reader to make XNOR
gate using ANDOR-NOT gates, using NAND gates only and using NOR gates
only.
bbb.Example. Determine the output Y from the XNOR gate from the given
input waveform shown in Fig. 2.5.9 (f).
ccc.
ddd.Fig. 2.5.9 (f)
eee.Solution. The output of XNOR gate is determined by realizing that it will
be HIGH only when the even-number of high inputs are present, therefore
the output Y is high for time period t2 and t5 as shown in Fig. 2.5.9 (g).
fff.
ggg.F ig. 2.5.9 (g)
hhh.
2.2 L OGIC DIAGRAM
inhibitor I . The 0 output from I and the 1 output from I are applied to
2 1 2
applied to the delay line. The I output from G along with the 0 output from 1
the delay line produces 1 output from I . The 1 input from G and the 0 3 1
input from the delay line produce a 0 output from inhibitor I . The 0 4
producing a 1 output.
The 1 output from the delay line along with the 1 output
from G produces a 0 output from I . The 1 output from G
1 3 1
produces a 0 output.
2.3 Truth Table
A truth table shows how a logic circuit's output responds to various combinations of the inputs,
using logic 1 for true and logic 0 for false. All permutations of the inputs are listed on the left,
and the output of the circuit is listed on the right. The desired output can be achieved by a
combination of logic gates. A truth table for two inputs is shown, but it can be extended to any
number of inputs. The input columns are usually constructed in the order of binary counting with
a number of bits equal to the number of inputs.
PQ
T T TTFTTTT
T F FTTFFTF
F T FTTFTFF
F F FFFTTTT
Key:
T = true, F = false
= OR (logical disjunction)
= conditional "if-then"
= conditional "(then)-if"
∧FT ∨FT
FFF FFT
TFT TTT
This notation is useful especially if the operations are commutative, although one can
additionally specify that the rows are the first operand and the columns are the second operand.
This condensed notation is particularly useful in discussing multi-valued extensions of logic, as it
significantly cuts down on combinatoric explosion of the number of rows otherwise needed. It
also provides for quickly recognizable characteristic "shape" of the distribution of the values in
the table which can assist the reader in grasping the rules more quickly.
Truth tables in digital logic
Truth tables are also used to specify the functionality of hardware look-up tables (LUTs) in
digital logic circuitry. For an n-input LUT, the truth table will have 2^n values (or rows in the
above tabular format), completely specifying a boolean function for the LUT. By representing
each boolean value as a bit in a binary number, truth table values can be efficiently encoded as
integer values in electronic design automation (EDA) software. For example, a 32-bit integer can
encode the truth table for a LUT with up to 5 inputs.
When using an integer representation of a truth table, the output value of the LUT can be
obtained by calculating a bit index k based on the input values of the LUT, in which case the
LUT's output value is the kth bit of the integer. For example, to evaluate the output value of a
LUT given an array of n boolean input values, the bit index of the truth table's output value can
be computed as follows: if the ith input is true, let Vi = 1, else let Vi = 0. Then the kth bit of the
binary representation of the truth table is the LUT's output value, where k = V0*2^0 + V1*2^1 +
V2*2^2 + ... + Vn*2^n.
Truth tables are a simple and straightforward way to encode boolean functions, however given
the exponential growth in size as the number of inputs increase, they are not suitable for
functions with a large number of inputs. Other representations which are more memory efficient
are text equations and binary decision diagrams.
Applications of truth tables in digital electronics
In digital electronics (and computer science, fields of engineering derived from applied logic and
math), truth tables can be used to reduce basic boolean operations to simple correlations of inputs
to outputs, without the use of logic gates or code. For example, a binary addition can be
represented with the truth table:
A B | C R
1 1 | 1 0
1 0 | 0 1
0 1 | 0 1
0 0 | 0 0
where
A = First Operand
B = Second Operand
C = Carry
R = Result
This truth table is read left to right:
• Value pair (A,B) equals value pair (C,R).
• Or for this example, A plus B equal result R, with the Carry C.
Note that this table does not describe the logic operations necessary to implement this operation,
rather it simply specifies the function of inputs to output values.
In this case it can only be used for very simple inputs and outputs, such as 1's and 0's, however if
the number of types of values one can have on the inputs increases, the size of the truth table will
increase.
For instance, in an addition operation, one needs two operands, A and B. Each can have one of
two values, zero or one. The number of combinations of these two values is 2x2, or four. So the
result is four possible outputs of C and R. If one was to use base 3, the size would increase to
3x3, or nine possible outputs.
The first "addition" example above is called a half-adder. A full-adder is when the carry from the
previous operation is provided as input to the next adder. Thus, a truth table of eight rows would
be needed to describe a full adder's logic:
A B C* | C R
0 0 0 | 0 0
0 1 0 | 0 1
1 0 0 | 0 1
1 1 0 | 1 0
0 0 1 | 0 1
0 1 1 | 1 0
1 0 1 | 1 0
1 1 1 | 1 1
In order to play with TTL gates, you must have several pieces of equipment. Here's a list of what you will need to
purchase:
• A breadboard
• A volt-ohm meter (also known as a multimeter)
• A logic probe (optional)
• A regulated 5-volt power supply
• A collection of TTL chips to experiment with
• Several LEDs (light emitting diodes) to see outputs of the gates
• Several resistors for the LEDs
• Some wire (20 to 28 gauge) to hook things together
These parts together might cost between $40 and $60 or so, depending on where you get them.
Let's walk through a few details on these parts to make you more familiar with them:
• As described on the previous page, a breadboard is a device that makes it easy to wire up your circuits.
• A volt-ohm meter lets you measure voltage and current easily. We will use it
to make sure that our power supply is producing the right voltage.
• The logic probe is optional. It makes it easy to test the state (1 or 0) of a
wire, but you can do the same thing with an LED.
• Of the parts described above, all are easy except the 5-volt power supply.
No one seems to sell a simple, cheap 5-volt regulated power supply. You
therefore have two choices. You can either buy a surplus power supply from
Jameco (for something like a video game) and use the 5-volt supply from it,
or you can use a little power-cube transformer and then build the regulator
yourself. We will talk through both options below.
• An LED (light emitting diode) is a mini light bulb. You use LEDs to see the
output of a gate.
• We will use the resistors to protect the LEDs. If you fail to use the resistors, A resistor and an LED
the LEDs will burn out immediately.
This equipment is not the sort of stuff you are going to find at the corner store.
However, it is not hard to obtain these parts. You have a few choices when trying to purchase the components listed
above:
1. Radio Shack
2. A local electronics parts store - Most major cities have electronics parts stores, and many cities are blessed
with good surplus electronics stores. If you can find a good surplus store in your area that caters to people
building their own stuff, then you have found a goldmine.
3. A mail-order house like Jameco - Jameco has been in business for decades, has a good inventory and good
prices. (Be sure to download their PDF catalog or get a paper catalog from them -- it makes it much easier
to traverse the Web site.)
The following table shows you what you need to buy, with Jameco part numbers listed.
Part Jameco #
Breadboard 20722
5 to 10 LEDs 94529*
Part Jameco #