CS355 Sylabus
One-to-many switch: decoder

• The decoder is not actually a real one-to-many switch, but it is used for the purpose of selecting one register out of a set (many) of registers.

So in that role (selecting one out of many), it can be used as a one-to-many switch in the construction of the CPU.

Later, I will show you a real one-to-many digital switching device called "demultiplexor". This device can be found in telephone and network equipments that redirect one stream onto one of its many outputs.

• Schematically, a decoder has N control signals and 2N output signals.

At any time, exactly one output signal is equal to 1 (and all other outputs are equal to 0) and the output signal that is 1 depends on the current values of the control signals.

The following figure shows schematically what a 2x4 decoder does. The 2x4 decoder has 2 control signals and 4 outputs:

• The following figure shows how a 2x4 decoder can be constructed using elementary gates:

• The construction is very simple, just make sure you remember that an AND gate outputs 1 only when ALL its inputs are equal to 1.

• You connect the inputs of the and-gates to every possible combinations of the input signals:

• (c1) (c0)
• (c1) (NOT c0)
• (NOT c1) (c0)
• (NOT c1) (NOT c0)

• The right figure shows that when what happens when the control signals c1 = 1 and c0 = 0. In this case, c1 = 1 and (NOT c0 = 1), so that the second AND gate will receive all 1's as inputs. Only this and gate will output 1, and all other and gates will output 0.

• Here is a logic-sim circuit file that implements a 2x4 decoder: click here