请问:为什么调用size函数失败?
时间:10-02
整理:3721RD
点击:
各位:我在写sequence的时候遇到一个莫名其妙的问题,如下:
在sequence里面定义: my_eth_transaction tx_xacts[2]; 然后在body里面,想让它打印出tx_xacts的大小,用语句‘ $display("Debug 1: size is %0d\n",tx_xacts.size()); '
但是用vcs运行出error:
Error-[PMCOWAT] Called on wrong array type
/proj/testbench/inc/eth_direct_sequence.sv 46
Predefined method 'size' called on an array that is not an associative array.
Source info : this.tx_xact.size
See the 'Associative Array Methods' section in the SystemVerilog Testbench Constructs manual.
为什么呢?
在sequence里面定义: my_eth_transaction tx_xacts[2]; 然后在body里面,想让它打印出tx_xacts的大小,用语句‘ $display("Debug 1: size is %0d\n",tx_xacts.size()); '
但是用vcs运行出error:
Error-[PMCOWAT] Called on wrong array type
/proj/testbench/inc/eth_direct_sequence.sv 46
Predefined method 'size' called on an array that is not an associative array.
Source info : this.tx_xact.size
See the 'Associative Array Methods' section in the SystemVerilog Testbench Constructs manual.
为什么呢?
静态数组没有size()。
谢谢!
静态数组是可以调用size函数的,貌似关联数组不能使用size吧。
关联数组是num