Jump to content

rahuljn

Members
  • Content Count

    90
  • Joined

  • Last visited

  • Days Won

    4

rahuljn last won the day on December 10 2015

rahuljn had the most liked content!

About rahuljn

  • Rank
    Advanced Member

Recent Profile Visitors

474 profile views
  1. Hello 1. In IEEE doc @112, I see the following Because the time at which deferred port binding is completed is implementation defined, it is implementation defined whether get_interface returns a pointer to a channel or a null pointer. So where I shoudl check whether the port is bounded or not and accordingly take action so that my code works fine with all implementations. 2. For a multiport how to get all interfaces connected to that port. The get_interface returns only the pointer to first channel instance Thanks RJ
  2. Hello Thanks for your comments. But in my case I am not interested in reading that port value during the simulation as I am explicitly stubing that. Can you confirm you are not getting seg fault with my example(without any change) ? In my env I am using Ubuntu, gcc 4.8.4 and SystemC 2.3.1 and I am getting the seg fault. Thanks RJ
  3. Hello I agree with you but the standard says that you can instantiate new sc_ports etc in before_end_of_elaboration callbacks. If you see @24 of IEEE doc, it says "The instantiation of objects of class sc_module,sc_port,sc_export, sc_prim_channel" Then how it works ? Thanks Rahul
  4. Hello As per standard we can create new sc_port in before_end_of_elaboration callback In the following example, I am creating a new port in before_end_of_elaboration callback but it is not connected in sc_main. #include "systemc.h" class test : public sc_module { public: SC_HAS_PROCESS(test); test(sc_module_name name){ SC_THREAD(fun); } void fun(){} void before_end_of_elaboration(){ sc_port<sc_signal_inout_if<bool> > in1; } }; int sc_main(int, char**){ test t("t"); sc_start(100,SC_NS); sc_stop(); return 0; } But I am not getting unconnected port error. Thanks RahulJn
  5. Hello In the following example I am tying to connect the unconnected port to dummy channel in before_end_of_elaboration callback. But it gives me seg fault #include "systemc.h" class test : public sc_module { public: sc_in<bool> in1; SC_HAS_PROCESS(test); test(sc_module_name name){ SC_THREAD(fun); } void fun(){ } void before_end_of_elaboration(){ sc_signal<bool> sig; in1.bind(sig); } }; int sc_main(int, char**){ test t("t"); sc_start(); return 0; } Can you please help. Also the standard says that @page 122 that the time at which deferred port binding is complete is implementation defined, so where I shoudl check my unconnected ports in the module" Thanks RahulJn
  6. Hi In the following example I am creating a process in end_of_elaboration method. Alan mentioned above that process created in end_of_elaboration method are static but when I call dynamic(), it return 1. So it is dynamic. #include "systemc.h" class test : public sc_module { public: sc_process_handle h; SC_HAS_PROCESS(test); test(sc_module_name name){ } void end_of_elaboration(){ SC_THREAD(fun); } void fun(){ h = sc_get_current_process_handle(); cout<<h.dynamic()<<endl; } }; int sc_main(int, char**){ test t("t"); sc_start(); return 0; } Thanks Rahul
  7. Hi Roman I want to do port to export binding at top so I wrote init.out(targ.in); Thanks
  8. Hi I am facing an issue with sc_port sc_export binding. My following example compiles fine class initiator : public sc_module { public: sc_port<sc_signal_inout_if<bool> > out; initiator(sc_module_name name){} }; class target : public sc_module { public: sc_port<sc_signal_in_if<bool> > in; target(sc_module_name name){} }; int sc_main(int, char**){ initiator init("init"); target targ("targ"); sc_signal<bool> sig; init.out(sig); targ.in(sig); sc_start(); return 0; } But when I move the channel inside the target, and replace sc_port with sc_export, I have following error class initiator : public sc_module { public: sc_port<sc_signal_inout_if<bool> > out; initiator(sc_module_name name){} }; class target : public sc_module { public: sc_export<sc_signal_in_if<bool> > in; sc_signal<bool> sig; target(sc_module_name name){in(sig);} }; int sc_main(int, char**){ initiator init("init"); target targ("targ"); init.out(targ.in); sc_start(); return 0; } the error is error: no match for call to ‘(sc_core::sc_port<sc_core::sc_signal_inout_if<bool>, 1, (sc_core::sc_port_policy)0u>) (sc_core::sc_export<sc_core::sc_signal_in_if<bool> >&)’ Can you help me in inderstanding this issue ? Thanks Rahul
  9. Hi Folks Any clue please ? Thanks Rahul
  10. Hi Alain I have a initiator module with tlm::tlm_initiator_socket<BUS_WIDTH,tlm::tlm_base_protocol_types,2> initiator_socket; and a target module with tlm::tlm_target_socket<BUS_WIDTH> target_socket1; tlm::tlm_target_socket<BUS_WIDTH> target_socket2; And in top, I have initiator_inst->initiator_socket.bind(target_inst->target_socket1); initiator_inst->initiator_socket.bind(target_inst->target_socket2); When I run this, it says Error: (E107) bind interface to port failed: interface already bound to port: port 'initiator.tlm_base_initiator_socket_0' (tlm_initiator_socket) But when I have a initiator module with tlm::tlm_initiator_socket<BUS_WIDTH> initiator_socket; and a target module with tlm::tlm_target_socket<BUS_WIDTH,tlm::tlm_base_protocol_types,2> target_socket; and in top I have tow instance of initiator and connected to target like initiator_inst1->initiator_socket.bind(target_inst->target_socket); initiator_inst2->initiator_socket.bind(target_inst->target_socket); It works fine. Why the Ist case above is not working ? Thanks RahulJn
  11. Is there a way to know in a channel interface function in which port context it is called? In my scenario I have a interface with read and write function. Now I have an initiator model with two ports and a target model with two exports. Now when read or write is called thru initiator ports I want to know on which target port context this read or write is called
  12. Hi Guys In TLM2 LRM, under section 14.18.2, I am not fully understand the following points Rule i) The effective word length shall be calculated as (BUSWIDTH + 7)/8 bytes. >> from where this expression comes from and why we have additional 7 in this expression. Rule i) initiators and targets are connected LSB-to-LSB, MSB-to-MSB. >> does it mean we direct connect the ports regardless to their endianness and host endianness. Can you please help me to understand these. Thanks Rahul
  13. In addition what is the difference between sensitive<<in and sensitive<<in.value_changed() And in sensitive<<in.defualt_event(); and sensitive<<in.value_chnaged_event(); Thanks
  14. Hi Guys I have a SC_METHOD which is sensitive to module input port.(in) In that case what is the difference between and which one we should use sensitive<<in sensitive<<in.value_changed() in end_of_elaboration : sensitive<<in.defualt_event(); in end_of_elaboration : sensitive<<in.value_chnaged_event(); Thanks Rahul
×
×
  • Create New...