题解 | #优先编码器电路①#
优先编码器电路①
https://www.nowcoder.com/practice/0594ed5303ad48a19aed90bc48839d00
`timescale 1ns/1ns module encoder_0( input [8:0] I_n , output reg [3:0] Y_n ); always@(*)begin case(1'b0) I_n[8]:Y_n = 4'b0110; I_n[7]:Y_n = 4'b0111; I_n[6]:Y_n = 4'b1000; I_n[5]:Y_n = 4'b1001; I_n[4]:Y_n = 4'b1010; I_n[3]:Y_n = 4'b1011; I_n[2]:Y_n = 4'b1100; I_n[1]:Y_n = 4'b1101; I_n[0]:Y_n = 4'b1110; default:Y_n = 4'b1111; endcase end endmodule