在仿真过程中,尤其是较大规模的芯片的后仿过程中,内存占用很大,仿真过程非常缓慢。运用save/store进行仿真状态的保存有更大意义。但还是想记录一下仿真过程和进度。
我使用的方法是,在验证环境中,调用Linux命令打印时间。
大致代码如下:
task base_test::run_phase(uvm_phase phase);
$system($sformatf("hostname > %s", logfile)); //打印主机名到logfile中
$system($sformatf("lscpu >> %s", logfile)); //追加打印CPU信息到logfile中
$system($sformatf("cat /proc/meminfo >> %s", logfile)); //追加打印内存信息到logfile中
$system($sformatf("date >> %s", logfile)); //追加打印当前时间到logfile中
$system($sformatf("uptime >> %s", logfile)); //追加打印负载情况到logfile中
forever begin:heartbeat_log
repeat(delay_ns) #1ns;
//每过delay_ns追加打印负载情况到logfile中
$system($sformatf("echo -n '%0t' >> %s, uptime >> %s", $realtime, logfile, logfile));
end
endtask
后续更倾向于ucli结合脚本来实现,大家可以给出更多建议,目标是更精细地查看仿真过程中时间消耗的详细过程。