RisingEdge.pro
Sign in to run

Bottling Line Eject Delay

Line 2 caps six hundred bottles a minute. The vision camera at the capper raises flag for one clock cycle when a cap is crooked, and the air ejector sits three starwheel pockets downstream, one pocket per clock. This block has exactly one job: delay flag by three cycles and present it as eject, so the jet fires when the bad bottle, and only the bad bottle, is in front of it.

The contractor signed it off from the maintenance panel with a thumb on the test button. Since production started, QA keeps finding crooked caps in shipped cases while the jet blasts good bottles two pockets early. In simulation the fault is plain: the flag comes out one cycle after it goes in, not three. The testbench fires single-frame rejects, two rejects separated by a single quiet cycle, the contractor's thumb-on-the-button pattern (flag held high four cycles straight), and a reset in the middle of a delay in flight, and it checks eject on every cycle.

Interface

PortDirectionTypeDescription
clkin1 bitClock, one starwheel pocket per cycle
rstin1 bitSynchronous reset (active high)
flagin1 bitReject flag from the camera, 1 cycle wide
ejectout1 bitEjector fire command (registered)

Behavior

  • eject reproduces flag delayed by exactly three clock cycles: eject during any cycle equals flag three cycles earlier
  • Pulse shapes are preserved exactly: single-cycle flags come out single-cycle, back-to-back patterns come out unchanged
  • rst = 1 at a clock edge clears eject and every delay stage; flags already in flight are discarded and must never emerge after the reset
  • After reset is released, eject stays 0 until the first post-reset flag has had its three cycles
  • The testbench checks eject on every cycle

One trace tells the whole story: a flag in cycle 1 fires the jet in cycle 4, three pockets later.

cycle : 0 1 2 3 4 5
flag  : 0 1 0 0 0 0
eject : 0 0 0 0 1 0

Constraints

Everything is synchronous to clk and eject is registered. The template contains the shipped implementation: fix it in place rather than starting over. The three delay stages are already declared and the structure is right.

sequentialshift-registerbehavioral
Loading editor...

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