Jump to content

Recommended Posts

Hello,

 

I've scoured the internet and this forum for what I imagine will have a very simple solution.  Apparently I am not describing it sufficiently.

 

I have a SystemC model comprised of a handful of registers, and single memory bank.  I would like to implement TWO blocking transport interfaces to this model.

 

If I implement a single blocking transport ( via inheritance of b_transport ), the method has access to all the model resources.

 

If I want two b_transport interfaces, I've had to move them to channels, which are then instantiated in the model.  These channels do not have access to the model resources of course, because they are declared seperately from the model.  They communicate transactions to the model via an event (or using a fifo).  Therefore, the blocking transport will issue a wait(sc_zero_time) for the transaction to reach the model and perform some action. *Perhaps this solution is already what I should be doing.

 

However, I like the idea of a blocking transport actually setting the value and returning (with no wait statements); but, I cannot do this because I need TWO of these methods.

 

Brian

 

 

Share this post


Link to post
Share on other sites

I'm assuming, it is ok for you to have different sockets for these two b_transport functions.  The simplest solution is to use two tlm_utils::simple_target_socket instances and just register different functions for each of those:

SC_MODULE(target)
{
  tlm_utils::simple_target_socket<target> socket1;
  tlm_utils::simple_target_socket<target> socket2;

  SC_CTOR(target)
    : socket1("socket1")
    , socket2("socket2")
  {
    socket1.register_b_transport(this, &target::first_b_transport);
    socket2.register_b_transport(this, &target::second_b_transport);
  }

  void first_b_transport( tlm::tlm_generic_payload &, sc_core::sc_time & );
  void second_b_transport( tlm::tlm_generic_payload &, sc_core::sc_time & );
};

Alternatively, you can use tagged sockets and dispatch to different implementations based on the ID parameter.

 

hth,
  Philipp

Share this post


Link to post
Share on other sites

Philipp,

 

This looks exactly like what I am looking for.  I have only been doing SC a little over a year, and have only used b_transport or analysis ports for data communication.

 

Would you say that sockets are the preferred construct for most data communication?  Futhermore, we generally use custom transaction types instead of the generic payload.

 

Brian

Share this post


Link to post
Share on other sites

Would you say that sockets are the preferred construct for most data communication?

 

I'm not sure, if I understand the question right.  How do you use 'b_transport' without sockets?

Of course, technically, you can just use

sc_core::sc_port<tlm::tlm_blocking_transport_if<my_payload> > > my_transport_port;

but the you are quite far away from TLM-2.0. ;-)

 

Sockets (or ports and exports) in general are a good idea to separate communication and computation.  This improves the modularity of your design.

 

Using tlm_analysis_ports for data communication (in the modelled system) is probably not what you want either.

But on the other hand, I don't know the details of your use case.

 

/Philipp

Share this post


Link to post
Share on other sites

Hello,

I have created two target sockets for b_transport method, but i am getting error as,

error: ‘class tlm::tlm_fw_transport_if<>’ has no member named ‘uart_t_socket_b_transport’

please suggest me to correct error.

Thank you,

Veena

Share this post


Link to post
Share on other sites

Hi Veena,

9 hours ago, Veena said:

error: ‘class tlm::tlm_fw_transport_if<>’ has no member named ‘uart_t_socket_b_transport’

 

When you use simple_target_socket instances as described in the snippet above, you still call the normal b_transport on the initiator side.

Can you show more context of the problem?

Greetings from Duisburg,
 Philipp

Share this post


Link to post
Share on other sites

Hi,

First up on thanks for replying, my question is in model I need to implement two b_transport methods, so that I created two target sockets and register the b_transport_1 function to target socket socket1 and second b_transport_2 function to target socket socket2.

When I compile code it giving error as   error: ‘class tlm::tlm_fw_transport_if<>’ has no member named ‘b_transport_2’

As you suggest in, 

Thanks in advance,

/ Veena

Share this post


Link to post
Share on other sites
1 hour ago, Veena said:

When I compile code it giving error as   error: ‘class tlm::tlm_fw_transport_if<>’ has no member named ‘b_transport_2’

  • Why do you try to call b_transport_2(...) anywhere in your code?
  • How do you register these functions to the simple socket?

/Philipp

Share this post


Link to post
Share on other sites
SC_MODULE(target)
{
  tlm_utils::simple_target_socket<target> socket1;
  tlm_utils::simple_target_socket<target> socket2;

  SC_CTOR(target)
    : socket1("socket1")
    , socket2("socket2")
  {
    socket1.register_b_transport(this, &target::first_b_transport);
    socket2.register_b_transport(this, &target::second_b_transport);
  }

  void first_b_transport( tlm::tlm_generic_payload &, sc_core::sc_time & );
  void second_b_transport( tlm::tlm_generic_payload &, sc_core::sc_time & );
};

Share this post


Link to post
Share on other sites

Hi sir,

I am learning systemC by writing UART module. In UART, address for transmit and receive register is same. So in UART model(target) I am getting difficulty when accessing these registers from testbench(Intiator).

Share this post


Link to post
Share on other sites
33 minutes ago, Veena said:

But In target what may be the names when implementing these two b_transport function?

You can chose whatever name you want in the target.  You just register them to different sockets:

// register different functions for each socket
    socket1.register_b_transport(this, &target::first_b_transport);
    socket2.register_b_transport(this, &target::second_b_transport);

// in testbench, call b_transport on different sockets (assuming init_socket1/2 bound to target->socket1/2) 
    init_socket1->b_transport(...); // will call target::first_b_transport
    init_socket2->b_transport(...); // will call target::second_b_transport

/Philipp

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

×