Jump to content
sheridp@umich.edu

multi_passthrough_target_socket requires transport registeration

Recommended Posts

I ran into an issue using multi_passthrough_target_sockets:  It is required that register at least one transport method (b_transport or nb_transport_fw) or you'll get the following error:
 

Quote

Error: (E109) complete binding failed: export not bound: export 'container.multi_passthrough_target_socket_0' (tlm_target_socket)  (SystemC 2.3.3) or

Error: (E124) sc_export instance not bound to interface at end of construction: export 'container.multi_passthrough_target_socket_0' (tlm_target_socket) (SystemC 2.3.1a)

This is in contrast to the spec section 16.1.4.4, section l:

Quote

In the absence of hierarchical binding to a multi-socket on a child module, a target should register b_transport and nb_transport_fw callbacks with a target multi-socket. Not doing so will result in a run-time error if and only if the corresponding method is called.

It's not really a big problem (why would you ever not register at least one?), but it is something I ran into during development, as I was checking my hierarchical binding structure, but had not yet created my transport methods.

The error message is particularly confusing, because the target_socket is bound, and the runtime error is thrown after elaboration, an not when the corresponding method is called.

The following code will reproduce the error:

#include <systemc.h>
#include <tlm.h>
#include <tlm_utils/multi_passthrough_target_socket.h>
#include <tlm_utils/multi_passthrough_initiator_socket.h>


class Container : sc_module {

public:
	tlm_utils::multi_passthrough_target_socket<Container, 1, tlm::tlm_base_protocol_types, 0, SC_ZERO_OR_MORE_BOUND> target_socket;
	tlm_utils::multi_passthrough_initiator_socket<Container, 1, tlm::tlm_base_protocol_types, 0, SC_ZERO_OR_MORE_BOUND> initiator_socket;

	Container(sc_module_name name) {
		initiator_socket.bind(target_socket);

		//If both lines are  line is commented, an error is generated
		// target_socket.register_b_transport(this, &Container::b_transport);
		// target_socket.register_nb_transport_fw(   this, &Container::nb_transport_fw);
	}

	void b_transport( int id, tlm::tlm_generic_payload& trans, sc_time& delay ) {
	}

	tlm::tlm_sync_enum nb_transport_fw(int id, tlm::tlm_generic_payload& trans, tlm::tlm_phase& phase, sc_time& delay){
	}
};

int sc_main(int argc, char *argv[]) {
	Container c("container");
	sc_start();
	return 0;
}

 

Share this post


Link to post
Share on other sites

Actually your code, its behavior and the spec is in sync. You do not have hierarchical binding as you bind an initiator to a target socket. Therfore you need to register at least one of the callbacks so that the interface get bound to the target socket.

Best regards

Share this post


Link to post
Share on other sites

Eyck,

Not to quibble, but I disagree with that interpretation.  You're right I don't have hierarchical binding, and by the first sentence, I should register a transport method.  However, the second sentence says that if I don't register one, a runtime error will be generated if and only if the corresponding method is called, which in my code, it isn't. 

I think this becomes even more problematic if I had configured the socket to be SC_ZERO_OR_MORE_BOUND, in which case it's even more likely that I might not register a transport method if I intend not to connect the socket.

I can definitely understand that perhaps my interpretation relies too heavily on the second sentence, but I'd say the spec could probably be made more clear in that regard.  Let me know your thoughts. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...