简体   繁体   English

sc_port 和 sc_export 之间的区别

[英]Difference between sc_port and sc_export

Can someone clearly and intuitively explain what is the difference between an sc_port and an sc_export in SystemC?有人可以清楚直观地解释 SystemC 中的sc_portsc_export有什么区别吗? When does one use a port, and when an export?什么时候使用端口,什么时候使用出口?

I've been reading portions of the manual but I still fail to grasp the main conceptual difference between the two.我一直在阅读手册的部分内容,但我仍然无法掌握两者之间的主要概念差异。

From IEEE Standard for Standard SystemC ® Language Reference Manual来自IEEE Standard for Standard SystemC® 语言参考手册

Class sc_export allows a module to provide an interface to its parent module. Class sc_export 允许模块为其父模块提供接口。 An export forwards interface method calls to the channel to which the export is bound.导出将接口方法调用转发到导出所绑定的通道。 An export defines a set of services (as identified by the type of the export) that are provided by the module containing the export.导出定义了由包含导出的模块提供的一组服务(由导出类型标识)。

Providing an interface through an export is an alternative to a module simply implementing the interface.通过导出提供接口是简单实现接口的模块的替代方案。 The use of an explicit export allows a single module instance to provide multiple interfaces in a structured manner.显式导出的使用允许单个模块实例以结构化方式提供多个接口。

If a module is to call a member function belonging to a channel instance within a child module, that call should be made through an export of the child module.如果模块要调用属于子模块内通道实例的成员 function,则应通过子模块的导出进行该调用。

The upshot of all this being that without sc_export one would need to create an sc_port in the parent module and connect it to the port of the child module in order to expose a child's port as a port of the parent module.所有这一切的结果是,如果没有 sc_export,则需要在父模块中创建一个 sc_port 并将其连接到子模块的端口,以便将子模块的端口公开为父模块的端口。 Using sc_export allows one to directly expose a child port as port of the parent module.使用 sc_export 可以直接将子端口公开为父模块的端口。 Simply create an instance of sc_export and bind it to a child port.只需创建一个 sc_export 实例并将其绑定到子端口。

For a full description and class specification see section 5.13 of IEEE Standard for Standard SystemC ® Language Reference Manual有关完整说明和 class 规范,请参阅IEEE Standard for Standard SystemC® 语言参考手册的第 5.13

ps If you do not intend to convert your code to VHDL then there is no need to use sc_export . ps 如果您不打算将代码转换为 VHDL,则无需使用sc_export SystemC is just standard C++ and ports are just normal public members (you could have a private port but there hardly seems much point) so you can just take a reference to it and pretend that it's a member of its parent module or any other module that has access to it for that matter. SystemC 只是标准的 C++ 并且端口只是普通的公共成员(你可以有一个private端口,但似乎没什么意义)所以你可以引用它并假装它是其父模块或任何其他模块的成员可以访问它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM