Debug Combinational: Priority Encoder Masking Bug
Interrupt controllers rely on strict priority encoding to resolve simultaneous hardware requests. A 4-to-2 priority encoder takes four request lines (D3 to D0) and outputs the binary index (Y1, Y0) of the highest-priority active request, along with a valid bit (V). Input D3 has the highest priority.
Expected behavior:
| D3 | D2 | D1 | D0 | Y1 | Y0 | V | |------|------|------|------|------|------|-----| | 0 | 0 | 0 | 0 | 0 | 0 | 0 | | 0 | 0 | 0 | 1 | 0 | 0 | 1 | | 0 | 0 | 1 | 0 | 0 | 1 | 1 | | 0 | 0 | 1 | 1 | 0 | 1 | 1 | | 0 | 1 | 0 | 0 | 1 | 0 | 1 | | 0 | 1 | 0 | 1 | 1 | 0 | 1 | | 0 | 1 | 1 | 0 | 1 | 0 | 1 | | 0 | 1 | 1 | 1 | 1 | 0 | 1 | | 1 | 0 | 0 | 0 | 1 | 1 | 1 | | 1 | 0 | 0 | 1 | 1 | 1 | 1 | | 1 | 0 | 1 | 0 | 1 | 1 | 1 | | 1 | 0 | 1 | 1 | 1 | 1 | 1 | | 1 | 1 | 0 | 0 | 1 | 1 | 1 | | 1 | 1 | 0 | 1 | 1 | 1 | 1 | | 1 | 1 | 1 | 0 | 1 | 1 | 1 | | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
Simulation shows Y1 = 1 and Y0 = 0 for inputs D3 = 1, D2 = 0, D1 = 1, D0 = 0. The circuit correctly outputs Y1 = 1, Y0 = 1 when only D3 is high, but produces an incorrect binary code when D3 and D1 are active simultaneously. Inspect the circuit and correct the fault.
Constraints
- Do not modify the output encoding logic gates.
- Fix the masking logic to ensure only one internal grant signal is active at a time.
Topics
Solve this problem
Place the gates, wire them up and watch the signals settle. Every submission runs on the same simulation engine that grades it.
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.