Logic Gates (Revision)
Logic Gates (Revision)
LOGIC GATES
REVISION
Disclaimer:
Most of the contents (if not all) are extracted from resources available for Digital Fundamentals 10th Edition.
REVISION
THE INVERTER
The inverter performs the Boolean NOT operation. When the input is LOW, the output is HIGH; when the input is
HIGH, the output is LOW.
The NOT operation (complement) is shown with an overbar. Thus, the Boolean expression for an inverter is
Input Output Example waveforms:
A X
LOW (0) HIGH (1)
HIGH (1) LOW(0)
A group of inverters can be used to form the 1’s complement (toggling all bits in it, i.e., transforming the 0 bit to 1 and
the 1 bit to 0) of a binary number:
REVISION
THE AND GATE
The AND gate produces a HIGH output when all inputs are HIGH; otherwise, the output is LOW. For a 2-input gate,
the truth table is
Example Waveforms
The AND operation is usually shown with a dot between the variables, but it may be implied (no dot). Thus, the
AND operation
The AND is written
operation is usedasinXcomputer
= A .B or programming
X = AB. as a selective mask. If you want to retain certain bits of a
binary number but reset the other bits to 0, you could set a mask with 1’s in the position of the retained bits.
If the binary number 10100011 is ANDed with the mask 00001111, what is the
EXAMPLE result? 00000011
REVISION
THE OR GATE
The OR gate produces a HIGH output if any input is HIGH; if all inputs are LOW, the output is LOW. For a 2-input
gate, the truth table is
Inputs Output
A B X
0 0 0
0 1 1
1 0 1
1 1 1
The OR operation is shown with a plus sign (+) between the variables. Thus, the OR operation is written as X = A +
B.
Example Waveforms
THE OR GATE
EXAMPLE
ASCII letters have a 1 in the bit 5 position for lower case letters and a 0 in this position for capitals. (Bit positions are
numbered from right to left starting with 0.) What will be the result if you OR an ASCII letter with the 8-bit mask
00100000?
The NAND operation is shown with a dot between the variables and an overbar covering them. Thus, the NAND
operation is written as X = A .B (Alternatively, X = AB.)
The NOR operation is shown with a plus sign (+) between the variables and an overbar covering them. Thus, the
NOR operation is written as X = A + B.
EXAMPLE
Notice that the If the A and B waveforms are both inverted
XOR gate will for the above waveforms, how is the output
Example Waveforms produce a affected?
HIGH only
when exactly There is no change in the output.
one input is
HIGH.
REVISION
THE XNOR GATE
The XNOR gate produces a HIGH output only when both inputs are at the same logic level. The truth table is
Example Waveforms
EXAMPLE
If the Awaveform is inverted but Bremains the same, how is the
output affected?