`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] | I[6] | I[5] | I[4]); assign Y[1] = EI & (I[7] | I[6] | ~I[5]&~I[4]&I[3] | ~I[5]&~I[4]&I[2]); assign Y[0] = EI & (I[7] | ~I[6]&I[5] | ~I[6]&~I[4]&I[3] | ~I[6]&~I[4]&~I[2]&I[1]); assign EO = EI&~I[7]&~I[6]&~I[5]&~I[4]&~I[3]&~I[2]&~I[1]&~I[0]; assign GS = EI&(I[7] | I[6] | I[5] | I[4] | I[3] | I[2] | I[1] | I[0]); //assign GS = EI&(| I); endmodule module encoder_164( input [15:0] A , input EI , output wire [3:0] L , output wire GS , output wire EO ); wire [2:0]Y_1; wire GS_1; wire EO_1; encoder_83 e_1( .I(A[15:8]), .EI(EI), .Y(Y_1), .GS(GS_1), .EO(EO_1) ); wire [2:0]Y_0; wire GS_0; wire EO_0; encoder_83 e_0( .I(A[7:0]), .EI(EO_1), .Y(Y_0), .GS(GS_0), .EO(EO_0) ); assign GS = GS_1 | GS_0; assign EO = EO_0; assign L[3] = GS_1; assign L[2] = Y_1[2] | Y_0[2]; assign L[1] = Y_1[1] | Y_0[1]; assign L[0] = Y_1[0] | Y_0[0]; endmodule
更考察的是基础数电知识中的级联,只不过当时是划线连接,现在是用代码连接