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?