»»»Home «««
»»»TELL «««
»»»Toped «««
»»»Ifaces «««

Data types and variables

TELL defines several build-in basic data types as listed below.

  • int - 32 bit signed integer. Intention is to introduce byte and word as an unsigned integers for better type checking
  • real - 10 digits of precision floating point, represented internally via C type double
  • string - sequence of ASCII characters, represented internally as an array of chars.
  • bool - Boolean
  • layout - a reference to a layout object in the TDT database
  • auxdata - a reference to auxilary data. GRC data only so far.
  • void - to signify that a function doesn’t return anything
  • callback - variables of this type store function references. See callbacks for further info.


Lists can be defined from any of the build-in or user types in TELL. They are homogeneous, their length is dynamic and limited only by the available memory. Empty lists are perfectly legal. One can think for TELL lists as of dynamic length arrays.

List expansion can have an adverse performance impact when repeated significant number of times. Much faster is to setup the initial list length during the variable declaration.

   int list iter;           // empty list declaration
   point list polygon [10]; // list of 10 points

See list operations

Build-in composite types

Below is the list of the build-in structures. The only non-trivial structure here is bind. It is used for reference and text objects and fully describes the placement of a particular cell instance or text. See also user defined structures

  • int x
  • int y
  • point p1
  • point p2
  • int key
  • string value
  • string key
  • string value
  • point p
  • real rotation
  • bool flipX
  • real scale


Constants in TELL are fixed values that can’t be changed after initialization. They can be of any build-in or user type and are defined using the keyword const in front of the variable declaration. Constants can be initialized either with the declaration or after, but a value can be assigned to them only once.

   const int a = 1; // constant declaration & initialization
   const real b;    // constant declaration
   // ... some code
   b = 3.7; // constant initialization

TELL defines a number of build-in constants listed in the table below

Name Type Value Description
true bool 1 -
false bool 0 -
_horizontal int 0 -
_vertical int 1 -
_lmbox int 0x0001 selection filter - boxes
_lmpoly int 0x0002 selection filter - polygons
_lmwire int 0x0004 selection filter - wires
_lmtext int 0x0008 selection filter - texts
_lmref int 0x0010 selection filter - cell references
_lmaref int 0x0020 selection filter - array of references
_lmpref int 0x0040 selection filter - parametrized cells
_lmapref int 0x0080 selection filter - array of parametrized cells
_iconsize16 int 0 toolbar icon size
_iconsize24 int 1 toolbar icon size
_iconsize32 int 2 toolbar icon size
_iconsize48 int 3 toolbar icon size

For selection filters - see selectmask

For toolbar icon sizes - see toolbarsize

User defined structures

A structure is defined using a keyword struct and the type name, followed by the list of structure members enclosed in curly braces. Each structure member is described by its type and name. Structure member declarations are separated by a semicolon. The new type name can be used exactly as any other build-in TELL type to declare variables or function arguments. The struct definition does not create an actual data object, but just describes what constitutes this object.

   struct circle { point center; real radius };
   struct ply_shape { point list vertexes; int layer };
   struct layout_text {
      string text; point bind; int layer; bool flipX; real rotation };

Variable scope, definition and initialization

Variables can be declared anywhere in the code, but before they are used. Initialization can be included in the declaration. Variables are visible from the line they are defined until the end of the block. Global variables are those declared outside any function scope. They are visible from the line of definition further.

   int          number_of_contacts = 4;
   real         contact_size = 0.25;
   point        bound_point = {20.5,20};
   box          source_area = { {0,0} , {2.2,1.6} };
   layout list  contacts = select(source_area);
   bool         nc_OK = (number_of_contacts == 4);
   circle       c1 = { {12.5, 96} , 10 };
   ply_shape    p1 = { {{-1,75},{10,75},{10,70},{15,70},
                        {15,66},{-10,66},{-10,70},{-1,70}}, 6};

Lists and user defined structures are initialized using similar syntax - a comma separated list of initializers enclosed in braces. The same syntax can be used in assignments. For lists, each of the initializer fields should be the same type as the type of the list declaration. For structures, each initializer should match the type of the corresponding structure member. Some examples can be seen above


Quick List

Some of the Toped functions - for example gdsimport are using relatively complex data structures as input parameters. The quick list is a very simple convention which can save some typing and reduce errors. This is not a separate TELL type. It shall be always included in a string variable. Quick list can contain only numbers, spaces and following characters: - comma , - used as a separator - star * - used as a wildcard - dash - indicating a range

Example 1. Quick List

   "1,3-6,8"  // is a short for 1,3,4,5,6,8
   "*"        // means *all*. The parser will treat this depending on the
              // context it is used.