Jump to content

tagged sockets


Recommended Posts

I suppose so - though since a simple target socket is not a multi-socket, it would not tag transactions. But you could route incoming transactions on the simple target socket to a particular interface of the tagged initiator socket based on address, and then use the tag to reconstruct the address on the backward path.

Alan

Link to comment
Share on other sites

hello,

isocket is a tlm_initiator socket of an interconnect component.

tsocket is a simple_target_socket_tagged of a target compoment

initiator->isocket.bind( target->tsocket );

=>

error C2664: 'void tlm::tlm_base_initiator_socket<BUSWIDTH,FW_IF,BW_IF,N,POL>::bind(tlm::tlm_base_target_socket_b<32,FW_IF,BW_IF> &)' : cannot convert parameter 1 from 'tlm_utils::simple_target_socket_tagged<MODULE> *' to 'tlm::tlm_base_target_socket_b<BUSWIDTH,FW_IF,BW_IF> &'

According to Table 60 of the "1666-2011"-reference manual, i can bind a tlm_initiator_socket to a simple_target_socket_tagged. right?

How does it work?

Thank you (Alan)

Link to comment
Share on other sites

actually i have an array of tagged sockets on the target component and another on the 2. interconnect component

i am doing following bindings:

interconnect1->isocket.bind( target->tsocket[0] );

interconnect2->isocket[0].bind(target->tsocket[1]);

this is the complete error for the 1st one

'void tlm::tlm_base_initiator_socket<BUSWIDTH,FW_IF,BW_IF,N,POL>::bind(tlm::tlm_base_target_socket_b<32,FW_IF,BW_IF> &)' : cannot convert parameter 1 from 'tlm_utils::simple_target_socket_tagged<MODULE> *' to 'tlm::tlm_base_target_socket_b<BUSWIDTH,FW_IF,BW_IF> &'

1> with

1> [

1> BUSWIDTH=32,

1> FW_IF=tlm::tlm_fw_transport_if<tlm::tlm_base_protocol_types>,

1> BW_IF=tlm::tlm_bw_transport_if<>,

1> N=1,

1> POL=SC_ONE_OR_MORE_BOUND

1> ]

1> and

1> [

1> MODULE=target

1> ]

1> and

1> [

1> BUSWIDTH=32,

1> FW_IF=tlm::tlm_fw_transport_if<tlm::tlm_base_protocol_types>,

1> BW_IF=tlm::tlm_bw_transport_if<>

1> ]

Link to comment
Share on other sites

  • 2 months later...

Hi there,

i would like declare an array of tagged target socket in the header file of my interconnect component.

The size of the array will then be determine in constructor (.cpp file) using the initial values of one of the member variables.

I tried it with the std::vector<>

file.h

std::vector<tlm_utils::simple_target_socket_tagged<interconnect1>> sockets_array

file.cpp - class constructor

sockets_array.resize(number);

It doesn't work.

Why?

Link to comment
Share on other sites

Hello,

what is the meaning of these errors please?

error C2248: 'sc_core::sc_module::operator =' : cannot access private member declared in class 'sc_core::sc_module'
error C2248: 'sc_core::sc_module::operator =' : cannot access private member declared in class 'sc_core::sc_module_name'
error C2248: 'tlm::tlm_generic_payload::operator =' : cannot access private member declared in class 'tlm::tlm_generic_payload'

thank you

Link to comment
Share on other sites

The errors are saying that you are attempting to copy or assign an sc_module. Copying and assignment of sc_modules is disabled by making the copy constructor and operator= private.

This can happen if you declare std::vector<sc_module> for instance, as std::vector using copying and assignment internally.

In SystemC you can use the sc_vector class instead to manage arrays of modules, ports, and so on,

regards

Alan

Link to comment
Share on other sites

Hi Alan,

i have a component "interconnect1" which can have more than one sockets. The exact number of sockets is given every time an object of this component is instantiated. So i wrote following code in the header file for the socket:

std::vector<tlm_utils::simple_target_socket_tagged<interconnect1>> sockets_array;

In the implementation file (.cpp) the constructor looks like this:

interconnect1::interconnect1( sc_module_name name, const unsigned int number )
:
nr(number)
{
socket_array.resize(nr);
for (int i=0; i<nr; i++)
{
 socket_array[i].register_b_transport  ( this, &interconnect1::b_transport   , i);
 socket_array[i].register_get_direct_mem_ptr( this, &interconnect1::get_direct_mem_ptr , i);
 socket_array[i].register_nb_transport_fw ( this, &interconnect1::nb_transport_fw  , i);
 socket_array[i].register_transport_dbg  ( this, &interconnect1::transport_dbg  , i);
}
}

i get the following build errors:

ClCompile:
1>  interconnect1.cpp
1>  Unknown compiler version - please run the configure tests and report the results
1>c:\users\...\desktop\systemc-2.3.0\src	lm_utils\simple_target_socket.h(1126): error C2248: 'sc_core::sc_event::operator =' : cannot access private member declared in class 'sc_core::sc_event'
1>		  c:\users\...\desktop\systemc-2.3.0\src\sysc\kernel\sc_event.h(331) : see declaration of 'sc_core::sc_event::operator ='
1>		  c:\users\...\desktop\systemc-2.3.0\src\sysc\kernel\sc_event.h(250) : see declaration of 'sc_core::sc_event'
1>		  This diagnostic occurred in the compiler generated function 'tlm_utils::simple_target_socket_tagged<MODULE> &tlm_utils::simple_target_socket_tagged<MODULE>::operator =(const tlm_utils::simple_target_socket_tagged<MODULE> &)'
1>		  with
1>		  [
1>			  MODULE=interconnect1
1>		  ]

What am i doing wrong? Or is it possible to define vector of sockets?

Arrays works just fine, but the number of socket is variable.

thx for the help

Link to comment
Share on other sites

Hi Tanja,

yes the std::vector is trying to assign and copy sockets, which then is causing it to attempt and assign an an sc_event.

To avoid that, you could create an array of pointers to sockets e.g.

std::vector<tlm_utils::simple_target_socket_tagged<interconnect1>* >  sockets_array;

and then dynamically allocate the sockets and bind them, e.g.

interconnect1::interconnect1( sc_module_name name, const unsigned int number )
:
nr(number)
{
socket_array.resize(nr);
for (int i=0; i<nr; i++)
{
 socket_array[i] = new tlm_utils::simple_target_socket_tagged<interconnect1>;
 *(socket_array[i]).register_b_transport  ( this, &interconnect1::b_transport   , i);

 // etc
}
}

and then preferably implement a destructor.

Does that make sense?

If you're using SystemC 2.3.0, the sc_vector should provide a better solution,

regards

Alan

Link to comment
Share on other sites

There's a paper about sc_vector written by Philipp Hartmann who was the original author. You can download it here:

http://complex.offis.de/documents/doc_download/29-scvector-container-and-the-ieee-p1666-2011-systemc-standard

Also of course have a look at the 1666-2011 standard, in particular pages 404 and 405.

You should just be able to do something like

struct Mod: sc_module
{
sc_vector<  tlm_utils::simple_target_socket_tagged<interconnect1> > vec;
Mod(sc_module_name n)
: vec("vec", 4)  //  4 is the size
{ 

You can also defer the creation by calling the init() of sc_vector in the constructor,

regards

Alan

Link to comment
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...