The Don't Care Assignment
Instruction decoders in embedded processors map binary opcodes to internal control signals. When an instruction set architecture leaves portions of the opcode space undefined, hardware engineers have a choice: force the control signals to zero, or assign them as don't cares. Assigning a literal zero forces the synthesis tool to instantiate logic gates to enforce that zero. Assigning a don't care allows the synthesizer to optimize the logic, treating the invalid states as whatever boolean value minimizes the total gate count.
The module acts as a specialized 3-to-5 one-hot decoder. It takes a 3-bit input and asserts exactly one of the five output bits for valid inputs 0 through 4. For inputs 5, 6, and 7, the module must output literal don't care values. This allows downstream synthesis tools to aggressively minimize the cell count.
| Signal | Direction | Width | Description | |--------|-----------|-------|-------------| | opcode | input | 3 | The binary instruction code | | signals | output | 5 | The decoded one-hot control signals, or don't cares for invalid opcodes |
Constraints
- The circuit is strictly combinational; there is no clock or reset
- For
opcodevalues 0 through 4,signalsmust be one-hot, starting at5'b00001foropcode0 - For
opcodevalues 5, 6, and 7, every bit ofsignalsmust evaluate to1'bx
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.
This problem is part of Codiode Pro. The statement above is free to read.
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.