32 : sc_core::sc_module(
nm)
33 , m_broker(cci::cci_get_broker())
34 , p_node_exe_path(
"node_exe_path",
"",
"path of the node binary executable or .so")
35 , p_node_name(
"node_name",
"",
"unique name of the spawned node")
36 , events_binder(
"events_binder")
37 , time_sync_binder(
"time_sync_binder")
38 , data_binder(
"data_binder")
39 , control_binder(
"control_binder")
41 SCP_TRACE(()) <<
"component_constructor constructor";
42 if (p_node_exe_path.get_value().empty()) {
43 SCP_FATAL(()) <<
"node_exe_path CCI parameter is not set!";
45 if (p_node_name.get_value().empty()) {
46 SCP_FATAL(()) <<
"node_name CCI parameter is not set!";
48 m_config_handle.version = (1ULL << 32);
49 m_config_handle.getConfigs = &component_constructor::get_configs;
62 return cmp->get_node_config(name);
70 m_node_handle = CreateNode(p_node_name.get_value().c_str(), &m_config_handle);
72 SCP_FATAL(()) <<
"Couldn't create node: " << p_node_name.get_value();
78 for (
const auto&
param : m_broker.get_unconsumed_preset_values()) {
83 events_binder.emplace_back(
curr_param_val.c_str(), get_node_bind_handle());
84 }
else if (
curr_param_name.find(time_sync_binder.name()) != std::string::npos) {
85 time_sync_binder.emplace_back(
curr_param_val.c_str(), get_node_bind_handle());
86 }
else if (
curr_param_name.find(data_binder.name()) != std::string::npos) {
87 data_binder.emplace_back(
curr_param_val.c_str(), get_node_bind_handle());
88 }
else if (
curr_param_name.find(control_binder.name()) != std::string::npos) {
89 control_binder.emplace_back(
curr_param_val.c_str(), get_node_bind_handle());
97 const char* get_node_config(
const std::string&
_name)
101 for (
const auto&
param : m_broker.get_unconsumed_preset_values()) {
104 auto value =
param.second.to_json();
108 m_broker.ignore_unconsumed_preset_values(
109 [
param_name](
const std::pair<std::string, cci::cci_value>&
iv) ->
bool {
117 SCP_FATAL(()) <<
"Requested configuration: " <<
_name <<
" was not found!";
122 template <
typename T>
129 SCP_FATAL(()) <<
"Failed to load: " << p_node_exe_path.get_value() <<
" Error: " <<
dlerror();
134 <<
"is not found in the library: " << p_node_exe_path.get_value().c_str();
139 void end_of_simulation() { DestroyNode(m_node_handle); }
142 cci::cci_broker_handle m_broker;
143 cci::cci_param<std::string> p_node_exe_path;
144 cci::cci_param<std::string> p_node_name;
148 CreateNodeFnPtr CreateNode;
149 DestroyNodeFnPtr DestroyNode;
152 sc_core::sc_vector<fss_events_binder> events_binder;
153 sc_core::sc_vector<fss_time_sync_binder> time_sync_binder;
154 sc_core::sc_vector<fss_data_binder> data_binder;
155 sc_core::sc_vector<fss_control_binder> control_binder;