Jump to content

multiple event notifications


amitk3553

Recommended Posts

Hello All,

 

Following is the rule in LRM of systemC:

An earlier notification will always override one scheduled to occur later, and an immediate notification is always earlier than any delta-cycle delayed or timed notification.

 

There is an example:

   Process_A {my_event.notify();}

   Process_B {my_event.notify(SC_ZERO_TIME);}

   Process_C {wait(my_event);}

 

 

Now two cases of execution are shown below:

    If process A executes first, then the event is triggered immediately, causing process C to be executed in the same delta-cycle. Then, process B is executed, and since the event was triggered immediately, there is no     conflict and the second notification is accepted, causing process C to be executed again in the next delta-cycle.

 

   If, however, process B executes first, then the delta-cycle delayed notification is scheduled first. Then, process A executes and the immediate notification overrides the delta-cycle delayed notification, causing process   C to be executed only once, in the current delta-cycle.

 

So which is right one and how???

 

Regards

Amit Kumar

Link to comment
Share on other sites

Amit,

both cases are valid simulation runs, as the internal scheduling (i.e. the order, in which processes are evaluated) is implementation-defined. You need to ensure within your models, that there is no (implicit) dependency on any particluar ordering of processes within a single evaluation phase. Otherwise, you may see unexpected behaviour due to things like the event cancellation example, you quoted from the standard.

Greetings from Oldenburg,

Philipp

Link to comment
Share on other sites

Dear Sir,

As a general rule, it is not advisable to use 'wait() - notify()' pairs in

complicated design examples. It is difficult for both the programmer 

and the runtime system to track all the events correctly. One would

be far better off using implicit events via method sensitivity lists.

Link to comment
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...