The 2-to-1 MUX / Multiplexer / Multiplexor is a device that allows either input A or B to be driven as its output based on the value of the signal pin provided. It is the basis for more complex devices such as 4-to-1 (or 8-to-1!) MUXes to enhancing full adder circuitry.
The general characteristic equation for a 2:1 (or 2-to-1) MUX is O = S'A + SB, assuming that A, B, S, and O are all one bit inputs and outputs.
This two to one multiplexer itself will show a value of 0 instead of the any one of the inputs to avoid possible errors that may happen when wiring this mux in a more complex circuit, however it may cause confusion if one of your inputs is 0 itself, so be sure to take caution when using this MUX in your circuit to account for that potential failure state.
The side block diagram form of the 2-1 Multiplexer is done in Xilinx Vivado using the IP generation tool. Note that I have not included a specific package download in my website to account for this, simply because it is likely that your toolset for your FPGA or other board will have an easier time optimizing and improving the efficiency given simply the Verilog code rather than a direct IP package. This also allows you to have more freedom in modifying or recreating such designs if you so desire to improve its implementation tailored to your needs.
module twoToOne_mux(
input logic a, b, sel,
output logic y
);
always_comb
begin
case (sel)
0: y = a;
1: y = b;
// always good practice to include a default when using case statements
default: y = 0;
endcase
end
endmodule