4 Replies Latest reply on Apr 2, 2012 10:45 PM by pradeepk

    How to code in SVRF?

    pradeepk

      Hi,

      I'm new to SVRF coding. I have a scenario as follows:

       

      User can set a double value to an environment variable. In the svrf code I need to check if this value falls within a range of double. For example,

       

      Let's say the value set in environment for variable abc is 24.0 . Now, how do I code in svrf rule deck to see if value of variable abc falls in the range 18.0 to 30.0?

       

      Help would be much appreciated.

       

      Thanks,

      Pradip

        • 1. Re: How to code in SVRF?
          samantha_lizak

          Hi Pradip-

           

          There are two ways to pass environment variables in: TVF's "$env( )" and the SVRF "VARIABLE" statement. As you need to check whether the passed in value is between two other values, you must use TVF; SVRF preprocessor directives (#IFDEF) can only check for exact matches.

           

          Example 2 in "TVF Examples" in the SVRF manual shows using TVF to handle a variable while still using most of the SVRF deck.  You'd need to add some standard tcl to handle the range check.  (TVF stands for Tcl Verification Format, and uses all the regular tcl commands plus our extensions.)  The code would look something along the lines of

           

          if (($my_env_var > 18.0) && ($my_env_var < 30.0)) { <do stuff> }

           

          Just to be on the safe side, it is also good to make sure something gets passed in; the tcl code for that is "info exists env(external_name)"; after checking, then assign it to the internal name (I used "my_env_var").

           

          Hope this helps.

           

          -Sam.

          • 2. Re: How to code in SVRF?
            pradeepk

            Hi Sam,

            Thanks for helping me out. Your suggestion is something I did try earlier. What I actually want to achieve is :

             

            if(($my_env_var >= 18.0) && ( $my_env_var < 30.0){

             

            #DEFINE ABC

            }

            else {

             

            #DEFINE DEF

            }

             

            I'm not sure how do I specify preprocessor directive using TVF. I check the reference manual but did not find any info on this.

            Is there a way to specify, a preprocessor directive using TVF?

             

            Thanks,

            Pradip

            • 3. Re: How to code in SVRF?
              samantha_lizak

              Hi Pradip-

               

              What about tvf::VERBATIM?  It is generally used for quoting SVRF.  So instead of "#DEFINE ABC", you'd have "tvf::VERBATIM {

              #DEFINE ABC

              }

              "

               

              Note the line wrap after each { and } -- I think it is required in tcl based on the examples.

               

              You can put any SVRF you like within VERBATIM's { }, so it allows larger chunks as well. Perhaps you wouldn't even need the #DEFINE.

               

              Best-

               

              Sam.

              • 4. Re: How to code in SVRF?
                pradeepk

                Hi Sam,

                 

                You're right. This is something which worked. Thanks

                 

                I found another way using the DENSITY command to implement it in SVRF without using TVF.

                 

                VARIABLE BUMP_PITCH ENVIRONMENT    //User entry for an exact pitch value

                 

                #IFDEF ABC

                PITCH_OUTSIDE_RANGE_156_167 {
                DENSITY CHIP < 0 [BUMP_PITCH - 156 ]
                DENSITY CHIP >= 0 [BUMP_PITCH - 167 ]
                }
                #ENDIF

                 

                #IFDEF DEF

                PITCH_OUTSIDE_RANGE_167_178 {
                DENSITY CHIP < 0 [BUMP_PITCH - 167 ]
                DENSITY CHIP >= 0 [BUMP_PITCH - 178 ]
                }
                #ENDIF

                 

                Thanks,

                Pradip