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.

vhdl code for 2 cross 2 matrix

Status
Not open for further replies.

itsprabhuece

Newbie level 1
Joined
Aug 2, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
coimbatore
Activity points
1,286
how to create matrix in vhdl...and how to access ...how to access each value..
 

you can create a 2D array

Code VHDL - [expand]
1
2
3
4
5
6
--declaration
type a1 is array (0 to 7, 0 to 7) of std_logic;
signal ar :a1;                                                           -- Declaration of an array
 
--to access
ar(0,0) <= '1';           --  this will set first element to 1



OR

an 1D-1D array....
it is an array of array...

Code VHDL - [expand]
1
2
3
4
5
6
7
8
--declaration
type a1 is array (0 to 7) of std_logic_vector(0 to 7);
signal ar :a1;                                                           -- Declaration of an array
signal arr : a1 :=(others=>(others=>'0'));                     -- Initialization of array
 
--to access
ar(0)(0) <= '1';           --  this will set first element to 1
arr(1) <= "01101000";       -- this will set the row1 to the byte given...



hope it helps.....

- - - Updated - - -

here are some links....you might find helpful....

https://vhdlguru.blogspot.in/2010/02/arrays-and-records-in-vhdl.html
https://vhdlguru.blogspot.in/2010/03/some-tricky-coding-methods-using-vhdl.html
 

note: never create a 2d array of std_logic. It makes your life really difficult. create an array of std_logic_vectors instead. a 2d array of std_logic_vector is fine (but if you want numeric values, dont use std_logic_vector)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top