Jump to content

Recommended Posts

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

 

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×