c4brian Posted July 8, 2014 Report Share Posted July 8, 2014 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 Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted July 8, 2014 Report Share Posted July 8, 2014 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 c4brian and David Black 2 Quote Link to comment Share on other sites More sharing options...
c4brian Posted July 9, 2014 Author Report Share Posted July 9, 2014 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 Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted July 10, 2014 Report Share Posted July 10, 2014 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 Quote Link to comment Share on other sites More sharing options...
Veena Posted June 5, 2017 Report Share Posted June 5, 2017 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 Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted June 5, 2017 Report Share Posted June 5, 2017 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 Quote Link to comment Share on other sites More sharing options...
Veena Posted June 9, 2017 Report Share Posted June 9, 2017 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 Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted June 9, 2017 Report Share Posted June 9, 2017 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 Quote Link to comment Share on other sites More sharing options...
Veena Posted June 9, 2017 Report Share Posted June 9, 2017 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 & ); }; Quote Link to comment Share on other sites More sharing options...
Veena Posted June 9, 2017 Report Share Posted June 9, 2017 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). Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted June 9, 2017 Report Share Posted June 9, 2017 But the above code should work. Just call "b_transport" (not "first_b_transport" and "second_b_transport") from your testbench. /Philipp Quote Link to comment Share on other sites More sharing options...
Veena Posted June 9, 2017 Report Share Posted June 9, 2017 Ok, Thank you. I will tray. /Veena Quote Link to comment Share on other sites More sharing options...
Veena Posted June 9, 2017 Report Share Posted June 9, 2017 But In target what may be the names when implementing these two b_transport function? Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted June 9, 2017 Report Share Posted June 9, 2017 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 Quote Link to comment Share on other sites More sharing options...
Veena Posted June 9, 2017 Report Share Posted June 9, 2017 I have done it successfully. Thanks a lot sir. /Veena Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.