Product Documentation
Virtuoso ADE SKILL Reference
Product Version IC23.1, November 2023

calcVal

calcVal(
t_outputName
[ t_testName ]
[ ?cornerName t_cornerName ]
[ ?historyName t_historyName ]
[ ?lib t_libName ]
[ ?cell t_cellName ]
[ ?view t_viewName ]
[ ?run t_runName ]
[ ?result t_resultName ]
[ ?getFirstSweepPoint t_getFirstSweepPoint ]
[ ?ignoreParams g_ignoreParams ]
[ ?matchParams g_matchParams ]
[ ?defaultVal t_defaultVal ]
[ ?relxName t_relxName ]
[ ?ageValue t_ageValue ]
[ ?ageUnit t_ageUnit ]
[ ?she g_she ]
)
=> g_output / nil

Description

Returns the value of an output from the same or another test. You can use the value returned by this function in another output expression.

Arguments

t_outputName

Name of the output or expression. The output can return a scalar value or waveform. To retrieve the value of an output of type signal, the simulation waveform results must be saved.

Limitation:

calcVal supports waveform outputs in expressions, but it does not support waveforms outputs used in subexpressions.

For example, the following calcVal expression returns a good result :

a=calcVal("b" "test1") 
;   where, b=(VT("/out1") + 1)

The following calcVal expression returns an error:

c=calcVal("d" "test1")
;   where, d=(e + 1) and e=VT("/out1")

t_testName

Name of test name to which the given output belongs. When not specified, the name of the current test is used.

You do not need to provide this argument when using the calcVal expression for global variables.

For calcVal expressions that use the result of an output from another test, it is recommended to use outputs that return scalar values for better performance.

?cornerName t_cornerName

Name of the corner. When specified, the value of the given output for this corner is used. Name of a corner group cannot be used in this argument.

Do not use a SKILL expression to specify a corner name unless you are also using the ?historyName argument in the calcVal expression.

?historyName t_historyName

Name of the history from which the results are to be retrieved. When specified, the scalar or waveform result of the output from the given history is used. Otherwise, the value of the output from the current simulation run is used.

You can use the following wildcards to find a history saved for the given cellview:

  • <highest>: To match a history name that has the highest numerical value amongst all histories for which the name begins with the given prefix. For example, Interactive.<highest>.
  • <lowest>: To match a history name that has the lowest numerical value amongst all histories for which the name begins with the given prefix. For example, Interactive.<lowest>.
  • <latest>: To match the history name so that it is the latest amongst all histories for which the name matches the given pattern. The <latest> wildcard matches any substring. For example, Inter<latest> or <latest>ive.4.
  • <oldest>: To match the history name so that it is the oldest amongst all histories for which the name matches the given pattern. The <oldest> wildcard matches any substring. For example, Inter<oldest> or <oldest>ive.4.
  • <any>: To match a history name that begins with the given prefix followed by any substring. For example, Hist<any>3 would match a history name that begins with Hist and ends with 3.
  • <ro>: To match a history name irrespective of the .RO suffix. The editable or read-only status is ignored. For example, Interactive.4<ro> would match with Interactive.4 or Interactive.4.RO.

You can combine two or more wildcards, for example, In<any>.<highest><ro>. Ensure that the combination does not produce conflicting results. For example, avoid using <oldest> and <latest> together.

?lib t_libName

The library associated with the maestro cellview from where the results are to be retrieved.

This argument can be used only when the ?historyName argument is specified along with it. This ensures calcVal knows which history to retrieve the results from.

?cell t_cellName

The cell associated with the maestro cellview from where the results are to be retrieved.

This argument can be used only when the ?historyName argument is specified along with it. This ensures that calcVal knows which history to retrieve the results from.

?view t_viewName

The view associated the maestro cellview from where the results are to be retrieved.

This argument can be used only when the ?historyName argument is specified along with it.This ensures that calcVal knows which history to retrieve the results from.

?run t_runName

Name of the run plan from which the value of the given output is to be returned. This argument is useful only when the setup has a run plan.

Use this argument to get the value of an output from the results of one run (in the run plan) and use it in a variable, expression, or run condition for another run in the same run plan or history. It cannot be used to refer to the results of any other history. When both ?run and ?historyName are specified, ?historyName is ignored by calcVal.

