3. Programming Frames : How You Can Invoke Frames : Differences Among the Frame-invoking Statements : How You Can Return a Value from an Active Child to the Inactive Parent
 
Share this page                  
How You Can Return a Value from an Active Child to the Inactive Parent
One feature of the callframe statement is its ability to pass a return value from the called frame to the calling frame using the return statement.
When you use the return statement in a frame that was opened with the callframe statement, you can pass a single value back to the calling frame. This enables the calling frame to get information back from the frame that it called. For example, you can use the return statement to send back a status code, which the calling frame can then use in conditional processing.
When you issue the original callframe statement, you must specify a variable name to receive the return value. The syntax is:
variable = callframe framename ([parameterlist])
variable
Specifies any variable within the scope of the calling component, including a field variable or a local variable declared in the initialize or declare blocks. The data type of the variable must be compatible with the return value data type you specified when you created the frame with the OpenROAD Workbench.
Then, in the return statement, you must specify the return value. The syntax is:
return expression
expression
Specifies any variables, constants, or expressions from the called frame. The value of the expression must be appropriate for the return data type of the called frame.
For example, in the following callframe statement, id is an integer variable:
id = callframe fakeframe;
The following return statement passes the integer value back to the frame that issued the callframe statement:
return 33;