NAND and NOR Logic

A NAND gate is an AND gate with its output inverted, and a NOR gate is an OR gate with its output inverted. They look like minor variations, yet either one alone can build every other logic function. That property, together with the fact that NAND and NOR are cheaper to make in CMOS than AND and OR, which each need an extra inverter, is why you are so often asked to redesign a circuit using NAND only or NOR only.

Definitions and truth tables

For two inputs AA and BB:


NAND: Y=AB‾NOR: Y=A+B‾\text{NAND: } Y = \overline{A B} \qquad\qquad \text{NOR: } Y = \overline{A + B}



The table compares each inverted gate with its parent.


AA

BB

AND

NAND

OR

NOR

0

0

0

1

0

1

0

1

0

1

1

0

1

0

0

1

1

0

1

1

1

0

1

0


The same rule holds for any number of inputs: a NAND output is 0 only when every input is 1, and a NOR output is 1 only when every input is 0. A three-input NAND therefore gives ABC‾\overline{ABC}.


De Morgan's theorem gives each gate a second reading:


AB‾=Aˉ+BˉA+B‾=Aˉ Bˉ\overline{AB} = \bar{A} + \bar{B} \qquad\qquad \overline{A + B} = \bar{A}\,\bar{B}



Building everything from one gate

A universal gate is a gate type from which NOT, AND and OR, and therefore any Boolean function, can be built. NAND and NOR are both universal. With NAND gates:

  • NOT: tie the inputs together, so A A‾=Aˉ\overline{A\,A} = \bar{A}.
  • AND: follow a NAND with a NAND inverter, so AB‾‾=AB\overline{\overline{AB}} = AB.
  • OR: invert each input, then NAND them, so Aˉ Bˉ‾=A+B\overline{\bar{A}\,\bar{B}} = A + B.

The NOR constructions mirror these: A+A‾=Aˉ\overline{A + A} = \bar{A}, A+B‾‾=A+B\overline{\overline{A+B}} = A + B and Aˉ+Bˉ‾=AB\overline{\bar{A} + \bar{B}} = AB.


Function

Two-input NAND gates

Two-input NOR gates

NOT

1

1

AND

2

3

OR

3

2


Three NAND-gate circuits that produce NOT, AND and OR from inputs A and B.


Two-level NAND–NAND and NOR–NOR circuits

Converting gate by gate wastes inverters. Every gate also adds a propagation delay, the short time between an input change and the gate's output responding, so the delay of a path is the sum of the delays of the gates along it. The sum-of-products core maps to two NAND levels when the required input polarities are already available; any input inverters add delay on their paths. For F=PQ+RSF = PQ + RS, complement twice and apply De Morgan's theorem to the inner bar:


F=PQ+RS‾‾=PQ‾⋅RS‾‾F = \overline{\overline{PQ + RS}} = \overline{\overline{PQ}\cdot\overline{RS}}


This is a NAND–NAND realization: replace every AND gate and the OR gate of the sum-of-products circuit with NAND gates and keep the wiring. A single literal that went straight into the OR gate must enter the output NAND complemented. Dually, a product of sums becomes a NOR–NOR circuit:


(P+Q)(R+S)=P+Q‾+R+S‾‾(P + Q)(R + S) = \overline{\overline{P + Q} + \overline{R + S}}



In CMOS, a two-input NAND needs four transistors, while an AND gate is a NAND plus an inverter, six transistors. NAND is usually preferred over NOR because NOR stacks pMOS transistors in series, and a pMOS transistor conducts less well than an nMOS transistor of the same size. A single 74HC00 chip holds four two-input NAND gates, so NAND-only designs often save chips as well as gates.


What to remember

  • NAND is AB‾\overline{AB}, which is 0 only when all inputs are 1. NOR is A+B‾\overline{A+B}, which is 1 only when all inputs are 0.
  • Both are universal: tie inputs for NOT; AND costs 2 NANDs or 3 NORs; OR costs 3 NANDs or 2 NORs.
  • A sum of products maps to NAND–NAND; a product of sums maps to NOR–NOR.
  • Cascaded two-input NANDs do not form a multi-input NAND.

Example: A pump interlock built from NAND gates only

A tank pump must run (F=1F = 1) when the operator switch AA and the level sensor BB are both on, or when the manual override DD is on and the maintenance lock CC is off:


F=AB+CˉDF = AB + \bar{C}D


