• 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. Community Forums
  2. Functional Verification
  3. Controlling generation

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 64
  • Views 13517
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Controlling generation

archive
archive over 18 years ago

Hello, I have a query in generation. Suppose if i need to generate a field based on other field, For example class gen; rand rw_wr; rand data; endclass in the above code i want to generate data only when rw_wr = 1 if rw_wr = '0' data should not be generated. For the above scenario how to write the generation constraint. Sundar


Originally posted in cdnusers.org by sundar_80
  • Cancel
Parents
  • archive
    archive over 18 years ago

    The answer depends on your reason for asking this question. If your goal is to save generation effort by not randomizing "data", then perhaps the benefit gained by preventing the randomization of "data" is not worth the effort. If your goal is not to loose the value of "data" because of the randomization only when "rw_wr" is set to 0, then you can do this in multiple ways. If you want "rw_wr" to be generated first, then you can randomize "rw_wr" first, and depending on the result randomize the rest of the data object by explicitly using "randomize(data)". If you don't want to to impose an ordering because you feel such ordering may affect your randomization behavior, then you can save the content of "data" in a temporary variable by defining "pre_randomize()" and putting that value back into "data" by extending "post_randomize()". Sasan


    Originally posted in cdnusers.org by iman2418
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • archive
    archive over 18 years ago

    The answer depends on your reason for asking this question. If your goal is to save generation effort by not randomizing "data", then perhaps the benefit gained by preventing the randomization of "data" is not worth the effort. If your goal is not to loose the value of "data" because of the randomization only when "rw_wr" is set to 0, then you can do this in multiple ways. If you want "rw_wr" to be generated first, then you can randomize "rw_wr" first, and depending on the result randomize the rest of the data object by explicitly using "randomize(data)". If you don't want to to impose an ordering because you feel such ordering may affect your randomization behavior, then you can save the content of "data" in a temporary variable by defining "pre_randomize()" and putting that value back into "data" by extending "post_randomize()". Sasan


    Originally posted in cdnusers.org by iman2418
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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.

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

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