mpx.v

This module implements a power of two-to-one multiplexor of variable bit width. The inputs are all concatenated into a single input vector. It is implemented as a binary tree in combinational logic.

Ports

selinputThe multi-bit selector.
ininputThe data channels concatenated to a single vector, e.g., {in3, in2, in1, in0}.
out  output  The single-word output.

Parameters

wid16Data bit width of individual input channels and the output.
lev2The number of bits in the data selector. There should be 2lev inputs in in.
invert "no"If "yes" the output is inverted; otherwise not.

Notes

Example instantiation in Verilog:

// three-bit selector
wire	[11:0]	in0, in1, in2, in3, in4, in5, in6, in7, out;
wire	[2:0]	sel = 2'b010;
mpx #(.wid(12), .lev(3))  multiplexor (
    .sel(sel), 
    .in({in7, in6, in5, in4, in3, in2, in1, in0}), 
    .out(out)
);