当前位置:网站首页>Tlm/systemc: TLM socket binding problem
Tlm/systemc: TLM socket binding problem
2022-06-12 13:55:00 【123axj】
stay systemc Programming , If the program run The following two types of errors occur during the process , It means that there is port Not properly bound .
Error: (E126) sc_export instance already bound: xxxxxx
In file: xxxx/sysc/sysc/communication/sc_export.h:188 (systemc 2.3.3)
In file: xxxx/sysc/sysc/communication/sc_export.h:179 (systemc 2.3.1)
Error: (E120) sc_export instance has no interface: init.init_socket_export_0
In file: xxxxx/sysc/communication/sc_export.h:174 (systemc 2.3.3)
In file: xxxxx/sysc/communication/sc_export.h:166 (systemc 2.3.1)
see systemC spec, Find out port Binding does have some limitations ,16.1.1.2 The following sections describe .

meanwhile , stay 13.1 chapter P462 There are the following binding examples . In this example , because Initiator and Target Class tlm socket, so struct Parent_of_initiator When binding in ,initiator->init_socket.bind( init_socket ); Or you could write it as init_socket.bind(initiator->init_socket). but If Initiator Class defines simple socket, Must use the... In the above table bind The way .


Here is an example written by myself , And give the wrong way of writing
// execute:
// g++ -g -Wall -lsystemc -m64 -pthread main.cpp
// -L/$(your systemc path)/lib-linux64
// -I/$(your systemc path)/include -I/$(your systemc path)/src/tlm_utils -o sim
#include <systemc>
#include "tlm.h"
#include "tlm_utils/simple_initiator_socket.h"
#include "tlm_utils/simple_target_socket.h"
using namespace sc_core;
using namespace std;
//Initiator
class Initiator : public sc_core::sc_module {
public:
tlm_utils::simple_initiator_socket<Initiator> init_socket;
SC_HAS_PROCESS(Initiator);
explicit Initiator(sc_core::sc_module_name name);
~Initiator() override = default;
};
Initiator::Initiator(sc_core::sc_module_name name)
: sc_core::sc_module(name), init_socket("dummy_initiator_socket") {}
//Target
class Target : public sc_core::sc_module {
public:
tlm_utils::simple_target_socket<Target> targ_socket;
SC_HAS_PROCESS(Target);
explicit Target(sc_core::sc_module_name name);
~Target() override = default;
};
Target::Target(sc_core::sc_module_name name)
: sc_core::sc_module(name), targ_socket("dummy_target_socket") {}
// Parent of initiator
struct Parent_of_initiator: sc_module // Showing hierarchical socket binding
{
// here can't use simple socket, will lead to simulation error
// (E126) sc_export instance already bound:xxxxxxxxx
// tlm_utils::simple_initiator_socket<Initiator> init_socket; //error use
tlm::tlm_initiator_socket<32> init_socket;
Initiator* initiator;
SC_CTOR(Parent_of_initiator) : init_socket("init_socket") {
initiator = new Initiator("initiator");
// here MUST use simple init socket.bind(tlm init socket)
// if use tlm init socket.bind (simple init socket) may lead to simulation error
// Error: (E120) sc_export instance has no interface: xxxxxxx
// init_socket(initiator->init_socket); //error use
initiator->init_socket.bind( init_socket ); // Bind initiator socket to parent initiator socket
}
};
// Parent of target
struct Parent_of_target: sc_module
{
// here can't use simple socket, will lead to simulation error
// (E126) sc_export instance already bound:xxxxxxxxx
// tlm_utils::simple_target_socket<Initiator> targ_socket; //error use
tlm::tlm_target_socket<32> targ_socket;
Target* target;
SC_CTOR(Parent_of_target) : targ_socket("targ_socket") {
target = new Target("target");
// here MUST use tlm target socket.bind(simple target socket)
// if use simple target socket.bind (tlm target socket) may lead to simulation error
// Error: (E120) sc_export instance has no interface: xxxxxxx
// target->targ_socket(targ_socket); //error use
targ_socket.bind( target->targ_socket ); // Bind parent target socket to target socket
}
};
//main
int sc_main(int argc, char ** argv)
{
Parent_of_initiator *init;
Parent_of_target *targ;
init = new Parent_of_initiator("init");
targ = new Parent_of_target("targ");
init->init_socket.bind(targ->targ_socket); // Bind initiator socket to target socket at top level
std::cout<<"test pass"<<std::endl;
return 0;
}
边栏推荐
- Acwing: topology sequence
- Go language functions as parameters of functions
- FFmpeg 学习指南
- [advanced MySQL] query optimization principle and scheme (6)
- Single bus temperature sensor 18B20 data on cloud (Alibaba cloud)
- AVFoundation
- Go zero micro Service Practice Series (II. Service splitting)
- Data type conversion and conditional control statements
- Chapter IV expression
- 将字符串转为16进制字符串并显示出来
猜你喜欢

【SemiDrive源码分析】【X9芯片启动流程】25 - MailBox 核间通信机制介绍(代码分析篇)之 RPMSG-IPCC RTOS & QNX篇

618进入后半段,苹果占据高端市场,国产手机终于杀价竞争

拆改廣告機---業餘解壓

阿里云开发板HaaS510解析串口JSON数据并发送属性

Alibaba cloud development board haas510 responds to UART serial port instructions

Paw 高级使用指南

A method of quickly creating test window

什么是自动出价?它的优势是什么?

Create a small root heap and judge the node relationship (also.C\u str() substr(),atoi(),string. Use of find())

【mysql进阶】索引分类及索引优化方案(五)
随机推荐
one × Convolution kernel of 1
【视频课】android studio物联网APP设计制作全套教程--国庆期间全掌握
Xcode debugging OpenGLES
阿裏雲開發板HaaS510報送設備屬性
Player screen orientation scheme
Cdeforces 1638 C. inversion graph - simple thinking
Web3.0,「激发创造」的时代
[wustctf2020] selfie score query -1
My resume.
Cmake basic tutorial - 01 a-hello-cmake
Codeforces 1629 A. download more RAM - simple greed
Codeforces 1629 F2. Game on sum (hard version) - Yang Hui's triangle, violence, finding rules
Now you must know the pointer
Alicloud development board vscode development environment setup
Tree reconstruction (pre order + middle order or post order + middle order)
Alibaba cloud development board haas510 connects to the Internet of things platform -- Haas essay solicitation
Display logs in the database through loganalyzer
Scyther工具形式化分析Woo-Lam协议
一种快速创建测试窗口的方法
view的子视图的递归