Practice
Bobsled Split Latch
Berg im Tal runs a bobsled training track. A light beam crosses the ice at corner 7. When a sled cuts the beam, a latch board captures the track timer's tick count, and the scoreboard reads that latch on its own schedule. Twice this season the board showed a corner-7 split before the sled got there. The photo from the coach is on your desk.
The vendor swears the latch is fine, and their bench is already in your rig. It passes. It drives beam crossings, waits until the values settle, and every value it reads is correct. The spec, though, promises more than correct values. It promises a moment: split may change at a rising edge of clk and at no other time. Nothing in the vendor's bench ever looks between the edges.
Your task: fix the bench so it catches the latch changing split at a forbidden moment. Keep driving beam crossings and checking settled values. Add checks that pin down when split changes, not just what it settles to. The design file is off limits: the evidence must come from the bench.
Interface
| Port | Direction | Type | Description |
|---|---|---|---|
clk | in | 1 bit | Clock |
rst | in | 1 bit | Synchronous reset (active high) |
beam | in | 1 bit | Beam broken (held for one full cycle) |
split | out | 8-bit vector | Captured tick count |
Behavior (the latch spec)
- The internal tick counter increments at every rising edge of
clk;rst = 1at a rising edge clears it to 0 - When
beam = 1at a rising edge,splitcaptures the tick counter's value from just before that edge - With
beam = 0at the edge,splitholds its value rst = 1clearssplitto 0splitmay change only at a rising edge ofclk. Between edges it must hold, whateverbeamdoes
What the bench checks
- The grading bench (the read-only testbench tab) runs your bench inside it and audits every
check_splitcall against its own spec model of the latch - Every expected value must match the spec model at the exact instant of the check
- At least 1 check must catch the shipped latch holding a value the spec model forbids at that instant
- At least 2 beam crossings must be driven, and at least 1 sound check must expect a nonzero split
- At least 4 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 spec allows split to change only at a rising edge of clk; between edges it must hold. Your checks are judged at the instant they run.
the deliverable is the bench, not the latch; split_latch stays as shipped. The beam optics, the track timer electronics, and the scoreboard are out of scope.
keep the given signal names, the dut instance and the check_split check helper exactly as they are. The grader finds them by name.
split_latch. A bench that fixes the design instead catches nothing, and the grader will say so.
- Report mismatches only through
check_split. The grader owns the verdict, so never print the word FAIL yourself - A check is judged at the instant you call it. Where you place that instant inside the cycle is the whole game here
Do not add ports.
Click Run to execute your code. Output will appear here.