RTL Design #59 · 2026-11-21 · Multipliers · Medium · about 30 min

A shift-and-add multiplier

Build a sequential shift-and-add multiplier, shift_mul, in mul.sv. It multiplies two unsigned N-bit numbers (N is 8 by default) using one adder, one step per clock, and takes exactly N clocks per product.

Requirements:

  1. start is honoured on a rising edge where busy is 0. That edge captures a and b; later changes to a and b have no effect on the running multiplication. A start while busy is 1 is ignored.
  2. busy is 1 from the edge that accepts start until the edge that finishes the multiplication, which is the Nth edge after it. So busy reads 1 for exactly N cycles.
  3. The edge that finishes the multiplication sets busy to 0, drives done to 1 for exactly one cycle, and loads product with the full 2N-bit result.
  4. product keeps that value until the next multiplication finishes. It does not change while a new one is running.
  5. rst_n is a synchronous, active-low reset. It clears busy, done and product, and abandons any multiplication in progress (no done). Reset wins over start on the same edge.

Example, N = 8, a = 13, b = 11, with start high only on edge 0:

after edge busy done product
0 1 0 0
1 … 7 1 0 0
8 0 1 143
9 0 0 143

Write and run your answer in the browser. The hidden tests check it, and it’s free.