Practice
Spore Room Airlock
Fenwood Farm grows oyster mushrooms in a sealed grow room. Workers pass between the prep room and the grow room through a two-door airlock. Each side has a call button, and the controller may release only one door at a time. Between one door relocking and the other releasing, a fan gets 1 full cycle to flush the lock. That gap is what keeps wild spores out of the clean side.
Last Tuesday, in the harvest rush, both buttons were pressed in the same moment. Both doors released together, the fan never got its gap, and a full rack of spawn was lost to contamination. The vendor's bench for the controller is already in your rig, and it passes. It tries each door alone, and the two doors queued, but never the double press.
Your task: extend the vendor's bench so the fault shows. Keep the vendor's tests. Add the harvest-rush case: req_a and req_b rising before the same locked-door edge, plus check_doors calls that pin what the spec demands from that moment on.
Interface
| Port | Direction | Type | Description |
|---|---|---|---|
clk | in | 1 bit | Clock |
rst | in | 1 bit | Synchronous reset (active high) |
req_a | in | 1 bit | Call button, prep-room side (level, held) |
req_b | in | 1 bit | Call button, grow-room side (level, held) |
unlock_a | out | 1 bit | Door A release (registered) |
unlock_b | out | 1 bit | Door B release (registered) |
Behavior (the spec the controller claims to meet)
- Out of reset, both doors are locked:
unlock_a = 0,unlock_b = 0 - With both doors locked,
req_a = 1at a rising edge releases door A the next cycle, whateverreq_bcarries. On a tie, the prep side wins - With both doors locked,
req_a = 0andreq_b = 1at the edge releases door B the next cycle - A released door stays released while its request is held, and relocks the cycle after its request reads 0 at an edge
- While one door is released, the other side waits. After the relock, both doors stay locked for 1 full cycle (the fan flush), then the waiting side may release
- The two doors are never released in the same cycle
rst = 1at a rising edge locks both doors, whatever the requests carry
What the bench checks
- The grading bench (the read-only testbench tab) runs your bench inside it and audits every
check_doorscall against its own model of the spec - Every pair of expected doors must match the spec model at the instant of the check
- At least 1 check must catch the shipped controller holding doors the spec model does not
- Your bench must drive door A alone, door B alone, and both requests high at the same locked-door edge
- At least 8 checks must run, none before
rsthas been high through a rising edge - The run ends when your bench sets
tb_done; a stalled bench times out and fails
Constraints
the controller is synchronous to clk, and both unlock outputs are registered: each effect shows the cycle after its edge.
the deliverable is the extended bench, not a controller fix; airlock_ctrl stays as shipped. The door hardware and the flush fan itself are out of scope.
keep the given signal names, the dut instance and the check_doors check helper exactly as they are. The grader finds them by name.
airlock_ctrl. The farm needs the fault demonstrated, not painted over.
- Keep the vendor's directed tests in place: the grader still requires the solo-door coverage they provide
- Report mismatches only through
check_doors. The grader owns the verdict, so never print the word FAIL yourself
Do not add ports.
Click Run to execute your code. Output will appear here.