# Muliplexer 4-way Implementation proof

There's Mux4Way functional table:

I have already know right way for implementation of this chip by using another 3 Multiplexor chips when mux functions as following:

/**
* Multiplexor:
* out = a if sel == 0
*       b otherwise
*/


Let's say we have already build Muxtiplexor chips, to build working 4 way mux we would have something like that in HDL:

// First selection bit
Mux(a=D0, b=D1, sel=sel[0], out=mux0);
Mux(a=D2, b=D3, sel=sel[0], out=mux1);

// Second selection bit
Mux(a=mux0, b=mux1, sel=sel[1], out=out);


And it's working! But I've no idea why! So, in such particular way it behaves as expected but all my tries to build truth table was with no success.

It would be great to have any idea how to prove why this particular way is correct and even why it is working.

• Your truth table is a demultiplexer, not a multiplexer. – Tom Carpenter Jun 27 '16 at 21:16

It's quite simple.

Since you know how to implement a Mux, consider it as an abstraction. Then on proceed to think of how you would create a 4WayMux out of individual Mux chips.

A Mux converts two inputs into a single output.

So then to convert four inputs into a single output, we need to combine the output from two individual Mux chips into one single Mux chip.

So input a and b would go into Mux1 and create output1 and input c and d into Mux2 and create output2

Then output1 and output2, would become the input to Mux3, that converts these two inputs into a single output, essentially converting four inputs into a single output.

If you want to construct a truth table around this concept, you'll have to create truth tables for each individual Mux chip involved and combine it, or assume a 4 input Mux chip and create a table.