Verilog Code:-
module encoder_83(
input wire D0, D1, D2, D3, D4, D5, D6, D7,
output wire Y2, Y1, Y0
);
assign Y2 = D4 | D5 | D6 | D7;
assign Y1 = D2 | D3 | D6 | D7;
assign Y0 = D1 | D3 | D5 | D7;
endmodule
Test Bench:
module tb_encoder_83();
reg D0, D1, D2, D3, D4, D5, D6, D7;
wire Y2, Y1, Y0;
encoder_83 DUT (D0, D1, D2, D3, D4, D5, D6, D7, Y2, Y1, Y0);
initial
begin
D0=0; D1=0; D2=0; D3=0; D4=0; D5=0; D6=0; D7=0;
#10 D0=1; #10 D0=0; D1=1; #10 D1=0; D2=1; #10 D2=0; D3=1; #10 D3=0;
D4=1; #10 D4=0; D5=1; #10 D5=0; D6=1; #10 D6=0; D7=1; #10 D7=0;
#10 $finish;
end
endmodule
OUTPUT:
Pin Assignment:-
> Input = J15
> Input = L16
> Input = M13
> Input= R15
> Input=R17
> Input=T18
> Input=U18
> Input=R13
> Output = H17
> Output = K15
> Output= J13