An error occurs when a variable is declared after `uvm_info()

Hello,

I face an error through writing a function with uvm. I use uvm_info to print some information. And the next line after uvm_info, a variable is declared. But an error occurs. I don’t know why this error occurs. Please, help me… :(

The this code is not working.


function void BLA();
  `uvm_info(get_type_name(), $psprintf("bla"), UVM_LOW)
  V_0 v0 = OTHER_BLA();
  V_1 v1;
  V_2 v2;
  if (blablabla) begin
  end

...

endfunction: BLA

But, this code is working.


function void BLA();
  V_0 v0 = OTHER_BLA();
  V_1 v1;
  V_2 v2;
  `uvm_info(get_type_name(), $psprintf("bla"), UVM_LOW)
  if (blablabla) begin
  end

...

endfunction: BLA

Thanks.

In reply to jh_veryveri:

From section 6.21 of the LRM:
A variable declaration shall precede any simple reference (non-hierarchical) to that variable. Variable
declarations shall precede any statements within a procedural block.

You are not allowed to declare any variables after a procedural statement, which the `uvm_info() is.