标签:
mutiplexer 数据选择器
1 one-bit wide 2-1 mux
wire dout = sel? din1 : din0; // conditional continuous and wire assignment
2 4-1 mux
module mux4_1(sel, din0, din1, din2, din3, dout); input [1:0] sel; input din0, din1, din2, din3; output dout; reg dout; always @ (sel or din0 or din1 or din2 or din3) begin case(sel) 2‘b00: dout = din0; 2‘b01: dout = din1; 2‘b10: dout = din2; 2‘b11: dout = din3; default: dout = din0; endcase end endmodule
3 two-bit wide 8-1 mux (case statement)
sel | din7 | din6 | din5 | din4 | din3 | din2 | din1 | din0 | dout |
000 | XX | XX | XX | XX | XX | XX | XX | DD | din0 |
001 | XX | XX | XX | XX | XX | XX | DD | XX | din1 |
010 | XX | XX | XX | XX | XX | DD | XX | XX | din2 |
011 | XX | XX | XX | XX | DD | XX | XX | XX | din3 |
100 | XX | XX | XX | DD | XX | XX | XX | XX | din4 |
101 | XX | XX | DD | XX | XX | XX | XX | XX | din5 |
110 | XX | DD | XX | XX | XX | XX | XX | XX | din6 |
111 | DD | XX | XX | XX | XX | XX | XX | XX | din7 |
标签:
原文地址:http://www.cnblogs.com/xinxue/p/5249252.html