Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

matrix(5x5) with vhdl

Status
Not open for further replies.

azadehasadi

Newbie level 4
Joined
Jun 18, 2015
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
41
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
Joined
Aug 20, 2011
Messages
2,641
Helped
302
Reputation
606
Reaction score
297
Trophy points
1,363
Activity points
18,256
So, you want to define a matrix of 5x5 elements with every element being 8 bits long ?
 

shaiko

Advanced Member level 5
Joined
Aug 20, 2011
Messages
2,641
Helped
302
Reputation
606
Reaction score
297
Trophy points
1,363
Activity points
18,256
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...
 

sreevenkjan

Full Member level 5
Joined
Nov 4, 2013
Messages
268
Helped
27
Reputation
54
Reaction score
26
Trophy points
28
Location
Germany
Activity points
1,834
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).
 

azadehasadi

Newbie level 4
Joined
Jun 18, 2015
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
41
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
Joined
Aug 20, 2011
Messages
2,641
Helped
302
Reputation
606
Reaction score
297
Trophy points
1,363
Activity points
18,256
Why would you need a 3D array to design a UART ???
 

TrickyDicky

Advanced Member level 5
Joined
Jun 7, 2010
Messages
7,025
Helped
2,058
Reputation
4,133
Reaction score
2,010
Trophy points
1,393
Activity points
38,605
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.
 

azadehasadi

Newbie level 4
Joined
Jun 18, 2015
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
41
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)
 

azadehasadi

Newbie level 4
Joined
Jun 18, 2015
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
41
tnx, do u know how can access to each element? for example i assign a signal to certain element?
 

TrickyDicky

Advanced Member level 5
Joined
Jun 7, 2010
Messages
7,025
Helped
2,058
Reputation
4,133
Reaction score
2,010
Trophy points
1,393
Activity points
38,605
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).
 

azadehasadi

Newbie level 4
Joined
Jun 18, 2015
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
41
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
Joined
Jun 7, 2010
Messages
7,025
Helped
2,058
Reputation
4,133
Reaction score
2,010
Trophy points
1,393
Activity points
38,605
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.
 

azadehasadi

Newbie level 4
Joined
Jun 18, 2015
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
41
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
Joined
Nov 4, 2013
Messages
268
Helped
27
Reputation
54
Reaction score
26
Trophy points
28
Location
Germany
Activity points
1,834
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.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top