在下面的代码片段中,我得到了以下错误:
资料来源:
x.datatheword = $urandom_range(0,255);'this‘不是精化时间常数。若要更正错误,可以将此const变量转换为参数或localparam。
数据记录的几何形状,只是一个内存,是在definition_pkg中声明的。数据记录对象是在Base_txn中创建的,我可以像这样直接访问它:
x.data[0][7:0] = x.frameID ; 我不知道为什么我会得到一个精化时间错误,因为在for循环中所发生的一切(我认为)是我正在索引一个已经存在的对象。
对任何建议、解释或解决方案表示感谢。
definition_pkg.svh
`define REC_DATAWIDTH 32
`define REC_ROWS 16
typedef bit[`REC_DATAWIDTH-1:0] DataRec [`REC_ROWS] ;sequences.sv
class Base_txn extends uvm_sequence_item;
rand DataRec data;
...
class sequencethingy extends uvm_sequence#(Base_txn);
...
int byte4val ;
int theword ;
int thebyteH ;
int thebyteL ;
// -----------------------------------------------------------------------
function void build_S (ref Base_txn x);
...
x.data[0][7:0] = x.frameID ;
...
for (int i = 8 ; i <= (byte4val+8) ; i++) // byte8 is the location of S[0]
begin
theword = i/4 ;
thebyteL = 8*(i%4) ;
thebyteH = thebyteL + 7 ;
x.data[theword][thebyteH : thebyteL] = $urandom_range(0,255) ;
end
endfunction
...
task body();
Base_txn wd_tx;
...
build_S(wd_tx) ; // give the processor some data 发布于 2016-06-20 14:38:46
https://stackoverflow.com/questions/37925155
复制相似问题