题解2 | #优先编码器Ⅰ#
优先编码器Ⅰ
https://www.nowcoder.com/practice/a7068b8f4c824d6a9592f691990b21de
真值表转化成公式一个一个写粗来
`timescale 1ns/1ns module encoder_83( input [7:0] I , input EI , output wire [2:0] Y , output wire GS , output wire EO ); assign Y[2] = EI & (|I[7:4]); assign Y[1] = EI & ((|I[7:6]) | (~(|I[7:4]) & ( |I[3:2] ))); assign Y[0] = EI & (I[7] | ( ~(&I[7:6]) & I[5] ) | ( ~(&I[7:4]) & I[3] ) | ( ~(&I[7:2]) & I[1] )); assign GS = EI & (|I[7:0]); assign EO = EI & ~(|I[7:0] ); endmodule