SystemC time

首先要区分SystemC 仿真时间 和 机器执行时间,机器执行时间 是我们CPU物理机跑程序所花费的物理时间,这个时间就是我们真是感受到的时间,1s,1min … ;而SystemC 仿真时间是SystemC程序执行过程中kernel调度的时间,SystemC仿真时间跟物理执行时间没有任何粒度上的对应关系,比如一个程序,在SystemC 仿真时间 从0ns到 100 ns过程中花费了CPU物理时间为10s;并不能推算出从100ns到200ns过程中也需要花费10s的物理时间。

对于1G Hz的silicon (硬件芯片),1s中就是执行了1G 个cycle;但如果是跑RTL code的Simulation,则跑1万个Cycle很有可能就需要花费CPU物理时间的1h,因为Simulation是串行执行。因为Simulation跑的太慢,所以一般会使用emulation platform来跑RTL code,用FPGA硬件设备来加速仿真过程。

SystemC是用纯软件来模拟硬件的实现,程序的仿真速度就跟我们的代码实现有很大的关系。一般可以用 cycle per S 来表述仿真速度,也就是物理执行时间的1S,SystemC 仿真时间推进了多少个cycle,如果我们SystemC程序配置的是1G Hz,则1个cycle就是1ns。

代码中可以用sc_core::sc_time_stamp()获取当前的仿真时间。

SC_ZERO_TIME是SystemC定义的一个时间宏,表示delta T,是SystemC Kernel调度的最小时间单位,对于程序员来讲,大部分情况下可以简单的理解为0T。注:如果涉及到SystemC调度顺序引发的问题,则可能需要考虑delta T的影响。

Class sc_time 是SystemC使用的时间类型,SystemC支持的时间单位 enum sc_time_unit {SC_FS = 0, SC_PS, SC_NS, SC_US, SC_MS, SC_SEC};

Simulation time is an integer quantity. Simulation time is initialized to zero at the start of simulation and increases monotonically during simulation. The physical significance of the integer value representing time within the kernel is determined by the simulation time resolution. Simulation time and time intervals are represented by class sc_time. Certain functions allow time to be expressed as a value pair having the signature <double,sc_time_unit>

仿真时间为整数。仿真时间在仿真开始时初始化为零,在仿真过程中单调增加。表示核内时间的整数值的物理意义是由模拟时间分辨率决定的。模拟时间和时间间隔由类sc_time表示。某些函数允许将time表示为< double sc_time_unit>的值。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

123axj

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值