The Incomplete Sensitivity List Fallback
A 2-to-1 multiplexer drives Y from A when Sel is 0 and from B when Sel is 1.
Sel |
Y |
|---|---|
| 0 | A |
| 1 | B |
What the simulation shows: with A=0 and B=1, flipping Sel from 0 to 1 leaves Y at 0. Y only catches up the next time A or B changes. Synthesis builds a perfectly good mux, so the hardware and the simulation disagree.
The design below has one bug. Find it and fix it.
| Signal | Direction | Width | Description |
|---|---|---|---|
A |
input | 1 | Data in, selected when Sel is 0 |
B |
input | 1 | Data in, selected when Sel is 1 |
Sel |
input | 1 | Select |
Y |
output | 1 | Selected data |
Constraints
- Keep the logic inside the procedural block.
- Change at most 1 line.
Topics
Solve this problem
Write the module in Verilog, SystemVerilog or VHDL. Your submission is compiled and simulated against the problem's 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.
Part of Combinational RTL
Problem 1 of 15 in the Combinational RTL track.
Related problems
Browse all problems · Verilog practice problems · Learning tracks