Ternary Operator Mux
Data routing is a fundamental operation in digital design. A multiplexer acts as a controlled switch, allowing a system to select between multiple data sources to drive a single shared bus or execution unit.
This module routes one of two 8-bit input data buses to an 8-bit output bus based on the state of a single select bit. When the select bit is high, the first input bus is routed to the output. When the select bit is low, the second input bus is routed to the output.
This is a purely combinational circuit. There is no clock and no reset. The output must reflect the selected input immediately without any registered delay.
| Signal | Direction | Width | Description | |--------|-----------|-------|-------------| | a | input | 8 | Data input selected when sel is 1 | | b | input | 8 | Data input selected when sel is 0 | | sel | input | 1 | Select signal; determines which input drives out | | out | output | 8 | Selected data output |
Constraints
- The module must be purely combinational.
- Output
outmust strictly followawhenselis 1, andbwhenselis 0. - The design must not use clocks, resets, or flip-flops.
- The data buses are exactly 8 bits wide.
Topics
Solve this problem
Write the module in Verilog, SystemVerilog or VHDL. Your submission is compiled and simulated against a real testbench — you get the waveform back, not a stored answer.
Free to solve. A Codiode account keeps your progress.
The circuit builder and code editor need a desktop screen. On a phone, read the problem here and open it on a laptop to solve.