1

I have read somewhere that Non-Blocking-Assignment is not allowed for dynamic objects like class-objects, dynamic arrays etc.

My sample code is

class dyn_class;
  logic a;
  function void put();
    a <= 1'b1;
  endfunction
endclass

module TB();
  dyn_class dyn_obj = new();
  initial
  dyn_obj.put();
endmodule

The ERROR popped up is ERROR VCP7049 "Non-blocking assignment to dynamic object: this.a." "testbench.sv" 7 14

Can anyone tell the reason why this is the case?

I also read somewhere that there is a proposal to remove this rule in the next version.

The simulator is edaplayground.

user1978273
  • 484
  • 10
  • 24

1 Answers1

1

The 1800-2012 LRM removes the restriction on NBAs that target class members. However the restriction targeting automatic variables and dynamically sized arrays remains. (This keeps memory management simple when removing objects that have pending events).

Modelsim supports this starting with version 10.2 released in 2012.

dave_59
  • 39,096
  • 3
  • 24
  • 63