• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Blogs
  2. Verification
  3. sync and wait Actions vs. Temporal Struct and Unit Memb…
teamspecman
teamspecman

Community Member

Blog Activity
Options
  • Subscribe by email
  • More
  • Cancel
AF
events
IntelliGen
Specman
units
e code
temporal expressions
Funcional Verification

sync and wait Actions vs. Temporal Struct and Unit Members

12 May 2014 • 2 minute read
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 

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information