next up previous contents index
Next: Parameters Panel: Set PCell Up: Parameterized Cells and Vias Previous: Changing the Parameters of   Contents   Index


Parameter Constraints

Constraints are described by text strings included in the pc_params property contained in the super-master cell. Constraints do not appear in the sub-master or instance properties. Constraint support is also provided for Ciranove/Python OpenAccess pcells, though the constraint strings are provided by another method internally as there are no corresponding super-master Xic cells.

In Xic, constraints are mainly handled in the Parameters panel (see 5.3), which is where parameter setting is primarily handled. The constraints may affect the type of input widget for the parameter. It will not be possible to set a value for the parameter that is not allowed by the associated constraint.

The constraint strings follow closely the Ciranova format. Each is in the form of a Python function call, with a set of arguments that define the constraint. The arguments can be either positional or named. For example, the range constraint has the following template:

range(low,high,resolution=None, action=REJECT)

The two final arguments have defaults, and are therefor optional. Arguments can be given positionally, or as an assignment using the argument name keyword. The following forms are equivalent:

range(0,10)
range(high=10,low=0)

The first line follows the argument order of the template. The second line does not, but supplies the argument name explicitly. Arguments can appear in any order if the name is given. An argument list can use both positional and explicit assignment. Note that the resolution and action arguments are not given in either example, so that the defaults will be used.

All keywords are case-insensitive.

Each constraint type contains an action argument, which can be set to one of the literal enumerators REJECT, ACCEPT, or USE_DEFAULT. This specifies what happens when an attempt is made to set the parameter to a value not allowed by the constraint. The REJECT option (the default) will simply fail, causing the command that initiated the operation to also fail. The ACCEPT action will accept the new parameter value, basically ignoring the constraint. The USE_DEFAULT option is intended to reset the parameter to the default value when the constraint test fails, but this is not implemented in Xic, REJECT will be done instead.

The enumeration value None can be given to most arguments. This usually means to ignore the argument, and skip any test that would use the argument. For example, a range constraint may give a high value of None, meaning that the parameter value can be arbitrarily large.

The available constraint types are as follows.

choice
The choice constraint restricts the parameter to a number of alternatives. These alternatives can be numbers or strings, as appropriate for the parameter data type. The keyword ``choiceConstraint'' is a (case-insensitive) synonym. The template is

choice(choices,action=REJECT)

where the choices argument is a list in the form

[element,element...]

The square brackets are literal, elements are numbers or strings (single or double-quoted) which are separated by commas.

Examples:
choice([1,2,4,8])
choice(["red","green","blue"])

The first line restricts the numeric parameter to the values listed. The second line would restrict a string parameter to the strings listed. Note that if the script is Python, single quotes must be used instead of double quotes. Single or double quotes can be used with native scripts.

range
The ramge constraint restricts a numerical parameter to a range of values. The keyword ``rangeConstraint'' (case-insensitive) is a synonym. The template is

range(low,high,resolution=None, action=REJECT)

The low and high are numerical endpoints of the range. Either can be the enumeration value None, which skips testing against that endpoint. For example,

range(0,None)

simply indicates that the value must be zero or larger.

The numerical values passed for low and high must be consistent with the language used for the script. In particular, Python requires a standard integer or floating-point format. The native language allows SPICE-type numbers (e.g., 1.2K), hex numbers with a ``0x'' prefix (e.g., 0xff00) and character constants (e.g., ' \ n') in addition.

The resolution argument is used in the Parameters panel to set the number of digits to include following a decimal point (see 5.3).

step
The step constraint limits the numerical parameter value to multiples of a given delta between a starting and ending value. The keyword ``stepConstraint'' (case-insensitive) is a synonym. The template is

step(step,start=0,limit= None,resolution=None,action=REJECT)

The parameter must be numeric. If the step value is 0 or None, the constraint acts the same as the range constraint, with start and limit providing the low and high values, respectively.

Otherwise, the allowed values are given by

start + N*step

where N is a non-negative integer, and the value of the expression is within the range terminated by limit, if limit is not None. Note that step can be negative, in which case the parameter value must be greater than or equal to limit.

The resolution is treated as in the range constraint.

numericStep
This is very much like the step constraint, but is intended for use with string variables used for numeric input to support SPICE-like multipliers. This is needed for script languages that don't handle numbers in this format. Since the native script language understands this number format directly, it is not clear that the numericStep constraint will ever be needed in pcells with native scripts. The keyword ``numericStepConstraint'' is a synonym. The template is

step(step,start=0,limit= None,resolution=None,scaleFactor= 'u',action=REJECT)

The arguments are the same as for the step constraint, with the addition of scaleFactor. The scaleFactor is a string set to one of the scaling suffixes from the table below:

suffix multiplier name
a 1e-18 atto
f 1e-15 femto
p 1e-12 pico
n 1e-9 nano
u 1e-6 micro
m 1e-3 milli
mil 25.4 mil
k 1e3 kilo
meg 1e6 mega
g 1e9 giga
t 1e12 tera

The scale fastor is case-insensitive. If the scaleFactor is assigned the value None, no scale fastor is assumed, and the constraint is basically identical to step. If a scale factor is given, numbers given for step, start, and limit are internally multiplied by the scale factor, before comparison to the parameter value.


next up previous contents index
Next: Parameters Panel: Set PCell Up: Parameterized Cells and Vias Previous: Changing the Parameters of   Contents   Index
Stephen R. Whiteley 2022-05-28