Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Accumulate a four-lane signed dot product

Hardware interview practice

Accumulate a four-lane signed dot product

MediumRTL DesignSystemVerilog

A small signal-processing block accepts four signed byte pairs and uses one multiplier for a fixed four-cycle calculation. Implement synthesizable SystemVerilog RTL for the fixed-latency dot-product engine.

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Starting point

Question code

input logic clk, rst_n, start;
input logic signed [7:0] a[4], b[4];
output logic busy, done;
output logic signed [17:0] result;
Reviewed example

Work through one case

Input
At C0, start is accepted with a={1,2,3,4} and b={5,6,7,8}.
Expected output
After C4, done=1 and result=70.

The engine snapshots the operands and accumulates one lane per cycle: 1×5 + 2×6 + 3×7 + 4×8 = 70, then completes on the fourth MAC edge.

What to cover

Requirements

  1. Accept start only on a rising edge with busy=0, snapshot all eight inputs, set busy, and ignore every start sampled while busy=1.
  2. Accumulate one signed lane product per cycle in index order; keep every product and the running sum signed at 18 bits.
  3. For a start accepted at C0, drive done=1 and the exact sum after edge C4; busy is 1 after C0 through C3, then 0 after C4, and done is otherwise 0.
  4. When rst_n=0 at a rising edge, clear busy, done, result, the accumulator, and the lane index; the reset edge accepts no start.
Continue practicing

Related questions

RTL DesignEnabled modulo-five counter→RTL DesignEncode the highest active request and its one-hot form→RTL DesignXNOR from one 2-to-1 mux→
asic.fyi · Learn silicon end to end.info@asic.fyi