Only 74HC00 chips are in stock. Each chip contains four two-input NAND gates, and each gate has a propagation delay of 9 ns. Only the uncomplemented signals AA, BB, CC and DD are available.


a) Write FF in a NAND-only form and state how many two-input NAND gates the circuit needs.


A sum of products converts to NAND–NAND form by complementing twice and applying De Morgan's theorem to the inner bar:


F=AB+CˉD‾‾=AB‾⋅CˉD‾‾F = \overline{\overline{AB + \bar{C}D}} = \overline{\overline{AB}\cdot\overline{\bar{C}D}}


The product CˉD\bar{C}D needs Cˉ\bar{C}, which a NAND gate with both inputs tied to CC supplies. The gates are:

  • G1 =NAND(C,C)=Cˉ= \text{NAND}(C, C) = \bar{C}
  • G2 =NAND(A,B)=AB‾= \text{NAND}(A, B) = \overline{AB}
  • G3 =NAND(Cˉ,D)=CˉD‾= \text{NAND}(\bar{C}, D) = \overline{\bar{C}D}
  • G4 =NAND(G2,G3)=F= \text{NAND}(\text{G2}, \text{G3}) = F


Four NAND gates G1 to G4 connecting inputs A, B, C and D to output F.


The circuit needs 4 two-input NAND gates.


b) Trace the inputs A=0A = 0, B=1B = 1, C=0C = 0, D=1D = 1 through every gate and check the result against the original expression.


Apply the NAND rule (output 0 only when both inputs are 1) gate by gate:

  • G1 =NAND(0,0)=1= \text{NAND}(0, 0) = 1
  • G2 =NAND(0,1)=1= \text{NAND}(0, 1) = 1
  • G3 =NAND(1,1)=0= \text{NAND}(1, 1) = 0
  • G4 =NAND(1,0)=1= \text{NAND}(1, 0) = 1

Directly from the expression: AB=0⋅1=0AB = 0 \cdot 1 = 0 and CˉD=1⋅1=1\bar{C}D = 1 \cdot 1 = 1, so F=0+1=1F = 0 + 1 = 1. Both give F=1F = 1: the override is on and the lock is off, so the pump runs.


c) Find the worst-case propagation delay from an input change to a settled output FF, treating every gate as having exactly 9 ns of delay and ignoring wire delay.


The worst case is the path through the most gates in series. List every input-to-output path:

  • AA or BB: G2, then G4, so ________ gates.
  • DD: G3, then G4, so ________ gates.
  • CC: G1, then G3, then G4, so ________ gates.


tworst=3×9 ns=27 nst_{\text{worst}} = 3 \times 9\ \text{ns} = 27\ \text{ns}


The inverter for CC adds a third level only on the CC path. In a real chip the delay also depends on supply voltage and load, so the stated 9 ns is a modelling assumption.


d) The same function could be built with 74HC08 (four two-input AND gates), 74HC32 (four two-input OR gates) and 74HC04 (six inverters) chips. Compare the number of chips each design needs.


The AND–OR design needs two AND gates (ABAB and CˉD\bar{C}D), one OR gate and one inverter. Each type sits on a different chip, so it needs one 74HC08, one 74HC32 and one 74HC04: 3 chips.


The NAND design uses 4 gates, which fill exactly one 74HC00: 1 chip. Using a single universal gate type lets every gate share one package, saving two chips and their board space and wiring.

A three-input NAND gate and a three-input NOR gate both receive the inputs A=1A = 1, B=0B = 0, C=1C = 1. What are the two outputs?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

Each input of a two-input NOR gate is driven by its own NOR gate wired as an inverter, with both inputs of that gate tied together. The first inverter receives AA and the second receives BB. Which Boolean expression gives the final output YY?


Three NOR gates connect inputs A and B through separate tied-input gates to a final NOR gate with output Y.


Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

A two-input circuit is built from four NAND gates, each with a propagation delay of 7.5 ns. Gate N1 receives AA and BB. Gate N2 receives AA and the output of N1. Gate N3 receives BB and the output of N1. Gate N4 receives the outputs of N2 and N3 and drives the output YY.


Four NAND gates N1 to N4 connecting inputs A and B to output Y.


Treat every gate as having exactly this delay and ignore wire delay. What is the worst-case propagation delay from a change at an input to a settled output YY? Give your answer in ns to one decimal place.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

Extra Practice