OpenSTA logo OpenSTA SCL Reference
SUBROUTINE Command

SUBROUTINE Command

This command defines the start of a discrete section of code which is bounded by the SUBROUTINE and END SUBROUTINE commands. Subroutines are callable from the main code section or from within other subroutines, this has the effect of temporarily causing the script processing to run the code in the subroutine.

Subroutines are called from other code with a command of the format CALL name. They return control to the code from where they were called by use of the RETURN command. A maximum of 255 subroutines may be defined within a Script.

Subroutines share the same variable definitions as the main code but have their own labels. A label may not be referenced outside the main module or outside the subroutine in which it occurs. This has the effect of disabling branching in and out of subroutines, and means that each subroutine has its own 255 label symbol table.

Command Definition:

SUBROUTINE name {[parameter{, parameter ...}]}

name

The name of the subroutine. This must be a valid OpenSTA Dataname, and must be unique within the Script.

parameter

A character variable or integer variable declared in the Definitions section of the Script. Up to 8 parameters can be declared in the SUBROUTINE command. There must be the same number of parameters in this list as there are in the subroutine call, and the data types of the parameters must match.

Examples:

SUBROUTINE CREATE_FULL_NAME [First-Name, Middle-Initial, Last-Name]
	SET Full-Name = First-Name + "  " + Middle-Initial + " " + Last-Name
	RETURN
END SUBROUTINE

<<<
prev page
^^^
section start
>>>
next page