Product Documentation
Cadence Integrators Toolkit Database Reference
Product Version IC23.1, June 2023

21


Snap Pattern Definition Functions

A SnapPattern object is a technology database object that provides an improved control over the layout of instances for some layer-purpose pairs (LPPs) in advanced node designs. The snap pattern data is stored in a Snap Pattern Definition (SnapPatternDef) object.

You can use the SnapPatternDef functions to create, search, and delete SnapPatternDefs and to modify the underlying SnapPatterns data.

To learn how to use SnapPatternDef functions, see Example- Using Snap Pattern Definition Functions.

Supported functions include:

techAllocEncSnappingLayerArray

techEncSnappingLayer*
techAllocEncSnappingLayerArray(
unsigned int numLayers
);

Description

Allocates memory for the array of enclosed snapping layers and initializes the memory with zeroes.

Arguments

numLayers

Number of enclosed snapping layer specifications to fit in the allocated memory.

Return Value

techEncSnappingLayer*

Pointer to the allocated memory area.

techAllocSnappingLayerArray

techSnappingLayer*
techAllocSnappingLayerArray(
unsigned int    numLayers
);

Description

Allocates memory for the array of snapping layers and initializes the memory with zeros.

Arguments

numLayers

Number of snapping layer specifications to fit in the allocated memory.

Return Value

techSnappingLayer*

Pointer to the allocated memory area.

Returns NULL in case of failure.

techFreeEncSnappingLayerArray

void
techFreeEncSnappingLayerArray(
unsigned int          numLayers,
techEncSnappingLayer  *layers
);

Description

Deallocates the memory allocated for an array of enclosed snapping layers.

In addition to deallocating the specified memory area, the function also frees the memory internally on the non-null enclosures and snappingLayer.purposes members of each enclosed snapping layer in the array.

Arguments

numLayers

Size of the deallocated memory area, measured in blocks of sizeof(techEncSnappingLayers) bytes.

layers

Pointer to the memory area to deallocate.

Return Value

No value returned.

techCreateSnapPatternDef

techSnapPatternDefId
techSnapPatternDefId
techCreateSnapPatternDef(
techFileId techId,
String name,
techLayerNum layerNum,
techPurpose purposeNum,
Boolean isHorizontal,
dbDistance step,
techEncSnappingLayer *snappingLayers,
unsigned int numSnappingLayers,
techSnapPatternDefType type,
dbDistance offset,
dbDistance trackWidth
);

Description

Creates a snap pattern definition object in the specified technology file.

Arguments

techId

ID of the technology file in which the snap pattern definition object is created.

name

Name for the snap pattern definition object.

layerNum

Layer number for the snap pattern definition object.

purposeNum

Purpose number for the snap pattern definition object.

isHorizontal

Pattern direction: TRUE for horizontal and FALSE for vertical.

step

Distance between the pattern tracks.

snappingLayers

Array of snapping layers for the snap pattern definition object.

numSnappingLayers

Number of elements in the array of snapping layers.

type

Type of the snap pattern definition object.

offset

Distance from the nearest period track to the anchor reference (either the lower edge of the PRBoundary or the origin axis).

trackWidth

Width of the physical shape, represented by each track.

Return Value

techSnapPatternDefId

ID of the created snap pattern definition object.

techCreateSnapPatternDefWithTrackGroups

techSnapPatternDefId
techCreateSnapPatternDefWithTrackGroups(
techFileId techId,
String name,
techLayerNum layerNum,
techPurpose purposeNum,
Boolean isHorizontal,
dbDistance step,
techEncSnappingLayer *snappingLayers,
unsigned int numSnappingLayers,
techSnapPatternDefType type,
dbDistance offset,
dbDistance trackWidth,
const techSnapPatternDefTrackGroup *trackGroups,
unsigned int numTrackGroups
);

Description

Creates a snap pattern definition object with track groups in the specified technology file.

Arguments

techId

ID of the technology file in which the snap pattern definition object is created.

name

