Verification #36 · 2026-10-29 · Argument passing · Easy · about 10 min
The helper that drains a copy
mover.move(n, src, dst) takes bytes from the front of one queue and appends them to another, for a testbench that splits a byte stream into packets:
- It removes up to
nbytes from the front of the caller'ssrcqueue, oldest first, and appends them to the end of the caller'sdstqueue. Bytes already indststay. - If
srchas fewer thannbytes, it moves what there is. - It returns the number of bytes moved, and adds that to
total.
The return value and total are right, but the caller's queues don't change. Run moves four bytes and finds src untouched and dst empty. Fix mover.sv.
Write and run your answer in the browser. The hidden tests check it, and it’s free.