Digital Circuits/Encoders-Decoders

Encoders and decoders are similar to multiplexers and demultiplexers, except that they are a little bit more complicated.

Decoders
Decoders will have N inputs, and $$2^N$$ output. Let's say that we have two inputs (A and B), and 4 outputs (M N O P). Decoders will satisfy the following truth table:

Binary numbers come in, and essentially select which wire to send a signal on. chankana

Encoders
Encoders work in exactly the opposite way as decoders, taking $$2^N$$ inputs, and having N outputs. When a bit comes in on an input wire, the encoder outputs the physical address of that wire.It takes 2^n inputs and gives out n outputs,the enable pin should be kept 1 for enabling the circuit.

Priority Encoders
A Priority Encoder works opposite of the decoder circuit. Priority Encoders have logical ranking within them, input1 may be higher than input2. If input2 and input1 were pressed, the encoder would determine the priority, and accept the input.

Encoders and Multiplexers
The relationship between the two.

A multiplexer (MUX) is a combination circuit that contains more than one input line, one output line and more than one selection line. Whereas, an encoder is also considered a type of multiplexer but without a single output line.It is a combinational logic function that has 2^n (or fewer) input lines and n output lines.