Product Documentation
Virtuoso Parameterized Cell Reference
Product Version IC23.1, September 2023

2


Safety Rules for Creating SKILL Pcells

This chapter provides important rules for creating SKILL Pcells, including which functions are safe to use and what to avoid.

If you use SKILL functions that are unsupported or not intended for use in Pcells, your Pcell code will probably fail when you try to translate your design to a format other than Design Framework II or when you use the Pcell in a different Cadence application.

The purpose for creating a Pcell is to automate the creation of data. Pcells should be designed as standalone entities, independent of the environment in which they are created and independent of the variety of environments in which you or someone else might want to use them. An environment can react to a Pcell, but Pcell code should not react to, interact with, or be dependent on an environment.

Although it is possible to create Pcells dependent on something in your current or local environment or using unsupported or not recommended functions, your Pcell code might fail on subsequent evaluations and is likely to fail when you try to translate it for a different environment. Although it is possible to load files, read from files, and write to files in the UNIX file system from within a Pcell, do not do so, because

Functions that are not supported for use by customers within SKILL Pcells usually belong to specific applications (tools); they are unknown to other environments, to other tools, and to data translators.

Create Pcells using only the recommended, supported functions. You can identify them by their prefixes. However, you can also use all of the basic SKILL language functions that are defined in Cadence SKILL Language Reference; these functions do not have prefixes. To use only recommended, supported, documented functions, follow the rules in this section.

This chapter contains the following information:

SKILL Procedures Called in Pcells

You can call your own SKILL procedures from within Pcells. However, the code in procedures called by Pcells must follow all of the safety rules described in this section. The safety rules apply to all code that is evaluated when the system evaluates a Pcell, and that includes SKILL procedures called by the Pcell.

Called procedures are not compiled with the Pcell, so ensure they are loaded before the system evaluates the Pcell. You can set up the libInit.il file to automatically load the procedures the first time it accesses the library.

Related Topics

How to Package a Pcell

Loading of Pcell Support Files

Macros in Pcell SKILL Code

Macros in Pcells are only expanded one level. You can include macros that do not reference or contain other macros (are not nested) in your Pcell SKILL code, and they will be expanded successfully.

To include a nested macro in a Pcell, it is recommended that you use an explicit function call in the Pcell code section of the pcDefinePCell function, and make sure that the function is defined and available (loaded) prior to any evaluation of the Pcell. This is usually done by including the function in your libInit.il file. If you do not use this method for nested macros, the nested code is treated as an undefined function, causing the Pcell evaluation to fail.

Physical Limits for Functions

You can avoid creating a Pcell that is too large to be processed or displayed by not exceeding the physical limitations for SKILL functions.

The following physical limitations exist for functions:

By default, code vectors are limited to functions that can compile less than 32KB words. This translates roughly into a limit of 20000 lines of SKILL code per function. The maximum number of arguments limit of 32KB is mostly applicable in the case when functions are defined to take an @rest argument or in the case of apply called on an argument list longer than 32KB elements.

Recommended and Supported SKILL Functions for Pcells

When you create SKILL routines within Pcells, use only the following functions:

Related Topics

Cadence SKILL Language Reference;

pc Functions for SKILL Pcell Code

Using Print Functions in a Pcell

You cannot print or generate output from a Pcell because it causes the Pcell evaluation to fail. However, you can bypass the system processing for print functions by using the fprintf or println function to print directly to stdout (standard output) in the format shown below:

fprintf( stdout ... )
println( variable stdout )

where variable is your variable name. For example

fprintf( stdout "myVariable = %L \n" myVariable )

Using printf or println in a Pcell

If you use the printf or println function in a Pcell, the output is treated as an error. In a cellview, errors are indicated by flashing markers. You can query the error in the cellview, change your Pcell code to fix the error, and recompile your Pcell.

To query markers,

  1. Make the marker layer a valid layer.
  2. Choose Verify – Markers – Explain.
  3. Click a flashing marker.
    A dialog box appears, showing the text printed from the Pcell by the printf or println function.

For debugging tips, see Debugging SKILL Pcells.

Enclosing the Body of Code in a let or prog for Local Variables

When you use local variables in the body of SKILL Pcell code in a pcDefinePCell statement, be sure to enclose the Pcell code in a let or prog statement, and define all variables used in the Pcell code at the beginning of the let or prog statement. Defining variables as part of a let or prog prevents conflicts with variables used by the Pcell compiler. Using let gives faster performance than prog; prog allows multiple exits while let exits only at its end.

What to Avoid When Creating Pcells

When creating a Pcell, do not use functions with prefixes other than db, dd, cdf, rod, and tech. Although it is possible to call procedures with other prefixes from within a Pcell, you will not be able to view the Pcell in a different environment or translate it into the format required by another database. Most translators, including the physical design translators, can translate only basic SKILL functions, the four pc functions, and functions in the SKILL families db, dd, cdf, rod, and tech.

In some cases, a function looks like a basic function but is not a basic function. For example, the Cadence analog design environment function complex looks like a basic function, but it is not. Avoid using Cadence analog design environment functions and other non-basic SKILL functions because the translators do not support them.

Specifically, do not use functions with application-specific prefixes such as ael, abs, de, ge, hi, las, le, pr, and sch. Procedures in any application-specific family are at a higher level of functionality than can be used in a Pcell safely. For example, if you create a Pcell using le functions, the Pcell works only in environments that include the Virtuoso layout editor. You cannot use a translator to export your design from the DFII database.

When a translator cannot evaluate a function, one of the following happens:

To make your design translate successfully, you must resolve undefined functions in Pcells. You can do this by flattening the Pcells, which results in a loss of hierarchy and parameterization, or by rewriting the Pcell code to eliminate the undefined functions.

Here are more important rules for creating Pcells. In your Pcell code,

Return to top
 ⠀
X