EmbDev.net

Forum: FPGA, VHDL & Verilog Matrix input


Author: Bahare Moradi (bahare)
Posted on:

Rate this post
0 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
Author: P. K. (pek)
Posted on:

Rate this post
1 useful
not useful
You define your own type in a package, like
type uMatrixSType is array (3 downto 0) of unsigned(11 downto 0);
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
entity MATRIXIN is
  port (
    ...
    MatrixxDI : in uMatrixType;
    ...
  );
end MATRIXIN;

: Edited by User
Author: Verilogi (Guest)
Posted on:

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

Author: P. K. (pek)
Posted on:

Rate this post
1 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

Author: Bahare Moradi (bahare)
Posted on:

Rate this post
0 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?

Author: Lothar Miller (lkmiller) (Moderator)
Posted on:

Rate this post
1 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-Mehrdi...
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:
  output0 <= FeldA(cnthi)(cntlo);
  output1 <= FeldB(cnthi, cntlo);
Now: try yourself. Its not that difficult...

Author: Bahare Moradi (bahare)
Posted on:

Rate this post
0 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

Author: P. K. (pek)
Posted on:

Rate this post
1 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.

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.