Name for the snap pattern definition object.

layerNum

Layer number for the snap pattern definition object.

purposeNum

Purpose number for the snap pattern definition object.

isHorizontal

Pattern direction: TRUE for horizontal and FALSE for vertical.

step

Distance between the pattern tracks.

snappingLayers

Array of snapping layers for the snap pattern definition object.

numSnappingLayers

Number of elements in the array of snapping layers.

type

Type of the snap pattern definition object.

offset

Distance from the nearest period track to the anchor reference (either the lower edge of the PRBoundary or the origin axis).

trackWidth

Width of the physical shape, represented by each track.

trackGroups

Array of track groups.

numTrackGroups

Number of elements in the array of track groups. A warning is displayed if the function is called with numTrackGroups = 0.

Return Value

techSnapPatternDefId

ID of the created snap pattern definition object.

techFreeSnappingLayerArray

void
techFreeSnappingLayerArray(
unsigned int      numLayers,
techSnappingLayer *layers
);

Description

Deallocates the memory allocated for an array of snapping layers.

In addition to deallocating the specified memory area, the function also frees the memory internally on the non-null purposes members of each snapping layer in the array.

Arguments

numLayers

Size of the deallocated memory area, measured in blocks of sizeof(dbSnappingLayer) bytes.

layers

Pointer to the memory area to deallocate.

Return Value

No value returned.

techCreateSnapPatternDef

techSnapPatternDefId
techSnapPatternDefId
techCreateSnapPatternDef(
techFileId techId,
String name,
techLayerNum layerNum,
techPurpose purposeNum,
Boolean isHorizontal,
dbDistance step,
techEncSnappingLayer *snappingLayers,
unsigned int numSnappingLayers,
techSnapPatternDefType type,
dbDistance offset,
dbDistance trackWidth
);

Description

Creates a snap pattern definition object in the specified technology file.

Arguments

techId

ID of the technology file in which the snap pattern definition object is created.

name

Name for the snap pattern definition object.

layerNum

Layer number for the snap pattern definition object.

purposeNum

Purpose number for the snap pattern definition object.

isHorizontal

Pattern direction: TRUE for horizontal and FALSE for vertical.

step

Distance between the pattern tracks.

snappingLayers

Array of snapping layers for the snap pattern definition object.

numSnappingLayers

Number of elements in the array of snapping layers.

type

Type of the snap pattern definition object.

offset

Distance from the nearest period track to the anchor reference (either the lower edge of the PRBoundary or the origin axis).

trackWidth

Width of the physical shape, represented by each track.

Return Value

techSnapPatternDefId

ID of the created snap pattern definition object.

techCreateSnapPatternDefWithTrackGroups

techSnapPatternDefId
techCreateSnapPatternDefWithTrackGroups(
techFileId techId,
String name,
techLayerNum layerNum,
techPurpose purposeNum,
Boolean isHorizontal,
dbDistance step,
techEncSnappingLayer *snappingLayers,
unsigned int numSnappingLayers,
techSnapPatternDefType type,
dbDistance offset,
dbDistance trackWidth,
const techSnapPatternDefTrackGroup *trackGroups,
unsigned int numTrackGroups
);

Description

Creates a snap pattern definition object with track groups in the specified technology file.

Arguments

techId

ID of the technology file in which the snap pattern definition object is created.

name

Name for the snap pattern definition object.

layerNum

Layer number for the snap pattern definition object.

purposeNum

Purpose number for the snap pattern definition object.

isHorizontal

Pattern direction: TRUE for horizontal and FALSE for vertical.

step

Distance between the pattern tracks.

snappingLayers

Array of snapping layers for the snap pattern definition object.

numSnappingLayers

Number of elements in the array of snapping layers.

type

Type of the snap pattern definition object.

offset

Distance from the nearest period track to the anchor reference (either the lower edge of the PRBoundary or the origin axis).

trackWidth

Width of the physical shape, represented by each track.

trackGroups

Array of track groups.

