Multiplexers
Combinational 32-Bit 2:1 MUX
Latch-free combinational 32-bit 2:1 mux with no clock, reset, or enable.
About this block
Simulate it in the Verilog IDE
Combinational 32-Bit 2:1 MUX is a Verilog reference block in the Multiplexers catalog. Multiplexers, demultiplexers, and data-path selectors. Marked Easy: a small block you can read, simulate, and synthesize in one sitting.
This IP provides a simple, efficient, and fully combinational 32-bit 2-to-1 multiplexer. It selects between two 32-bit input vectors (din_a and din_b) based on a single select signal (sel). The design is latch-free, ensuring minimal latency and no unintended storage elements. It is suitable for basic data routing tasks in digital designs and has been verified with a self-checking testbench.
The module routes din_a to dout when sel is low (0), and din_b to dout when sel is high (1). The implementation uses continuous assignment for optimal synthesis results.
- Choose Open in IDE. RTL Studio loads the packaged workspace for Combinational 32-Bit 2:1 MUX.
- Read the Verilog module in the editor. The catalog line for this block: Latch-free combinational 32-bit 2:1 mux with no clock, reset, or enable.
- Run the packaged testbench with the in-browser Verilator simulator, then open the VCD in the waveform viewer.
- Run Yosys in the same IDE for a generic netlist. Sky130 liberty mapping is a separate Pro library option.
RTL Studio is the Verilog simulator and IDE around this block: Slang lint, Verilator, VCD waveforms, and Yosys, in the browser. Simulation guide · Yosys guide.
Architecture
The logic is purely combinational. The Mermaid diagram below illustrates the data flow:
Ports
| Port Name | Direction | Width | Description |
|---|---|---|---|
din_a | Input | [31:0] | Data input A |
din_b | Input | [31:0] | Data input B |
sel | Input | 1 | Select signal (0: select A, 1: select B) |
dout | Output | [31:0] | Multiplexed output |
Verification
The provided testbench (tb/tb_mux_2to1_32b.v) validates all functional modes:
- Selection of input A when
sel=0. - Selection of input B when
sel=1. - Random data patterns for both select states.
- Edge cases including all zeros and all ones.
### Running the Simulation
- Ensure you have a Verilog simulator installed (e.g., Icarus Verilog, ModelSim).
- Run the testbench:
- Check the console output for PASS/FAIL status.
A VCD file (sim/dump.vcd) is generated for waveform analysis.
### Expected Results
More in Multiplexers
- 4:1 Priority Mux (One-Hot Select) — L1 Upgrade
- Combinational 16:1 MUX (32-Bit Datapath)
- Combinational 4:1 MUX (3-Bit Datapath)
- Combinational 4:1 MUX (8-Bit Datapath, Enable)
- Combinational 8:1 MUX (32-Bit Datapath, Enable)
- Glitch-Free 2:1 Clock Mux
- One-Hot Select Mux 8:1 — L1 Upgrade
- Registered 1-Bit 2:1 MUX (Packed din[1:0])
- Registered 16:1 MUX (32-Bit Datapath, Active-Low Enable)
- Registered 8-Bit 2:1 MUX with Enable