As we know for the two-dimensional systolic array, except that the data of the first row is sent at the time of initialization, or say the first cycle, the following ones must be sent after a row/column delay of one beat. I've tried some code for a systolic array, but it can only handle square matrices with the same rows and columns.
for (clk <- 0 until 2*n) {
for (id <- 0 until n) {
val p = clk - id
if (p >= 0 && p < n) {
dut.io.h_in(id).poke(a(id)(p))
dut.io.v_in(id).poke(b(p)(id))
} else {
dut.io.h_in(id).poke(0)
dut.io.v_in(id).poke(0)
}
}
}
a,b mentioned above are two n*n matrices filled with random value. My goal is to make the values of these matrices to be assigned to h_in and v_in ports of module dut in a way that a 2D systolic array can read. So far the code works correctly.
Because of the symmetry of square matrices, the code above works, but I can't think of a feasible way to control the flow of data in a way that 2D systolic array can read when the matrix is no longer a square, such as 43, 53 or so. Can anyone give any possible guidance? Thanks in advance.