73class fss_binder_base :
public sc_core::sc_object,
public fss_binder_if<IF>
76 fss_binder_base(fssString obj_name, fssString if_name, fssBindIFHandle bind_handle)
77 : sc_core::sc_object(obj_name), m_if_name(if_name), m_bind_handle(bind_handle)
80 die_null_ptr(
"fss_binder_base",
"bind_handle");
83 die_null_ptr(
"fss_binder_base",
"if_name");
85 GET_IF_FN_PTR<IF> get_if;
86 if constexpr (std::is_same_v<IF, fssEventsIf>) {
87 get_if = bind_handle->getEventsIfHandle;
88 }
else if constexpr (std::is_same_v<IF, fssTimeSyncIf>) {
89 get_if = bind_handle->getTimeSyncIfHandle;
90 }
else if constexpr (std::is_same_v<IF, fssControlIf>) {
91 get_if = bind_handle->getControlIfHandle;
93 get_if = bind_handle->getBusIfHandle;
96 die_null_ptr(
"fss_binder_base",
"get_if");
98 m_if_handle = get_if(bind_handle, if_name);
100 die_null_ptr(
"fss_binder_base",
"m_if_handle");
104 fss_binder_base(fssString obj_name, fssString _if_name, IF* if_handle)
105 : sc_core::sc_object(obj_name), m_if_name(_if_name), m_if_handle(if_handle)
108 die_null_ptr(
"fss_binder_base",
"if_handle");
111 die_null_ptr(
"fss_binder_base",
"_if_name");
113 m_bind_handle =
nullptr;
116 IF* get_if_handle()
const override {
return m_if_handle; }
118 fssString get_if_name()
const override {
return m_if_name; }
120 virtual ~fss_binder_base() {}
123 void bind_if(fssString if_name, IF* if_handle)
override
126 die_null_ptr(
"bind_if",
"if_name");
129 die_null_ptr(
"bind_if",
"if_handle");
131 other_if_name = if_name;
132 other_if_handle = if_handle;
134 BIND_IF_FN_PTR<IF> bind_if_if;
135 if constexpr (std::is_same_v<IF, fssEventsIf>) {
136 bind_if_if = m_bind_handle->bindEventsIf;
137 }
else if constexpr (std::is_same_v<IF, fssTimeSyncIf>) {
138 bind_if_if = m_bind_handle->bindTimeSyncIf;
139 }
else if constexpr (std::is_same_v<IF, fssControlIf>) {
140 bind_if_if = m_bind_handle->bindControlIf;
142 bind_if_if = m_bind_handle->bindBusIf;
145 die_null_ptr(
"bind_if",
"bind_if_if");
147 bind_if_if(m_bind_handle, if_name, if_handle);
153 fssBindIFHandle m_bind_handle;
156 fssString other_if_name;
159class fss_events_binder :
public fss_binder_base<fssEventsIf>
162 fss_events_binder(fssString obj_name, fssString events_if_name, fssBindIFHandle bind_handle)
163 : fss_binder_base<fssEventsIf>(obj_name, events_if_name, bind_handle)
167 fss_events_binder(fssString obj_name, fssString events_if_name, fssEventsIfHandle events_if_handle)
168 : fss_binder_base<fssEventsIf>(obj_name, events_if_name, events_if_handle)
172 void notify(fssUint64 event)
174 if (!other_if_handle) {
175 die_null_ptr(
"bind_if",
"other_if_handle");
177 if (!other_if_handle->handleEvents) {
178 die_null_ptr(
"bind_if",
"other_if_handle->handleEvents");
180 other_if_handle->handleEvents(other_if_handle, event);
183 virtual ~fss_events_binder() {}
186class fss_time_sync_binder :
public fss_binder_base<fssTimeSyncIf>
189 fss_time_sync_binder(fssString obj_name, fssString time_sync_if_name, fssBindIFHandle bind_handle)
190 : fss_binder_base<fssTimeSyncIf>(obj_name, time_sync_if_name, bind_handle)
194 fss_time_sync_binder(fssString obj_name, fssString time_sync_if_name, fssTimeSyncIfHandle time_sync_if_handle)
195 : fss_binder_base<fssTimeSyncIf>(obj_name, time_sync_if_name, time_sync_if_handle)
201 if (!other_if_handle) {
202 die_null_ptr(
"update_time",
"other_if_handle");
204 if (!other_if_handle->updateTimeWindow) {
205 die_null_ptr(
"update_time",
"other_if_handle->updateTimeWindow");
207 other_if_handle->updateTimeWindow(other_if_handle, window);
210 virtual ~fss_time_sync_binder() {}
213class fss_data_binder :
public fss_binder_base<fssBusIf>
216 fss_data_binder(fssString obj_name, fssString data_if_name, fssBindIFHandle bind_handle)
217 : fss_binder_base<fssBusIf>(obj_name, data_if_name, bind_handle)
221 fss_data_binder(fssString obj_name, fssString data_if_name, fssBusIfHandle data_if_handle)
222 : fss_binder_base<fssBusIf>(obj_name, data_if_name, data_if_handle)
226 fssBusIfItemSize get_number()
228 if (!other_if_handle) {
229 die_null_ptr(
"get_number",
"other_if_handle");
231 if (!other_if_handle->getNumber) {
232 die_null_ptr(
"get_number",
"other_if_handle->getNumber");
234 return other_if_handle->getNumber(other_if_handle);
236 fssString get_name(fssBusIfItemIndex _index)
238 if (!other_if_handle) {
239 die_null_ptr(
"get_name",
"other_if_handle");
241 if (!other_if_handle->getName) {
242 die_null_ptr(
"get_name",
"other_if_handle->getName");
244 return other_if_handle->getName(other_if_handle, _index);
246 fssBusIfItemSize get_size(fssBusIfItemIndex _index)
248 if (!other_if_handle) {
249 die_null_ptr(
"get_size",
"other_if_handle");
251 if (!other_if_handle->getSize) {
252 die_null_ptr(
"get_size",
"other_if_handle->getSize");
254 return other_if_handle->getSize(other_if_handle, _index);
256 fssBusIfItemSize get_index(fssString _name)
258 if (!other_if_handle) {
259 die_null_ptr(
"get_index",
"other_if_handle");
261 if (!other_if_handle->getIndex) {
262 die_null_ptr(
"get_index",
"other_if_handle->getIndex");
264 return other_if_handle->getIndex(other_if_handle, _name);
266 fssBusIfItemIndex add_item(fssString _name, fssBusIfItemSize _size)
268 if (!other_if_handle) {
269 die_null_ptr(
"add_item",
"other_if_handle");
271 if (!other_if_handle->addItem) {
272 die_null_ptr(
"add_item",
"other_if_handle->addItem");
274 return other_if_handle->addItem(other_if_handle, _name, _size);
276 fssBusIfItemData get_item(fssBusIfItemIndex _index)
278 if (!other_if_handle) {
279 die_null_ptr(
"get_item",
"other_if_handle");
281 if (!other_if_handle->getItem) {
282 die_null_ptr(
"get_item",
"other_if_handle->getItem");
284 return other_if_handle->getItem(other_if_handle, _index);
286 void set_item(fssBusIfItemIndex _index, fssBusIfItemData _data)
288 if (!other_if_handle) {
289 die_null_ptr(
"set_item",
"other_if_handle");
291 if (!other_if_handle->setItem) {
292 die_null_ptr(
"set_item",
"other_if_handle->setItem");
294 other_if_handle->setItem(other_if_handle, _index, _data);
299 if (!other_if_handle) {
300 die_null_ptr(
"transmit",
"other_if_handle");
302 if (!other_if_handle->transmit) {
303 die_null_ptr(
"transmit",
"other_if_handle->transmit");
305 other_if_handle->transmit(other_if_handle);
308 virtual ~fss_data_binder() {}
311class fss_control_binder :
public fss_binder_base<fssControlIf>
314 fss_control_binder(fssString obj_name, fssString control_if_name, fssBindIFHandle bind_handle)
315 : fss_binder_base<fssControlIf>(obj_name, control_if_name, bind_handle)
319 fss_control_binder(fssString obj_name, fssString control_if_name, fssControlIfHanlde control_if_handle)
320 : fss_binder_base<fssControlIf>(obj_name, control_if_name, control_if_handle)
324 fssString do_command(fssString cmd)
326 if (!other_if_handle) {
327 die_null_ptr(
"do_command",
"other_if_handle");
329 if (!other_if_handle->doCommand) {
330 die_null_ptr(
"do_command",
"other_if_handle->doCommand");
332 return other_if_handle->doCommand(other_if_handle, cmd);
335 virtual ~fss_control_binder() {}