Sub topic 5
Building Circuits from NAND or NOR Only
This chapter assumes you know Boolean variables, truth tables, AND, OR, and NOT gates. You should also be comfortable with Boolean algebra and De Morgan’s laws:
\[ \overline{A+B}=\overline{A}\cdot\overline{B} \]
\[ \overline{A\cdot B}=\overline{A}+\overline{B} \]
A universal gate is a gate type that can implement any Boolean function by itself. NAND and NOR are universal gates because each can create NOT, AND, and OR operations.
NAND as a Universal Gate
A NAND gate produces the complement of AND:
\[ A \text{ NAND } B=\overline{A\cdot B} \]
NOT from NAND
Connect both inputs to the same signal:
\[ \overline{A}=A \text{ NAND } A \]
AND from NAND
First form NAND, then invert its result with another NAND:
\[ A\cdot B=\overline{\overline{A\cdot B}} \]
module and_from_nand(
input a,
input b,
output y
);
wire n;
assign n = ~(a & b);
assign y = ~(n & n);
endmoduleOR from NAND
De Morgan’s law gives:
\[ A+B=\overline{\overline{A} \cdot \overline{B}} \]
Therefore, invert each input with a NAND gate and feed the results into a third NAND gate.
NOR as a Universal Gate
A NOR gate produces the complement of OR:
\[ A \text{ NOR } B=\overline{A+B} \]
NOT from NOR
Tie both inputs together:
\[ \overline{A}=A \text{ NOR } A \]
OR from NOR
First form NOR, then invert the result:
\[ A+B=\overline{\overline{A+B}} \]
AND from NOR
Using De Morgan’s law:
\[ A\cdot B=\overline{\overline{A}+\overline{B}} \]
Invert both inputs with NOR gates, then apply NOR to those inverted signals.
| Required operation | NAND-only construction | NOR-only construction |
|---|---|---|
| NOT | \(A \text{ NAND } A\) | \(A \text{ NOR } A\) |
| AND | NAND followed by NAND inverter | Invert both inputs, then NOR |
| OR | Invert both inputs, then NAND | NOR followed by NOR inverter |
Converting a Boolean Expression
To implement a function with NAND gates, a sum-of-products expression is usually convenient. For example:
\[ F=AB+CD \]
Create \(AB\) and \(CD\) with NAND gates, producing their complements. Then use a final NAND gate:
\[ F=\overline{\overline{AB}\cdot\overline{CD}} \]
This is the NAND-NAND form.
For NOR gates, a product-of-sums expression is usually convenient. If:
\[ F=(A+B)(C+D) \]
Use NOR gates to create the complemented sums, then use a final NOR gate. This is the NOR-NOR form.
Exercise
Build \(F=A+B\) using only three NAND gates.
Show answer
Use one NAND gate as an inverter for A, one as an inverter for B, and a third NAND gate to compute \(\overline{\overline{A}\cdot\overline{B}}=A+B\).