"Static" methods in Systemverilog

Hello all
I was trying out some example with the “static” keyword in SystemVerilog. I really got confused with the output.


module test;
 
  class base;
     int i;
    
  // function get();
  // static function get(); 
  // function static get(); 
  // static function static get();
      int a;
      a++;
      $display(a);   
      
     endfunction 
  endclass
  
    base b3 = new();
    
    initial begin 
      base b1, b2;
      
      b1 = new();
      b2 = new();
      
      b1.get();
      b2.get();
      b3.get();
      
    end
endmodule 

For “function get()” and “static function get()” i am getting output as
1
1
1

For “function static get()” and " static function static get()" i am getting output as
1
2
3

Q1) if a function is “static”, initialized before time 0. then how it is displayed as 1, 1, 1 for “static function get()”

Q2) In this “function static get()” method, my function is not static, but it is displayed as 1, 2, 3.

Q3)Difference between “static function get()”, “function static get()” and “static function static get()”

In reply to SriGanesh D:

function static get() is illegal syntax. See https://verificationacademy.com/forums/systemverilog/what-exact-difference-between-static-tasks/functions-and-automatic-tasks/functions-please-explain-clear-example#reply-60649

In reply to dave_59:

In reply to SriGanesh D:

function static get()
is illegal syntax. See What is the exact difference between static tasks/functions and automatic tasks/functions ? please explain with a clear example - SystemVerilog - Verification Academy

Hi Dave
Thanks for the reply, I got some idea about static and automatic methods. But one clarification, if “function static” is illegal syntax means. why didn’t tool show any error?

In reply to SriGanesh D:

You’ll have to take that up with your tool vendor. This Mentor sponsored public forum is not for discussing tool specific issues. I’m guessing it also didn’t warn you about declaring a non-void function with a 1-bit return value, and using it as a statement.