SKILL tips

From NCSU EDA Wiki
Jump to: navigation, search

Generic SKILL Hints

The locally generated and procured SKILL reside in the $cdk_dir/skill directory. The subdirectories are organized by the function the code performs.

The file $cdk_dir/skill/ controls the loading of the SKILL routines. It is loaded by the .cdsinit file, and it in turn loads files from each subdirectory in $cdk_dir/skill, which then actually load the SKILL files. The "config_files" are not loaded this way, however. The config_files are setup files for the various editors, and these are loaded directly by .cdsinit.

The files skill.vim and diva.vim contain syntax highlighting instructions for colorizing SKILL files using the text editor vim. (These files now come with the vim distribution.) The file skill.nedit does the same thing for the text editor nedit.

Global Data

Some variables and subroutines are used in more than one file in the distribution. These are stored in $cdk_dir/skill/ Variables that are used as constants, such as the threshold below which parasitic capacitances are ignored, are stored here as well. To avoid name collisions, global variables begin with the prefix NCSU_.

User Hooks and Customizations

Site and User Menus

The CDK provides a mechanism for site administrators and individual users to easily install their own menus, which appear on the menubar after the "NCSU" menu, on a library-by-library basis. Whenever a schematic or layout window is opened, the CDK first looks for a sitewide menu description file pointed to by the variable NCSU_siteMenuFile, which is defined in the file The default value of this variable is prependNCSUCDKInstallPath( "cdssetup/cdksitemenu" ). The CDK then looks for a .cdkusermenu menu description file, first in the current directory, and if one doesn't exist there it searches the user's home directory.

(Note to admins: To have site and user menus available for more viewtypes, e.g. symbol, add additional deRegUserTriggers() calls to the end of skill/menus/, using the schematic trigger as a template.)

The menu description file lists the menu titles, items, and callbacks. The format is very simple yet flexible and is described below:

    ; comment style 1
    # comment style 2
    menu <menu_name> <view_type> <title text> [library1] [library2] [...]
    item <item_name> <parent_menu_name> <item text> <callback>
    sliderItem <item_name> <parent_menu_name> <item text>

The keywords are:

  • menu defines a toplevel menu
  • item defines a menu item in parent_menu_name
  • sliderItem defines a slider menu (also called a cascading menu) in parent_menu_name

Fields listed in angled brackets (<>) are required; fields listed in square brackets ([]) are optional:

  • menu_name is the name by which the menu is referred
  • item_name is the name by which the item is referred
  • parent_menu_name refers to either a menu or a sliderItem
  • view_type defines the viewType for which the menu is instantiated; commonly set to either "maskLayout" or "schematic"
  • title text and item text are quoted strings which appear in the menu bar and the menus respectively
  • callback is an unquoted string containing SKILL code which is executed when the menu item is selected
  • library1, library2, etc., are optional libraries for which the menu is instantiated. If not given, the menu is instantiated for all libraries.

Items appear in the menus in the order in which they are defined; other than that, the order of the lines in the menu description file doesn't matter. Slider menus can be nested. Lines beginning with a hash or semicolon are ignored, as are lines with only whitespace. Menu names and menu item names should not be duplicated.

Example menu description file:

menu menu1 schematic "1st menu"
menu menu2 maskLayout "2nd menu" classLib workLib
item menuItem1 menu1 "menu item 1" callback1a()
item menuItem2 menu1 "menu item 2" callback2a()
item menuItem3 menu2 "menu item 1" callback1a() callback1b()
item menuItem4 menu2 "menu item 2" callback2a() callback2b()
sliderItem slider1 menu2 "choices"
item menuItem6 slider1 "submenu item 1" callback3a()
item menuItem7 slider1 "submenu item 2" callback3b()

This defines two menus titled 1st menu and 2nd menu which appear in schematic and layout windows respectively. The second menu furthermore only appears in layouts in either the "classLib" or "workLib" libraries. Menu1 contains two items titled menu item 1 and menu item 2, which run the SKILL functions callback1a() and callback2a() when selected respectively. Menu2 contains duplicates of those two items, but each item calls two callback functions, one after the other. Additionally, menu2 contains a slider item titled choices. This submenu contains items titled submenu item 1 and submenu item 2, which have the callbacks callback3a() and callback3b() respectively.

Library Creation

Situations might arise, especially when compiling a non-MOSIS technology library, in which it is convenient to be able to interact with a library during its creation, e.g., to add particular properties. To accomplish this, users can register SKILL functions to be called at two separate stages of the library creation process. Use the following registration functions:

NCSU_registerLibCreateHook registers a function to be executed immediately after library creation. The registered function is passed the ID of the newly-created library as an argument.

NCSU_registerLibCompileHook registers a function to be executed after (successful) completion of tech file compilation. This applies only if the "Compile tech file" option is selected. The registered function is passed the ID of the newly-created library and the ID of the techfile as arguments, in that order.

Both NCSU_registerLibCreateHook and NCSU_registerLibCompileHook take a single argument: a symbol representing the name of the function.

Here's an example. Suppose you want to automatically add the property maxArea to libraries after creation. A function to do this might look like:

; set max area property to 10 sq. mm.
procedure( setMaxArea( libID )
    bag = dbOpenBag( libID "w" )
    dbCreateProp( bag "maxArea" "float" 10.0 )
    dbSaveBag( bag )
    dbCloseBag( bag )

To register this function you would execute the following:

NCSU_registerLibCreateHook( 'setMaxArea )

To unregister functions, execute:
NCSU_unregisterLibCreateHook() and
which take no arguments.

--Slipa 12:18, 27 February 2006 (EST)