Russell Nash
Russell Nash

Reputation: 81

Default value of dynamic array argument in SystemVerilog

According to SystemVerilog LRM 3.1a (p.38) it is possible to pass dynamic array as an argument to tasks of functions:

 task foo( string arr[] );

Is it possible to assign a default value (zero-sized array) to this argument? Somewhat like we can do with other arguments:

task foo2(int i = -1, byte z = 0); 

Upvotes: 4

Views: 3923

Answers (1)

Russell Nash
Russell Nash

Reputation: 81

Finally found an answer. It is possible to do C-like array init at declaration time. Looks like:

task foo ( byte bar[] = '{} );

By the way, it seems there is no mentions about this possibility in LRM.

Upvotes: 4

Related Questions