Thursday, June 8, 2017

VERILOG PROGRAM FOR MUX



MUX 8X1
module mux8x1(y,i,s);
    input[0:7]i;
    input[0:2]s;
    output y;
    assign y=(i[0]&~s[0]&~s[1]&~s[2])|(i[1]&~s[0]&~s[1]&s[2])|(i[2]&~s[0]&s[1]&~s[2])|(i[3]&~s[0]&s[1]&s[2])|(i[4]&s[0]&~s[1]&~s[2])|(i[5]&s[0]&~s[1]&s[2])|(i[6]&s[0]&s[1]&~s[2])|(i[7]&s[0]&s[1]&s[2]);
endmodule;

MUX 16X1
module mux16x1(y,i,s);
    input[0:15]i;                   
    input[0:3]s;
    output y;
    assign y=(i[0]&~s[0]&~s[1]&~s[2]&~s[3])|(i[1]&~s[0]&~s[1]&~s[2]&s[3])|(i[2]&~s[0]&~s[1]&s[2]&~s[3])|(i[3]&~s[0]&~s[1]&s[2]&s[3])|(i[4]&~s[0]&s[1]&~s[2]&~s[3])|(i[5]&~s[0]&s[1]&~s[2]&s[3])|(i[6]&~s[0]&s[1]&s[2]&~s[3])|(i[7]&~s[0]&s[1]&s[2]&s[3])|(i[8]&s[0]&~s[1]&~s[2]&~s[3])|(i[9]&s[0]&~s[1]&~s[2]&s[3])|(i[10]&s[0]&~s[1]&s[2]&~s[3])|(i[11]&s[0]&~s[1]&s[2]&s[3])|(i[12]&s[0]&s[1]&~s[2]&~s[3])|(i[13]&s[0]&s[1]&~s[2]&s[3])|(i[14]&s[0]&s[1]&s[2]&~s[3])|(i[15]&s[0]&s[1]&s[2]&s[3]);
endmodule;
MUX 32X1
module mux32x1(y,i,s);
    input[0:31]i;
    input[0:4]s;
    output y;
    assign y=(i[0]&~s[0]&~s[1]&~s[2]&~s[3]&~s[4])|(i[1]&~s[0]&~s[1]&~s[2]&~s[3]&s[4])|(i[2]&~s[0]&~s[1]&~s[2]&s[3]&~s[4])|(i[3]&~s[0]&~s[1]&~s[2]&s[3]&s[4])|(i[4]&~s[0]&~s[1]&s[2]&~s[3]&~s[4])|(i[5]&~s[0]&~s[1]&s[2]&~s[3]&s[4])|(i[6]&~s[0]&~s[1]&s[2]&s[3]&~s[4])|(i[7]&~s[0]&~s[1]&s[2]&s[3]&s[4])|(i[8]&~s[0]&s[1]&~s[2]&~s[3]&~s[4])|(i[9]&~s[0]&s[1]&~s[2]&~s[3]&s[4])|(i[10]&~s[0]&s[1]&~s[2]&s[3]&~s[4])|(i[11]&~s[0]&s[1]&~s[2]&s[3]&s[4])|(i[12]&~s[0]&s[1]&s[2]&~s[3]&~s[4])|(i[13]&~s[0]&s[1]&s[2]&~s[3]&s[4])|(i[14]&~s[0]&s[1]&s[2]&s[3]&~s[4])|(i[15]&~s[0]&s[1]&s[2]&s[3]&s[4])|(i[16]&s[0]&~s[1]&~s[2]&~s[3]&~s[4])|(i[17]&s[0]&~s[1]&~s[2]&~s[3]&s[4])|(i[18]&s[0]&~s[1]&~s[2]&s[3]&~s[4])|(i[19]&s[0]&~s[1]&~s[2]&s[3]&s[4])|(i[20]&s[0]&~s[1]&s[2]&~s[3]&~s[4])|(i[21]&s[0]&~s[1]&s[2]&~s[3]&s[4])|(i[22]&s[0]&~s[1]&s[2]&s[3]&~s[4])|(i[23]&s[0]&~s[1]&s[2]&s[3]&s[4])|(i[24]&s[0]&s[1]&~s[2]&~s[3]&~s[4])|(i[25]&s[0]&s[1]&~s[2]&~s[3]&s[4])|(i[26]&s[0]&s[1]&~s[2]&s[3]&~s[4])|(i[27]&s[0]&s[1]&~s[2]&s[3]&s[4])|(i[28]&s[0]&s[1]&s[2]&~s[3]&~s[4])|(i[29]&s[0]&s[1]&s[2]&~s[3]&s[4])|(i[30]&s[0]&s[1]&s[2]&s[3]&~s[4])|(i[31]&s[0]&s[1]&s[2]&s[3]&s[4]);
