SystemC的运行阶段

Spec中给出了SystemC程序的执行过程(在terminal下执行 编译出来的可执行文件):

a) Elaboration—Construction of the module hierarchy

b) Elaboration—Callbacks to function before_end_of_elaboration

c) Elaboration—Callbacks to function end_of_elaboration

d) Simulation—Callbacks to function start_of_simulation

e) Simulation—Initialization phase

f) Simulation—Evaluation, update, delta notification, and timed notification phases (repeated)

g) Simulation—Callbacks to function end_of_simulation

h) Simulation—Destruction of the module hierarchy

个人的理解如下:

  1. Elaboration—Construction of the module hierarchy,例化 系统的 Top Module,也就是 按照层次结构 调用 class的构造函数。此过程是非常重要的一个过程,构造函数中用SC_THREAD / SC_METHOD 标记的函数将会被 注册到SystemC Kernel中,port 绑定一般也在构造函数中完成。
  2. Elaboration—Callbacks to function before_end_of_elaboration,调用所有sc_module 实例的 before_end_of_elabration(),基类sc_module中的此函数为空,不用care。
  3. end_of_elaboration 和before_end_of_elaboration的区别暂时也没搞清楚。Spec中对两者都有分别的介绍, systemc: sc_event和sc_event_finder 中介绍了一个需要使用这两个函数的场景。end_of_elaboration 中不能调用 event的notify函数,不能调用kill, reset, or throw_it of class sc_process_handle。
  4. start_of_simulation 一般很少使用。
  5. Simulation—Initialization phase,调用一次所有的 ( SC_METHOD关联函数 & 此函数后没有加 dont_initialize() ) SC_THREAD关联函数此阶段不被执行
  6. Simulation—Evaluation, update, delta notification, and timed notification phases (repeated) 这个阶段才是真正的 SC_METHOD/SC_THREAD关联函数(在spec中统称为 processes) 开始执行的阶段,SystemC仿真时间在此阶段从0开始往前推进,SystemC Kernel开始在各个processes间进行调度执行。
  7. end_of_simulation。此函数跟before_end_of_elaboration 类似,也是在基类sc_module中定义的。对于此阶段,spec中有如下解释:If no pending timed notifications or time-outs exist, the end of simulation has been reached. So, exit the scheduler. Applications are recommended to call function sc_stop before returning control from sc_main to ensure that the end_of_simulation callbacks are called。所以,如果程序中没有显式的调用sc_stop,则所有sc_module 实例中的end_of_simulation函数不会被调用。此函数的一般用法是,做一些performance counter的统计结果输出,但其实也可以在模块的析构函数中写;故一般不建议使用此函数。
  8. Destruction of the module hierarchy

The purpose of member function before_end_of_elaboration is to allow an application to perform actions during elaboration that depend on the global properties of the module hierarchy and that also need to modify the module hierarchy. Examples include the instantiation of top-level modules to monitor events buried within the hierarchy.

operator-> and operator[] of class sc_port should not be called from the function before_end_of_elaboration because the implementation may not have completed port binding at the time of this callback and, hence, these operators may return null pointers. The member function size may return a value less than its final value.

The purpose of member function end_of_elaboration is to allow an application to perform housekeeping actions at the end of elaboration that do not need to modify the module hierarchy. Examples include design rule checking, actions that depend on the number of times a port is bound, and printing diagnostic messages concerning the module hierarchy.

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
SystemC是一种用于硬件和软件系统建模与验证的开发工具。它基于C++语言开发,并提供了一套库函数和类库,用于建立系统级别的模型,包括通信协议、数字信号处理、嵌入式系统等。 相较于其他编程语言,SystemC因其特定于硬件设计的特性而备受关注。它能够提供比较精确的硬件行为模型,因此在硬件验证和调试方面具有较高的效率和准确性。此外,SystemC还支持多线程的并发控制,能够模拟硬件设计中的并行性,更好地满足系统级模型的需求。 对于初学者来说,SystemC的学习曲线可能较陡,因为其需要掌握C++语言和系统级建模的理念。然而,一旦掌握了其基本原理,SystemC能够大大提高硬件系统的设计效率和可靠性。 现在,有许多关于SystemC的电子书可供读者学习和参考。这些电子书涵盖了SystemC的基础知识与应用技巧,可以帮助读者快速掌握SystemC的核心概念和使用方法。同时,这些电子书还提供了丰富的案例和实例,方便读者进行实际的练习和实验。有些电子书还会提供一些SystemC的高级主题,如高层次综合、虚拟原型设计等,帮助读者在实际工程中应用SystemC进行系统级建模与验证。 总之,SystemC电子书为读者提供了学习和实践SystemC的机会,帮助他们掌握这一强大的硬件系统建模与验证工具。读者可以通过电子书来学习SystemC的基础知识,并通过实例和案例来深入理解其应用。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

123axj

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

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

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

打赏作者

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

抵扣说明:

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

余额充值