# DEF 5.8 C/C++ Programming Interface -- 6
Describes the C/C++ programming interface used to read and write Design Exchange Format (DEF) files.
Author: Technical Publications

###
DEF 5.8 C/C++ Programming Interface (Open Licensing Program)

# 6

# DEF Writer Routines

You can use the Cadence® Design Exchange Format (DEF) writer routines to create a program that outputs a DEF file. The DEF writer routines correspond to the sections of the DEF file. This chapter describes the routines listed below that you need to write a particular DEF section.

Routines | DEF File Section
DEF Writer Setup and Control | Initialization and global variables
Blockages | BLOCKAGES statement
Bus Bit Characters | BUSBITCHARS statement
Components | COMPONENTS statement
Design Name | DESIGN statement
Die Area | DIEAREA statement
Divider Character | DIVIDERCHAR statement
Extensions | EXTENSIONS statement
Fills | FILLS statement
GCell Grid | GCELLGRID statement
Groups | GROUPS statement
History | HISTORY statement
Nets | NETS statement

> Regular Wiring

regularWiring statement in a NETS statement

> Subnet

SUBNET statement in a NETS statement

Nondefault Rules | NONDEFAULTRULES statement
Pins | PINS statement
Pin Properties | PINPROPERTIES statement
Property Definitions | PROPERTYDEFINITIONS statement
Property Statements | PROPERTY statements
Regions | REGIONS statement
Rows | ROW statement
Special Nets | SPECIALNETS statement

> Special Wiring

specialWiring statement in a SPECIALNETS statement

> Shielded Routing

shielded routing statement in a SPECIALNETS statement

Scan Chains | SCANCHAINS statement
Slots | SLOTS statement
Styles | STYLES statement
Technology | TECHNOLOGY statement
Tracks | TRACKS statement
Units | UNITS statement
Version | VERSION statement
Vias | VIAS statement

## DEF Writer Setup and Control

The DEF writer setup and control routines initialize the reader and set global variables that are used by the DEF file. You must begin a DEF file with either the defwInit routine or the defwInitCbk routine. You must end a DEF file with the defwEnd routine. All other routines must be used between these routines. The remaining routines described in this section are provided as utilities.

For an example on how to set up the writer, see "Setup Examples".

All routines return 0 if successful.

### defwInit

Initializes the DEF writer. Use this routine if you do not want to use the callback mechanism.

#### Syntax

int defwInit (
  FILE*
file,
  int vers1,
  int vers2,
  const char* caseSensitive,
  const char* dividerChar,
  const char* busBitChars,
  const char* designName,
  const char* technology,
  const char* array,
  const char* floorplan,
  double units)

#### Arguments

file

> Specifies the name of the DEF file to create.

vers1, vers2

> Specifies which version of LEF/DEF is being used. vers1 specifies the major number. vers2 specifies the minor number.

caseSensitive

> Note: The NAMECASESENSITIVE statement is obsolete; therefore the writer ignores this argument.

dividerChar

> Writes the DIVIDERCHAR statement that specifies the character used to express hierarchy when DEF names are mapped to or from other databases. The character must be enclosed in double quotation marks.

busBitChars

> Writes the BUSBITCHARS statement that specifies the pair of characters used to specify bus bits when DEF names are mapped to or from other databases. The characters must be enclosed in double quotation marks.

designName

> Writes the DESIGN statement that specifies a name for the design.

technology

> Writes the TECHNOLOGY statement that specifies a technology name for the design.

units

> Writes the UNITS statement that specifies how to convert DEF units.

### defwInitCbk

Also initializes the DEF writer. Use this routine if you want to use the callback mechanism. If you use this routine, you must also use the following routines:

| defwVersion

| defwBusBitChars

| defwDividerChar

| defwDesignName

If you do not include these routines, default values are used.

#### Syntax

int defwInit(
  FILE* file);

#### Arguments

file

> Specifies the name of the DEF file to create.

### defwEnd

Ends the DEF file. This routine is required and must be used last.

#### Syntax

int defwEnd(void)

### defwCurrentLineNumber

Returns the line number of the last line written to the DEF file. This routine does not require any arguments.

#### Syntax

int defwCurrentLineNumber(void)

### defwNewLine

Writes a blank line. This routine does not require any arguments.

#### Syntax

int defwNewLine()

### defwAddComment

