UP

SYMBOL PROPERTY SYNTAX


GENERAL RULES

For symbols a global property string (to show it press 'q' when nothing is selected and Options->Symbol global attrs is selected) defines at least 3 attributes:

The order these attributes appear in the property string is not important, they can be on the same line or on different lines:

type=nmos format="@name @pinlist @model w=@w l=@l m=@m" template="name=m1 model=nmos w=5u l=0.18u m=1"
 

format="@name @pinlist @model w=@w l=@l m=@m"
template="name=m1 model=nmos w=5u l=0.18u m=1"
type=nmos
 

As you see double quotes are used when attribute values have spaces. For this reason if double quotes are needed in an attribute value they must be escaped with backslash \"

since the symbol global property string is formatted as a space separated list of attribute=value items, if a value has spaces in it it must be enclosed in double quotes, see for example the symbol template attribute: template="name=m1 model=nmos w=5u l=0.18u m=1" or the the format attribute: format="@name @pinlist @model w=@w l=@l m=@m". As a direct consequence a literal double quote in property strings must be escaped (\")

ATTRIBUTE SUBSTITUTION

XSCHEM uses a method for attribute substitution that is very similar to shell variable expansion done with the $ character (for example $HOME --> /home/user) The only difference is that XSCHEM uses the '@' character. The choice of '@' vs '$' is simply because in some simulation netlists shell variables are passed to the simulator for expansion, so to avoid the need to escape the '$' in property strings a different and less used character was chosen.
A literal @ must be escaped to prevent it to be interpreted as the start of a token to be substituted (\@). If a non space character (different than @) ends a token it must be escaped. Attribute substitution with values defined in instance attributes takes place in symbol format attribute and in every text, as shown in below picture.


In recent xschem versions a % prefixed attribute (example: %var) can be used instead of a @ prefix. The only difference is that if no matching attribute is defined in instance the %var resolves to var instead of an empty string.

If no matching attribute is defined in instance (for example we have @W in symbol and no W=... in instance) the @W string is substituted with an empty string.

OTHER PREDEFINED SYMBOL ATTRIBUTES

PREDEFINED SYMBOL VALUES


TCL ATTRIBUTE SUBSTITUTION

Any attribute and symbol text can be embedded in a tcleval(....) construct, the string inside the parentheses will be passed to the tcl interpreter for evaluation. This allows to use any tcl variable/command/expression. Example:
spice_ignore="tcleval($::ignore_symbol)"
will cause the symbol to be ignored by the spice netlister if the ignore_symbol tcl variable is existing and set to true