NCSU CDK SKILL Programming

Note: $cdk_dir == toplevel directory of NCSU CDK

This document contains the following sections:

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/loadSkill.il controls the loading of the SKILL routines. It is loaded by the .cdsinit file, and it in turn loads loadSkill.il 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.

There are some files intended to help with SKILL programming. RCSheader contains a template for use with RCS, the GNU revision control system. 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.

For NCSU admins: All of the source files are maintained with the RCS revision control system. (add rcstools to access the rcs commands.) Thus, in each directory with source files there will be an RCS sub-directory. Do not edit files unless they are first checked out with co -l. When a modified file is ready for checkin, use ci -u to keep an unlocked, working copy in the source directory, otherwise the Cadence tools will not find the file. (And take two seconds to make a meaningful log entry!)

Global Data

Some variables and subroutines are used in more than one file in the distribution. These are stored in $cdk_dir/skill/globalData.il. 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 globalData.il. 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/triggers.il, 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:

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

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()

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:

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 NCSU_unregisterLibCompileHook(), which take no arguments.


Return to index