shubham_v Posted May 14, 2019 Report Share Posted May 14, 2019 Hi, I have came back to system c after 6 months, again. I was trying to solve different basic examples of system c. The code is getting compiled,but i am not able to view the desired output. My output is not at all changing,i am not sure whether my function is getting hit or not. Please have a look at the code below and any help would b appreciated. In code,i have added stimulus first and then monitor to check wheteher my function was getting invoked.Again ,in main file also i passed the input. But from ,nowhere i am getting the output. Please help! https://www.edaplayground.com/x/5qEA Ps:Not only this example,the other examples such as combinational circuits,encoders,decoders. I am facing the same issue with respect to all of them.There must be a common mistake which i am repeating. Thanks & regards, shubham_v Quote Link to comment Share on other sites More sharing options...
SDeepti Posted May 14, 2019 Report Share Posted May 14, 2019 You have registered d_operation() as a thread. Ideally a thread should have an infinite loop and a wait(). Adding that, you can see changes to your d_out. Also, how about having another thread that does the reset job? shubham_v 1 Quote Link to comment Share on other sites More sharing options...
shubham_v Posted May 15, 2019 Author Report Share Posted May 15, 2019 (edited) Hi deepti, Thanks for your reply. I have tried the other examples also,but tats the commmon issue iam facing of not getting output. By infinite loop, you mean to say i need to put sc_start(-1) which in turn makes my thread to run forever. As far as my problem is concerned,even for combinational circuits if iam using sc_method ,i am not getting the desired output. Update:-Started writing the fresh code and i am getting some ouput now.Some issues are there with respect to timing,but i think it can be resolved. Regards, Shubham Edited May 15, 2019 by shubham_v Got the output Quote Link to comment Share on other sites More sharing options...
SDeepti Posted May 15, 2019 Report Share Posted May 15, 2019 No, you need to have loop with the function registered as SC_THREAD. For your code, it will be: void d_operation() { while(1){ if (reset.read()==1) { d_out = 0; // std::cout << "reset= " << reset << "...din= " << d_in << ".....d_out" << d_out << std::endl; } else { //d_out.write(d_in.read()); d_out=d_in; // wait(1, SC_NS); // std::cout << "reset= " << reset << "...din= " << d_in << ".....d_out" << d_out << std::endl; } wait(); } } shubham_v 1 Quote Link to comment Share on other sites More sharing options...
shubham_v Posted May 16, 2019 Author Report Share Posted May 16, 2019 Hi deepti, ok,i got it. Thanks for the help. Regards, Veeresh k 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.