|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
class Transaction;
bit[31:0] addr,crc,data[8];
Statistics stats;//4
static int count=0;
int id;
function new;
stats=new();//8
id=count++;
endfunction
function Transaction copy;
copy=new();
copy.addr=addr;
copy.crc=crc;
copy.data=data;
copy.stats=stats.copy();
id=count++;
endfunction
endclass
class Statistics;
time startT,stopT;
static int ntrans=0;
static time total_elapsed_time=0;
function time how_long;
how_long=stopT-startT;
ntrans++;
total_elapsed_time+=how_long;
endfunction
function void start;
startT=$time;
endfunction
function Statistics copy();
copy=new();
copy.startT=startT;
copy.stopT=stopT;
endfunction
endclass
** Error: H:/systemverilog/work/q.sv(4): Invalid type 'Statistics'. Please check the type of the variable 'stats'.
** Error: H:/systemverilog/work/q.sv(8): (vlog-2730) Undefined variable: 'stats
class不是相当于module吗,不能包含其它类吗?这问题该怎么解决 |
|