Jump to content
amitk3553

multiple event notifications

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

Share this post


Link to post
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

Share this post


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

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

×