Continue to Site

# matrix(5x5) with vhdl

Status
Not open for further replies.

##### Newbie level 4
hi i want define matrix 5x5 and (it must: std_logic_vector(7 downto 0))
plz help me. i need it for project in my university

#### shaiko

##### Advanced Member level 5
So, you want to define a matrix of 5x5 elements with every element being 8 bits long ?

##### Newbie level 4
So, you want to define a matrix of 5x5 elements with every element being 8 bits long ?

yes, i want it

#### shaiko

##### Advanced Member level 5
Try this:
Code:
subtype element is std_logic_vector(7 downto 0);
type memory_cube is array(integer range 0 to 4, integer range 0 to 4) of element;

It should compile - but I'm not sure whether it would synthesize...

Points: 2

#### sreevenkjan

##### Full Member level 5
hi i want define matrix 5x5 and (it must: std_logic_vector(7 downto 0))
plz help me. i need it for project in my university

Code:
type mat1 is array (0 to 4) of std_logic_vector(7 downto 0);
type mat is array (0 to 4) of mat1;
signal matrix_5x5  : mat;
Your 5x5 matrix is signal matrix_5x5 where each element is std_logic_vector(7 downto 0).

##### Newbie level 4
i use ISE for vhdl code,
Code:
type matrix5x5_8 is array(4 downto 0,4 downto 0) of std_logic_vector(7 downto 0);

thanks very much, i must use uart(its for serial input) to receive data, can u help me for it.

#### shaiko

##### Advanced Member level 5
Why would you need a 3D array to design a UART ???

#### TrickyDicky

##### Advanced Member level 5
i use ISE for vhdl code,
Code:
type matrix5x5_8 is array(4 downto 0,4 downto 0) of std_logic_vector(7 downto 0);

thanks very much, i must use uart(its for serial input) to receive data, can u help me for it.

There are many exmaples of uart out there
Just search for "uart vhdl" in your favourite search engine.

##### Newbie level 4
my project is:
pc send elements of matrix 5x5 then fpga(VHDL code) must compute sum of element of this matrix(sum of 25 element)

##### Newbie level 4
tnx, do u know how can access to each element? for example i assign a signal to certain element?

#### TrickyDicky

##### Advanced Member level 5
Why not go and code something, and we will help with any problems.
Hint: if all you are doing is summing a 5x5 matrix, you probably dont want a 5x5 matrix in VHDL (because each element arrives serially, you can sum them in the time domain).

##### Newbie level 4
u mean i define a matrix 1D(liner)? with 25 element?
tnx, if i want sum of two matrix rival of element what do i do?

#### TrickyDicky

##### Advanced Member level 5
No, you dont need a matrix at all. You just have a single value that adds the new values to the previous sum as they arrive.

##### Newbie level 4
ok, i think i understand,
and if i receive element of two matrix,how can i stored and sum of element with each others?

#### sreevenkjan

##### Full Member level 5
send the data as a raster scan. I assume your input from pc through UART should be an image. So send the pixel data from top left to bottom right through UART port in a raster fashion i.e first pixel and then second pixel serially. Your receiver system on the fpga side should also be the same.

Status
Not open for further replies.