Home > Community > Forums > Custom IC Design > function call is some how retaining previous call values in SKILL

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

 function call is some how retaining previous call values in SKILL 

Last post Mon, Feb 25 2013 12:01 AM by RFStuff. 8 replies.
Started by RFStuff 22 Feb 2013 01:52 AM. Topic has 8 replies and 1067 views
Page 1 of 1 (9 items)
Sort Posts:
  • Fri, Feb 22 2013 1:52 AM

    • RFStuff
    • Top 25 Contributor
    • Joined on Tue, Feb 5 2013
    • Posts 227
    • Points 3,995
    function call is some how retaining previous call values in SKILL Reply

     Dear All,

    I am calling function as below:-

           guardring(L_cell W_cell clearance W_guard Space_NTAP_PATAP First_type_tap).

          When I call second time this function in CIW, it some how retaining the previous call vlaues. So the outcome result is wrong.

           However when I call it 2nd time it gives me dsired result. It looks like the variable is NOT prempted after function call is over.

       Can anybody please tell why it happening. It looks like to me a file open/close problem.

    My code is as below:

    procedure( guardring(L_cell W_cell clearance W_guard Space_NTAP_PATAP First_type_tap)
    xPitch=0.16+0.2
    yPitch=0.16+0.2
    ;row=5
    ;column=20

        if( (First_type_tap=="N") then

            ; For Creating  NTAP
             
                NTAP_CONT_NO_IN_THICKNESS=car(guardtapsize( (W_guard+0.64) "NTAP" ))
                    printf("NTAP_CONT_NO_IN_THICKNESS=%d",NTAP_CONT_NO_IN_THICKNESS)
                NTAP_THICKNESS= (NTAP_CONT_NO_IN_THICKNESS*0.36) +0.56
                printf("NTAP_THICKNESS=%f\n",NTAP_THICKNESS)
                NTAP_LENGTH=(2*(NTAP_THICKNESS+clearance))+L_cell
                NTAP_CONT_NO_IN_LENGTH=car(guardtapsize( NTAP_LENGTH "NTAP" ))
                NTAP_LENGTH= (NTAP_CONT_NO_IN_LENGTH*0.36) +0.56
                printf("NTAP_LENGTH=%f",NTAP_LENGTH)
                row=NTAP_CONT_NO_IN_THICKNESS
                column=NTAP_CONT_NO_IN_LENGTH
                xOffset=0
                yOffset=0
            guardlayercreate( "NTAP" xPitch yPitch row column xOffset yOffset "Y" )
               ...................................................................



     ....................................................................

    ) /*End of procedure*/  

    procedure( guardtapsize( width type )
                 ;declare(a[2])
                 if( (type=="NTAP") then

                   
                 N_width=  ceiling(((width-0.56)/0.36))
                 ;actual_width=( (N_width*0.36) +0.56)
                     printf("N_width=%d\n",N_width)
                         ;printf("actual_width=%f\n",actual_width)
                         ;a[0]=N_width
                         ;a[1]=actual_width
                else
                         
                  N_width=  ceiling(((width-0.24)/0.36))
                  ;actual_width=( (N_width*0.36) +0.24)
                          printf("N_width=%d\n",N_width)
                      ;printf("actual_width=%f\n",actual_width)
                          ;a[0]=N_width
                          ;a[1]=actual_width
                 )
                   list(N_width)    
              )

    • Post Points: 20
  • Fri, Feb 22 2013 2:37 AM

    Re: function call is some how retaining previous call values in SKILL Reply

    Your code above seems to have changed since the email you sent - but either way it's hard to tell because the code is not complete, nor did you give an example of what actually happens that is wrong.

    Your code is full of global variables - maybe you're using a global variable before it is defined (in some cases?) - nothing leaps out from the segment of the code you posted.  You should really use let() within the procedures to define local variables. I'd suggest running your code through SKILL Lint in the SKILL Development Tools (from the CIW Tools menu).

    Andrew.

    • Post Points: 20
  • Sat, Feb 23 2013 9:39 PM

    • RFStuff
    • Top 25 Contributor
    • Joined on Tue, Feb 5 2013
    • Posts 227
    • Points 3,995
    Re: function call is some how retaining previous call values in SKILL Reply

    Dear Andrew,

    Sorry, I did some mistakes in the code. After fixing them the issue got resolved though it was not pertaing to Global/Local variable type.

    Since you have pointed out about the variable types, it creats some ambiguities for me.

    1) : It looks like SKILL does not require special command for Global variables rather it requires for loacal variable

          Suppose a function is as follows:

                    procedure( funct(x,y))


                        a=x

                       b=y

                      c=a+b

                   )

                c is a global variable.

              After calling this function in CIW funct(2,3), if I type a= , I should get a=2, if I type c= , I should get c=5

             But I am NOT getting it

    2)   SKILL Lint in the SKILL Development Tools (from the CIW Tools menu) has many options, is tere any document which tells how to use it

    Kind Regards

                                           

     

    • Post Points: 20
  • Sun, Feb 24 2013 2:48 AM

    Re: function call is some how retaining previous call values in SKILL Reply

    Well, your function has an extra close parenthesis on the first line (so maybe that's your problem?). 

    Also, to see the values of the variables in the CIW you would not type "a=", but just "a". If you type "a=" you've entered a half-completed assignment statement... (I'd also recommend that you don't use commas between arguments; whilst it works, it's not documented behaviour I believe. Arguments are supposed to be white-space separated).

    Note that if the function was defined in a file with a ".ils" suffix, then it's interpreted with SKILL++ semantics and so the global variables would not be visible in the CIW (but they are still global) unless you use toplevel('ils) - but I doubt that's what you've done.

    For SKILL Lint, the easiest is to hit the "Help" button on the SKILL Lint form (I do wonder why people don't do that). Or you could search the documentation... But if that's too tricky, then it's in the "Cadence SKILL Development Help" manual. Most of the options you wouldn't need except for more esoteric cases - usually just the filename is sufficient.

    Regards,

    Andrew.

    • Post Points: 35
  • Sun, Feb 24 2013 5:29 PM

    • theopaone
    • Top 100 Contributor
    • Joined on Tue, Feb 12 2013
    • Cedar Park, TX
    • Posts 77
    • Points 1,160
    Re: function call is some how retaining previous call values in SKILL Reply

     Most interpreted languages require you to declare your local variables. There are several differences with SKILL. In SKILL, an undeclared variable is retained in memory after the function has completed so therefore it becomes a global variable. Also, in SKILL but not SKILL++, the variable is dynamically scoped. If the variable is used in a called function and is not declared local to that subroutine, you are using, and messing with, the value of the variable from the calling function. Declared variables in SKILL++ are lexically scoped, they only have a value within their own function.

     Ted

    • Post Points: 5
  • Sun, Feb 24 2013 9:23 PM

    • RFStuff
    • Top 25 Contributor
    • Joined on Tue, Feb 5 2013
    • Posts 227
    • Points 3,995
    Re: function call is some how retaining previous call values in SKILL Reply

    Dear Andrew,

    You are right. I am using .ils file. So the global variables wwere not visible.

    Kind Regards,

    • Post Points: 20
  • Sun, Feb 24 2013 9:24 PM

    • RFStuff
    • Top 25 Contributor
    • Joined on Tue, Feb 5 2013
    • Posts 227
    • Points 3,995
    Re: function call is some how retaining previous call values in SKILL Reply

     Dear Ted,

    Thanks a lot.

    Kind Regards,

     

    • Post Points: 5
  • Sun, Feb 24 2013 11:05 PM

    Re: function call is some how retaining previous call values in SKILL Reply
    Note that they are still global though. Any other code in SKILL++ would also be able to see these global variables. Or if you typed inScheme(a) in the CIW you'd see them too.

    Andrew
    • Post Points: 20
  • Mon, Feb 25 2013 12:01 AM

    • RFStuff
    • Top 25 Contributor
    • Joined on Tue, Feb 5 2013
    • Posts 227
    • Points 3,995
    Re: function call is some how retaining previous call values in SKILL Reply

     Thanks Andrew.

     

    • Post Points: 5
Page 1 of 1 (9 items)
Sort Posts:
Started by RFStuff at 22 Feb 2013 01:52 AM. Topic has 8 replies.