LearnGates

The 2-to-4 decoder

A decoder turns a binary number into “which one”. A 2-to-4 decoder has two inputs, S1 and S0, that form a number from 0 to 3, and four outputs Y0 to Y3. Exactly one output is 1: the one whose number is on the inputs.

Truth table

Truth table of 2-to-4 decoder
S1S0Y0Y1Y2Y3
001000
010100
100010
110001

Try it Click the inputs to change them.

Y01Y10Y20Y30

How it works

Each output recognises one combination. Y2 must be 1 only for S1 = 1 and S0 = 0, so Y2 = S1 AND NOT S0. The other outputs follow the same pattern: each one is an AND of S1 or its opposite with S0 or its opposite. Two NOT gates provide the opposites for all four.

Decoders pick things out by number: which memory chip answers an address, which digit of a display is lit, which instruction a processor is running.

Hints and solution

Try on your own first. Each hint gives away a little more.

  1. Y2 should be 1 for S1 = 1, S0 = 0.
  2. Each output is an AND of S1 or NOT S1 with S0 or NOT S0.