# 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 ${\displaystyle 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:

 A B M N O P 0 0 1 0 0 0 0 1 0 1 0 0 1 0 0 0 1 0 1 1 0 0 0 1

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 ${\displaystyle 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.

Truth Table for 4:2 encoder circuit
Y3 Y2 Y1 Y0 A B
0 0 0 1 0 0
0 0 1 0 0 1
0 1 0 0 1 0
1 0 0 0 1 1

## 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.

This section of the Digital Circuits wikibook is a stub. You can help by expanding this section. If you add something, list yourself as a Contributor.