# How to program a matrix 5*5 in VHDL ?

Status
Not open for further replies.

#### Mejdi_tn

##### Junior Member level 3
Hi
how to programm a Matrix 5*5 in VHDL
exemple for Martix in C

double Mat33[NBROWS][NBCOLS]=
{
{ 6*sqrt(2), 3*sqrt(5), 6 , 3*sqrt(5), 6*sqrt(2) } , // row no 0
{ 3*sqrt(5), 3*sqrt(2), 3 , 3*sqrt(2), 3*sqrt(5) } , // row no 1
{ 6 , 3 , 1 , 3 , 6 } , // row no 2
{ 3*sqrt(5), 3*sqrt(2), 3 , 3*sqrt(2), 3*sqrt(5) } , // row no 3
{ 6*sqrt(2), 3*sqrt(5), 6 , 3*sqrt(5), 6*sqrt(2) } // row no 4
};
thing you

#### Old Nick

matrix vhdl

Why not just use a dual port ram block or similar (it doesn't really need to be dual port, but it depends how you want to access it!)?

#### Iouri

matrix multiplication vhdl

it is really depends what you are trying to do, you can use RAM modules or registers will take a lot's of logic resources

#### master_picengineer

##### Banned
matrix multiplication in vhdl

Old Nick said:
Why not just use a dual port ram block or similar (it doesn't really need to be dual port, but it depends how you want to access it!)?

Hi all,

Could you please elaborate and explain how ?
Thanks Old Nick for the idea.

#### Old Nick

matrix in vhdl

what is the target, Xilinx - Altera?

I am assuming you understand haw RAM can be viewed as a matrix, elements in memory are the same as elements in an array.

Xilinx has a coregen module you can use for dual port, or if it's a small array you can just program it yourself to save space.

#### honnaraj.t

##### Member level 2
opengl vhdl

hi nick,
i am implementing opengl on FPGA.... in my project i need to do lots of matrix multiplication ........please send me some material to do matrix multiplication in VHDL........

regards
honnaraj

#### atena

##### Full Member level 1
vhdl code for matrix multiplier

honnaraj.t said:
hi nick,
i am implementing opengl on FPGA.... in my project i need to do lots of matrix multiplication ........please send me some material to do matrix multiplication in VHDL........

regards
honnaraj

Dont try to synthesize and implement floating point with VHDL and FPGA without internal built floating-point processor. The technique of entering the matrix in VHDL is very simple but i dont think you can use those math function like sqrt here....

#### honnaraj.t

##### Member level 2
vhdl matrix operations

hi,

#### sameem_shabbir

vhdl coding for matrix multiplication

Matrix multiplication
I have seen its code available at Xilinx site.
Hope that is going to be helpful to you

#### smqasim

##### Newbie level 6
matriz vhdl

Use a systolic array for Matrix multiplication. Systolic array is best suited for matrix operations implemented in hardware. The systolic array consists of identical processing elements. Each processing element does a multiply accumulate operation and passes the data to the preceding element for further processing.

Another technique is to use internal memory (BRAM) of FPGA for storing the input and output matrices. Design a controller that takes the input from the memory, does the multiply and accumulate operation and finally stores the result in memory.

#### rourabpaul

##### Member level 3
Re: Matrix in VHDL

i never use array in vhdl code,
i want to make a matrix multiplication using array,
in that case how can i decalare array in port,
pls help

---------- Post added at 08:16 ---------- Previous post was at 08:11 ----------

i never use array in vhdl code,
i want to make a matrix multiplication using array,
in that case how can i decalare array in port,
pls help

---------- Post added at 08:21 ---------- Previous post was at 08:16 ----------

i never use array in vhdl code,
i want to make a matrix multiplication using array,
in that case how can i decalare array in port,
pls help

#### TrickyDicky

Re: Matrix in VHDL

you need to declare the array type in a package, then you can use it on a port:

Code:
library ieee;
use ieee.numeric_std.all;

package type_pkg is
type my_array_t is array(0 to 7) of unsigned(7 downto 0);
end package type_pkg;

use work.type_pkg.all;

entity matrix_mult is
port (
.....
input : my_array_t;
);

end entity matrix_mult;

Status
Not open for further replies.