Home › Practice › Accelerators › 2x2 systolic array

2x2 systolic array

MediumRTLAcceleratorssequential

Four of the cells from the last problem, wired into a 2x2 grid, multiply two 2x2 matrices with no multiplier bigger than one cell. Here the only trick left is timing.

Concept first. In the grid, numbers of A flow left to right along each row, and numbers of B flow top to bottom along each column. Cell (r, c) must multiply A[r][k] with B[k][c] for k = 0 and 1, and add them up; its total is then C[r][c]. For that, both numbers of a pair have to arrive at the same tick.

But passing on costs one tick per cell. Look at a single row of cells: a number that enters at tick t is at the first cell at tick t, at the second cell at tick t+1, at the third at t+2. A number going down a column behaves the same way. So two numbers that you put in together arrive together at a cell only if they travelled the same number of cells. For the cell at the far corner they have each travelled a different distance than for a cell next to the entrance.

Your job: work out which cells get their a straight from the input and which get it through another cell, the same for b, and delay the input streams so every pair meets at the right cell. This delaying of the inputs is called the skew. Do not delay anything you do not have to.

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

← One cell of a systolic array (PE)Four lanes, one instruction, one mask (GPU style) →