Encoder
An encoder is a circuit that changes a set of signals into a code. Let's
begin making a 2to1 line encoder truth table by reversing the 1to2 decoder
truth table.

1to2 decoder reversed truth table. 
This truth table is a little short. A complete truth table would be

2to1 decoder with empty entries 
One question we need to answer is what to do with those other inputs? Do
we ignore them? Do we have them generate an additional error output? In many
circuits this problem is solved by adding sequential logic in order to know not
just what input is active but also which order the inputs became active.
A more useful application of combinational encoder design is a binary to
7segment encoder. The seven segments are given according

7segment display 
Our truth table is:

7segment truth table 
Deciding what to do with the remaining six entries of the truth table is
easier with this circuit. This circuit should not be expected to encode an
undefined combination of inputs, so we can leave them as "don't care" when we
design the circuit. The boolean equations are

7segment equations 
and the circuit is
(See Figure[04474.png below].)

7segment circuit 

Sevensegment decoder gate level diagram. 

7segment ladder 

7segment ladder 
