Home > Community > Forums > Functional Verification Shared Code > Macro for multiple-value when definitions

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: *

 Macro for multiple-value when definitions 

Last post Tue, May 20 2008 10:33 AM by archive. 2 replies.
Started by archive 31 Oct 2007 03:23 AM. Topic has 2 replies and 10494 views
Page 1 of 1 (3 items)
Sort Posts:
  • Wed, Oct 31 2007 3:23 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    Macro for multiple-value when definitions Reply

    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
           "extend \[,...\] ({;...})" as computed {
        for each in do {
            result = appendf("%sextend %s %s %s;",result,it,,);
        };
        result = appendf("{%s}",result); // required only for versions 6.1.1 or earlier
    };

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


    Originally posted in cdnusers.org by matanvax
    • Post Points: 5
  • Tue, Jan 29 2008 7:46 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Macro for multiple-value when definitions Reply

    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
    • Post Points: 0
  • Tue, May 20 2008 10:33 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Macro for multiple-value when definitions Reply

    Hi Thorsten,
    the web browser does not display the

    <>

    BR
    Ernst


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

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


    Originally posted in cdnusers.org by zwinge
    • Post Points: 0
Page 1 of 1 (3 items)
Sort Posts:
Started by archive at 31 Oct 2007 03:23 AM. Topic has 2 replies.