• 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. Scope of effect of the syntax desVar("")

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 143
  • Views 1648
  • 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

Scope of effect of the syntax desVar("")

ExcaIibur
ExcaIibur over 4 years ago

I have a function that is partitioned as following and during debugging of the pre-run script, I noticed that the scope of effect of the syntax desVar("") is not what I expected and remains unclear to me.

;main()

code=1;

while (target not met)

     procedure_measure_analog_metric("A")

     printf("current code is %L\n" evalstring(desVar("code")))

     code_next = 2*code;

     desVar("code" code_next)

     code= code_next

      printf("next code is %L\n" evalstring(desVar("code")))

;==========================================

;procedure_measure_analog_metric(net_name)

ocnxlLoadCurrentEnvironment( ?noAnalysis t)
ocnxlSetCalibration()

analysis('ac ?start "10k"  ?stop "1G"  ?dec "5"  )

printf("code inside sub-proc is: L\n" evalstring(desVar("code_rf1")))

ocnxlRunCalibration()

if(net_name=="A")

then

    SimResult = ymax(vfreq('ac "A"))

else if(net_name=="B")

then

    SimResult = ymax(vfreq('ac "B"))

))

;========================

The outputs I get are: 

current code is: 1

next code is: 2

code inside sub-proc is: 1

What I expected are: 

current code is: 1

next code is: 2

code inside sub-proc is: 2

It looks like desVar("var_name" var_value) is only effective until another ocnxlLoadCurrentEnvironment() and/or ocnxlSetCalibration() is declared.

My question is:
1. If so, what is the correct syntax to extend the value of code_next into the sub proc?
2. When my scenario is I need to calibrate analog performance a,b,c,d,.etc, but all the analysis are the same (i.e. analysis type, nr. of points. .etc). Then, can I just use one set of ocnxlLoadCurrentEnvironment() and ocnxlSetCalibration() at the top of my main script, followed by multiple ocnxlRunCalibration() that are splitted inside loops, and eventually ended by ocnCloseSession() at the end of my main script?

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 4 years ago

    The simplest approach would be to make your function do something like this:

    procedure(procedure_measure_analog_metric(net_name @optional code)
    let((SimResult)

      ocnxlLoadCurrentEnvironment( ?noAnalysis t)
      ocnxlSetCalibration()

      analysis('ac ?start "10k"  ?stop "1G"  ?dec "5"  )

      when(code
        desVar("code_rf1" code)
      )

      printf("code inside sub-proc is: L\n" evalstring(desVar("code_rf1")))

      ocnxlRunCalibration()

      if(net_name=="A")

      then

          SimResult = ymax(vfreq('ac "A"))

      else if(net_name=="B")

      then

          SimResult = ymax(vfreq('ac "B"))

      )
      ; return the result
      SimResult
    )

    Then in the main code:

    code=1;

    while (target not met)

         result=procedure_measure_analog_metric("A" code)

         printf("current code is %L\n" code)

         code_next = 2*code;

         code= code_next

          printf("next code is %L\n" code)

    Andrew

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • ExcaIibur
    ExcaIibur over 4 years ago in reply to Andrew Beckett

    Thanks Andrew for the idea. That can work.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • ExcaIibur
    ExcaIibur over 4 years ago in reply to Andrew Beckett

    Thanks Andrew for the idea. That can work.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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