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.
- techAllocEncSnappingLayerArray
- techAllocSnappingLayerArray
- techFreeEncSnappingLayerArray
- techFreeSnappingLayerArray
- techCreateSnapPatternDef
- techCreateSnapPatternDefWithTrackGroups
- techCreateSnapPatternDef
- techDeleteSnapPatternDef
- techFindSnapPatternDef
- techFindSnapPatternDefByLPP
- techFindSnapPatternDefByName
- techGenSnapPatternDef
- techGenSnapPatternDefForLPP
- techGetSnapPatternDefLayer
- techGetSnapPatternDefName
- techGetSnapPatternDefOffset
- techGetSnapPatternDefPurpose
- techGetSnapPatternDefSnappingLayers
- techGetSnapPatternDefStep
- techGetSnapPatternDefTrackGroups
- techGetSnapPatternDefTrackWidth
- techGetSnapPatternDefType
- techIsSnapPatternDefHorizontal
- techSnapPatternDefTypeToString
- techStartGenSnapPatternDef
- techStartGenSnapPatternDefForLPP
- techStringToSnapPatternDefType
techAllocEncSnappingLayerArray
techEncSnappingLayer*
techAllocEncSnappingLayerArray(
unsigned int numLayers
);
Description
Allocates memory for the array of enclosed snapping layers and initializes the memory with zeroes.
Arguments
|
Number of enclosed snapping layer specifications to fit in the allocated memory. |
Return Value
techAllocSnappingLayerArray
techSnappingLayer*
techAllocSnappingLayerArray(
unsigned int numLayers
);
Description
Allocates memory for the array of snapping layers and initializes the memory with zeros.
Arguments
|
Number of snapping layer specifications to fit in the allocated memory. |
Return Value
techFreeEncSnappingLayerArray
void
techFreeEncSnappingLayerArray( unsigned intnumLayers, techEncSnappingLayer*layers);
Description
Deallocates the memory allocated for an array of enclosed snapping layers.
enclosures and snappingLayer.purposes members of each enclosed snapping layer in the array.Arguments
|
Size of the deallocated memory area, measured in blocks of sizeof(techEncSnappingLayers) bytes. |
|
Return Value
techCreateSnapPatternDef
techSnapPatternDefId
techSnapPatternDefId techCreateSnapPatternDef( techFileIdtechId, Stringname, techLayerNumlayerNum, techPurposepurposeNum, BooleanisHorizontal, dbDistancestep, techEncSnappingLayer*snappingLayers, unsigned intnumSnappingLayers, techSnapPatternDefTypetype, dbDistanceoffset, dbDistancetrackWidth);
Description
Creates a snap pattern definition object in the specified technology file.
Arguments
Return Value
techCreateSnapPatternDefWithTrackGroups
techSnapPatternDefId techCreateSnapPatternDefWithTrackGroups( techFileIdtechId, Stringname, techLayerNumlayerNum, techPurposepurposeNum, BooleanisHorizontal, dbDistancestep, techEncSnappingLayer*snappingLayers, unsigned intnumSnappingLayers, techSnapPatternDefTypetype, dbDistanceoffset, dbDistancetrackWidth, const techSnapPatternDefTrackGroup*trackGroups, unsigned intnumTrackGroups);
Description
Creates a snap pattern definition object with track groups in the specified technology file.
Arguments
Return Value
techFreeSnappingLayerArray
void
techFreeSnappingLayerArray( unsigned intnumLayers, techSnappingLayer*layers);
Description
Deallocates the memory allocated for an array of snapping layers.
purposes members of each snapping layer in the array.Arguments
|
Size of the deallocated memory area, measured in blocks of sizeof(dbSnappingLayer) bytes. |
|
Return Value
techCreateSnapPatternDef
techSnapPatternDefId
techSnapPatternDefId techCreateSnapPatternDef( techFileIdtechId, Stringname, techLayerNumlayerNum, techPurposepurposeNum, BooleanisHorizontal, dbDistancestep, techEncSnappingLayer*snappingLayers, unsigned intnumSnappingLayers, techSnapPatternDefTypetype, dbDistanceoffset, dbDistancetrackWidth);
Description
Creates a snap pattern definition object in the specified technology file.
Arguments
techCreateSnapPatternDefWithTrackGroups
techSnapPatternDefId techCreateSnapPatternDefWithTrackGroups( techFileIdtechId, Stringname, techLayerNumlayerNum, techPurposepurposeNum, BooleanisHorizontal, dbDistancestep, techEncSnappingLayer*snappingLayers, unsigned intnumSnappingLayers, techSnapPatternDefTypetype, dbDistanceoffset, dbDistancetrackWidth, const techSnapPatternDefTrackGroup*trackGroups, unsigned intnumTrackGroups);
Description
Creates a snap pattern definition object with track groups in the specified technology file.
Arguments
Return Value
techDeleteSnapPatternDef
Boolean
techDeleteSnapPatternDef(
techSnapPatternDefId SPDef
);
Description
Deletes the specified snap pattern definition object.
Arguments
Return Values
techFindSnapPatternDef
techSnapPatternDefId
techFindSnapPatternDef( techFileIdtechId, techLayerNumlayerNum, techPurposepurposeNum);
Description
Searches for the snap pattern definition object by the specified layer and purpose in the specified technology file.
Arguments
Return Value
techFindSnapPatternDefByLPP
techSnapPatternDefId
techFindSnapPatternDefByLPP( techFileIdtechId, techLPIdlpId);
Description
Searches for the snap pattern definition object by the specified layer-purpose pair (LPP) in the specified technology file.
Arguments
|
ID of the LPP whose layer and purpose IDs are used for the search. |
Return Value
techFindSnapPatternDefByName
techSnapPatternDefId
techFindSnapPatternDefByName( techFileIdtechId, cppConstStringname);
Description
Searches for the snap pattern definition object with the specified name in the specified technology file.
Arguments
|
Name of the snap pattern definition object for which the search is performed. |
Return Value
techFindSnapPatternDefByName
techSnapPatternDefId
techFindSnapPatternDefByName( techFileIdtechId, cppConstStringname);
Description
Searches for the snap pattern definition object with the specified name in the specified technology file.
Arguments
|
Name of the snap pattern definition object for which the search is performed. |
Return Value
techGenSnapPatternDef
Boolean
techGenSnapPatternDef( techGenStateIdpState, 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
|
ID of the next snap pattern definition produced by the generator. This value is undefined if |
Return Value
|
|
techGenSnapPatternDefForLPP
Boolean
techGenSnapPatternDefForLPP( techGenStateIdpState, 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
|
ID of the next snap pattern definition object produced by the generator. This value is undefined if |
Return Value
|
|
techGetSnapPatternDefLayer
techLayerNum
techGetSnapPatternDefLayer(
techSnapPatternDefId SPDef
);
Description
Retrieves the layer number for the specified snap pattern definition object.
Arguments
Return Value
|
Layer number for the specified snap pattern definition object. |
techGetSnapPatternDefName
String
techGetSnapPatternDefName(
techSnapPatternDefId SPDef
);
Description
Retrieves the name for the specified snap pattern definition object.
Arguments
Return Value
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
Return Value
|
Offset value of the specified snap pattern definition object. |
techGetSnapPatternDefPurpose
techPurpose
techGetSnapPatternDefPurpose(
techSnapPatternDefId SPDef
);
Description
Retrieves the purpose for the specified snap pattern definition object.
Arguments
Return Value
techGetSnapPatternDefSnappingLayers
void
techGetSnapPatternDefSnappingLayers( techSnapPatternDefIdSPDef, 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
|
Pointer to the memory area in which the number of snapping layers is placed. |
|
|
Pointer to the memory area in which the array of snapping layers is placed. |
Return Value
techGetSnapPatternDefStep
dbDistance
techGetSnapPatternDefStep(
techSnapPatternDefId SPDef
);
Description
Retrieves the step (spacing between pattern tracks) for the specified snap pattern definition.
Arguments
Return Value
techGetSnapPatternDefTrackGroups
void
techGetSnapPatternDefTrackGroups( techSnapPatternDefIdSPdef, unsigned int*numTrackGroups, techSnapPatternDefTrackGroup**trackGroups);
Description
Retrieves the list of track groups from the specified snap pattern definition object.
Arguments
|
Pointer to the memory area in which the number of track groups is placed. |
|
|
Pointer to the memory area in which the array of track group entries is placed. |
Return Value
techGetSnapPatternDefTrackWidth
dbDistance
techGetSnapPatternDefTrackWidth(
techSnapPatternDefId SPDef
);
Description
Retrieves the track width for the specified snap pattern definition object.
Arguments
Return Value
|
Track width of the specified snap pattern definition object. |
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
Return Value
techIsSnapPatternDefHorizontal
Boolean
techIsSnapPatternDefHorizontal(
techSnapPatternDefId SPDef
);
Description
Verifies whether the specified snap pattern definition object direction is horizontal.
Arguments
Return Value
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
Return Value
|
|
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
|
ID of the technology file containing the snap pattern definition objects to be generated. |
Return Value
techStartGenSnapPatternDefForLPP
techGenStateId
techStartGenSnapPatternDefForLPP( techFileIdtechId, techLPIdsnapLPId);
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
|
ID of the technology file containing the snap pattern definition objects to be generated. |
|
Return Value
techStringToSnapPatternDefType
Boolean
techStringToSnapPatternDefType( cppConstStringtypeStr, 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
|
Pointer to the memory area where the conversion result will be written. The value referenced by the pointer is undefined if |
Return Value
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