numTrackGroups

Number of elements in the array of track groups. A warning is displayed if the function is called with numTrackGroups = 0.

Return Value

techSnapPatternDefId

ID of the created snap pattern definition object.

techDeleteSnapPatternDef

Boolean
techDeleteSnapPatternDef(
techSnapPatternDefId  SPDef
);

Description

Deletes the specified snap pattern definition object.

Arguments

SPDef

ID of the snap pattern definition object to be deleted.

Return Values

Boolean

TRUE, if the object was successfully deleted.

FALSE, if the object was not deleted.

techFindSnapPatternDef

techSnapPatternDefId
techFindSnapPatternDef(
techFileId     techId,
techLayerNum   layerNum,
techPurpose    purposeNum
);

Description

Searches for the snap pattern definition object by the specified layer and purpose in the specified technology file.

Arguments

techId

ID of the technology file in which the search is performed.

layerNum

Layer number in a layer-purpose pair.

purposeNum

Purpose number in a layer-purpose pair.

Return Value

techSnapPatternDefId

ID of the snap pattern definition object, if found.

Returns NULL in case of failure.

techFindSnapPatternDefByLPP

techSnapPatternDefId
techFindSnapPatternDefByLPP(
techFileId     techId,
techLPId       lpId
);

Description

Searches for the snap pattern definition object by the specified layer-purpose pair (LPP) in the specified technology file.

Arguments

techId

ID of the technology file in which the search is performed.

lpId

ID of the LPP whose layer and purpose IDs are used for the search.

Return Value

techSnapPatternDefId

ID of the snap pattern definition object, if found.

Returns NULL in case of failure.

techFindSnapPatternDefByName

techSnapPatternDefId
techFindSnapPatternDefByName(
techFileId          techId,
cppConstString      name
);

Description

Searches for the snap pattern definition object with the specified name in the specified technology file.

Arguments

techId

ID of the technology file in which the search is performed.

name

Name of the snap pattern definition object for which the search is performed.

Return Value

techSnapPatternDefId

ID of the snap pattern definition object, if found.

Returns NULL in case of failure.

techFindSnapPatternDefByName

techSnapPatternDefId
techFindSnapPatternDefByName(
techFileId          techId,
cppConstString      name
);

Description

Searches for the snap pattern definition object with the specified name in the specified technology file.

Arguments

techId

ID of the technology file in which the search is performed.

name

Name of the snap pattern definition object for which the search is performed.

Return Value

techSnapPatternDefId

ID of the snap pattern definition object, if found.

Returns NULL in case of failure.

techGenSnapPatternDef

Boolean
techGenSnapPatternDef(
techGenStateId        pState,
techSnapPatternDefId  *snapPatternDefId
);

Description

Retrieves the ID of the next snap pattern definition object from the generator with the given techGenStateId. The snap pattern definition ID is returned in the snapPatternDefId argument.

Arguments

pState

State ID for the generator.

snapPatternDefId

ID of the next snap pattern definition produced by the generator. This value is undefined if FALSE is returned.

Return Value

Boolean

TRUE, if the next snap pattern definition ID is successfully generated.

FALSE, if the list is exhausted or an error occurs.

techGenSnapPatternDefForLPP

Boolean
techGenSnapPatternDefForLPP(
techGenStateId        pState,
techSnapPatternDefId  *snapPatternDefId
);

Description

Retrieves the ID of the next snap pattern definition object from the generator with the given state. The snap pattern definition ID is returned in the snapPatternDefId argument.

Arguments

pState

State ID for the generator.

snapPatternDefId

ID of the next snap pattern definition object produced by the generator. This value is undefined if FALSE is returned.

Return Value

Boolean

TRUE, if the next snap pattern definition ID is successfully generated.

FALSE, if the list is exhausted or an error occurs.

techGetSnapPatternDefLayer

techLayerNum
techGetSnapPatternDefLayer(
techSnapPatternDefId   SPDef
);

Description

Retrieves the layer number for the specified snap pattern definition object.

