参数化测试类的非过程上下文中包含动态数据的结构

问题描述 投票:0回答:2

SV/UVM 中的以下代码会产生代码后显示的 VCS 编译错误。

 typedef enum int {
  ABC,
  DEF,
  GHI,
 . . .
 } enum_t

class some_test #(type T=uvm_test) extends T;
 
 `uvm_component_param_utils(some_test#(T))

 bit assoc_array[3][enum_t];


 //bunch of tasks and functions here

 
 task run_phase(uvm_phase phase);
   int index;
  
  //Below wait inside some fork-join and begin-end blocks
  //index calculated
  assoc_array[index].delete(); //Compiler OK here
  assoc_array[index][DEF] = 1; //Compiler OK here
 
  //some more forked threads

  wait(assoc_array[index].exists(ABC) && (assoc_array[index][ABC]==1)); //COMPILER ERROR
 endtask

endclass

错误是:

Error-[DTINPCIL] Dynamic type in non-procedural context
"wait ((this.assoc_array[index].exists(ABC) && (this.assoc_array[index][ABC] == 1))) ;"
  Argument: this.assoc_array[index]
  Structure containing dynamic data and/or used in dynamic arrays may not be 
  used in non-procedural context.

我不明白为什么这是非程序上下文。这与测试是参数化测试有什么关系吗?我正在做这样的“扩展”来实现多重继承。我在 Tudor Timi 的一篇博客中看到了这一点,标题为“Fake it Until you make it - Emulate multiple Heritage in System Verilog”,尽管他的示例实现了其他目标,并且绝对没有进行参数化测试。

在其他一些测试包中,我也有这段代码:

typedef some_test #(some_basic_test) better_test;
system-verilog uvm
2个回答
0
投票

你需要更改等待语句来执行...while.

   do
   begin
     //debug print/function/timeout
   end
   while(assoc_array[index].exists(ABC) && (assoc_array[index][ABC]==1));

0
投票

我能够在 EDA Playground 上使用最少的代码示例重现您的 VCS 编译错误。然而,其他 3 个模拟器不会产生编译错误。

我不明白错误消息。该代码在从

wait
块调用的
task
内使用
initial
,这对我来说似乎是一个过程上下文。

我还尝试了我拥有的更新版本的 VCS,并且遇到了相同的错误。您可以联系 Synopsys 寻求帮助。

这是我使用的代码:

module tb;

typedef enum int {
    ABC,
    DEF,
    GHI
} enum_t;

bit assoc_array[3][enum_t];
int index;

task runphase;
    assoc_array[index][DEF] = 1;
    wait(assoc_array[index].exists(ABC));
endtask

initial begin
    runphase();
end
endmodule
© www.soinside.com 2019 - 2024. All rights reserved.