Forum Discussion
Altera_Forum
Honored Contributor
15 years agomatrix array in vhdl
Dear all, I have 4x4 matrix and I want to read this matrix row by row on each clock cycle. For example, row1 is read in cycle1, row2 is read in cycle2 and so on. Can anyone give idea how to w...
Altera_Forum
Honored Contributor
15 years agoyou can transpose the entire thing yes. You just need to write a transpose function, like this:
function transpose( matrix : matrix_t ) return matrix_t is
variable ret : matrix_t;
begin
for i in matrix'range(1) loop
for j in matrix'range(2) loop
ret(j, i) := matrix(i,j);
end loop;
end loop;
return ret;
end function;
.....
transposed_matrix <= transpose(input);
This is not like softwear where you have to move everything around a memory - all you are doing is shifting all the "wires" around, so the data doesnt actually move, the output just connects to different inputs. There is no resource cost involved - its free. one big but: I think we've spoken before on this very subject, and it was clear then you had little understanding of digital logic. That doesnt seem to have changed. I recommend you go and learn about digital logic before you get any further with this. Otherwise you are going to hit some brick walls very quickly and you will not understand why.