Meir Posted January 14, 2020 Report Share Posted January 14, 2020 Hey all. i am a novice user of SystemC, and couldn't find an answer to the following question? ive noticed that when ever i tried using SC_CTHREAD(proc_name, clk.pos()) -> the simulation time was increased significantly (to a level where it appeared to be stuck). what is the right use of SC_CTHREAD so that it doesnt jam the simulation? i am adding an example of what i did: SC_CTHREAD(monitor_intr_in, clk.pos()); ... void TMG_helper::monitor_intr_in() { while(true) { cout << "i am here" << endl; } } thank you in advance ! Quote Link to comment Share on other sites More sharing options...
David Black Posted January 14, 2020 Report Share Posted January 14, 2020 You are missing at minimum a single wait() in the infinite loop. SystemC is an event driven simulator and as such concurrency is modeled using co-operative multi-tasking. An infinite loop is an infinite loop. No pre-emption. maehne 1 Quote Link to comment Share on other sites More sharing options...
Meir Posted January 16, 2020 Author Report Share Posted January 16, 2020 hey. thanks for replying. the code that i posted was a snippet. it did include the wait() statement. so my questions still remains: 1. what is the right use case for SC_CTHREAD ? 2. why in my give example the simulation gets "stuck" ? thanks Quote Link to comment Share on other sites More sharing options...
Meir Posted January 20, 2020 Author Report Share Posted January 20, 2020 hey. any chance getting a reply ? thank you !! Quote Link to comment Share on other sites More sharing options...
Roman Popov Posted January 20, 2020 Report Share Posted January 20, 2020 In general, you can use profiler tool to understand where hotspots are. Your code snippet is incomplete, so it is impossible to say anything. Quote Link to comment Share on other sites More sharing options...
Timur Kelin Posted January 21, 2020 Report Share Posted January 21, 2020 Hi Roman Could you please recommend a multi-threaded profiler for SC. I tried making use of gprof but with no success. Thank you 16 hours ago, Roman Popov said: In general, you can use profiler tool to understand where hotspots are. Quote Link to comment Share on other sites More sharing options...
Roman Popov Posted January 21, 2020 Report Share Posted January 21, 2020 6 hours ago, Timur Kelin said: Hi Roman Could you please recommend a multi-threaded profiler for SC. I tried making use of gprof but with no success. Many commercial SystemC tools have SystemC-specific profilers measuring runtimes of SC processes. On Windows I usually use Visual Studio built-in profiler. I don't have experience with profiling on Linux. Quote Link to comment Share on other sites More sharing options...
sumit_tuwien Posted January 23, 2020 Report Share Posted January 23, 2020 On 1/21/2020 at 11:54 AM, Timur Kelin said: Hi Roman Could you please recommend a multi-threaded profiler for SC. I tried making use of gprof but with no success. Thank you valgrind can be used as a profiler here. the tool is callgrind. kcachegrind comes with kde is a nice viewer. Quote Link to comment Share on other sites More sharing options...
sumit_tuwien Posted January 23, 2020 Report Share Posted January 23, 2020 On 1/16/2020 at 9:44 AM, Meir said: hey. thanks for replying. the code that i posted was a snippet. it did include the wait() statement. so my questions still remains: 1. what is the right use case for SC_CTHREAD ? 2. why in my give example the simulation gets "stuck" ? thanks Your simulation was stuck because it was not proceeding with time ... 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.