Variadic Functions in VHDL
Here’s a function that will take an arbitrary number of int
s as arguments.
Within the function, the type of nums
is equivalent to integer_vector
. We can call nums'length
, iterate over it with a for
loop, etc.
To use the sum
procedure, instantiate it in the VHDL architecture like this.
When you run this code, you should observe the output generated by the report
statements.
Another key aspect of functions in VHDL is their ability to handle arrays and loops, which we’ll look at next.