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

PortDirectionTypeDescription
clkin1 bitClock
rstin1 bitSynchronous reset (active high)
beamin1 bitBeam broken (held for one full cycle)
splitout8-bit vectorCaptured tick count

Behavior (the latch spec)

  • The internal tick counter increments at every rising edge of clk; rst = 1 at a rising edge clears it to 0
  • When beam = 1 at a rising edge, split captures the tick counter's value from just before that edge
  • With beam = 0 at the edge, split holds its value
  • rst = 1 clears split to 0
  • split may change only at a rising edge of clk. Between edges it must hold, whatever beam does

What the bench checks

  • The grading bench (the read-only testbench tab) runs your bench inside it and audits every check_split call 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 rst has been high through a rising edge
  • The run ends when your bench sets tb_done; a stalled bench times out and fails

Constraints

TIMING

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.

SCOPE

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.

GIVENS

keep the given signal names, the dut instance and the check_split check helper exactly as they are. The grader finds them by name.

DO NOT MODIFY

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.

Loading editor...

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