Jump to content

Recommended Posts

Posted

Hi TLM experts,

 

I have few question.

I have a target with 2 target ports

- do I need to implement b_transport for each target port or

- just need to provide one implementation of b_transport

In later case how can I know on which port the b_transport is called ?

 

I also have two independent register bank, one for each target port. i.e. first register bank is accessible from first port and second one with second port.

 

- How I can ensure the first register bank is only accessible from first port,not from other ports ?

- If there is only one b_transport then how can I decide that on which port the b_transport is actually called and whcih  register bank I need to access

 

Thanks in advance

-

RahulJn

 

 

Posted

Have a look at the section on convenience sockets in the LRM. There are some sockets that are described as tagged (see table 59). If you use one of the tagged target sockets, then you can arrange that a socket ID is associated with each initiator, so you can tell them apart. See the example at the bottom of page 531 for instance.

 

If you have two independent register banks accessible from independent ports, why not write one target and make two instances of it?

 

If you do want a single class with two target ports, then it's up to you to decide what to do by checking the address when you receive the generic payload. Remember that TLM2 was intended for memory-mapped busses, so your two register banks would be (I assume) at different memory map locations.

 

regards

Alan

Posted

Hi Alain

Thanks for your answers.

What about my first question

I have a target with 2 target ports

- do I need to implement b_transport for each target port or

- just need to provide one implementation of b_transport

 

Thanks

Posted

You just need one b_transport, but you have access to the tag so you know which initiator called you.

Have a look at simple_target_socket_tagged and the example on page 531,

 

regards

Alan

Posted

Hi Philipp

Yes it is clear from the LRM but I am looking for some mechanism to use similar things in my model which is based on tlm_initiator_socket/tlm_traget_socket.

I need to know at run time on whcih port the b_transport is called.

Is it possible ?

 

Thanks

Posted

Yes it is clear from the LRM but I am looking for some mechanism to use similar things in my model which is based on tlm_initiator_socket/tlm_traget_socket.

I need to know at run time on whcih port the b_transport is called.

Is it possible ?

 

If you bind the same interface object (a "single" b_transport) to both target sockets, there is no predefined way to determine the port through which the interface has been called.

 

If you insist on using a plain tlm_target_socket instead of the tagged convenience sockets, you can build the tagging mechanism on your own by implementing a small helper that provides the forward interface (most notably b_transport), stores an ID internally and forwards the call including the ID to the module itself.  Not sure, why you would need to reinvent that, though.

 

/Philipp

  • 6 months later...
Posted

If you bind the same interface object (a "single" b_transport) to both target sockets, there is no predefined way to determine the port through which the interface has been called.

 

If you insist on using a plain tlm_target_socket insteahid of the tagged convenience sockets, you can build the tagging mechanism on your own by implementing a small helper that provides the forward interface (most notably b_transport), stores an ID internally and forwards the call including the ID to the module itself.  Not sure, why you would need to reinvent that, though.

 

/Philipp

 

Hi Philipp

I want to build my own tagging mechanism in existing models.

A pseudo code will be of great help here

 

Thanks

RahulJn

 

Thanks

RahulJn

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...