• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. Problems with unbound variables inside skill procedure in...

Stats

  • Locked Locked
  • Replies 8
  • Subscribers 144
  • Views 23458
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problems with unbound variables inside skill procedure in interactive ocean

angelmariag
angelmariag over 13 years ago

 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

  • Cancel
  • angelmariag
    angelmariag over 13 years ago

     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.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 13 years ago

    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.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • angelmariag
    angelmariag over 13 years ago

    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

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • insaf
    insaf over 11 years ago

    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 

     

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    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.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • insaf
    insaf over 11 years ago

    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 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    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 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • insaf
    insaf over 11 years ago

    Andrew, 

    thanks a lot Andrew for this explanation :) 

    Best regards,

    Insaf  

      

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information