ralph.goergen

Members
  • Content count

    129
  • Joined

  • Last visited

About ralph.goergen

  • Rank
    Advanced Member

Recent Profile Visitors

222 profile views
  1. Hi makiso, Please write down all the indexes (values of j) that will be considered in your nested loop (or use cout to print them). The you will see that you do not go through your array. Or consider using sc_vector and the vector based binding facilities to avoid this problem. Greetings Ralph
  2. Hi. You cannot have C-style arrays of SystemC objects. This includes ports, modules, and *signals*. Use sc_vector instead. BTW: I think it should be possible to drop an sc_vector in an sc_vector to realize two dimensions. Greetings Ralph
  3. Hi. Ameya is right. See SystemC LRM (ieee1666) Section 5.2.15: [...] it is associated with the most recently created process instance [...] I.e.: ONE process created most recently before calling dont_initialize is not execute. BTW: No process is executed in the constructor. But all processes, that are not marked as dont_initialize, are evaluated once at simulation start. Greetings Ralph
  4. Hi Sumit. what you are doing here is a hierarchical module. foo is a member, i.e. a submodule of bar. They should not have the same name. If you want bar to be derived from foo, then derive bar from foo instead of sc_module. Then, you instantiation will work. If you want foo to be a submodule of bar, let the derivation as is but fix your initializer lists. You need to forward the name argument to the base class constructor in every class derived from sc_module, i.e. in bar as well. Furthermore, the submodule foo should not have the same name as its parent bar. // constructor Bar(sc_core::sc_module_name name) : sc_module(name) // forward name to base class constructor , foo("foo") // name submodule foo 'foo' { ... Or use the SC_CTOR macro that handles this for you. Greetings Ralph
  5. OK. Thanks. I now saw that there is a comparable guard expression in the sc_cor_pthread.cpp file. But I think changing this needs some more care and investigation. I forward this to the developer community. Greetings Ralph
  6. Hi, You have to forward the module name to the base class constructor: foo(sc_core::sc_module_name name) : sc_module(name) {} Or use SC_CTOR instead. Greetings Ralph
  7. Hi. There seems to be a problem with the '#if defined' expressions. MSYS gcc and clang define _WIN32, and in combination with using pthreads, SC_USE_PTHREADS is defined as well. Could you please evaluate possible fixes? E.g. adding '!defined(SC_USE_PTHREADS)' in line 33 of sc_cor_fiber.h? And could you please try with the public review version of SystemC 2.3.2 as well (http://www.accellera.org/downloads/drafts-review)? If this works, I can try to forward the issue to the SystemC developer working group. Greetings Ralph
  8. Hi. Did you set the time resolution? I think it defaults to pico seconds. See sc_set_time_resolution in the SystemC LRM (IEEE 1666) for details. Greetings Ralph
  9. How about using delta cycles? Their main reason is to bring determinism into concurrent systems. When you notify the event for the next delta cycle with e.notify(sc_core::SC_ZERO_TIME), then it will definitely see all transactions that happened in this delty cycle. Greetings Ralph
  10. Dear S. Hard to tell exactly from what you posted. Often this error appears when the compiler does not identify the first identifier given in a declaration as the name of a type. Maybe, the compiler does not see the declaration of class sc_vector. What version of SystemC are you using? Can you check if all your include and using statements are correct? Or use the fully quallified name 'sc_core::sc_vector'? One more issue: sc_vector is meant to contain objects derived from sc_object and not pointers (this is one of the advantages over std::vector). So you should do sc_vector<reg>. But I am not sure if this causes the error here. Greetings Ralph
  11. Yes you can. If you do not have a chance to update your compiler, you can still use one of the two methods mentioned in the IEEE1666 SystemC LRM Section 8.5.5: A creator function object or a member function. Both solutions are not as compact as the Lambda solution, but they do not require any C++11 feature.
  12. Hi. If you want to pass arguments to the constructor of the elements of an sc_vector, you need a custom creator. See SystemC LRM IEEE:1666 Section 8.5.5 for details and examples. A very easy way to realize custom creator by using a Lambda function is presented here: https://www.researchgate.net/publication/284731273_Automated_SystemC_Model_Instantiation_with_Modern_C_Features_and_sc_vector Greetings Ralph
  13. OK. It seems to work as well when you place the constructor in a cpp file. I did not use it that way so far. Actually, the standard says something differrent: IEEE1666-2011: Sec 5.2.8: "Macro SC_HAS_PROCESS shall only be used within the class definition, constructor body, or member function body of a module. The name of the module class being constructed shall be passed as the argument to the macro. The macro invocation shall be terminated with a semicolon." Rest of your example seems to be OK and the code below works in my environment (slight modification of your code replacing Schedule with int and fixed typos): //m2.h #include <systemc> using namespace sc_core; class M2 : public sc_module { public: // Constructor M2(sc_module_name name); sc_port<sc_fifo_in_if< int > > p0; private: void threadReceiveSchedule(); }; //m2.cpp #include "m2.h" SC_HAS_PROCESS(M2); M2::M2(sc_module_name name) { SC_THREAD(threadReceiveSchedule); } void M2::threadReceiveSchedule() { int schedule; while(true) { std::cout << "read fifo" << std::endl; if (p0->nb_read(schedule)) { } wait(10, SC_NS); } } //m1.h #include <systemc> #include "m2.h" class M1 : public sc_module { public: // Constructor M1(sc_module_name name); sc_fifo< int > c0; void process(); private: M2* _m2; }; //m1.cpp #include "m1.h" SC_HAS_PROCESS(M1); M1::M1(sc_module_name name): c0("fifo_schedule", 10) { _m2 = new M2("M2"); _m2->p0(c0); } void M1::process() { int schedule; c0.write(schedule); } //main.cpp #include "m1.h" using namespace sc_core; int sc_main(int,char**) { M1 _m1("m1"); sc_core::sc_start(sc_core::SC_ZERO_TIME); return 0; }
  14. Hi Jean-Claude, I am not sure if this couses the port not bound error but I see at least one issue in your code: SC_HAS_PROCESS macro shall beinvoked within the class definition or the constructor body. I looks like you are calling it in a global area between class definition and ctor body or in a cpp file right before the ctor body. Please try to move the macro call into the module/class definition. Greetings Ralph
  15. Hi. Maybe this happened with the update of the forum sw. This is the new link to the thread Philipp talked about: Regards Ralph