System verilog 如何在SystemVerilog中正确地内联声明N维队列?

System verilog 如何在SystemVerilog中正确地内联声明N维队列?,system-verilog,synopsys-vcs,System Verilog,Synopsys Vcs,如果我有2D INT队列,我希望能够像这样内联声明它: int my_queue[$][$] = {{1, 2}, {3, 4}}; 我也看到了 typedef int int_queue[$]; int_queue my_queue[$] = {{1, 2}, {3, 4}}; 相反,当我编译时,VCS会向我提供一个不兼容的复杂类型错误: Type of source expression is incompatible with type of target expression.

如果我有2D INT队列,我希望能够像这样内联声明它:

int my_queue[$][$] = {{1, 2}, {3, 4}};
我也看到了

typedef int int_queue[$];
int_queue my_queue[$] = {{1, 2}, {3, 4}};
相反,当我编译时,VCS会向我提供一个不兼容的复杂类型错误:

  Type of source expression is incompatible with type of target expression. 
  Mismatching types cannot be used in assignments, initializations and 
  instantiations. The type of the target is 'int$[$][$]', while the type of 
  the source is 'bit[63:0]'.
这对我来说意味着风投公司希望正确地投下等式的右边。我一直使用的解决方法是:

typedef int int_queue[$];
typedef int_queue int_queue_of_queues[$];
int_queue_of_queues my_queue = int_queue_of_queues'{{1, 2}, {3, 4}};

但这增加了N个额外的typedef和N维的行,我宁愿在一行中完成。如果我有一种方法可以在不使用typedef的情况下强制转换声明的右侧,那么这将很简单,但我不知道这是否可行。

数组连接语法仅在单个维度上有效。无法嵌套{},因为数组{}和整数{}串联之间存在歧义。您需要在外部维度或两个维度中使用数组分配模式。我更喜欢在这两个维度上使用赋值模式,这样可以更清楚地表明它们是数组元素,而不是整数连接

int my_queue[$][$] = '{'{1, 2}, '{3, 4}};
参见IEEE 1800-2017中的第10.10节未封装阵列连接 LRM