Home > Community > Blogs > Functional Verification > performance tips and tricks another specman performance series
 
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: *

Performance Tips and Tricks: Another Specman Performance Series

Comments(0)Filed under: Functional Verification, Testbench simulation, e, Specman, Aspect Oriented Programming, AOP, EDA, performance, team specman

Building on the great success of Efrat Shneydor's previous blog series, Performance-Aware e Coding Guidelines, a new "Specman Performance Handbook" was added to the 9.2 release of Specman Elite that included, on top of the previous blog items, a slew of other important tips and techniques on how to create more performance friendly code.  Below is the first in a 5 part series of blogs based on excerpts from this Handbook.

Tip 1: Do Not Use delete(0) to Remove items from the Beginning of a List

One way to remove the first few items of a list that obey a particular rule is to use a while loop that checks the first item in the list in respect to that rule and then delete it using list.delete(0). However, using delete(0) negatively affects performance.

Impact:

  - Wall clock

Explanation:

Because delete() maintains the order of the list, each delete(0) is implemented by moving the rest of the list one cell up. Doing this several times is highly inefficient.

You can, instead:

  1. Use a local variable to count until the required index is found.
  2. Copy the list to itself starting from that counter.

Example:

Use:

extend packet {

improved_remove_sfd() is {

var shift: int = data.first_index(it != 0x55);

// count the shift of the sfd

if (shift != UNDEF) {

data = data[shift..];

// GOOD - allocation and copying are done only once

};

};

};

Instead of:

            extend packet {

bad_remove_sfd() is {

while data[0] == 0x55 {

data.delete(0); // BAD - does many unnecessary copies

};

};

};

Now, this is not to say that every use of delete(0) is necessarily a bad thing.  delete(0) is a very compact way to delete a single item from the front of a list and may make sense to use in many situations.  Just be aware of the performance penalty when using it repeatedly or in many locations within the code.

Next week, we will be pulling another tidbit out of the new 9.2 Specman Performance Handbook available within the Cadence Help System.  We will be discussing Ports.

Hope this helps! 

Team Specman

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.