super.body() 变量的使用是非法的,因为它被认为是 "not declared"

Usage of a super.body() variable is illegal as it's considered "not declared"

我在序列 class 中扩展了 virtual task body() 的用法,并且在 body() 的父 class 声明中,我声明了一个变量。但是,在扩展 class' body() 中使用它时,我遇到了编译错误 Identifier 'q' has not been declared yet.

这是一个例子:

// Inside a base sequence class
virtual task body();
  byte q [$];
  ... 
  .. // rest of the code
  .
endtask : body


// Inside extended sequence class
virtual task body();
  super.body();

  q.push_back('hFF); // X Compilation error: Identifier 'q' has not been declared yet.

  ... 
  .. // rest of the code
  .

endtask : body

我看不出任何没有看到变量的逻辑原因。 当然,我可以在任务范围之外将其声明为 class 成员,但我想改进我对 SV 的理解中的这些小漏洞。

有什么帮助吗?提前致谢。

q 是超级 class 中的 body 任务的本地。派生的 class 中的 body 任务是不同的任务,因此范围不同。您不可能从派生的 class 中的 body 任务中看到它,就像您无法从任何其他任务中看到它一样。