Home > Community > Forums > Custom IC SKILL > Problems with unbound variables inside skill procedure in interactive ocean

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

 Problems with unbound variables inside skill procedure in interactive ocean 

Last post Wed, Apr 23 2014 12:24 AM by insaf. 8 replies.
Started by angelmariag 19 Oct 2011 03:28 PM. Topic has 8 replies and 3400 views
Page 1 of 1 (9 items)
Sort Posts:
  • Wed, Oct 19 2011 3:28 PM

    Problems with unbound variables inside skill procedure in interactive ocean Reply

     Hello all,

    I have the following issue: I am trying to run an ocean script (diffopamp.ocn) inside an interactive session in a linux shell.

    The ocean script diffopamp.ocn have the lines:

    load("skillafv.il")

    AFVtestInit( "./SPECS/CmirDiffAmp4.spec")

     

     And the script skillafv.il has the procedure:

    procedure(AFVtestInit(file "t")
    let((ps line key (fp infile(file)) (count 0))
    AnalogTests = ’unbound
    AnalogTests = makeTable(’AnalogTests nil)
    if(fp then
    while((line=lineread(fp))
    println(line)
    count++
    ;;AnalogTests is equivilent to a record which is indexed on a key
    ;; that contains a value and two other fields, pass and fail
    ;; value@keyslot pass fail
    ps = line
    when(length(ps) < 3
    printf("Field formats are:\n testkey m value\n testkey x value\n
    testkey r lowerLimit upperLimit\n")
    printf("Where testkey is the name of the test.\n character m means
    minimum value\n character x means maximum value\n character r means range of
    2 values\n")
    error("Test specification requires THREE or more fields; line %d\n
    contains %s\n"
    count line)
    )
    key = get_pname(car(ps))
    AnalogTests[key] = tconc(AnalogTests[key] get_pname(cadr(ps)))
    AnalogTests[key] = lconc(AnalogTests[key] cddr(ps))
    AnalogTests[key] = lconc(AnalogTests[key] list(0))
    AnalogTests[key] = lconc(AnalogTests[key] list(0))
    AnalogTests[key] = lconc(AnalogTests[key] list(0))
    ;;this gets the tconc formatted list and stuffs it in the table
    AnalogTests[key] = car(AnalogTests[key])
    )
    else
    error("Cannot OPEN file %s \n" file)
    )
    )
    )

     When I load the ocean script inside the CIW session using: load("diffopamp.ocn") there are no issues, and I can execute the procedure inside the skill script. But when I tried to use an interactive session called in a unix shell, and after typing:

    ocean>load("diffopamp.ocn")

     I got the error:

    *Error* eval: unbound variable - AnalogTests

    Can somebody please help me? 

    Best Regards,

    Angel

    • Post Points: 5
  • Wed, Oct 19 2011 4:19 PM

    Re: Problems with unbound variables inside skill procedure in interactive ocean Reply

     Hi all,

    I finished finding the issue. I had copied the original script from a pdf tutorial and for some reason the line:

    AnalogTests = makeTable('AnalogTests nil) was having some issue. Not sure what, but after typing the lines manually on the batch mode I found that the line has an issue. I basically edited the original script typing again the line and voila!! Now it is working.

    SOLVED.

    • Post Points: 20
  • Thu, Oct 20 2011 1:42 AM

    Re: Problems with unbound variables inside skill procedure in interactive ocean Reply

    I suspect there was some strange control character on the line. Doing "cat -vet file.il" would show anything abnormal.

    By the way, there's no need for the line:

    AnalogTests = ’unbound

    before the assignment - it is completely superflous.

    Andrew.

    • Post Points: 35
  • Thu, Oct 20 2011 12:54 PM

    Re: Problems with unbound variables inside skill procedure in interactive ocean Reply

    Thanks a lot Andrew !!!

    I copied again the original text from the pdf and after typing the command that you suggested:

    "cat -vet sillafv.il"

    This was the output:

    procedure(AFVtestInit(file "t")$
    let((ps line key (fp infile(file)) (count 0))$
    AnalogTests = M-bM-^@M-^Yunbound$
    AnalogTests = makeTable(M-bM-^@M-^YAnalogTests nil)$

    if(fp then$
    while((line=lineread(fp))$
    println(line)$
    count++$
    ;;AnalogTests is equivilent to a record which is indexed on a key$
    ;; that contains a value and two other fields, pass and fail$
    ;; value@keyslot pass fail$
    ps = line$
    when(length(ps) < 3$
    printf("Field formats are:\n testkey m value\n testkey x value\n$
    testkey r lowerLimit upperLimit\n")$
    printf("Where testkey is the name of the test.\n character m means$
    minimum value\n character x means maximum value\n character r means range of$
    2 values\n")$
    error("Test specification requires THREE or more fields; line %d\n$
    contains %s\n"$
    count line)$
    )$
    key = get_pname(car(ps))$
    AnalogTests[key] = tconc(AnalogTests[key] get_pname(cadr(ps)))$
    AnalogTests[key] = lconc(AnalogTests[key] cddr(ps))$
    AnalogTests[key] = lconc(AnalogTests[key] list(0))$
    AnalogTests[key] = lconc(AnalogTests[key] list(0))$
    AnalogTests[key] = lconc(AnalogTests[key] list(0))$
    ;;this gets the tconc formatted list and stuffs it in the table$
    AnalogTests[key] = car(AnalogTests[key])$
    )$
    else$
    error("Cannot OPEN file %s \n" file)$
    )$
    )$
    )$
     

    And yes, even when I was not seeing the strange control characters on the file, there were there and with the command now I can see that they are there (curiously inside the CIW, there was no issue):

     AnalogTests = M-bM-^@M-^Yunbound$
    AnalogTests = makeTable(M-bM-^@M-^YAnalogTests nil)$

    Thanks a lot again, and I am going to follow your suggestion about the superflous line.

    Angel

    • Post Points: 5
  • Tue, Apr 22 2014 1:16 AM

    • insaf
    • Not Ranked
    • Joined on Tue, Apr 22 2014
    • Posts 6
    • Points 75
    Re: Problems with unbound variables inside skill procedure in interactive ocean Reply

    Hi Andrew,

    I see that you are an active member in many forums and i hope you can help me to solve my issue.

    I have developed a script containing the following procedures ( i created a Matrice with i lines and j columns using Tables ) 

    procedure( Storage_Results(i lifetime Unit_lifetime VT deltaVT gm_max vargm id0_sat varid0 Id1_lin varId1) 

    V = vector(sprintf(lifetime "%f" lifetime) Unit_lifetime desVar("Vdd") desVar("Vg") sprintf(VT "%f" VT) sprintf(deltaVT "%f" deltaVT) sprintf(gm_max "%f" gm_max) sprintf(vargm "%f" vargm) sprintf(id0_sat "%f" id0_sat) sprintf(varid0 "%f" varid0) sprintf(Id1_lin "%f" Id1_lin) sprintf(varId1 "%f" varId1))  

    myTable[i] = makeTable("table" 0)

    for(j 0 length(V)-1  

    setarray(myTable[i] j V[j]))

    ); end procedure

    procedure( Display_Results(i)

    for( j 0 length(myTable[i])-1

    fprintf( myport "      %s     " myTable[i][j]))

    fprintf( myport "\n")

    ); end procedure 

     And i have the same problem of  angelmaria. when i loaded my script, i got this error "*Error* eval: unbound variable - myTable"  Knowing that at first it works many times then it does not without changing any thing in my script. 

    so i tapped again the line (myTable[i] = makeTable("table" 0)) as angelmaria did. But this trick works sometimes not often. 

     i also did (cat -vet myscript_09.il) to show anything abnormal. and i removed all the strange control characters. but this didn't resolve my problem. 

    So, can you tell me what can i do please.

    thank you alot in advance.

    Best regards

    insaf 

     

     

    • Post Points: 20
  • Tue, Apr 22 2014 9:00 AM

    Re: Problems with unbound variables inside skill procedure in interactive ocean Reply

    Insaf,

    The forum guidelines ask you not to append on the end of old threads, and this isn't really related to the previous post. It's unlikely to be anything to do with strange characters in your code.

    My assumption is that you've never defined myTable anywhere. Inside Storage_Results, it's doing myTable[i]=... and so this is trying to store a new table into the index "i" of myTable. Somewhere you'll need to initialize myTable by doing (for example):

    myTable=makeTable("table" 0)

    Regards,

    Andrew.

    • Post Points: 20
  • Tue, Apr 22 2014 10:01 AM

    • insaf
    • Not Ranked
    • Joined on Tue, Apr 22 2014
    • Posts 6
    • Points 75
    Re: Problems with unbound variables inside skill procedure in interactive ocean Reply

    Andrew,

    ok thank you for your information. I'm a new member here and i don't know the forum guidelines.

    thank you very much again for your usuful response. it seems to be working.

    I don't understand yet why it's working sometimes without initialized myTable. However, that's not important anyway.

    Best regards,

    Insaf 

    • Post Points: 20
  • Tue, Apr 22 2014 10:27 AM

    Re: Problems with unbound variables inside skill procedure in interactive ocean Reply

    Insaf,

    If you look at the list of posts in each forum (at least in the custom IC, RF and mixed signal forums) you'll see that the topmost post covers the guidelines. 

    As for how this can work sometimes and not others, it can only be because the variable is being initialised somewhere. Given that the variable is a global variable, maybe it is in somebody else's code and you're dependent upon whether that other code has been run. The dangers of global variables...

    Andrew 

    • Post Points: 20
  • Wed, Apr 23 2014 12:24 AM

    • insaf
    • Not Ranked
    • Joined on Tue, Apr 22 2014
    • Posts 6
    • Points 75
    Re: Problems with unbound variables inside skill procedure in interactive ocean Reply

    Andrew, 

    thanks a lot Andrew for this explanation :) 

    Best regards,

    Insaf  

      

    • Post Points: 5
Page 1 of 1 (9 items)
Sort Posts:
Started by angelmariag at 19 Oct 2011 03:28 PM. Topic has 8 replies.