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_o may change at a rising edge of clk_i 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_o at a forbidden moment. Keep driving beam_i crossings and checking settled values. Add checks that pin down when split_o changes, not just what it settles to. The design file is off limits: the evidence must come from the bench.

Interface

PortDirectionTypeDescription
clk_iin1 bitClock
rst_iin1 bitSynchronous reset (active high)
beam_iin1 bitBeam broken (held for one full cycle)
split_oout8-bit vectorCaptured tick count

Behavior (the latch spec)

  • The internal tick counter increments at every rising edge of clk_i; rst_i = 1 at a rising edge clears it to 0
  • When beam_i = 1 at a rising edge, split_o captures the tick counter's value from just before that edge
  • With beam_i = 0 at the edge, split_o holds its value
  • rst_i = 1 clears split_o to 0
  • split_o may change only at a rising edge of clk_i. Between edges it must hold, whatever beam_i 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_i 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_o to change only at a rising edge of clk_i; 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.