An encoder is a combinational circuit that performs reverse function of a decoder. It accepts 2^{n} input and produces output in n output lines. This process of generating codes based on the values of input lines is called encoding.

**4 to 2 Encoder**

A 4 to 2 bit encoder consists of 4 input lines and 2 output lines. When any of the input lines becomes 1, we get corresponding binary at the output lines.

Truth table of 4 to 2 bit encoder is,

Input | Output | ||||
---|---|---|---|---|---|

Y3 | Y2 | Y1 | Y0 | A1 | A2 |

0 | 0 | 0 | 1 | 0 | 0 |

0 | 0 | 1 | 0 | 0 | 1 |

0 | 1 | 0 | 0 | 1 | 0 |

1 | 0 | 0 | 0 | 1 | 1 |

From the truth table, we can find logic expressions for A1 and A2 as following,

$${A_1=Y3+Y2}$$ $${A_2=Y3+Y1}$$