rahuljn Posted July 25, 2014 Report Share Posted July 25, 2014 Hi Experts I am facing an issue in downcasting the sc_module child objects to target_base_socket_type. It works fine when I downcast to initiator_base_socket_type. In initiator module I have following lines or code which works fine and tells me which ports are not bound tlm::tlm_initiator_socket<BUS_WIDTH> initiator_socket; typedef tlm::tlm_fw_transport_if<tlm::tlm_base_protocol_types> fw_interface_type;typedef tlm::tlm_bw_transport_if<tlm::tlm_base_protocol_types> bw_interface_type;typedef tlm::tlm_base_initiator_socket<BUS_WIDTH,fw_interface_type,bw_interface_type> initiator_base_socket_type; void before_end_of_elaboration(){ cout<<this->name()<<" before_end_of_elaboration"<<endl; std::vector<sc_object*> module_list = this->get_child_objects(); for(std::vector<sc_object*>::iterator it=module_list.begin(); it<module_list.end();it++){ initiator_base_socket_type* ibsoc = dynamic_cast<initiator_base_socket_type*>(*it); if(ibsoc != NULL){ if(ibsoc->get_base_port().size()==0){ cout<<"\t\t\tInitiator Port "<<ibsoc->name()<<" not connected"<<endl; } } }} I have the same piece of code (following) code in target module, in this case ibsoc is always NULL tlm::tlm_target_socket<BUS_WIDTH,tlm::tlm_base_protocol_types,2> target_socket; typedef tlm::tlm_fw_transport_if<tlm::tlm_base_protocol_types> fw_interface_type;typedef tlm::tlm_bw_transport_if<tlm::tlm_base_protocol_types> bw_interface_type;typedef tlm::tlm_base_target_socket<BUS_WIDTH,fw_interface_type,bw_interface_type> target_base_socket_type;....void before_end_of_elaboration(){ std::vector<sc_object*> module_list = this->get_child_objects(); for(std::vector<sc_object*>::iterator it=module_list.begin(); it<module_list.end();it++){ target_base_socket_type* ibsoc = dynamic_cast<target_base_socket_type*>(*it); if(ibsoc != NULL){ if(ibsoc->get_base_port().size()==0){ cout<<"\t\t\tTarget Port "<<ibsoc->name()<<" not connected"<<endl; } } }} Am I missign something ? Please note in for target port I have N=2 Thanks Quote Link to comment Share on other sites More sharing options...
rahuljn Posted July 25, 2014 Author Report Share Posted July 25, 2014 Ok, I got the issue. I need to have same template parameters to make it work 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.