Title here
Summary here
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 int[]
. We can call nums.size()
, iterate over it with foreach
, etc.
Variadic functions can be called in the usual way with individual arguments.
If you already have multiple arguments in an array, apply them to a variadic function using the syntax func(array)
like this.
To run the program, compile and execute the SystemVerilog code using a simulator.
Another key aspect of functions in SystemVerilog is their ability to form tasks, which we’ll look at next.