I would like to change the value variable (global or local to a test) every time a given test runs.
I have created a local variable (numOfRuns), which is initialised to zero. Every time the test is run, the variable should be incremented by 1.
Later, I will the use this value to be included into the expressions I have created in the "outputs setup" tab.
Thanks in advance.
Not sure off the top of my head how easy this is to do (or even if it's possible - although that may dependent upon your precise requirements). My first question would be why you would want this? It seems a bit unusual...
The second question would be whether you want it to increment each time you hit the run button, or per actual simulation point (so if you do sweeps and/or corners, should it increment then too)?
Thanks for your reply.
I agree, that what I am trying to do is bit weird.
So, please, let me explain it better.
I have a test that I want to run in a loop until a condition is met. I really don't know how to do this, apart from using the "Run Plan", place there many instances of the same test and set a stop condition. Please notice, that no simulation must not be run, after the condition is valid.
Please, imagine that I am trimming a circuit and the initial value should be hard-coded by the user. Let's say that I have a variable that is called preTrimValue and another one called trimmedValue.
The first one should be hard-coded by the user, in the global variables or in the local variables for the test and the second is obtained as a result from running the test.
For example, for "preTrimValue" the user enters the number 7. The simulation will grab that value and do all the calculations and obtain, let's say, a code of 10. As I want a variation of +- 0/5LSB, the circuit must be trimmed again, BUT now the preTimValue variable should get its value from "trimmedValue".
So difficult part for me, is that I want to run the test in a loop and, the first time it runs, it must get the values from the global variables but on the next iterations should get the values from the trimmedValue.
So, I came up with this:
1 - I created a global variable called "run" which starts with number 0.
2 - An expression checks if the number is zero and, if it is, it will grab the hard-coded values by the user, otherwise will use a calcVal command to get the codes from trimmedValue.
3 - Every time a simulation is run, the "run" variable is incremented by 1 using maeSetVar.
This will be done across corners, but the variable will be incremented only, when the test runs again.
Maybe I came with a solution which is a bit cumbersome, but it made sense to me by then.
OK, it sounds as if you should be using a "pre-run script" that is available in ADE Assembler (or ADE XL). You can enable this for a test by using the Right Mouse menu over the test name, and even create the sample script.
It's covered in more details in this Rapid Adoption Kit: Techniques for Simulating Calibrated Circuits with Virtuoso ADE Assembler
With pre-run scripts you can (for example) do a successive approximation approach or binary chop to find your best trimming code - more details in the RAK.
Thanks Andrew, I will run that RAK.