EmbDev.net

Forum: FPGA, VHDL & Verilog Matrix input


von Bahare M. (bahare)


Rate this post
useful
not useful
Dear friends
I want to write a  program in ISE(vhdl) which has a matrix 
input(n-by-n).
the program receives the matrix and does some operations on it.
I don't know how to define this input in Entity Part?
Can any one help me?

: Edited by User
von P. K. (pek)


Rate this post
useful
not useful
You define your own type in a package, like
1
type uMatrixSType is array (3 downto 0) of unsigned(11 downto 0);
2
type uMatrixType  is array (3 downto 0) uMatrixSType;

This example would give a 4x4 Matrix of 12-bit unsigned values. 
Afterwards just us the type in your entity definition, like
1
entity MATRIXIN is
2
  port (
3
    ...
4
    MatrixxDI : in uMatrixType;
5
    ...
6
  );
7
end MATRIXIN;

: Edited by User
von Verilogi (Guest)


Rate this post
useful
not useful
One should add in how one makes the package available for the code 
meaing how to include it to use

von P. K. (pek)


Rate this post
useful
not useful
Verilogi wrote:
> One should add in how one makes the package available for the code
> meaing how to include it to use

Sorry, this IMHO looks like basic knowledge one should acquire at or 
shortly after the first contact with VHDL.

Anyway, it has been written down by many others, find your favourite 
among the hits:
https://www.google.com/#q=vhdl+how+to+use+a+package

von Bahare M. (bahare)


Rate this post
useful
not useful
after defining an input like this, how can we use it's elements.
for exmaple can we write  MatrixxDI(1,2)?????????
what is the correct format?

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
Bahare Moradi wrote:
> after defining an input like this, how can we use it's elements.
> for exmaple can we write  MatrixxDI(1,2)?????????
Why not simply trying this yourself?

> what is the correct format?
Try that with Google translator. Its German:
http://www.lothar-miller.de/s9y/archives/39-Mehrdimensionale-Arrays.html
There can be seen two different ways to define a matrix.
The access to the matrix is also different an its shown in this two 
lines:
1
  output0 <= FeldA(cnthi)(cntlo);
2
  output1 <= FeldB(cnthi, cntlo);
Now: try yourself. Its not that difficult...

von Bahare M. (bahare)


Rate this post
useful
not useful
Thanks....
it works....
I used this :
A(1)(2)<="01010101";


_____________________________
I simulated a program containing 2D matrix in ISE.
But is it executable on board?
Can I use 2D matrix in my program which I want to transfer to my chip on 
the board?
I have heard that it is not possible and it is just for simulation

von P. K. (pek)


Rate this post
useful
not useful
Try synthesizing it, you'll see...

I've several of similar constructs in use, but I'm currently working 
with Quartus. However, I'd be surprised if it didn't work with ISE, too.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.