Practice
Cutter Ramp Streamer
The blade head of a vinyl cutter cannot go from parked to cutting speed in one step; it tears the material. So every move starts with a ramp: 8 velocity words, streamed to the servo drive over a valid/ready handshake.
The previous implementation shipped to three customers before the field reports arrived. Ramps had missing steps or the same step twice, and one memorable unit drove the head into the rollers at full speed. The cause: whenever its buffer fills, the drive drops ready during the ramp, but the old source counted every word it presented as sent. The handshake rule it skipped is the one every datasheet states: a word transfers only on a cycle where valid and ready are both high. Until then, the source must hold valid high and keep the word rock steady.
Your task: build the source side, with the handshake done right. When the motion planner pulses go with a starting velocity on base, stream the 8 words base, base+1, ... base+7. Flag the final word with last, then go quiet.
Interface
| Port | Direction | Type | Description |
|---|---|---|---|
clk | in | 1 bit | Clock |
rst | in | 1 bit | Synchronous reset (active high) |
go | in | 1 bit | Start pulse from the motion planner |
base | in | 8-bit vector | Starting velocity, captured when go is taken |
ready | in | 1 bit | Drive can accept a word this cycle |
valid | out | 1 bit | Word on data is valid |
data | out | 8-bit vector | Velocity word base + k (wraps mod 256) |
last | out | 1 bit | High while word 8 of 8 is presented |
Behavior
- Idle:
valid = 0andlast = 0;datais meaningless and unchecked whilevalid = 0 go = 1sampled at a clock edge while idle starts a burst: from the next cycle,valid = 1anddata = baseas captured at that edge- A word transfers at each clock edge where
valid = 1andready = 1; the next cycle presents the next word,data = base + kfor word k (wrapping mod 256) - While
valid = 1andready = 0, every output holds exactly:valid,data, andlastmust not change last = 1exactly while the eighth word (base + 7) is presented, stalled or not- After the eighth word transfers, the block returns to idle from the next cycle; a
goon that first idle cycle starts a new burst gois ignored whenever a burst is in progress;basechanges mid-burst are ignored toorst = 1at a clock edge aborts everything: idle from the next cycle
What the bench checks
- The testbench checks
validandlaston every cycle anddataon every cycle wherevalidshould be 1 - A full-rate burst must present eight consecutive values, assert
lastonly on the eighth, then return to idle - Stalls on the first, middle, and final words must hold outputs steady; the stalled ramp also wraps from
FFto00 - A new
gopulse and changes tobaseduring a burst must not alter that burst - Reset during a stalled burst must abort it immediately and keep the source idle afterward
- A
goheld across the final transfer must be ignored there, then start the next burst from the following idle cycle
Constraints
everything is synchronous to clk; outputs may only change at clock edges.
this models the source side of the handshake only. The servo drive and its buffer live behind ready, and the blade mechanics are out of scope.
The burst length is fixed at 8 and the word values are base + k mod 256, so no memory is involved.
Do not add ports.
Click Run to execute your code. Output will appear here.