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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...