• 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 Shared Code
  3. Macro for multiple-value when definitions

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 38
  • Views 15593
  • 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

Macro for multiple-value when definitions

archive
archive over 17 years ago

The two macros below introduce new syntax for adding definitions to more than one 'when' determinant value at the same time. The first macro overloads 'extend' keyword and the second is the equivalent for 'when' keyword.

A use example:

extend [HUGE, BIG] packet {
    // definitions that pertain to these subtypes
};


The above code would be expanded in the following (naive) way:

extend HUGE packet {
    // definitions that pertain to these subtypes
};
extend BIG packet {
    // definitions that pertain to these subtypes
};



The macros code:

define 'statement>
       "extend \['name>,...\] 'name> ({;...})" as computed {
    for each in 'names> do {
        result = appendf("%sextend %s %s %s;",result,it,'name>,);
    };
    result = appendf("{%s}",result); // required only for versions 6.1.1 or earlier
};

define 'struct_member>
       "when \['name>,...\] 'name> ({;...})" as computed {
    for each in 'names> do {
        result = appendf("%swhen %s %s %s;",result,it,'name>,);
    };
    result = appendf("{%s}",result); // required only for versions 6.1.1 or earlier
};


Originally posted in cdnusers.org by matanvax
  • Cancel
  • archive
    archive over 17 years ago

    Hm, are you sure it compiles ? I get various errors, e.g. the syntactic category is missing (at least in my browser the space after "define" is empty)...

    Cheers,
    Thorsten.


    Originally posted in cdnusers.org by blutsvente
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • archive
    archive over 17 years ago

    Hi Thorsten,
    the web browser does not display the

    <>

    BR
    Ernst


    define 'statement> "extend \['exp>,...\] 'name> ({;...})" as computed {for each in 'exps> do { result = appendf("%sextend %s %s %s;",result,it,'name>,);}; result = appendf("{%s}",result); };

    define 'struct_member> "when \['exp>,...\] 'name> ({;...})" as computed {for each in 'exps> do {result = appendf("%swhen %s %s %s;",result,it,'name>,); }; result = appendf("{%s}",result); };

    Originally posted in cdnusers.org by zwinge
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

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