Phani Karthik Posted September 22, 2022 Report Share Posted September 22, 2022 Hi All, Greetings. Iam new to systemC and Iam stuck in a scenario while using methods and want the community's help kindly. Basically My scenario is like the one snap i have attached. Iam deep inside a call stack of methods and at one point I will check if a resource (timer in this case) is available. Now If I was using a thread here, I would have used WAIT() for an event that informs that timers are available now. But since iam inside method, I cannot wait here nor loop here waiting for the resource. Can you please help suggest how should I handle this scenario? What I tried: a) If i return back from the inner check, then nce the timer is available, will not be able to come back to the same point as no context will be saved. b) I cannot do a busy wait as simulation time will not proceed.(Timers will never be available) PS: Iam only allowed to systemc method (and NOT a thread). Thanks & Regards, Phani Quote Link to comment Share on other sites More sharing options...
David Black Posted September 22, 2022 Report Share Posted September 22, 2022 Why use SC_METHOD instead of SC_THREAD? If your answer is performance, you are very likely committing the sin of premature optimization. The overhead of SC_THREAD is very minimal (a few percentage points), and the benefit of easier coding is very high. SystemC is as much about faster coding as it is about high-performance models. Anything you can do in SC_THREAD can be accomplished in SC_METHOD, but with a complexity cost (i.e., increased development time and the likelihood of bugs). You could use next_trigger( time); return, and add some state to your code in order to resume at the proper point. Quote Link to comment Share on other sites More sharing options...
Phani Karthik Posted September 26, 2022 Author Report Share Posted September 26, 2022 Thank you very much for your kind reply. Regards, Phani 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.