From: David Bishop <dbishop@eda.org>

Date: Fri Jun 27 2014 - 09:38:47 PDT

Date: Fri Jun 27 2014 - 09:38:47 PDT

On 06/26/2014 10:09 PM, tgingold@free.fr wrote: > Hello, > > I am slightly confused by the representation. In the ug: > > As a concession to C, all matrices are assumed to be in column, row format, and starting at index “0”. Thus for the matrix: > Z := ((1.0, 2.0, 3.0), > (4.0, 5.0, 6.0), > (7.0, 8.0, 9.0)); > Z (0,2) = 7.0 > > > I suppose we all agree that Z should be: > [ 1 2 3 > 4 5 6 > 7 8 9 ] > > So the first dimension is the number of lines and the second dimension is the number of columns. > This is natural both from a point of view of the VHDL language and from classical math style. > > But in that case and following the above excerpt, Z (0, 2) is 3.0 ! > > BTW, I am not sure that starting at index "0" is the best choice. This is > neither the matlab conversion (which is heavily used) nor the math choice. When I create a matrix, I do it as: type real_matrix is array (NATURAL range <>, NATURAL range <>) of REAL; -- real matrix Which follows from: type real_vector is array (NATURAL range <>) of REAL; Which is part of VHDL-2008. So what you really have is array of arrays. In order to load the array, I have to do: Z := ((1.0, 2.0, 3.0), (4.0, 5.0, 6.0), (7.0, 8.0, 9.0)); which reversed rows and columns as it loads..... -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Fri Jun 27 09:38:59 2014

*
This archive was generated by hypermail 2.1.8
: Fri Jun 27 2014 - 09:39:35 PDT
*