OpenSTA logo OpenSTA SCL Reference
Variable Values

Variable Values

A set of values may be associated with a variable, using a value clause in the variable definition. They are used by the GENERATE and NEXT commands, which allow the variable to be assigned a value from the list or range, either randomly (using GENERATE) or sequentially (using NEXT). Values may be specified as a list (integer and character variables) or as a range (integers only).

A value list has the following format:

(value1{, value2, value3 ...})

The values must be of the same data type as the variable; that is integer values for integer variables, and character values for character variables. They may also be constants which have previously been defined.

A range provides a shorthand method for defining a list of adjacent integer values and has the following format:

(start-value - end-value)

If the start-value is less than the end-value, the variable is increased by 1 on each execution of the NEXT command, until the end value is reached. If the start-value is greater than the end-value, the variable is decreased by 1 on each execution of the NEXT command, until the end-value is reached.

If the variable is set to the end-value when the NEXT command is executed, the variable will be reset to the start value. You can also reset the variable explicitly, by using the RESET command.

In the following list of example variable definitions including values, the definitions of A and B are equivalent:

Integer A (4,3,2,1,0,-1)
Integer B (4 - -1)
Integer C (100 - 999)
Integer D (100,200,300,400)
Character*10 Lang ("en", 'fr', 'de', "es")
Character Control ("~<CR>", "~<LF>", "^Z", "^X", "^U")

Note: Lists may contain only individual values and not ranges.

Note: In the case of character variables, the maximum size of a character constant or literal string is 65535 characters.

Note: Variables which have been declared as an array may not have an associated value list or range.

Note: Referencing a variable with a value list or range without first calling NEXT will result in a runtime error. The compiler cannot spot this type of problem.

Related:


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