This challenge has been archived and is no longer accepting new submissions.

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

PortDirectionTypeDescription
grantin8-bit vectorArbiter grant bus, one line per master
faultout1 bitHigh when grant is not one-hot

Behavior

  • fault = 0 when exactly one bit of grant is 1
  • fault = 1 when grant is all zeros
  • fault = 1 when two or more bits of grant are 1

What the bench checks

  • The testbench drives all 256 values of grant

Constraints

TIMING: purely combinational: fault is a function of grant alone, with no clock and no state.

SCOPE: this models the watchdog checker only. The arbiter driving grant and whatever acts on fault are 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.

Loading editor...

Click Run to execute your code. Output will appear here.