Arguments

SPDef

ID of a snap pattern definition object.

Return Value

techLayerNum

Layer number for the specified snap pattern definition object.

Returns techcNullLayer in case of error.

techGetSnapPatternDefName

String
techGetSnapPatternDefName(
techSnapPatternDefId    SPDef
);

Description

Retrieves the name for the specified snap pattern definition object.

Arguments

SPDef

ID of a snap pattern definition object.

Return Value

String

Name of the specified snap pattern definition object.

Returns NULL in case of error.

techGetSnapPatternDefOffset

dbDistance
techGetSnapPatternDefOffset(
techSnapPatternDefId  SPDef
);

Description

Retrieves the offset for the specified snap pattern definition object. Here, offset is the distance of the first track from the period track.

Arguments

SPDef

ID of a snap pattern definition object.

Return Value

dbDistance

Offset value of the specified snap pattern definition object.

Returns 0 in case of error.

techGetSnapPatternDefPurpose

techPurpose
techGetSnapPatternDefPurpose(
techSnapPatternDefId SPDef
);

Description

Retrieves the purpose for the specified snap pattern definition object.

Arguments

spDef

ID of a snap pattern definition object.

Return Value

techPurpose

Purpose of the specified snap pattern definition object.

Returns techcUnknownPurpose in case of error.

techGetSnapPatternDefSnappingLayers

void
techGetSnapPatternDefSnappingLayers(
techSnapPatternDefId    SPDef,
unsigned int            *numSnappingLayers,
techEncSnappingLayer    **snappingLayers
);

Description

Allocates a suitable amount of heap memory, and fills it with an array of snapping layers of the specified snap pattern definition object. Pointer to the allocated memory area is returned through the snappingLayers parameter and the size of this memory area is returned through the numSnappingLayers parameter.

Arguments

SPDef

ID of a snap pattern definition object.

numSnappingLayers

Pointer to the memory area in which the number of snapping layers is placed.

snappingLayers

Pointer to the memory area in which the array of snapping layers is placed.

Return Value

No value returned.

techGetSnapPatternDefStep

dbDistance
techGetSnapPatternDefStep(
techSnapPatternDefId    SPDef
);

Description

Retrieves the step (spacing between pattern tracks) for the specified snap pattern definition.

Arguments

wspId

ID of a snap pattern definition object.

Return Value

dbDistance

Step value of the specified snap pattern definition object.

Returns 0 in case of error.

techGetSnapPatternDefTrackGroups

void
techGetSnapPatternDefTrackGroups(
techSnapPatternDefId SPdef,
unsigned int *numTrackGroups,
techSnapPatternDefTrackGroup **trackGroups
);

Description

Retrieves the list of track groups from the specified snap pattern definition object.

Arguments

SPdef

ID of a snap pattern definition object.

numTrackGroups

Pointer to the memory area in which the number of track groups is placed.

trackGroups

Pointer to the memory area in which the array of track group entries is placed.

Return Value

No value returned.

techGetSnapPatternDefTrackWidth

dbDistance
techGetSnapPatternDefTrackWidth(
techSnapPatternDefId  SPDef
);

Description

Retrieves the track width for the specified snap pattern definition object.

Arguments

SPDef

ID of a snap pattern definition object.

Return Value

dbDistance

Track width of the specified snap pattern definition object.

Returns 0 in case of error.

techGetSnapPatternDefType

techSnapPatternDefType
techGetSnapPatternDefType(
techSnapPatternDefId  SPDef
);

Description

Retrieves the type for the specified snap pattern definition object. Valid values are 0 and 1, or integer constants techcSPTypeLocal and techcSPTypeGlobal, respectively.

Arguments

SPDef

ID of a snap pattern definition object.

Return Value

techSnapPatternDefType

Type of the specified snap pattern definition object.

techIsSnapPatternDefHorizontal

Boolean
techIsSnapPatternDefHorizontal(
techSnapPatternDefId   SPDef
);

