Practice
One-Hot Watchdog
A chip's bus arbiter has one job: out of 8 grant lines, raise exactly one, every cycle. A bus with exactly one line high is called one-hot. Twice during testing the arbiter broke that rule: once two grants at the same time, once none at all. Both times the data corruption took a week to trace. So the test build got a watchdog: a small combinational checker that watches the grant bus and raises fault the moment the bus is not one-hot.
Now the chip is 97 percent full, so every circuit must be worth the space it uses. The rule from the integration lead is simple: 30 cells in the synthesized netlist and the watchdog ships; one cell over and it is deleted. The first version, which compares the bus against all eight legal one-hot patterns, synthesizes to 37.
Your task: rebuild the checker so it still raises fault for every bus value that is not one-hot, but synthesizes to 30 cells or fewer. There are sharper ways to ask "is exactly one bit set". The team record stands at 21 cells.
Interface
| Port | Direction | Type | Description |
|---|---|---|---|
grant | in | 8-bit vector | Arbiter grant bus, one line per master |
fault | out | 1 bit | High when grant is not one-hot |
Behavior
fault = 0when exactly one bit ofgrantis 1fault = 1whengrantis all zerosfault = 1when two or more bits ofgrantare 1
What the bench checks
- The testbench drives all 256 values of
grant
Constraints
TIMING: purely combinational:
faultis a function ofgrantalone, with no clock and no state.
SCOPE: this models the watchdog checker only. The arbiter driving
grantand whatever acts onfaultare out of scope.
CELL BUDGET: the grader enforces the outer line: any flip-flop, any latch, or more than 60 cells in total, and a passing simulation still fails. Inside that line, the integration lead's 30-cell rule and the 21-cell record chase are on your honor. Count cells by adding up the Netlist tab's stats-bar categories (gates, FFs, muxes, arithmetic).
Do not add ports.
Click Run to execute your code. Output will appear here.