8 to 3 encoder with priority Verilog code
This page of Verilog source code section covers 8 to 3 encoder with priority Verilog code. The block diagram and truth table of 8 to 3 encoder with priority Verilog code is also mentioned.
Block Diagram of 8 to 3 encoder with priority

Truth Table of 8 to 3 encoder with priority

8 to 3 encoder with priority Verilog code
module prio_enco(en, a_in, y_op);
input en;
input [7:0] a_in;
output [2:0] y_op;
reg [2:0] y_op;
always @ (a_in,en)
begin
case (a_in)
8'b00000001: y_op = 3'b000;
8'b0000001x: y_op= 3'b001;
8'b000001xx: y_op= 3'b010;
8'b00001xxx: y_op= 3'b011;
8'b0001xxxx: y_op= 3'b100;
8'b001xxxxx: y_op= 3'b101;
8'b01xxxxxx: y_op= 3'b110;
8'b1xxxxxxx: y_op= 3'b111;
default: y_op=3'bxxx;
endcase
end
endmodule
USEFUL LINKS to VHDL CODES
Refer following as well as links mentioned on left side panel for useful VHDL codes.
D Flipflop
T Flipflop
Read Write RAM
4X1 MUX
4 bit binary counter
Radix4 Butterfly
16QAM Modulation
2bit Parallel to serial
USEFUL LINKS to Verilog Codes
Following are the links to useful Verilog codes.
Low Pass FIR Filter
Asynchronous FIFO design with verilog code
D FF without reset
D FF synchronous reset
1 bit 4 bit comparator
All Logic Gates
RF and Wireless tutorials
WLAN 802.11ac 802.11ad wimax Zigbee z-wave GSM LTE UMTS Bluetooth UWB IoT satellite Antenna RADAR