Description

Verifies whether the specified snap pattern definition object direction is horizontal.

Arguments

SPDef

ID of a snap pattern definition object.

Return Value

Boolean

TRUE, if the object is horizontal.

FALSE, if the object is vertical.

techSnapPatternDefTypeToString

String
techSnapPatternDefTypeToString(
int  type
);

Description

Converts a techSnapPatternDefType enum to a string holding the name of the corresponding snapPatternDef type. Valid input values are 0 and 1, or integer constants techcSPTypeLocal and techcSPTypeGlobal, respectively.

Arguments

type

A snap pattern definition type enum.

Return Value

String

“local”, if input value is 0 or techcSPTypeLocal.

“global”, if input value is 1 or techcSPTypeGlobal.

Returns NULL in case of failure.

techStartGenSnapPatternDef

techGenStateId
techStartGenSnapPatternDef(
techFileId  techId
);

Description

Initializes a generator for all snap pattern definition objects in the specified technology file. A generator state is returned, which is used with the techGenSnapPatternDef function.

Arguments

techId

ID of the technology file containing the snap pattern definition objects to be generated.

Return Value

techGenStateId

State ID for the generator.

techStartGenSnapPatternDefForLPP

techGenStateId
techStartGenSnapPatternDefForLPP(
techFileId  techId,
techLPId    snapLPId
);

Description

Initializes a generator for all snap pattern definition objects in the specified technology file that have the specified snapping LPP. A generator state is returned, which is used with the techGenSnapPatternDefForLPP function.

Arguments

techId

ID of the technology file containing the snap pattern definition objects to be generated.

snapLPId

ID of the LPP used for generation.

Return Value

techGenStateId

State ID for the generator.

techStringToSnapPatternDefType

Boolean 
techStringToSnapPatternDefType(
cppConstString           typeStr,
techSnapPatternDefType   *type
);

Description

Converts the string holding a snap pattern definition type name to a techSnapPatternDefType enum. Valid input strings are “local” and “global”. The result is written to the memory area referenced by the type pointer.

Arguments

typeStr

A snap pattern definition type name.

type

Pointer to the memory area where the conversion result will be written. The value referenced by the pointer is undefined if FALSE is returned.

Return Value

Boolean

TRUE, if the conversion returned a valid result.

FALSE, in case of failure.

Example- Using Snap Pattern Definition Functions

// Create the test data.
ddId                    lib = ddCreateLib("design", getTestDir() + "/design");
techFileId              techfile = techOpenTechFile("design", "tech.db", "a");
tcLoadTechFile(techfile, "dump.tf", "w", ilcNil);
constString             name = "finfet1";
techLayerNum            layerNum = 4;
techLayerNum            snapLayerNum = 5;
techPurpose             purposeNum = 1001;
Boolean                 isHorizontal = TRUE;
dbDistance              offset = 30;
dbDistance              step = 20;
unsigned int            numTrackEnclosures = 2;
unsigned int            numSnapPurposes = 1;
unsigned int            snapPurposeNum = 5;
dbDistance              trackWidth = 19;
techEncSnappingLayer    *snappingLayers = techAllocEncSnappingLayerArray(1);
techSnapPatternDefType  type = techcSPTypeGlobal;
snappingLayers[0].enclosures = calloc(numTrackEnclosures,
                                            dbDualDistance);
snappingLayers[0].snappingLayer.purposes = calloc(numSnapPurposes, 
                                                        techPurpose);
    
snappingLayers[0].snappingLayer.layerNum = snapLayerNum;
snappingLayers[0].enclosures[0].first = 1;
snappingLayers[0].enclosures[0].second = 2;
snappingLayers[0].enclosures[1].first = 3;
snappingLayers[0].enclosures[1].second = 4;
snappingLayers[0].numEnclosures = numTrackEnclosures;
snappingLayers[0].snappingLayer.purposes[0] = snapPurposeNum;
snappingLayers[0].snappingLayer.numPurposes = numSnapPurposes;
techSnapPatternDefId spId = techCreateSnapPatternDef(techfile,
                                                     (String) name,
                                                     layerNum,
                                                     purposeNum,
                                                     isHorizontal,
                                                     step,
                                                     snappingLayers,
                                                     1,
                                                     type,
                                                     offset, 
                                                     trackWidth);