The ?run argument is used only for a cellview created using ADE Assembler.

Also see: Using Results of One Run in Another

?result t_resultName

Name of an analysis from which the signal type output is to be to retrieved. When specified, returns a waveform for the corresponding output of that analysis. Use this argument only for the outputs of type signal.

The specified analysis must exist in the test along with the simulation waveform results in order for calcVal to return the expected result.

?getFirstSweepPoint t_getFirstSweepPoint

Specifies that when sweep values are used, the result of only the first swept point is to be used for calculation.

If ?cornerName is specified with this argument, the function retrieves the output value of the first swept point for the given corner. Otherwise, calcVal retrieves the results for all the corners set up for the test.

Default value: nil

?matchParams t_matchParams

Specifies the requirements to look for points that have matched variables and parameters in the current run and the source run. The source run can be of any other test in the current history, or the same or another test in another history specified by ?historyName.

Possible values:

  • "none": (Default value) Does not look for the matched variables and parameters. Instead, it uses the result value for the current data point if all data points in the source and target tests are same. Otherwise, calcVal returns nil.
  • "all": Matches each variable or parameter value in the current test with the variables and parameters of the source test. If an identical point is found, returns the required output value for that point. If no point with the same number and values of variables and parameters is found, returns nil.
  • A list containing a list of name-value pairs of the parameters to be matched: Compares the given variables and parameters. The list is given in the list(list(<param1> <val1>) list(<param2> <val2>) ...) format, where <valN> can be a constant or a value returned by a user-defined function. If the same variables and parameters are found with the given values in both source and target points, returns the value of the given output.

Important Points to Note

  • This argument considers the corners and sweep parameters in the same way.
  • If the ?getFirstSweepPoint argument is set to t, only the first parameter is compared.
  • Avoid setting ?matchParams as "none" when the tests contain local sweeps.
  • Escape the string values. Example, (list "trim" "\"b\"").
  • If no matching point is found, the function returns nil. If multiple matching points are found and each point belongs to a different corner, calcVal returns the value from the corner that has the same name as that of the current corner for which the function is being evaluated–this is called corner affinity. In all other cases, calcVal returns nil.

?ignoreParams g_ignoreParams

Ignores the specified parameters. For example, a local parameter value that is different in the source and the target test or a parameter whose value is a calcVal expression.

If a list of name-value pairs are specified for ?matchParams, the given parameters must match with the given value. Values of all other parameters should match with the values of corresponding parameters in the current point. If you want to consider only ?matchParams and ignore the rest of the variables and parameters that are not specified by ?matchParams, set ?ignoreParams to rest.

If the model files in the setup of the source and target tests are different and you want to ignore those while comparing setups, add modelFiles to the list specified for ?ignoreParams.

If ?ignoreParams is specifed without ?matchParams, the tool assumes ?matchParams to be set to all.

?defaultVal t_defaultVal

The default value to be returned if calcVal fails for any reason.

This is helpful when calcVal is used in an expression for a dependent output measurement, or in the input value for a test variable.

?relxName t_relxName

Name of the reliability setup to be used.

?ageValue t_ageValue

Specifies one of the following values:

  • Fresh: For the fresh stage
  • Stress: For stress stage
  • age_number: For aged stage (Aging simulation)
"age_number" specifies the age points at which the device degradation is calculated.

?ageUnit t_ageUnit

Specifies the unit for the age points.

Valid Values: yr, year, years, d, day, days, h, hour, hours, min, minute, minutes, sec, second, seconds.

Default Value: year

?she g_she

Boolean value to specify whether the self-heating effect is enabled.

Valid Values:

  • t: Self-heating effect is enabled
  • nil: Self-heating effect is disabled

Default Value: nil

Value Returned

g_output

Returns the value of the output.

nil

Returns nil if the function fails and the default value is not specified.

The function fails when the values specified for its arguments are not correct. For example, when the specified test, output expression, or corner is not found in the given history or when there is no history that matches the criteria set by the ?historyName argument.

Examples

In the following example, avg_vt represents the expression average(VT("/out")) and myTest is the test name:

calcVal("avg_vt" "myTest")