Allows you to enter any comment into the DEF file. This statement automatically adds a pound symbol (#) to the beginning of the comment statement.

#### Syntax

int defwAddComment(
  const char*
comment)

### defwAddIntent

Automatically indents a statement by adding three blank spaces to the beginning of the statement. This routine does not require any arguments.

#### Syntax

int defwAddIndent()

### defwPrintError

Prints the return status of the defw* routines.

#### Syntax

void defwPrintError(
  int
status)

#### Arguments

status

> Specifies the nonzero integer returned by the DEF writer routines.

### Setup Examples

The following examples show how to set up the writer. There are two ways to use the DEF writer:

| You call the write routines in your own sequence. The writer makes sure that some routines are called before others, but it is mainly your responsibility to make sure the sequence is correct, and all the required sections are there.

| You write callback routines for each section, and the writer calls your callback routines in the sequence based on the LEF/DEF Language Reference. If a section is required but you do not provide a callback routine, the writer will issue a warning. If there is a default routine, the writer will invoke the default routine with a message attached

This manual includes examples with and without callback routines.

The following example uses the writer without callbacks.

int setupRoutine() {
  FILE* f;
  int res;

...
  // Open the def file for the writer to write
  if ((f = fopen("defOutputFileName","w")) == 0) {
  printf("Couldn't open output file '%s'\n",
  "defOutputFileName");
  return(2);
  }

// Initialize the writer. This routine has to call first.
  // Call this routine instead of defwInitCbk(f)
  // if you are not using callback routines.
  res = defwInit(f);
  ...

res = defwEnd();
  ...

fclose(f);
  return 0;
  }

The following example uses the writer with callbacks.

int setupRoutine() {
  FILE* f;
  int res;
  int userData = 0x01020304;

...
  // Open the def file for the writer to write
  if ((f = fopen("defOutputFileName","w")) == 0) {
  printf("Couldn't open output file '%s'\n",
  "defOutputFileName");
  return(2);
  }

// Initialize the writer. This routine has to call first.
  // Call this routine instead of defwInit() if you are
  // using the writer with callbacks.
  res = defwInitCbk(f);
  ...

res = defwEncrypt(); // Set flag to write in encrypted format
  ...

// Set the user callback routines
  defwSetArrayCbk (arrayCB);
  defwSetBusBitCbk (busbitCB);
  defwSetCaseSensitiveCbk (casesensitiveCB);
  defwSetComponentCbk (componentCB);
  defwSetConstraintCbk (constraintCB);
  defwSetDefaultCapCbk (defaultCapCB);
  defwSetDesignCbk (designCB);
  defwSetDesignEndCbk (designendCB);
  ...

// Invoke the parser
  res = defwWrite(f, "defInputFileName", (void*)userData);
  if (res != 0) {
  printf("DEF writer returns an error\n");
  return(2);
  }

res = defwCloseEncrypt(); // Clean up the encrypted buffer
  ...

fclose(f);
  return 0;
  }

The following example shows the callback routine to mark the end of the DEF design. The type is defwDesignEndCbkType.

#define CHECK_RES(res) \
  if (res) { \
  defwPrintError(res); \
  return(res); \
  }

int designendCB (defwCallbackType_e type,
  defiUserData userData) {
  int res;

// Check if the type is correct
  if (type != defwDesignEndCbkType) {
  printf("Type is not defwDesignEndCbkType, terminate
  writing.\n");
  return 1;
  }
  res = defwEnd();
  CHECK_RES(res);
  return 0;
  }

## Blockages

Blockages routines write a DEF BLOCKAGES statement. The BLOCKAGES statement is optional and can be used only once in a DEF file. For syntax information about the DEF BLOCKAGES statement, see "Blockages" in the LEF/DEF Language Reference.

A BLOCKAGES statement must start and end with the defwStartBlockages and defwEndBlockages routines. All blockages must be defined between these routines.

### defwStartBlockages

Starts a BLOCKAGES statement.

#### Syntax

int defwStartBlockages(
  int
count)

#### Arguments

count

> Specifies the number of blockages defined in the BLOCKAGES statement.

### defwEndBlockages

Ends the BLOCKAGES statement.

#### Syntax

int defwEndBlockages()

### defwBlockageDesignRuleWidth

Writes a DESIGNRULEWIDTH statement for the blockage. Either a SPACING or a DESIGNRULEWIDTH statement can be specified for a routing blockage. The DESIGNRULEWIDTH statement is optional and can be used only once for each routing blockage in the BLOCKAGES statement.

Note: This function will become obsolete in the next parser release. Use defwBlockagesLayerDesignRuleWidth instead.

#### Syntax

defwBlockageDesignRuleWidth(
  int
effectiveWidth)

#### Arguments

effectiveWidth

> Specifies that the blockages have a width of effectiveWidth for the purposes of spacing calculations.

### defwBlockagesLayerDesignRuleWidth

Writes a DESIGNRULEWIDTH statement for the blockage. Either a SPACING or a DESIGNRULEWIDTH statement can be specified for a routing blockage. The DESIGNRULEWIDTH statement is optional and can be used only once for each routing blockage in the BLOCKAGES statement.

#### Syntax

defwBlockagesLayerDesignRuleWidth(
  int
effectiveWidth)

#### Arguments

effectiveWidth

> Specifies that the blockages have a width of effectiveWidth for the purposes of spacing calculations.

### defwBlockageLayer

Writes a LAYER statement that defines a routing blockage. When the compName argument is specified, writes a LAYER COMPONENT statement that defines a routing blockage that is associated with a component. Either a LAYER, LAYER COMPONENT, FILLS, SLOTS, or PUSHDOWN statement can be specified for each routing blockage in the BLOCKAGES statement. The LAYER and LAYER COMPONENT statements are optional and each can be used only once for each routing blockage in the BLOCKAGES statement.

Note: This function will become obsolete in the next parser release. Use defwBlockagesLayer and/or defwBlockagesLayerComponent instead.

#### Syntax

int defwBlockageLayer(
  const char*
layerName,
  const char* compName)

#### Arguments

layerName

> Specifies the layer on which to create the routing blockage.

compName

> Optional argument that specifies a component with which to associate the blockage. Specify NULL to ignore this argument.

### defwBlockagesLayer

Writes a LAYER statement that defines a routing blockage. Any one of the LAYER, LAYER COMPONENT, FILLS, SLOTS, or PUSHDOWN statements can be specified for each routing blockage in the BLOCKAGES statement. The LAYER statement is optional and can be used only once for each routing blockage in the BLOCKAGES statement.

#### Syntax

int defwBlockagesLayer(
  const char*
layerName)

#### Arguments

layerName

> Specifies the layer on which to create the routing blockage.

### defwBlockagesLayerComponent

Writes a LAYER COMPONENT statement that defines a routing blockage that is associated with a component. Any one of the LAYER, LAYER COMPONENT, FILLS, SLOTS, or PUSHDOWN statements can be specified for each routing blockage in the BLOCKAGES statement. The LAYER COMPONENT statement is optional and can be used only once for each routing blockage in the BLOCKAGES statement.

#### Syntax

int defwBlockagesLayerComponent(
  const char*
compName)

#### Arguments

compName

> Specifies a component with which to associate the blockage.

### defwBlockageLayerExceptpgnet

Writes an EXCEPTPGNET statement for a routing blockage on the given layer, which specifies that the blockage only blocks signal net routing and does not block power or ground net routing. Either a COMPONENT, SLOTS, FILLS, PUSHDOWN, or EXCEPTPGNET statement can be specified for each routing blockage in the BLOCKAGES statement. The EXCEPTPGNET statement is optional and can be used only once for each routing blockage in the BLOCKAGES statement.

Note: This function will become obsolete in the next parser release. Use defwBlockagesLayerExceptpgnet instead.

#### Syntax

int defwBlockageLayerExceptpgnet(
  const char*
layerName)

#### Arguments

layerName

> Specifies the layer on which to create the routing blockage.

### defwBlockagesLayerExceptpgnet

Writes an EXCEPTPGNET statement for a routing blockage on the given layer, which specifies that the blockage only blocks signal net routing and does not block power or ground net routing. Any one of the COMPONENT, SLOTS, FILLS, PUSHDOWN, or EXCEPTPGNET statements can be specified for each routing blockage in the BLOCKAGES statement. The EXCEPTPGNET statement is optional and can be used only once for each routing blockage in the BLOCKAGES statement.

#### Syntax

int defwBlockagesLayerExceptpgnet(
  const char*
layerName)

#### Arguments

layerName

> Specifies the layer on which to create the routing blockage.

### defwBlockageLayerFills

Writes a FILLS statement, which defines a routing blockage on the specified layer where metal fills cannot be placed. Either a LAYER, LAYER COMPONENT, FILLS, SLOTS, PUSHDOWN, or EXCEPTPGNET statement can be specified for each routing blockage in the BLOCKAGES statement. The FILLS statement is optional and can be used only once for each routing blockage in the BLOCKAGES statement.

Note: This function will become obsolete in the next parser release. Use defwBlockagesLayerFills instead.

#### Syntax

int defwBlockageLayerFills(
  const char*
layerName)

#### Arguments

layerName

> Specifies the layer on which to create the blockage.

### defwBlockagesLayerFills

Writes a FILLS statement, which defines a routing blockage where metal fills cannot be placed. Any one of the LAYER, LAYER COMPONENT, FILLS, SLOTS, PUSHDOWN, or EXCEPTPGNET statements can be specified for each routing blockage in the BLOCKAGES statement. The FILLS statement is optional and can be used only once for each routing blockage in the BLOCKAGES statement.

#### Syntax

int defwBlockagesLayerFills()

### defwBlockageLayerPushdown

Writes a LAYER PUSHDOWN statement, which defines the routing blockage as being pushed down into the block from the top level of the design. Either a LAYER, LAYER COMPONENT, FILLS, SLOTS, PUSHDOWN, or EXCEPTPGNET statement can be specified for each routing blockage in the BLOCKAGES statement. The LAYER PUSHDOWN statement is optional and can be used only once for each routing blockage in the BLOCKAGES statement.

Note: This function will become obsolete in the next parser release. Use defwBlockagesLayerPushdown instead.

#### Syntax

int defwBlockageLayerPushdown(
  const char*
layerName)

#### Arguments

layerName

> Specifies the layer on which the blockage lies.

### defwBlockagesLayerPushdown

Writes a LAYER PUSHDOWN statement, which defines the routing blockage as being pushed down into the block from the top level of the design. Any one of the LAYER, LAYER COMPONENT, FILLS, SLOTS, PUSHDOWN, or EXCEPTPGNET statements can be specified for each routing blockage in the BLOCKAGES statement. The LAYER PUSHDOWN statement is optional and can be used only once for each routing blockage in the BLOCKAGES statement.

#### Syntax

int defwBlockagesLayerPushdown(
  const char*
layerName)

#### Arguments

layerName

> Specifies the layer on which the blockage lies.

### defwBlockageLayerSlots

Writes a SLOTS statement, which defines a routing blockage where slots cannot be placed. Either a LAYER, LAYER COMPONENT, FILLS, SLOTS, PUSHDOWN, or EXCEPTPGNET statement can be specified for each routing blockage in the BLOCKAGES statement. The SLOTS statement is optional and can be used only once for each routing blockage in the BLOCKAGES statement.

#### Syntax

int defwBlockageLayerSlots(
  const char*
layerName)

#### Arguments

layerName

> Specifies the layer on which to create the blockage.

### defwBlockagePlacement

Writes a PLACEMENT statement, which defines a placement blockage. Either a PLACEMENT, PLACEMENT COMPONENT, PLACEMENT PUSHDOWN, PLACEMENT PARTIAL, or PLACEMENT SOFT statement can be specified for each placement blockage in the BLOCKAGES statement. The PLACEMENT statement is optional and can be used only once for each placement blockage in the BLOCKAGES statement.

Note: This function will become obsolete in the next parser release. Use defwBlockagesPlacement instead.

#### Syntax

defwBlockagePlacement()

### defwBlockagesPlacement

Writes a PLACEMENT statement, which defines a placement blockage. Any one of the PLACEMENT, PLACEMENT COMPONENT, PLACEMENT PUSHDOWN, PLACEMENT PARTIAL, or PLACEMENT SOFT statements can be specified for each placement blockage in the BLOCKAGES statement. The PLACEMENT statement is optional and can be used only once for each placement blockage in the BLOCKAGES statement.

#### Syntax

defwBlockagesPlacement()

### defwBlockagePlacementComponent

Writes a PLACEMENT COMPONENT statement, which defines a placement blockage associated with a component. Either a PLACEMENT, PLACEMENT COMPONENT, PLACEMENT PUSHDOWN, PLACEMENT PARTIAL, or PLACEMENT SOFT statement can be specified for each placement blockage in the BLOCKAGES statement. The PLACEMENT COMPONENT statement is optional and can be used only once for each placement blockage in the BLOCKAGES statement.

Note: This function will become obsolete in the next parser release. Use defwBlockagesPlacementComponent instead.

#### Syntax

int defwBlockagePlacementComponent(
  const char*
compName)

#### Arguments

compName

> Specifies the component with which to associate the blockage.

### defwBlockagesPlacementComponent

Writes a PLACEMENT COMPONENT statement, which defines a placement blockage associated with a component. Any one of the PLACEMENT, PLACEMENT COMPONENT, PLACEMENT PUSHDOWN, PLACEMENT PARTIAL, or PLACEMENT SOFT statements can be specified for each placement blockage in the BLOCKAGES statement. The PLACEMENT COMPONENT statement is optional and can be used only once for each placement blockage in the BLOCKAGES statement.

#### Syntax

int defwBlockagesPlacementComponent(
  const char*
compName)

#### Arguments

compName

> Specifies the component with which to associate the blockage.

### defwBlockagePlacementPartial

Writes a PLACEMENT PARTIAL statement, which specifies that the initial placement should not use more than maxDensity percentage of the blockage area for standard cells. Either a PLACEMENT, PLACEMENT PARTIAL, PLACEMENT COMPONENT, PLACEMENT SOFT, or PLACEMENT PUSHDOWN statement can be specified for each placement blockage. The PLACEMENT PARTIAL statement is optional and can be used only once for each placement blockage in the BLOCKAGES statement.

Note: This function will become obsolete in the next parser release. Use defwBlockagesPlacementPartial instead.

#### Syntax

int defwBlockagePlacementPartial(
  double
maxDensity)

#### Arguments

maxDensity

> Specifies the maximum density value. The initial placement will not use more than maxDensity percentage of the blockage area for standard cells.
> Value: 0.0-100.0

### defwBlockagesPlacementPartial

Writes a PLACEMENT PARTIAL statement, which specifies that the initial placement should not use more than maxDensity percentage of the blockage area for standard cells. Any one of the PLACEMENT, PLACEMENT PARTIAL, PLACEMENT COMPONENT, PLACEMENT SOFT, or PLACEMENT PUSHDOWN statements can be specified for each placement blockage. The PLACEMENT PARTIAL statement is optional and can be used only once for each placement blockage in the BLOCKAGES statement.

#### Syntax

int defwBlockagesPlacementPartial(
  double
maxDensity)

#### Arguments

maxDensity

> Specifies the maximum density value. The initial placement will not use more than maxDensity percentage of the blockage area for standard cells.
> Value: 0.0-100.0

### defwBlockagePlacementPushdown

Writes a PLACEMENT PUSHDOWN statement, which defines the placement blockage as being pushed down into the block from the top level of the design. Either a PLACEMENT, PLACEMENT COMPONENT, PLACEMENT PUSHDOWN, PLACEMENT PARTIAL, or PLACEMENT SOFT statement can be specified for each placement blockage in the BLOCKAGES statement. The PLACEMENT PUSHDOWN statement is optional and can be used only once for each placement blockage in a BLOCKAGES statement.

Note: This function will become obsolete in the next parser release. Use defwBlockagesPlacementPushdown instead.

#### Syntax

int defwBlockagePlacementPushdown()

### defwBlockagesPlacementPushdown

Writes a PLACEMENT PUSHDOWN statement, which defines the placement blockage as being pushed down into the block from the top level of the design. Any one of the PLACEMENT, PLACEMENT COMPONENT, PLACEMENT PUSHDOWN, PLACEMENT PARTIAL, or PLACEMENT SOFT statement can be specified for each placement blockage in the BLOCKAGES statement. The PLACEMENT PUSHDOWN statement is optional and can be used only once for each placement blockage in a BLOCKAGES statement.

#### Syntax

int defwBlockagesPlacementPushdown()

### defwBlockagePlacementSoft

Writes a PLACEMENT SOFT statement, which specifies that the initial placement should not use the blockage area, but later timing optimization phases can use the blockage area. Either a PLACEMENT, PLACEMENT PARTIAL, PLACEMENT COMPONENT, PLACEMENT SOFT, or PLACEMENT PUSHDOWN statement can be specified for each placement blockage. The PLACEMENT SOFT statement is optional and can be used only once for each placement blockage in the BLOCKAGES statement.

Note: This function will become obsolete in the next parser release. Use defwBlockagesPlacementSoft instead.

#### Syntax

int defwBlockagePlacementSoft()

### defwBlockagesPlacementSoft

Writes a PLACEMENT SOFT statement, which specifies that the initial placement should not use the blockage area, but later timing optimization phases can use the blockage area. Any one of the PLACEMENT, PLACEMENT PARTIAL, PLACEMENT COMPONENT, PLACEMENT SOFT, or PLACEMENT PUSHDOWN statements can be specified for each placement blockage. The PLACEMENT SOFT statement is optional and can be used only once for each placement blockage in the BLOCKAGES statement.

#### Syntax

int defwBlockagesPlacementSoft()

### defwBlockagePolygon

Writes a POLYGON statement. Either a RECT or a POLYGON statement is required with a LAYER, LAYER COMPONENT, FILLS, SLOTS, or PUSHDOWN statement. The POLYGON statement can be used more than once for each routing blockage in the BLOCKAGES statement.

Note: This function will become obsolete in the next parser release. Use defwBlockagesPolygon instead.

#### Syntax

defwBlockagePolygon(
  int
num_polys,
  double* xl,
  double* yl)

#### Arguments

num_polys

> Specifies the number of polygon sides.

xl yl

> Specifies a sequence of points to generate a polygon geometry. The polygon edges must be parallel to the x axis, to the y axis, or at a 45-degree angle.

### defwBlockagesPolygon

Writes a POLYGON statement. Either a RECT or a POLYGON statement is required with a LAYER, LAYER COMPONENT, FILLS, SLOTS, or PUSHDOWN statement. The POLYGON statement can be used more than once for each routing blockage in the BLOCKAGES statement.

#### Syntax

int defwBlockagesPolygon(
  int
num_polys,
  double* xl,
  double* yl)

#### Arguments

num_polys

> Specifies the number of polygon sides.

xl yl

> Specifies a sequence of points to generate a polygon geometry. The polygon edges must be parallel to the x axis, to the y axis, or at a 45-degree angle.

### defwBlockageRect

Writes a RECT statement. Either a RECT or a POLYGON statement is required with a LAYER, LAYER COMPONENT, FILLS, SLOTS, or LAYER PUSHDOWN statement. A RECT statement is also required with a PLACEMENT COMPONENT or PLACEMENT PUSHDOWN statement. The RECT statement can be used more than once for each blockage in the BLOCKAGES statement.

Note: This function will become obsolete in the next parser release. Use defwBlockagesRect instead.

#### Syntax

int defwBlockageRect(
  int
xl,
  int yl,
  int xh,
  int yh)

#### Arguments

xl yl xh yh

> Specifies the absolute coordinates of the blockage geometry.

### defwBlockagesRect

Writes a RECT statement. Either a RECT or a POLYGON statement is required with a LAYER, LAYER COMPONENT, FILLS, SLOTS, or LAYER PUSHDOWN statement. A RECT statement is also required with a PLACEMENT COMPONENT or PLACEMENT PUSHDOWN statement. The RECT statement can be used more than once for each blockage in the BLOCKAGES statement.

#### Syntax

int defwBlockagesRect(
  int
xl,
  int yl,
  int xh,
  int yh)

#### Arguments

xl yl xh yh

> Specifies the absolute coordinates of the blockage geometry.

### defwBlockagesLayerMask

Writes the blockage layer color mask.

#### Syntax

int defwBlockagesLayerMask(
  int
maskColor)

#### Arguments

maskColor

> Specifies the mask color.

### defwBlockageSpacing

Writes a SPACING statement for the blockage. Either a SPACING or a DESIGNRULEWIDTH statement can be specified for a routing blockage. The SPACING statement is optional and can be used only once for each routing blockage in the BLOCKAGES statement.

#### Syntax

defwBlockageSpacing(
  int
minSpacing)

#### Arguments

minSpacing

> Specifies the minimum spacing between this blockage and any other routing shape.

## Bus Bit Characters

The Bus Bit Characters routine writes a DEF BUSBITCHARS statement. The BUSBITCHARS statement is required and can be used only once in a DEF file. For syntax information about the DEF BUSBITCHARS statement, see "Bus Bit Characters" in the LEF/DEF Language Reference.

This routine returns 0 if successful.

### defwBusBitChars

Writes a BUSBITCHARS statement.

#### Syntax

int defwBusBitChars(
  const char*
busBitChars)

#### Arguments

busBitChars

> Specifies the pair of characters used to specify bus bits when DEF names are mapped to or from other databases. The characters must be enclosed in double quotation marks.
> If one of the bus bit characters appears in a DEF name as a regular character, you must use a backslash ( \) before the character to prevent the DEF reader from interpreting the character as a bus bit delimiter.

## Components

Components routines write a DEF COMPONENTS section. The COMPONENTS section is optional and can be used only once in a DEF file. For syntax information about the DEF COMPONENTS section, see "Components" in the LEF/DEF Language Reference.

The COMPONENTS section must start and end with the defwStartComponents and defwEndComponents routines. All components must be defined between these routines.

If the DEF file contains a REGIONS statement, the COMPONENTS statement must follow it. For more information about the DEF REGIONS routines, see "Regions".

For examples of the routines described here, see "Components Example".

Note: To write a PROPERTY statement for the component, you must use one of the property routines between the routines described here. For more information, see "Property Statements".

All routines return 0 if successful.

### defwStartComponents

Starts the COMPONENTS section.

#### Syntax

int defwStartComponents(
  int
count)

#### Arguments

count

> Specifies the number of components defined in the COMPONENTS section.

### defwEndComponents

Ends the COMPONENTS section.

If the count specified in defwStartComponents is not the same as the actual number of defwComponent routines used, this routine returns DEFW_BAD_DATA.

#### Syntax

int defwEndComponents(void)

### defwComponent

Writes a set of statements that define one component. This routine is required and can be used more than once in the COMPONENTS statement.

If you specify 0 for all optional arguments except weight, they are ignored. For weight, you must specify -1.0.

#### Syntax

int defwComponent(
  const char*
name,
  const char* master,
  const char* eeq,
  const char* source,
  const char* status,
  int statusX,
  int statusY,
  int statusOrient,
  double weight,
  const char* region,)

#### Arguments

eeq

> Optional argument that specifies that the component being defined should be electrically equivalent to eeq (a previously defined component). Specify NULL to ignore this argument.

master

> Specifies the name of a model defined in the library.

name

> Specifies the component name, which is an instance of master.

region

> Optional argument that specifies the name of a previously defined region in which the component must lie. Specify NULL to ignore this argument.

status

> Optional argument that specifies the component state. Specify NULL to ignore this argument.
> Value: Specify one of the following:

| COVER | Specifies that the component has a location and is a part of the cover macro. It cannot be moved by automatic tools or interactive commands.
| FIXED | Specifies that the component has a location and cannot be moved by automatic tools, but can me moved using interactive commands.
| PLACED | Specifies that the component has a location, but can be moved using automatic layout tools.
| UNPLACED | Specifies that the component does not have a location.

statusOrient

> Optional argument that specifies the orientation of the component. Specify -1 to ignore this argument.
> Value: 0 to 7. For more information, see "Orientation Codes".

statusX statusY

> Optional arguments that specify the location of the component. Specify 0 to ignore these arguments.

source

> Optional argument that specifies the source of the component. Specify NULL to ignore this argument.
> Value: Specify one of the following:

| DIST | Component is a physical component (that is, it only connects to power or ground nets), such as filler cells, well-taps, and decoupling caps.
| NETLIST | Component is specified in the original netlist. This is the default value, and is normally not written out in the DEF file.
| TIMING | Component is a logical rather than physical change to the netlist, and is typically used as a buffer for a clock-tree, or to improve timing on long nets.
| USER | Component is generated by the user for some user-defined reason.

weight

> Optional argument that specifies the weight of the component, which determines if automatic placement attempts to keep the component near the specified location. weight is only meaningful when the component is placed. All non-zero weights have the same effect during automatic placement. Specify 0 to ignore this argument.

### defwComponentStr

Also writes a set of statements that define one component. This routine is the same as the defwComponent routine, with the exception of the foreignOrients argument, which takes a string instead of an integer.This routine is required and can be used more than once in the COMPONENTS statement.

If you specify 0 for all optional arguments except weight, they are ignored. For weight, you must specify -1.0.

#### Syntax

int defwComponent(
  const char*
name,
const char* master,
const char* eeq,
const char* source,
const char* status,
int statusX,
  int statusY,
const char* statusOrient,
  double weight,
  const char* region,)

#### Arguments

eeq

> Optional argument that specifies that the component being defined should be electrically equivalent to eeq (a previously defined component). Specify NULL to ignore this argument.

master

> Specifies the name of a model defined in the library.

name

> Specifies the component name, which is an instance of master.

region

> Optional argument that specifies the name of a previously defined region in which the component must lie. Specify NULL to ignore this argument.

status

> Optional argument that specifies the component state. Specify NULL to ignore this argument.
> Value: Specify one of the following:

| COVER | Specifies that the component has a location and is a part of the cover macro. It cannot be moved by automatic tools or interactive commands.
| FIXED | Specifies that the component has a location and cannot be moved by automatic tools, but can me moved using interactive commands.
| PLACED | Specifies that the component has a location, but can be moved using automatic layout tools.
| UNPLACED | Specifies that the component does not have a location.

statusOrient

> Optional argument that specifies the orientation of the component. Specify NULL to ignore this argument.
> Value: N, W, S, E, FN, FW, FS, or FE

statusX statusY

> Optional arguments that specify the location of the component. Specify 0 to ignore these arguments.

source

> Optional argument that specifies the source of the component. Specify NULL to ignore this argument.
> Value: Specify one of the following:

| DIST | Component is a physical component (that is, it only connects to power or ground nets), such as filler cells, well-taps, and decoupling caps.
| NETLIST | Component is specified in the original netlist. This is the default value, and is normally not written out in the DEF file.
| TIMING | Component is a logical rather than physical change to the netlist, and is typically used as a buffer for a clock-tree, or to improve timing on long nets.
| USER | Component is generated by the user for some user-defined reason.

weight

> Optional argument that specifies the weight of the component, which determines if automatic placement attempts to keep the component near the specified location. weight is only meaningful when the component is placed. All non-zero weights have the same effect during automatic placement. Specify 0 to ignore this argument.

### defwComponentHalo

Writes a HALO statement for a component. The HALO statement creates a placement blockage around the component. The HALO statement is optional and can be used only once for each component in the COMPONENT statement. If you call this routine, you cannot call defwComponentHaloSoft.

#### Syntax

defwComponentHalo(
  int
left,
  int bottom,
  int right,
  int top)

#### Arguments

left bottom right top

> Specifies the amount the halo extends from the left, bottom, right, and top edges of the LEF macro.

### defwComponentHaloSoft

Writes a HALO SOFT statement. This routine is similar to defwComponentHalo, except that it also writes the SOFT option. The HALO SOFT statement is optional and can be used only once for each component. If you call this routine, you cannot call defwComponentHalo.

#### Syntax

int defwComponentHaloSoft(
  int
left,
  int bottom,
  int right,
  int top)

#### Arguments

left bottom right top

> Specifies the amount the halo extends from the left, bottom, right, and top edges of the LEF macro.

### defwComponentRouteHalo

Writes a ROUTEHALO statement. The ROUTEHALO statement is optional and can be used only once for each component.

#### Syntax

int defwComponentRouteHalo(
  int
haloDist,
  const char* minLayer,
  const char* maxLayer)

#### Arguments

haloDist

> Specifies the halo distance, as an integer in DEF database units.

minLayer

> Specifies the minimum layer. The routing halo exists for the routing layers between minLayer and maxLayer. minLayer must be a lower routing layer than maxLayer. minLayer must be a string that matches a LEF routing layer name.

maxLayer

> Specifies the maximum layer. The routing halo exists for the routing layers between minLayer and maxLayer. maxLayer must be a string that matches a LEF routing layer name.

#### Components Example

The following example shows a callback routine with the type defwComponentCbkType. This example only shows the usage of some functions related to component.

int componentCB (defwCallbackType_e type,
  defiUserData userData) {
  int res;
  const char** foreigns;
  int *foreignX, *foreignY, *foreignOrient;

// Check if the type is correct
  if (type != defwComponentCbkType) {
  printf("Type is not defwComponentCbkType, terminate
  writing.\n");
  return 1;
  }
  foreigns = (const char**)malloc(sizeof(char*)*1);
  foreignX = (int*)malloc(sizeof(int)*1);
  foreignY = (int*)malloc(sizeof(int)*1);
  foreignOrient = (int*)malloc(sizeof(int)*1);
  res = defwStartComponents(2);
  CHECK_RES(res);
  res = defwComponent("Z38A01", "DFF3", 0, NULL, NULL, NULL,
  NULL, NULL, 0, NULL, NULL, NULL, NULL,
  "PLACED", 18592, 5400, 6, 0, NULL, 0, 0, 0,
  0);
  CHECK_RES(res);
  foreigns[0] = strdup("gds2name");
  foreignX[0] = -500;
  foreignY[0] = -500;
  foreignOrient[0] = 3;
  res = defwComponent("cell3", "CHM6A", 0, NULL, NULL, NULL,
  NULL, "TIMING", 1, foreigns, foreignX,
  foreignY, foreignOrient, "PLACED", 240, 10,
  0, 0, "region1", 0, 0, 0, 0);
  CHECK_RES(res);
  res = defwStringProperty("cc", "This is the copy list");
  CHECK_RES(res);
  res = defwIntProperty("index", 9);
  CHECK_RES(res);
  res = defwRealProperty("size", 7.8);
  CHECK_RES(res);
  res = defwEndComponents();
  CHECK_RES(res);
  free((char*)foreigns[0]);
  free((char*)foreigns);
  free((char*)foreignX);
  free((char*)foreignY);
  free((char*)foreignOrient);
  return 0;}

## Design Name

The Design routine writes a DEF DESIGN statement. The DESIGN statement is required and can be used only once in a DEF file. For syntax information about the DESIGN statement, see "Design" in the LEF/DEF Language Reference.

This routine returns 0 if successful.

### defwDesignName

Writes a DESIGN statement.

#### Syntax

int defwDesignName(
  const char*
name)

#### Arguments

name

> Specifies a name for the design.

## Die Area

Die Area routines write a DEF DIEAREA statement. The DIEAREA statement is optional and can be used only once in a DEF file. For syntax information about the DEF DIEAREA statement, see "Die Area" in the LEF/DEF Language Reference.

If the DEF file contains a PROPERTYDEFINITIONS statement, the DIEAREA statement must follow it. For more information about the DEF PROPERTYDEFINITIONS statement, see "Property Definitions".

This routine returns 0 if successful.

### defwDieArea

Writes a DIEAREA statement.

#### Syntax

int defwDieArea (
  int
xl,
  int yl,
  int xh,
  int yh )

#### Arguments

xl, yl, xh, yh

> Specifies the points of two corners of the bounding rectangle for the design. Geometric shapes (such as blockages, pins, and special net routing) can be outside of the die area, to allow proper modeling of pushed down routing from top-level designs into sub blocks. However, routing tracks should still be inside the die area.

### defwDieAreaList

Writes a DIEAREA statement that includes more than two points.

#### Syntax

defwDieAreaList(
  int num_points,
  int* xl,
  int*yh)

#### Arguments

num_points

> Specifies the number of points specified.

xl yh

> Specifies the points of a polygon that forms the die area. Geometric shapes (such as blockages, pins, and special net routing) can be outside of the die area, to allow proper modeling of pushed down routing from top-level designs into sub blocks. However, routing tracks should still be inside the die area.

### Die Area Example

The following example shows a callback routine with the type defwDieAreaCbkType.

int dieareaCB (defwCallbackType_e type,
  defiUserData userData) {
  int res;
  // Check if the type is correct
  if (type != defwDieAreaCbkType) {
  printf("Type is not defwDieAreaCbkType, terminate
  writing.\n");
  return 1;
  }
  res = defwDieArea(-190000, -120000, 190000, 70000);
  CHECK_RES(res);
  return 0;}

## Divider Character

The Divider Character routine writes a DEF DIVIDERCHAR statement. The DIVIDERCHAR statement is required and can be used only once in a DEF file. For syntax information about the DIVIDERCHAR statement, see "Divider Character" in the LEF/DEF Language Reference.

This routine returns 0 if successful.

### defwDividerChar

Writes a DIVIDERCHAR statement.

#### Syntax

int defwDividerChar(
  const char*
dividerChar)

#### Arguments

dividerChar

> Specifies the character used to express hierarchy when DEF names are mapped to or from other databases. The character must be enclosed in double quotation marks.
> If the divider character appears in a DEF name as a regular character, you must use a backslash (\) before the character to prevent the DEF reader from interpreting the character as a hierarchy delimiter.

## Extensions

The Extension routines write a series of statements that define the EXTENSIONS statement in the DEF file. The EXTENSIONS statement is optional and can be used only once in a DEF file. For syntax information about the EXTENSIONS statement, see "Extensions" in the LEF/DEF Language Reference.

You must use the defwStartBeginext and defwEndBeginext routines to create an EXTENSIONS statement. You must define all extensions between these routines.

For examples of the routines described here, see "Extensions Example".

All routines return 0 if successful.

### defwStartBeginext

Starts the EXTENSIONS statement.

#### Syntax

int defwStartBeginext(
  const char*
name)

#### Arguments

name

> Specifies the extension name.

### defwEndBeginext

Ends the BEGINEXT statement.

#### Syntax

int defwEndBeginext()

### defwBeginextCreator

Writes a CREATOR statement. The CREATOR statement is optional and can be used only once in an EXTENSIONS statement.

#### Syntax

int defwBeginextCreator(
  const char*
creatorName)

#### Arguments

creatorName

> Specifies a string value that defines the creator value.

### defwBeginextDate

Writes a DATE statement that specifies the current system time and date. The DATE statement is optional and can be used only once in an EXTENSIONS statement.

#### Syntax

int defwBeginextDate()

### defwBeginextRevision

Writes a REVISION statement. The REVISION statement is optional and can be used only once in an EXTENSIONS statement.

#### Syntax

int defwBeginextRevision(
  int
vers1,
  int vers2)

#### Arguments

vers1, vers2

> Specifies the values used for the revision number string.

### defwBeginextSyntax

Adds customized syntax to the DEF file. This routine is optional and can be used more than once in an EXTENSIONS statement.

#### Syntax

int lefwBeginextSyntax(
  const char*
title,
  const char* string)

#### Arguments

title, string

> Specify any values you need.

### Extensions Example

The following example shows a callback routine with the type defwExtCbkType. This example only shows the usage of some functions related to extensions.

int extensionCB (defwCallbackType_e type,
  defiUserData userData) {
  int res;
  // Check if the type is correct
  if (type != defwExtCbkType) {
  printf("Type is not defwExtCbkType, terminate
  writing.\n");
  return 1;
  }
  res = defwStartBeginext("tag");
  CHECK_RES(res);
  res = defwBeginextCreator("CADENCE");
  CHECK_RES(res);
  res = defwBeginextDate();
  CHECK_RES(res);
  res = defwBeginextSyntax("OTTER", "furry");
  CHECK_RES(res);
  res = defwStringProperty("arrg", "later");
  CHECK_RES(res);
  res = defwBeginextSyntax("SEAL", "cousin to WALRUS");
  CHECK_RES(res);
  res = defwEndBeginext();
  CHECK_RES(res);
  return 0;}

## Fills

Fills routines write a DEF FILLS statement. The FILLS statement is optional and can be used only once in a DEF file. For syntax information about the DEF FILLS statement, see "Fills" in the LEF/DEF Language Reference.

The DEF FILLS statement must start and end with the defwStartFills and defwEndFills routines. All fills must be defined between these routines.

All routines return 0 if successful.

### defwStartFills

Starts a FILLS statement.

#### Syntax

int defwStartFills(
  int
count)

#### Arguments

count

> Specifies the number of fills defined in the FILLS statement.

### defwEndFills

Ends the FILLS statement.

#### Syntax

int defwEndFills()

### defwFillLayer

Writes a LAYER statement. The LAYER statement is required for each fill and can be used more than once in a FILLS statement.

#### Syntax

int defwFillLayer(
  const char*
layerName)

#### Arguments

layerName Specifies the layer on which to create the fill.

### defwFillLayerOPC

Writes an OPC keyword for a FILLS LAYER statement, which specifies that FILL shapes require OPC correction during mask generation. defwFillLayer must be called before this routine. This routine is optional and can be called only once after the defwFillLayer or defwFillVia routine.

#### Syntax

int defwFillLayerOPC()

### defwFillPoints

Specifies the points for a FILLS VIA statement. This routine is required after defwFillVia and can be called more than once.

#### Syntax

int defwFillPoints(
  int
num_points,
  double* xl,
  double* yl)

#### Arguments

num_points

> Specifies the number of points provided.

x1 y1

> Specify the placement locations (x y points) for the via.

### defwFillPolygon

Writes a POLYGON statement. Either a POLYGON or a RECT statement is required with a LAYER statement. The POLYGON statement is required and can be used more than once for each fill in the FILLS statement.

#### Syntax

defwFillPolygon(
  int
num_polys,
  double* xl,
  double* yl)

#### Arguments

num_polys

> Specifies the number of polygon sides.

xl yl

> Specifies a sequence of points to generate a polygon geometry. The polygon edges must be parallel to the x axis, the y axis, or at a 45-degree angle.

### defwFillRect

Writes a RECT statement. Either a POLYGON or a RECT statement is required with a LAYER statement. The RECT statement is required and can be used more than once for each fill in the FILLS statement.

#### Syntax

int defwFillRect(
  int
xl,
  int yl,
  int xh,
  int yh)

#### Arguments

xl, yl, xh, yh

> Specifies the coordinates of the fill.

### defwFillVia

Writes a FILLS VIA statement. The FILLS VIA statement is optional and can be used more than once. Call defwFillPoints after this routine.

#### Syntax

int defwFillVia(
  const char*
viaName)

#### Arguments

viaName

> The name of the via, which must be previously defined in the DEF VIA or LEF VIA section.

### defwFillViaOPC

Writes the OPC keyword for a FILLS VIA statement, which specifies that FILL shapes require OPC correction during mask generation. This routine is optional and can only be called after defwFillVia.

#### Syntax

int defwFillViaOPC()

## GCell Grid

The Gcell Grid routine writes a DEF GCELLGRID statement. The GCELLGRID statement is optional and can be used only once in a DEF file. For syntax information about the DEF GCELLGRID statement, see GCell Grid in the LEF/DEF Language Reference.

If the DEF file contains a TRACKS statement, the GCELLGRID statement must follow it. For more information about the DEF TRACKS statement, see "Tracks".

This routine returns 0 if successful.

### defwGcellGrid

Writes a GCELLGRID statement.

#### Syntax

int defwGcellGrid(
  const char*
master,
int doStart,
  int doCount,
int doStep)

#### Arguments

doCount

> Specifies the number of columns or rows in the grid.

doStart

> Specifies the starting location of the grid (that is, the first column or row).

doStep

> Specifies the step spacing between the grid units.

master

> Specifies the direction of the tracks for the global router grid that overlays the array.
> Value: Specify one of the following:

| X | Specifies a vertical grid.
| Y | Specifies a horizontal grid.

### Gcell Grid Example

The following example shows a callback routine with the type defwGcellGridCbkType.

int gcellgridCB (defwCallbackType_e type,
  defiUserData userData) {
  int res;
  // Check if the type is correct
  if (type != defwGcellGridCbkType) {
  printf("Type is not defwGcellGridCbkType, terminate
  writing.\n");
  return 1;
  }
  res = defwGcellGrid("X", 0, 100, 600);
  CHECK_RES(res);
  return 0;}

## Groups

The Groups routines write a DEF GROUPS statement. The GROUPS statement is optional and can be used only once in a DEF file. For syntax information about the DEF GROUPS statement, see Groups in the LEF/DEF Language Reference.

You must begin and end a DEF GROUPS statement with the defwStartGroups and defwEndGroups routines. You must define all groups between these routines.

For examples of the routines described here, see "Groups Example".

Note: To write a PROPERTY statement for the component, you must use one of the property routines immediately following the defwGroup* routines that define the group. For more information, see "Property Statements".

All routines return 0 if successful.

### defwStartGroups

Starts the GROUPS statement.

#### Syntax

int defwStartGroups(
  int
count)

#### Arguments

count

> Specifies the number of groups defined in the GROUPS statement.

### defwEndGroups

Ends the GROUPS statement.

#### Syntax

int defwEndGroups()

### defwGroup

Writes a series of statements that define the specified group. This routine is required and can be used more than once in a GROUPS statement.

#### Syntax

int defwGroup(
  const char*
groupName,
  int numExpr,
const char** groupExpr)

#### Arguments

groupExpr

> Specifies a component name, a list of component names, or a regular expression for a set of components.

groupName

> Specifies the name for a group of components.

numExpr

> Specifies the number of components in the group.

### defwGroupRegion

Writes a REGION statement for the group defined. This statement is optional and can be used only once per group name.

#### Syntax

int defwGroupRegion(
  int
xl,
  int yl,
  int xh,
  int yh,
  const char* regionName)

#### Arguments

regionName

> Specifies the name of a previously defined region in which the group must lie.

xl xh yl yh

> Specifies the coordinates of a rectangular region in which the group must lie. Specify the coordinates or regionName; do not specify both.

#### Groups Example

The following example shows a callback routine with the type defwGroupCbkType.

int dividerCB (defwCallbackType_e type,
  defiUserData userData) {
  int res;
  const char **groupExpr;
  // Check if the type is correct
  if (type != defwGroupCbkType) {
  printf("Type is not defwGroupCbkType, terminate
  writing.\n");
  return 1;
  }
  groupExpr = (const char**)malloc(sizeof(char*)*2);
  res = defwStartGroups(2);
  CHECK_RES(res);
  groupExpr[0] = strdup("cell2");
  groupExpr[1] = strdup("cell3");
  res = defwGroup("group1", 2, groupExpr);
  CHECK_RES(res);
  free((char*)groupExpr[0]);
  free((char*)groupExpr[1]);
  res = defwGroupRegion(0, 0, 0, 0, "region1");
  CHECK_RES(res);
  res = defwStringProperty("ggrp", "xx");
  CHECK_RES(res);
  res = defwIntProperty("side", 2);
  CHECK_RES(res);
  res = defwRealProperty("maxarea", 5.6);
  CHECK_RES(res);
  groupExpr[0] = strdup("cell1");
  res = defwGroup("group2", 1, groupExpr);
  CHECK_RES(res);
  free((char*)groupExpr[0]);
  res = defwGroupRegion(0, 10, 1000, 1010, NULL);
  CHECK_RES(res);
  res = defwGroupSoft("MAXHALFPERIMETER", 4000, "MAXX", 10000,
  NULL, NULL);
  CHECK_RES(res);
  res = defwEndGroups();
  CHECK_RES(res);
  free((char*)groupExpr);
  // Write a new line
  res = defwNewLine();
  CHECK_RES(res);
  return 0;}

## History

The History routine writes a DEF HISTORY statement. The HISTORY statement is optional and can be used more than once in a DEF file. For syntax information about the DEF HISTORY statement, see History in the LEF/DEF Language Reference.

This routine returns 0 if successful.

### defwHistory

Writes a HISTORY statement.

#### Syntax

int defwHistory(
  const char*
string)

#### Arguments

string

> Lists a historical record about the design. Each line indicates one historical record. Any text excluding a semicolon (;) can be included. Linefeed and Return do not terminate the statement.

#### History Example

The following example shows a callback routine with the type defwHistoryCbkType.

int historyCB (defwCallbackType_e type,
  defiUserData userData) {
  int res;
  // Check if the type is correct
  if (type != defwHistoryCbkType) {
  printf("Type is not defwHistoryCbkType, terminate
  writing.\n");
  return 1;
  }
  res = defwHistory("DEF version 5.3");
  CHECK_RES(res);
  return 0;}

## Nets

Nets routines write a DEF NETS statement. The NETS statement is optional and can be used only once in a DEF file. For syntax information about the DEF NETS statement, see "Nets" in the LEF/DEF Language Reference.

A NETS statement must start and end with the defwStartNets and defwEndNets routines. All nets must be defined between these routines. Each individual net must start and end with either defwNet or defwNetMustjoinConnection, and defwNetEndOneNet.

For examples of the routines described here, see "Nets Example".

In addition to the routines in this section, you can also include routines that form a regularWiring statement, a SUBNET statement, and a PROPERTY statement. For information about these routines, see "Regular Wiring" , "Subnet" , and "Property Statements".

All routines return 0 if successful.

### defwStartNets

Starts a NETS statement. A NET statement must start and end with defwStartNets and defwEndNets.

#### Syntax

int defwStartNets(
  int
count)

#### Arguments

count

> Specifies the number of nets defined in the NETS statement.

### defwEndNets

Ends the NETS statement. A NET statement must start and end with defwStartNets and defwEndNets.

#### Syntax

int defwEndNets()

### defwNet

Starts a net description in the NETS statement. Each net description must start with either defwNet or defwNetMustJoinConnection, and end with defwNetEndOneNet.

If you specify this routine, you can optionally specify the following routine:

| defwNetConnection

#### Syntax

int defwNet(
  const char*
netName)

#### Arguments

netName

> Specifies the name of the net.

### defwNetMustjoinConnection

Writes a MUSTJOIN statement in the NETS statement. Each net description must start with either defwNet or defwNetMustJoinConnection, and end with defwNetEndOneNet.

#### Syntax

int defwNetMustjoinConnection(
  const char*
compName,
  const char* pinName)

#### Arguments

compName, pinName

> Identifies the net as a mustjoin by specifying one of its pins, using a component name and pin name.

### defwNetEndOneNet

Ends a net description in the NETS statement. Each net description must start with either defwNet or defwNetMustJoinConnection, and end with defwNetEndOneNet.

#### Syntax

int defwNetEndOneNet()

### defwNetConnection

Defines the net specified in defwNet. This routine can be used more than once for each net in a NETS statement.

Syntax

int defwNetConnection(
  const char*
compName,
  const char* pinName,
  int synthesized)

#### Arguments

compName

> Specifies the name of a regular component pin on the net. If you omit this value, the DEF writer writes the PIN statement.

pinName

> Specifies the name of an I/O pin on the net.

synthesized

> Optional argument that marks the pin as part of a synthesized scan chain.
> Value: Specify one of the following:

| 0 | Argument is ignored.
| 1 | Writes a SYNTHESIZED statement.

### defwNetEstCap

Writes an ESTCAP statement. The ESTCAP statement is optional and can be used only once for each net in the NETS statement.

#### Syntax

int defwNetEstCap(
  double
wireCap)

#### Arguments

wireCap

> Specifies the estimated wire capacitance for the net. ESTCAP can be loaded with simulation data to generate net constraints for timing-driven layout.

### defwNetFixedBump

Writes a FIXEDBUMP statement that indicates a bump cannot be assigned to a different pin. The FIXEDBUMP statement is optional and can be used only once for a net.

#### Syntax

int defwNetFixedBump()

### defwNetFrequency

Writes a FREQUENCY statement. The FREQUENCY statement is optional and can be used only once for a net.

#### Syntax

int defwNetFrequency(
  double
frequency)

#### Arguments

frequency

> Specifies the frequency of the net, in hertz. The frequency value is used by the router to choose the correct number of via cuts required for a given net, and by validation tools to verify that the AC current density rules are met.

### defwNetNondefaultRule

Writes a NONDEFAULTRULE statement. The NONDEFAULTRULE statement is optional and can be used only once for a net.

#### Syntax

int defwNetNondefaultRule(
  const char*
ruleName)

#### Arguments

ruleName

> Specifies that the net and wiring are created according to the specified nondefault rule defined in LEF.

### defwNetOriginal

Writes an ORIGINAL statement. The ORIGINAL statement is optional and can be used only once for a net.

#### Syntax

int defwNetOriginal(
  const char*
netName)

#### Arguments

netName

> Specifies the name of the original net partitioned to create multiple nets, including the net being defined.

### defwNetPattern

Writes a PATTERN statement. The PATTERN statement is optional and can be used only once for a net.

#### Syntax

int defwNetPattern(
  const char*
name)

#### Arguments

name

> Specifies the routing pattern used for the net.
> Value: Specify one of the following:

| BALANCED | Used to minimize skews in timing delays for clock nets.
| STEINER | Used to minimize net length.
| TRUNK | Used to minimize delay for global nets.
| WIREDLOGIC | Used in ECL designs to connect output and mustjoin pins before routing to the remaining pins.

### defwNetSource

Writes a SOURCE statement. The SOURCE statement is optional and can be used only once for a net.

#### Syntax

int defwNetSource(
  const char*
name)

#### Arguments

name

> Specifies the source of the net.
> Value: Specify one of the following:

| DIST | Net is the result of adding physical components (that is, components that only connect to power or ground nets), such as filler cells, well-taps, tie-high and tie-low cells, and decoupling caps.
| NETLIST | Net is defined in the original netlist. This is the default value, and is not normally written out in the DEF file.
| TEST | Net is part of a scanchain.
| TIMING | Net represents a logical rather than physical change to netlist, and is used typically as a buffer for a clock-tree, or to improve timing on long nets.
| USER | Net is user defined.

### defwNetUse

Writes a USE statement. The USE statement is optional and can be used only once for a net.

#### Syntax

int defwNetUse(
  const char*
name)

#### Arguments

name

> Specifies how the net is used.
> Value: Specify one of the following:

| ANALOG | Used as a analog signal net.
| CLOCK | Used as a clock net.
| GROUND | Used as a ground net.
| POWER | Used as a power net.
| RESET | Used as a reset net.
| SCAN | Used as a scan net.
| SIGNAL | Used as digital signal net.
| TIEOFF | Used as a tie-high or tie-low net.

### defwNetVpin

Writes a VPIN statement. The VPIN statement is optional and can be used more than once for a net.

#### Syntax

int defwNetVpin(
  const char*
vpinName,
  const char* layerName,
  int layerXl,
  int layerYl,
  int layerXh,
  int layerYh,
  const char* status,
  int statusX,
  int statusY,
  int orient)

#### Arguments

layerName

> Optional argument that specifies the layer on which the virtual pin lies. Specify NULL to ignore this argument.

layerXl layerYl layerXh layerYh

> Specifies the physical geometry of the virtual pin.

orient

> Optional argument that specifies the orientation of the virtual pin. Specify -1 to ignore this argument.
> Value: 0 to 7. For more information, see "Orientation Codes".

status

> Optional argument that specifies the placement status of the virtual pin. Specify NULL to ignore this argument.
> Value: specify one of the following:

| COVER | Specifies that the pin has a location and is a part of the cover macro. It cannot be moved by automatic tools or interactive commands.
| FIXED | Specifies that the pin has a location and cannot be moved by automatic tools but can be moved by interactive commands.
| PLACED | Specifies that the pin has a location, but can be moved during automatic layout.

statusX statusY

> Optional arguments that specify the placement location of the virtual pin. If you specify status, you must specify these arguments. Specify 0 to ignore these arguments.

vpinName

> Specifies the name of the virtual pin to define.

### defwNetVpinStr

Also writes a VPIN statement. This routine is the same as the defwNetVpin routine, with the exception of the orient argument, which takes a string instead of an integer. The VPIN statement is optional and can be used more than once for a net.

#### Syntax

int defwNetVpin(
  const char*
vpinName,
const char* layerName,
int layerXl,
int layerYl,
int layerXh,
int layerYh,
const char* status,
int statusX,
int statusY,
  const char* orient)

#### Arguments

layerName

> Optional argument that specifies the layer on which the virtual pin lies. Specify NULL to ignore this argument.

layerXl layerYl layerXh layerYh

> Specifies the physical geometry of the virtual pin.

orient

> Optional argument that specifies the orientation of the virtual pin. Specify NULL to ignore this argument.
> Value: N, W, S, E, FN, FW, FS, or FE

status

> Optional argument that specifies the placement status of the virtual pin. Specify NULL to ignore this argument.
> Value: specify one of the following:

| COVER | Specifies that the pin has a location and is a part of the cover macro. It cannot be moved by automatic tools or interactive commands.
| FIXED | Specifies that the pin has a location and cannot be moved by automatic tools but can be moved by interactive commands.
| PLACED | Specifies that the pin has a location, but can be moved during automatic layout.

statusX statusY

> Optional arguments that specify the placement location of the virtual pin. If you specify status, you must specify these arguments. Specify 0 to ignore these arguments.

vpinName

> Specifies the name of the virtual pin to define.

### defwNetWeight

Writes a WEIGHT statement. The WEIGHT statement is optional and can be used only once for a net.

#### Syntax

int defwNetWeight(
  double
weight)

#### Arguments

weight

> Specifies the weight of the net. Automatic layout tools attempt to shorten the lengths of nets with high weights. A value of 0 indicates that the net length for that net can be ignored. A value of 1 specifies that the net should be treated normally. A larger weight specifies that the tool should try harder to minimize the net length of that net.
> For normal use, timing constraints are generally a better method to use for controlling net length than net weights. For the best results, you should typically limit the maximum weight to 10, and not add weights to more than 3 percent of the nets.

### defwNetXtalk

Writes a XTALK statement. The XTALK statement is optional and can be used only once for a net.

#### Syntax

int defwNetXtalk(
  int
num)

#### Arguments

num

> Specifies the crosstalk class number for the net. If you specify the default value (0), the XTALK statement will not be written to the DEF file.
> Value: 0 to 200

### Nets Example

The following example shows a callback routine with the type defwNetCbkType. This example only shows the usage of some functions related to net.

int netCB (defwCallbackType_e type,
  defiUserData userData) {
  int res;
  const char **coorX, **coorY;
  const char **coorValue;
  // Check if the type is correct
  if (type != defwNetCbkType) {
  printf("Type is not defwNetCbkType, terminate
  writing.\n");
  return 1;
  }
  res = defwStartNets(3);
  CHECK_RES(res);
  coorX = (const char**)malloc(sizeof(char*)*5);
  coorY = (const char**)malloc(sizeof(char*)*5);
  coorValue = (const char**)malloc(sizeof(char*)*5);
  res = defwNet("my_net");
  CHECK_RES(res);
  res = defwNetConnection("I1", "A", 0);
  CHECK_RES(res);
  res = defwNetConnection("BUF", "Z", 0);
  CHECK_RES(res);
  res = defwNetNondefaultRule("RULE1");
  CHECK_RES(res);
  res = defwNetShieldnet("VSS");
  CHECK_RES(res);
  res = defwNetPathStart("ROUTED");
  CHECK_RES(res);
  ...
  = defwNetNoshieldStart("M2");
  CHECK_RES(res);
  coorX[0] = strdup("14100");
  coorY[0] = strdup("341440");
  coorX[1] = strdup("14000");
  coorY[1] = strdup("*");
  res = defwNetNoshieldPoint(2, coorX, coorY);
  CHECK_RES(res);
  res = defwNetNoshieldEnd();
  CHECK_RES(res);
  res = defwNetEndOneNet();
  CHECK_RES(res);
  res = defwNet("MUSTJOIN");
  CHECK_RES(res);
  res = defwNetConnection("cell4", "PA1", 0);
  CHECK_RES(res);
  res = defwNetEndOneNet();
  CHECK_RES(res);
  res = defwNet("XX100");
  CHECK_RES(res);
  res = defwNetConnection("Z38A05", "G", 0);
  CHECK_RES(res);
  res = defwNetConnection("Z38A03", "G", 0);
  CHECK_RES(res);
  res = defwNetConnection("Z38A01", "G", 0);
  CHECK_RES(res);
  res = defwNetVpin("V_SUB3_XX100", NULL, -333, -333, 333,
  333, "PLACED", 189560, 27300, 0);
  CHECK_RES(res);
  res = defwNetSubnetStart("SUB1_XX100");
  CHECK_RES(res);
  ...
  // An example for Regular Wiring can be found in the
  // Regular Wiring section.
  res = defwNetPathEnd();
  CHECK_RES(res);
  res = defwNetNoshieldStart("M2");
  CHECK_RES(res);
  coorX[0] = strdup("14100");
  coorY[0] = strdup("341440");
  coorX[1] = strdup("14000");
  coorY[1] = strdup("*");
  res = defwNetNoshieldPoint(2, coorX, coorY);
  CHECK_RES(res);
  res = defwNetNoshieldEnd();
  CHECK_RES(res);
  res = defwNetEndOneNet();
  CHECK_RES(res);
  res = defwNet("MUSTJOIN");
  CHECK_RES(res);
  res = defwNetConnection("cell4", "PA1", 0);
  CHECK_RES(res);
  res = defwNetEndOneNet();
  CHECK_RES(res);
  res = defwNet("XX100");
  CHECK_RES(res);
  res = defwNetConnection("Z38A05", "G", 0);
  CHECK_RES(res);
  res = defwNetConnection("Z38A03", "G", 0);
  CHECK_RES(res);
  res = defwNetConnection("Z38A01", "G", 0);
  CHECK_RES(res);
  res = defwNetVpin("V_SUB3_XX100", NULL, -333, -333, 333,
  333, "PLACED", 189560, 27300, 0);
  CHECK_RES(res);
  res = defwNetSubnetStart("SUB1_XX100");
  CHECK_RES(res);
  ...
  // An example for Subnet can be found in the Subnet section
  CHECK_RES(res);
  res = defwNetSubnetEnd();
  CHECK_RES(res);
  res = defwEndNets();
  CHECK_RES(res);
  return 0;}

## Regular Wiring

Routines described in this section form a regularWiring statement that can be used to define regular wiring for a net or subnet. The regularWiring statement is optional and can be used more than once in a NETS statement. For syntax information about the DEF NETS statement, see "Nets" in the LEF/DEF Language Reference.

A regularWiring statement must start and end with the defwNetPathStart and defwNetPathEnd routines. All regular wiring must be defined between these routines.

For examples of the routines described here, see "Regular Wiring Example".

The regular wiring routines can be included between the following pairs of routines:

| defwNet and defwEndOneNet

| defwNetMustjoinConnection and defwEndOneNet

| defwNetSubnetStart and defwSubnetEnd

All routines return 0 if successful.

### defwNetPathStart

Starts a regularWiring statement.

#### Syntax

int defwNetPathStart(
  const char*
type)

#### Arguments

type

> Specifies the regular wiring type.
> Value: Specify one of the following:

| COVER | Specifies that the wiring cannot be moved by either automatic layout or interactive commands.
| FIXED | Specifies that the wiring cannot be moved by automatic layout, but can be changed by interactive commands.
| ROUTED | Specifies that the wiring can be moved by the automatic layout tools.
| NOSHIELD | Specifies that the last wide segment of the net is not shielded.

### defwNetPathEnd

Ends the regularWiring statement.

#### Syntax

int defwNetPathEnd()

### defwNetPathLayer

Writes a LAYER statement. The LAYER statement is required and can be used more than once in the regularWiring statement.

#### Syntax

int defwNetPathLayer(
  const char*
layerName,
  int isTaper,
  const char* rulename)

#### Arguments

layerName

> Specifies the layer name on which the wire lies.

isTaper

> Optional argument that writes the keyword TAPER, which specifies that the next contiguous wire segment is created using the default rule.
> Value: Specify one of the following:

| 0 | Ignores the argument.
| 1 | Writes the keyword TAPER. If you specify 1, you must specify NULL for the rulename argument.

ruleName

> Optional argument that specifies that the next contiguous wire segment is created using the specified nondefault rule (ruleName). Specify NULL to ignore this argument. If you specify a rulename, you must specify 0 for the isTaper argument.

### defwNetPathPoint

Defines the center line coordinates of the route on the layer specified with defwNetPathLayer. This routine is required and can be used only once for each layer in the regularWiring statement.

#### Syntax

int defwNetPathPoint(
  int
numPts,
  const char** pointX,
  const char** pointY,
  const char** value)

#### Arguments

numPts

> Specifies the number of points in the wire path (route)

pointX pointY

> Specifies the coordinates of the path points.

value

> Optional argument that specifies the amount by which the wire is extended past the end point of the segment. This value must be greater than or equal to 0 (zero). Specify NULL to ignore this argument.

### defwNetPathStyle

Writes a STYLE statement for the layer specified with defwNetPathLayer. The STYLE statement is optional and can be used only once for each layer in the regularWiring statement.

#### Syntax

defwNetPathStyle(
  int
styleNum)

#### Arguments

styleNum

> Specifies a previously defined style from the STYLES section in this DEF file. If a style is specified, the wire's shape is defined by the center line coordinates and the style.

### defwNetPathVia

Specifies a via to place at the last point on the layer specified with defwNetPathLayer. This routine is optional and can be used only once for each layer in the regularWiring statement.

#### Syntax

int defwNetPathVia(
  const char*
viaName)

#### Arguments

viaName

> Specifies the via to place at the last specified path coordinate.

### defwNetPathViaWithOrient

Specifies the orientation of the via specified with defwNetPathVia. This routine is optional and can be used only once for each via in the regularWiring statement.

#### Syntax

defwNetPathViaWithOrient(
  const char*
name,
  int orient)

#### Arguments

name

> Specifies the via.

orient

> Specifies the orientation.
> Value: 0 to 7. For more information, see "Orientation Codes"

### defwNetPathViaWithOrientStr

Also specifies the orientation of the via specified with defwNetPathVia. This routine is the same as the defwNetPathViaWithOrient routine, with the exception of the orient argument, which takes a string instead of an integer. The defwNetPathViaWithOrientStr is optional and can be used only once for each via in the regularWiring statement.

#### Syntax

defwNetPathViaWithOrient(
  const char*
name,
  int orient)

#### Arguments

name

> Specifies the via.

orient

> Specifies the orientation. Specify NULL to ignore this argument.
> Value: N, W, S, E, FN, FW, FS, or FE

### Regular Wiring Example

The following example only shows the usage of some functions related to regular wiring in a net. This example is part of the net callback routine.

int netCB (defwCallbackType_e type,
  defiUserData userData) {
  int res;
  const char **coorX, **coorY;
  const char **coorValue;
  ...
  res = defwNetPathStart("NEW");
  CHECK_RES(res);
  res = defwNetPathLayer("M1", 1, NULL);
  CHECK_RES(res);
  coorX[0] = strdup("2400");
  coorY[0] = strdup("282400");
  coorValue[0] = NULL;
  coorX[1] = strdup("240");
  coorY[1] = strdup("*");
  coorValue[1] = NULL;
  res = defwNetPathPoint(2, coorX, coorY, coorValue);
  CHECK_RES(res);
  free((char*)coorX[0]);
  free((char*)coorY[0]);
  free((char*)coorX[1]);
  free((char*)coorY[1]);
  res = defwNetPathEnd();
  CHECK_RES(res);
  ...
  return 0;}

## Subnet

The Subnet routines write a SUBNET statement which further defines a net. A SUBNET statement is optional and can be used more than once in a NETS statement. For information about the DEF NETS statement, see "Nets" in the LEF/DEF Language Reference.

You must begin and end a SUBNET statement with the defwNetSubnetStart and defwSubnetEnd routines. You must define all subnets between these routines.

For examples of the routines described here, see "Subnet Example".

In addition to the routines described in this section, you can include a NONDEFAULTRULE statement and a regularWiring statement within a SUBNET statement. For more information about these routines, see defwNetNondefaultRule , or "Regular Wiring".

All routines return 0 if successful.

### defwNetSubnetStart

Starts a SUBNET statement. This statement is optional and can be used only once in a NETS statement.

#### Syntax

int defwNetSubnetStart(
  const char*
name)

#### Arguments

name

> Specifies the name of the subnet.

### defwNetSubnetEnd

Ends a SUBNET statement.

#### Syntax

int defwNetSubnetEnd()

### defwNetSubnetPin

Specifies a component for the SUBNET statement. This routine is optional and can be used more than once in a SUBNET statement.

#### Syntax

int defwNetSubnetPin(
  const char*
component,
  const char* name)

#### Arguments

component

> Specifies either a component name, or the value PIN or VPIN.

name

> Specifies either a pin name if component is set to PIN, or a virtual pin name if component is set to VPIN.

### Subnet Example

The following example only shows the usage of some functions related to subnet in a net. This example is part of the net callback routine.

int netCB (defwCallbackType_e type,
  defiUserData userData) {
  int res;
  const char **coorX, **coorY;
  const char **coorValue;
  ...
  res = defwNetSubnetStart("SUB1_XX100");
  CHECK_RES(res);
  res = defwNetSubnetPin("Z38A05", "G");
  CHECK_RES(res);
  res = defwNetSubnetPin("VPIN", "V_SUB1_XX100");
  CHECK_RES(res);
  res = defwNetPathStart("ROUTED");
  CHECK_RES(res);
  res = defwNetPathLayer("M1", 0, "RULE1");
  CHECK_RES(res);
  coorX[0] = strdup("54040");
  coorY[0] = strdup("30300");
  coorValue[0] = strdup("0");
  coorX[1] = strdup("*");
  coorY[1] = strdup("30900");
  coorValue[1] = NULL;
  res = defwNetPathPoint(2, coorX, coorY, coorValue);
  CHECK_RES(res);
  free((char*)coorX[0]);
  free((char*)coorY[0]);
  free((char*)coorValue[0]);
  free((char*)coorX[1]);
  free((char*)coorY[1]);
  res = defwNetPathVia("nd1VIA12");
  CHECK_RES(res);
  ...
  res = defwNetPathEnd();
  CHECK_RES(res);
  res = defwNetSubnetEnd();
  ...
  return 0;}

## Nondefault Rules

Nondefault rule routines write a DEF NONDEFAULTRULES statement. The NONDEFAULTRULES statement is optional and can be used only once in a DEF file. For syntax information about the DEF NONDEFAULTRULES statement, see "Nondefault Rules" in the LEF/DEF Language Reference.

The NONDEFAULTRULES statement must start and end with the defwStartNonDefaultRules and defwEndNonDefaultRules routines. All nondefault rules must be defined between these two routines. Each individual nondefault rule must start with defwNonDefaultRule.

Note: To write a PROPERTY statement for the nondefault rule, you must use one of the property routines immediately following the defwNonDefaultRule routine. For more information, see "Property Statements".

All routines return 0 if successful.

### defwStartNonDefaultRules

Starts a NONDEFAULTRULES statement.

#### Syntax

defwStartNonDefaultRules(
  int
count)

#### Arguments

count

> Specifies the number of rules defined in the NONDEFAULTRULES statement.

### defwEndNonDefaultRules

Ends the NONDEFAULTRULES statement.

#### Syntax

defwEndNonDefaultRules()

### defwNonDefaultRule

Starts a nondefault rule definition. This routine is required for each nondefault rule and can be used more than once in the NONDEFAULTRULES statement.

#### Syntax

defwNonDefaultRule(
  const char*
ruleName,
  int hardSpacing)

#### Arguments

ruleName

> Specifies the name for this nondefault rule. This name can be used in the NETS section wherever a nondefault rule name is allowed. The reserved name DEFAULT can be used to indicate the default routing rule used in the NETS section.

hardSpacing

> Optional argument that specifies that any spacing values that exceed the LEF LAYER ROUTING spacing requirements are "hard" rules instead of "soft" rules. Specify 0 to ignore this argument.

### defwNonDefaultRuleLayer

Writes a LAYER statement for the nondefault rule. The LAYER statement is required and can be used more than once for each nondefault rule in the NONDEFAULTRULES statement.

#### Syntax

defwNonDefaultRuleLayer(
  const char*
layerName,
  double width,
  double diagWidth,
  double spacing,
  double wireExt)

#### Arguments

layerName

> `Specifies the layer for the various width and spacing values. layerName must be a routing layer.

width

> Specifies the required minimum width allowed for layerName.

diagWidth

> Optional argument that specifies the diagonal width for layerName, when 45-degree routing is used. Specify 0 to ignore this argument.

spacing

> Optional argument that specifies the minimum spacing for layerName. The LEF LAYER SPACING or SPACINGTABLE definitions always apply; therefore it is only necessary to add a SPACING value if the desired spacing is larger than the LAYER rules already require. Specify 0 to ignore this argument.

wireExt

> Optional argument that specifies the distance by which wires are extended at vias on layerName. Specify 0 to ignore this argument.

### defwNonDefaultRuleMinCuts

Writes a MINCUTS statement. The MINCUTS statement is optional and can be used more than once for each nondefault rule in the NONDEFAULTRULES statement.

#### Syntax

defwNonDefaultRuleMinCuts(
  const char*
cutLayerName,
  int numCuts)

#### Arguments

cutLayerName

> Specifies the cut layer.

numCuts

> Specifies the minimum number of cuts allowed for any via using cutLayerName. All vias (generated or fixed vias) used for this nondefault rule must have at least numCuts cuts in the via.

### defwNonDefaultRuleVia

Writes a VIA statement for the nondefault rule. The VIA statement is optional and can be used more than once for each nondefault rule in the NONDEFAULTRULES statement.

#### Syntax

defwNonDefaultRuleVia(
  const char*
viaName)

#### Arguments

viaName

> Specifies a previously defined LEF or DEF via to use with this rule.

### defwNonDefaultRuleViaRule

Writes a VIARULE statement. The VIARULE statement is optional and can be used more than once for each nondefault rule in the NONDEFAULTRULES statement.

#### Syntax

defwNonDefaultRuleViaRule(
  const char*
viaRuleName)

#### Arguments

viaRuleName

> Specifies a previously defined LEF VIARULE GENERATE to use with this routing rule. If no via or via rule is specified for a given routing-cut-routing layer combination, then a VIARULE GENERATE DEFAULT via rule must exist for that combination, and it is implicitly inherited.

## Pins

Pin routines write a DEF PINS statement. The PINS statement is optional and can be used only once in a DEF file. For syntax information about the DEF PINS statement, see "Pins" in the LEF/DEF Language Reference.

A PINS statement must start and end with the defwStartPins and defwEndPins routines. All pins must be defined between these routines. Each individual pin must start with a defwPin routine.

If the DEF file contains a COMPONENTS statement, the PINS statement must follow it. For more information about DEF COMPONENTS routines, see "Components".

For examples of the routines described here, see "Pins Example".

Note: To write a PROPERTY statement for the pin, you must use one of the property routines immediately following the defwPin routine. For more information, see "Property Statements".

All routines return 0 if successful.

### defwStartPins

Starts a PINS statement.

#### Syntax

int defwStartPins(
  int
count)

#### Arguments

count

> Specifies the number of pins defined in the PINS statement.

### defwEndPins

Ends the PINS statement. If count is not the same as the actual number of defwPin routines used, defwEndPins returns DEFW_BAD_DATA.

#### Syntax

int defwEndPins(void)

### defwPin

Starts a pin description in the PINS statement. Each pin description must start with defwPin. This routine is required and can be used more than once in a PINS statement.

#### Syntax

int defwPin(
  const char*
pinName,
  const char* netName,
  int special,
const char* direction,
const char* use,
const char* status,
  int statusX,
  int statusY,
  int orient)

#### Arguments

direction

> Optional argument that specifies the pin type. Specify NULL to ignore this argument.
> Value: Specify one of the following:

| FEEDTHRU | Pin that goes completely across the cell.
| INPUT | Pin that accepts signals coming into the cell.
| INOUT | Pin that drives signals out of the cell.
| OUTPUT | Pin that can accept signals going either in or out of the cell.

netName

> Specifies the corresponding internal net name.

orient

> Optional argument that specifies the orientation for the pin. Specify -1 to ignore this argument.
> Value: 0 to 7. For more information, see "Orientation Codes".

pinName

> Specifies the name for the external pin.

special

> Optional argument that identifies the pin as a special pin. Specify 0 to ignore this argument.
> Value: Specify one of the following: I

| 0 | Argument is ignored.
| 1 | Writes a SPECIAL statement.

status

> Optional argument that specifies the placement status of the pin. Specify NULL to ignore this argument.
> Value: Specify one of the following:

| COVER | Specifies that the pin has location and is a part of a cover macro. It cannot be moved by automatic layout tools or by interactive commands.
| FIXED | Specifies that the pin has a location and cannot be moved by automatic tools, but can be moved by interactive commands.
| PLACED | Specifies that the pin has a location, but can be moved during automatic layout.

statusX statusY

> Optional arguments that specify the placement location of the pin. If you specify status, you must specify these arguments.Specify 0 to ignore these arguments.

use

> Optional argument that specifies how the pin is used. Specify NULL to ignore this argument.
> Value: Specify one of the following:

| ANALOG | Pin is used for analog connectivity.
| CLOCK | Pin is used for clock net connectivity.
| GROUND | Pin is used for connectivity to the chip-level ground distribution network.
| POWER | Pin is used for connectivity to the chip-level power distribution network.
| RESET | Pin is used as reset pin.
| SCAN | Pin is used as scan pin.
| SIGNAL | Pin is used for regular net connectivity.
| TIEOFF | Pin is used as tie-high or tie-low pin.

### defwPinStr

Also starts a pin description in the PINS statement. This routine is the same as the defwPin routine, with the exception of the orient argument, which takes a string instead of an integer. Each pin description must start with defwPin. This routine is required and can be used more than once in a PINS statement.

#### Syntax

int defwPin(
  const char*
pinName,
  const char* netName,
  int special,
const char* direction,
const char* use,
const char* status,
  int statusX,
  int statusY,
  const char* orient)

#### Arguments

direction

> Optional argument that specifies the pin type. Specify NULL to ignore this argument.
> Value: Specify one of the following:

| FEEDTHRU | Pin that goes completely across the cell.
| INPUT | Pin that accepts signals coming into the cell.
| INOUT | Pin that drives signals out of the cell.
| OUTPUT | Pin that can accept signals going either in or out of the cell.

netName

> Specifies the corresponding internal net name.

orient

> Optional argument that specifies the orientation for the pin. Specify NULL to ignore this argument.
> Value: N, W, S, E, FN, FW, FS, or FE

pinName

> Specifies the name for the external pin.

special

> Optional argument that identifies the pin as a special pin. Specify 0 to ignore this argument.
> Value: Specify one of the following: I

| 0 | Argument is ignored.
| 1 | Writes a SPECIAL statement.

status

> Optional argument that specifies the placement status of the pin. Specify NULL to ignore this argument.
> Value: Specify one of the following:

| COVER | Specifies that the pin has location and is a part of a cover macro. It cannot be moved by automatic layout tools or by interactive commands.
| FIXED | Specifies that the pin has a location and cannot be moved by automatic tools, but can be moved by interactive commands.
| PLACED | Specifies that the pin has a location, but can be moved during automatic layout.

statusX statusY

> Optional arguments that specify the placement location of the pin. If you specify status, you must specify these arguments.Specify 0 to ignore these arguments.

use

> Optional argument that specifies how the pin is used. Specify NULL to ignore this argument.
> Value: Specify one of the following:

| ANALOG | Pin is used for analog connectivity.
| CLOCK | Pin is used for clock net connectivity.
| GROUND | Pin is used for connectivity to the chip-level ground distribution network.
| POWER | Pin is used for connectivity to the chip-level power distribution network.
| RESET | Pin is used as reset pin.
| SCAN | Pin is used as scan pin.
| SIGNAL | Pin is used for regular net connectivity.
| TIEOFF | Pin is used as tie-high or tie-low pin.

### defwPinAntennaModel

Writes an ANTENNAMODEL statement. The ANTENNAMODEL statement is optional and can be used more than once in a pin definition.

#### Syntax

int defwPinAntennaModel(
  const char*
oxide)

#### Arguments

oxide

> Specifies the oxide model for the pin. Each model can be specified once per layer. If you specify an ANTENNAMODEL statement, that value affects all ANTENNAGATEAREA and ANTENNA*CAR statements for the pin that follow it until you specify another ANTENNAMODEL statement.
> Value: OXIDE1, OXIDE2, OXIDE3, or OXIDE4
> Note: OXIDE3 and OXIDE4 are currently not supported. If you specify either of these models, the tool parses and ignores it.

### defwPinAntennaPinDiffArea

Writes an ANTENNAPINDIFFAREA statement. The ANTENNAPINDIFFAREA statement is optional and can be used more than once in a PIN section.

#### Syntax

int defwPinAntennaPinDiffArea(
  int
value,
const char* layerName)

#### Argument

value

> Specifies the diffusion (diode) area to which the pin is connected on a layer.

layerName

> Optional argument that specifies the layer. Specify NULL to ignore this argument.

### defwPinAntennaPinGateArea

Writes an ANTENNAPINGATEAREA statement. The ANTENNAPINGATEAREA statement is optional, and can be used once after each defwPinAntennaModel routine in a PINS section.

#### Syntax

int defwPinAntennaPinGateArea(
  int
value,
const char* layerName)

#### Arguments

value

> Specifies the gate area to which the pin is connected on a layer.

layerName

> Optional argument that specifies the layer. Specify NULL to ignore this argument.

### defwPinAntennaPinMaxAreaCar

Writes an ANTENNAPINMAXAREACAR statement. The ANTENNAPINMAXAREACAR statement is optional, and can be used once after each defwPinAntennaModel routine in a PINS section.

#### Syntax

int defwPinAntennaPinMaxAreaCar(
  int
value,
const char* layerName)

#### Arguments

value

> Specifies the maximum cumulative antenna ratio, using the metal area below the current pin layer.

layerName

> Specifies the pin layer.

### defwPinAntennaPinMaxCutCar

Writes an ANTENNAPINMAXCUTCAR statement. The ANTENNAPINMAXCUTCAR statement is optional, and can be used once after each defwPinAntennaModel routine in a PINS section.

#### Syntax

int defwPinAntennaPinMaxCutCar(
  int
value,
const char* layerName)

#### Arguments

value

> Specifies the maximum cumulative antenna ratio, using the cut area below the current pin layer.

layerName

> Specifies the pin layer.

### defwPinAntennaPinMaxSideAreaCar

Writes an ANTENNAPINMAXSIDEAREACAR statement. The ANTENNAPINMAXSIDEAREACAR statement is optional, and can be used once after each defwPinAntennaModel routine in a PINS section.

#### Syntax

int defwPinAntennaPinMaxSideAreaCar(
  int
value,
const char* layerName)

#### Arguments

value

> Specifies the maximum cumulative antenna ratio, using the metal side wall area below the current pin layer.

layerName

> Specifies the pin layer.

### defwPinAntennaPinPartialCutArea

Writes an ANTENNAPINPARTIALCUTAREA statement. The ANTENNAPINPARTIALCUTAREA statement is optional and can be used more than once in a PINS section.

#### Syntax

int defwPinAntennaPinPartialCutArea(
  int
value,
const char* layerName)

#### Arguments

value

> Specifies the partial cut area, which is above the current pin layer and inside (or outside) the macro on a layer.

layerName

> Optional argument that specifies the layer. Specify NULL to ignore this argument.

### defwPinAntennaPinPartialMetalArea

Writes an ANTENNAPINPARTIALMETALAREA statement. The ANTENNAPINPARTIALMETALAREA statement is optional and can be used more than once in a PINS section.

#### Syntax

int defwPinAntennaPinPartialMetalArea(
  int
value,
const char* layerName)

#### Arguments

value

> Specifies the partial metal area, which is connected directly to the I/O pin and the inside (or outside) of the macro on a layer.

layerName

> Optional argument that specifies the layer. Specify NULL to ignore this argument.

### defwPinAntennaPinPartialMetalSideArea

Writes an ANTENNAPINPARTIALMETALSIDEAREA statement. The ANTENNAPINPARTIALMETALSIDEAREA statement is optional and can be used more than once for each pin in a PINS statement.

#### Syntax

int defwPinAntennaPinPartialMetalSideArea(
  int
value,
const char* layerName)

#### Arguments

value

> Specifies the partial metal side wall area, which is connected directly to the I/O pin and the inside (or outside) of the macro on a layer.

layerName

> Optional argument that specifies the layer. Specify NULL to ignore this argument.

### defwPinGroundSensitivity

Writes a GROUNDSENSITIVITY statement for a pin in the PINS statement. The GROUNDSENSITIVITY statement is optional and can be used only once for each pin in the PINS statement.

#### Syntax

defwPinGroundSensitivity(
  const char*
pinName)

#### Arguments

pinName

> Specifies that if this pin is connected to a tie-low connection (such as 1'b0 in Verilog), it should connect to the same net to which pinName is connected.

### defwPinLayer

Writes a LAYER statement for a pin in the PINS statement. Either a LAYER or a POLYGON statement can be specified for a pin. The LAYER statement is optional and can be used more than once for each pin in the PINS statement.

#### Syntax

defwPinLayer(
  const char*
layerName,
  int spacing,
  int designRuleWidth,
  int xl,
  int yl,
  int xh,
  int yh)

#### Arguments

layerName

> Specifies the routing layer used for the pin.

spacing

> Optional argument that specifies the minimum spacing allowed between this pin and any other routing shape. If you specify a minimum spacing, you must specify 0 for designRuleWidth. Specify 0 to ignore this argument.

designRuleWidth

> Optional argument that specifies that this pin has a width of designRuleWidth for the purpose of spacing calculations. If you specify a designRuleWidth value, you must specify 0 for spacing. Specify 0 to ignore this argument.

xl yl xh yh

> Specifies the physical geometry for the pin on the specified layer.

### defwPinNetExpr

Writes a NETEXPR statement for a pin in the PINS statement. The NETEXPR statement is optional and can be used only once for each pin in the PINS statement.

#### Syntax

defwPinNetExpr(
  const char*
pinExpr)

#### Arguments

pinExpr

> Specifies a net expression property name (such as power1 or power2). If pinExpr matches a net expression property higher up in the netlist (for example, in Verilog, VHDL, or OpenAccess), then the property is evaluated, and the software identifies a net to which to connect this pin.

### defwPinPolygon

Writes a POLYGON statement for a pin in the PINS statement. Either a LAYER or a POLYGON statement can be specified for a pin. The POLYGON statement is optional and can be used more than once for each pin in the PINS statement.

#### Syntax

defwPinPolygon(
  const char*
layerName,
  int spacing,
  int designRuleWidth,
  int num_polys,
  double* xl,
  double* yl)

#### Arguments

layerName

> Specifies the layer on which to generate a polygon.

spacing

> Optional argument that specifies the minimum spacing allowed between this pin and any other routing shape. If you specify a minimum spacing, you must specify 0 for designRuleWidth. Specify 0 to ignore this argument.

designRuleWidth

> Optional argument that specifies that this pin has a width of designRuleWidth for the purpose of spacing calculations. If you specify a designRuleWidth value, you must specify 0 for spacing. Specify 0 to ignore this argument.

num_polys

> Specifies the number of polygon sides.

xl yl

> Specifies a sequence of points to generate a polygon for the pin. The polygon edges must be parallel to the x axis, the y axis, or at a 45-degree angle.

### defwPinPort

Writes a PORT statement for a pin in the PINS statement. The PORT statement is optional and can be used more than once in a PINS statement.

#### Syntax

int defwPinPort()

### defwPinPortLayer

Writes a LAYER statement for a PINS PORT statement. Either a LAYER, POLYGON, or VIA statement can be specified for a pin port. This routine is optional and is called after defwPinPort.

#### Syntax

int defwPinPortLayer(
  const char*
layerName,
  int spacing,
  int designRuleWidth,
  int xl,
  int yl,
  int xh,
  int yh)

#### Arguments

layerName

> Specifies the layer name.

spacing

> Optional argument that specifies the minimum spacing allowed between this pin port and any other routing shape. If you specify spacing, you must specify 0 for designRuleWidth. Specify 0 to ignore this argument.

designRuleWidth

> Optional argument that specifies that this pin port has a width of designRuleWidth for the purpose of spacing calculations. If you specify designRuleWidth, you must specify 0 for spacing. Specify 0 to ignore this argument.

xl yl xh yh

> Specifies the physical geometry for the pin port on the specified layer.

### defwPinPortLocation

Writes a FIXED, PLACED, or COVER statement for a PINS PORT statement. This routine is optional and is called after defwPinPort.

#### Syntax

int defwPinPortLocation(
  const char*
status,
  int statusX,
  int statusY,
  const char* orient)

#### Arguments

status

> Specifies the placement status of the pin.
> Value: specify one of the following:

| COVER | Specifies that the pin has a location and is a part of the cover macro. It cannot be moved by automatic tools or interactive commands.
| FIXED | Specifies that the pin has a location and cannot be moved by automatic tools but can be moved by interactive commands.
| PLACED | Specifies that the pin has a location, but can be moved during automatic layout.

statusX statusY

> Specifies the placement location of the pin. If you specify status, you must specify these arguments.

orient

> Specifies the orientation of the pin.
> Value: 0 to 7. For more information, see "Orientation Codes".

### defwPinPortPolygon

Writes a POLYGON statement for a PINS PORT statement. Either a LAYER, POLYGON, or VIA statement can be specified for a pin port. This routine is optional and is called after defwPinPort.

#### Syntax

int defwPinPortPolygon(
  const char*
layerName,
  int spacing,
  int designRuleWidth,
  int num_polys,
  double* xl,
  double* yl)

#### Arguments

layerName

> Specifies the layer name.

spacing

> Optional argument that specifies the minimum spacing allowed between this pin port and any other routing shape. If you specify a minimum spacing, you must specify 0 for designRuleWidth. Specify 0 to ignore this argument.

designRuleWidth

> Optional argument that specifies that this pin port has a width of designRuleWidth for the purpose of spacing calculations. If you specify designRuleWidth, you must specify 0 for spacing. Specify 0 to ignore this argument.

num_polys

> Specifies the number of polygon sides.

xl yl

> Specifies a sequence of points to generate a polygon for the pin port. The polygon edges must be parallel to the x axis, the y axis, or at a 45-degree angle.

### defwPinPortVia

Writes a VIA statement for a PINS PORT statement. Either a LAYER, POLYGON, or VIA statement can be specified for a pin port. This routine is optional and is called after defwPinPort.

#### Syntax

int defwPinPortVia(
  const char*
viaName,
  int xl,
  int yl)

#### Arguments

viaName

> Specifies the via name. The via name must have been defined in the associated LEF files or this DEF file before this function is called.

x1 y1

> Specifies the point at which the via is to be placed.

### defwPinSupplySensitivity

Writes a SUPPLYSENSITIVITY statement for a pin in the PINS statement. The SUPPLYSENSITIVITY statement is optional and can be used only once for each pin in the PINS statement.

#### Syntax

defwPinSupplySensitivity(
  const char*
pinName)

#### Arguments

pinName

> Specifies that if this pin is connected to a tie-high connection (such as 1'b1 in Verilog), it should connect to the same net to which pinName is connected.

### defwPinVia

Writes a VIA statement for a pin in the PINS statement. The VIA statement is optional and can be used more than once for a pin.

#### Syntax

int defwPinVia(
  const char*
viaName,
  int xl,
  int yl)

#### Arguments

viaName

> Specifies the via name. The via name must have been defined in the associated LEF files or this DEF file before this function is called.

x1 y1

> Specifies the point at which the via is to be placed.

### Pins Example

The following example shows a callback routine with the type defwPinCbkType.

int pinCB (defwCallbackType_e type,
  defiUserData userData) {
  int res;
  // Check if the type is correct
  if (type != defwPinCbkType) {
  printf("Type is not defwPinCbkType, terminate
  writing.\n");
  return 1;
  }

res = defwStartPins(1);
  CHECK_RES(res);
  res = defwPin("scanpin", "SCAN", 0, "INPUT", NULL, NULL, 0,
  0, -1, NULL, 0, 0, 0, 0);
  CHECK_RES(res);
  res = defwEndPins();
  CHECK_RES(res);
  return 0;}

## Pin Properties

The Pin Properties routines write a DEF PINPROPERTIES statement. The PINPROPERTIES statement is optional and can be used only once in a DEF file. For syntax information about the DEF PINPROPERTIES statement, see "Pin Properties" in the LEF/DEF Language Reference.

You must begin and end a DEF PINPROPERTIES statement with the defwStartPinProperties and defwEndPinProperties routines. You must define all pin properties between these routines. Each property definition must start with a defwPinProperty routine.

If the DEF file contains a PINS statement, the PINPROPERTIES statement must follow it. For more information about the DEF PINS writer routines, see "Pins".

For examples of the routines described here, see"Pin Properties Example".

Note: To write a PROPERTY statement for a pin, you must use one of the property routines immediately following the defwPinProperty routine, which specifies the pin name. For more information, see "Property Statements".

All routines return 0 if successful.

### defwStartPinProperties

Starts a PINPROPERTIES statement.

#### Syntax

int defwStartPinProperties(
  int
count)

#### Arguments

count

> Specifies the number of pin properties defined in the PINPROPERTIES statement.

### defwEndPinProperties

Ends the PINPROPERTIES statement. If count specified in defwStartPinProperties is not the same as the actual number of defwPinProperty routines used, defwEndPinProperties returns DEFW_BAD_DATA. This routine does not require any arguments.

#### Syntax

int defwEndPinProperties(void)

### defwPinProperty

Begins a property definition. This routine is required and can be used more than once in a PINPROPERTIES statement.

#### Syntax

int defwPinProperty(
  const char*
component,
  const char* pinName)

#### Arguments

component

> Specifies either the string to use for the component pin name, or the keyword PIN.

pinName

> Specifies the I/O pin name. Specify this value only when component is set to PIN.

### Pin Properties Example

The following example shows a callback routine with the type defwPinPropCbkType.

int pinpropCB (defwCallbackType_e type,
  defiUserData userData) {
  int res;
  // Check if the type is correct
  if (type != defwPinPropCbkType) {
  printf("Type is not defwPinPropCbkType, terminate
  writing.\n");
  return 1;
  }
  res = defwStartPinProperties(2);
  CHECK_RES(res);
  res = defwPinProperty("cell1", "PB1");
  CHECK_RES(res);
  res = defwStringProperty("dpBit", "1");
  CHECK_RES(res);
  res = defwRealProperty("realProperty", 3.4);
  CHECK_RES(res);
  res = defwPinProperty("cell2", "vdd");
  CHECK_RES(res);
  res = defwIntProperty("dpIgnoreTerm", 2);
  CHECK_RES(res);
  res = defwEndPinProperties();
  CHECK_RES(res);
  return 0;}

## Property Definitions

The Property Definitions routines write a DEF PROPERTYDEFINITIONS statement. The PROPERTYDEFINITIONS statement is optional and can be used only once in a DEF file. For syntax information about the DEF PROPERTYDEFINITIONS statement, see Property Definitions in the LEF/DEF Language Reference.

You must begin and end a DEF PROPERTYDEFINITIONS statement with the defwStartPropDef and defwEndPropDef routines. You must define all properties between these routines.

If the DEF file contains a HISTORY statement, the PROPERTYDEFINITIONS statement must follow it. For more information about the DEF HISTORY routine, see "History".

For examples of the routines described here, see "Property Definitions Example".

All routines return 0 if successful.

### defwStartPropDef

Starts a PROPERTYDEFINITIONS statement. This routine does not require any arguments.

#### Syntax

int defwStartPropDef(void)

### defwEndPropDef

Ends the PROPERTYDEFINITIONS statement. This routine does not require any arguments.

#### Syntax

int defwEndPropDef(void)

### defwIntPropDef

Writes an integer property definition. This routine is optional and can be used more than once in a PROPERTYDEFINITIONS statement.

#### Syntax

int defwIntPropDef(
  const char*
objType,
  const char* propName,
  double leftRange,
  double rightRange,
  const char* value)

#### Arguments

objType

> Specifies the type of object for which you can define properties.
> Value: DESIGN, COMPONENT, NET, SPECIALNET, GROUP, ROW, COMPONENTPIN, NONDEFAULTRULE, or REGION

propName

> Specifies a unique property name for the object type.

leftRange rightRange

> Optional arguments that limit integer property values to a specified range. That is, the value must be greater than or equal to leftRange and less than or equal to rightRange. Specify 0 to ignore these arguments.

value

> Optional argument that specifies a numeric value for an object. Specify NULL to ignore this argument.

### defwRealPropDef

Writes a real property definition. This routine is optional and can be used more than once in a PROPERTYDEFINITIONS statement.

#### Syntax

int defwRealPropDef(
  const char*
objType,
  const char* propName,
  double leftRange,
  double rightRange,
  const char* value)

#### Arguments

objType

> Specifies the type of object for which you can define properties.
> Value: Specify DESIGN, COMPONENT, NET, SPECIALNET, GROUP, ROW, COMPONENTPIN, NONDEFAULTRULE, or REGION

propName

> Specifies a unique property name for the object type.

leftRange rightRange

> Optional arguments that limit real number property values to a specified range. That is, the value must be greater than or equal to leftRange and less than or equal to rightRange. Specify 0 to ignore these arguments.

value

> Optional argument that specifies a numeric value for an object. Specify NULL to ignore this argument.

### defwStringPropDef

Writes a string property definition. This routine is optional and can be used more than once in a PROPERTYDEFINITIONS statement.

#### Syntax

int defwStringPropDef(
  const char*
objType,
  const char* propName,
  double leftRange,
  double rightRange,
  const char* value)

#### Arguments

objType

> Specifies the type of object for which you can define properties.
> Value: DESIGN, COMPONENT, NET, SPECIALNET, GROUP, ROW, COMPONENTPIN, NONDEFAULTRULE, or REGION

propName

> Specifies a unique property name for the object type.

leftRange rightRange

> Optional arguments that limit string property values to a specified range. That is, the value must be greater than or equal to leftRange and less than or equal to rightRange. Specify 0 to ignore these arguments.

value

> Optional argument that specifies a character value for an object. Specify NULL to ignore this argument.

### Property Definitions Example

The following example shows a callback routine with the type defwPropDefCbkType.

int pinCB (defwCallbackType_e type,
  defiUserData userData) {
  int res;
  // Check if the type is correct
  if (type != defwPropDefCbkType) {
  printf("Type is not defwPropDefCbkType, terminate
  writing.\n");
  return 1;
  }
  res = defwStartPropDef();
  check_res(res);
  defwAddComment("defwPropDef is broken into 3 routines,
  defwStringPropDef");
  defwAddComment("defwIntPropDef, and defwRealPropDef");
  res = defwStringPropDef("REGION", "scum", 0, 0, NULL);
  CHECK_RES(res);
  res = defwIntPropDef("REGION", "center", 0, 0, NULL);
  CHECK_RES(res);
  res = defwRealPropDef("REGION", "area", 0, 0, NULL);
  CHECK_RES(res);
  res = defwStringPropDef("GROUP", "ggrp", 0, 0, NULL);
  CHECK_RES(res);
  res = defwEndPropDef();
  CHECK_RES(res);
  return 0;}

## Property Statements

The Property Statements routines write PROPERTY statements when used after the defwRow, defwRegion, defwComponent, defwPin, defwPinProperty, defwSpecialNet, defwNet, defwNonDefaultRule, or defwGroup routines.

For examples of the routines described here, see "Property Statements Example".

### defwIntProperty

Writes a PROPERTY statement with an integer value. This statement is optional and can be used more than once.

#### Syntax

int defwIntProperty(
  const char*
propName,
  int propValue)

#### Arguments

propName

> Specifies a unique property name for the object.

propValue

> Specifies an integer value for the object.

### defwRealProperty

Writes a PROPERTY statement with a real number value. This statement is optional and can be used more than once.

#### Syntax

int defwRealProperty(
  const char*
propName,
  double propValue)

#### Arguments

propName

> Specifies a unique property name for the object.

propValue

> Specifies a real value for the object.

### defwStringProperty

Writes a PROPERTY statement with a string value. This statement is optional and can be used more than once.

#### Syntax

int defwStringProperty(
  const char*
propName,
  const char* propValue)

propName

> Specifies a unique property name for the object.

propValue

> Specifies a string value for the object.

### Property Statements Example

The following example shows how to create a property inside a Rows callback routine.

int rowCB (defwCallbackType_e type,
  defiUserData userData) {
  int res;
  ...
  res = defwRealProperty("minlength", 50.5);
  CHECK_RES(res);
  res = defwStringProperty("firstName", "Only");
  CHECK_RES(res);
  res = defwIntProperty("idx", 1);
  CHECK_RES(res);
  ...
  return 0;}

## Regions

The Regions routines write a DEF REGIONS statement. The REGIONS statement is optional and can be used only once in a DEF file. For syntax information about the DEF REGIONS statement, see "Regions" in the LEF/DEF Language Reference.

You must begin and end a DEF REGIONS statement with the defwStartRegions and defwEndRegions routines. You must define all regions between these routines. Each region definition must start with a defwRegions routine.

If the DEF file contains a VIAS statement, the REGIONS statement must follow it. For more information about the DEF VIAS routines, see "Vias".

For examples of the routines described here, see "Regions Example".

Note: To write a PROPERTY statement for the region, you must use one of the property routines immediately following the defwRegion routines. For more information, see "Property Statements".

All routines return 0 if successful.

### defwStartRegions

Starts a REGIONS statement.

#### Syntax

int defwStartRegions(
  int
count)

#### Arguments

count

> Specifies the number of regions defined in the REGIONS statement.

### defwEndRegions

Ends the REGIONS statement. If count specified in defwStartRegions is not the same as the actual number of defwRegionName routines used, this routine returns DEFW_BAD_DATA. This routine does not require any arguments.

#### Syntax

int defwEndRegions(void)

### defwRegionName

Starts a region description. This routine must be called the number of times specified in the defwStartRegions count argument.

#### Syntax

int defwRegionName(
  const char*
regionName)

#### Arguments

regionName

> Specifies the name of the region.

### defwRegionPoints

Specifies the set of points bounding the region. This routine is required and can be used more than once to define a region.

#### Syntax

int defwRegionPoints(
  int
xl,
  int yl,
  int xh,
  int yh)

#### Arguments

xl yl xh yh

> Specifies the corner points of the region.

### defwRegionType

Writes a TYPE statement. The TYPE statement is optional and can be used only once per region.

#### Syntax

int defwRegionType(
  const char*
type)

#### Arguments

type

> Specifies the region type.
> Value: Specify one of the following:

| FENCE | All instances assigned to this type of region must be exclusively placed inside the region boundaries. No other instances are allowed inside this region.
| GUIDE | All instances assigned to this type of region should be placed inside this region, but it is a preference, not a hard constraint. Other constraints, such as wire length and timing can override it.

### Regions Example

The following example shows a callback routine with the type defwRegionCbkType.

int regionCB (defwCallbackType_e type,
  defiUserData userData) {
  int res;
  // Check if the type is correct
  if (type != defwRegionCbkType) {
  printf("Type is not defwRegionCbkType, terminate
  writing.\n");
  return 1;
  }
  res = defwStartRegions(1);
  CHECK_RES(res);
  res = defwRegionName("region2");
  CHECK_RES(res);
  res = defwRegionPoints(4000, 0, 5000, 1000);
  CHECK_RES(res);
  res = defwStringProperty("scum", "on bottom");
  CHECK_RES(res);
  res = defwEndRegions();
  CHECK_RES(res);
  return 0;}

## Rows

The Row routines write a DEF ROWS statement. The ROWS statement is optional and can be used more than once in a DEF file. For syntax information about the DEF ROWS statement, see "Rows" in the LEF/DEF Language Reference.

If the DEF file contains a DIEAREA statement, the ROWS statement must follow it. For more information about the DEF DIEAREA writer routines, see "Die Area".

Note: To write a PROPERTY statement for the row, you must use one of the property routines immediately following the defwRow routine. For more information, see "Property Statements".

All routines return 0 if successful.

### defwRow

Writes a ROWS statement.

#### Syntax

int defwRow(
  const char*
rowName,
  const char* rowType,
  int origX,
  int origY,
  int orient,
  int do_count,
  int do_increment,
  int xstep,
  int ystep)

#### Arguments

do_count

> Optional argument that specifies the number of columns in the array pattern. Specify 0 to ignore this argument.

do_increment

> Optional argument that specifies the number of rows in the array pattern. Specify 0 to ignore this argument.

orient

> Specifies the orientation of all sites in the row.
> Value: 0 to 7. For more information, see "Orientation Codes"

rowName

> Specifies the row name for this row.

rowType

> Specifies the site to use for the row.

stepX stepY

> Optional arguments that specify the spacing between the columns and rows. Specify 0 to ignore these arguments.

x_orig y_orig

> Specifies the location in the design of the first site in the row.

### defwRowStr

Also writes a ROWS statement. This routine is the same as the defwRow routine, with the exception of the orient argument, which takes a string instead of an integer.

#### Syntax

int defwRowStr (
  const char*
rowName,
  const char* rowType,
  int x_orig,
  int y_orig,
  const char* orient,
  int do_count,
  int do_increment,
  int xstep,
  int ystep)

#### Arguments

do_count

> Optional argument that specifies the number of columns in the array pattern. Specify 0 to ignore this argument.

do_increment

> Optional argument that specifies the number of rows in the array pattern. Specify 0 to ignore this argument.

orient

> Specifies the orientation of all sites in the row.
> Value: N, W, S, E, FN, FW, FS, or FE

rowName

> Specifies the row name for this row.

rowType

> Specifies the site to use for the row.

stepX stepY

> Optional argument that specifies the spacing between the columns and rows. Specify 0 to ignore these arguments.

x_orig y_orig

> Specifies the location in the design of the first site in the row.

### Rows Example

The following example shows a callback routine with the type defwRowCbkType.

int rowCB (defwCallbackType_e type,
  defiUserData userData) {
  int res;
  nt regionCB (defwCallbackType_e type,
  defiUserData userData) {
  int res;
  // Check if the type is correct
  if (type != defwRowCbkType) {
  printf("Type is not defwRowCbkType, terminate
  writing.\n");
  return 1;
  }
  res = defwRow("ROW_9", "CORE", -177320, -111250, 5, 911, 1,
  360, 0);
  CHECK_RES(res);
  res = defwRealProperty("minlength", 50.5);
  CHECK_RES(res);
  res = defwStringProperty("firstName", "Only");
  CHECK_RES(res);
  res = defwIntProperty("idx", 1);
  CHECK_RES(res);
  res = defwRow("ROW_10", "CORE1", -19000, -11000, 6, 1, 100,
  0, 600);
  CHECK_RES(res);
  return 0;}

## Scan Chains

The Scan Chain routines write a DEF SCANCHAINS statement. The SCANCHAINS statement is optional and can be used only once in a DEF file. For syntax information about the DEF SCANCHAINS statement, see "Scan Chains" in the LEF/DEF Language Reference.

You must begin and end a DEF SCANCHAINS statement with the defwStartScanchains and defwEndScanchains routines. You must define all scan chains between these routines. Each scan chain specification must start with a defwScanchains routine.

For examples of the routines described here, see "Scan Chain Example".

Note: To write a PROPERTY statement for the region, you must use one of the property routines following defwScanchains. For more information, see "Property Statements".

All routines return 0 if successful.

### defwStartScanchains

Starts the SCANCHAINS statement.

#### Syntax

int defwStartScanchains(
  int
count)

#### Arguments

count

> Specifies the number of scan chains defined in the SCANCHAINS statement.

### defwEndScanchains

Ends the SCANCHAINS statement. If count specified in the defwStartScanChains routine is not the same as the actual number of defwScanChain routines used, this routine returns DEFW_BAD_DATA.

#### Syntax

int defwEndScanchains()

### defwScanchain

Starts a scan chain specification. This routine must be used the number of times specified in the defwStartScanchains count argument.

#### Syntax

int defwScanchain(
  const char*
chainName)

#### Arguments

chainName

> Specifies the name of the scan chain.

### defwScanchainCommonscanpins

Writes a COMMONSCANPINS statement. The COMMONSCANPINS statement is optional and can be used only once for each scan chain.

#### Syntax

int defwScanchainCommonscanpins(
  const char*
inst1,
  const char* pin1,
  const char* inst2,
  const char* pin2)

#### Arguments

inst1 inst2

> Optional arguments that specify the common scan-in and scan-out pins. The inst1 argument can have the value IN or OUT. The inst2 argument can have the remaining IN or OUT value not specified in the inst1 argument. Specify NULL to ignore either of these arguments.

pin1 pin2

> Specifies the names of the scan-in and scan-out pins that correspond with the value of inst1 and inst2. Specify NULL to ignore either of these arguments.

Note: The inst1/pin1 and inst2/pin2 arguments must be used as pairs. If you specify NULL for either inst1 or inst2, you must also specify NULL for the corresponding pin1 or pin2. Similarly, if you specify IN or OUT for inst1 or inst2, you must specify a pin name for the corresponding pin1 or pin2.

### defwScanchainFloating

Writes a FLOATING statement. The FLOATING statement is optional and can be used more than once for each scan chain.

#### Syntax

int defwScanchainFloating(
  const char*
floatingComp,
  const char* inst1,
  const char* pin1,
  const char* inst2,
  const char* pin2)

#### Arguments

floatingComp

> Specifies the floating component name.

inst1 inst2

> Optional arguments that specify the in and out pins for the component. The inst1 argument can have the value IN or OUT. The inst2 argument can have the remaining IN or OUT value not specified in the inst1 argument. Specify NULL to ignore either of these arguments.

pin1 pin2

> Specifies the names of the in and out pins that correspond with the value of inst1 and inst2. Specify NULL to ignore either of these arguments.

Note: The inst1/pin1 and inst2/pin2 arguments must be used as pairs. If you specify NULL for either inst1 or inst2, you must also specify NULL for the corresponding pin1 or pin2. Similarly, if you specify IN or OUT for inst1 or inst2, you must specify a pin name for the corresponding pin1 or pin2.

### defwScanchainFloatingBits

Writes a FLOATING statement that contains BITS information. The FLOATING statement is optional and can be used more than once for each scan chain.

#### Syntax

int defwScanchainFloatingBits(
  const char*
floatingComp,
  const char* inst1,
  const char* pin1,
  const char* inst2,
  const char* pin2,
int bits)

#### Arguments

floatingComp

> Specifies the floating component name.

inst1 inst2

> Optional arguments that specify the in and out pins for the component. The inst1 argument can have the value IN or OUT. The inst2 argument can have the remaining IN or OUT value not specified in the inst1 argument. Specify NULL to ignore either of these arguments.

pin1 pin2

> Specifies the names of the in and out pins that correspond with the value of inst1 and inst2. Specify NULL to ignore either of these arguments.
> Note: The inst1/pin1 and inst2/pin2 arguments must be used as pairs. If you specify NULL for either inst1 or inst2, you must also specify NULL for the corresponding pin1 or pin2. Similarly, if you specify IN or OUT for inst1 or inst2, you must specify a pin name for the corresponding pin1 or pin2.

bits

> Optional argument that specifies the sequential bit length of any chain element. Specify -1 to ignore this argument.

### defwScanchainOrdered

Writes an ORDERED statement. The ORDERED statement specifies an ordered list of scan chains. The ORDERED statement is optional and can be used more than once for each scan chain.

#### Syntax

int defwScanchainOrdered(
  const char*
name1,
  const char* inst1,
  const char* pin1,
  const char* inst2,
  const char* pin2,
  const char* name2,
  const char* inst3,
  const char* pin3,
  const char* inst4,
  const char* pin4)

#### Arguments

name1 name2

> Specifies the fixed component names. You must specify both name1 and name2 the first time you call this routine within a scanchain. If you call this routine multiple times within a scanchain, you only need to specify name1.

inst1 inst2 inst3 inst4

> Optional arguments that specify the scan-in and scan-out pins for the components. The inst1 and inst3 arguments can have the value IN or OUT. The inst2 and inst4 arguments can have the remaining IN or OUT not specified in the inst1 or inst3 arguments. Specify NULL to ignore any of these arguments.

pin1 pin2 pin3 pin4

> Specifies the names of the scan-in and scan-out pins that correspond with the inst* values. Specify NULL to ignore any of these arguments.
> Note: The inst*/pin* arguments must be used as pairs. If you specify NULL for inst1, you must also specify NULL for the corresponding pin1. Similarly, if you specify IN or OUT for inst1, you must specify a pin name for the corresponding pin1.

### defwScanchainOrderedBits

Writes an ORDERED statement that contains BITS information. The ORDERED statement specifies an ordered list of scan chains. The ORDERED statement is optional and can be used more than once for each scan chain.

#### Syntax

int defwScanchainOrderedBits(
  const char*
name1,
  const char* inst1,
  const char* pin1,
  const char* inst2,
  const char* pin2,
  int bits1,
  const char* name2,
  const char* inst3,
  const char* pin3,
  const char* inst4,
  const char* pin4,
  int bits2)

#### Arguments

name1 name2

> Specifies the fixed component names. You must specify both name1 and name2 the first time you call this routine within a scanchain. If you call this routine multiple times within a scanchain, you only need to specify name1.

inst1 inst2 inst3 inst4

> Optional arguments that specify the scan-in and scan-out pins for the components. The inst1 and inst3 arguments can have the value IN or OUT. The inst2 and inst4 arguments can have the remaining IN or OUT not specified in the inst1 or inst3 arguments. Specify NULL to ignore any of these arguments.

pin1 pin2 pin3 pin4

> Specifies the names of the scan-in and scan-out pins that correspond with the inst* values. Specify NULL to ignore any of these arguments.
> Note: The inst*/pin* arguments must be used as pairs. If you specify NULL for inst1, you must also specify NULL for the corresponding pin1. Similarly, if you specify IN or OUT for inst1, you must specify a pin name for the corresponding pin1.

bits*

> Optional argument that specifies the sequential bit length of any chain element. Specify -1 to ignore this argument.

### defwScanchainPartition

Writes a PARTITION statement. The PARTITION statement is optional and can be used only once to define a scan chain.

#### Syntax

int defwScanchainPartition(
  const char*
name,
  int maxBits)

#### Arguments

name

> Specifies a partition name. A partition name associates each chain with a partition group, which determines their compatibility for repartitioning by swapping elements between them. Chains with matching PARTITION names constitute a swap-compatible group.

maxBits

> Optional argument that specifies the maximum bit length that the chain can grow to in the partition. Specify -1 to ignore this argument.

### defwScanchainStart

Writes a START statement. The START statement is required and can be used only once to define a scan chain.

#### Syntax

int defwScanchainStart(
  const char*
inst,
  const char* pin)

#### Arguments

inst

> Specifies the start of the scan chain. You can specify a component name, or the keyword PIN to specify an I/O pin.

pin

> Specifies the out pin name. If you do not specify the out pin, DEF uses the out pin specified for common scan pins. If the scan chain starts at an I/O pin, you must specify the I/O pin name as the out pin.

### defwScanchainStop

Writes a STOP statement. The STOP statement is required and can be used only once to define a scan chain.

#### Syntax

int defwScanchainStop(
  const char*
inst,
  const char* pin)

#### Arguments

inst

> Specifies the end point of the scan chain. You can specify a component name, or the keyword PIN to specify an I/O pin.

pin

> Specifies the in pin name. If you do not specify the in pin, DEF uses the in pin specified for common scan pins. If the scan chain starts at an I/O pin, you must specify the I/O pin name as the in pin.

### Scan Chain Example

The following example shows a callback routine with the type defwScanchainCbkType.

int scanchainCB (defwCallbackType_e type,
  defiUserData userData) {
  int res;
  // Check if the type is correct
  if (type != defwScanchainCbkType) {
  printf("Type is not defwScanchainCbkType, terminate
  writing.\n");
  return 1;
  }

res = defwStartScanchains(1);
  CHECK_RES(res);
  res = defwScanchain("the_chain");
  CHECK_RES(res);
  res = defwScanchainCommonscanpins("IN", "PA1", "OUT", "PA2")
  CHECK_RES(res);
  res = defwScanchainStart("PIN", "scanpin");
  CHECK_RES(res);
  res = defwScanchainStop("cell4", "PA2");
  CHECK_RES(res);
  res = defwScanchainOrdered("cell2", "IN", "PA0", NULL
  NULL, "cell1", "OUT", "P10", NULL,
  NULL);
  CHECK_RES(res);
  res = defwScanchainFloating("scancell1", "IN", "PA0",
  NULL, NULL)
  CHECK_RES(res);
  res = defwEndScanchain();
  CHECK_RES(res);
  return 0;}

## Special Nets

Special Nets routines write a DEF SPECIALNETS statement. The SPECIALNETS statement is optional and can be used only once in a DEF file. For syntax information about the DEF SPECIALNETS statement, see "Special Nets" in the LEF/DEF Language Reference.

A SPECIALNETS statement must start and end with the defwStartSpecialNets and defwEndSpecialNets routines. All special nets must be defined between these routines. Each individual special net must start and end with the defwSpecialNet and defwSpecialNetEndOneNet routines.

For examples of the routines described here, see "Special Nets Example".

In addition to the routines in this section, you can also include routines that form a specialWiring statement and a PROPERTY statement. For information about these routines, see "Special Wiring" and "Property Statements".

All routines return 0 if successful.

### defwStartSpecialNets

Starts the SPECIALNETS statement.

#### Syntax

int defwStartSpecialNets(
  int
count)

#### Arguments

count

> Specifies the number of special nets defined in the SPECIALNETS statement.

### defwEndSpecialNets

Ends the SPECIALNETS statement. If count specified in defwStartSpecialNets is not the same as the actual number of defwSpecialNet routines used, this routine returns DEFW_BAD_DATA.

#### Syntax

int defwEndSpecialNets()

### defwSpecialNet

Starts a special net description. Each special net in the SPECIALNETS statement must start and end with defwSpecialNet and defwSpecialNetEndOneNet.

#### Syntax

int defwSpecialNet(
  const char*
netName)

#### Arguments

netName

> Specifies the name of the net to define.

### defwSpecialNetEndOneNet

Ends the special net description started with defwSpecialNet. Each special net in the SPECIALNETS statement must start and end with defwSpecialNet and defwSpecialNetEndOneNet.

#### Syntax

int defwSpecialNetEndOneNet()

### defwSpecialNetConnection

Specifies the special pin and component information for the special net. This routine is optional and can be used only once for each special net in the SPECIALNETS statement.

#### Syntax

int defwSpecialNetConnection(
  const char*
compNameRegExpr,
  const char* pinName,
  int synthesized)

#### Arguments

compNameRegExpr

> Specifies a component name or a regular expression that specifies a set of component names.

pinName

> Specifies the name of the special pin on the net that corresponds to the component. During evaluation of the regular expression, components that match the expression but do not have a pin named pinName are ignored.

synthesized

> Optional argument that marks the pin as part of a synthesized scan chain.
> Value: Specify one of the following:

| 0 | Argument is ignored.
| 1 | Writes a SYNTHESIZED statement.

### defwSpecialNetEstCap

Writes an ESTCAP statement. The ESTCAP statement is optional and can be used only once for each special net in the SPECIALNETS statement.

#### Syntax

int defwSpecialNetEstCap(
  double
wireCap)

#### Arguments

wireCap

> Specifies the estimated wire capacitance for the net. ESTCAP can be loaded with simulation data to generate net constraints for timing-driven layout.

### defwSpecialNetFixedBump

Writes a FIXEDBUMP statement that indicates the bump cannot be assigned to a different pin. The FIXEDBUMP statement is optional and can be used only once for each special net in the SPECIALNETS statement.

#### Syntax

defwSpecialNetFixedBump()

### defwSpecialNetOriginal

Writes an ORIGINAL statement. The ORIGINAL statement is optional and can be used only once for each special net in the SPECIALNETS statement.

#### Syntax

int defwSpecialNetOriginal(
  const char*
netName)

#### Arguments

netName

> Specifies the original net partitioned to create multiple nets, including the current net.

### defwSpecialNetPattern

Writes a PATTERN statement. The PATTERN statement is optional and can be used only once for each special net in the SPECIALNETS statement.

#### Syntax

int defwSpecialNetPattern(
  const char*
name)

#### Arguments

name

> Specifies the routing pattern used for the net.
> Value: Specify one of the following:

| BALANCED | Used to minimize skews in timing delays for clock nets.
| STEINER | Used to minimize net length.
| TRUNK | Used to minimize delay for global nets.
| WIREDLOGIC | Used in ECL designs to connect output and mustjoin pins before routing to the remaining pins.

### defwSpecialNetSource

Writes a SOURCE statement. The SOURCE statement is optional and can only be used once for each special net in the SPECIALNETS statement.

#### Syntax

int defwSpecialNetSource(
  const char*
name)

#### Arguments

name

> Specifies the source of the net.
> Value: Specify one of the following:

| DIST | Net is the result of adding physical components (that is, components that only connect to power or ground nets), such as filler cells, well-taps, tie-high and tie-low cells, and decoupling caps.
| NETLIST | Net is defined in the original netlist. This is the default value, and is not normally written out in the DEF file.
| TEST | Net is part of a scanchain.
| TIMING | Net represents a logical rather than physical change to netlist, and is used typically as a buffer for a clock-tree, or to improve timing on long nets.
| USER | Net is user defined.

### defwSpecialNetUse

Writes a USE statement. The USE statement is optional and can be used only once for each special net in the SPECIALNETS statement.

#### Syntax

int defwSpecialNetUse(
  const char*
name)

#### Arguments

name

> Specifies how the net is used.
> Value: Specify one of the following:

| ANALOG | Used as a analog signal net.
| CLOCK | Used as a clock net.
| GROUND | Used as a ground net.
| POWER | Used as a power net.
| RESET | Used as a reset net.
| SCAN | Used as a scan net.
| SIGNAL | Used as digital signal net.
| TIEOFF | Used as a tie-high or tie-low net.

### defwSpecialNetVoltage

Writes a VOLTAGE statement. The VOLTAGE statement is optional and can be used only once for each special net in the SPECIALNETS statement.

#### Syntax

int defwSpecialNetVoltage(
  double
volts)

#### Arguments

volts

> Specifies the voltage for the net as an integer in units of .001 volts. For Example, 1.5 v is equal to 1500 in DEF.

### defwSpecialNetWeight

Writes a WEIGHT statement. The WEIGHT statement is optional and can be used only once for each special net in the SPECIALNETS statement.

#### Syntax

int defwSpecialNetWeight(
  double
weight)

#### Arguments

weight

> Specifies the weight of the net. Automatic layout tools attempt to shorten the lengths of nets with high weights. Do not specify a net weight larger than 10, or assign weights to more than 3 percent of the nets in a design.

### Special Nets Example

The following example shows a callback routine with the type defwSNetCbkType. This example only shows the usage of some functions related to special net.

int snetCB (defwCallbackType_e type,
  defiUserData userData) {
  int res;
  const char **coorX, **coorY;

// Check if the type is correct
  if (type != defwSNetCbkType) {
  printf("Type is not defwSNetCbkType, terminate
  writing.\n");
  return 1;
  }
  res = defwStartSpecialNets(2);
  CHECK_RES(res);
  res = defwSpecialNet("net1");
  CHECK_RES(res);
  res = defwSpecialNetConnection("cell1", "VDD", 0);
  CHECK_RES(res);
  res = defwSpecialNetWidth("M1", 200);
  CHECK_RES(res);
  res = defwSpecialNetVoltage(3.2);
  CHECK_RES(res);
  res = defwSpecialNetSpacing("M1", 200, 190, 210);
  CHECK_RES(res);
  res = defwSpecialNetSource("TIMING");
  CHECK_RES(res);
  res = defwSpecialNetOriginal("VDD");
  CHECK_RES(res);
  res = defwSpecialNetUse("POWER");
  CHECK_RES(res);
  res = defwSpecialNetWeight(30);
  CHECK_RES(res);
  res = defwStringProperty("contype", "star");
  CHECK_RES(res);
  res = defwIntProperty("ind", 1);
  CHECK_RES(res);
  res = defwRealProperty("maxlength", 12.13);
  CHECK_RES(res);
  res = defwSpecialNetEndOneNet();
  CHECK_RES(res);
  res = defwSpecialNet("VSS");
  CHECK_RES(res);
  res = defwSpecialNetConnection("cell1", "GND", 0);
  CHECK_RES(res);
  ...
  // An example on Special Wiring can be found under the
  // Special Wiring section.
  ...
  // An example on SpecialNet Shield can be found under the
  // Shielded Routing section.
  res = defwSpecialNetPattern("STEINER");
  CHECK_RES(res);
  res = defwSpecialNetEstCap(100);
  CHECK_RES(res);
  res = defwSpecialNetEndOneNet();
  CHECK_RES(res);
  res = defwEndSpecialNets();
  CHECK_RES(res);
  return 0;}

## Special Wiring

Special wiring routines form a specialWiring statement that can be used to define the wiring for both routed and shielded nets.The specialWiring statement is optional and can be used more than once in a SPECIALNET statement. For syntax information about the DEF SPECIALNETS statement, see "Special Nets" in the LEF/DEF Language Reference.

A specialWiring statement can include routines to define either rectangles, polygons, or a path of points to create the routing for the nets. Each path of points must start and end with the defwSpecialNetPathStart and defwSpecialNetPathEnd routines. If defined, a specialWiring statement must be included between the defwSpecialNet and defwEndOneNet routines.

For examples of the routines described here, see "Special Wiring Example".

All routines return 0 if successful.

### defwSpecialNetPathStart

Starts a specialWiring statement. Each specialWiring statement must start and end with defwSpecialNetPathStart and defwSpecialNetPathEnd.

#### Syntax

int defwSpecialNetPathStart(
  const char*
type)

#### Arguments

type

> Specifies the special wiring type. If no wiring is specified for a particular net, the net is unrouted.
> Value: Specify one of the following:

| COVER | Specifies that the wiring cannot be moved by either automatic layout or interactive commands.
| FIXED | Specifies that the wiring cannot be moved by automatic layout, but can be changed by interactive commands.
| ROUTED | Specifies that the wiring can be moved by automatic layout tools.
| SHIELD | Specifies that the special net being defined shields a regular net.
| NEW | Indicates a new wire segment.

### defwSpecialNetPathEnd

Ends the specialWiring statement. Each specialWiring statement must start and end with defwSpecialNetPathStart and defwSpecialNetPathEnd.

#### Syntax

int defwSpecialNetPathEnd()

### defwSpecialNetPathLayer

Writes a LAYER statement. Either a LAYER, POLYGON, or RECT statement is required for each specialWiring statement.The LAYER statement can be used more than once for each specialWiring statement.

#### Syntax

int defwSpecialNetPathLayer(
  const char*
layerName)

#### Arguments

layerName

> Specifies the layer on which the wire lies.

### defwSpecialNetPathPoint

Defines the center line coordinates of the route on the layer specified with defwSpecialNetPathLayer. Either this routine or defwSpecialNetPathPointWithWireExt is required with a LAYER statement, and can be used only once for each LAYER statement in a specialWiring statement.

#### Syntax

int defwSpecialNetPathPoint(
  int
numPts,
  const char** pointX,
  const char** pointY)

#### Arguments

numPts

> Specifies the number of points in the route.

pointX pointY

> Specifies the route coordinates.

### defwSpecialNetPathPointWithWireExt

Defines the center line coordinates and wire extension value of the route on the layer specified with defwSpecialNetPathLayer. Either this routine or defwSpecialNetPathPoint is required with a LAYER statement, and can be used only once for each LAYER statement in a specialWiring statement.

#### Syntax

defwSpecialNetPathPointWithWireExt(
  int
numPoints,
  const char** pointX,
  const char** pointY,
  const char** value)

#### Arguments

numPoints

> Specifies the number of points in the route.

pointX pointY

> Specifies the route coordinates.

value

> Optional argument that specifies the amount by which the wire is extended past the endpoint of the segment. Specify NULL to ignore this argument.

### defwSpecialNetPathShape

Writes a SHAPE statement. The SHAPE statement is optional with a LAYER statement, and can be used only once for each LAYER statement in a specialWiring statement.

#### Syntax

int defwSpecialNetPathShape(
  const char*
shapeType)

#### Arguments

shapeType

> Specifies a wire with special connection requirements because of its shape.
> Value: RING, PADRING, BLOCKRING, STRIPE, FOLLOWPIN, IOWIRE, COREWIRE, BLOCKWIRE, FILLWIRE, BLOCKAGEWIRE, or DRCFILL

### defwSpecialNetPathStyle

Writes a STYLE statement. A STYLE statement is optional with a LAYER statement, and can be used only once for each LAYER statement in a specialWiring statement.

#### Syntax

defwSpecialNetStyle(
  int
styleNum)

#### Arguments

styleNum

> Specifies a previously defined style number from the STYLES section in this DEF file.

### defwSpecialNetPathVia

Specifies a via for the special wiring. This routine is optional with a LAYER statement, and can be used only once for each LAYER statement in a specialWiring statement.

#### Syntax

int defwSpecialNetPathVia(
  const char*
viaName)

#### Arguments

viaName

> Specifies a via to place at the last point of the route.

### defwSpecialNetPathViaData

Creates an array of power vias of the via specified with defwSpecialNetPathVia. This routine is optional with a LAYER statement, and can be used only once for each LAYER statement in a specialWiring statement.

#### Syntax

int defwSpecialNetPathViaData(
  int
numX,
  int numY,
  int stepX,
  int stepY)

#### Arguments

numX numY

> Specifies the number of vias to create in the x and y directions.

stepX stepY

> Specifies the step distance between vias, in the x and y directions

### defwSpecialNetPathWidth

Writes a WIDTH statement. The WIDTH statement is required with a LAYER statement, and can be used only once for each LAYER statement in a specialWiring statement.

#### Syntax

int defwSpecialNetPathWidth(
  int
width)

#### Arguments

width

> Specifies the width for wires on the layer specified with defwSpecialNetPathLayer.

### defwSpecialNetShieldNetName

Specifies the name of a regular net to be shielded by the special net being defined. This routine is required if SHIELD is specified in the defwSpecialNetPathStart routine and can be used only once for each specialWiring statement.

#### Syntax

int defwSpecialNetShieldNetName(
  const char*
name)

#### Arguments

name

> Specifies the name of the regular net to be shielded.

### defwSpecialNetPolygon

Writes a POLYGON statement. Either a LAYER, POLYGON, or RECT statement is required for each specialWiring statement. The POLYGON statement can be used only once for each specialWiring statement.

#### Syntax

defwSpecialNetPolygon(
  const char*
layerName,
  int num_polys,
  double* xl,
  double* yl)

#### Arguments

layerName

> Specifies the layer on which to generate the polygon.

num_polys

> Specifies the number of polygon sides.

xl yl

> Specifies a sequence of points to generate a polygon geometry on layerName. The polygon edges must be parallel to the x axis, the y axis, or at a 45-degree angle.

### defwSpecialNetRect

Writes a RECT statement. Either a LAYER, POLYGON, or RECT statement is required for each specialWiring statement. The RECT statement can be used only once for each specialWiring statement.

#### Syntax

defwSpecialNetRect(
  const char*
layerName,
  int xl,
  int yl,
  int xh,
  int yh)

#### Arguments

layerName

> Specifies the layer on which to create the rectangle.

xl yl xh yh

> Specifies the coordinates of two points which define the opposite corners of the rectangle.

### Special Wiring Example

The following example only shows the usage of some functions related to special wiring in a special net. This example is part of the special net callback routine.

int snetCB (defwCallbackType_e type,
  defiUserData userData) {
  int res;
  const char **coorX, **coorY;

...
  res = defwSpecialNetPathStart("ROUTED");
  CHECK_RES(res);
  res = defwSpecialNetPathLayer("M1");
  CHECK_RES(res);
  res = defwSpecialNetPathWidth(250);
  CHECK_RES(res);
  res = defwSpecialNetPathShape("IOWIRE");
  CHECK_RES(res);
  coorX = (const char**)malloc(sizeof(char*)*3);
  coorY = (const char**)malloc(sizeof(char*)*3);
  coorX[0] = strdup("5");
  coorY[0] = strdup("15");
  coorX[1] = strdup("125");
  coorY[1] = strdup("*");
  coorX[2] = strdup("245");
  coorY[2] = strdup("*");
  res = defwSpecialNetPathPoint(3, coorX, coorY);
  CHECK_RES(res);
  res = defwSpecialNetPathEnd();
  free((char*)coorX[0]);
  free((char*)coorY[0]);
  free((char*)coorX[1]);
  free((char*)coorY[1]);
  ...
  return 0;}

## Shielded Routing

The shielded routing routines form a shielded routing specification that can be used to define a special net. The shielded routing specification is optional and can be used more than once in a SPECIALNET statement. For syntax information about the DEF SPECIALNETS statement, see Special Nets in the LEF/DEF Language Reference.

You must begin and end a shielded routing specification with the defwSpecialNetShieldStart and defwSpecialNetShieldEnd routines. You must define all shielded routing between these routines. The shielded routing routines must be included between the defwSpecialNet and defwEndOneNet routines.

For examples of the routines described here, see "Shielded Routing Example".

### defwSpecialNetShieldStart

Starts the shielded routing specification. This routine is optional and can be used only once to define each special net shield.

#### Syntax

int defwSpecialNetShieldStart(
  const char*
name)

#### Arguments

name

> Specifies the net shield name.

### defwSpecialNetShieldEnd

Ends the shielded routing specification.

#### Syntax

int defwSpecialNetShieldEnd()

### defwSpecialNetShieldLayer

Writes a LAYER statement. The LAYER statement is required and can be used only once per special net shield.

#### Syntax

int defwSpecialNetShieldLayer(
  const char*
name)

#### Arguments

name

> Specifies the layer on which the wire lies.

### defwSpecialNetShieldPoint

Specifies the points of the wire path in the special net shield. This routine is optional and can be used more than once per special net shield.

#### Syntax

int defwSpecialNetShieldPoint(
  int
numPts,
  const char** pointx,
  const char** pointy)

#### Arguments

numPts

> Specifies the number of points in the special net shield.

pointx pointy

> Specifies the coordinate locations for the path points.

### defwSpecialNetShieldShape

Writes a SHAPE statement. The SHAPE statement is optional and can be used only once per special net shield.

#### Syntax

int defwSpecialNetShieldShape(
  const char*
shapeType)

#### Arguments

shapeType

> Specifies a wire with special connection requirements because of its shape.
> Value: RING, PADRING, BLOCKRING, STRIPE, FOLLOWPIN, IOWIRE, COREWIRE, BLOCKWIRE, FILLWIRE, or BLOCKAGEWIRE

### defwSpecialNetShieldVia

Specifies a via name for the special net shield. This routine is optional and can be used more than once per special net shield.

#### Syntax

int defwSpecialNetShieldVia(
  const char*
name)

#### Arguments

name

> Specifies the via to place at the last specified path coordinate.

### defwSpecialNetShieldViaData

Creates an array of power vias of the via specified with the defwSpecialNetShieldVia routine. This routine is optional and can be used more than once for a special net.

#### Syntax

int defwSpecialNetShieldViaData(
  int
numX,
  int numY,
  int stepX,
  int stepY)

#### Arguments

numX numY

> Specifies the number of vias to create in the x and y directions.

stepX stepY

> Specifies the step distance in the x and y directions.

### defwSpecialNetShieldWidth

Writes a WIDTH statement. The WIDTH statement is required and can be used only once per special net shield.

#### Syntax

int defwSpecialNetShieldWidth(
  int
width)

#### Arguments

width

> Specifies the wire width.

### Shielded Routing Example

The following example only shows the usage of some functions related to shielded routing in a special net. This example is part of the special net callback routine.

int snetCB (defwCallbackType_e type,
  defiUserData userData) {
  int res;
  const char **coorX, **coorY;
  ...
  res = defwSpecialNetShieldStart("my_net");
  CHECK_RES(res);
  res = defwSpecialNetShieldLayer("M2");
  CHECK_RES(res);
  res = defwSpecialNetShieldWidth(90);
  CHECK_RES(res);
  coorX[0] = strdup("14100");
  coorY[0] = strdup("342440");
  coorX[1] = strdup("13920");
  coorY[1] = strdup("*");
  res = defwSpecialNetShieldPoint(2, coorX, coorY);
  CHECK_RES(res);
  res = defwSpecialNetShieldVia("M2_TURN");
  CHECK_RES(res);
  free((char*)coorX[0]);
  free((char*)coorY[0]);
  coorX[0] = strdup("*");
  coorY[0] = strdup("263200");
  res = defwSpecialNetShieldPoint(1, coorX, coorY);
  CHECK_RES(res);
  res = defwSpecialNetShieldVia("M1_M2");
  CHECK_RES(res);
  free((char*)coorX[0]);
  free((char*)coorY[0]);
  coorX[0] = strdup("2400");
  coorY[0] = strdup("*");
  res = defwSpecialNetShieldPoint(1, coorX, coorY);
  CHECK_RES(res);
  res = defwSpecialNetShieldEnd();
  ...
  return 0;}

## Slots

Slots routines write a DEF SLOTS statement. The SLOTS statement is optional and can be used only once in a DEF file. For syntax information about the DEF SLOTS statement, see "Slots" in the LEF/DEF Language Reference.

The SLOTS statement must start and end with the defwStartSlots and defwEndSlots routines. All slots must be defined between these routines.

All routines return 0 if successful.

### defwStartSlots

Starts a SLOTS statement.

#### Syntax

int defwStartSlots(
  int
count)

#### Arguments

count

> Specifies the number of defwSlotLayer routines in the SLOTS statement.

### defwEndSlots

Ends the SLOTS statement.

#### Syntax

int defwEndSlots()

### defwSlotLayer

Writes a LAYER statement. The LAYER statement is required for each slot and can be used more than once in a SLOTS statement.

#### Syntax

int defwSlotLayer(
  const char*
layerName)

#### Arguments

layerName

> Specifies the layer on which to create the slot.

### defwSlotPolygon

Writes a POLYGON statement. Either a POLYGON or RECT statement is required with a LAYER statement. The POLYGON statement can be used more than once for each slot in the SLOTS statement.

#### Syntax

defwSlotPolygon(
  int
num_polys,
  double* xl,
  double* yl)

#### Arguments

num_polys

> Specifies the number of polygon sides.

xl yl

> Specifies a sequence of points to generate a polygon geometry. The polygon edges must be parallel to the x axis, the y axis, or at a 45-degree angle.

### defwSlotRect

Writes a RECT statement. The RECT statement is required and can be used more than once for each slot in the SLOTS statement.

#### Syntax

int defwSlotRect(
  int
xl,
  int yl,
  int xh,
  int yh)

#### Arguments

xl yl xh yh

> Specifies the coordinates of the slot geometry.

## Styles

Styles routines write a DEF STYLES statement. The STYLES statement is optional and can be used only once in a DEF file. For syntax information about the STYLES statement, see "Styles" in the LEF/DEF Language Reference.

The STYLES statement must start and end with the defwStartStyles and defwEndStyles routines.

All routines return 0 if successful.

### defwStartStyles

Starts the STYLES statement.

#### Syntax

defwStartStyles(
  int
count)

#### Arguments

count

> Specifies the number of styles defined in the STYLES statement.

### defwEndStyles

Ends the STYLES statement.

#### Syntax

defwEndStyles()

### defwStyles

Defines a style. This routine is required and can be used more than once in the STYLES statement.

#### Syntax

defwStyles(
  int
styleNums,
  int num_points,
  double* xp,
  double* yp)

#### Arguments

styleNums

> Defines a style. styleNums is a positive integer that is greater than or equal to 0 (zero), and is used to reference the style later in the DEF file. When defining multiple styles, the first styleNums must be 0 (zero), and any following styleNums should be numbered consecutively so that a table lookup can be used to find them easily.

num_points

> Specifies the number of points in the style.

xp yp

> Specifies a sequence of points to generate a polygon geometry. The syntax corresponds to a coordinate pair, such as x y. Specify an asterisk (*) to repeat the same value as the previous x or y value from the last point. The polygon must be convex. The polygon edges must be parallel to the x axis, the y axis, or at a 45-degree angle, and must enclose the point (0 0).

## Technology

The Technology routine writes a DEF TECHNOLOGY statement. The TECHNOLOGY statement is optional and can be used only once in a DEF file. For syntax information about the TECHNOLOGY statement, see "Technology" in the LEF/DEF Language Reference.

This routine returns 0 if successful.

### defwTechnology

Writes a TECHNOLOGY statement.

#### Syntax

int defwTechnology(
  const char*
technology)

#### Arguments

technology

> Specifies a technology name for the design in the database.

## Tracks

The Tracks routine writes a DEF TRACKS statement. The TRACKS statement is optional and can be used only once in a DEF file. For syntax information about the DEF TRACKS statement, see Tracks in the LEF/DEF Language Reference.

If the DEF file contains a ROWS statement, the TRACKS statement must follow it. For more information about the DEF ROWS writer routine, see "Rows".

For examples of the routines described here, see "Tracks Example".

This routine returns 0 if successful.

### defwTracks

Writes a TRACKS statement.

#### Syntax

int defwTracks(
  const char*
master,
  int doStart,
  int doCount,
  int doStep,
  int numLayers,
  const char** layers)

#### Arguments

doCount

> Specifies the number of tracks to create.

doStep

> Specifies the step spacing between the tracks.

doStart

> Specifies the coordinate of the first line.

layers

> Specifies the routing layers used for the tracks.

master

> Specifies the direction for the first track defined.
> Value: Specify one of the following:

| X | Indicates vertical lines.
| Y | Indicates horizontal lines.

numLayers

> Specifies the number of routing layers to use for tracks.

### Tracks Example

The following example shows a callback routine with the type defwTrackCbkType.

int trackCB (defwCallbackType_e type,
  defiUserData userData) {
  int res;
  const char** layers;
  // Check if the type is correct
  if (type != defwTrackCbkType) {
  printf("Type is not defwTrackCbkType, terminate
  writing.\n");
  return 1;
  }

layers = (const char**)malloc(sizeof(char*)*1);
  layers[0] = strdup("M1");
  res = defwTracks("X", 3000, 40, 120, 1, layers);
  CHECK_RES(res);
  free((char*)layers[0]);
  layers[0] = strdup("M2");
  res = defwTracks("Y", 5000, 10, 20, 1,layers);
  CHECK_RES(res);
  free((char*)layers[0]);
  free((char*)layers);
  res = defwNewLine();
  CHECK_RES(res);
  return 0;}

## Units

The Units routine writes a DEF UNITS statement. The UNITS statement is optional and can be used only once in a DEF file. For syntax information about the UNITS statement, see "Units" in the LEF/DEF Language Reference.

This routine returns 0 if successful.

### defwUnits

Writes a UNITS statement.

#### Syntax

int defwUnits(
  int
units)

#### Arguments

units

> Specifies the convert factor used to convert DEF distance units into LEF distance units.

## Version

The Version routine writes a DEF VERSION statement. The VERSION statement is required and can be used only once in a DEF file. For syntax information about the DEF VERSION statement, see "Version" in the LEF/DEF Language Reference.

This routine returns 0 if successful.

### defwVersion

Writes a VERSION statement.

#### Syntax

int defwVersion(
  int
vers1,
  int vers2)

#### Arguments

version1

> Specifies the major number.

version2

> Specifies the minor number.

## Vias

Vias routines write a DEF VIAS statement. The VIAS statement is optional and can be used only once in a DEF file. For syntax information about the DEF VIAS statement, see "Vias" in the LEF/DEF Language Reference.

The VIAS statement must start and end with the defwStartVias and defwEndVias routines. All vias must be defined between these routines. Each individual via must start and end with the defwViaName and defwOneViaEnd routines.

For examples of the routines described here, see "Vias Example".

All routines return 0 if successful.

### defwStartVias

Starts a VIAS statement.

#### Syntax

int defwStartVias(
  int
count)

#### Arguments

count

> Specifies the number of vias defined in the VIAS statement.

### defwEndVias

Ends the VIAS statement.

If the count specified in defwStartVias is not the same as the actual number of defwViaName routines used, this routine returns DEFW_BAD_DATA.

#### Syntax

int defwEndVias(void)

### defwViaName

Starts a via description in the VIAS statement. Each via in the VIAS statement must start and end with defwViaName and defwOneViaEnd. This routine must be used the exact number of times specified with count in defwStartVias.

Each via can include one of the following routines:

| defwViaPolygon

| defwViaRect

| defwViaViarule

#### Syntax

int defwViaName(
  const char*
name)

#### Arguments

name

> Specifies the name of the via. Via names are generated by appending a number after the rule name. Vias are numbered in the order in which they are created.

### defwOneViaEnd

Ends a via description in the VIAS statement. Each via in the VIAS statement must start and end with defwViaName and defwOneViaEnd. This routine must be used the exact number of times specified with count in defwStartVias.

#### Syntax

int defwOneViaEnd()

### defwViaPolygon

Writes a POLYGON statement for a via in the VIAS statement. Either a POLYGON, RECT, or VIARULE statement can be specified for a via. The POLYGON statement is optional and can be used more than once for each via in the VIAS statement.

#### Syntax

int defwViaPolygon(
  const char*
layerName,
  int num_polys,
  double* xl,
  double* yl)

#### Arguments

layerName

> Specifies the layer on which to generate a polygon.

num_polys

> Specifies the number of polygon sides.

xl yl

> Specifies a sequence of points to generate a polygon geometry. The polygon edges must be parallel to the x axis, to the y axis, or at a 45-degree angle.

### defwViaRect

Writes a RECT statement for a via in the VIAS statement. Either a POLYGON, RECT, or VIARULE statement can be specified for a via. The RECT statement is optional and can be used more than once for each via in the VIAS statement.

#### Syntax

int defwViaRect(
  const char*
layerName,
  int xl,
  int yl,
  int xh,
  int yh)

#### Arguments

layerName

> Specifies the layer on which the via geometry lies. All geometries for the via, including the cut layers, are output by the DEF writer.

xl yl xh yh

> Defines the via geometry for the specified layer. The points are specified with respect to the via origin. In most cases, the via origin is the center of the via bounding box.

### defwViaViarule

Writes a VIARULE statement for a via in the VIAS statement. Either a POLYGON, RECT, or VIARULE statement can be specified for a via. The VIARULE statement is optional and can be used only once for each via in the VIAS statement.

If you specify this routine, you can optionally specify the following routines:

| defwViaViaruleRowCol

| defwViaViaruleOrigin

| defwViaViaruleOffset

| defwViaViarulePattern

#### Syntax

defwViaViarule(
  const char*
viaRuleName,
  double xCutSize,
  double yCutSize,
  const char* botMetalLayer,
  const char* cutLayer,
  const char* topMetalLayer,
  double xCutSpacing,
  double yCutSpacing,
  double xBotEnc,
  double yBotEnc,
  double xTopEnc,
  double yTopEnc)

#### Arguments

viaRuleName

> Specifies the name of the LEF VIARULE that produced this via. The VIARULE must be a VIARULE GENERATE via rule; it cannot refer to a VIARULE without a GENERATE keyword.

xCutSize yCutSize

> Specifies the required width (xCutSize) and height (yCutSize) of the cut layer rectangles.

botMetalLayer cutLayer topMetalLayer

> Specifies the required names of the bottom routing layer, cut layer, and top routing layer. These layer names must be previously defined in layer definitions, and must match the layer names defined in the specified LEF viaRuleName.

xCutSpacing yCutSpacing

> Specifies the required x and y spacing between cuts. The spacing is measured form one cut edge to the next cut edge.

xBotEnc yBotEnc xTopEnc yTopEnc

> Specifies the required x and y enclosure values for the bottom and top metal layers. The enclosure measures the distance from the cut array edge to the metal edge that encloses the cut array.

### defwViaViaruleRowCol

Writes a ROWCOL statement in the VIARULE for a via. The ROWCOL statement is optional and can be used only once for each via in the VIAS statement.

#### Syntax

defwViaViaruleRowCol(
  int
numCutRows,
  int numCutCols)

#### Arguments

numCutRows numCutCols

> Specifies the number of cut rows and columns that make up the cut array.

### defwViaViaruleOrigin

Writes an ORIGIN statement in a VIARULE statement for a via. The ORIGIN statement is optional and can be used only once for each via in the VIAS statement.

#### Syntax

defwViaViaruleOrigin(
  int
xOffset,
  int yOffset)

#### Arguments

xOffset yOffset

> Specifies the x and y offset for all of the via shapes. By default, the 0,0 origin of the via is the center of the cut array and the enclosing metal rectangles. After the non-shifted via is computed, all cut and metal rectangles are offset by adding these values.

### defwViaViaruleOffset

Writes an OFFSET statement in a VIARULE statement for a via. The OFFSET statement is optional and can be used only once for each via in the VIAS statement.

#### Syntax

defwViaViaruleOffset(
  int
xBotOffset,
  int yBotOffset,
  int xTopOffset,
  int yTopOffset)

#### Arguments

xBotOffset yBotOffset xTopOffset yTopOffset

> Specifies the x and y offset for the bottom and top metal layers. These values allow each metal layer to be offset independently.
> By default, the 0,0 origin of the via is the center of the cut array and the enclosing metal rectangles. After the non-shifted via is computed, the metal layer rectangles are offset by adding the appropriate values--the x/y BotOffset values to the metal layer below the cut layer, and the x/y TopOffset values to the metal layer above the cut layer.

### defwViaViarulePattern

Writes a PATTERN statement in a VIARULE statement for a via. The PATTERN statement is optional and can be used only once for each via in the VIAS statement.

#### Syntax

defwViaViarulePattern(
  const char*
cutPattern)

#### Arguments

cutPattern

> Specifies the cut pattern encoded as an ASCII string.

### Vias Example

The following example shows a callback routine with the type defwViaCbkType.

int viaCB (defwCallbackType_e type,
  defiUserData userData) {
  int res;

// Check if the type is correct
  if (type != defwViaCbkType) {
  printf("Type is not defwViaCbkType, terminate
  writing.\n");
  return 1;
  }

res = defwStartVias(1);
  CHECK_RES(res);
  res = defwViaName("VIA_ARRAY");
  CHECK_RES(res);
  res = defwViaRect("M1", -40, -40, 40, 40);
  CHECK_RES(res);
  res = defwViaRect("V1", -40, -40, 40, 40);
  CHECK_RES(res);
  res = defwViaRect("M2", -50, -50, 50, 50);
  CHECK_RES(res);
  res = defwOneViaEnd();
  CHECK_RES(res);
  res = defwEndVias();
  CHECK_RES(res);
  return 0;}

Return to top of page

For support, see Cadence Online Support service.
Copyright © 2016, Cadence Design Systems, Inc.
All rights reserved.