Jump to content

Recommended Posts

Hello,

 

I am having an SC_THREAD as follows

 

//

//

SC_THREAD(my_proc);

sensitive << event_1;

dont_initialize();
//

//

//

 

void my_proc()

{

  while(1)

   {

    wait(10,SC_NS);

    cout << " Display ok";

    wait(event_1);

   }

}

 

My question is i am having an situation where this event get triggered repetedly in short instance of time, lets say at time t=2 ns it get triggered then SC_THREAD starts, then again it get triggered at t=4ns, but this triggerring of event goes unnoticed.

 

I saw some post and from them i got to know that i cant even use sc_event_queue as i am using wait in my thread.

What can be alternative to implement this logic.

Thanks.

Share this post


Link to post
Share on other sites

I may completely miss the modeling intent, but if you want the process to be triggered upon each event notification or after ten nanoseconds at the latest, maybe you can use a wait with a timeout?

  wait(10,SC_NS); // startup? (trying to stay close to the original code)
  while(1)
  {
    cout << " Display ok";
    wait( sc_time(10, SC_NS), event_1 ); // wakeup upon event_1, after 10ns at the latest
  }

Would this help in your scenario?

 

Greetings from Duisburg,
  Philipp

Share this post


Link to post
Share on other sites

hi,

 

sc_event_queue is not sc_event.

 

in the example above instead of declaring event_1 as sc_event declare it as

 

sc_event_queue event_1;

 

what it does is whenever you notify the event_1, it adds/list it in queue. so you don't miss any event happened on event_1. but you can't list the immediate notification(meaning event1.notify() won't list anything in the queue as it is immediate. event1.notify(sc_zero_time) will work.

 

not sure, whether it was your question.

 

thanks,

sudha.

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...