amitk3553 Posted May 3, 2013 Report Share Posted May 3, 2013 Hello all, What is the difference between static and dynamic processes? Regards Amit Quote Link to comment Share on other sites More sharing options...
David Long Posted May 3, 2013 Report Share Posted May 3, 2013 Hi Amit, Static processes are created before the start of simulation, by calling e.g. SC_THREAD macro or sc_spawn in the constructor or end_elaboration callback. Dynamic processes are created by calling sc_spawn within another process (which will not be executed until the simulation is running). Regards, Dave amitk3553 1 Quote Link to comment Share on other sites More sharing options...
amitk3553 Posted May 3, 2013 Author Report Share Posted May 3, 2013 Hi Amit, Static processes are created before the start of simulation, by calling e.g. SC_THREAD macro or sc_spawn in the constructor or end_elaboration callback. Dynamic processes are created by calling sc_spawn within another process (which will not be executed until the simulation is running). Regards, Dave Hello Dave Here is my understanding as below.Please correct this e.g. processs A() { ----- ----- process B() { --------}; }; SC_CTOR(){ sc_thread(A); sensitive<<a<<b; } here process a is static?? then implementation of B in A is dynamic process as done above??? or something else??? and what does mean by sc_spawn?? Quote Link to comment Share on other sites More sharing options...
apfitch Posted May 3, 2013 Report Share Posted May 3, 2013 Have a look at the example on p66 of the 1666-2011 IEEE SystemC standard - that shows at example of using sc_spawn to create a dynamic process. In the code you've shown above, there are no dynamic processes. Your code doesn't seem to be valid C++ code, there's no keyword "process", you have to declare a void function to create a static process, e.g. void e() { cout << "this is a dynamic process" << endl; } SC_MODULE(M) { void f() { cout << "This is a static process" << endl; wait(10, SC_NS); sc_spawn (&e); } SC_CTOR(M) { SC_THREAD(f) } }; regards Alan Quote Link to comment Share on other sites More sharing options...
karandeep963 Posted May 6, 2013 Report Share Posted May 6, 2013 Hi Amit, Static processes are created before the start of simulation, by calling e.g. SC_THREAD macro or sc_spawn in the constructor or end_elaboration callback. Dynamic processes are created by calling sc_spawn within another process (which will not be executed until the simulation is running). Regards, Dave Hello Dave , Correct me , If I would say the process using static/dynamic sensitivity are static/dynamic process respectively , would be correct statement?????? If above is true then what would be called for a process implementing both static and dynamic events in the same ??? Regards, KS Quote Link to comment Share on other sites More sharing options...
amitk3553 Posted May 6, 2013 Author Report Share Posted May 6, 2013 Have a look at the example on p66 of the 1666-2011 IEEE SystemC standard - that shows at example of using sc_spawn to create a dynamic process. In the code you've shown above, there are no dynamic processes. Your code doesn't seem to be valid C++ code, there's no keyword "process", you have to declare a void function to create a static process, e.g. void e() { cout << "this is a dynamic process" << endl; } SC_MODULE(M) { void f() { cout << "This is a static process" << endl; wait(10, SC_NS); sc_spawn (&e); } SC_CTOR(M) { SC_THREAD(f) } }; regards Alan Hello Alan, Would you please explain the meaning of following line: sc_spawn (&e); Regards Amit Quote Link to comment Share on other sites More sharing options...
apfitch Posted May 6, 2013 Report Share Posted May 6, 2013 It launches the function e() as a dynamic process, Alan amitk3553 1 Quote Link to comment Share on other sites More sharing options...
amitk3553 Posted May 7, 2013 Author Report Share Posted May 7, 2013 Hello alan, What is event finder used in case of static process? Regards Amit Quote Link to comment Share on other sites More sharing options...
David Long Posted May 7, 2013 Report Share Posted May 7, 2013 Hi KS, Hello Dave , Correct me , If I would say the process using static/dynamic sensitivity are static/dynamic process respectively , would be correct statement?????? If above is true then what would be called for a process implementing both static and dynamic events in the same ??? Regards, KS No, you are mixing up static/dynamic sensitivity with static/dynamic processes. You can for example have a static process (e.g SC_THREAD) that makes use of dynamic sensitivity (e.g wait(x) ) or a dynamic process (sc_spawn) with static sensitivity (using sc_spawn_options - see section 5.5 of the LRM)). Regards, Dave Quote Link to comment Share on other sites More sharing options...
amitk3553 Posted May 8, 2013 Author Report Share Posted May 8, 2013 hello all, Would dynamic process(as in above example) enter in initialisation phase ? Regards cam Quote Link to comment Share on other sites More sharing options...
mohitnegi Posted May 8, 2013 Report Share Posted May 8, 2013 Hi Amit, Static processes are created before the start of simulation, by calling e.g. SC_THREAD macro or sc_spawn in the constructor or end_elaboration callback. Dynamic processes are created by calling sc_spawn within another process (which will not be executed until the simulation is running). Regards, Dave Hi David , Is sc_spawn only way to create a dynamic process ... Quote Link to comment Share on other sites More sharing options...
David Long Posted May 8, 2013 Report Share Posted May 8, 2013 Is sc_spawn only way to create a dynamic process ... Yes. Regards, Dave Quote Link to comment Share on other sites More sharing options...
apfitch Posted May 8, 2013 Report Share Posted May 8, 2013 In the above example, the dynamic process e() would not get executed during the initialisation phase. Alan Quote Link to comment Share on other sites More sharing options...
karandeep963 Posted May 14, 2013 Report Share Posted May 14, 2013 Have a look at the example on p66 of the 1666-2011 IEEE SystemC standard - that shows at example of using sc_spawn to create a dynamic process. In the code you've shown above, there are no dynamic processes. Your code doesn't seem to be valid C++ code, there's no keyword "process", you have to declare a void function to create a static process, e.g. void e() { cout << "this is a dynamic process" << endl; } SC_MODULE(M) { void f() { cout << "This is a static process" << endl; wait(10, SC_NS); sc_spawn (&e); } SC_CTOR(M) { SC_THREAD(f) } }; regards Alan Hello Alan, Simulating the above code generates me the following errors: 1.cpp: In member function ‘void M::f()’: 1.cpp:13:20: error: ‘sc_spawn’ was not declared in this scope make: *** [1.o] Error 1 using "systemc-2.3.0" library. Please help. Regards, KS Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted May 14, 2013 Report Share Posted May 14, 2013 In order to use sc_spawn and dynamic processes in general with the Accellera SystemC implementation, please define SC_INCLUDE_DYNAMIC_PROCESSES before including SystemC: #define SC_INCLUDE_DYNAMIC_PROCESSES #include <systemc> // or <systemc.h> hth, Philipp karandeep963 and faras.dewal 2 Quote Link to comment Share on other sites More sharing options...
dakupoto Posted May 15, 2013 Report Share Posted May 15, 2013 The SystemC simulation engine performs two major tasks - 'elaboration' and 'simulation'. In the elaboration step, the internal data structures to used for the simulation are initialized. This corresponds to static process. sc_spawn, sc_join etc., correspond to dynamic process. Quote Link to comment Share on other sites More sharing options...
apfitch Posted May 15, 2013 Report Share Posted May 15, 2013 Hi Dakupoto, that's not strictly correct, have a look at p6 of the standard: using sc_spawn during elaboration creates a static process, regards Alan karandeep963 1 Quote Link to comment Share on other sites More sharing options...
rahuljn Posted June 2, 2014 Report Share Posted June 2, 2014 Is it possible to emulate SC_THREAD by calling sc_spawn ? Quote Link to comment Share on other sites More sharing options...
rahuljn Posted June 2, 2014 Report Share Posted June 2, 2014 As Dave said "Static processes are created before the start of simulation, by calling e.g. SC_THREAD macro or sc_spawn in the constructor or end_elaboration callback." Any example to create static process using sc_spawn (no SC_THREAD) ? Quote Link to comment Share on other sites More sharing options...
rahuljn Posted June 2, 2014 Report Share Posted June 2, 2014 Finally I am able to create process using sc_spawn() instead of SC_THREAD. My question is in the following code, is the process process1 is static or dynamic process ? class spawn_test : public sc_module { public: void process1(); SC_HAS_PROCESS(spawn_test); spawn_test(sc_module_name name){ //SC_THREAD(process1); sc_process_handle h1=sc_spawn(sc_bind(&spawn_test::process1,this)); }}; void spawn_test::process1(){ cout<<"Hello1\n"; wait(1,SC_NS); cout<<"Hello11\n";} int sc_main(int argc, char*argv[]){ spawn_test* st = new spawn_test("st"); sc_start(10,SC_NS); return 0;} manjunath angadi and deepakj 2 Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted June 2, 2014 Report Share Posted June 2, 2014 My question is in the following code, is the process process1 is static or dynamic process ? Why don't you ask the process itself? std::cout << std::boolalpha << h1.dynamic() << std::endl; Short answer: Processes created from the process macros SC_THREAD,... are called "unspawned" processes, whereas processes created by sc_spawn are called (surprise!) spawned processes. Unspawned processes are by definition static processes, as the macros can't be used during simulation. On the other hand, spawned processes can be either static or dynamic processes: A dynamic process is created during simulation, whereas a static process is created during elaboration. hth, Philipp Quote Link to comment Share on other sites More sharing options...
rahuljn Posted April 8, 2016 Report Share Posted April 8, 2016 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 Quote Link to comment Share on other sites More sharing options...
apfitch Posted April 10, 2016 Report Share Posted April 10, 2016 Hi Rahul, I think I said "during elaboration" rather than "in the end_of elaboration callback". Anyway, the standard says on page 6 "A static process is a process created during the construction of the module hierarchy or from thebefore_end_of_elaboration callback.A dynamic process is a process created from the end_of_elaboration callback or during simulation." So I was wrong to say "elaboration" (which includes the end_of_elaboration callback according to section 4 of the standard), I should have referred to page 6, kind regards Alan P.S. Have you really been thinking about this for 2 years? :-) 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.