Binary Encoder Binary encoder has 2n input lines and n-bit output lines. It can be 4-to-2, 8-to-3 and 16-to-4 line configurations. VHDL Code for 4 to 2 encoder can be designed both in structural and behavioral modelling. 4 to 2 encoder design using logic gates Truth Table for 4 to 2 encoder VHDL Code for 4