You can compute the value of an expression with reference to another expression from a different test, as shown below.

calcVal("output1" "test1")/calcVal("output2" "test3")

You can also use the output value for a corner, as shown below.

calcVal("Gain" "AC" ?cornerName "C2")

You can also use the output value from a history that has the highest numerical value suffixed with the history name Interactive, as shown below.

calcVal("Gain" "AC" ?historyName "Interactive.<highest>")

You can use the waveform from the result, as shown below.

calcVal("/OUT" "AC" ?result "ac")
=> srrWave:0x40421090

If you want to retrieve the value from only the first sweep point, you can use the ?getFirstSweepPoint argument. The following example will always return the first sweep point value of myCalib in the test calib_tb. This is useful if you run a sweep on the test where the calcVal expression is used but the source of the value myCalib is not swept.

calcVal("myCalib" "calib_tb"  ?getFirstSweepPoint t)

You can specify a default value that can be used when the result for the specified output is not found.

calcVal("Gain" "AC" ?cornerName "C2" ?defaultVal "1000")

The default value can also be used to show an error message when the result for the corner is not available.

calcVal("Gain" "AC" ?cornerName "C2" ?defaultVal "ERROR: Gain for C2 is not available")

You can retrieve the results from a nominal run. The following example would give an output, which is the ratio of the measured frequency of the specified corner to the frequency in the nominal run:

calcVal("Freq")/calcVal("Freq" ?cornerName "Nominal")

This example shows how ?matchParams works when multiple matching points are found and they belong to different corners.

The setup contains two tests, AC and TRAN, with multiple points and corners. The corners setup appears as shown below.

The test TRAN has an output GainVal with the calcVal expression shown below.

calcVal("Gain" "AC" ?matchParams "all")

The corners Nominal and C0 are identical, so calcVal evaluation for each point finds two corners in which all variables and parameters match. However, the calcVal expression is successfully evaluated only for Nominal.

For C0, it returns eval err because when ?matchParams is used, even though calcVal finds the matching point in multiple corners, it can use the value from a corner that has the same name as that of the corner for which the expression is being evaluated, which is C0 in this case. C0 is disabled for AC, so no value is returned for Gain. Therefore, the output returns an error. To return a value result for GainVal, you must enable C0 for AC.

More Examples Using ?matchParams

The following examples show how you can use the ?matchParams argument of calcVal. The base setup used in these examples is shown below.

This setup contains two tests, calib_tb and tank_tb.

If not overriding, these tests use four global variables: C0_cap, L0_ind, freq_target, and calibval. calibval contains an expression that uses the value of the myCalib output defined for the test calib_tb.

The VAR("calibval")output of test tank_tb returns the value of the calibval global variable, which saves the result of the calcVal function.

In the following example cases, you can observe the difference in the value of VAR("calibval")for different values of ?matachParam, and varying variables and parameters:

Case I: ?matchParams is set to the default value ("none"), the number of data points in the calibrated and target tests is same, and the swept variables and corners are identical

For each data point of tank_tb, there will be a valid value of the calibval global variable. Thus, calcVal returns a valid, non-nil value.

calib_tb

C0_cap=5p L0_ind=9n

C0_cap=5p L0_ind=11n

C0_cap=6p L0_ind=9n

C0_cap=6p L0_ind=11n

myCalib

198

4

99

-85

tank_tb

C0_cap=5p L0_ind=9n

C0_cap=5p L0_ind=11n

C0_cap=6p L0_ind=9n

C0_cap=6p L0_ind=11n

calibval

198

4

99

-85

In the case described above, the return value would be same if ?matchParams is set to "all" because the count and values of all variables and parameters match.

Case II: ?matchParams is set to the default value ("none"), the number of data points in the calibrated and target tests is same, but the values are different

In this example, ?matchParams is set to "none", but calcVal does not look for any matching variable because the setup contains local sweeps. As a result, for each point of tank_tb, calcVal returns nil.

calib_tb

C0_cap=5p L0_ind=9n

C0_cap=5p L0_ind=11n

C0_cap=6p L0_ind=9n

C0_cap=6p L0_ind=11n

myCalib

198

4

99

-85

tank_tb

