* 2 to 1 Multiplexer
2개의 입력이 들어오고 1bit signal값에 따라 한개의 신호를 정하여서 출력한다.
module MUX(d0,d1,s,y);
input d0,d1,s;
output y;
wire w0,w1,sb;
iv NOT1(sb,s);
nd2 NAND1(.y(w0),.a(d0),.b(sb));
nd2 NAND2(.y(w1),.a(d1),.b(s));
nd2 NAND3(y,w0,w1);
endmodule
module MUX(d0,d1,s,y);
input d0,d1,s;
output y;
assign y = (s==0) ? d0 : d1;
endmodule
* 8 to 1 Multiplexer
8개의 입력이 들어오고 3bit signal값에 따라 한개의 신호를 정하여서 출력한다.
module mx8(y,a,b,c,d,e,f,g,h,s0,s1,s2);
input a,b,c,d,e,f,g,h,s0,s1,s2;
output y;
wire w1,w2,w3,w4,w5,w6;
mx2 mux1(.y(w1),.d0(a),.d1(b),.s(s0));
mx2 mux2(.y(w2),.d0(c),.d1(d),.s(s0));
mx2 mux3(.y(w3),.d0(e),.d1(f),.s(s0));
mx2 mux4(.y(w4),.d0(g),.d1(h),.s(s0));
mx2 mux5(.y(w5),.d0(w1),.d1(w2),.s(s1));
mx2 mux6(.y(w6),.d0(w3),.d1(w4),.s(s1));
mx2 mux7(.y(y),.d0(w5),.d1(w6),.s(s2));
endmodule
'Computer > Computer Structure' 카테고리의 다른 글
Carry Look-ahead Adder (1) | 2013.05.09 |
---|---|
Ripple Carry Adder (0) | 2013.05.06 |
Full Adder (0) | 2013.05.06 |
Half Adder (0) | 2013.05.06 |
기본 Gate (0) | 2013.05.05 |