0
我想比较SystemC中的仿真时间。我想在我的while循环开始时获取当前的仿真时间,并且一旦仿真时间达到了特定的数字,我希望它离开循环。以下是我正在考虑的尝试,但由于语法问题,它不起作用。SystemC时间比较
sc_time currentTime;
int imageDur; //This value is variable; Resolution is seconds
currentTime = sc_time_stamp(); //Get current simulation time
while(sc_time_stamp() - currentTime < imageDur){
//Do stuff
}
这样做的问题是,imageDur是int类型,我不能执行sc_time到int比较。所以我的下一个想法是通过以下方式将imageDur转换为sc_time:
sc_time scImageDur;
scImageDur(imageDur,SC_SEC);
但是,这在语法上也不正确。
一种卡住如何去做这件事。另外,在进行减法比较时,sc_time_stamp()
的分辨率是否重要?或者系统本身执行该决议?