difference between decoder and encoder
A decoder is a multiply-input, multiply-output combinational logic circuit that converts coded inputs into coded outputs, where the input and output codes are different. The most commonly used input code is an n-bit binary code. The most commonly used output code is a 1-out-of-m code (which contains m output bits), where only one bit is asserted at any time.
If the device’s output code has fewer bits than the input code, the device is usually called an encoder. Probably the simplest encoder to build is s binary encoder. The outputs of a binary encoder produce a binary number that corresponds to the address of the activated input.