Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics 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.

How can I formulate matrices using VHDL?

Status
Not open for further replies.

dimitris01

Newbie level 3
Joined
Dec 9, 2005
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,315
hi can anyone tell me how can I formulate matrices using VHDL?
 

Re: VHDL design

// definition of matrix m*n of integers (0, 1...9)
TYPE matrix IS array (m-1 downto 0, n-1 downto 0) of integer range 9 downto 0;

// instantiating matrix
VARIABLE matrix_instance: matrix;

// using matrix
matrix_instance( 1 , 1 ) := 5;
 

    dimitris01

    Points: 2
    Helpful Answer Positive Rating
VHDL design

matrix_instance( 1 , 1 ) := 5; can u explain me this line?

thx

dimitris
 

Re: VHDL design

"matrix_instance" is the matrix of integers range from 0 to 9. So, the element with index (1,1) take on a value 5.
(note: elements of matrix are instaniate like variables. That is why I wrote :=)

Any other questions? I'm ready to answer.
 

    dimitris01

    Points: 2
    Helpful Answer Positive Rating
VHDL design

ok if i want to create a Nx1 matrix I write?

constant N : integer := 1;
constant M : integer := 7;
type NM is array(0 to N, 0 to M) of integer;

and by using the matrix_instance I can assign the values of the elements of the matrix?

thx
 

Re: VHDL design

matrix_instance is only the name of instance. It is not a keyword. In your case you can operate with matrix elements using something like this:

constant N : integer := 1;
constant M : integer := 7;
type NM is array(0 to N, 0 to M) of integer;

VARIABLE matrix_instance: NM;
VARIABLE some_variable: integer;
...
NM(1,2) := 1;
some_variable := NM(0,3);
...
 

    dimitris01

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top