Home > Community > Forums > Custom IC SKILL > Help regarding pop-push of a LIST

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

 Help regarding pop-push of a LIST 

Last post Wed, Mar 13 2013 10:14 PM by Neeraj Vardhan. 37 replies.
Started by Neeraj Vardhan 04 Mar 2013 08:09 PM. Topic has 37 replies and 2947 views
Page 1 of 3 (38 items) 1 2 3 Next >
Sort Posts:
  • Mon, Mar 4 2013 8:09 PM

    Help regarding pop-push of a LIST Reply

    Hi,

    I was trying to save my path coordinates as a list. But when i was trying to print the list of points, got errors "unbound variable-plist" . the code is mentioned below.

     

    procedure(nvToGetMyLocation()

    let((point plist)

    cvw=getCurrentWindow()

    point=hiGetPoint(cvw)

    plist=append(plist list(point))

    print(point)

    print(plist)

    ); let

    ); procedure_nvToGetMyLocation

     

    • Post Points: 20
  • Mon, Mar 4 2013 8:45 PM

    • skillUser
    • Top 10 Contributor
    • Joined on Fri, Sep 19 2008
    • Austin, TX
    • Posts 2,574
    • Points 15,670
    Re: Help regarding pop-push of a LIST Reply

    Hi Neeraj,

    I can't test your code right now, but one thing that springs to mind is that plist is a function, and possibly a special variable... As I read your code I don't see anything that would cause plist to be undefined - it is declared in the let statement, so it should always have a value in that scope, at the very least it would be nil.

    Try using a different name for the variable...

    Hope this helps,

    Lawrence. 

    • Post Points: 20
  • Mon, Mar 4 2013 8:55 PM

    Re: Help regarding pop-push of a LIST Reply
    Hi lawrence,

    I tried with different variable name, and got the below error. Hope i am doing some mistake as there are other functions too in this code.

    3.965 6.48)((3.965 6.48))
    (6.61 6.51)((6.61 6.51))
    (6.47 5.21)((6.47 5.21))
    (3.7 5.055)((3.7 5.055))
    (2.345 6.535)((2.345 6.535))
    (2.79 5.72)((2.79 5.72))
    s
    *Error* toplevel: undefined variable - s

    Neeraj
    • Post Points: 20
  • Tue, Mar 5 2013 4:59 AM

    Re: Help regarding pop-push of a LIST Reply

    I'm guessing that your code cannot be what you've posted, because that works fine. There's nothing wrong with it (well, apart from you using the obsolete getCurrentWindow() rather than hiGetCurrentWindow() - but that shouldn't cause any problems).

    Have you really loaded that version of the code? Or maybe your real code is more complicated than what you've posted?

    Regards,

    Andrew.

    • Post Points: 20
  • Tue, Mar 5 2013 5:56 AM

    Re: Help regarding pop-push of a LIST Reply

    I was trying to upload the code from morning, but failed to upload... below is the code i am  working on

    procedure(nvMyDirection()

    let((xy1 xy2 x1 x2 y1 y2)

    i=0

    for(i 1 n

    xy1=nth(i p_list)

    xy2=nth((i+1) p_list)

    x1=xCoord(xy1)

    y1=yCoord(xy1)

    x2=xCoord(xy2)

    y2=yCoord(xy2)

     

    if(x2-x1>0 && y2-y1 == 0 then print("RIGHT"))

    if(x2-x1<0 && y2-y1 == 0 then print("LEFT"))  

    if(y2-y1>0 && x2-x1 == 0 then print("TOP"))

    if(y2-y1>0 && x2-x1 == 0 then print("BOTTOM"))

    print(xy1)

    print(xy2)

    print(x1)

    print(x2)

    ) ; for

    ) ; let

    ) ; procedure_nvMyDirection

     

    procedure(nvGetMyLayer()

    let((layer cur_layer)

    layer=leGetEntryLayer()

    cur_layer=append(cur_layer list(layer))

    ); let

    ); procedure_nvGetMyLayer

     

    procedure(nvGetMyLocation()

    n++

    prog((p_curt p_list)

    cvw=getCurrentWindow()

    p_curt=hiGetPoint(cvw)

    p_list=append(p_list list(p_curt))

    print(p_curt)

    print(p_list)

    ); let

    ); procedure_nvGetMyLocation 

    • Post Points: 20
  • Tue, Mar 5 2013 6:05 AM

    Re: Help regarding pop-push of a LIST Reply

    Not clear what your problem is now - please elaborate. You have four separate functions there, which are variously referring to global variable. For example, nvGetLocation is referring to a variable n which would need to be defined. nvMyDirection is referring to global variable p_list (which is not the same as the variable p_list in nvGetMyLocation, since that is local to the prog() call within that function).

    So what are you calling, and what is happening that is not what you expect?

    Regards,

    Andrew.

    • Post Points: 20
  • Tue, Mar 5 2013 6:18 AM

    Re: Help regarding pop-push of a LIST Reply
    "3.965 6.48)((3.965 6.48)) (6.61 6.51)((6.61 6.51)) (6.47 5.21)((6.47 5.21)) (3.7 5.055)((3.7 5.055)) (2.345 6.535)((2.345 6.535)) (2.79 5.72)((2.79 5.72))   error* toplevel: undefined variable - p_list"  this is the error its pouping up . And when i tried to print p_list it didnt return the list of points, insted it gave undefined variable-p_list
    • Post Points: 20
  • Tue, Mar 5 2013 6:26 AM

    Re: Help regarding pop-push of a LIST Reply

    Yes, but what functions are you running? 

    If you're calling nvGetMyLocation() (assuming you have a variable n defined), then p_list will be set within that function, but will be discarded (and hence no longer defined) after the prog() has finished. So if you're then trying to look at p_list in the CIW, it will be undefined - hardly surprising since it is a local variable. Similarly if you call nvMyDirection() it will be looking for a global variable p_list, which won't be defined. If it was, then it could compute local variables xy1, xy2, x1, x2 (which are defined in the let()), but these will be thrown away when the let() exits and hence when nvMyDirection exits. If you then call nvMyPath, it won't know what xy1 and xy2 are - plus the fact that the code is wrong in this function because the list of points is improperly specified.

    So PLEASE explain what you're doing. Nobody can debug by reading your mind!

    Regards,

    Andrew.

    • Post Points: 20
  • Tue, Mar 5 2013 6:46 AM

    Re: Help regarding pop-push of a LIST Reply
    i am trying to create an auto_route function. For that, first i am saving my start and end points of the metal paths. So for that i started making a list of points with in p_list. And then accessing it later to create the path and vias. The direction will help me the VIA placement, so that it dont create a notch. I am just trying but it started failing from yesterday. when i started writing the rest of the code.. Regards Neeraj
    • Post Points: 20
  • Tue, Mar 5 2013 6:50 AM

    Re: Help regarding pop-push of a LIST Reply

    Neeraj,

    OK, but you still haven't said which functions you are calling, and in what order. In other words, the sequence of events that led to the error you saw.

    Regards,

    Andrew.

    • Post Points: 20
  • Tue, Mar 5 2013 7:07 AM

    Re: Help regarding pop-push of a LIST Reply
    i am using these key one by one to get the location and the entry layer at that moment.


    hiSetBindKey("Layout" "<key>1" "nvGetMyLocation() nvGetMyLayer() leSetEntryLayer(\"M1\")")
    hiSetBindKey("Layout" "<key>2" "nvGetMyLocation() nvGetMyLayer() leSetEntryLayer(\"M2\")")
    hiSetBindKey("Layout" "<key>3" "nvGetMyLocation() nvGetMyLayer() leSetEntryLayer(\"M3\")")
    hiSetBindKey("Layout" "<key>4" "nvGetMyLocation() nvGetMyLayer() leSetEntryLayer(\"M4\")")
    hiSetBindKey("Layout" "<key>5" "nvGetMyLocation() nvGetMyLayer() leSetEntryLayer(\"M5\")")
    hiSetBindKey("Layout" "<key>6" "nvGetMyLocation() nvGetMyLayer() leSetEntryLayer(\"M6\")")
    hiSetBindKey("Layout" "<key>7" "nvGetMyLocation() nvGetMyLayer() leSetEntryLayer(\"M7\")")
    hiSetBindKey("Layout" "<key>8" "nvGetMyLocation() nvGetMyLayer() leSetEntryLayer(\"M8\")")
    hiSetBindKey("Layout" "<key>e" "nvGetMyLocation() nvMyDirection()")

    Regards
    Neeraj</key></key></key></key></key></key></key></key></key>
    • Post Points: 20
  • Tue, Mar 5 2013 8:44 AM

    • theopaone
    • Top 75 Contributor
    • Joined on Tue, Feb 12 2013
    • Cedar Park, TX
    • Posts 85
    • Points 1,230
    Re: Help regarding pop-push of a LIST Reply

    As Andrew said, nvMyDirection is not going to execute because p_list is a local variable in nvGetMyLocation. That is what the declaration in the prog statement does. The value is only available within the dynamic scope of the function (the function and all it the functions it calls). The variable does not exist at the interpreter level of when inside nvMyDirection. I would probably return the value from nvGetMyLocation and use that as the input to nvMyDirection.

     Look at your print values. Each one is the point and the a list containing only that point. There is nothing accumulating the data. It is better to use println or printf( "%L\n" ...) for your print statement so it will print on each line.

    Also, n (in the n++ statement) is a global variable.

    Ted

    • Post Points: 20
  • Tue, Mar 5 2013 9:16 AM

    Re: Help regarding pop-push of a LIST Reply

    I tried one of your bindkeys, and I get (not surprisingly):

    *Error* eval: unbound variable - n

    If I then type "n=0" in the CIW, the bindkey then works - it just prints the coordinates of the cursor in the CIW.

    So it's still not producing the error you say. I see no reason why it should - but I would expect that you'd get that error if you called nvMyDirection(), but you didn't say that you were calling that.

    It sounds as if you're lacking some basic understanding on variable scoping. I'd suggest that you read the SKILL Language User Guide which is an introduction to the SKILL Language.

    Kind Regards,

    Andrew.

    • Post Points: 20
  • Tue, Mar 5 2013 6:42 PM

    Re: Help regarding pop-push of a LIST Reply

    Hi Andrew and Ted, thanks a lot for the help. Andrew, i went through the manual yesterday. I got why i was facing problem. 

    Regards

    Neeraj 

     

    • Post Points: 5
  • Tue, Mar 5 2013 10:02 PM

    Re: Help regarding pop-push of a LIST Reply
    Hi, This is not related to this topic, but i would like to know is there any function which could fetch me the current width of path. Regards Neeraj
    • Post Points: 20
Page 1 of 3 (38 items) 1 2 3 Next >
Sort Posts:
Started by Neeraj Vardhan at 04 Mar 2013 08:09 PM. Topic has 37 replies.