Encoder design in Verilog
In digital circuits, the encoder is a component that performs one hot to binary conversion, That is, if there are 2^n input lines, and at most only one of them will ever be high, the binary code of this 'hot' line is produced on the n-bit output lines.
The encoder can be designed in verilog using case statement or if statement, both coding styles are presented in addition to test bench
1- 4x16 Encoder using if statement :
2- 4x16 Encoder using case statement :
3- Test bench :
4- simulation results :