top.v 476 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
module mux1( select, d, q );

input select;
input[1:0] d;
output     q;

wire      q;
wire      select;
wire[1:0] d;

assign q = d[select];

endmodule

module top(select, d, q);

input[1:0] select;
input[1:0] d;
output     q;

wire      q;
wire[1:0] select;
wire[1:0] d;

wire[1:0] q_tmp;

mux1 m1(
		.select(select[0]),
		.d(d),
		.q(q_tmp[0])
);

mux1 m2(
		.select(select[1]),
		.d(d),
		.q(q_tmp[1])
);

mux1 m3(
		.select(select[0]),
		.d(q_tmp),
		.q(q)
);



endmodule