C0_cap=5p L0_ind=9n

C0_cap=5p L0_ind=11n

C0_cap=11p L0_ind=9n

C0_cap=11p L0_ind=11n

calibval

nil

nil

nil

nil

In the case shown above, calcVal does not return valid results. Therefore, it is recommended to use ?matchParams set to "none" only when the tests do not have local sweeps, the count of the enabled sweep points and corners in the source and target test is same and they are identical.

In case II described above, if ?matchParams is set to "all" instead of "none", calcVal looks for matching variables and parameters in other points, and the results are different, as shown below.

calib_tb

C0_cap=5p L0_ind=9n

C0_cap=5p L0_ind=11n

C0_cap=6p L0_ind=9n

C0_cap=6p L0_ind=11n

myCalib

198

4

99

-85

tank_tb

C0_cap=5p L0_ind=9n

C0_cap=5p L0_ind=11n

C0_cap=11p L0_ind=9n

C0_cap=11p L0_ind=11n

calibval

198

4

nil

nil

Case III: ?matchParams is set to "all" and the target test has more data points than the calibrated test

calcVal does not find matching data points for some parameters. For those points, it returns nil, as shown below.

calib_tb

C0_cap=5p L0_ind=9n

C0_cap=5p L0_ind=11n

myCalib

198

4

tank_tb

C0_cap=5p L0_ind=9n

C0_cap=5p L0_ind=11n

C0_cap=6p L0_ind=9n

C0_cap=6p L0_ind=11n

calibval

198

4

nil

nil

Case IV: ?matchParams is set to list(list("L0_ind" "11n") list("C0_cap" "8p"))

In this case, calcVal looks for data points in the calibrated test that have parameters L0_ind=11n and C0_cap=8p. If found, the target test uses the value of the myCalib expression to get the value for calibval for all the points in the target test, as shown below.

calib_tb

C0_cap=5p L0_ind=9n

C0_cap=5p L0_ind=11n

C0_cap=8p L0_ind=9n

C0_cap=8p L0_ind=11n

myCalib

198

4

99

-85

tank_tb

C0_cap=8p L0_ind=9n

C0_cap=8p L0_ind=11n

C0_cap=6p L0_ind=9n

C0_cap=6p L0_ind=11n

calibval

-85

-85

-85

-85

Case V: ?matchParams is used with ?ignoreParams where ?matchParams is set to "all" and ?ignoreParams is set to list ("calibVal")

On using ?matchParams with ?ignoreParams, calcVal looks for matching data points but ignores the local sweep variable calibval that has different values in both the tests. The target test then uses the value of the myCalib expression to get the value for calcVal_withIgnore for all the points in the target test.

However, on setting ?matchParams to "all" without using ?ignoreParams, you get an evaluation error, as calcVal tries to match all data points and encounters calibval that has a different value in both the tests.

Recommendations for ?output in calcVal

Consider the following recommendations while using calcVal expressions in outputs:

Recommendations for Using ?matchParams in calcVal

Depending on the variable and corner settings in the target and source (calibrated) test, you can specify an appropriate value for the ?matchParams argument of calcVal to obtain correct results. You may find the following recommendations useful:

Troubleshooting calcVal

Before running a simulation, ADE Explorer or ADE Assembler check the calcVal expressions in outputs or variables for any syntax issues and report errors that you can fix before running the simulation. If you proceed without fixing the syntax issues or if the values assigned to the arguments during runtime are invalid, the expressions return eval err. You can set the debug environment variable to specify the level of details to be reported in the log file to help you resolve issues.

The examples cases described in this section show how you can resolve issues for calcVal expressions.

Case 1: calcVal with Local Sweeps

With local sweep values, the Results tab displays independent sweep points for each test. In such cases, on using calcVal with just the arguments t_outputName and t_testName, the function returns an evaluation error or nil. This is because when calcVal tries to fetch the target value from the specified test, it looks for the same sweep point as that of the test where the function is specified.

For example, let us consider the following setup.

Here, on using the function calcVal("UGF" "AC")for the second sweep point of the test TRAN, calcVal will try to find the value of UGF from the second sweep point for the test AC, which does not exist. This will result in an evaluation error.