// Examples for the getter functions.
cout << "Sample snapPatternDef dump: " << endl;
cout << "  name: "
     << techGetSnapPatternDefName(spId) << endl;
cout << "  layer: "
     << techGetSnapPatternDefLayer(spId) << endl;
cout << "  purpose: "
     << techGetSnapPatternDefPurpose(spId) << endl;
cout << "  horizontal: "
     << (bool) techIsSnapPatternDefHorizontal(spId) << endl;
cout << "  offset: "
     << techGetSnapPatternDefOffset(spId) << endl;
cout << "  step: "
     << techGetSnapPatternDefStep(spId) << endl;
cout << "  track width: "
     << techGetSnapPatternDefTrackWidth(spId) << endl;
cout << "  type: "
     << techSnapPatternDefTypeToString(techGetSnapPatternDefType(spId))
     << endl;
unsigned int            tmp_num = 0;
techEncSnappingLayer    *tmp_snapLayers = NULL;
techGetSnapPatternDefSnappingLayers(spId, &tmp_num, &tmp_snapLayers);
cout << "  snapping layers:" << endl;
assert(tmp_num == 1);
assert(tmp_snapLayers[0].snappingLayer.layerNum 
       == snappingLayers[0].snappingLayer.layerNum);
assert(tmp_snapLayers[0].numEnclosures == snappingLayers[0].numEnclosures);
assert(tmp_snapLayers[0].snappingLayer.numPurposes 
       == snappingLayers[0].snappingLayer.numPurposes);
cout << "    layer: " << tmp_snapLayers[0].snappingLayer.layerNum << " purposes: (";
for (oaUInt4 k = 0; k < snappingLayers[0].snappingLayer.numPurposes; k++) {
    assert(tmp_snapLayers[0].snappingLayer.purposes[k] 
           == snappingLayers[0].snappingLayer.purposes[k]);
    cout  << " " << tmp_snapLayers[0].snappingLayer.purposes[k];
}    
cout << " )" << endl << endl;
techFreeEncSnappingLayerArray(1, tmp_snapLayers);
// Examples for the generator functions.
techGenStateId       gen_state = techStartGenSnapPatternDef(techfile);
techSnapPatternDefId tmp_spDef;
cout << "Snap pattern definition names returned by the techGenSnapPatternDef generator: ";
while (techGenSnapPatternDef(gen_state, &tmp_spDef))
    cout << " " << techGetSnapPatternDefName(tmp_spDef);
cout << endl << endl;
techStopGen(gen_state);
cout << "Snap pattern definition names returned by the techGenSnapPatternDefForLPP generator: ";
techLPId                lpp = techCreateLP(techfile, layerNum,
                                           purposeNum, "M3");
techLPId                snap_lpp = techCreateLP(techfile, snapLayerNum,
                                                snapPurposeNum, "VIA3");
assert(lpp);
gen_state = techStartGenSnapPatternDefForLPP(techfile, snap_lpp);
while (techGenSnapPatternDefForLPP(gen_state, &tmp_spDef))
    cout << " " << techGetSnapPatternDefName(tmp_spDef);
cout << endl << endl;
techStopGen(gen_state);
// Examples for the find and delete functions.
assert(spId == techFindSnapPatternDefByLPP(techfile, lpp));
assert(spId == techFindSnapPatternDef(techfile, layerNum, purposeNum));
assert(spId == techFindSnapPatternDefByName(techfile, name));
assert(techDeleteSnapPatternDef(spId));
assert(techFindSnapPatternDefByName(techfile, name) == techcNullSnapPatternDefId);
// Clean up the test data.


Return to top
 ⠀
X