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.

using integer arrays in VHDL

Status
Not open for further replies.

chillimillii

Newbie level 5
Joined
Sep 26, 2007
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,334
arrays in vhdl

hi,


i have to use integer arrays in VHDL. the main problem is i have to put integer values into arrays. i dont know how to implement this in VHDL. please help me. Thanks!
 

vhdl array of integers

Dont understand what exactly your problem is.
you can eaisly define a data type like
type int_array is array(0 to N-1) of integer;

then a signal of that type:

signal my_integers : int_array;


now you can eaisly assign values to the array elements like:
my_integers(0) <= 24;
or
my_integers(N-1) <= 100;
Kr,
Avi
 

vhdl 1 & integer

Well, if I want to assign values in array like:

type type_array is array(0 to N-1) of std_logic_vector(o to N-1);
signal tmp : type_array;

how should I do ?
 

array integer vhdl

Code:
tmp(i) <= std_logic_vector(conv_unsigned(j,N));
-- respectively conv_signed(), according to your data interpretation

An integer array (with a range to control the bit width) would be possible as well.

By the way, the arithmetic types generally have a downto bit order, thus a std_logic_vector(0 to N-1) would be supplied with inverted bits. Not a problem for the std_logic_vector, but a possible source of confusion when further processing the data.
 

implications of using integer in vhdl

avimit said:
Dont understand what exactly your problem is.
you can eaisly define a data type like
type int_array is array(0 to N-1) of integer;

then a signal of that type:

signal my_integers : int_array;


now you can eaisly assign values to the array elements like:
my_integers(0) <= 24;
or
my_integers(N-1) <= 100;
Kr,
Avi


basically i have to use 4x 3 array having its elements as integers in Vhdl (for performing matrix subtraction and multiplication etc etc operations). I don't know exactly declaring and defining this. do you have any idea about it?
 

array 0 to n vhdl

Code:
type int_array is array(0 to 3, 0 to 2) of integer range -2**15 to 2**15 -1;
 
integer array in vhdl

You may also break down the array type declaration into 2 steps for clarity like this:
type my_int_array is array(0 to 3) of integer range -2**15 to 2**15 -1;
type my_int_matrix is array (0 to 2) of my_int_array;

Kr,
Avi
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top