endmodule;

MUX 64X1

module mux64x1(y,i,s);
    input[0:63]i;
    input[0:5]s;
    output y;
    assign y=(i[0]&(~s[0])&(~s[1])&(~s[2])&(~s[3])&(~s[4])&(~s[5]))|(i[1]&(~s[0])&(~s[1])&(~s[2])&(~s[3])&(~s[4])&s[5])|(i[2]&(~s[0])&(~s[1])&(~s[2])&(~s[3])&s[4]&(~s[5]))|(i[3]&(~s[0])&(~s[1])&(~s[2])&(~s[3])&s[4]&s[5])|(i[4]&(~s[0])&(~s[1])&(~s[2])&s[3]&(~s[4])&(~s[5]))|(i[5]&(~s[0])&(~s[1])&(~s[2])&s[3]&(~s[4])&s[5])|(i[6]&(~s[0])&(~s[1])&(~s[2])&s[3]&s[4]&(~s[5]))|(i[7]&(~s[0])&(~s[1])&(~s[2])&s[3]&s[4]&s[5])|(i[8]&(~s[0])&(~s[1])&s[2]&(~s[3])&(~s[4])&(~s[5])|(i[9]&(~s[0])&(~s[1])&s[2]&(~s[3])&(~s[4])&s[5])|(i[10]&(~s[0])&(~s[1])&s[2]&(~s[3])&s[4]&(~s[5]))|(i[11]&(~s[0])&(~s[1])&s[2]&(~s[3])&s[4]&s[5])|(i[12]&(~s[0])&(~s[1])&s[2]&s[3]&(~s[4])&(~s[5]))|(i[13]&(~s[0])&(~s[1]0&s[2]&s[3]&(~s[4])&s[5])|(i[14]&(~s[0])&(~s[1])&s[2]&s[3]&s[4]&(~s[5]))|(i[15]&(~s[0])&(~s[1])&s[2]&s[3]&s[4]&s[5])|(i[16]&(~s[0])&s[1]&(~s[2])&(~s[3])&(~s[4])&(~s[5]))|(i[17]&(~s[0])&s[1]&(~s[2])&(~s[3])&(~s[4])&s[5])|(i[18]&(~s[0])&s[1]&(~s[2])&(~s[3])&s[4]&(~s[5]))|(i[19]&(~s[0])&s[1]&(~s[2])&(~s[3])&s[4]&s[5])|(i[20]&(~s[0])&s[1]&(~s[2])&s[3]&(~s[4])&(~s[5]))|(i[21]&(~s[0])&s[1]&(~s[2])&s[3]&(~s[4])&s[5])|(i[22]&(~s[0])&s[1]&(~s[2])&s[3]&s[4]&(~s[5]))|(i[23]&(~s[0])&s[1]&(~s[2])&s[3]&s[4]&s[5])|(i[24]&(~s[0])&s[1]&s[2]&(~s[3])&(~s[4])&(~s[5]))|(i[25]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[2])&(~s[3])&(~s[4])&s[5])|(i[50]&s[0]&s[1]&(~s[2])&(~s[3])&s[4]&(~s[5]))|(i[51]&s[0]&s[1]&(~s[2])&(~s[3])&s[4]&s[5])|(i[52]&s[0]&s[1]&(~s[2])&s[3]&(~s[4])&(~s[5]))|(i[53]&s[0]&s[1]&(~s[2])&s[3]&(~s[4])&s[5])|(i[54]&s[0]&s[1]&(~s[2])&s[3]&s[4]&(~s[5]))|(i[55]&s[0]&s[1]&(~s[2])&s[3]&s[4]&s[5])|(i[56]&s[0]&s[1]&s[2]&(~s[3])&(~s[4])&(~s[5]))|(i[57]&s[0]&s[1]&s[2]&(~s[3])&s[4]&s[5])|(i[58]&s[0]&s[1]&s[2]&(~s[3])&s[4]&(~s[5]))|(i[59]&s[0]&s[1]&s[2]&(~s[3])&s[4]&s[5])|(i[60]&s[0]&s[1]&s[2]&s[3]&(~s[4])&(~s[5]))|(i[61]&s[0]&s[1]&s[2]&s[3]&(~s[4])&s[5])|(i[62]&s[0]&s[1]&s[2]&s[3]&s[4]&(~s[5]))|(i[63]&s[0]&s[1]&s[2]&s[3]&s[4]&s[5]);
    endmodule;

No comments:

Post a Comment