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.

Increment an array of integers in VHDL

Status
Not open for further replies.

Farid Shamani

Newbie level 6
Newbie level 6
Joined
Jun 11, 2013
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
95
Hi friends,

I am wondering if there is any other way rather than FOR loop too increment an array of integers by a certain amount. I mean if I have a array of (12, 1, 15, 40, ... , 3) in next iteration all the elements increase by , e.g., one (13, 2, 16, 41, ... , 4).

Thank you
Farid
 

A for loop is the only way to do it. But why not wrap it inside a function?


Code VHDL - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function array_add_1( a : int_array_t) return int_array_t is
  variable ret : int_array_t(a'range);
begin
  for i in a'range loop
    ret(i) := a(i) + 1;
  end loop;
 
  return ret;
end function array_add_1;
 
 
.........
 
--in your code:
 
my_array <= array_add_1(my_array);

 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top