Void

Hi,
pls tell me what i void’ in below example

repeat(10)
begin
void’(obj_1.randomize());
$display(" Ran_Stb_1.Var : %0d ",obj_1.Var);
end

Hi Lakshmikanth,
‘void’ in general means nothing or no data type.

void func1(arg1) means that the function doesn’t return anything.
func1(void) means that function doesn’t take any inputs.

In the present context, it means that you are trying to cast the return value of randomize function to a datatype of void (or in other words ‘no type’). Basically you just wanted to ignore the result and not assign it to any variable.

In order to make code more meaningful, you can slightly modify it as below:

if(obj_1.randomize());
   $display(" Ran_Stb_1.Var : %0d ",obj_1.Var);
else
   $display(" Randomization failure !!!");

Hope this helps.
Thanks,
Rajkumar.