Hardware interview practice
Assert an integer square-root pipeline
Check a 32-bit floor-square-root block with fixed 16-cycle latency, one outstanding request, and a backpressured response. Verify both protocol timing and the arithmetic result.
Reviewed example
Work through one case
Input
accept radicand=27 at cycle0; response first asserts at cycle16 with root=5,remainder=2 and stalls until cycle18Expected output
fixed latency PASS; arithmetic PASS; root/remainder/valid stable through acceptance at cycle18Five squared is 25 <= 27, six squared is 36 > 27, and remainder 27-25 is two; ready does not alter assertion latency.
What to cover
Requirements
- Associate each accepted radicand with the response that first asserts exactly LATENCY cycles later, regardless of rsp_ready.
- Check root squared is at most the radicand and the next root squared is greater, using widened products that represent 65536 squared.
- Check remainder equals radicand minus root squared on every accepted response.
- Hold rsp_valid, root, and remainder stable throughout response stalls.
- Cancel pending latency obligations on reset and cover boundary, perfect-square, near-square, and stalled cases.
