当前位置:网站首页>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;
}
边栏推荐
- Démontage et modification de la machine publicitaire - décompression amateur
- After reading the question, you will point to offer 16 Integer power of numeric value
- Leetcode questions brushing February /1020 Number of enclaves
- Factory mode of "object creation" mode
- M1 pod install pod lint failure solution
- 【视频课】android studio物联网APP设计制作全套教程--国庆期间全掌握
- 将字符串转为16进制字符串并显示出来
- AVFoundation
- Programmer interview golden classic good question / interview question 01.05 Edit once
- Introduction to color coding format
猜你喜欢

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

阿里云开发板vscode开发环境搭建

一种快速创建测试窗口的方法

阿里云开发板HaaS510响应UART串口指令

Web3.0, the era of "stimulating creativity"

数据类型转换和条件控制语句

正点原子STM32F429核心板的插座型号

CSDN blog points rule

Codeforces 1629 F2. Game on sum (hard version) - Yang Hui's triangle, violence, finding rules

动态搜索广告智能查找匹配关键字
随机推荐
Real time software source code of COVID-19
My resume.
阿里云开发板HaaS510解析串口JSON数据并发送属性
Language skills used in development
Debug code to quickly locate the error location
Code debugging - print log output to file
Codeforces 1637 F. Towers - thinking, DFS
A method of quickly creating test window
【mysql进阶】mysql索引数据结构的演变(四)
拆改广告机---业余解压
【SemiDrive源码分析】【X9芯片启动流程】25 - MailBox 核间通信机制介绍(代码分析篇)之 RPMSG-IPCC RTOS & QNX篇
事件的传递和响应以及使用实例
[video lesson] a full set of tutorials on the design and production of Android studio Internet of things app -- all mastered during the National Day
Bridging and net
Alibaba cloud development board haas510 parses serial port JSON data and sends attributes
对于跨境电商,更侧重收入的出价策略 —Google SEM
Cmake basic tutorial - 02 b-hello-cmake
618进入后半段,苹果占据高端市场,国产手机终于杀价竞争
Encryptor and client authenticate with each other
NotePad 常用设置