Decoder with Enable Logic
An address decoder turns a binary address into one select line per device. The enable input forces every line low when the bus is idle, so no device acts on a stray address.
This module decodes a 3-bit binary input into an 8-bit output vector. It includes an active-high enable signal. When the enable signal is asserted, exactly one bit of the output corresponding to the binary value of the input is driven high. When the enable signal is deasserted, all output bits are forced to zero regardless of the input value.
| Signal | Direction | Width | Description |
|---|---|---|---|
| en | input | 1 | Active-high enable signal; output is 8'b00000000 when low |
| sel | input | 3 | Binary selection input |
| out | output | 8 | Decoded output; one-hot when en is 1, all zeros when en is 0 |
Constraints
- The circuit is purely combinational; no clock or reset signals are used.
- The output must be exactly 8'b00000000 when
enis 0, overriding any value onsel. - The output must be strictly one-hot when
enis 1.
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.
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.
Part of Combinational RTL
Problem 7 of 15 in the Combinational RTL track.
Related problems
Browse all problems · Verilog practice problems · Learning tracks