Problem

Hi All,

In following code, K will be disappeared when leaving begin end block. Is there any way to show or prove that K is really disappeared during simulation?

for (int j=0; j<3; j++) begin
 automatic int k;
 .......
end

Thank you

In reply to peter:

No.

In reply to peter:
The value of k declared in class is never updated by the function’s automatic variable. Does this help you note that the value disappeared?

class automaticVar;
  int k;
  function dissappear;
    automatic int k;
    for(k=0;k<10;k++) begin
     $display("value of k is %0d",k);
    end
  endfunction
  
  function reuse;
    $display("New value of k is %0d",k);
  endfunction
  

  
endclass

module top;
  automaticVar av1 = new();
  initial begin
    av1.dissappear();
    av1.reuse();
  end
endmodule