Jump to content

Recommended Posts

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

Share this post


Link to post
Share on other sites

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?

 

Share this post


Link to post
Share on other sites

 

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 by shubham_v
Got the output

Share this post


Link to post
Share on other sites

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();
    }
    }

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×