Visual
Lab intro
A multiplexer routes one of several input lines to a single output based on the binary value on its select lines. This tutorial uses a 4-to-1 multiplexer with four data inputs D0 through D3, two select lines S0 and S1, and one output Y. You will set the select lines to each of the four binary combinations and verify that Y follows the corresponding data input.
What you will learn
- How select lines determine which data input is connected to the output
- How to set S0 and S1 to address each of the four data inputs
- How to verify the output Y matches the selected data input for all four select combinations
- How a multiplexer can implement a Boolean function by treating data inputs as truth table entries
Prerequisites
- Understanding of binary encoding and how two bits address four lines
- Familiarity with combinational logic and truth tables
- Basic knowledge of AND, OR, and NOT gate behaviour
Step-by-step
- Step 1: Identify the controlsOpen the 4-to-1 multiplexer simulator. The left panel shows six toggles: D0, D1, D2, D3 for data inputs, and S0, S1 for select lines. The right panel shows one LED labeled Y. All toggles start at 0.Tip: S0 is the least significant select bit and S1 is the most significant. The selected input index equals 2*S1 + S0.
- Step 2: Select D0 and set D0=1Set S1=0 and S0=0. This selects input D0. Now set D0 to 1. The Y LED should light up. Set D0 back to 0. Y should go dark. Y is following D0.Tip: Toggle D0 a few times while S1=0, S0=0 to confirm Y tracks D0 in real time.
- Step 3: Select D1 and set D1=1Set S1=0 and S0=1. This selects input D1. Set D1 to 1. Y should light up. Set D1 back to 0. Y should go dark. Confirm Y is now following D1 and not D0.Tip: Leave D0 at 1 while you switch to S0=1. Y should go dark the moment S0 changes, confirming D0 is no longer selected.
- Step 4: Select D2 and set D2=1Set S1=1 and S0=0. This selects input D2. Set D2 to 1. Y should light up. Set D2 to 0. Y should go dark.Tip: At this point D0 and D1 may be at any value. Y should ignore both completely and respond only to D2.
- Step 5: Select D3 and set D3=1Set S1=1 and S0=1. This selects input D3. Set D3 to 1. Y should light up. Set D3 to 0. Y should go dark.Tip: This is the last select combination. After confirming it, you have verified all four data paths.
- Step 6: Test cross-interferenceSet all data inputs D0 through D3 to 1. Now change only the select lines: S1=0 S0=0, then S1=0 S0=1, then S1=1 S0=0, then S1=1 S0=1. Y should remain lit for all four combinations because all data inputs are 1. Then set all data inputs to 0 and repeat. Y should remain dark for all four select combinations.Tip: This step confirms that Y follows the selected input, not a logical OR of all inputs. If Y is lit when all data inputs are 0, the simulator has a fault.
- Step 7: Implement a simple functionSet the data inputs to represent a truth table: D0=0, D1=1, D2=1, D3=0. This encodes the XOR function for two variables where S1 is one variable and S0 is the other. Step through all four select combinations and verify that Y produces the XOR truth table output.Tip: For S1=0 S0=0, Y should be 0. For S1=0 S0=1, Y should be 1. For S1=1 S0=0, Y should be 1. For S1=1 S0=1, Y should be 0. This matches XOR.
Expected output
For each select combination, Y must equal the data input addressed by that combination: Y=D0 when S1=0 S0=0, Y=D1 when S1=0 S0=1, Y=D2 when S1=1 S0=0, and Y=D3 when S1=1 S0=1. Changes to non-selected data inputs should have no effect on Y.
Troubleshooting tips
- If Y is always 0 regardless of inputs, check that the enable or chip-select line is not active low and currently deasserted. Some MUX simulators include an active low enable that must be set to 0 for the circuit to function.
- If Y follows the wrong data input for a given select combination, verify the bit ordering. Some simulators label S0 as the most significant bit, which reverses the addressing order.
- If Y is lit even when the selected data input is 0, another data input with value 1 may be leaking through. This would indicate a simulator bug rather than a user error. Reset all inputs to 0 and retest.
- If Y does not update when the data input is toggled while select lines are fixed, the simulator may require a clock edge. Check whether the MUX is combinational or registered in the simulator documentation.
- If changing a non-selected data input causes Y to flicker, the simulator may have a propagation delay animation. Wait for the output to settle before recording the value.