wtr
Full Member level 5
Hello, pleases look at the following.
How can I facilitate the situation where I want to change this function to
function slv2matrix2d (a : STD_LOGIC_VECTOR, range_of_row, Range_of_col) return byte_2d_matrix_t
Whereby this means that BLK_WIDTH = a'length and DWORD_WIDTH=cellsize(byte)*numbers of col
I don't think range ascending or decending matters
Regards
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 type byte_2d_matrix_t is array(natural range <>, natural range <>) of BYTE_T; subtype COL_RANGE is NATURAL range 0 TO 3; subtype ROW_RANGE is NATURAL range 0 TO 3; function slv2matrix2d (a : STD_LOGIC_VECTOR) return byte_2d_matrix_t is -- sqr(a) variable b : byte_2d_matrix_t(ROW_RANGE, COL_RANGE); -- variable b : byte_2d_matrix_t(rr, col); begin for i in COL_RANGE loop for j in ROW_RANGE loop b(j, i) := a( (BLK_WIDTH - (1+(i*DWORD_WIDTH) + (j*BYTE_WIDTH))) DOWNTO (BLK_WIDTH - ((i*DWORD_WIDTH) + ((j+1)*BYTE_WIDTH))) ); end loop; end loop; return b; end function;
How can I facilitate the situation where I want to change this function to
function slv2matrix2d (a : STD_LOGIC_VECTOR, range_of_row, Range_of_col) return byte_2d_matrix_t
Whereby this means that BLK_WIDTH = a'length and DWORD_WIDTH=cellsize(byte)*numbers of col
I don't think range ascending or decending matters
Regards