Home › Practice › Accelerators › Dot product of two lists of four

Dot product of two lists of four

EasyRTLAcceleratorscombinational

A neural network layer is mostly dot products. The hardware that runs it asks one question over and over: multiply matching entries of two lists, then add everything up. Here you do it for lists of four, with all four multiplications happening at the same moment.

Concept first. The dot product of two lists pairs up the entries by position, multiplies each pair, and adds the results. Example with other numbers: list A = (2, 0, 1, 3) and list B = (1, 5, 4, 0). The pairs are 2×1, 0×5, 1×4, 3×0, so the answer is 2 + 0 + 4 + 0 = 6.

This circuit has no clock. The answer follows the inputs the moment they change. It is fast, but it needs four multipliers side by side, and multipliers are big. The next problem shows the opposite choice.

Solve in your browser →

No install and no sign-up needed. You write your answer in the editor and Nishkam checks it.

More in this track

← Multiply and keep a running total (MAC)Dot product with one multiplier →