Jump to content
bluephilosopher

how to avoid repetitive sensitivity after signal update

Recommended Posts

I hope I have made the topic title understandable, jeje

 

There is the question:

 

I have a sc_method method1 with static sensitivity to 2 signals, sig_1 and sig_2. and sc_method method2 is sensitive to sig_1.

When the sig_1 in simulator is changed, method1 is triggered by sig_1, and after a delta cycle, agian by sig_2. Is there a way to let the sensitivity of method1 to sig_1 wait for a delta cycle, i.e. ignore the sensitiviy of sig_1, if after a delta cycle there is the sensitiviy of sig_2

 

thanks

 

 

sc_method(method1)
    sensitivity << sig_1 <<sig_2;

sc_method(method2)
    sensitivity << sig_1;

/* simulator */
sig_1.write(variable);

 

Share this post


Link to post
Share on other sites

Hi. 

 

You cannot wait in an sc_method. But you can delay the execution of method1 for one delta cycle by introducing an additional signal: 

 

sc_method(method1)
  sensitive << sig_3 << sig_2;

...

sc_method(method3) 
  sensitive << sig_1;

method3()
{
  sig_3.write(!sig_3);
}

...

Share this post


Link to post
Share on other sites

then how about to wait for a certain time, but not a delta cycle? 

Should I then change the method3 to a sc_thread?

 

############################################

Why is the idea of let sc_method to run without delay? Does it represent any real hardware?

Share this post


Link to post
Share on other sites

In the sense of hardware, an sc_method could be a pure combinatorical block, e.g. something you would implement in a concurrent signal assignment in VHDL. For simulation, the difference is in the simulation performance. An sc_method is always 'run-to-completion' an has no persistent local variables. Hence, it can run in the context of another process. An sc_thread has to have its own process context. As a result, you get less context switches and faster simulation with sc_method. To achieve 'run-to-completion' you are not allowed to wait inside an sc_method. 

 

If you want to wait inside the process you have to use SC_THREAD or SC_CTHREAD.

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

×