Jump to content


  • Content count

  • Joined

  • Last visited

  1. Debugging Multi threaded program in SystemC

    @AmeyaVS: Thanks for pointing out the document pointers. I will try to go through them. @David Black: Thanks for your detailed comment. I got your point on context switching with both sc_method and sc_thread and in either case it is unavoidable. But still, I think the best practice is to use sc_method wherever possible because that will definitely gonna aid us in debugging. As it gets executes in one shot, no suspend in between.
  2. I have been working on maintaining IP's that are written quite old (Legacy :-)). Most of the code use SC_THREAD extensively. I know that it's not a good practice to use sc_thread and we should minimize it's use wherever possible to avoid context-switching. But I would like to know what are the debugging techniques that can help in debug these multi threaded programs efficiently. As sometimes it's a nightmare to identify issues in a program surrounded by tons of threads running parallely. Regards, Ankur Saini
  3. SystemC 2.3.2 installation error

    Hello Roman, I have performed few other simulations as well using SystemC 2.0 build with this GCC version itself on my same platform. So, I guess there shouldn't be any issue with compiler. Regards, Ankur Saini
  4. SystemC 2.3.2 installation error

    Hello Ameya, Thanks for your prompt response. But I don't have cmake setup on my system. I have 'make' and 'gmake' build system. My GCC version is 4.3.5. Can you help me in the installation with this setup. Regards, Ankur Saini
  5. I am trying to install systemc 2.3.2 on my linux system (x86_64).I followed the steps mentioned here (http://rkrara.blogspot.in/2012/12/install-systemc-230-on-linux.html) But I am getting the errors while running make command. (PFA the error log) Please help me with the installation. make.log
  6. @David Black: Hello David.. Nice solution.. just one comment.. as you mentioned the usage of callbacks -"before_end_of_elaboration" and "end_of_elaboration", I guess we can use the "start_of_simulation" and "end_of_simulation" also to do the same stuff you written in the code above. Correct me if I am wrong anywhere.
  7. before_end_of_elaboration callback

    If I am right, with SystemC 2.x onwards, it gave us a flexibility to still leave the ports unbound if they are defined with SC_ZERO_OR_MORE_BOUND binding policy. Correct me in-case I am wrong.
  8. before_end_of_elaboration callback

    @maehne: I got your point to some extent. So that means this callback is just provided to bind/create additional hierarchy which is not part of the actual design but rather helpful for debugging and understanding !! Apart from this is there any other use-case of this callback which you think is worth explaining its existence inside the standard (Just to get little insight)
  9. before_end_of_elaboration callback

    @Philipp A Hartmann: I really want to know the significance of "before_end_of_elaboration" callback in SystemC. On Doulos website (https://www.doulos.com/knowhow/systemc/new_standard/), it is mentioned that it can be used in the scenarios where we bind the module monitor ports to the top level singleton monitor channel. Referring to the attached example, why are we not binding the module monitor ports to the top level monitor channel in the top level constructor ? Why the binding of ports is done in the particular module callback function ? Also, what is the need of providing an additional callback function to instantiate module/ports when we can do the same thing in the constructor itself ?
  10. How exactly sc_main works !!

    @Philipp A Hartmann: Thanks for the short summary. It really gave me a good understanding from the top level.
  11. How exactly sc_main works !!

    How "sc_main" works in SystemC ? I mean what I understood from library is that - there is a main function defined in library which calls the sc_elab_and_sim which in turns calls the sc_main function. But my question is SystemC library is distributed as source which user builds at his end; and links to his application. And if SystemC has main inside it then it should have got compiled into exe! Am I right ? Can somebody help me in understanding this flow ?
  12. before_end_of_elaboration callback

    @Philipp A Hartmann: Thanks a lot Philipp for the clarification.. understood the point now..
  13. I created a simple example to see how the callbacks are being called by the systemc simulation kernel. But I am little surprised with the output. Can somebody explain or justify the output ? CODE: ============================= class analyzer : public sc_module { public: sc_out<bool> out_portA; sc_in<bool> in_portA; analyzer(sc_module_name nm) : out_portA("OUT_PORT_A"),in_portA("IN_PORT_A") { std::cout << "I am in analyzer constructor " << std::endl; } void before_end_of_elaboration(){ std::cout << "I am in before_end_of_elaboration of " << name() << std::endl; } }; class producer : public sc_module { public: sc_out<bool> out_portP; producer(sc_module_name nm) : out_portP("OUT_PORT_P") { std::cout << "I am in producer constructor " << std::endl; } void before_end_of_elaboration(){ std::cout << "I am in before_end_of_elaboration of " << name() << std::endl; } }; class consumer : public sc_module { public: sc_in<bool> in_portC; consumer(sc_module_name nm) : in_portC("IN_PORT_C") { std::cout << "I am in consumer constructor " << std::endl; } void before_end_of_elaboration(){ std::cout << "I am in before_end_of_elaboration of " << name() << std::endl; } }; class top_module : public sc_module { public: sc_signal<bool> sig1; producer p1; consumer c1; top_module(sc_module_name nm):sig1("SIG1"),p1("P1"),c1("C1") { std::cout << "I am in top constructor " << std::endl; p1.out_portP(sig1); c1.in_portC(sig1); } void before_end_of_elaboration(){ std::cout << "I am in before_end_of_elaboration of " << name() << std::endl; analyzer a1("A1"); //p1.out_portP(sig1);a1.in_portA(sig1); //sc_signal<bool> sig2; //a1.out_portA(sig2);c1.in_portC(sig2); } }; int sc_main(int argc, char *argv[]) { top_module top("TOP"); sc_start(1,SC_MS); sc_stop(); return 0; } OUTPUT: ============================= SystemC 2.3.0-ASI --- Feb 1 2014 18:12:06Copyright (c) 1996-2012 by all Contributors,ALL RIGHTS RESERVEDI am in producer constructor I am in consumer constructor I am in top constructor I am in before_end_of_elaboration of TOPI am in analyzer constructor I am in before_end_of_elaboration of TOP.P1I am in before_end_of_elaboration of TOP.C1Info: /OSCI/SystemC: Simulation stopped by user. Why it has not called the analyzer before_end_of_elaboration() callback ? Also, can I alter/modify/redefine the port bindings in the top level before_end_of_elaboration callback (see the commented lines in top level callback)?