Skip to content
BetterDL

Fan-in

Also called: fanin, gate fan-in

The number of inputs a logic gate has. A 3-input AND gate has a fan-in of 3; wide gates are often built from trees of 2-input gates.

Fan-in is simply the number of inputs on a gate. A NOT gate has a fan-in of 1, a standard 2-input NAND has 2, and a 4-input OR has 4.

In logic terms a multi input gate works just like its 2-input version. In hardware, fan-in is limited. In CMOS, each extra input on a NAND or NOR adds a transistor to a series stack, and a long stack switches slowly. So libraries offer gates with up to about 4 inputs, and wider functions are built from several gates.

How to build a wide gate from 2-input ones:

  • AND, OR, XOR: connect gates of the same type, because the operation is associative. A tree (pair up inputs, then pair up the results) is faster than a long chain. A chain of n inputs is n − 1 gates deep, while a tree is only about log₂ n deep.
  • NAND, NOR, XNOR: don't chain them directly. Build the AND, OR or XOR tree first, then make the last gate the inverting one.

Fan-in is easy to confuse with fan out, which counts how many gate inputs a single output drives. Fan-in is about a gate's inputs; fan-out is about where a signal goes.

ABCDY

Worked example

Example

A 4-input NAND from 2-input gates

Only 2-input gates are available. Build Y = .

  1. 1.

    First level: AND(A, B) gives and AND(C, D) gives .

  2. 2.

    Second level: a NAND of those two gives .

  3. 3.

    Three gates, two levels deep. Only the last gate inverts.

  4. 4.

    Check A = B = C = D = 1: the ANDs give 1 and 1, and the NAND gives 0. Any 0 input would make one AND 0 and the NAND 1. ✓

Common mistakes

  • Mixing up fan-in (a gate's number of inputs) with fan-out (the number of inputs one signal drives).

  • Widening a NAND by chaining NANDs. The inversion must happen once, at the end.

  • Assuming any fan-in is free. Very wide gates are slow in real hardware, so they are split into trees.

Practice Fan-in

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

Fan-in is taught in Logic Gates.