You can fix this by using additional arguments like ?getFirstSweepPoint, ?matchParams, and ?ignoreParam.

To avoid such errors, you can also use the calcVal lint check button in the in the Run Preview tab to run pre-simulation checks on calcVal expressions. You can then view the resulting output messages in the CIW.

Case 2: Using ?matchParams with multiple matching points in the target test

On using the arguments ?ignoreParams and ?matchParams, calcVal looks for matching points in the target test. But on encountering multiple matching points, it would not know which value to pick and will return nil.

For example, on setting ?matchParams and ?ignoreParams to list(list("a" 1) list("b" 3)) and list("c")) respectively, with a local sweep c=5 6 7 in the target test, calcVal would find three matching values and would not know which one to use.

Case 3: Syntax errors

The most common issues with calcVal expressions are syntax errors, such as missing double quotation marks or a missing parenthesis.

When the calcVal expressions have syntax errors, the tool displays warning messages. It is recommended to fix the reported warnings before continuing with simulation. However, if you still continue, the incorrect expressions either result in a nil value in the netlist or an evaluation error in the results of output expressions.

To avoid such errors, you can use the calcVal lint check button in the Run Preview tab to run pre-simulation checks on calcVal expressions. You can then view the resulting output messages in the CIW.

Case 4: Using the argument ?getFirstSweepPoint

In general, the ?getFirstSweepPoint argument is useful to tell calcVal to fetch the value from the first sweep point only, especially while working with local sweeps. But in specific cases, you might get an evaluation error.

In case, you have a local sweep in the target test and you run only one point in the source test, calcVal would not know which value to pick even though there is just one point.

To avoid such issues, you can specify the option ?getFirstSweepPoint t in the expression to tell calcVal to fetch the value from the first sweep point, irrespective of the number of sweeps in the source test.

Case 5: calcVal accuracy

The calcVal return value is a copy of the target value this function is pointing to, but a comparison with the original value shows some extremely small differences.

calcVal needs to do some processing of the values and expressions. Usually, a 64-bit double floating point value can be precisely processed upto fifteen digits. Differences in the thirteen, fourteen, and, fifteen digits range indicate a difference in the numerical noise level. The simulator can accurately process values in the range of five to six digits. Therefore, comparing values from the numerical noise level should be avoided. Comparison should always be done with a certain range to avoid any false alarm.

Case 6: The usage of ?matchParams and ?ignoreParams

The ?matchParams and ?ignoreParams arguments let you specify which value to fetch in case of local sweeps. But in some cases, problems may arise.

For example, consider two tests, test1 and test2 containing local sweep points vdd=1 2 3 4 and vdd=2 4 respectively. Here, if a calcVal expression in the second point of test2, vdd=4 tries to get a value from test1, it would not know which point of test1 to fetch the value from.

In such scenarios, using ?matchParams "all" would solve the issue because calcVal will then look at all the points in the test1 to find a point with vdd=4 and will get the value from point four of test1.

But if you sweep vdd=2 4 in test1 and vdd=1 2 3 4 in test2, the above argument would not solve the problem since calcVal will try to match all values and will not find a match for vdd=1 and vdd=3. In this case, you can specify which value to match by using the argument ?matchParams list(list("vdd" 4))

Let us add another variable rload to this setup with rload=2 for test1 and rload=3 for test2. Now considering the local sweep point vdd=1 2 3 4, the above mentioned solution will not work since all the variables need to match and the value for rload is different for both the tests. In this case, you can use any of the following arguments as a solution.

Case 7: Circular dependencies

An error message is displayed in case you have a circular dependency in calcVal expressions.

For example, consider a circular dependency between the calcVal expressions in four tests, test1, test2, test3, and test4. The calcVal expression in test2 is dependent on test1. Accordingly, test3 is dependent on test2 and test3 on test4. If test1 has an additional dependency on test4, the setup contains a circular dependency. This would mean that test1 is dependent on test2, test3, test4 and finally on itself. This indicates that there is an issue with your setup and the dependency loop needs to be broken at one point.

In case of a longer loop, the error message does not provide complete information. In the above situation, calcVal might report only the dependency between test2 and test3. However, it could be that the wrong dependency is actually between test3 and test1.


Return to top
 ⠀
X