Home > Community > Blogs > Functional Verification > sync wait actions vs temporal struct and unit members
 
Login with a Cadence account.
Not a member yet?
Create a permanent login account to make interactions with Cadence more conveniennt.

Register | Membership benefits
Get email delivery of the Functional Verification blog (individual posts).
 

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

sync and wait Actions vs. Temporal Struct and Unit Members

Comments(0)Filed under: Specman, events, IntelliGen, temporal expressions, Funcional Verification, AF, e code, units
Using sync on a temporal expression (TE), does not guarantee that the execution will continue whenever the TE seems to succeed. In this example, the sync action will miss every second change of my_event:

    tcm0()@any is {
        wait;
        while TRUE {
            sync change (my_event)@any;
            message (LOW, "tcm0: change (my_event)@any occurred");
            wait cycle;
        };
    };

The explanation for this behavior is that Specman evaluates the temporal expression in the sync (or wait) action only when the action is reached.In this case, when "sync change (my_event)@clk;" is reached for the first time,  the value of my_event is saved, and the TE succeeds only at the next my_event change at the sampling event.

If you expect that each change will start a new TE evaluation, an event struct member should be used. Event and expects are struct members and therefore are evaluated as long as the struct is not quitted. In the example below, the execution will continue after each my_event change:

    event e is change(my_event)@any;
    tcm1()@any is {
        wait;
        while TRUE {
            sync @e;
            message (LOW, "tcm1: event e occurred");
            wait cycle;
        };
    };

But using sync on an event still does not guarantee that the execution will always continue whenever the TE seems to succeed. In the following TCM, although e will occur each cycle, the execution will continue after every third occurence:
 
    tcm2()@any is {
        wait;
        while TRUE {
            sync @e;
            message (LOW, "tcm2: event e occurred");
            wait [3]*cycle;
        };
    };

Using on struct/unit member ensures execution upon each e occurrence:
   
   on e {
      message (LOW, "on: change (my_event)@any occurred");
    };

To summarize:
  • sync and wait are actions, and as such they are activated when the action is reached.
  • They should be used to suspend the execution until the TE they are associated with is successful.
  • The TE evaluation is started when the action is reached.

When we want to guarantee the execution of some code whenever a TE succeeds, it is recommended to define an event and on struct member, which remain active throughout the lifetime of the object from its creation until either quit() is called or the run ends.
 
Maya Bar
Specman support 

Comments(0)

Leave a Comment


Name
E-mail (will not be published)
Comment
 I have read and agree to the Terms of use and Community Guidelines.
Community Guidelines
The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.