A decoder, or demultiplexer, is a common digital component that takes a single input line, and connects it to a specified output line, depending on the value of the select input(s).

Here is a symbol for a 1:8 decoder, and logic functions:

  +-------+               __ __ __ 
--|EN   D0|--          D0=S2*S1*S0*EN
  |     D1|--             __ __
  |     D2|--          D1=S2*S1*S0*EN
  |     D3|--             __    __
  |     D4|--          D2=S2*S1*S0*EN
--|S2   D5|--             __
--|S1   D6|--          D3=S2*S1*S0*EN
--|S0   D7|--                __ __
  +-------+            D4=S2*S1*S0*EN


Here, the encoded signal is attached to the "EN" input, and the binary value present on S2-S0 selects which "D" output the decoder connects "EN" to. For example: if the bitstring "010" (2 in decimal) is applied to S, the decoder will connect EN<->D2. If "111" (7) is applied to S, the decoder connects EN<->D7, etc. Any unconnected outputs will hold a logical '0' value, while the connected output holds whatever value is present on "EN".

Note that each of the outputs of the decoder has a logic equation which resembles a minterm. Thus, a decoder can be used as a minterm generator, and as an easy way to implement any logic function--We need only OR together all of the minterms that we want, and ignore the rest, and our function is taken care of. For example, suppose we wish to implement (on our 1:8 decoder) a function with this truth table:

0 0 0|1          <-m0
0 0 1|0
0 1 0|0
0 1 1|0
1 0 0|0
1 0 1|0
1 1 0|1          <-m6
1 1 1|1          <-m7

Notice that I have pointed out minterms 0, 6, and 7. To implement this arbitrary function F, we need only take our decoder, and OR together the outputs that correspond to each minterm, and then we must connect the "EN" input so that it is always '1'.

F = D0 + D6 + D7
S2 = A
S1 = B
S0 = C
EN = 1

And, voila! Our function is implemented.

Note that a decoder need not be 1:8. It could be any of 1:2N. We just need N select inputs, and 2N outputs. (Which, of course, makes really large decoders impractical.)

See also multiplexer.