The Incomplete Case Latch
If a combinational block doesn't assign an output in every case, the output has to remember its old value, and synthesis builds a latch to do that. Nobody wanted that latch.
A custom instruction decoder maps a 4-bit binary-coded decimal input into an 8-bit control signal. The input has 16 possible binary states, but only the values 0 through 9 are valid instructions. The hardware must explicitly drive the output to zero for the 6 invalid states to guarantee that a purely combinational circuit is synthesized.
The module computes the following mapping:
sel = 0outputs8'h01sel = 1outputs8'h02sel = 2outputs8'h04sel = 3outputs8'h08sel = 4outputs8'h10sel = 5outputs8'h20sel = 6outputs8'h40sel = 7outputs8'h80sel = 8outputs8'hAAsel = 9outputs8'h55- All other values of
sel(10 through 15) output8'h00
| Signal | Direction | Width | Description |
|---|---|---|---|
sel |
input | 4 | Selection input representing a decimal value from 0 to 15 |
out |
output | 8 | Decoded control signal; invalid inputs must output zero |
Constraints
- The circuit must be purely combinational.
- No clock or reset signals are present.
- The output must be exactly
8'h00for inputs 10, 11, 12, 13, 14, and 15.
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 Synthesis Intuition
Problem 1 of 25 in the Synthesis Intuition track.
Related problems
Browse all problems · Verilog practice problems · Learning tracks