LEF 5.8 C/C++ API Guide
LEF 5.8 C/C++ API Guide
Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
What’s New . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Related Documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Typographic and Syntax Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
LEF Reader Working Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Comparison Utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Compressed LEF Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Orientation Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2
LEF Reader Setup and Control Routines . . . . . . . . . . . . . . . . . . . . . . 23
Calling the API Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
LEF API Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
lefrInit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
lefrInitSession . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
lefrClear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
lefrGetUserData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
lefrPrintUnusedCallbacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
lefrRead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
lefrRegisterLef58Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
lefrReset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
lefrSetCommentChar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
lefrSetRegisterUnusedCallbacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
lefrSetShiftCase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
lefrSetUserData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
lefrSetVersionValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3
LEF Reader Callback Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Callback Function Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Callback Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
LEF_Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
User Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Callback Types and Setting Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
User Callback Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
lefrDensityCbkFnType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
lefrDoubleCbkFnType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
lefrIntergerCbkFnType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
lefrLayerCbkFnType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
lefrMacroCbkFnType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
lefrMacroForeignCbkFnType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
lefrMacroNumCbkFnType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
lefrMacroSiteCbkFnType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
lefrMaxStackViaCbkFnType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
lefrNonDefaultCbkFnType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
lefrObstructionCbkFnType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
lefrPinCbkFnType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
lefrPropCbkFnType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
lefrSiteCbkFnType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
lefrSpacingCbkFnType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
lefrStringCbkFnType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
lefrUnitsCbkFnType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
lefrUseMinSpacingCbkFnType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
lefrViaCbkFnType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
lefrViaRuleCbkFnType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
lefrVoidCbkFnType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
4
LEF Reader Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Callback Style Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Retrieving Repeating LEF Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Deriving C Syntax from C++ Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
C++ Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
C Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
LEF Reader Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Layer Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
lefiAntennaModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
lefiAntennaPWL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
lefiInfluence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
lefiLayer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
lefiLayerDensity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
lefiOrthogonal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
lefiParallel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
lefiSpacingTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
lefiTwoWidths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Macro Data Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
lefiDensity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
lefiMacro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
lefiMacroForeign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
lefiMacroSite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
lefiPoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Macro Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Macro Obstruction Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
lefiObstruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Macro Obstruction Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Macro Pin Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
lefiPin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
lefiPinAntennaModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
lefiGeometries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
lefiGeomEnum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
lefiGeomRect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
lefiGeomRectIter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
lefiGeomPath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
lefiGeomPathIter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
lefiGeomPolygon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
lefiGeomPolygonIter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
lefiGeomVia . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
lefiGeomViaIter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Macro Pin Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Maximum Via Stack Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
lefiMaxStackVia . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Miscellaneous Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
lefiUserData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Nondefault Rule Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
lefiNonDefault . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Nondefault Rule Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Property Definition Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
lefiProp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
lefiPropType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Property Definition Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Same-Net Spacing Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
lefiSpacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Same-Net Spacing Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Site Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
lefiSite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
lefiSitePattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Site Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Units Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
lefiUnits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Units Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Use Min Spacing Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
lefiUseMinSpacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Via Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
lefiVia . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
lefiViaLayer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Via Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Via Rule Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
lefiViaRule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
lefiViaRuleLayer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Via Rule Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
5
LEF Writer Callback Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Callback Function Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Callback Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
User Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Callback Types and Setting Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
6
LEF Writer Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
LEF Writer Setup and Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
lefwInit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
lefwEnd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
lefwCurrentLineNumber . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
lefwNewLine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
lefwPrintError . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Setup Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Bus Bit Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
lefwBusBitChars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Bus Bit Characters Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Clearance Measure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
lefwClearanceMeasure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Divider Character . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
lefwDividerChar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Divider Character Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
lefwStartBeginext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
lefwEndBeginext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
lefwBeginextCreator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
lefwBeginextDate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
lefwBeginextRevision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
lefwBeginextSyntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
lefwLayerResistancePerCut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
lefwLayerWidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Layer Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Layer (Routing) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
lefwStartLayerRouting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
lefwEndLayerRouting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
lefwDensityCheckStep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
lefwDensityCheckWindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
lefwFillActiveSpacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
lefwLayerACCurrentDensity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
lefwLayerACFrequency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
lefwLayerACTableEntries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
lefwLayerACWidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
lefwLayerAntennaAreaDiffReducePwl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
lefwLayerAntennaAreaFactor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
lefwLayerAntennaAreaMinusDiff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
lefwLayerAntennaAreaRatio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
lefwLayerAntennaCumAreaRatio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
lefwLayerAntennaCumDiffAreaRatio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
lefwLayerAntennaCumDiffAreaRatioPwl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
lefwLayerAntennaCumDiffSideAreaRatio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
lefwLayerAntennaCumDiffSideAreaRatioPwl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
lefwLayerAntennaCumSideAreaRatio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
lefwLayerAntennaCumRoutingPlusCut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
lefwLayerAntennaDiffAreaRatio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
lefwLayerAntennaDiffAreaRatioPwl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
lefwLayerAntennaDiffSideAreaRatio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
lefwLayerAntennaDiffSideAreaRatioPwl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
lefwLayerAntennaGatePlusDiff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
lefwLayerAntennaModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
lefwLayerAntennaSideAreaFactor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
lefwLayerAntennaSideAreaRatio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
lefwLayerDCCurrentDensity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
lefwLayerDCTableEntries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
lefwLayerDCWidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
lefwLayerRouting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
lefwLayerRoutingArea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
lefwLayerRoutingCapacitance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
lefwLayerRoutingCapMultiplier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
lefwLayerRoutingDiagMinEdgeLength . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
lefwLayerRoutingDiagPitch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
lefwLayerRoutingDiagPitchXYDistance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
lefwLayerRoutingDiagSpacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
lefwLayerRoutingDiagWidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
lefwLayerRoutingEdgeCap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
lefwLayerRoutingHeight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
lefwLayerRoutingMaxwidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
lefwLayerRoutingMinenclosedarea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
lefwLayerRoutingMinimumcut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
lefwLayerRoutingMinimumcutConnections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
lefwLayerRoutingMinimumcutLengthWithin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
lefwLayerRoutingMinimumcutWithin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
lefwLayerRoutingMinsize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
lefwLayerRoutingMinstep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
lefwLayerRoutingMinstepMaxEdges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
lefwLayerRoutingMinstepWithOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
lefwLayerRoutingMinwidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
lefwLayerRoutingOffset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
lefwLayerRoutingOffsetXYDistance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
lefwLayerRoutingPitch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
lefwLayerRoutingPitchXYDistance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
lefwLayerRoutingProtrusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
lefwLayerRoutingResistance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
lefwLayerRoutingShrinkage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
lefwLayerRoutingSpacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
lefwLayerRoutingSpacingEndOfLine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
lefwLayerRoutingSpacingEOLParallel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
lefwLayerRoutingSpacingEndOfNotchWidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
lefwLayerRoutingSpacingLengthThreshold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
lefwLayerRoutingSpacingNotchLength . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
lefwLayerRoutingSpacingRange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
lefwLayerRoutingSpacingRangeInfluence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
lefwLayerRoutingSpacingRangeRange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
lefwLayerRoutingSpacingRangeUseLengthThreshold . . . . . . . . . . . . . . . . . . . . . . . 176
lefwLayerRoutingSpacingSameNet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
lefwLayerRoutingStartSpacingtableInfluence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
lefwLayerRoutingStartSpacingInfluenceWidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
lefwLayerRoutingStartSpacingtableParallel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
lefwLayerRoutingStartSpacingtableParallelWidth . . . . . . . . . . . . . . . . . . . . . . . . . . 178
lefwLayerRoutingStartSpacingtableTwoWidths . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
lefwLayerRoutingStartSpacingtableTwoWidthsWidth . . . . . . . . . . . . . . . . . . . . . . . . 179
lefwLayerRoutingEndSpacingtable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
lefwLayerRoutingThickness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
lefwLayerRoutingWireExtension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
lefwMaxAdjacentSlotSpacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
lefwMaxCoaxialSlotSpacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
lefwMaxEdgeSlotSpacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
lefwMaximumDensity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
lefwMinimumDensity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
lefwSlotLength . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
lefwSlotWidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
lefwSlotWireLength . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
lefwSlotWireWidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
lefwSplitWireWidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Routing Layer Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
lefwStartMacro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
lefwEndMacro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
lefwMacroClass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
lefwMacroEEQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
lefwMacroForeign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
lefwMacroForeignStr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
lefwMacroOrigin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
lefwMacroSite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
lefwMacroSitePattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
lefwMacroSitePatternStr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
lefwMacroSize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
lefwMacroSymmetry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
lefwStartMacroDensity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
lefwMacroDensityLayerRect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
lefwEndMacroDensity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Macro Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Macro Obstruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
lefwStartMacroObs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
lefwEndMacroObs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
lefwMacroObsDesignRuleWidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
lefwMacroObsLayer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
lefwMacroObsLayerPath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
lefwMacroObsLayerPolygon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
lefwMacroObsLayerRect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
lefwMacroObsLayerWidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
lefwMacroObsVia . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
Macro Obstruction Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Macro Pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
lefwStartMacroPin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
lefwEndMacroPin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
lefwMacroPinAntennaDiffArea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
lefwMacroPinAntennaGateArea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
lefwMacroPinAntennaMaxAreaCar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
lefwMacroPinAntennaMaxCutCar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
lefwMacroPinAntennaMaxSideAreaCar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
lefwMacroPinAntennaModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
lefwMacroPinAntennaPartialCutArea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
lefwMacroPinAntennaPartialMetalArea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
lefwMacroPinAntennaPartialMetalSideArea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
lefwMacroPinDirection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
lefwMacroPinGroundSensitivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
lefwMacroPinMustjoin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
lefwMacroPinNetExpr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
lefwMacroPinShape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
lefwMacroPinSupplySensitivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
lefwMacroPinTaperRule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
lefwMacroPinUse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
Macro Pin Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
lefwStringPropDef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
Property Definitions Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
Same-Net Spacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
lefwStartSpacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
lefwEndSpacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
lefwSpacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Same-Net Spacing Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
Site . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
lefwSite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
lefwEndSite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
lefwSiteRowPattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
lefwSiteRowPatternStr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
Site Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
lefwStartUnits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
lefwEndUnits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
lefwUnits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
lefwUnitsFrequency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Units Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Use Min Spacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
lefwUseMinSpacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
lefwVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
Version Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Via . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
lefwStartVia . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
lefwEndVia . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
lefwViaLayer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
lefwViaLayerPolygon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
lefwViaLayerRect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
lefwViaResistance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
lefwViaViarule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
lefwViaViaruleOffset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
lefwViaViaruleOrigin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
lefwViaViarulePattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
lefwViaViaruleRowCol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
7
LEF Compressed File Routines. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
lefGZipOpen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
lefGZipClose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
8
LEF File Comparison Utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
lefdefdiff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
A
LEF Reader and Writer Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
LEF Reader Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
LEF Writer Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
Preface
This document describes the C and C++ programming interface used to read and write
Cadence® Library Exchange Format (LEF) files. You should be an experienced C++ or C
programmer and be familiar with LEF file structure to read this manual.
What’s New
For information on what is new or changed in the LEF programming interface for version 5.8,
see What’s New in LEF C/C++ Programming Interface.
For information on what is new or changed in the DEF programming interface for version 5.8,
see What’s New in DEF C/C++ Programming Interface.
For information on what is new or changed in LEF and DEF for version 5.8, see What’s New
in LEF/DEF.
Related Documents
The LEF C/C++ programming interface lets you create programs that read and write LEF files.
For more information about the Design Exchange Format (DEF) file syntax, see the
LEF/DEF Language Reference.
text
Words in monospace type indicate keywords that you must enter literally. These
keywords represent language tokens.
variable
Words in italics indicate user-defined information for which you must substitute a
name or a value.
int
Specifies an integer argument
num
Some LEF classes can be defined more than once. A statement that begins with the
identifier num represents a specific number of calls to the particular class type.
{ }
Braces enclose each entire LEF class definition.
|
Vertical bars separate possible choices for a single argument. They take precedence
over any other character.
[ ]
Brackets denote optional arguments. When used with vertical bars, they enclose a list of
choices from which you can choose one.
4/12/17
1
Introduction
Overview
This manual describes the application programming interface (API) routines for the following
Cadence® Library Exchange Format (LEF) components:
■ LEF reader
■ LEF writer
Cadence Design Systems, Inc. uses these routines internally with many tools that read and
write LEF. The API supports LEF version 5.8, but also reads earlier versions of LEF.
You can use the API routines documented in this manual with tools that write these older
versions, as long as none of the tools in an interdependent flow introduce newer constructs.
Note: The writer portion of the API does not always optimize the LEF output.
settings and initialize the parser callbacks any time. The properties once defined in
PROPERTYDEFINITIONS sections will be also defined in all subsequent file reads.
■ Session-based mode - This mode introduces the concept of the parsing session. In this
mode, the order of calling parsing configuration and processing API is strict:
b. Parser configuration: Call multiple callback setters and parsing parameters setting
functions.
c. Data processing: - Do one or multiple parsing of LEF files with the lefrRead()
function.
By default, the LEF parser works in the compatibility mode. To activate the session-based
mode, you must use lefrInitSession() instead of lefrInit().
Note: Currently, the compatibility mode can be used in all old applications where the code
has not been adjusted. The lef2oa translator has already been adjusted to use the session-
based parsing mode.
Comparison Utility
The LEF file comparison utility, lefdefdiff, helps you verify that your usage of the API is
consistent and complete. This utility reads two LEF files, generally an initial file and the
resulting file from reading in an application, then writes out a LEF file. The comparison utility
reads and writes the data so that the UNIX diff utility can be used to compare the files.
Because the LEF file comparison utility works incrementally (writing out as it operates), the
size of files it can process has no limitations. However, large files can have performance
restrictions. In general, this utility is intended only to verify the use of the API; that is, the utility
is not a component of a production design flow.
A zlib compression library is also required in order to read compressed LEF files. The zlib
source code is free software that can be downloaded from [Link].
For information on compressed file routines, see “LEF Compressed File Routines.”
Orientation Codes
Orientation codes are used throughout the LEF reader routines. The orientation codes are
the same for all routines.
N W S E
FN FW FS FE
orient 0 = N orient 4 = FN
orient 1 = W orient 5 = FW
orient 2 = S orient 6 = FS
orient 3 = E orient 7 = FE
Note: The location given is the lower left corner of the resulting site or component after the
mirroring and rotation are applied. It is not the location of the origin of the child cell.
2
LEF Reader Setup and Control Routines
The Cadence® Library Exchange Format (LEF) reader provides several routines to initialize
the reader and set global variables that are used by the reader.
2. Call the callback registration routines for those constructs your application uses.
3. Call any additional setup and control routines required to prepare for reading the LEF file.
4. Call the lefrRead() routine to start reading the LEF file.
As each construct in the LEF file is read, the reader calls the appropriate registered callbacks.
These callbacks handle storing the associated data in a format appropriate for the
application. The callbacks can call additional setup and control routines for the LEF reader as
required.
For examples of API routine usage, see Appendix A, “LEF Reader and Writer Examples.”
lefrInit
Initializes internal variables in the LEF reader. You must use this routine before using
lefrRead. You can use routines to set callback functions before or after this routine.
Syntax
int lefrInit()
lefrInitSession
Starts a new parsing session and closes any old parsing session, if open. You must use this
routine before using lefrRead.
Syntax
int lefrInitSession(
int startSession = 1)
Arguments
startSession
Boolean. If is non-zero, performs the parser initialization in session-based mode;
otherwise, the function will initialize the parsing in the compatibility mode, working exactly
as lefrInit() call.
lefrClear
Releases all parsing session data and closes the parsing session. if the call to lefrClear()
is skipped, the data cleaning and the session closing is done by the next
lefrInitSession() call.
Syntax
int lefrClear()
lefrGetUserData
Retrieves the user-provided data. The LEF reader returns an opaque lefiUserData
pointer, which you set using lefrSetUserData. You can set or change the user data at any
time with the lefrSetUserData and lefrGetUserData calls. Every callback returns the
user data as the third argument.
Syntax
lefiUserData lefrGetUserData()
lefrPrintUnusedCallbacks
Prints all callback routines that are not set but have constructs in the LEF file.
Syntax
void lefrPrintUnusedCallbacks(FILE* f)
lefrRead
Specifies the LEF file to read. If the file parses with no errors (that is, all callbacks return
condition codes that indicate success), this routine returns a value of 0.
Syntax
int lefrRead(
FILE* file,
const char* fileName,
lefiUserData* data)
Arguments
file
Specifies a pointer to an already open file. This allows the parser to work with either a
disk file or a piped stream. This argument is required. Any callbacks that have been set
will be called from within this routine.
fileName
Specifies a UNIX filename using either a complete or a relative path specification.
data
Specifies the data type. For information about the lefiUserData type, see
“lefiUserData” on page 89.
lefrRegisterLef58Type
Registers new LEF layers LEF58_TYPE – TYPE pairs. As LEF syntax requires that any layer
LEF58_TYPE can be used only for certain layer types, you have to set a number of allowed
layer LEF58_TYPE – TYPE pairs, calling the function several times (if necessary). For
example, to register a new LEF58_TYPE XXX for the CUT and ROUTING type layers, you have
to call the API twice:
lefrRegisterLef58Type(‘XXX’, ‘CUT’);
lefrRegisterLef58Type(‘XXX’, ‘ROUTING’);
Use this feature only for the development of new ‘experimental’ types, which can now be
introduced without parser code update. All types mentioned in LEF documentation are
already pre-set and do not require to be registered.
Syntax
void lefrRegisterLef58Type(
const char* lef58Type,
const char* layerType);
Arguments
lef58Type
Specifies the LEF layer lef58Type.
layerType
Specifies the LEF layer type.
lefrReset
Resets all of the internal variables of the LEF reader to their initial values.
Syntax
int lefrReset(void)
lefrSetCommentChar
Changes the character used to indicate comments in the LEF file.
Syntax
void lefrSetCommentChar(char c)
c
Specifies the comment character. The default character is a pound sign (#).
lefrSetRegisterUnusedCallbacks
Keeps track of all the callback routines that are not set. You can use this routine to keep track
of LEF constructs that are in the input file but do not trigger a callback. This statement does
not require any additional arguments.
Syntax
void lefrSetRegisterUnusedCallbacks(void)
lefrSetShiftCase
Allows the parser to upshift all names if the LEF file is case insensitive.
Syntax
void lefrSetShiftCase(void)
lefrSetUserData
Sets the user-provided data. The LEF reader does not look at this data, but passes an opaque
lefiUserData pointer back to the application with each callback. You can set or change the
user data at any time using the lefrSetUserData and lefrGetUserData routines. Every
callback returns the user data as the third argument.
Syntax
void lefrSetUserData(
lefiUserData* data)
Arguments
data
Specifies the user-provided data.
lefrSetVersionValue
Sets a default version number for a LEF file that does not conrtain a VERSION statement.
Syntax
void lefrSetVersionValue(
char* version)
Arguments
version
Specifies the version number to assign to the LEF file.
Examples
The following example shows how to initialize the reader.
int setupRoutine() {
FILE* f;
int res;
int userData = 0x01020304;
...
3
LEF Reader Callback Routines
The Cadence® Library Exchange Format (LEF) reader calls all callback routines when it
reads in the appropriate part of the LEF file. Some routines, such as the version callback, are
called only once. Other routines can be called more than once.
Callback Type
The callBackType argument is a list of objects that contains a unique number assignment
for each callback from the [Link] list allows you to use the same callback routine for
different types of LEF data. For examples, see Appendix A, “LEF Reader and Writer
Examples.”
LEF_Data
The LEF_data argument provides the data specified by the callback. Data types returned by
the callbacks vary for each callback. Examples of the types of arguments passed include
const char*, double, int, and defiProp. Two points to note:
■ The data returned in the callback is not checked for validity.
■ If you want to keep the data, you must make a copy of it.
User Data
The data argument is a four-byte data item that is set by the user. The LEF reader contains
only user data. The user data is most often set to a pointer to the library data so that it can be
passed to the routines. This is more effective than using a global variable.
The callback functions can be set or reset at any time. If you want a callback to be available
when the LEF file parsing begins, you must set the callback before you call lefrRead.
Note: You can unset a callback by using the set function with a null argument.
The following table lists the LEF reader callback setting routines and the associated callback
types. The contents of the setting routines are described in detail in the section “User Callback
Routines” on page 36.
LEF
Setting Routine Callback Type
Information
Bus Bit void lefrSetBusBitCharsCbk lefrBusBitCharsCbkType
Characters (lefrStringCbkFnType);
Clearance void lefrClearanceMeasureCbkTy
Measure lefrSetClearanceMeasureCbk pe
(lefrStringCbkFnType);
Density void lefrSetDensityCbk lefrDensityCbkType
(lefrDensityCbkFnType)
LEF
Setting Routine Callback Type
Information
Divider void lefrSetDividerCharCbk lefrDividerCharCbkType
Character (lefrStringCbkFnType);
Extensions void lefrSetExtensionCbk lefrExtensionCbkType
(lefrStringCbkFnType)
Fixed Mask void lefrFixedMaskCbk lefrFixedMaskCbkType
(lefrIntergerCbkFnType)
Library End void lefrSetLibraryEndCbk lefrLibraryEndCbkType
Statement (lefrVoidCbkFnType);
Layer void lefrSetLayerCbk lefrLayerCbkType
(lefrLayerCbkFnType);
Macro void lefrSetMacroBeginCbk lefrMacroBeginCbkType
Beginning (lefrStringCbkFnType);
Macro void lefrSetMacroCbk lefrMacroCbkType
(lefrMacroCbkFnType);
Macro Class void lefrSetMacroClassTypeCbk lefrMacroClassTypeCbkType
Type (lefrStringCbkFnType);
Macro End void lefrSetMacroEnd lefrMacroEndCbkType
(lefrStringCbkFnType) ;
Macro Fixed void lefrMacroFixedMaskCbk lefrMacroFixedMaskCbkType
Mask (lefrIntergerCbkFnType)
Macro Foreign void lefrSetMacroForeignCbk lefrMacroForeignCbkFnType
(lefrMacroForeignCbkFnType);
void
lefrUnsetMacroForeignCbk();
Macro Origin void lefrSetMacroOriginCbk lefrMacroOriginCbkType
(lefrMacroNumCbkFnType) ;
Macro void lefrSetObstructionCbk lefrObstructionCbkType
Obstruction (lefrObstructionCbkFnType);
Macro Pin void lefrSetPinCbk lefrPinCbkType
(lefrPinCbkFnType);
LEF
Setting Routine Callback Type
Information
Macro Site void lefrSetMacroSiteCbk lefrMacroSiteCbkFnType
(lefrMacroSiteCbkFnType);
void lefrUnsetMacroSiteCbk();
Macro Size void lefrSetMacroSizeCbk lefrMacroSizeCbkType
(lefrMacroNumCbkFnType) ;
Manufacturing void lefrSetManufacturingCbk lefrManufacturingCbkType
Grid (lefrDoubleCbkFnType);
Maximum Via void lefrSetMaxStackViaCbk lefrMaxStackViaCbkType
Stack (lefrMaxStackViaCbkFnType) ;
Nondefault void lefrSetNonDefaultCbk lefrNonDefaultCbkType
Rules (lefrNonDefaultCbkFnType);
Property void lefrSetPropBeginCbk lefrPropBeginCbkType
Definitions (lefrVoidCbkFnType);
Beginning
Property void lefrSetPropCbk lefrPropCbkType
Definitions (lefrPropCbkFnType);
Property void lefrSetPropEndCbk lefrPropEndCbkType
Definitions (lefrVoidCbkFnType);
End
Same-Net void lefrSetSpacingBeginCbk lefrSpacingBeginCbkType
Spacing (lefrVoidCbkFnType);
Beginning
Same-Net void lefrSetSpacingCbk lefrSpacingCbkType
Spacing (lefrSpacingCbkFnType);
Same-Net void lefrSetSpacingEndCbk lefrSpacingEndCbkType
Spacing (lefrVoidCbkFnType);
End
Site void lefrSetSiteCbk lefrSiteCbkType
(lefrSiteCbkFnType);
Units void lefrSetUnitsCbk lefrUnitsCbkType
(lefrUnitsCbkFnType);
Use Min void lefrSetUseMinSpacingCbk lefrUseMinSpacingCbkType
Spacing (lefrUseMinSpacingCbkFnType);
LEF
Setting Routine Callback Type
Information
Version void lefrSetVersionCbk lefrVersionCbkType
(lefrDoubleCbkFnType);
Version void lefrSetVersionStrCbk lefrVersionStrCbkType
String (lefrStringCbkFnType);
Via void lefrSetViaCbk lefrViaCbkType
(lefrViaCbkFnType);
Via Rule void lefrSetViaRuleCbk lefrViaRuleCbkType
(lefrViaRuleCbkFnType);
Unused void lefrSetUnusedCallbacks lefrUnspecifiedCbkType
(lefrVoidCbkFnType func);
Examples
The following example shows how to create a setup routine so the reader can parse the LEF
file and call the callback routines you defined.
int setupRoutine() {
FILE* f;
int res;
int userData = 0x01020304;
...
■ lefrViaCbkFnType on page 51
■ lefrViaRuleCbkFnType on page 52
■ lefrVoidCbkFnType on page 52
lefrDensityCbkFnType
Retrieves data from the DENSITY object from within the MACRO object. Use the arguments
defined in the lefiDensity class to retrieve the data.
For syntax information about the LEF MACRO statement, see "Macro" in the LEF/DEF
Language Reference.
Syntax
int lefrDensityCbkFnType(
lefrCallbackType_e typ
lefiDensity* density
lefiUserData* data)
Arguments
typ
Returns the lefrDensityCbkType type. This allows you to verify within your program
that this is a correct callback.
lefiDensity
Returns a pointer to a lefiDensity structure. For more information, see “lefiDensity”
on page 68.
data
Returns four bytes of user-defined data. User data is set most often to a pointer to the
design data.
lefrDoubleCbkFnType
Retrieves different kinds of LEF data. The format of the data returned is always the same, but
the actual data represented varies depending on the calling routine.
For more information about LEF syntax, see the LEF/DEF Language Reference.
Syntax
int lefrDoubleCbkFnType(
lefrCallbackType_e typ,
double number,
lefiUserData* data)
Arguments
typ
Returns a type that varies depending on the callback routine used. The following types
can be returned.
number
Returns data that varies depending on the callback used. The following kinds of data can
be returned.
data
Returns four bytes of user-defined data. User data is set most often to a pointer to the
design data.
lefrIntergerCbkFnType
Retrieves LEF data pertaining to fixed masks. The format of the data returned is always the
same, but the actual data represented varies depending on the calling routine.
For more information about the FIXEDMASK statement, see "FIXEDMASK" in the LEF/DEF
Language Reference.
Syntax
int lefrIntergerCbkFnType
leftCallbackType_e type,
int number,
lefiUserData* data)
Arguments
type
Returns a type that varies depending on the callback routine used. The following types
can be returned.
number
Returns a type that varies depending on the callback used. The following kind of data
can be returned.
Fixed mask: Does not allow mask shifting. All the LEF MACRO PIN MASK assignments
must be kept fixed and cannot be shifted to a different mask, (1indicates not allowed, and
0 allowed).
Macro FixedMask: Indicates that the specified macro does not allow mask shifting. All
the LEF PIN MASK assignments must be kept fixed and cannot be shifted to a different
mask. (1 indicates not allowed, and 0 allowed).
data
Returns four bytes of user-defined data. User data is set most often to a pointer to the
design data.
lefrLayerCbkFnType
Retrieves data from the LAYER object of the LEF file. Use the arguments defined in the
lefiLayer class to retrieve the data.
For syntax information about the LEF LAYER statement, see "Layer (Cut)," "Layer
(Masterslice or Overlap)," "Layer (Routing)," or "Layer (Implant)" in the LEF/DEF Language
Reference.
Syntax
int lefrLayerCbkFnType(
lefrCallbackType_e typ,
lefiLayer* layer,
lefiUserData* data)
Arguments
typ
Returns the lefrLayerCbkType type. This allows you to verify within your program that
this is a correct callback.
layer
Returns a pointer to a lefiLayer structure. For more information, see “lefiLayer” on
page 61.
data
Returns four bytes of user-defined data. User data is set most often to a pointer to the
design data.
lefrMacroCbkFnType
Retrieves data from the MACRO object in the LEF file. Use the arguments defined in the
lefiMacro class to retrieve the data.
For syntax information about the LEF MACRO statement, see "Macro" in the LEF/DEF
Language Reference.
Syntax
int lefrMacroCbkFnType(
lefrCallbackType_e typ,
lefiMacro* macro,
lefiUserData* data)
Arguments
typ
Returns the lefrMacroCbkType type. This allows you to verify within your program that
this is a correct callback.
macro
Returns a pointer to a lefiMacro structure. For more information, see “lefiMacro” on
page 69.
data
Returns four bytes of user-defined data. User data is set most often to a pointer to the
design data.
lefrMacroForeignCbkFnType
Retrieves data for in-place processing of a MACRO FOREIGN statement. Use the arguments
defined in the lefiMacroForeign class to retrieve the data.
For syntax information about the LEF MACRO FOREIGN statement, see "Macro" in the LEF/
DEF Language Reference.
Syntax
int lefrMacroForeignCbkFnType(
lefrCallbackType_e typ,
lefiMacroForeign* foreign,
lefiUserData* data)
Arguments
typ
Returns the lefrMacroForeignCbkType type. This allows you to verify within your
program that this is a correct callback.
foreign
Returns a pointer to a lefiMacroForeign structure. For more information, see
lefiMacroForeign on page 70.
data
Returns four bytes of user-defined data. User data is set most often to a pointer to the
design data.
lefrMacroNumCbkFnType
Retrieves different kinds of Macro LEF data. The format of the data returned is always the
same, but the actual data represented varies depending on the calling routine.
For syntax information about the LEF MACRO statement, see "Macro" in the LEF/DEF
Language Reference.
Syntax
int lefrMacroNumCbkFnType(
lefrCallbackType_e typ,
lefiNum num,
lefiUserData* data)
Arguments
typ
Returns a type that varies depending on the callback routine used. The following types
can be returned.
num
Returns data that varies depending on the callback used. The following kinds of data can
be returned.
data
Returns four bytes of user-defined data. User data is set most often to a pointer to the
design data.
lefrMacroSiteCbkFnType
Retrieves data for in-place processing of a MACRO SITE statement. Use the arguments
defined in the lefiMacroSite class to retrieve the data.
For syntax information about the LEF MACRO FOREIGN statement, see "Macro" in the LEF/
DEF Language Reference.
Syntax
int lefrMacroSiteCbkFnType(
lefrCallbackType_e typ,
lefiMacroSite* site,
lefiUserData* data)
Arguments
typ
Returns the lefrMacroSiteCbkType type. This allows you to verify within your
program that this is a correct callback.
site
Returns a pointer to a lefiMacroSite structure. For more information, see
lefiMacroSite on page 71.
data
Returns four bytes of user-defined data. User data is set most often to a pointer to the
design data.
lefrMaxStackViaCbkFnType
Retrieves data from the MAXVIASTACK object in the LEF file. Use the arguments defined in
the lefiMaxStackVia class to retrieve the data.
For syntax information about the LEF NONDEFAULTRULE statement, see “Maximum Via
Stack” in the LEF/DEF Language Reference.
Syntax
lefrMaxStackViaCbkFnType(
lefrCallbackType_e typ,
lefiMaxStackVia* maxStack,
lefiUserData data)
Arguments
typ
Returns the lefrMaxStackViaCbkType type. This allows you to verify within your
program that this is a correct callback.
maxStack
Returns a pointer to a lefiMaxStackVia structure. For more information, see
“lefiMaxStackVia” on page 88.
data
Returns four bytes of user-defined data. User data is set most often to a pointer to the
design data.
lefrNonDefaultCbkFnType
Retrieves data from the NONDEFAULTRULE object in the LEF file. Use the arguments defined
in the lefiNonDefault class to retrieve the data.
For syntax information about the LEF NONDEFAULTRULE statement, see "Nondefault Rule"
in the LEF/DEF Language Reference.
Syntax
lefrNonDefaultCbkFnType(
lefrCallbackType_e typ,
lefiNonDefault* def,
lefiUserData* data)
Arguments
typ
Returns the lefrNonDefaultCbkType type. This allows you to verify within your
program that this is a correct callback.
def
Returns a pointer to a lefiNonDefault structure. For more information, see
“lefiNonDefault” on page 89.
data
Returns four bytes of user-defined data. User data is set most often to a pointer to the
design data.
lefrObstructionCbkFnType
Retrieves data from the OBS (macro obstruction) object within the MACRO object in the LEF
file. Use the arguments defined in the lefiObstruction class to retrieve the data.
For syntax information about the LEF OBS statement, see "Macro Obstruction Statement" in
the LEF/DEF Language Reference.
Syntax
int lefrObstructionCbkFnType(
lefrCallbackType_e typ,
lefiObstruction* obs,
lefiUserData* data)
Arguments
typ
Returns the lefrObstructionCbkType type. This allows you to verify within your
program that this is a correct callback.
obs
Returns a pointer to a lefiObstruction structure. For more information, see
“lefiObstruction” on page 74.
data
Returns four bytes of user-defined data. User data is set most often to a pointer to the
design data.
lefrPinCbkFnType
Retrieves data from the PIN object within the MACRO object in the LEF file. Use the arguments
defined in the lefiPin class to retrieve the data.
For syntax information about the LEF PIN statement, see "Macro Pin Statement" in the LEF/
DEF Language Reference.
Syntax
int lefrPinCbkFnType(
lefrCallbackType_e typ,
lefiPin* pin,
lefiUserData* data)
Arguments
typ
Returns the lefrPinCbkType type. This allows you to verify within your program that
this is a correct callback.
pin
Returns a pointer to a lefiPin structure. For more information, see “lefiPin” on
page 77.
data
Returns four bytes of user-defined data. User data is set most often to a pointer to the
design data.
lefrPropCbkFnType
Retrieves data from the PROPERTYDEFINITIONS object in the LEF file. Use the arguments
defined in the lefiProp class to retrieve the data.
For syntax information about the LEF PROPERTYDEFINITIONS statement, see "Property
Definitions" in the LEF/DEF Language Reference.
Syntax
lefrPropCbkFnType(
lefrCallbackType_e typ,
lefiProp* prop,
lefiUserData* data)
Arguments
typ
Returns the lefrPropCbkType type. This allows you to verify within your program that
this is a correct callback.
prop
Returns a pointer to a lefiProp structure. For more information, see “lefiProp” on
page 91.
data
Returns four bytes of user-defined data. User data is set most often to a pointer to the
design data.
lefrSiteCbkFnType
Retrieves data from the SITE object in the LEF file. Use the arguments defined in the
lefiSite class to retrieve the data.
For syntax information about the LEF SITE statement, see "Site" in the LEF/DEF Language
Reference.
Syntax
int lefrSiteCbkFnType(
lefrCallbackType_e typ,
lefiSite* site,
lefiUserData* data)
Arguments
typ
Returns the lefrSiteCbkType type. This allows you to verify within your program that
this is a correct callback.
site
Returns a pointer to a lefiSite structure. For more information, see “lefiSite” on
page 95.
data
Returns four bytes of user-defined data. User data is set most often to a pointer to the
design data.
lefrSpacingCbkFnType
Retrieves data from the SPACING object of the LEF file. Use the arguments defined in the
lefiSpacing class to retrieve the data.
For syntax information about the LEF SPACING statement, see "Samenet Spacing" in the
LEF/DEF Language Reference.
Syntax
int lefrSpacingCbkFnType(
lefrCallbackType_e typ,
lefiSpacing* spacing,
lefiUserData* data)
Arguments
typ
Returns the lefrSpacingCbkType type. This allows you to verify within your program
that this is a correct callback.
spacing
Returns a pointer to a lefiSpacing structure. For more information, see “lefiSpacing”
on page 94.
data
Returns four bytes of user-defined data. User data is set most often to a pointer to the
design data.
lefrStringCbkFnType
Retrieves different kinds of LEF data. The format of the data returned is always the same, but
the actual data represented varies depending on the calling routine.
For more information about LEF syntax, see the LEF/DEF Language Reference.
Syntax
int lefrStringCbkFnType(
lefrCallbackType_e typ,
const char* string,
lefiUserData* data)
Arguments
typ
Returns a type that varies depending on the callback routine used. The following types
can be returned.
string
Returns data that varies depending on the callback used. The following kinds of data can
be returned.
data
Returns four bytes of user-defined data. User data is set most often to a pointer to the
design data.
lefrUnitsCbkFnType
Retrieves data from the UNITS object in the LEF file. Use the arguments defined in the
lefiUnits class to retrieve the data.
For syntax information about the LEF UNITS statement, see "Units" in the LEF/DEF
Language Reference.
Syntax
int lefrUnitsCbkFnType(
lefrCallbackType_e typ,
lefiUnits* units,
lefiUserData* data)
Arguments
typ
Returns the lefrUnitsCbkType type. This allows you to verify within your program that
this is a correct callback.
units
Returns a pointer to a lefiUnits structure. For more information, see “lefiUnits” on
page 97.
data
Returns four bytes of user-defined data. User data is set most often to a pointer to the
design data.
lefrUseMinSpacingCbkFnType
Retrieves data from the USEMINSPACING object in the LEF file. Use the arguments defined
in the lefiUseMinSpacing class to retrieve data.
For information about the LEF USEMINSPACING statement, see "Use Min Spacing" in the
LEF/DEF Language Reference.
Syntax
int lefrUseMinSpacingCbkFnType(
lefrCallbackType_e typ,
lefiUseMinSpacing* spacing,
lefiUserData* data)
Arguments
typ
Returns the lefrUseMinSpacingCbkFnType type. This allows you to verify within
your program that this is a correct callback.
spacing
Returns a pointer to a lefiUseMinSpacing structure. For more information, see
“lefiUseMinSpacing” on page 99
data
Returns four bytes of user-defined data. User data is set most often to a pointer to the
design data.
lefrViaCbkFnType
Retrieves data from the VIA object in the LEF file. Use the arguments defined in the lefiVia
class to retrieve the data.
For syntax information about the LEF VIA statement, see "Via" in the LEF/DEF Language
Reference.
Syntax
int lefrViaCbkFnType(
lefrCallbackType_e typ,
lefiVia* via,
lefiUserData* data)
Arguments
typ
Returns the lefrViaCbkType type. This allows you to verify within your program that
this is a correct callback.
via
Returns a pointer to a lefiVia structure. For more information, see “lefiVia” on
page 99.
data
Returns four bytes of user-defined data. User data is set most often to a pointer to the
design data.
lefrViaRuleCbkFnType
Retrieves data from the VIARULE object in the LEF file. Use the arguments defined in the
lefiViaRule class to retrieve the data.
For syntax information about the LEF VIARULE statement, see "Via Rule" in the LEF/DEF
Language Reference.
Syntax
int lefrViaRuleCbkFnType(
lefrCallbackType_e typ,
lefiViaRule* viaRule,
lefiUserData* data)
Arguments
typ
Returns the lefrViaRuleCbkType type. This allows you to verify within your program
that this is a correct callback.
viaRule
Returns a pointer to a lefiViaRule structure. For more information, see “lefiViaRule”
on page 103.
data
Returns four bytes of user-defined data. User data is set most often to a pointer to the
design data.
lefrVoidCbkFnType
Marks the beginning and end of LEF objects. The format of the data returned is always the
same, but the actual data represented varies depending on the calling routine.
For more information about LEF syntax, see the LEF/DEF Language Reference.
Syntax
int lefrVoidCbkFnType(
lefrCallbackType_e typ,
void* ptr,
lefiUserData* data)
Arguments
typ
Returns a type that varies depending on the callback routine used. The following types
can be returned.
ptr
Returns nothing. (This is a placeholder value to meet the required three arguments for
each routine).
data
Returns four bytes of user-defined data. User data is set most often to a pointer to the
design data.
Examples
The following example shows a callback routine using lefrCallbackType_e, char*, and
lefiUserData.
int macroBeginCB (lefrCallbackType_e type,
const char *macroName,
lefiUserData userData) {
printf("IRDROP END\n");
return 0;}
4
LEF Reader Classes
Introduction
Every statement in the Cadence® Library Exchange Format (LEF) file is associated with a
LEF reader class. When the LEF reader uses a callback, it passes a pointer to the appropriate
class. You can use the member functions in each class to retrieve data defined in the LEF file.
For a list of the LEF Reader Classes that correspond to LEF file syntax, see “LEF Reader
Classes” on page 58.
Important
Returned data is not static. If you want to keep the data, you must copy it.
You can use a for loop from 0 to the number of items specified in the index. In the loop,
retrieve the data from the subsequent arrays. For example:
for (i = 0; i < layer->lefiLayer::numMinstep(); i++) {
fprintf(fout, " MINSTEP %g ", layer->lefiLayer::minstep(i));
if (layer->lefiLayer::hasMinstepType(i))
fprintf(fout, "%s ", layer->lefiLayer::minstepType(i));
if (layer->lefiLayer::hasMinstepLengthsum(i))
fprintf(fout, "LENGTHSUM %g ",
layer->lefiLayer::minstepLengthsum(i));
fprintf(fout, ";\n");
}
The following examples show the same statements in C and C++ syntax.
C++ Syntax
class lefiSite {
const char* name() const;
int hasClass() const;
const char* siteClass() const;
double sizeX() const;
double sizeY() const;
int numSites() const;
char* siteName(int index) const;
int siteOrient(int index) const;
char* siteOrientStr(int index) const;
};
C Syntax
const char * lefiSite_name
( const lefiSite * this );
int lefiSite_hasClass
( const lefiSite * this );
const char * lefiSite_siteClass
( const lefiSite * this );
double lefiSite_sizeX
( const lefiSite * this );
double lefiSite_sizeY
( const lefiSite * this );
int lefiSite_numSites
( const lefiSite * this );
char * lefiSite_siteName
( const lefiSite * this, int index );
int lefiSite_siteOrient
( const lefiSite * this, int index );
char * lefiSite_siteOrientStr
( const lefiSite * this, int index );
The C routine prototypes for the API functions can be found in the following files:
Layer Classes
The LEF LAYER routines include the following classes:
■ lefiAntennaModel on page 59
■ lefiAntennaPWL on page 60
■ lefiInfluence on page 61
■ lefiLayer on page 61
■ lefiLayerDensity on page 66
■ lefiOrthogonal on page 66
■ lefiParallel on page 67
■ lefiSpacingTable on page 67
■ lefiTwoWidths on page 68
lefiAntennaModel
Retrieves antenna model information from a LAYER section of the LEF file.
For syntax information about the LEF LAYER sections, see "Layer (Cut)," and "Layer
(Routing)" in the LEF/DEF Language Reference.
C++ Syntax
class lefiAntennaModel {
int hasAntennaAreaRatio() const;
int hasAntennaDiffAreaRatio() const;
int hasAntennaDiffAreaRatioPWL() const;
int hasAntennaCumAreaRatio() const;
int hasAntennaCumDiffAreaRatio() const
int hasAntennaCumDiffAreaRatioPWL() const;
int hasAntennaAreaFactor() const;
int hasAntennaAreaFactorDUO() const;
lefiAntennaPWL
Retrieves antenna Piece-wise Linear Format (PWL) data from a LAYER section of the LEF
file.
For syntax information about the LEF LAYER sections, see "Layer (Cut)," and "Layer
(Routing)" in the LEF/DEF Language Reference.
C++ Syntax
class lefiAntennaPWL {
int numPWL() const;
double PWLdiffusion(int index):
double PWLratio(int index); };
lefiInfluence
Retrieves influence rule information from a LAYER (Routing) section of the LEF file.
For syntax information about the LEF LAYER (Routing) section, see "Layer (Routing)" in the
LEF/DEF Language Reference.
C++ Syntax
class lefiInfluence {
int numInfluenceEntry() const;
double width(int index) const;
double distance(int index) const;
double spacing(int index) const; };
lefiLayer
Retrieves data from a LAYER section of the LEF file. This callback can be used for all layer
types (cut, masterslice, implant, and routing). However, most of these functions apply to
routing layers. Comments in the C++ syntax indicate those arguments that apply only to a
particular layer type. All other arguments apply to all layer types.
For syntax information about the LEF LAYER sections, see "Layer (Cut)," "Layer (Masterslice
or Overlap)," and "Layer (Routing)" in the LEF/DEF Language Reference.
C++ Syntax
class lefiLayer {
int hasType() const;
int hasPitch() const; // Routing
int hasXYPitch() const;
int hasOffset() const; // Routing
int hasXYOffset() const;
int hasWidth() const; // Routing
int hasArea() const;
int hasDiagPitch() const;
int hasXYDiagPitch() const;
int hasDiagWidth() const;
int hasDiagSpacing() const;
int hasSpacingNumber() const;
int hasSpacingName(int index) const;
int hasSpacingLayerStack(int index) const;
int hasSpacingAdjacent(int index) const;
int hasSpacingCenterToCenter(int index) const;
int hasSpacingRange(int index) const; // Routing
int hasSpacingRangeUseLengthThreshold(int index) const;
int numSpacingTable();
lefiSpacingTable* spacingTable(int index);
int hasMask() const; // Check the layer has color mask assigned or not.
int mask() const; }; // Return the color mask number of the layer.
lefiLayerDensity
Retrieves data from the LAYERDENSITY statement in a LAYER section of the LEF file.
For syntax information about the LEF LAYER sections, see "Layer (Cut)," and "Layer
(Routing)" in the LEF/DEF Language Reference.
C++ Syntax
class lefiLayerDensity {
char* type();
int hasOneEntry();
double oneEntry();
int numFrequency();
double frequency(int index);
int numWidths();
double width(int index);
int numTableEntries();
double tableEntry(int index);
int numCutareas();
double cutArea(int index); };
lefiOrthogonal
Retrieves orthogonal spacing information from a LAYER section of the LEF file.
For syntax information about the LEF LAYER sections, see "Layer (Cut) in the LEF/DEF
Language Reference.
C++ Syntax
class lefiOrthogonal {
int numOrthogonal() const;
double cutWithin(int index) const;
double orthoSpacing(int index) const; };
lefiParallel
Retrieves parallel run length information from a LAYER (Routing) section of the LEF file.
For syntax information about the LEF LAYER (Routing) section, see "Layer (Routing)" in the
LEF/DEF Language Reference.
C++ Syntax
class lefiParallel {
int numLength() const;
int numWidth() const;
double length(int iLength) const;
double width(int iWidth) const;
double widthSpacing(int iWidth, int iWidthSpacing) const; };
lefiSpacingTable
Retrieves spacing table information from a LAYER (Routing) section of the LEF file.
For syntax information about the LEF LAYER (Routing) section, see "Layer (Routing)" in the
LEF/DEF Language Reference.
C++ Syntax
class lefiSpacingTable {
int isInfluence() const;
lefiInfluence* influence() const;
int isParallel() const;
lefiParallel* parallel() const;
lefiTwoWidths* twoWidths() const; };
lefiTwoWidths
Retrieves two-width spacing information from a LAYER (Routing) section of the LEF file.
For syntax information about the LEF LAYER (Routing) section, see "Layer (Routing)" in the
LEF/DEF Language Reference.
C++ Syntax
class lefiTwoWidths {
int numWidth() const;
double width(int iWidth) const;
int hasWidthPRL(int iWidth) const;
double widthPRL(int iWidth) const;
int numWidthSpacing(int iWidth) const;
double widthSpacing(int iWidth, int iWidthSpacing) const; };
lefiDensity
Retrieves density information from the MACRO section of the LEF file.
For syntax information about the MACRO section, see "Macro" in the LEF/DEF Language
Reference.
C++ Syntax
class lefiDensity {
int numLayer() const;
char* layerName(int index) const;
lefiMacro
Retrieves data from the MACRO section of the LEF file.
For syntax information about the MACRO section, see "Macro" in the LEF/DEF Language
Reference.
C++ Syntax
class lefiMacro {
int hasClass() const;
int hasGenerator() const;
int hasGenerate() const;
int hasPower() const;
int hasOrigin() const;
int hasEEQ() const;
int hasLEQ() const;
int hasSource() const;
int hasXSymmetry() const;
int hasYSymmetry() const;
int has90Symmetry() const;
int hasSiteName() const;
int hasSitePattern() const;
int hasSize() const;
int hasForeign() const;
int hasForeignOrigin(int index = 0) const;
int hasForeignOrient(int index = 0) const;
int hasForeignPoint(int index = 0) const;
int hasClockType() const;
int isBuffer() const;
int isInverter() const;
int numSitePattern() const;
int numProperties() const;
const char* propName(int index) const;
const char* propValue(int index) const;
double propNum(int index) const;
const char propType(int index) const;
int propIsNumber(int index) const;
int propIsString(int index) const;
const char* name() const;
const char* macroClass() const;
const char* generator() const;
const char* EEQ() const;
lefiMacroForeign
Retrieves data for in-place processing of a MACRO FOREIGN statement.
C++ Syntax
class lefiMacroForeign {
public:
lefiMacroForeign(const char *name,
int hasPts,
double x,
double y,
int hasOrient,
int orient);
protected:
const char *cellName_;
int cellHasPts_;
double px_;
double py_;
int cellHasOrient_;
int cellOrient_;
};
lefiMacroSite
Retrieves data for in-place processing of a MACRO SITE statement.
C++ Syntax
class lefiMacroSite {
public:
lefiMacroSite(const char *name, const lefiSitePattern* pattern);
protected:
const char *siteName_;
const lefiSitePattern *sitePattern_;
};
lefiPoints
Returns the X and Y points for the ORIGIN and SIZE statements in the MACRO section.
C++ Syntax
struct lefiPoints {
double x;
double y; };
typedef struct lefiPoints lefiNum;
Macro Examples
The following example shows a callback routine with the type lefrMacroBeginCbkType,
and the class const char*.
int macroBeginCB (lefrCallbackType_e type,
const char *macroName,
lefiUserData userData) {
The following example shows a callback routine with the type lefrMacroCbkType, and the
class lefiMacro. This example only shows how to retrieve part of the data from the
lefiMacro class.
int macroCB (lefrCallbackType_e type,
lefiMacro *macroInfo,
lefiUserData userData) {
if (macroInfo->hasClass())
printf(" CLASS %s\n", macroInfo->macroClass());
if (macroInfo->hasXSymmetry()) {
printf(" SYMMETRY X ");
hasPrtSym = 1;
}
if (macroInfo->hasYSymmetry()) { // print X Y & R90 in one line
hasPrtSym = 1;
}
else // the line has already started
printf("Y ");
}
if (macroInfo->has90Symmetry()) {
if (!hasPrtSym) { // the line has not started yet
printf(" SYMMETRY R90 ");
hasPrtSym = 1;
}
else // the line has already started
printf("R90 ");
}
if (hasPrtSym) {
printf ("\n");
hasPrtSym = 0;
}
}
return 0;}
lefiObstruction
Retrieves data from the Macro Obstruction (OBS) statement in the MACRO section of the LEF
file. The Macro Obstruction statement defines sets of obstructions (blockages) on the macro.
For syntax information about the Macro Obstruction statement, see "Macro Obstruction
Statement" in the LEF/DEF Language Reference.
C++ Syntax
class lefiObstruction {
lefiGeometries* geometries() const;};
lefiGeometries* geometry;
int numItems;
int i, j;
lefiGeomPath* path;
lefiGeomPathIter* pathIter;
lefiGeomRect* rect;
lefiGeomRectIter* rectIter;
lefiGeomPolygon* polygon;
lefiGeomPolygonIter* polygonIter;
lefiGeomVia* via;
lefiGeomViaIter* viaIter;
terminate parsing.\n");
return 1;}
printf("OBS\n");
geometry = obs->geometries();
numItems = geometry->numItems();
case lefiGeomPolygonE:
polygon = geometry->getPolygon(i);
printf(" POLYGON");
for (j = 0; j < polygon->numPoints; j++)
printf(" ( %g %g )", polygon->x[j], polygon-
>y[j]);
printf("\n");
break;
case lefiGeomPolygonIterE:
polygonIter = geometry->getPolygonIter(i);
printf(" POLYGON ITERATE");
for (j = 0; j < polygonIter->numPoints; j++)
printf(" ( %g %g )", polygonIter->x[j],
polygonIter->y[j]);
printf("\n");
printf(" DO %g BY %g STEP %g %g\n",
polygonIter->xStart, polygonIter->yStart,
polygonIter->xStep, polygonIter->yStep);
break;
case lefiGeomViaE:
via = geometry->getVia(i);
printf(" VIA ( %g %g ) %s\n", via->x,
via->y, via->name);
break;
case lefiGeomViaIterE:
viaIter = geometry->getViaIter(i);
printf(" VIA ITERATE ( %g %g ) %s\n",
viaIter->x, viaIter->y, viaIter->name);
printf(" DO %g BY %g STEP %g %g\n",
viaIter->xStart, viaIter->yStart,
viaIter->xStep, viaIter->yStep);
break;
}
}
return 0; }
lefiPin
Retrieves data from the PIN statement in the MACRO section of the LEF file. MACRO PIN
statements are included in the LEF file for each macro.
For syntax information about the Macro Pin statement, see "Macro Pin Statement" in the
LEF/DEF Language Reference.
C++ Syntax
class lefiPin {
int hasForeign() const;
int hasForeignOrient(int index = 0) const;
int hasForeignPoint(int index = 0) const;
int hasLEQ() const;
int hasDirection() const;
int hasUse() const;
int hasShape() const;
int hasMustjoin() const;
int hasOutMargin() const;
int hasOutResistance() const;
int hasInMargin() const;
int hasPower() const;
int hasLeakage() const;
int hasMaxload() const;
int hasMaxdelay() const;
int hasCapacitance() const;
int hasResistance() const;
int hasPulldownres() const;
int hasTieoffr() const;
int hasVHI() const;
int hasVLO() const;
int hasRiseVoltage() const;
int hasFallVoltage() const;
int hasRiseThresh() const;
int hasFallThresh() const;
int hasRiseSatcur() const;
int hasFallSatcur() const;
int hasCurrentSource() const;
int hasTables() const;
int hasAntennaSize() const;
int hasAntennaMetalArea() const;
int hasAntennaMetalLength() const;
int hasAntennaPartialMetalArea() const;
int hasAntennaPartialMetalSideArea() const;
int hasAntennaPartialCutArea() const;
int hasAntennaDiffArea() const;
int hasAntennaModel() const;
int hasTaperRule() const;
lefiPinAntennaModel
Retrieves antenna model information from Macro Pin statement of the LEF file.
For syntax information about the Macro Pin statement, see "Macro Pin Statement" in the
LEF/DEF Language Reference.
C++ Syntax
class lefiAntennaModel {
int hasAntennaGateArea() const;
int hasAntennaMaxAreaCar() cons
int hasAntennaMaxSideAreaCar() const;
int hasAntennaMaxCutCar() const;
lefiGeometries
Retrieves data from the Macro Pin statement and from the Macro Obstruction statement in
the MACRO section of the LEF file. These statements specify the pin port and obstruction
geometries for the macro.
For syntax information about LEF geometries, see "Layer Geometries" in the LEF/DEF
Language Reference.
C++ Syntax
class lefiGeometries {
int numItems() const;
enum lefiGeomEnum itemType(int index) const;
struct lefiGeomRect* getRect(int index) const;
struct lefiGeomRectIter* getRectIter(int index) const;
struct lefiGeomPath* getPath(int index) const;
int colorMask;
};
lefiGeomEnum
Returns the type of geometry of a macro.
C++ Syntax
enum lefiGeomEnum {
lefiGeomunknown = 0,
lefiGeomLayerE,
lefiGeomLayerMinSpacingE,
lefiGeomLayerRuleWidthE,
lefiGeomWidthE,
lefiGeomPathE,
lefiGeomPathIterE,
lefiGeomRectE,
lefiGeomRectIterE,
lefiGeomPolygonE,
lefiGeomPolygonIterE,
lefiGeomViaE,
lefiGeomViaIterE,
lefiGeomClassE,
lefiGeomEnd };
lefiGeomRect
Returns data from the RECT statement in the MACRO section.
C++ Syntax
struct lefiGeomRect {
double xl;
double yl;
double xh;
double yh;
int colorMask; }; //specify color mask number for the GeomRect
//structure.
lefiGeomRectIter
Returns data from the RECT ITERATE statement in the MACRO section.
C++ Syntax
struct lefiGeomRectIter {
double xl;
double yl;
double xh;
double yh;
double xStart;
double yStart;
double xStep;
double yStep;
int colorMask;}; //specify color mask number for the GeomRectIter
//structure.
lefiGeomPath
Returns data from the PATH statement in the MACRO section.
C++ Syntax
struct lefiGeomPath {
int numPoints;
double* x;
double* y;
int colorMask; }; //specify color mask number for the GeomPath
//structure.
lefiGeomPathIter
Returns data from the PATH ITERATE statement in the MACRO section.
C++ Syntax
struct lefiGeomPathIter {
int numPoints;
double* x;
double* y;
double xStart;
double yStart;
double xStep;
double yStep;
int colorMask; }; //specify color mask number for the GeomPathIter
//structure.
lefiGeomPolygon
Returns data from the POLYGON statement in the MACRO section.
C++ Syntax
struct lefiGeomPolygon {
int numPoints;
double* x;
double* y;
int colorMask; }; //specify color mask number for the GeomPolygon
//structure.
lefiGeomPolygonIter
Returns data from the POLYGON ITERATE statement in the MACRO section.
C++ Syntax
struct lefiGeomPolygonIter {
int numPoints;
double* x;
double* y;
double xStart;
double yStart;
double xStep;
double yStep;
int colorMask; }; //specify color mask number for the GeomPolygonIter
//structure.
lefiGeomVia
Returns data from the VIA statement in the MACRO section.
C++ Syntax
struct lefiGeomVia {
char* name;
double x;
double y;
int topMaskNum; //define top mask number for the GeomVia structure.
int cutMaskNum; //define cut mask number for the GeomVia structure.
int bottomMaskNum;}; //define bottom mask number for the GeomVia structure.
lefiGeomViaIter
Returns data from the VIA ITERATE statement in the MACRO section.
C++ Syntax
struct lefiGeomViaIter {
char* name;
double x;
double y;
double xStart;
double yStart;
double xStep;
double yStep;
int topMaskNum; //define top mask number for the GeomViaIter structure.
int cutMaskNum; //define cut mask number for the GeomViaIter structure.
int bottomMaskNum;}; //define bottom mask number for the GeomViaIter
//structure.
lefiGeometries* geometry;
int numPorts;
int numItems;
int i, j;
lefiGeomPath* path;
lefiGeomPathIter* pathIter;
lefiGeomRect* rect;
lefiGeomRectIter* rectIter;
lefiGeomPolygon* polygon;
lefiGeomPolygonIter* polygonIter;
lefiGeomVia* via;
lefiGeomViaIter* viaIter;
if (pin->hasForeign()) {
if (pin->hasForeignOrient())
printf(" FOREIGN %s STRUCTURE ( %g %g ) %d\n",
pin->foreignName(), pin->foreignX(),
pin->foreignY(), pin->foreignOrient());
else if (pin->hasForeignPoint())
printf(" FOREIGN %s STRUCTURE ( %g %g )\n",
pin->foreignName(), pin->foreignX(),
pin->foreignY());
else
if (pin->hasLEQ())
printf(" LEQ %s\n", pin->LEQ());
if (pin->hasAntennaSize()) {
for (i = 0; i < pin->numAntennaSize(); i++) {
printf(" ANTENNASIZE %g ", pin->antennaSize(i));
if (pin->antennaSizeLayer(i))
printf("LAYER %s ", pin->antennaSizeLayer(i));
printf("\n");
}
}
numPorts = pin->numPorts();
for (i = 0; i < numPorts; i++) {
printf(" PORT\n");
geometry = pin->port(i);
// A complete example can be found on page 76.
numItems = geometry->numItems();
for (j = 0; j < numItems; j++) {
switch (geometry->itemType(j)) {
case lefiGeomClassE:
printf(" CLASS %s\n", geometry->getClass(j));
break;
case lefiGeomLayerE:
printf(" LAYER %s\n", geometry->getLayer(j));
break;
case lefiGeomWidthE:
printf(" WIDTH %g\n", geometry->getWidth(j));
break;
case lefiGeomPathE:
...
break;
case lefiGeomPathIterE:
...
break;
case lefiGeomRectE:
rect = geometry->getRect(j);
printf(" RECT ( %g %g ) ( %g %g )\n", rect->xl,
rect->yl, rect->xh, rect->yh);
break;
case lefiGeomRectIterE:
...
break;
case lefiGeomPolygonE:
...
break;
case lefiGeomPolygonIterE:
...
break;
case lefiGeomViaE:
...
break;
case lefiGeomViaIterE:
...
break;
}
}
}
return 0; }
lefiMaxStackVia
Retrieves data from the MAXVIASTACK statement in the LEF file.
For syntax information about the LEF MAXVIASTACK statement, see "Maximum Via Stack" in
the LEF/DEF Language Reference.
C++ Syntax
class lefiMaxStackVia {
int maxStackVia() const;
int hasMaxStackViaRange() const;
const char* maxStackViaBottomLayer() const;
const char* maxStackViaTopLayer() const; }
Miscellaneous Class
Miscellaneous routines include the following LEF class:
■ lefiUserData on page 89
lefiUserData
The user data can be set or changed at any time with the lefrSetUserData and
lefrGetUserData calls. Every callback returns the user data as the third argument.
C++ Syntax
lefiUserData lefrGetUserData()
lefiNonDefault
Retrieves data from the NONDEFAULTRULE statement in the LEF file.
For syntax information about the LEF NONDEFAULTRULE statement, see "Nondefault Rule"
in the LEF/DEF Language Reference.
C++ Syntax
class lefiNonDefault {
const char* name() const;
int hardSpacing() const;
int numProps() const;
const char* propName(int index) const;
const char* propValue(int index) const;
double propNumber(int index) const;
const char propType(int index) const;
int propIsNumber(int index) const;
int propIsString(int index) const;
int numLayers() const;
const char* layerName(int index) const;
int hasLayerWidth(int index) const;
double layerWidth(int index) const;
int hasLayerSpacing(int index) const;
double layerSpacing(int index) const;
int hasLayerWireExtension(int index) const;
double layerWireExtension(int index) const;
int hasLayerDiagWidth(int index) const;
double layerDiagWidth(int index) const;
return 0;}
lefiProp
Retrieves data from the PROPERTYDEFINITIONS statement in the LEF file. The
PROPERTYDEFINITIONS statement lists all properties used in the LEF file. You must define
properties before you refer to them in other routines in the LEF file.
For syntax information about the LEF PROPERTYDEFINITIONS statement, see "Property
Definitions" in the LEF/DEF Language Reference.
C++ Syntax
class lefiProp {
const char* string() const;
const char* propType() const;
const char* propName() const;
char dataType() const;
int hasNumber() const;
int hasRange() const;
int hasString() const;
int hasNameMapString() const;
double number() const;
double left() const;
double right() const;};
lefiPropType
Retrieves the data type from the LEF PROPERTYDEFINITIONs statement in the LEF file, if
the property is of type REAL or INTEGER.
For syntax information about the LEF PROPERTYDEFINITIONS statement, see "Property
Definitions" in the LEF/DEF Language Reference.
C++ Syntax
class lefiPropType {
const char propType(char* name) const; };
printf("PROPERTYDEFINITIONS\n");
return 0;}
The following example shows a callback routine with the type lefrPropCbkType, and the
class lefiProp. This callback routine will be called for each defined property definition.
int propDefCB (lefrCallbackType_e type,
lefiProp* propInfo,
lefiUserData userData) {
printf("\n");
return 0;}
The following example shows a callback routine with the type lefrPropEndCbkType, and
the class void *. This callback routine marks the end of the Property Definition section.
int propDefEndCB (lefrCallbackType_e type,
void* dummy,
lefiUserData userData) {
printf("END PROPERTYDEFINITIONS\n");
return 0;}
lefiSpacing
Retrieves data from the SPACING statement in the LEF file.
C++ Syntax
class lefiSpacing {
int hasStack() const;
const char* name1() const;
const char* name2() const;
double distance() const;};
printf("STACK ");
printf("\n");
return 0; }
Site Classes
The LEF SITE routines include the following LEF class:
■ lefiSite on page 95
■ lefiSitePattern
lefiSite
Retrieves data from the SITE statement of the LEF file.
For syntax information about the LEF SITE statement, see "Site" in the LEF/DEF Language
Reference.
C++ Syntax
class lefiSite {
const char* name() const;
int hasClass() const;
const char* siteClass() const;
double sizeX() const;
double sizeY() const;
int hasSize() const;
int hasXSymmetry() const;
int hasYSymmetry() const;
int has90Symmetry() const;
int hasRowPattern() const;
int numSites() const;
char* siteName(int index) const;
int siteOrient(int index) const;
char* siteOrientStr(int index) const; };
lefiSitePattern
Retrieves site pattern information from the SITE statement of the LEF file.
For syntax information about the LEF SITE statement, see "Site" in the LEF/DEF Language
Reference.
C++ Syntax
lefiSitePattern {
const char* name() const;
int orient() const;
const char* orientStr() const;
double x() const;
double y() const;
int hasStepPattern () const;
double xStart() const;
double yStart() const;
double xStep() const;
double yStep() const; };
Site Examples
The following example shows a callback routine with the type lefrSiteCbkType, and the
class lefiSite.
int siteCB (lefrCallbackType_e type,
lefiSite* siteInfo,
lefiUserData userData) {
int hasPrtSym = 0;
if (hasPrtSym)
printf("R90 ");
else {
printf(" SYMMETRY R90 ");
hasPrtSym = 1;
}
}
if (hasPrtSym)
printf("\n");
if (siteInfo->hasSize())
printf(" SIZE %g BY %g\n", siteInfo->sizeX(),
siteInfo->sizeY());
printf("END %s\n", siteInfo->name());
return 0;}
Units Class
The LEF UNITS routines include the following LEF class:
■ lefiUnits on page 97
lefiUnits
Retrieves data from the UNITS statement of the LEF file. This statement defines the units of
measure in LEF.
For syntax information about the LEF UNITS statement, see "Units" in the LEF/DEF
Language Reference.
C++ Syntax
class lefiUnits {
int hasDatabase();
int hasCapacitance();
int hasResistance();
int hasTime();
int hasPower();
int hasCurrent();
int hasVoltage();
int hasFrequency();
const char* databaseName();
double databaseNumber();
double capacitance();
double resistance();
double time();
double power();
double current();
double voltage();
double frequency();};
Units Examples
The following example shows a callback routine with the type lefrUnitsCbkType, and the
class lefiUnits.
int unitsCB (lefrCallbackType_e type,
lefiUnits* unitInfo,
lefiUserData userData) {
printf("UNITS\n");
if (unitInfo->hasDatabase())
printf(" DATABASE %s %g\n", unitInfo->databaseName(),
unitInfo->databaseNumber());
if (unitInfo->hasCapacitance())
printf(" CAPACITANCE PICOFARADS %g\n",
unitInfo->capacitance());
if (unitInfo->hasResistance())
printf(" RESISTANCE OHMS %g\n", unitInfo->resistance());
if (unitInfo->hasPower())
printf(" POWER MILLIWATTS %g\n", unitInfo->power());
if (unitInfo->hasCurrent())
printf(" CURRENT MILLIAMPS %g\n", unitInfo->current());
if (unitInfo->hasVoltage())
printf(" VOLTAGE VOLTS %g\n", unitInfo->voltage());
if (unitInfo->hasFrequency())
printf(" FREQUENCY MEGAHERTZ %g\n", unitInfo-
>frequency());
printf("END UNITS\n");
return 0;};
■ lefiUseMinSpacing on page 99
lefiUseMinSpacing
Retrieves data from the USEMINSPACING statement of the LEF file.
For syntax information about the LEF USEMINSPACING statement, see "Use Min Spacing" in
the LEF/DEF Language Reference.
C++ Syntax
class lefiUseMinSpacing {
const char* name() const;
int value() const;};
Via Classes
The LEF VIA routines include the following LEF classes:
■ lefiVia on page 99
■ lefiViaLayer on page 101
lefiVia
Retrieves data from the VIA section of the LEF file.
For syntax information about the LEF VIA section, see "Via" in the LEF/DEF Language
Reference.
C++ Syntax
class lefiVia {
int hasDefault() const ;
int hasGenerated() const;
int hasForeign() const ; // optional - for information, see
// Orientation Codes on page 21
int hasForeignPnt() const ;
int hasForeignOrient() const ;
int hasProperties() const ;
int hasResistance() const ;
int hasTopOfStack() const ;
double xl,
double yl,
double xh,
double yh);
lefiGeometries* geom);
int rectColorMask(int layerNum,
int rectNum);
int polyColorMask(int layerNum,
int rectNum); };
lefiViaLayer
Retrieves data from the LAYER statement within the VIA section of the LEF file. The members
of the C++ class and C structures correspond to elements of the LAYER statement in the VIA
section.
For syntax information about the LEF VIA section, see "Via" in the LEF/DEF Language
Reference.
C++ Syntax
class lefiViaLayer {
int numRects();
char* name();
double xl(int index);
double yl(int index);
double xh(int index);
double yh(int index);
int numPolygons();
struct lefiGeomPolygon* getPolygon(int index) const;
double xl,
double yl
double xh
double yn);
lefiGeometries* geom);
int rectColorMask(int index);
int polyColorMask(int index); };
Via Examples
The following example shows a callback routine with the type lefrViaCbkType, and the
class lefiVia.
int i, j;
}
printf("END %s\n", viaInfo->name());
return 0;}
lefiViaRule
Retrieves data from the VIARULE and VIARULE GENERATE statements of the LEF file.
For syntax information about the LEF VIARULE and VIARULE GENERATE statements, see
"Via Rule," and "Via Rule Generate" in the LEF/DEF Language Reference.
C++ Syntax
class lefiViaRule {
int hasGenerate() const;
int hasDefault() const;
char* name() const;
int numLayers() const;
lefiViaRuleLayer* layer(int index);
int numVias() const;
char* viaName(int index) const;
int numProps() const;
const char* propName(int index) const;
const char* propValue(int index) const;
double propNumber(int index) const;
const char propType(int index) const;
int propIsNumber(int index) const;
int propISString(int index) const; };
lefiViaRuleLayer
Retrieves data from the LAYER statement within the VIARULE and VIARULE GENERATE
statements of the LEF file.
For syntax information about the LEF VIARULE and VIARULE GENERATE statements, see
"Via Rule," and "Via Rule Generate" in the LEF/DEF Language Reference.
C++ Syntax
class lefiViaRuleLayer {
int hasDirection() const;
int hasEnclosure() const;
int hasWidth() const;
int hasResistance() const;
int hasOverhang() const;
int hasMetalOverhang() const;
int hasSpacing() const;
int hasRect() const;
char* name() const;
int isHorizontal() const;
int isVertical() const;
double enclosureOverhang1() const;
double enclosureOverhang2() const;
double widthMin() const;
double widthMax() const;
double overhang() const;
double metalOverhang() const;
double resistance() const;
double spacingStepX() const;
double spacingStepY() const;
double xl() const;
double yl() const;
double xh() const;
double yh() const; };
else
printf("\n");
numLayers = viaRuleInfo->numLayers();
// If numLayers == 2, it is VIARULE without GENERATE and has
// via name. If numLayers == 3, it is VIARULE with GENERATE, and
// the 3rd layer is cut.
for (i = 0; i < numLayers; i++) {
vLayer = viaRuleInfo->layer(i);
printf(" LAYER %s\n", vLayer->name());
if (vLayer->hasDirection()) {
if (vLayer->isHorizontal())
printf(" DIRECTION HORIZONTAL\n");
if (vLayer->isVertical())
printf(" DIRECTION VERTICAL\n");
}
if (vLayer->hasWidth())
printf(" WIDTH %g TO %g\n", vLayer->widthMin(),
vLayer->widthMax());
if (vLayer->hasResistance())
printf(" RESISTANCE %g\n", vLayer->resistance());
if (vLayer->hasOverhang())
printf(" OVERHANG %g\n", vLayer->overhang());
if (vLayer->hasMetalOverhang())
printf(" METALOVERHANG %g\n", vLayer-
>metalOverhang());
if (vLayer->hasSpacing())
printf(" SPACING %g BY %g\n", vLayer->spacingStepX(),
vLayer->spacingStepY());
if (vLayer->hasRect())
printf(" RECT ( %g %g ) ( %g %g )\n", vLayer->xl(),
vLayer->yl(), vLayer->xh(), vLayer->yh()); }
5
LEF Writer Callback Routines
You can use the Cadence® Library Exchange Format (LEF) writer with callback routines, or
you can call one writer function at a time.
When you use callback routines, the writer creates a LEF file in the sequence shown in the
following table. The writer also checks which sections are required for the file. If you do not
provide a callback for a required section, the writer uses a default routine. If no default routine
is available for a required section, the writer generates an error message.
Callback Type
The callBackType argument is a list of objects that contains a unique number assignment
for each callback from the parser. This list allows you to use the same callback routine for
different types of LEF data.
User Data
The data argument is a four-byte data item that you set. The LEF writer contains only user
data. The user data is most often set to a pointer to the design data so that it can be passed
to the routines.
LEF
Setting Routine Callback Types
Information
Bus Bit void lefwSetBusBitCharsCbk lefwBusBitCharsCbkType
Characters (lefwVoidCbkFnType);
Clearance void lefwClearanceMeasureCbkTyp
Measure lefwSetClearanceMeasureCbk e
(lefwVoidCbkFnType);
Divider void lefwSetDividerCharCbk lefwDividerCharCbkType
Character (lefwVoidCbkFnType);
Extensions void lefwSetExtCbk lefwExtCbkType
(lefwVoidCbkFnType);
End Library void lefwSetEndLibCbk lefwEndLibCbkType
(lefwVoidCbkFnType);
LEF
Setting Routine Callback Types
Information
Layer void lefwSetLayerCbk lefwLayerCbkType
(lefwVoidCbkFnType);
Macro void lefwSetMacroCbk lefwMacroCbkType
(lefwVoidCbkFnType);
Manufacturing void lefwManufacturingGridCbkTy
Grid lefwSetManufacturingGridCbk pe
(lefwVoidCbkFnType);
Nondefault Rule void lefwSetNonDefaultCbk lefwNonDefaultCbkType
(lefwVoidCbkFnType);
Property void lefwSetPropDefCbk lefwPropDefCbkType
Definitions (lefwVoidCbkFnType);
Site void lefwSetSiteCbk lefwSiteCbkType
(lefwVoidCbkFnType);
Spacing void lefwSetSpacingCbk lefwSpacingCbkType
(lefwVoidCbkFnType);
Units void lefwSetUnitsCbk lefwUnitsCbkType
(lefwVoidCbkFnType);
Use Min void lefwUseMinSpacingCbkType
Spacing lefwSetUseMinSpacingCbk
(lefwVoidCbkFnType);
Version void lefwSetVersionCbk lefwVersionCbkType
(lefwVoidCbkFnType);
Via void lefwSetViaCbk lefwViaCbkType
(lefwVoidCbkFnType);
Via Rule void lefwSetViaRuleCbk lefwViaRuleCbkType
(lefwVoidCbkFnType);
6
LEF Writer Routines
You can use the Cadence® Library Exchange Format (LEF) writer routines to create a
program that outputs a LEF file. The LEF writer routines correspond to the sections in the LEF
file. This chapter describes the routines listed below that you need to write a particular LEF
section.
lefwInit
Initializes the LEF writer. This routine must be used first.
Syntax
int lefwInit(
FILE* file)
Arguments
file
Specifies the name of the LEF file to create.
lefwEnd
Ends the LEF file. This routine must be used last. This routine does not require any
arguments.
Syntax
int lefwEnd()
lefwCurrentLineNumber
Returns the line number of the last line written to the LEF file. This routine does not require
any arguments.
Syntax
int lefwCurrentLineNumber()
lefwNewLine
Writes a blank line. This routine does not require any arguments.
Syntax
int lefwNewLine()
lefwPrintError
Prints the return status of the lefw* routines.
Syntax
void lefwPrintError(
int status)
Arguments
status
Specifies the non-zero integer returned by the LEF writer routines.
Setup Examples
The following examples show how to set up the writer. There are two ways to use the LEF
writer:
■ You call the write routines in your own sequence. The writer makes sure that some
routines are called before others, but you must make sure the entire sequence is correct,
and that all 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 issues a warning. If there is a default
routine, the writer invokes the default routine with a message attached.
...
// Open the lef file for the writer to write.
if ((f = fopen("lefOutputFileName","w")) == 0) {
printf("Couldn’t open output file ’%s’\n",
"lefOutputFileName");
return(2);
}
// Initialize the writer. This routine has to call first. Call this
// routine instead of lefwInitCbk(f) if you are not using the
// callback routines.
res = lefwInit(f);
...
res = lefwEnd();
...
fclose(f);
return 0;
}
...
// Open the lef file for the writer to write.
if ((f = fopen("lefOutputFileName","w")) == 0) {
printf("Couldn’t open output file ’%s’\n",
"lefOutputFileName");
return(2);
}
// Initialize the writer. This routine has to call first. Call this
// routine instead of lefwInit() if you are using the writer with
// callbacks.
res = lefwInitCbk(f);
fclose(f);
return 0;
}
The following example shows how to use the callback routine to mark the end of the LEF file.
The type is lefwEndLibCbkType.
#define CHECK_RES(res) \
if (res) { \
lefwPrintError(res); \
return(res); \
}
writing.\n");
return 1;
}
res = lefwEnd();
CHECK_RES(res);
return 0;
}
The BUSBITCHARS statement is part of the LEF file header (which also includes the
VERSION, and DIVIDERCHAR statements). If the statements in the header section are not
defined, many applications assume default values for them. However, the default values are
not formally part of the language definition; therefore you cannot be sure that the same
assumptions are used in all applications. You should always explicitly define these values.
lefwBusBitChars
Writes a BUSBITCHARS statement.
Syntax
int lefwBusBitChars(
const char* busBitChars)
Arguments
busBitChars
Specifies the pair of characters used to specify bus bits when LEF names are mapped
to or from other databases. The characters must be enclosed in double quotation marks.
Clearance Measure
The Clearance Measure routine writes a LEF CLEARANCEMEASURE statement. The
CLEARANCEMEASURE statement is optional and can be used only once in a LEF file. For
syntax information about the LEF CLEARANCEMEASURE section, see "Clearance Measure" in
the LEF/DEF Language Reference.
lefwClearanceMeasure
Writes a CLEARANCEMEASURE statement.
Syntax
int lefwClearanceMeasure(
const char* type)
Arguments
type
Specifies the type of clearance spacing that will be applied to obstructions (blockages)
and pins in cells.
Value: Specify one of the following:
Divider Character
The Divider Character routine writes a LEF DIVIDERCHAR statement. The DIVIDERCHAR
statement is optional and can be used only once in a LEF file. For syntax information about
the LEF DIVIDERCHAR statement, see "Divider Character" in the LEF/DEF Language
Reference.
The DIVIDERCHAR statement is part of the LEF file header (which also includes the
VERSION, and BUSBITCHARS statements). If the statements in the header section are not
defined, many applications assume default values for them. However, the default values are
not formally part of the language definition; therefore you cannot be sure that the same
assumptions are used in all applications. You should always explicitly define these values.
lefwDividerChar
Writes a DIVIDERCHAR statement.
Syntax
int lefwDividerChar(
const char* dividerChar)
Arguments
dividerChar
Specifies the character used to express hierarchy when LEF names are mapped to or
from other databases. The character must be enclosed in double quotation marks.
Note: If the divider character appears in a LEF name as a regular character, you must
use a backslash (\) before the character to prevent the LEF reader from interpreting the
character as a hierarchy delimiter.
res = lefwDividerChar(":");
CHECK_RES(res);
res = lefwNewLine(); // add an empty line
CHECK_RES(res);
return 0;}
Extensions
Extensions routines write a LEF BEGINEXT statement. The BEGINEXT statement is optional
and can be used more than once in a LEF file.
Extensions routines let you add customized syntax to the LEF file that can be ignored by tools
that do not use that syntax. You can also use extensions to add new syntax not yet supported
by your version of LEF, if you are using version 5.1 or later. For syntax information about the
LEF EXTENSIONS section, see "Extensions" in the LEF/DEF Language Reference.
You must begin and end a LEF BEGINEXT statement with the lefwStartBeginext and
lefwEndBeginext routines. All LEF writer routines that define EXTENSIONS routines must
be included between these routines.
For examples of the routines described here, see “Extensions Examples” on page 122.
lefwStartBeginext
Starts the EXTENSIONS statement using the specified tag.
Syntax
int lefwStartBeginext(
const char* tag)
Arguments
tag
Identifies the extension block. The tag must be enclosed in double quotation marks.
lefwEndBeginext
Writes the ENDEXT statement.
Syntax
int lefwEndBeginext()
lefwBeginextCreator
Writes a CREATOR statement. The CREATOR statement is optional and can be used only once
in an EXTENSIONS statement.
Syntax
int lefwBeginextCreator(
const char* creator)
Arguments
creator
Specifies a string value that defines the creator value.
lefwBeginextDate
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 lefwBeginextDate()
lefwBeginextRevision
Writes a REVISION statement. The REVISION statement is optional and can be used only
once in an EXTENSIONS statement.
Syntax
int lefwBeginextRevision(
int vers1,
int vers2)
Arguments
vers1, vers2
Specify the values used for the revision number string.
lefwBeginextSyntax
Adds customized syntax to the LEF 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 Examples
The following example shows a callback routine with the type lefwExtCbkType. This
example only shows the usage of some functions related to array.
int extCB (lefwCallbackType_e type,
lefiUserData userData) {
int res;
res = lefwStartBeginext("SIGNATURE");
CHECK_RES(res);
res = lefwBeginextCreator("CADENCE");
CHECK_RES(res);
res = lefwBeginextDate();
CHECK_RES(res);
res = lefwEndBeginext();
CHECK_RES(res);
return 0;}
You must begin and end a LEF LAYER section with the lefwStartLayer and
lefwEndLayer routines. You create one LAYER section for each layer you need to define.
For examples of the routines described here, see “Layer Examples” on page 140.
In addition to the routines described in this section, you can include a PROPERTY statement
in a LAYER section. For more information about these routines, see “Property” on page 224.
lefwStartLayer
Starts the LAYER section. Each cut, masterslice, overlap, and implant layer must be defined
by a separate lefwStartLayer, lefwEndLayer routine pair.
Syntax
int lefwStartLayer(
const char* layerName,
const char* type)
Arguments
layerName
Specifies the name of the layer being defined.
type
Specifies the type of layer being defined.
Value: CUT, MASTERSLICE, OVERLAP, or IMPLANT
lefwEndLayer
Ends the LAYER section for the specified layer.
Syntax
int lefwEndLayer(
const char* layerName)
lefwLayerACCurrentDensity
Writes an ACCURRENTDENSITY statement for a cut layer. The ACCURENTDENSITY statement
is optional, and can be used only once in a LAYER section.
Syntax
int lefwLayerACCurrentDensity(
const char* type,
double value)
Arguments
type
Specifies one of the AC current limits, PEAK, AVERAGE, or RMS.
value
Specifies a maximum current limit for the layer in milliamps per square micron. If you
specify 0, you must call the lefwLayerACFrequency and
lefwLayerACTableEntries routines.
lefwLayerACCutarea
Writes a CUTAREA statement for a cut layer. The CUTAREA statement is optional if you specify
a FREQUENCY statement, and can be used only once in an ACCURENTDENSITY statement.
Syntax
int lefwLayerACCutarea(
int numCutareas,
double* cutareas)
Arguments
numCutareas
Specifies the number of cut area values.
cutareas
Specifies the cut area values, in square microns. If you specify only one cut area value,
there is no cut area dependency, and the table entries are assumed to apply to all cut
areas.
lefwLayerACFrequency
Writes a FREQUENCY statement for a cut layer. The FREQUENCY statement is required if you
specify a value of 0 in the lefwLayerACCurrentDensity routine, and can be used only
once in an ACCURENTDENSITY statement.
Syntax
int lefwLayerACFrequency(
int numFrequency,
double* frequency)
Arguments
numFrequency
Specifies the number of frequency values.
frequency
Specifies the frequency values, in megahertz. If you specify only one frequency value,
there is no frequency dependency, and the table entries are assumed to apply to all
frequencies.
lefwLayerACTableEntries
Writes a TABLEENTRIES statement for a cut layer. The TABLENTRIES statement is required
if you specify a FREQUENCY statement, and can be used only once in an ACCURENTDENSITY
statement.
Syntax
int lefwLayerACTableEntries(
int numEntries,
double* entries)
Arguments
numEntries
Specifies the number of table entry values.
entries
Specifies the maximum cut area for each frequency and cut area pair specified in the
FREQUENCY and CUTAREA statements, in milliamps per square micron.
lefwLayerAntennaAreaFactor
Writes an ANTENNAAREAFACTOR statement for a cut layer. The ANTENNAAREAFACTOR
statement is optional and can be used once after each lefwAntennaModel routine in a
LAYER section.
Syntax
int lefwLayerAntennaAreaFactor(
double value
const char* diffUseOnly)
Arguments
value
Specifies the adjust or multiply factor for the antenna metal calculation.
diffUseOnly
Optional argument that specifies the current antenna factor should be used only when
the corresponding layer is connected to the diffusion. Specify NULL to ignore this
argument.
lefwLayerAntennaAreaRatio
Writes an ANTENNAAREARATIO statement for a cut layer. The ANTENNAREARATIO statement
is optional and can be used once after each lefwAntennaModel routine in a LAYER section.
Syntax
int lefwLayerAntennaAreaRatio(
double value)
Arguments
value
Specifies the antenna ratio, using the bottom area of the metal wire that is not connected
to the diffusion diode.
lefwLayerAntennaCumAreaRatio
Writes an ANTENNACUMAREARATIO statement for a cut layer. The ANTENNACUMAREARATIO
statement is optional and can be used once after each lefwAntennaModel routine in a
LAYER section.
Syntax
int lefwLayerAntennaCumAreaRatio(
double value)
Arguments
value
Specifies the cumulative antenna ratio, using the bottom area of the metal wire that is not
connected to the diffusion diode.
lefwLayerAntennaCumDiffAreaRatio
Writes an ANTENNACUMDIFFAREARATIO statement for a cut layer. The
ANTENNACUMDIFFAREARATIO statement is optional and can be used once after each
lefwAntennaModel routine in a LAYER section. If you specify this routine, you cannot
specify lefwLayerAntennaCumDiffAreaRatioPWL in the same LAYER section.
Syntax
int lefwLayerAntennaCumDiffAreaRatio(
double value)
Arguments
value
Specifies the cumulative antenna ratio, using the bottom area of the metal wire that is
connected to the diffusion diode.
lefwLayerAntennaCumDiffAreaRatioPwl
Writes an ANTENNACUMDIFFAREARATIOPWL statement for a cut layer. The
ANTENNACUMDIFFAREARATIOPWL statement is optional and can be used once after each
lefwAntennaModel routine in a LAYER section. If you specify this routine, you cannot
specify lefwLayerAntennaCumDiffAreaRatio in the same LAYER section.
Syntax
int lefwLayerAntennaCumDiffAreaRatioPwl(
int numPwls,
double diffusions,
double ratios)
Arguments
numPwls
Specifies the number of diffusion-ratio pairs.
diffusions
Specifies the diffusion values.
ratios
Specifies the ratio values.
lefwLayerAntennaDiffAreaRatio
Writes an ANTENNADIFFAREARATIO statement for a cut layer. The
ANTENNADIFFAREARATIO statement is optional and can be used once after each
lefwAntennaModel routine in a LAYER section. If you specify this routine, you cannot
specify lefwLayerAntennaDiffAreaRatioPWL in the same LAYER section.
Syntax
int lefwAntennaDiffAreaRatio(
double value)
Arguments
value
Specifies the antenna ratio, using the bottom area of the wire that is connected to the
diffusion diode.
lefwLayerAntennaDiffAreaRatioPwl
Writes an ANTENNADIFFAREARATIOPWL statement for a cut layer. The
ANTENNADIFFAREARATIOPWL statement is optional and can be used once after each
lefwAntennaModel routine in a LAYER section. If you specify this routine, you cannot
specify lefwLayerAntennaDiffAreaRatio in the same LAYER section.
Syntax
int lefwAntennaDiffAreaRatioPWL(
int numPwls,
double diffusions,
double ratios)
Arguments
numPwls
Specifies the number of diffusion-ratio pairs.
diffusions
Specifies the diffusion values.
ratios
Specifies the ratio values.
lefwLayerAntennaModel
Writes an ANTENNAMODEL statement for a cut layer. The ANTENNAMODEL statement is
optional and can be used more than once in a LAYER section.
Syntax
int lefwLayerAntennaModel(
const char* oxide)
Arguments
oxide
Specifies the oxide model for the layer. Each model can be specified once per layer. If
you specify an ANTENNAMODEL statement, that value affects all ANTENNA* statements
for the layer that follow it until you specify another ANTENNAMODEL statement.
Value: OXIDE1, OXIDE2, OXIDE3, or OXIDE4
Note: OXIDE1 and OXIDE2 are currently supported. If you specify OXIDE3 or OXIDE4,
current tools parse and ignore them.
lefwLayerArraySpacing
Writes an ARRAYSPACING statement for a cut layer. The ARRAYSPACING statement is
optional and can be used only once in a LAYER section.
Syntax
int lefwLayerArraySpacing(
int longArray,
double viaWidth,
double cutSpacing,
int numArrayCut,
int* arrayCuts,
double* arraySpacings)
Arguments
longArray
Optional argument that indicates that the via can use N x M cut arrays, where N =
arrayCuts and M can be any value, including one that is larger than N. Specify 0 to
ignore this argument.
viaWidth
Optional argument that specifies the via width. The array spacing rules only apply when
the via metal width is greater than or equal to viaWidth. Specify 0 to ignore this
argument.
cutSpacing
Specifies the edge-of-cut to edge-of-cut spacing inside one cut array.
numArrayCuts
Specifies the number of arrayCuts and arraySpacings pairs provided.
arrayCuts
Specifies the size of the cut arrays.
A large via array with a size greater than or equal to arrayCuts x arrayCuts in both
dimensions must use N x N cut arrays (where N = arrayCuts) separated from other
cut arrays by a distance greater than or equal to arraySpacing.
If you specify multiple arrayCuts and arraySpacings, the arrayCuts values
must be specified in increasing order.
arraySpacings
Specifies the spacing between the cut arrays.
lefwLayerCutSpacing
Starts a SPACING statement for a cut layer. Call lefwLayerCutSpacingEnd to end each
spacing.
The SPACING statement is optional and can be used more than once in a LAYER section.
Syntax
int lefwLayerCutSpacing(
double spacing)
Arguments
spacing
Specifies the minimum spacing allowed between via cuts, in microns.
lefwLayerCutSpacingAdjacent
Writes an ADJACENTCUTS statement for a SPACING statement for a cut layer. The
ADJACENTCUTS statement is optional. You can specify only one of the following statements
per spacing: LAYER, ADJACENTCUTS, AREA, or PARALLELOVERLAP.
Syntax
int lefwLayerCutSpacingAdjacent(
int viaCuts,
double distance,
int stack)
Arguments
viaCuts
Optional argument that specifies the number of via cuts—either 2, 3, or 4.
distance
Specifies the distance between via cuts, in microns.
stack
Optional argument that sets the EXCEPTSAMEPGNET keword for the spacing. If this
keyword is set, the ADJACENTCUTS rule does not apply between cuts if they are on the
same net, and are on a power and ground net.
lefwLayerCutSpacingArea
Writes an AREA statement for a SPACING statement for a cut layer. The AREA statement is
optional. You can specify only one of the following statements per spacing: LAYER,
ADJACENTCUTS, AREA, or PARALLELOVERLAP.
Syntax
int lefwLayerCutSpacingArea(
double cutArea)
Arguments
cutArea
Specifies the cut area. Any cut with an area equal to or greater than this number requires
additional spacing.
lefwLayerCutSpacingCenterToCenter
Writes a CENTERTOCENTER statement for a SPACING statement for a cut layer. The
CENTERTOCENTER statement is optional.
Syntax
int lefwLayerCutSpacingCenterToCenter()
lefwLayerCutSpacingEnd
Ends a SPACING statement for a cut layer.
Syntax
int lefwLayerCutSpacingEnd()
lefwLayerCutSpacingLayer
Writes a LAYER statement for a SPACING statement for a cut layer. The LAYER statement is
optional. You can specify only one of the following statements per spacing: LAYER,
ADJACENTCUTS, AREA, or PARALLELOVERLAP.
Syntax
int lefwLayerCutSpacingLayer(
const char* name2,
int stack)
Arguments
name2
Specifies the second layer name.
stack
Optional argument indicating that same-net cuts on two different layers can be stacked
if they are exactly aligned; otherwise, the cuts must have cutSpacing between them.
Specify 0 to ignore this argument.
lefwLayerCutSpacingParallel
Writes a PARALLELOVERLAP statement for a SPACING statement for a cut layer. The
PARALLELOVERLAP statement is optional. You can specify only one of the following
statements per spacing: LAYER, ADJACENTCUTS, AREA, or PARALLELOVERLAP.
Syntax
int lefwLayerCutSpacingParallel()
lefwLayerCutSpacingSamenet
Writes a SAMENET statement for a SPACING statement for a cut layer. The SAMENET
statement is optional.
Syntax
int lefwLayerCutSpacingSameNet()
lefwLayerCutSpacingTableOrtho
Writes a SPACINGTABLE ORTHOGONAL statement for a cut layer. The SPACINGTABLE
ORTHOGONAL statement is optional and can be used only once in a LAYER section.
Syntax
int lefwLayerCutSpacingTableOrtho(
int numSpacing,
double* cutWithins,
double* orthoSpacings)
Arguments
numSpacing
Specifies the number of cutWithins and orthoSpacings pairs provided.
cutWithins
Specifies the distance between cuts, in microns.
If two cuts have parallel overlap greater than 0 and are less than cutWithin distance
from each other, then any other cuts in an orthogonal direction must be equal to or
greater than orthoSpacings.
orthoSpacings
Specifies the orthogonal spacing, in microns.
lefwLayerDCCurrentDensity
Writes the DCCURRENTDENSITY statement for a cut layer. The DCCURENTDENSITY
statement is optional and can be used only once in a LAYER section.
Syntax
int lefwLayerDCCurrentDensity(
const char* type,
double value)
Arguments
type
Specifies the DC current limit, AVERAGE.
value
Specifies a current limit for the layer in milliamps per square microns. If you specify 0,
you must call the lefwLayerDCCutarea and lefwLayerDCTableEntries routines.
lefwLayerDCCutarea
Writes a CUTAREA statement for a cut layer. The CUTAREA statement is required if you specify
a value of 0 in the lefwLayerDCCurrentDensity routine, and can be used only once in a
DCCURENTDENSITY statement.
Syntax
int lefwLayerDCCutarea(
int numCutareas,
double* cutareas)
Arguments
numCutareas
Specifies the number of cut area values.
cutareas
Specifies the cut area values, in square microns.
lefwLayerDCTableEntries
Writes a TABLEENTRIES statement for a cut layer. The TABLENTRIES statement is required
if you specify a CUTAREA statement, and can be used only once in a DCCURENTDENSITY
statement.
Syntax
int lefwLayerDCTableEntries(
int numEntries,
double* entries)
Arguments
numEntries
Specifies the number of table entry values.
entries
Specifies the maximum current density for each specified cut area, in milliamps per
square micron.
lefwLayerEnclosure
Writes an ENCLOSURE statement for a cut layer. The ENCLOSURE statement is optional and
can be used more than once in a LAYER section.
Syntax
lefwLayerEnclosure(
const char* location,
double overhang1,
double overhang2,
double width)
Arguments
location
Optional argument that specifies whether the overhang is required on the routing layers
above or below the cut layer. Specify "" to ignore this argument.
Value: ABOVE or BELOW
overhang1 overhang2
Specifies that any rectangle from this cut layer requires the routing layers to overhang by
overhang1 on two opposite sides, and by overhang2 on the other two opposite
sides.
width
Optional argument that specifies that the enclosure rule only applies when the width of
the routing layer is greater than or equal to width. Specify 0 to ignore this argument.
lefwLayerEnclosureLength
Writes an ENCLOSURE statement with a LENGTH keyword for a cut layer. This routine lets you
specify a minimum length instead of the width. The ENCLOSURE statement is optional and can
be used more than once in a LAYER section.
Syntax
int lefwLayerEnclosureLength(
const char* location,
double overhang1,
double overhang2,
double minLength)
Arguments
location
Optional argument that specifies whether the overhang is required on the routing layers
above or below the cut layer. If you don’t specify this argument, the rule applies to both
adjacent routing layers; specify "" to ignore this argument.
Value: ABOVE or BELOW
overhang1 overhang2
Overhange values. Any rectangle from this cut layer requires the routing layers to
overhang by overhang1 on two opposite sides, and by overhang2 on the other two
opposite sides.
minLength
Optional argument that specifies that the total length of the longest opposite-side
overhangs must be greater than or equal to minLength to make this enclosure valid.
The minLength is measured at the center of the cut. Specify 0 to ignore this argument.
lefwLayerEnclosureWidth
Writes an ENCLOSURE statement with an EXCEPTEXTRACUT keyword for a cut layer. This
routine is similar to lefwLayerEnclosure except that it lets you specify EXCEPTEXTRACUT.
The ENCLOSURE statement is optional and can be used more than once in a LAYER section.
Syntax
int lefwLayerEnclosureWidth(
const char* location,
double overhang1,
double overhang2,
double width,
double cutWithin)
Arguments
location
Optional argument that specifies whether the overhang is required on the routing layers
above or below the cut layer. If you don’t specify this argument, the rule applies to both
adjacent routing layers; specify "" to ignore this argument.
Value: ABOVE or BELOW
overhang1 overhang2
Overhange values. Any rectangle from this cut layer requires the routing layers to
overhang by overhang1 on two opposite sides, and by overhang2 on the other two
opposite sides.
width
Optional argument that specifies that the enclosure rule only applies when the width of
the routing layer is greater than or equal to width. Specify 0 to ignore this argument. If
you do not specify this argument, the enclosure rule applies to all widths (as if width
was 0).
cutWithin
Optional argument that sets the EXCEPTEXTRACUT cutWithin keyword. Specifies
that if there is another via cut less than or equal to cutWithin, then this ENCLOSURE
with WIDTH rule is ignored and the ENCLOSURE rules for minimum width wires are
applied to the via cuts instead. Specify 0 to ignore this argument.
lefwLayerPreferEnclosure
Writes a PREFERENCLOSURE statement for a cut layer. The PREFERENCLOSURE statement
is optional and can be used more than once in a LAYER section.
Note: The PREFERENCLOSURE statement specifies preferred enclosure rules that can
improve manufacturing yield, instead of enclosure rules that absolutely must be met
(ENCLOSURE statement).
Syntax
lefwLayerPreferEnclosure(
const char* location,
double overhang1,
double overhang2,
double width)
Arguments
location
Optional argument that specifies whether the overhang is required on the routing layers
above or below the cut layer. Specify "" to ignore this argument.
Value: ABOVE or BELOW
overhang1 overhang2
Specifies that any rectangle from this cut layer requires the routing layers to overhang by
overhang1 on two opposite sides, and by overhang2 on the other two opposite
sides. The overhang values must be equal to or larger than the overhang values in the
ENCLOSURE rule.
width
Optional argument that specifies that the enclosure rule only applies when the width of
the routing layer is greater than or equal to width. Specify 0 to ignore this argument.
lefwLayerResistancePerCut
Writes a RESISTANCE statement for the cut layer. The RESISTANCE statement is optional
and can be used only once in a LAYER section.
Syntax
lefwLayerResistancePerCut(
double resistance)
Arguments
resistance
Specifies the resistance per cut on this layer. LEF vias without their own specific
resistance value, or DEF vias from a via rule without a resistance per cut value, can use
this resistance value.
lefwLayerWidth
Writes a WIDTH statement for an implant or a cut layer. The WIDTH statement is optional and
can be used only once in a LAYER section.
Syntax
int lefwLayerWidth(
double minWidth)
Arguments
minWidth
Specifies the minimum width for the layer.
Layer Examples
The following example shows a callback routine with the type lefwLayerCbkType. This
example shows how to create a cut, masterslice, or overlap layer. For an example of a routing
layer, see the Layer (Routing) section.
int layerCB (lefwCallbackType_e type,
lefiUserData userData) {
int res;
double *current;
current = (double*)malloc(sizeof(double)*3);
return 0;}
Layer (Routing)
Routing layer routines write LAYER sections about routing layers. At least one LAYER section
is required in a LEF file, and more than one LAYER section is generally required to describe
a layout. For syntax information about the LAYER section for routing layers, see "Layer
(Routing)" in the LEF/DEF Language Reference.
You must begin and end a LEF LAYER section with the lefwStartLayerRouting and
lefwEndLayerRouting routines. The remaining routing layer routines defined in this
section must be included between these routines. You create one LAYER section for each
routing layer you need to define.
For examples of the routines described here, see “Routing Layer Examples” on page 185
In addition to the routines described in this section, you can include a PROPERTY statement
within a LAYER section. For more information about these routines, see “Property” on
page 224.
lefwStartLayerRouting
Starts the LAYER section. The LEF writer automatically writes the TYPE ROUTING statement.
This routine is required to define a routing layer and can be used more than once. Each
routing layer must be defined by a separate lefwStartLayerRouting,
lefwEndLayerRouting routine pair.
Syntax
int lefwStartLayerRouting(
const char* layerName)
Arguments
layerName
Specifies the name of the routing layer being defined.
lefwEndLayerRouting
Ends the LAYER section for the specified routing layer.
Syntax
int lefwEndLayerRouting(
const char* layerName)
lefwDensityCheckStep
Writes a DENSITYCHECKSTEP statement. The DENSITYCHECKSTEP statement is optional
and can be used only once in a LAYER section.
Syntax
int lefwDensityCheckStep(
double stepValue)
Arguments
stepValue
Specifies the stepping distance for metal density checks, in distance units.
lefwDensityCheckWindow
Writes a DENSITYCHECKWINDOW statement. The DENSITYCHECKWINDOW statement is
optional and can be used only once in a LAYER section.
Syntax
int lefwDensityCheckWindow(
double windowLength,
double windowWidth)
Arguments
windowLength
Specifies the length of the check window, in distance units.
windowWidth
Specifies the width of the check window, in distance units.
lefwFillActiveSpacing
Writes a FILLACTIVESPACING statement. The FILLACTIVESPACING statement is optional
and can be used only once in a LAYER section.
Syntax
int lefwFillActiveSpacing(
double spacing)
Arguments
spacing
Specifies the spacing between metal fills and active geometries.
lefwLayerACCurrentDensity
Writes an ACCURRENTDENSITY statement. The ACCURENTDENSITY statement is optional
and can be used only once in a LAYER section.
Syntax
int lefwLayerACCurrentDensity(
const char* type,
double value)
Arguments
type
Specifies the type of AC current limit.
Value: PEAK, AVERAGE, or RMS
value
Specifies a maximum current for the layer, in milliamps per micron. If you specify 0, you
must specify the lefwLayerACFrequency and lefwLayerACTableEntries
routines.
lefwLayerACFrequency
Writes a FREQUENCY statement. The FREQUENCY statement is required if you specify a value
of 0 in the lefwLayerACCurrentDensity routine, and can be used only once in an
ACCURENTDENSITY statement.
Syntax
int lefwLayerACFrequency(
int numFrequency,
double* frequency)
Arguments
numFrequency
Specifies the number of frequency values.
frequency
Specifies the frequency values, in megahertz.
lefwLayerACTableEntries
Writes a TABLEENTRIES statement. The TABLENTRIES statement is required if you specify
a FREQUENCY statement, and can be used only once in an ACCURENTDENSITY statement.
Syntax
int lefwLayerACTableEntries(
int numEntries,
double* entries)
Arguments
numEntries
Specifies the number of table entry values.
entries
Specifies the maximum current for each of the frequency and width pairs specified in the
FREQUENCY and WIDTH statements, in milliamps per micron.
lefwLayerACWidth
Writes a WIDTH statement. The WIDTH statement is optional if you specify a FREQUENCY
statement, and can be used only once in an ACCURENTDENSITY statement.
Syntax
int lefwLayerACWidth(
int numWidths,
double* widths)
Arguments
numWidths
Specifies the number of width values.
widths
Specifies the wire width values, in microns.
lefwLayerAntennaAreaDiffReducePwl
Writes an ANTENNAAREADIFFREDUCEPWL statement for a routing or cut layer. The
ANTENNAAREADIFFREDUCEPWL statement is optional and can be used once after each
lefwLayerAntennaModel routine in a LAYER section.
Syntax
int lefwLayerAntennaAreaDiffReducePwl(
int numPwls,
double* diffAreas,
double* metalDiffFactors)
Arguments
numPwls
Specifies the number of diffusion area and metalDiffFactor pairs.
diffAreas
Specifies the diffArea values. The values are floating points, specified in microns
squared. They should start with 0 and monotonically increase in value to the maximum
size diffArea expected.
metalDiffFactors
Specifies the metalDiffFactor values. The values are floating points with no units
and are normally between 0.0 and 1.0.
lefwLayerAntennaAreaFactor
Writes an ANTENNAAREAFACTOR statement. The ANTENNAAREAFACTOR statement is
optional and can be used once after each lefwAntennaModel routine in a LAYER section.
Syntax
int lefwLayerAntennaAreaFactor(
double value
const char* diffUseOnly)
Arguments
value
Specifies the adjust or multiply factor for the antenna metal calculation.
diffUseOnly
Optional argument that specifies the current antenna factor should be used only when
the corresponding layer is connected to the diffusion. Specify NULL to ignore this
argument.
lefwLayerAntennaAreaMinusDiff
Writes an ANTENNAAREAMINUSDIFF statement for a routing or cut layer. The
ANTENNAAREAMINUSDIFF statement is optional and can be used once after each
lefwLayerAntennaModel routine in a LAYER section.
Syntax
int lefwLayerAntennaAreaMinusDiff(
double minusDiffFactor)
Arguments
minusDiffFactor
Specifies the diffusion area. The antenna ratio metal area will subtract the diffusion area
connected to it. minusDiffFactor is a floating point value and defaults to 0.0.
lefwLayerAntennaAreaRatio
Writes the ANTENNAAREARATIO statement. The ANTENNAREARATIO statement is optional
and can be used once after each lefwAntennaModel routine in a LAYER section.
Syntax
int lefwLayerAntennaAreaRatio(
double value)
Arguments
value
Specifies the antenna ratio, using the bottom area of the metal wire that is not connected
to the diffusion diode.
lefwLayerAntennaCumAreaRatio
Writes an ANTENNACUMAREARATIO statement. The ANTENNACUMAREARATIO statement is
optional and can be used once after each lefwAntennaModel routine in a LAYER section.
Syntax
int lefwLayerAntennaCumAreaRatio(
double value)
Arguments
value
Specifies the cumulative antenna ratio, using the bottom area of the metal wire that is not
connected to the diffusion diode.
lefwLayerAntennaCumDiffAreaRatio
Writes an ANTENNACUMDIFFAREARATIO statement. The ANTENNACUMDIFFAREARATIO
statement is optional and can be used once after each lefwAntennaModel routine in a
LAYER section. If you specify this routine, you cannot specify
lefwLayerAntennaCumDiffAreaRatioPWL in the same LAYER section.
Syntax
int lefwLayerAntennaCumDiffAreaRatio(
double value)
Arguments
value
Specifies the cumulative antenna ratio, using the bottom area of the metal wire that is
connected to the diffusion diode.
lefwLayerAntennaCumDiffAreaRatioPwl
Writes an ANTENNACUMDIFFAREARATIOPWL statement. The
ANTENNACUMDIFFAREARATIOPWL statement is optional and can be used once after each
lefwAntennaModel routine in a LAYER section. If you specify this routine, you cannot
specify lefwLayerAntennaCumDiffAreaRatio in the same LAYER section.
Syntax
int lefwLayerAntennaCumDiffAreaRatioPwl(
int numPwls,
double diffusions,
double ratios)
Arguments
numPwls
Specifies the number of diffusion-ratio pairs.
diffusions
Specifies the diffusion values.
ratios
Specifies the ratio values.
lefwLayerAntennaCumDiffSideAreaRatio
Writes an ANTENNACUMDIFFSIDEAREARATIO statement. The
ANTENNACUMDIFFSIDEAREARATIO statement is optional and can be used once after each
lefwAntennaModel routine in a LAYER section. If you specify this routine, you cannot
specify lefwLayerAntennaCumDiffSideAreaRatioPWL in the same LAYER section.
Syntax
int lefwLayerAntennaCumDiffSideAreaRatio(
double value)
Arguments
value
Specifies the cumulative antenna ratio, using the side wall area of the metal wire that is
connected to the diffusion diode.
lefwLayerAntennaCumDiffSideAreaRatioPwl
Writes an ANTENNACUMDIFFSIDEAREARATIOPWL statement. The
ANTENNACUMDIFFSIDEAREARATIOPWL statement is optional and can be used once after
each lefwAntennaModel routine in a LAYER section. If you specify this routine, you cannot
specify lefwLayerAntennaCumDiffSideAreaRatio in the same LAYER section.
Syntax
int lefwLayerAntennaCumDiffSideAreaRatioPwl(
int numPwls,
double diffusions,
double ratios)
Arguments
numPwls
Specifies the number of diffusion-ratio pairs.
diffusions
Specifies the diffusion values.
ratios
Specifies the ratio values.
lefwLayerAntennaCumSideAreaRatio
Writes an ANTENNACUMSIDEAREARATIO statement. The ANTENNACUMSIDEAREARATIO
statement is optional and can be used once after each lefwAntennaModel routine in a
LAYER section.
Syntax
int lefwAntennaCumSideAreaRatio(
double value)
Arguments
value
Specifies the cumulative antenna ratio, using the side wall area of the metal wire that is
not connected to the diffusion diode.
lefwLayerAntennaCumRoutingPlusCut
Writes an ANTENNACUMROUTINGPLUSCUT statement for a routing or cut layer. The
ANTENNACUMROUTINGPLUSCUT statement is optional and can be used once after each
lefwLayerAntennaModel routine in a LAYER section.
Syntax
int lefwLayerAntennaCumRoutingPlusCut()
lefwLayerAntennaDiffAreaRatio
Writes an ANTENNADIFFAREARATIO statement. The ANTENNADIFFAREARATIO statement
is optional and can be used once after each lefwAntennaModel routine in a LAYER section.
If you specify this routine, you cannot specify lefwLayerAntennaDiffAreaRatioPWL in
the same LAYER section.
Syntax
int lefwAntennaDiffAreaRatio(
double value)
Arguments
value
Specifies the antenna ratio, using the bottom area of the wire that is connected to the
diffusion diode.
lefwLayerAntennaDiffAreaRatioPwl
Writes an ANTENNADIFFAREARATIOPWL statement. The ANTENNADIFFAREARATIOPWL
statement is optional and can be used once after each lefwAntennaModel routine in a
LAYER section. If you specify this routine, you cannot specify
lefwLayerAntennaDiffAreaRatio in the same LAYER section.
Syntax
int lefwAntennaDiffAreaRatioPWL(
int numPwls,
double diffusions,
double ratios)
Arguments
numPwls
Specifies the number of diffusion-ratio pairs.
diffusions
Specifies the diffusion values.
ratios
Specifies the ratio values.
lefwLayerAntennaDiffSideAreaRatio
Writes an ANTENNADIFFSIDEAREARATIO statement. The ANTENNADIFFSIDEAREARATIO
statement is optional and can be used once after each lefwAntennaModel routine in a
LAYER section. If you specify this routine, you cannot specify
lefwLayerAntennaDiffSideAreaRatioPwl in the same LAYER section.
Syntax
int lefwLayerAntennaDiffSideAreaRatio(
double value)
Arguments
value
Specifies the antenna ratio, using the side wall area of the wire that is connected to the
diffusion diode.
lefwLayerAntennaDiffSideAreaRatioPwl
Writes an ANTENNADIFFSIDEAREARATIOPWL statement. The
ANTENNADIFFSIDEAREARATIOPWL statement is optional and can be used once after each
lefwAntennaModel routine in a LAYER section. If you specify this routine, you cannot
specify lefwLayerAntennaDiffSideAreaRatio in the same LAYER section.
Syntax
int lefwLayerAntennaDiffSideAreaRatioPwl(
int numPwls,
double diffusions,
double ratios)
Arguments
numPwls
Specifies the number of diffusion-ratio pairs.
diffusions
Specifies the diffusion values.
ratios
Specifies the ratio values.
lefwLayerAntennaGatePlusDiff
Writes an ANTENNAGATEPLUSDIFF statement for a routing or cut layer. The
ANTENNAGATEPLUSDIFF statement is optional and can be used once after each
lefwLayerAntennaModel routine in a LAYER section.
Syntax
int lefwLayerAntennaGatePlusDiff(
double plusDiffFactor)
Arguments
plusDiffFactor
Specifies that the antenna ratio gate area should include the diffusion area multiplied by
plusDiffFactor. minusDiffFactor is a floating point value.
lefwLayerAntennaModel
Writes an ANTENNAMODEL statement. The ANTENNAMODEL statement is optional and can be
used more than once in a LAYER section.
Syntax
int lefwLayerAntennaModel(
const char* oxide)
Arguments
oxide
Specifies the oxide model for the layer. Each model can be specified once per layer. If
you specify an ANTENNAMODEL statement, that value affects all ANTENNA* statements
for the layer that follow it until you specify another ANTENNAMODEL statement.
Value: OXIDE1, OXIDE2, OXIDE3, or OXIDE4
Note: OXIDE1 and OXIDE2 are currently supported. If you specify OXIDE3 or
OXIDE4, current tools parse and ignore them.
lefwLayerAntennaSideAreaFactor
Writes an ANTENNASIDEAREAFACTOR statement. The ANTENNASIDEAREAFACTOR
statement is optional and can be used once after each lefwAntennaModel routine in a
LAYER section.
Syntax
int lefwLayerAntennaSideAreaFactor(
double value
const char* diffUseOnly)
Arguments
value
Specifies the adjust or multiply factor for the antenna metal calculation.
diffUseOnly
Optional argument that specifies that the current antenna factor should only be used
when the corresponding layer is connected to the diffusion. Specify NULL to ignore this
argument.
lefwLayerAntennaSideAreaRatio
Writes an ANTENNASIDEAREARATIO statement. The ANTENNASIDEAREARATIO statement
is optional and can be used once after each lefwAntennaModel routine in a LAYER section.
Syntax
int lefwLayerAntennaSideAreaFactor(
double value)
Arguments
value
Specifies the antenna ratio, using the side wall area of the wire that is not connected to
the diffusion diode.
lefwLayerDCCurrentDensity
Writes the DCCURRENTDENSITY statement. The DCCURENTDENSITY statement is optional
and can be used only once in a LAYER section.
Syntax
int lefwLayerDCCurrentDensity(
const char* type,
double value)
Arguments
type
Specifies the DC current limit, AVERAGE.
value
Specifies the current limit for the layer, in milliamps per micron. If you specify 0, you must
specify the lefwLayerDCWidth and lefwLayerDCTableEntries routines.
lefwLayerDCTableEntries
Writes a TABLEENTRIES statement. The TABLENTRIES statement is required if you specify
a WIDTH statement, and can be used only once in a DCCURENTDENSITY statement.
Syntax
int lefwLayerDCTableEntries(
int numEntries,
double* entries)
Arguments
numEntries
Specifies the number of table entry values.
entries
Specifies the value of current density for each specified width, in milliamps per micron.
lefwLayerDCWidth
Writes a WIDTH statement. The WIDTH statement is required if you specify a value of 0 in the
lefwLayerDCCurrentDensity routine, and can be used only once in a
DCCURENTDENSITY statement.
Syntax
int lefwLayerDCWidth(
int numWidths,
double* widths)
Arguments
numWidths
Specifies the number of width values.
widths
Specifies the wire width values, in microns.
lefwLayerRouting
Writes the DIRECTION and WIDTH statements for a LAYER section. The DIRECTION and
WIDTH statements are required and can be used only once in a LAYER section.
Syntax
int lefwLayerRouting(
const char* direction,
double width)
Arguments
direction
Specifies the preferred routing direction.
Value: Specify one of the following:
width
Specifies the default routing width to use for all regular wiring on the layer.
lefwLayerRoutingArea
Writes an AREA statement. The AREA statement is optional and can be used only once in a
LAYER section.
Syntax
int lefwLayerRoutingArea (
double area)
Arguments
area
Specifies the minimum metal area required for polygons on the layer, in distance units
squared. All polygons must have an area that is greater than or equal to area, if no
MINSIZE rule (lefwLayerRoutingMinsize) is specified. If a MINSIZE rule exists, all
polygons must meet either the MINSIZE or the AREA rule.
lefwLayerRoutingCapacitance
Writes a CAPACITANCE CPERSQDIST statement. The CAPACITANCE CPERSQDIST
statement is optional and can be used only once in a LAYER section.
Syntax
int lefwLayerRoutingCapacitance(
const char* capacitance)
Arguments
capacitance
Specifies the capacitance for each square unit, in picofarads per square micron.
lefwLayerRoutingCapMultiplier
Writes the CAPMULTIPLIER statement. The CAPMULTIPLIER statement is optional and can
be used only once in a LAYER section.
Syntax
int lefwLayerRoutingCapMultiplier(
double capMultiplier)
Arguments
capMultiplier
Specifies the multiplier for interconnect capacitance to account for increases in
capacitance caused by nearby wires.
lefwLayerRoutingDiagMinEdgeLength
Writes a DIAGMINEDGELENGTH statement. The DIAGMINEDGELENGTH statement is optional
and can be used only once in a LAYER section.
Syntax
lefwLayerRoutingDiagMinEdgeLength(
double diagLength)
Arguments
diagLength
Specifies the minimum length for a diagonal edge. Any 45-degree diagonal edge must
have a length that is greater than or equal to diagLength.
lefwLayerRoutingDiagPitch
Writes a DIAGPITCH statement that contains one pitch value that is used for both the
45-degree angle and 135-degree angle directions. The DIAGPITCH statement is optional and
can only be used once in a LAYER section. If you specify this routine, you cannot specify the
lefwLayerRoutingDiagPitchXYDistance routine.
Syntax
lefwLayerRoutingDiagPitch(
double distance)
Arguments
distance
Specifies the 45-degree routing pitch for the layer.
lefwLayerRoutingDiagPitchXYDistance
Writes a DIAGPITCH statement that contains separate values for the 45-degree angle and
135-degree angle directions. The DIAGPITCH statement is optional and can only be used
once in a LAYER section. If you specify this routine, you cannot specify the
lefwLayerRoutingDiagPitch routine.
Syntax
lefwLayerRoutingDiagPitchXYDistance(
double diag45Distance,
double diag135Distance)
Arguments
diag45Distance
Specifies the 45-degree angle pitch (the center-to-center space between 45-degree
angle routes).
diag135Distance
Specifies the 135-degree angle pitch.
lefwLayerRoutingDiagSpacing
Writes a DIAGSPACING statement. The DIAGSPACING statement is optional and can be
used only once in a LAYER section.
Syntax
lefwLayerRoutingDiagSpacing(
double diagSpacing)
Arguments
diagSpacing
Specifies the minimum spacing allowed for a 45-degree angle shape.
lefwLayerRoutingDiagWidth
Writes a DIAGWIDTH statement. The DIAGWIDTH statement is optional and can be used only
once in a LAYER section.
Syntax
lefwLayerRoutingDiagWidth(
double diagWidth)
Arguments
diagWidth
Specifies the minimum width allowed for a 45-degree angle shape.
lefwLayerRoutingEdgeCap
Writes an EDGECAPACITANCE statement. The EDGECAPACITANCE statement is optional and
can be used only once in a LAYER section.
Syntax
int lefwLayerRoutingEdgeCap(
double edgeCap)
Arguments
edgeCap
Specifies a floating-point value of peripheral capacitance, in picoFarads per micron.
lefwLayerRoutingHeight
Writes a HEIGHT statement. The HEIGHT statement is optional and can be used only once
in a LAYER section.
Syntax
int lefwLayerRoutingHeight(
double height)
Arguments
height
Specifies the distance from the top of the ground plane to the bottom of the interconnect.
lefwLayerRoutingMaxwidth
Writes a MAXIMUMWIDTH statement. The MAXIMUMWIDTH statement is optional and can be
used only once in a LAYER section.
Syntax
int lefwLayerRoutingMaxwidth(
double width)
Arguments
width
Specifies the maximum width a wire on the layer can have.
lefwLayerRoutingMinenclosedarea
Writes a MINENCLOSEDAREA statement. The MINENCLOSEDAREA statement is optional and
can be used more than once in a LAYER section.
Syntax
int lefwLayerRoutingMinenclosedarea(
int numMinenclosed,
double* area,
double* width)
Arguments
numMinenclosed
Specifies the number of values defined in the routine.
area
Specifies the minimum area size of a hole enclosed by metal. You can specify one or
more values.
width
Optional argument that applies the minimum area size limit only when the hole is created
from a wire that has a width that is less than or equal to width. You can specify one or
more values.
lefwLayerRoutingMinimumcut
Writes a MINIMUMCUT statement. The MINIMUMCUT statement is optional and can be used
more than once in a LAYER section.
Syntax
int lefwLayerRoutingMinimumcut(
double numCuts,
double minWidth)
Arguments
numCuts
Specifies the number of cuts a via must have when it is on a wide wire or pin whose width
is greater than minWidth.
minWidth
Specifies the minimum width of the wire or pin.
lefwLayerRoutingMinimumcutConnections
Writes a FROMABOVE or FROMBELOW statement. This statement is optional and can be used
only once after each lefwLayerRoutingMinimumcut routine.
Syntax
int lefwLayerRoutingMinimumcutConnections(
const char* direction)
Arguments
direction
Specifies the MINIMUMCUT statement applies only to connections from above the layer
or from below the layer.
Value: FROMABOVE or FROMBELOW
lefwLayerRoutingMinimumcutLengthWithin
Writes a LENGTH statement. This statement is optional and can be used only once after each
lefwLayerRoutingMinimumcut routine.
Syntax
int lefwLayerRoutingMinimumcutLengthWithin(
double length,
double distance)
Arguments
distance
Applies the minimum cut rule to thin wires directly connected to wide wires, if the vias on
the thin wires are less than distance from the wide wire, and the wide wire has a
length that is greater than length.
length
Specifies the minimum length of the wide wire.
lefwLayerRoutingMinimumcutWithin
Writes a MINIMUMCUT statement with a WITHIN keyword. This routine is similar to the
lefwLayerRoutingMinimumcut routine, except that it lets you specify a WITHIN value.
The MINIMUMCUT statement is optional and can be used only once in a LAYER section.
Syntax
int lefwLayerRoutingMinimumcutWithin(
double numCuts,
double minWidth,
double cutDistance)
Arguments
numCuts
Specifies the number of cuts a via must have when it is on a wide wire or pin whose width
is greater than minWidth.
minWidth
Specifies the minimum width of the wire or pin.
cutDistance
Specifies that numCuts via cuts must be less than cutDistance from each other to
be counted together to meet the minimum cut rule.
lefwLayerRoutingMinsize
Writes a MINSIZE statement. The MINSIZE statement is optional and can be used only once
in a LAYER section.
Syntax
lefwLayerRoutingMinsize(
int numRect,
double* minWidth,
double* minLength)
Arguments
numRect
Specifies the number of rectangles defined.
minWidth minLength
Specifies the minimum width and length values for a rectangle that must be able to fit
somewhere within each polygon on this layer. All polygons must meet this MINSIZE rule,
if no AREA rule is specified (lefwLayerRoutingArea). If an AREA rule is specified, all
polygons must meet either the MINSIZE or the AREA rule.
lefwLayerRoutingMinstep
Writes a MINSTEP statement. The MINSTEP statement is optional and can be used more than
once in a LAYER section.
Syntax
int lefwLayerRoutingMinstep(
double distance)
Arguments
distance
Specifies the minimum step size, or shortest edge length, for a shape.
lefwLayerRoutingMinstepMaxEdges
Writes a MINSTEP statement. This routine is similar to lefwLayerRoutingMinstep,
except that it lets you specify the MAXEDGES option. The MINSTEP statement is optional and
can be called only once after lefwStartLayerRouting.
Syntax
int lefwLayerRoutingMinstepMaxEdges(
double distance,
double maxEdges)
Arguments
distance
Specifies the minimum step size, or shortest edge length, for a shape.
maxEdges
Specifies the maximum consecutive edges.
lefwLayerRoutingMinstepWithOptions
Writes a MINSTEP statement that contains rule type and total edge length values. The
MINSTEP statement is optional and can be more than once in a LAYER section.
Syntax
lefwLayerRoutingMinstepWithOptions(
double distance,
const char* rule,
double maxLength)
Arguments
distance
Specifies the minimum step size, or shortest edge length, for a shape.
rule
Indicates to which consecutive edges the MINSTEP rule applies. A DRC violation occurs
if one or more consecutive edges of the specified type are less than distance. There
can only be one rule of each type per layer.
Value: Specify one of the following:
maxLength
Specifies the maximum total edge length allowed that OPC can correct without causing
new DRC violations. A violation only occurs if the total length of consecutive edges that
are less than distance is greater than maxLength.
lefwLayerRoutingMinwidth
Writes a MINWIDTH statement. The MINWIDTH statement is optional and can be used only
once in a LAYER section.
Syntax
int lefwLayerRoutingMinwidth(
double width)
Arguments
width
Specifies the minimum legal object width on the routing layer, in microns.
lefwLayerRoutingOffset
Writes an OFFSET statement that contains one value for both the x and y offsets. The OFFSET
statement is optional and can be used only once in a LAYER section. If you specify this
routine, you cannot specify the lefwLayerRoutingOffsetXYDistance routine.
Syntax
int lefwLayerRoutingOffset(
double offset)
Arguments
offset
Specifies the offset, from the origin (0,0) for the routing grid for the layer.
lefwLayerRoutingOffsetXYDistance
Writes an OFFSET statement that contains separate values for the x and y offsets. The
OFFSET statement is optional and can be used only once in a LAYER section. If you specify
this routine, you cannot specify the lefwLayerRoutingOffset routine.
Syntax
lefwLayerRoutingOffsetXYDistance(
double xDistance,
double yDistance)
Arguments
xDistance
Specifies the x offset for vertical routing tracks.
yDistance
Specifies the y offset for horizontal routing tracks.
lefwLayerRoutingPitch
Writes a PITCH statement that contains one pitch value that is used for both the x and y pitch.
The PITCH statement is required and can be used only once in a LAYER section. If you
specify this routine, you cannot specify the lefwLayerRoutingPitchXYDistance
routine.
Syntax
int lefwLayerRoutingPitch(
double pitch)
Arguments
pitch
Specifies the routing pitch for the layer.
lefwLayerRoutingPitchXYDistance
Writes a PITCH statement that contains separate values for the x and y pitch. The PITCH
statement is required and can be used only once in a LAYER section. If you specify this
routine, you cannot specify the lefwLayerRoutingPitch routine.
Syntax
lefwLayerRoutingPitchXYDistance(
double xDistance,
double yDistance)
Arguments
xDistance
Specifies the x pitch (that is , the space between each vertical routing track).
yDistance
Specifies the y pitch (that is, the space between each horizontal routing track).
lefwLayerRoutingProtrusion
Writes a PROTRUSION statement. The PROTRUSION statement is optional and can be used
only once in a LAYER section.
Syntax
int lefwLayerRoutingProtrusion(
double width1,
double length,
double width2)
Arguments
length
Specifies the maximum length of a protrusion.
width1
Specifies the minimum width of a protrusion.
width2
Specifies the minimum width of the wire to which the protrusion is connected.
lefwLayerRoutingResistance
Writes a RESISTANCE RPERSQ statement. The RESISTANCE RPERSQ statement is optional
and can be used only once in a LAYER section.
Syntax
int lefwLayerRoutingResistance(
const char* resistance)
Arguments
resistance
Specifies the resistance for a square of wire, in ohms per square micron.
lefwLayerRoutingShrinkage
Writes a SHRINKAGE statement. The SHRINKAGE statement is optional and can be used only
once in a LAYER section.
Syntax
int lefwLayerRoutingShrinkage(
double shrinkage)
Arguments
shrinkage
Specifies the value to account for shrinkage of interconnect wiring because of the etching
process. Actual wire widths are determined by subtracting this constant value.
lefwLayerRoutingSpacing
Writes a SPACING statement. The SPACING statement is optional and can be used more than
once in a LAYER section.
Note: You must use either this routine or the
lefwLayerRoutingStartSpacingtableParallel routine for all LAYER sections.
Syntax
int lefwLayerRoutingSpacing(
double Spacing)
Arguments
Spacing
Specifies the minimum spacing allowed between two regular geometries on different
nets, also known as the different-net spacing rule.
lefwLayerRoutingSpacingEndOfLine
Writes an ENDOFLINE statement. The ENDOFLINE statement is optional and can be used
only once after a SPACING statement.
Syntax
int lefwLayerRoutingSpacingEndOfLine(
double eolWidth,
double eolWithin)
Arguments
eolWidth
Specifies the end-of-line width. An end-of-line with a width less than eolWidth requires
spacing greater than or equal to eolSpace beyond the end of the line anywhere within
eolWIthin distance.
eolWithin
The eolWithin distance. This value must be smaller than the minimum allowed
spacing.
lefwLayerRoutingSpacingEOLParallel
Writes a PARALLELEDGE statement. The PARALLELEDGE statement is optional and can be
used only once after a SPACING statement.
Syntax
int lefwLayerRoutingSpacingEOLParallel(
double parSpace,
double parWithin,
int twoEdges)
Arguments
parSpace
Specifies the parSpace value. The end-of-line rule applies only if there is a parallel
edge less than parSpace away that is also less than parWithin from the end.
parWithin
Specifies the parWithin value.
twoEdges
Optional argument that writes the TWOEDGES keyword, which specifies that the end-of-
line rule applies only if there are two parallel edges that meet the PARALLELEDGE
parSpace and parWithin parameters. Specify 0 to ignore this argument.
lefwLayerRoutingSpacingEndOfNotchWidth
Writes an ENDOFNOTCHWIDTH statement. The ENDOFNOTCHWIDTH statement is optional and
can be used only once after a SPACING statement.
Syntax
int lefwLayerRoutingSpacingEndOfNotchWidth(
double eonWidth,
double minNSpacing,
double minNLength)
Arguments
eonWidth
Specifies the end-of-notch width.
minNSpacing
Specifies the minimum notch spacing.
minNLength
Specifies the minimum notch length.
lefwLayerRoutingSpacingLengthThreshold
Writes a LENGTHTHRESHOLD statement. The LENGTHTHRESHOLD statement is optional and
can be used only once after a lefwLayerRoutingSpacing routine. If you specify this
routine, you cannot specify the lefwLayerRoutingSpacingRange or
lefwLayerRoutingSamenet routines.
Syntax
int lefwLayerRoutingSpacingLengthThreshold(
double lengthValue,
double minWidth,
double maxWidth)
Arguments
lengthValue
Specifies the maximum parallel run length or projected length with an adjacent metal
object.
minWidth, maxWidth
Optional arguments that specify a width range. If you specify a range, the threshold
spacing rule applies to all objects with widths that are greater than or equal to
minWidth and less than or equal to maxWidth.
lefwLayerRoutingSpacingNotchLength
Writes a NOTCHLENGTH statement. The NOTCHLENGTH statement is optional and can be
used only once after lefwStartLayerRouting.
Syntax
int lefwLayerRoutingSpacingNotchLength(
double minNLength)
Arguments
minNLength
Specifies the minimum notch length. Any notch with notch length less than
minNLength must have a notch spacing greater than or equal to the minimum spacing.
The value you specify must be only slightly larger than the normal minimum spacing (for
example, between 1x or 2x minimum spacing).
lefwLayerRoutingSpacingRange
Writes a RANGE statement. The RANGE statement is optional and can be used only once after
a lefwLayerRoutingSpacing routine. If you specify this routine, you cannot specify the
lefwLayerRoutingSpacingLengthThreshold or lefwLayerRoutingSameNet
routines.
Syntax
int lefwLayerRoutingSpacingRange(
double minWidth,
double maxWidth)
Arguments
minWidth, maxWidth
Specifies a width range. If you specify a range, the minimum spacing rule applies to all
wires on the layer with widths that are greater than or equal to minWidth and less than
or equal to maxWidth.
lefwLayerRoutingSpacingRangeInfluence
Writes an INFLUENCE statement. The INFLUENCE statement is optional and can be used
only once after a lefwLayerRoutingSpacingRange routine. If you specify this routine,
you cannot specify the lefwLayerRoutingSpacingRangeUseLengthThreshold or
lefwLayerRoutingSpacingRangeRange routines in the same LAYER section.
Syntax
int lefwLayerRoutingSpacingRangeInfluence (
double infValue,
double stubMinWidth,
double stubMaxWidth)
Arguments
infValue
Specifies the area of the stub wire which inherits the spacing from a wide wire.
stubMinWidth, stubMaxWidth
Optional arguments that specify a wire width range. If you specify a range, the influence
spacing rule applies to all stub wires on the layer with widths that are greater than or
equal to stubMinWidth and less than or equal to stubMaxWidth.
lefwLayerRoutingSpacingRangeRange
Writes a second RANGE statement. The second RANGE statement is optional and can be used
only once after a lefwLayerRoutingSpacingRange routine. If you specify this routine,
you cannot specify the lefwLayerRoutingSpacingRangeInfluence or
lefwLayerRoutingSpacingRangeUseLengthThreshold routines in the same LAYER
section.
Syntax
int lefwLayerRoutingSpacingRangeRange(
double minWidth,
double maxWidth)
Arguments
minWidth, maxWidth
Specify a second width range. If you specify a second range, the minimum spacing rule
applies if the widths of both objects are greater than or equal to minWidth and less than
or equal to maxWidth (each object in a different range).
lefwLayerRoutingSpacingRangeUseLengthThreshold
Writes a USELENGTHTHRESHOLD statement. The USELENGTHTHRESHOLD statement is
optional and can be used only once after a lefwLayerRoutingSpacingRange routine. If
you specify this routine, you cannot specify the lefwLayerRoutingSpacingRangeRange
or lefwLayerRoutingSpacingRangeInfluence routines in the same LAYER section.
This routine is only valid if one or both of the range values in the
lefwLayerRoutingSpacingRange routine are not zero.
Syntax
int lefwLayerRoutingSpacingRangeUseLengthThreshold()
lefwLayerRoutingSpacingSameNet
Writes a SAMENET keyword for a SPACING statement. Only one of
lefwLayerRoutingSpacingSameNet, lefwLayerRoutingSpacingRange, or
lefwLayerRoutingSpacingLengthThreshold can be called once after
lefwLayerRoutingSpacing.
Syntax
int lefwLayerRoutingSpacingSameNet(
int PGOnly)
Arguments
PGOnly
Optional argument that specifies the PGONLY keyword. If this keyword is specified, the
minSpacing value only applies to same-net metal that is a power or ground net.
lefwLayerRoutingStartSpacingtableInfluence
Writes a SPACINGTABLE INFLUENCE statement. The SPACINGTABLE INFLUENCE
statement is optional and can be used only once after a
lefwLayerRoutingStartSpacingtableParallel routine.
Syntax
int lefwLayerRoutingStartSpacingtableInfluence()
lefwLayerRoutingStartSpacingInfluenceWidth
Writes a SPACINGTABLE INFLUENCE WIDTH statement. The SPACINGTABLE INFLUENCE
WIDTH statement is required if you specify the
lefwLayerRoutingStartSpacingtableInfluence routine, and can be used only
once in a LAYER section.
Syntax
int lefwLayerRoutingStartSpacingInfluenceWidth(
double width,
double distance,
double spacing)
Arguments
distance
Specifies an array of values that represent the distance between a wide wire and two
perpendicular wires.
spacing
Specifies an array of values that represent the spacing between the two perpendicular
wires.
width
Specifies an array of values that represent the width of the wide wire.
lefwLayerRoutingStartSpacingtableParallel
Writes a SPACINGTABLE PARALLELRUNLENGTH statement. The SPACINGTABLE
PARALLELRUNLENGTH statement is optional and can be used only once in a LAYER section.
Note: You must use either this routine or the lefwLayerRoutingSpacing routine for all
LAYER sections.
Syntax
int lefwLayerRoutingStartSpacingtableParallel(
int numlength,
double* length)
Arguments
length
Specifies an array of values that represent the maximum parallel run length between two
wires.
numLength
Specifies the number of length values specified.
lefwLayerRoutingStartSpacingtableParallelWidth
Writes a SPACINGTABLE PARALLELRUNLENGTH WIDTH statement. The SPACINGTABLE
PARALLELRUNLENGTH WIDTH statement is required if you specify the
lefwLayerRoutingStartSpacingtableParallel routine, and can be used only once
in a LAYER section.
Syntax
int lefwLayerRoutingStartSpacingtableParallelWidth(
double width,
int numSpacing,
double* spacing)
Arguments
numSpacing
Specifies the number of spacing values specified.
spacing
Specifies an array of values that represent the spacing between the two wires.
width
Specifies and array of values that represent the maximum width of the two wires.
lefwLayerRoutingStartSpacingtableTwoWidths
Writes a SPACINGTABLE TWOWIDTHS statement. The SPACINGTABLE TWOWIDTHS
statement is optional and can be used multiple times in a LAYER section after the
lefwLayerRouting routine.
Syntax
int lefwLayerRoutingStartSpacingtableTwoWidths()
lefwLayerRoutingStartSpacingtableTwoWidthsWidth
Writes a SPACINGTABLE TWOWIDTHS WIDTH statement. This routine is required after a
lefwLayerRoutingStartSpacingtableTwoWidths routine.
Syntax
int lefwLayerRoutingSpacingtableTwoWidthsWidth(
double width,
double runLength,
int numSpacing,
double* spacing)
Arguments
width
The widths of the two objects.
runLength
Optional argument that specifies the parallel run length between the two objects. Specify
0 to ignore this argument.
numSpacing
Specifies the number of spacing values provided.
spacing
The spacing values that represent the spacing between two objects.
lefwLayerRoutingEndSpacingtable
Ends a SPACINGTABLE statement. This routine is required if you specify
lefwLayerRoutingStartSpacingtableParallel.
Syntax
int lefwLayerRoutineEndSpacingtable()
lefwLayerRoutingThickness
Writes a THICKNESS statement. The THICKNESS statement is optional and can be used only
once in a LAYER section.
Syntax
int lefwLayerRoutingThickness(
double thickness)
Arguments
thickness
Specifies the thickness of the interconnect.
lefwLayerRoutingWireExtension
Writes a WIREEXTENSION statement. The WIREEXTENSION statement is optional and can
be used only once in a LAYER section.
Syntax
int lefwLayerRoutingWireExtension(
double wireExtension)
Arguments
wireExtension
Specifies the distance by which wires are extended at vias. Enter 0 to specify no wire
extension. Values other than 0 must be more than half of the default routing width for the
layer.
lefwMaxAdjacentSlotSpacing
Writes a MAXADJACENTSLOTSPACING statement. The MAXADJACENTSLOTSPACING
statement is optional and can be used only once in a LAYER section.
Syntax
int lefwMaxAdjacentSlotSpacing(
double maxSpacing)
Arguments
maxSpacing
Specifies the maximum spacing, in distance units, allowed between two adjacent slot
sections.
lefwMaxCoaxialSlotSpacing
Writes a MAXCOAXIALSLOTSPACING statement. The MAXCOAXIALSLOTSPACING
statement is optional and can be used only once in a LAYER section.
Syntax
int lefwMaxCoaxialSlotSpacing(
double maxSpacing)
Arguments
maxSpacing
Specifies the maximum spacing, in distance units, allowed between two slots in the same
slot section.
lefwMaxEdgeSlotSpacing
Writes a MAXEDGESLOTSPACING statement. The MAXEDGESLOTSPACING statement is
optional and can be used only once in a LAYER section.
Syntax
int lefwMaxEdgeSlotSpacing(
double maxSpacing)
Arguments
maxSpacing
Specifies the maximum spacing, in distance units, allowed between slot edges.
lefwMaximumDensity
Writes a MAXIMUMDENSITY statement. The MAXIMUMDENSITY statement is optional and
can be used only once in a LAYER section.
Syntax
int lefwMaximumDensity(
double maxDensity)
Arguments
maxDensity
Specifies the maximum metal density allowed for the layer, as a percentage of its area.
lefwMinimumDensity
Writes a MINIMUMDENSITY statement. The MINIMUMDENSITY statement is optional and
can be used only once in a LAYER section.
Syntax
int lefwMinimumDensity(
double minDensity)
Arguments
minDensity
Specifies the minimum metal density allowed for the layer, as a percentage of its area.
lefwSlotLength
Writes a SLOTLENGTH statement. The SLOTLENGTH statement is optional and can be used
only once in a LAYER section.
Syntax
int lefwSlotLength(
double minSlotLength)
Arguments
minSlotLength
Specifies the minimum slot length, in distance units, allowed in the design.
lefwSlotWidth
Wries a SLOTWIDTH statement. The SLOTWIDTH statement is optional and can be used only
once in a LAYER section.
Syntax
int lefwSlotWidth(
double minSlotWidth)
Arguments
minSlotWidth
Specifies the minimum slot width, in distance units, allowed in the design.
lefwSlotWireLength
Writes a SLOTWIRELENGTH statement. The SLOTWIRELENGTH statement is optional and
can be used only once in a LAYER section.
Syntax
int lefwSlotWireLength(
double minWireLength)
Arguments
minWireLength
Specifies the minimum wire length, in distance units, allowed for wires that need to be
slotted.
lefwSlotWireWidth
Writes a SLOTWIREWIDTH statement. The SLOTWIREWIDTH statement is optional and can
be used only once in a LAYER section.
Syntax
int lefwSlotWireWidth(
double minWireWidth)
Arguments
minWireWidth
Specifies the minimum wire width, in distance units, allowed for wires that need to be
slotted.
lefwSplitWireWidth
Writes a SPLITWIREWIDTH statement. The SPLITWIREWIDTH statement is optional and
can be used only once in a LAYER section.
Syntax
int lefwSplitWireWidth(
double minWireWidth)
Arguments
minWireWidth
Specifies the minimum wire width, in distance units, allowed for wires that need to be
split.
...
res = lefwStartLayerRouting("M3");
CHECK_RES(res);
res = lefwLayerRouting("HORIZONTAL", 0.9);
CHECK_RES(res);
res = lefwLayerRoutingPitch(1.8);
CHECK_RES(res);
res = lefwLayerRoutingWireExtension(8);
CHECK_RES(res);
res = lefwLayerRoutingSpacing(0.9, 0, 0);
CHECK_RES(res);
res = lefwLayerRoutingResistance("0.0608");
CHECK_RES(res);
res = lefwLayerRoutingCapacitance("0.000184");
CHECK_RES(res);
res = lefwLayerACCurrentDensity("AVERAGE",0);
CHECK_RES(res);
current[0] = 1E6;
current[1] = 100E6;
current[2] = 400E6;
return 0;}
Macro
Macro routines write a LEF MACRO section. A MACRO section is optional and can be used
more than once in a LEF file. For syntax information about the LEF MACRO section, see
"Macro" in the LEF/DEF Language Reference.
You must begin and end a LEF MACRO section with the lefwStartMacro and
lefwEndMacro routines. The macroName value in the start and end routines identifies the
macro being defined. All LEF writer routines that define this macro must be included between
the lefwStartMacro and lefwEndMacro routines specifying that macro name.
For examples of the routines described here, see “Macro Examples” on page 195.
In addition to the routines described in this section, you can include an OBS, or PIN statement
within a MACRO section. For more information about these routines, see “Macro Obstruction”
on page 195, or “Macro Pin” on page 201.
You can also include a PROPERTY statement within a MACRO section. For more information
about these routines, see “Property” on page 224.
lefwStartMacro
Starts the MACRO section. This routine is required to begin each MACRO section.
Syntax
int lefwStartMacro(
const char* macroName)
Arguments
macroName
Specifies the name of the macro being defined.
lefwEndMacro
Ends the MACRO section for the specified macroName.
Syntax
int lefwEndMacro(
const char* macroName)
lefwMacroClass
Writes a CLASS statement. The CLASS statement is optional and can be used only once in a
MACRO section.
Syntax
int lefwMacroClass(
const char* value1,
const char* value2)
Arguments
value1
Specifies the macro type.
Value: COVER, RING, BLOCK, PAD, CORE, or ENDCAP
value2
Specifies a subtype for a macro type. If value1 is ENDCAP, you must specify this
argument. Otherwise, specify NULL to ignore this argument.
lefwMacroEEQ
Writes an EEQ statement. The EEQ statement is optional and can be used only once in a
MACRO section.
Syntax
int lefwMacroEEQ(
const char* macroName)
Arguments
macroName
Specifies that the macro being defined should be electrically equivalent to the previously
defined macroName.
lefwMacroForeign
Writes a FOREIGN statement. The FOREIGN statement is optional and can be used more than
once in a MACRO section.
Syntax
int lefwMacroForeign(
const char* cellName,
double xl,
double yl,
int orient)
Arguments
cellName
Specifies which foreign (GDSII) system name to use when placing an instance of this
macro.
xl yl
Optional arguments that specify the macro origin (lower left corner when the macro is in
north orientation) offset from the foreign origin. Specify 0 to ignore these arguments.
orient
Optional argument that specifies the orientation of the foreign cell when the macro is in
north orientation. Specify -1 to ignore this argument.
Value: 0 to 7. For more information, see “Orientation Codes” on page 21.
lefwMacroForeignStr
Also writes a FOREIGN statement. This routine is the same as the lefwMacroForeign
routine with the exception of the orient argument, which takes a string instead of an
integer. The FOREIGN statement is optional and can be used more than once in a MACRO
section.
Syntax
int lefwMacroForeignStr(
const char* cellName,
double xl,
double yl,
const char* orient)
Arguments
cellName
Specifies which foreign (GDSII) system name to use when placing an instance of this
macro.
xl yl
Optional arguments that specify the macro origin (lower left corner when the macro is in
north orientation) offset from the foreign origin. Specify 0 to ignore these arguments.
orient
Optional argument that specifies the orientation of the foreign cell when the macro is in
north orientation. Specify "" to ignore this argument.
Value: N, W, S, E, FN, FW, FS, or FE
lefwMacroOrigin
Writes an ORIGIN statement. The ORIGIN statement is optional and can be used only once
in a MACRO section.
Syntax
int lefwMacroOrigin(
double xl,
double yl)
Arguments
xl, yl
Specifies the origin of the macro. xl, yl is the lower left corner point of the macro. The
coordinates for macro sites, ports, and obstructions are specified with respect to the
macro origin. The origin itself is specified with respect to the lower left corner of the
bounding box of the sites of the macro.
lefwMacroSite
Writes a SITE statement. The SITE statement is optional and can be used more than once
in a MACRO section.
Syntax
int lefwMacroSite(
const char* siteName)
Arguments
siteName
Specifies the site associated with the macro.
lefwMacroSitePattern
Writes a SITE statement that includes a site pattern. The site pattern indicates that the cell
is a gate-array cell rather that a row-based standard cell. The SITE statement is optional and
can be used more than once in a MACRO section.
Syntax
lefwMacroSitePattern(
const char* name,
double origX,
double orgY,
int orient,
int numX,
int numY,
double spaceX,
double spaceY)
Arguments
name
Specifies the site associated with the macor.
origX origY
Optional arguments that specify the origin of the site inside the macro. Specify 0 to ignore
these arguments.
orient
Optional argument that specifies the orientation of the site at that location. Specify -1 to
ignore this argument.
Value: 0 to 7. For more information, see “Orientation Codes” on page 21.
numX numY
Optional arguments that specify the number of sites to add in the x and y directions.
Specify 0 to ignore these arguments.
spaceX spaceY
Optional arguments that specify the spacing between sites in the x and y directions.
Specify 0 to ignore these arguments.
lefwMacroSitePatternStr
Also writes a SITE statement that includes a site pattern. This routine is the same as the
lefwMacroSitePattern routine with the exception of the orient argument, which takes
a string instead of an integer. The SITE statement is optional and can be used more than
once in a MACRO section.
Syntax
lefwMacroSitePatternStr(
const char* name,
double origX,
double orgY,
int orient,
int numX,
int numY,
double spaceX,
double spaceY)
Arguments
name
Specifies the site associated with the macor.
origX origY
Optional arguments that specify the origin of the site inside the macro. Specify 0 to ignore
these arguments.
orient
Optional argument that specifies the orientation of the site at that location. Specify "" to
ignore this argument.
Value: N, W, S, E, FN, FW, FS, or FE
numX numY
Optional arguments that specify the number of sites to add in the x and y directions.
Specify 0 to ignore these arguments.
spaceX spaceY
Optional arguments that specify the spacing between sites in the x and y directions.
Specify 0 to ignore these arguments.
lefwMacroSize
Writes a SIZE statement. The SIZE statement is required and can be used only once in a
MACRO section.
Syntax
int lefwMacroSize(
double width,
double height)
Arguments
width, height
Specify the minimum bounding rectangle, in microns, for the macro. The bounding
rectangle should be a multiple of the placement grid.
lefwMacroSymmetry
Writes a SYMMETRY statement. The SYMMETRY statement is optional and can be used only
once in a MACRO section.
Syntax
int lefwMacroSymmetry(
const char* symmetry)
Arguments
symmetry
Specifies the allowable orientations for the macro.
Value: X, Y, or R90
lefwStartMacroDensity
Starts a DENSITY statement in the MACRO [Link] DENSITY statement is optional and
can be used only once in a MACRO statement.
Each DENSITY statement must start with this routine and end with the
lefwEndMacroDensity routine. Each DENSITY statement also must include at least one
lefwMacroDensityLayerRect routine.
Syntax
lefwStartMacroDensity(
const char* layerName)
Arguments
layerName
Specifies the layer on which to create the density rectangles.
lefwMacroDensityLayerRect
Writes a RECT statement in the DENSITY statement. The RECT statement is required and can
be used more than once in a DENSITY statement.
Syntax
lefwMacroDensityLayerRect(
double x1,
double y1,
double x2,
double y2,
double densityValue)
Arguments
x1 y1 x2 y2
Specifies the coordinates of a rectangle.
densityValue
Specifies the percentage density of the rectangle.
Value: 0 to 100
lefwEndMacroDensity
Ends the DENSITY statement.
Syntax
lefwEndMacroDensity()
Macro Examples
The following example shows a callback routine with the type lefwMacroCbkType. This
example shows function calls to create a macro. It does not include function calls to create a
macro obstruction. For an example of how to create a macro obstruction, see the Macro
Obstruction section. This example only shows the usage of some functions related to Macro.
int macroCB (lefwCallbackType_e type,
lefiUserData userData) {
int res;
double *xpath;
double *ypath;
res = lefwStartMacro("INV");
CHECK_RES(res);
res = lefwMacroClass("CORE", NULL);
CHECK_RES(res);
res = lefwMacroForeign("INVS", 0, 0, -1);
CHECK_RES(res);
res = lefwMacroPower(1.0);
CHECK_RES(res);
res = lefwMacroSize(67.2, 24);
CHECK_RES(res);
res = lefwMacroSymmetry("X Y R90");
CHECK_RES(res);
res = lefwMacroSite("CORE1");
CHECK_RES(res);
return 0;}
Macro Obstruction
Macro obstruction routines write an OBS (macro obstruction) section, which further defines a
macro. An OBS section is optional and can be used more than once in a MACRO section. For
syntax information about the LEF OBS section, see "Macro Obstruction Statement" in the
LEF/DEF Language Reference.
You must use the lefwStartMacroObs and lefwEndMacroObs routines to start and end
the OBS section. The remaining macro obstruction routines described in this section must be
included between these routines.
For examples of the routines described here, see “Macro Obstruction Examples” on
page 201.
lefwStartMacroObs
Starts the OBS section in a MACRO section. This routine is required for each OBS section, and
can be used more than once in a MACRO section.
Syntax
int lefwStartMacroObs()
lefwEndMacroObs
Ends the OBS section.
Syntax
int lefwEndMacroObs()
lefwMacroObsDesignRuleWidth
Writes a DESIGNRULEWIDTH statement. Either a LAYER statement, a DESIGNRULEWIDTH
statement, or a VIA statement must be defined within an OBS section and can be used more
than once.
Syntax
int lefwMacroObsDesignRuleWidth(
const char* layerName
double width)
Arguments
layerName
Specifies the layer on which the geometry lies.
width
Optional argument that specifies the effective design rule width. If specified, the
obstruction is treated as a shape of this width for all spacing checks. Specify 0 to ignore
this argument.
lefwMacroObsLayer
Writes a LAYER statement. Either a LAYER statement, a DESIGNRULEWIDTH statement, or a
VIA statement must be defined within an OBS section and can be used more than once.
Syntax
int lefwMacroObsLayer(
const char* layerName,
double spacing)
Arguments
layerName
Specifies the layer on which to place the obstruction.
spacing
Optional argument that specifies the minimum spacing allowed between this obstruction
and any other shape. Specify 0 to ignore this argument.
lefwMacroObsLayerPath
Writes a PATH statement. Either a PATH, POLYGON, or RECT statement must follow a LAYER
statement and can be used more than once.
Syntax
int lefwMacroObsLayerPath(
int num_paths,
double* xl,
double* yl,
int numX,
int numY,
double spaceX,
double spaceY)
Arguments
numPaths
Specifies the number of paths to create.
x1 y1
Creates a path between the specified points. The path automatically extends the length
by half of the current width on both end points to form a rectangle. (A previous WIDTH
statement is required.) The line between each pair of points must be parallel to the x or
y axis (45-degree angles are not allowed).
lefwMacroObsLayerPolygon
Writes a POLYGON statement. Either a PATH, POLYGON, or RECT statement must follow a
LAYER statement and can be used more than once.
Syntax
int lefwMacroObsLayerPolygon(
int num_polys,
double* xl,
double* yl,
int numX,
int numY,
double spaceX,)
double spaceY)
Arguments
num_polys
Specifies the number of polygon sides.
x1 y1
Specifies a sequence of points to generate a polygon geometry. Every polygon edge
must be parallel to the x or y axis, or at a 45-degree angle.
lefwMacroObsLayerRect
Writes a RECT statement. Either a PATH, POLYGON, or RECT statement must follow a LAYER
statement and can be used more than once.
Syntax
int lefwMacroObsLayerRect(
double xl1,
double yl1,
double xl2,
double yl2,
int numX,
int numY,)
double spaceX,
double spaceY)
Arguments
lefwMacroObsLayerWidth
Writes a WIDTH statement. The WIDTH statement is optional and can be used only once in
an LAYER section.
Syntax
int lefwMacroObsLayerWidth(
double width)
Arguments
width
Specifies the width that the PATH statements use.
lefwMacroObsVia
Writes a VIA statement. Either a LAYER statement, a DESIGNRULEWIDTH statement, or a
VIA statement must be defined within an OBS section and can be used more than once.
Syntax
int lefwMacroObsVia(
double xl,
double yl,
const char* viaName,
int numX,
int numY,
double spaceX,)
double spaceY)
Arguments
x1 y1
Specify the location to place the via.
viaName
Specifies the name of the via to place.
...
res = lefwStartMacroObs();
CHECK_RES(res);
res = lefwMacroObsLayer("M1", 0);
CHECK_RES(res);
res = lefwMacroObsLayerRect(24.1, 1.5, 43.5, 208.5, 0,
0, 0, 0);
CHECK_RES(res);
xpath = (double*)malloc(sizeof(double)*2);
ypath = (double*)malloc(sizeof(double)*2);
xpath[0] = 8.4;
ypath[0] = 3;
xpath[1] = 8.4;
ypath[1] = 124;
res = lefwMacroObsLayerPath(2, xpath, ypath, 0, 0, 0, 0);
CHECK_RES(res);
free((char*)xpath);
free((char*)ypath);
res = lefwEndMacroObs();
CHECK_RES(res);
...
return 0;}
Macro Pin
Macro Pin routines write a PIN section, which further defines a macro. A PIN section is
optional in each MACRO section and can be defined more than once in a MACRO section. For
syntax information about the LEF PIN section, see “Macro Pin Statement” in the LEF/DEF
Language Reference.
You must use the lefwStartMacroPin and lefwEndMacroPin routines to start and end
the PIN section. The remaining macro pin routines must be included between these routines.
For examples of the routines described here, see “Macro Pin Examples” on page 211.
In addition to the routines described in this section, you can include a PORT section within a
PIN section. For more information about these routines, see “Macro Pin Port” on page 211.
lefwStartMacroPin
Starts the PIN section in a MACRO section. This routine is required for each PIN section and
can be used more than once in a MACRO section.
Syntax
int lefwStartMacroPin(
const char* pinName)
Arguments
pinName
Specifies the name of the library pin.
lefwEndMacroPin
Ends the PIN section for the specified pin.
Syntax
int lefwEndMacroPin(
const char* pinName)
Arguments
pinName
Specifies the name of the library pin.
lefwMacroPinAntennaDiffArea
Writes an ANTENNADIFFAREA statement. The ANTENNADIFFAREA statement is optional and
can be used more than once in a PIN section.
Syntax
int lefwMacroPinAntennaDiffArea(
double value,
const char* layerName)
Arguments
value
Specifies the diffusion area, in micron-squared units, to which the pin is connected on a
layer.
layerName
Optional argument that specifies the layer. If you do not specify a layer name, value
applies to all layers. Specify NULL to ignore this argument.
lefwMacroPinAntennaGateArea
Writes an ANTENNAGATEAREA statement. The ANTENNAGATEAREA statement is optional and
can be used once after each lefwMacroPinAntennaModel routine in a PIN section.
Syntax
int lefwMacroPinAntennaGateArea(
double value,
const char* layerName)
Arguments
value
Specifies the gate area, in micron-squared units, to which the pin is connected on a layer.
layerName
Optional argument that specifies the layer. If you do not specify a layer name, value
applies to all layers. Specify NULL to ignore this argument.
lefwMacroPinAntennaMaxAreaCar
Writes an ANTENNAMAXAREACAR statement. The ANTENNAMAXAREACAR statement is
optional and can be used once after each lefwMacroPinAntennaModel routine in a PIN
section.
Syntax
int lefwMacroPinAntennaMaxAreaCar(
double value,
const char* layerName)
Arguments
value
For hierarchical process antenna effect calculation, specifies the maximum cumulative
antenna ratio value on the specified layerName, using the cut area below the current
pin layer.
layerName
Specifies the layer.
lefwMacroPinAntennaMaxCutCar
Writes an ANTENNAMAXCUTCAR statement. The ANTENNAMAXCUTCAR statement is optional
and can be used once after each lefwMacroPinAntennaModel routine in a PIN section.
Syntax
int lefwMacroPinAntennaMaxCutCar(
double value,
const char* layerName)
Arguments
value
For hierarchical process antenna effect calculation, specifies the maximum cumulative
antenna ratio value on the specified layerName, using the cut area below the current
pin layer.
layerName
Specifies the layer.
lefwMacroPinAntennaMaxSideAreaCar
Writes an ANTENNAMAXSIDEAREACAR statement. The ANTENNAMAXSIDEAREACAR
statement is optional and can be used once after each lefwMacroPinAntennaModel
routine in a PIN section.
Syntax
int lefwMacroPinAntennaMaxSideAreaCar(
double value,
const char* layerName)
Arguments
value
For hierarchical process antenna effect calculation, specifies the maximum cumulative
antenna ratio value on the specified layerName, using the metal side wall area below
the current pin layer.
layerName
Specifies the layer.
lefwMacroPinAntennaModel
Writes an ANTENNAMODEL statement. The ANTENNAMODEL statement is optional and can be
used more than once in a PIN section.
Syntax
int lefwMacroPinAntennaModel(
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: OXIDE1 and OXIDE2 are currently supported. If you specify OXIDE3 or OXIDE4,
current tools parse and ignore them.
lefwMacroPinAntennaPartialCutArea
Writes an ANTENNAPARTIALCUTAREA statement. The ANTENNAPARTIALCUTAREA
statement is optional and can be used more than once in a PIN section.
Syntax
int lefwMacroPinAntennaPartialCutArea(
double 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. If you specify a layer name, value applies
to antennas on that layer only. If you do not specify a layer name, value applies to all
layers. Specify NULL to ignore this argument.
lefwMacroPinAntennaPartialMetalArea
Writes an ANTENNAPARTIALMETALAREA statement. The ANTENNAPARTIALMETALAREA
statement is optional and can be used more than once in a PIN section.
Syntax
int lefwMacroPinAntennaPartialMetalArea(
double value,
const char* layerName)
Argument
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. If you do not specify a layer name, value
applies to all layers. Specify NULL to ignore this argument.
lefwMacroPinAntennaPartialMetalSideArea
Writes an ANTENNAPARTIALMETALSIDEAREA statement. The
ANTENNAPARTIALMETALSIDEAREA statement is optional and can be used more than once
in a PIN section.
Syntax
int lefwMacroPinAntennaPartialMetalSideArea(
double value,
const char* layerName)
Arguments
value
Specifies the partial metal side wall area, which is connected directly to the I/O pin and
inside, or outside, of the macro on a layer.
layerName
Optional argument that specifies the layer. If you do not specify a layer name, value
applies to all layers. Specify NULL to ignore this argument.
lefwMacroPinDirection
Writes a DIRECTION statement. The DIRECTION statement is optional and can be used only
once in a PIN section.
Syntax
int lefwMacroPinDirection(
const char* direction)
Arguments
direction
Specifies the pin type.
Value: INPUT, OUTPUT, OUTPUT TRISTATE, INOUT, or FEEDTHRU
lefwMacroPinGroundSensitivity
Writes a GROUNDSENSITIVITY statement. The GROUNDSENSITIVITY statement is optional
and can be used only once in a PIN section.
Syntax
lefwMacroPinGroundSensitivity(
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.
lefwMacroPinMustjoin
Writes a MUSTJOIN statement. The MUSTJOIN statement is optional and can be used only
once in a PIN section.
Syntax
int lefwMacroPinMustjoin(
const char* pinName)
Arguments
pinName
Specifies the name of another pin in the cell that must be connected with the pin being
defined.
lefwMacroPinNetExpr
Wries a NETEXPR statement in a PIN section. The NETEXPR statement is optional and can
be used only once in a PIN section.
Syntax
lefwMacroPinNetExpr(
const char* name)
Arguments
name
Specifies a net expression property name (such as power1 or power2). If name matches
a net expression property in the netlist (such as in Verilog, VHDL, or OpenAccess), then
the property is evaluated, and the software identifies a net to which to connect this pin.
lefwMacroPinShape
Writes a SHAPE statement. The SHAPE statement is optional and can be used only once in a
PIN section.
Syntax
int lefwMacroPinShape(
const char* name)
Arguments
name
Specifies a pin with special connection requirements because of its shape.
Value: ABUTMENT, RING, or FEEDTHRU
lefwMacroPinSupplySensitivity
Writes a SUPPLYSENSITIVITY statement. The SUPPLYSENSITIVITY statement is optional
and can be used only once in a PIN section.
Syntax
lefwMacroPinSupplySensitivity(
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.
lefwMacroPinTaperRule
Writes a TAPERRULE statement. The TAPERRULE statement is optional and can be used only
once in a PIN section.
Syntax
int lefwMacroPinTaperRule(
const char* ruleName)
Arguments
ruleName
Specifies the nondefault rule to use when tapering wires to the pin.
lefwMacroPinUse
Writes a USE statement. The USE statement is optional and can be used only once in a PIN
section.
Syntax
int lefwMacroPinUse(
const char* use)
Arguments
use
Specifies how the pin is used.
Value: SIGNAL, ANALOG, POWER, GROUND, or CLOCK
...
res = lefwStartMacroPin("Z");
CHECK_RES(res);
res = lefwMacroPinDirection("OUTPUT");
CHECK_RES(res);
res = lefwMacroPinUse("SIGNAL");
CHECK_RES(res);
res = lefwMacroPinShape("ABUTMENT");
CHECK_RES(res);
res = lefwMacroPinPower(0.1);
CHECK_RES(res);
res = lefwStartMacroPinPort(NULL);
CHECK_RES(res);
res = lefwEndMacroPin("Z");
CHECK_RES(res);
...
return 0;}
For examples of the routines described here, see “Macro Pin Port Examples” on page 217.
lefwStartMacroPinPort
Starts the PORT section.
Syntax
int lefwStartMacroPinPort(
const char* classType)
Arguments
classType
Optional argument that specifies whether or not the port is a core port.
Value: NONE or CORE.
lefwEndMacroPinPort
Ends the PORT section.
Syntax
int lefwEndMacroPinPort()
lefwMacroPinPortDesignRuleWidth
Writes a DESIGNRULEWIDTH statement. Either a LAYER statement, a DESIGNRULEWIDTH
statement, or a VIA statement must be defined in a PORT section and can be used more than
once.
Syntax
int lefwMacroPinPortDesignRuleWidth(
const char* layerName,
double width)
Argument
layerName
Specifies the layer on which to place the geometry.
width
Optional argument that specifies the effective design rule width. If specified, the router
uses the spacing defined in the layer section that corresponds to width. Specify 0 to
ignore this argument.
lefwMacroPinPortLayer
Writes a LAYER statement in the PORT section. Either a LAYER statement, a
DESIGNRULEWIDTH statement, or a VIA statement must be defined in a PORT section and
can be used more than once.
Syntax
int lefwMacroPinPortLayer(
const char* layerName,
double spacing)
Arguments
layerName
Specifies the layer on which to place the geometry.
spacing
Optional argument that specifies the minimum spacing allowed between this geometry
and any other shape. Specify 0 to ignore this argument.
lefwMacroPinPortLayerPath
Writes a PATH statement. Either a PATH, POLYGON, or RECT statement must follow a LAYER
statement.
Syntax
int lefwMacroPinPortLayerPath(
int num_paths,
double* xl,
double* yl,
int numX,
int numY,
double spaceX,
double spaceY)
Arguments
numPaths
Specifies the number of paths to create.
x1 y1
Create a path between the specified points. The path automatically extends the length
by half of the current width on both end points to form a rectangle. (A previous WIDTH
statement is required.) The line between each pair of points must be parallel to the x or
y axis (45-degree angles are not allowed).
lefwMacroPinPortLayerPolygon
Writes a POLYGON statement. Either a PATH, POLYGON, or RECT statement must follow a
LAYER statement.
Syntax
int lefwMacroPinPortLayerPolygon(
int num_polys,
double* xl,
double* yl,
int numX,
int numY,
double spaceX,
double spaceY)
Arguments
num_polys
Specifies the number of polygon sides.
x1 y1
Specifies a sequence of points to generate a polygon geometry. Each polygon edge
must be parallel to the x or y axis, or at a 45-degree angle.
lefwMacroPinPortLayerRect
Writes a RECT statement. Either a PATH, POLYGON, or RECT statement must follow a LAYER
statement.
Syntax
int lefwMacroPinPortLayerRect(
double xl1,
double yl1,
double xl2,
double yl2,
int numX,
int numY,
double spaceX,
double spaceY)
Arguments
specify the spacing, in distance units, between the columns and rows. Specify 0 to ignore
these arguments.
lefwMacroPinPortLayerWidth
Writes a WIDTH statement. The WIDTH statement is optional and can be used only once in a
PORT section.
Syntax
int lefwMacroPinPortLayerWidth(
double width)
Arguments
width
Specifies the width that the PATH statements use.
lefwMacroPinPortVia
Writes a VIA statement. Either a LAYER statement, a DESIGNRULEWIDTH statement, or a
VIA statement must be defined in a PORT section and can be used more than once.
Syntax
int lefwMacroPinPortVia(
double xl,
double yl,
const char* viaName,
int numX,
int numY,
double spaceX,
double spaceY)
Arguments
x1 y1
Specify the location to place the via.
viaName
Specifies the name of the via to place.
...
res = lefwStartMacroPin("Z");
CHECK_RES(res);
...
res = lefwStartMacroPinPort(NULL);
CHECK_RES(res);
res = lefwMacroPinPortLayer("M2", 5.6);
CHECK_RES(res);
xpath = (double*)malloc(sizeof(double)*3);
ypath = (double*)malloc(sizeof(double)*3);
xpath[0] = 30.8;
ypath[0] = 9;
xpath[1] = 42;
ypath[1] = 9;
xpath[2] = 30.8;
ypath[2] = 9;
res = lefwMacroPinPortLayerPath(3, xpath, ypath, 0, 0,
0, 0);
CHECK_RES(res);
res = lefwEndMacroPinPort();
CHECK_RES(res);
...
res = lefwEndMacroPin("Z");
CHECK_RES(res);
free((char*)xpath);
free((char*)ypath);
...
return 0;}
Manufacturing Grid
The Manufacturing Grid routine writes a LEF MANUFACTURINGGRID statement. The
MANUFACTURINGGRID statement is optional and can be used only once in a LEF file. For
syntax information about the MANUFACTURINGGRID statement, see “Manufacturing Grid” in
the LEF/DEF Language Reference.
lefwManufacturingGrid
Writes a MANUFACTURINGGRID statement.
Syntax
int lefwManufacturingGrid(
double grid)
Arguments
grid
Specifies the value for the manufacturing grid. You must specify a positive number for a
value.
Important
The lefwMaxviastack routine must be used only after all layer routines are used.
lefwMaxviastack
Writes a MAXVIASTACK statement.
Syntax
int lefwMaxviastack(
int value,
const char* bottomlayer,
const char* topLayer)
Arguments
value
Specifies the maximum allowed number of single-stacked vias.
bottomLayer
Optional argument that specifies the bottom layer in a range of layers for which the
maximum stacked via rule applies. Specify NULL to ignore this argument.
topLayer
Optional argument that specifies the top layer in a range of layers for which the maximum
stacked via rule applies. Specify NULL to ignore this argument.
Nondefault Rule
Nondefault Rule routines write a LEF NONDEFAULTRULE statement. The NONDEFAULTRULE
statement is optional and can be used only once in a LEF file. For syntax information about
the LEF NONDEFAULTRULE statement, see "Nondefault Rule" in the LEF/DEF Language
Reference.
For examples of the routines described here, see “Nondefault Rules Example” on page 224.
In addition to the routines described in this section, you can include a PROPERTY statement
and a VIA statement within a NONDEFAULTRULE section. For more information about these
routines, see “Property” on page 224, or “Via” on page 240.
lefwStartNonDefaultRule
Starts the NONDEFAULTRULE statement.
Syntax
int lefwStartNonDefaultRule(
const char* ruleName)
Arguments
ruleName
Specifies the name of the nondefault rule to define.
lefwEndNonDefaultRule
Ends the NONDEFAULTRULE statement for the specified ruleName.
Syntax
int lefwEndNonDefaultRule(
const char* ruleName)
lefwNonDefaultRuleHardspacing
Writes a HARDSPACING statement. The HARDSPACING statement specifies that any spacing
values that exceed the LEF LAYER spacing requirements are "hard" rules instead of "soft"
rules. By default, routers treat extra spacing requirements as soft rules that are high cost to
violate, but not real spacing violations. The HARDSPACING statement is optional and can be
used only once in a NONDEFAULTRULE statement.
Syntax
lefwNonDefaultRuleHardspacing()
lefwNonDefaultRuleLayer
Writes a LAYER statement in the NONDEFAULTRULE statement. The LAYER statement is
required and can be used more than once in a NONDEFAULTRULE statement.
Syntax
int lefwNonDefaultRuleLayer(
const char* layerName,
double width,
double minSpacing,
double wireExtension,
double resistance,
double capacitance,
double edgecap)
Arguments
layerName
Specifies the layer for the various width and spacing values. This layer must be a routing
layer.
minSpacing
Optional argument that specifies the recommended minimum spacing for layerName
for routes using this NONDEFAULTRULE to other geometries.
width
Specifies the required minimum width for layerName.
wireExtension
Optional argument that specifies the distance by which wires are extended at [Link]
value must be greater than or equal to half of the routing width for the layer, as defined
in the nondefault rule. Specify 0 to ignore this argument.
resistance
This argument is obsolete. Specify 0 to ignore this argument.
capacitance
This argument is obsolete. Specify 0 to ignore this argument.
edgecap
This argument is obsolete. Specify 0 to ignore this argument.
lefwNonDefaultRuleMinCuts
Wries a MINCUTS statement in the NONDEFAULTRULE statement. The MINCUTS statement
is optional and can be used more than once in a NONDEFAULTRULE statement.
Syntax
lefwNonDefaultRuleMinCuts(
const char* layerName,
int numCuts)
Arguments
layerName
Specifies the cut layer.
numCuts
Specifies the minimum number of cuts allowed for any via using layerName.
lefwNonDefaultRuleStartVia
Starts a VIA statement in the NONDEFAULTRULE statement. The VIA statement is optional
and can be used more than once in a NONDEFAULTRULE statement.
Each VIA statement must start and end with the lefwNonDefaultRuleStartVia and
lefwNonDefaultRuleEndVia routines. The following routines can be included within a
VIA statement:
■ lefwViaLayer on page 241
■ lefwViaLayerPolygon on page 242
■ lefwViaLayerRect on page 243
■ lefwViaResistance on page 243
■ lefwViaViarule on page 243 (and its related routines)
Syntax
lefwNonDefaultRuleStartVia(
const char* viaName,
const char* isDefault)
Arguments
viaName
Specifies the name for the via.
isDefault
Identifies the via as the default via between the specified layers.
lefwNonDefaultRuleEndVia
Ends the VIA statement for the specified viaName. Each VIA statement must start and end
with the lefwNonDefaultRuleStartVia and lefwNonDefaultRuleEndVia routines.
Syntax
lefwNonDefaultRuleEndVia(
const char* viaName)
lefwNonDefaultRuleUseVia
Writes a USEVIA statement in a NONDEFAULTRULE statement. The USEVIA statement is
optional and can be used more than once in a NONDEFAULTRULE statement.
Syntax
lefwNonDefaultRuleUseVia(
const char* viaName)
Arguments
viaName
Specifies a previously defined via from the LEF VIA statement, or a previously defined
NONDEFAULTRULE via to use with this routing rule.
lefwNonDefaultRuleUseViaRule
Wrties a USEVIARULE statement in the NONDEFAULTRULE statement. The USEVIARULE
statement is optional and can be used more than once in a NONDEFAULTRULE statement.
Syntax
lefwNonDefaultRuleUseViaRule(
const char* viaRuleName)
Arguments
viaRuleName
Specifies a previously defined VIARULE GENERATE rule to use with this routing rule. You
cannot specify a rule from a VIARULE without a GENERATE keyword.
res = lefwStartNonDefaultRule("RULE1");
CHECK_RES(res);
res = lefwNonDefaultRuleLayer("RX", 10.0, 2.2, 6);
CHECK_RES(res);
res = lefwNonDefaultRuleLayer("PC", 10.0, 2.2, 0);
CHECK_RES(res);
res = lefwEndNonDefaultRule("RULE1");
CHECK_RES(res);
return 0;}
Property
The Property routines write a LEF PROPERTY statement in a VIA, VIARULE, LAYER, MACRO,
or NONDEFAULTRULE section. The PROPERTY statement is optional and can be used more
than once in these sections.
For examples of the routines described here, see “Property Example” on page 226.
lefwIntProperty
Writes a PROPERTY statement that defines a named property with an integer value. The
PROPERTY statement is optional and can be used more than once in a LEF file.
Syntax
int lefwIntProperty(
const char* propName,
int propValue)
Arguments
propName
Specifies the name of the property.
propValue
Specifies an integer value.
lefwRealProperty
Writes a PROPERTY statement that defines a named property with a real number value. The
PROPERTY statement is optional and can be used more than once in a LEF file.
Syntax
int lefwRealProperty(
const char* propName,
double propValue)
Arguments
propName
Specifies the name of the property.
propValue
Specifies a real value.
lefwStringProperty
Writes a PROPERTY statement that defines a named property with a string value. The
PROPERTY statement is optional and can be used more than once in a LEF file.
Syntax
int lefwStringProperty(
const char* propName,
const char* propValue)
Arguments
propName
Specifies the name of the property.
propValue
Specifies a string value.
Property Example
The following example shows how to create property inside a Macro callback routine. It can
be used for Layer, Via, Via Rule, Via within the Nondefault Rule, and Macro.
int macroCB (lefwCallbackType_e type,
lefiUserData userData) {
int res;
...
res = lefwStringProperty("TYPE", "special");
CHECK_RES(res);
res = lefwIntProperty("intProp", 23);
CHECK_RES(res);
res = lefwRealProperty("realProp", 24.25);
CHECK_RES(res);
...
return 0;}
Property Definitions
Property Definitions routines write a LEF PROPERTYDEFINTIONS statement. The
PROPERTYDEFINTIONS statement is optional and can be used only once in a LEF file. For
syntax information about the LEF PROPERTYDEFINTIONS statement, see "Property
Definitions" in the LEF/DEF Language Reference.
You must use the lefwStartPropDef and lefwEndPropDef routines to start and end the
PROPERTYDEFINTIONS statement. The lefwPropDef routine must be included between
these routines.
For examples of the routines described here, see “Property Definitions Examples” on
page 230.
lefwStartPropDef
Starts the PROPERTYDEFINTIONS statement.
Syntax
int lefwStartPropDef()
lefwEndPropDef
Ends the PROPERTYDEFINTIONS statement.
Syntax
int lefwEndPropDef(
lefwIntPropDef
Writes an integer property definition in the PROPERTYDEFINITIONS statement. The
lefwIntProperty routine is optional and can be used more than once in a
PROPERTYDEFINITIONS statement.
Syntax
int lefwIntPropDef(
const char* objType,
const char* propName,
double leftRange,
double rightRange,
int propValue)
Arguments
leftRange rightRange
Optional arguments that limit integer property values to a specified range. Specify 0 to
ignore these arguments.
objType
Specifies the object type for which you are defining properties.
Value: LIBRARY, LAYER, VIA, VIARULE, NONDEFAULTRULE, MACRO, or PIN
propName
Specifies a unique property name for the object type.
propValue
Optional argument that specifies an integer value for an object type. Specify NULL to
ignore this argument.
lefwRealPropDef
Writes a real property definition in the PROPERTYDEFINITIONS statement. The
lefwRealPropDef routine is optional and can be used more than once in a
PROPERTYDEFINITIONS statement.
Syntax
int lefwRealPropDef(
const char* objType,
const char* propName,
double leftRange,
double rightRange,
int propValue)
Arguments
leftRange rightRange
Optional arguments that limit real property values to a specified range. Specify 0 to
ignore these arguments.
objType
Specifies the object type for which you are defining properties.
Value: LIBRARY, LAYER, VIA, VIARULE, NONDEFAULTRULE, MACRO, or PIN
propName
Specifies a unique property name for the object type.
propValue
Optional argument that specifies a real value for an object type. Specify NULL to ignore
this argument.
lefwStringPropDef
Writes a string property definition in the PROPERTYDEFINITIONS statement. The
lefwStringPropDef routine is optional and can be used more than once in a
PROPERTYDEFINITIONS statement.
Syntax
int lefwStringPropDef(
const char* objType,
const char* propName,
double leftRange,
double rightRange,
int propValue)
Arguments
leftRange rightRange
Optional arguments that limit property values to a specified range. Specify 0 to ignore
these arguments.
objType
Specifies the object type for which you are defining properties.
Value: LIBRARY, LAYER, VIA, VIARULE, NONDEFAULTRULE, MACRO, or PIN
propName
Specifies a unique property name for the object type.
propValue
Optional argument that specifies a string value for an object type. Specify NULL to ignore
this argument.
return 0;}
Same-Net Spacing
Same-Net Spacing routines write a LEF SPACING statement. The SPACING statement is
optional and can be used only once in a LEF file. For syntax information about the LEF
SPACING statement, see "Same-Net Spacing" in the LEF/DEF Language Reference.
You must use the lefwStartSpacing and lefwEndSpacing routines to start and end the
SPACING statement. The lefwSpacing routine must be included between these routines.
For examples of the routines described here, see “Same-Net Spacing Examples” on
page 232.
lefwStartSpacing
Writes the SPACING statement.
Syntax
int lefwStartSpacing()
lefwEndSpacing
Ends the SPACING statement.
Syntax
int lefwEndSpacing()
lefwSpacing
Writes the SAMENET statement. The SAMENET statement is required and can be used more
than once.
Syntax
int lefwSpacing(
const char* layerName1,
const char* layerName2,
double minSpace,
const char* stack)
Arguments
layerName1, layerName2
Specify the names of the layers for which the same-net spacing rule applies. You can
specify spacing rules for routing layers and cut layers. For a routing layer, the same-net
spacing rule is defined by specifying the same layer name twice.
minSpace
Specifies the minimum spacing.
stack
Optional argument that allows stacked vias at a routing layer. Specify NULL to ignore this
argument.
res = lefwStartSpacing();
CHECK_RES(res);
res = lefwSpacing("CUT01", "CA", 1.5, NULL);
CHECK_RES(res);
res = lefwEndSpacing();
CHECK_RES(res);
return 0;}
Site
The Site routines write a LEF SITE statement. The SITE statement is optional and can be
used more than once in a LEF file. For syntax information about the LEF SITE statement, see
"Site" in the LEF/DEF Language Reference.
Each SITE statement must be defined with a lefwSite and lefwEndSite routine.
lefwSite
Writes a SITE statement.
Syntax
int lefwSite(
const char* siteName,
const char* classType,
const char* symmetry,
double width,
double height)
Arguments
classType
Specifies whether the site is a core site or an I/O pad site.
Value: PAD or CORE.
siteName
Specifies the name of the placement site.
symmetry
Specifies how the site is symmetrical in normal orientation.
Value: Specify one of the following:
width, height
Specify the dimensions of the site in normal (or north) orientation, in microns.
lefwEndSite
Ends a SITE statement.
Syntax
int lefwEndSite(
const char* siteName)
Arguments
siteName
Specifies the name of the placement site.
lefwSiteRowPattern
Writes a ROWPATTERN statement in the SITE statement. The ROWPATTERN statement is
optional and can be used more than once in a SITE statement.
Syntax
lefwSiteRowPattern( const char* siteName,
int orient)
Arguments
siteName
Specifies the name of a previously defined site.
orient
Specifies the orientation for the previously defined site.
Value: 0 to 7. For more information, see “Orientation Codes” on page 21.
lefwSiteRowPatternStr
Also writes a ROWPATTERN statement. This routine is the same as the
lefwSiteRowPattern routine, with the exception of the orient argument, which takes a
string instead of an integer. The ROWPATTERN statement is optional and can be used more
than once in a SITE statement.
Syntax
lefwSiteRowPattern( const char* siteName,
int orient)
Arguments
siteName
Specifies the name of a previously defined site.
orient
Specifies the orientation for the previously defined site.
Value: N, W, S, E, FN, FW, FS, or FE.
Site Examples
The following example shows a callback routine with the type lefwSiteCbkType.
int siteCB (lefwCallbackType_e type,
lefiUserData userData) {
int res;
return 0;}
Units
Units routines write a LEF UNITS statement. The UNITS statement is optional and can be
used only once in a LEF file. For syntax information about the LEF UNITS statement, see
"Units" in the LEF/DEF Language Reference.
You must use the lefwStartUnits and lefwEndSpacing routines to start and end the
UNITS statement. The lefwUnits routine must be included between these routines.
For examples of the routines described here, see “Units Examples” on page 237.
lefwStartUnits
Starts the UNITS statement.
Syntax
int lefwStartUnits()
lefwEndUnits
Ends the UNITS statement.
Syntax
int lefwEndUnits()
lefwUnits
Writes a UNITS statement. The UNITS statement is required whenever the
lefwStartSpacing routine is specified.
Syntax
int lefwUnits(
double time,
double capacitance,
double resistance,
double power,
double current,
double voltage,
double database)
Arguments
time
Optional argument that specifies a TIME NANOSECONDS statement. This interprets one
LEF time unit as one nanosecond. Specify 0 to ignore this argument.
capacitance
Optional argument that specifies a CAPACITANCE PICOFARADS statement. This
interprets one LEF capacitance unit as one picofarad. Specify 0 to ignore this argument.
resistance
Optional argument that specifies a RESISTANCE OHMS statement. This interprets one
LEF resistance unit as one ohm. Specify 0 to ignore this argument.
power
Optional argument that specifies a POWER MILLIWATTS statement. This interprets one
LEF power unit as one milliwatt. Specify 0 to ignore this argument.
current
Optional argument that specifies a CURRENT MILLIAMPS statement. This interprets one
LEF current unit as one milliamp. Specify 0 to ignore this argument.
voltage
Optional argument that specifies a VOLTAGE VOLTS statement. This interprets one LEF
voltage unit as one volt. Specify 0 to ignore this argument.
database
Optional argument that specifies a DATABASE MICRONS statement. This interprets one
LEF distance unit as multiplied when converted into database units. Specify 0 to ignore
this argument.
lefwUnitsFrequency
Writes a FREQUENCY statement in the UNITS statement. The FREQUENCY statement is
optional and can be used only once in a UNITS statement.
Syntax
int lefwUnitsFrequency(
double frequency)
Arguments
frequency
Specifies a FREQUENCY MEGAHERTZ statement. This interprets one LEF frequency unit
as one megahertz.
Units Examples
The following example shows a callback routine with the type lefwUnitsCbkType.
int unitsCB (lefwCallbackType_e type,
lefiUserData userData) {
int res;
if (type != lefwUnitsCbkType) {
printf("Type is not lefwUnitsCbkType, terminate
writing.\n");
return 1;
}
res = lefwStartUnits();
CHECK_RES(res);
res = lefwUnits(100, 10, 10000, 10000, 10000, 1000, 0);
CHECK_RES(res);
res = lefwEndUnits();
CHECK_RES(res);
return 0;}
For syntax information about the LEF USEMINSPACING statement, see “Use Min Spacing” in
the LEF/DEF Language Reference.
lefwUseMinSpacing
Writes a USEMINSPACING statement.
Syntax
int lefwUseMinSpacing(
const char* type,
const char* onOff)
Arguments
type
Specifies that the minimum spacing applies to obstruction geometries.
Value: OBS
onOff
Specifies how to calculate the minimum spacing.
Value: Specify one of the following:
Version
The version routine writes a LEF VERSION statement. For syntax information about the LEF
VERSION statement, see "Version" in the LEF/DEF Language Reference.
The VERSION statement is part of the LEF file header (which also includes the
BUSBITCHARS, and DIVIDERCHAR statements). If the statements in the header section are
not defined, many applications assume default values for them. However, the default values
are not formally part of the language definition; therefore you cannot be sure that the same
assumptions are used in all applications. You should always explicitly define these values.
lefwVersion
Writes a VERSION statement. The VERSION statement can be used only once in a LEF file.
Syntax
int lefwVersion(
int vers1,
int vers2)
Arguments
vers1, vers2
Specify which version of the LEF syntax is being used. vers1 is the major value. vers2
is the minor value.
Version Examples
The following example shows a callback routine with the type lefwVersionCbkType.
int versionCB (lefwCallbackType_e type,
lefiUserData userData) {
int res;
return 0;}
Via
Via routines write a LEF VIA section. A VIA section is optional and can be used more than
once in a LEF file. For syntax information about the LEF VIA section, see "Via" in the LEF/
DEF Language Reference.
Each VIA section must start and end with the lefwStartVia and lefwEndVia routines.
The remaining via routines must be included between these routines.
In addition to the routines described in this section, you can include a PROPERTY statement
within a VIA section. For more information about these routines, see “Property” on page 224.
For examples of the routines described here, see “Via Examples” on page 247.
lefwStartVia
Starts a VIA section.
Syntax
int lefwStartVia(
const char* viaName,
const char* isDefault)
Arguments
viaName
Specifies the name for the via.
isDefault
Optional argument that identifies the via as the default via between the specified layers.
lefwEndVia
Ends the VIA section for the specified viaName value.
Syntax
int lefwEndVia(
const char* viaName)
lefwViaLayer
Writes a LAYER statement for a via. Either a LAYER or a VIARULE statement is required in a
VIA section. A LAYER statement can be used more than once for a via.
If you specify this routine, you must also specify one of the following routines:
■ lefwViaLayerPolygon on page 242
■ lefwViaLayerRect on page 243
Syntax
int lefwViaLayer(
const char* layerName)
Arguments
layerName
Specifies the layer on which to create the rectangles that make up the via. Normal vias
have exactly three layers used: a cut layer and two layers that touch the cut layer (routing
or masterslice).
lefwViaLayerPolygon
Writes a POLYGON statement for a via. Either a POLYGON or RECT statement is required if a
LAYER statement is specified in a VIA section, and can be used more than once.
Syntax
lefwViaLayerPolygon(
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. The polygon is generated by
connecting each successive point, then connecting the first and last points.
lefwViaLayerRect
Writes a RECT statement. Either a POLYGON or RECT statement is required if a LAYER
statement is specified in a VIA section, and can be used more than once.
Syntax
int lefwViaLayerRect(
double x1l,
double y1l,
double x2l,
double y2l)
Arguments
lefwViaResistance
Writes a RESISTANCE statement. The RESISTANCE statement is optional and can be used
only once with a LAYER statement in a VIA section.
Syntax
int lefwViaResistance(
double resistance)
Arguments
resistance
Specifies the total resistance of the via, in units of ohms, given as the resistance per via.
Note that this is not a resistance per via-cut value; it is the total resistance of the via.
lefwViaViarule
Writes a VIARULE statement for the via. Either a LAYER or a VIARULE statement is required
in a VIA section. A VIARULE statement can be used only once in a VIA section.
If you specify this routine, you can optionally specify the following routines:
Syntax
lefwViaViarule(
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. This name must refer to
a previouslydefined VIARULE GENERATE rule name. This indicates that the via is the
result of automatic via generation, and that the via name is only used locally inside this
LEF file.
xCutSize yCutSize
Specifies the required width (xSize) and height (ySize) of the cut layer rectangles.
xCutSpacing yCutSpacing
Specifies the required x and y spacing between cuts. The spacing is measured between
one cut edge and the next cut edge.
lefwViaViaruleOffset
Writes an OFFSET statement for the via. The OFFSET statement is optional with a VIARULE
statement and can be used only once in a VIA section.
Syntax
lefwViaViaruleOffset(
double xBotOffset,
double yBotOffset,
double xTopOffset,
double yTopOffset)
Arguments
lefwViaViaruleOrigin
Writes an ORIGIN statement for the via. The ORIGIN statement is optional with a VIARULE
statement and can be used only once in a VIA section.
Syntax
lefwViaViaruleOrigin(
double xOffset,
double 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.
lefwViaViarulePattern
Writes a PATTERN statement for the via. The PATTERN statement is optional with a VIARULE
statement and can be used only once in a VIA section.
Syntax
lefwViaViarulePattern(
const char* cutPattern)
Arguments
cutPattern
Specifies the cut pattern encoded as an ASCII string. This parameter is only required
when some of the cuts are missing from the array of cuts, and defaults to "all cuts are
present," if not specified.
lefwViaViaruleRowCol
Writes a ROWCOL statement for the via. The ROWCOL statement is optional with a VIARULE
statement and can be used only once in a VIA section.
Syntax
lefwViaViaRuleRowCol(
int numCutRows,
int numCutCols)
Arguments
numCutRows numCutCols
Specifies the number of cut rows and columns that make up the via array.
Via Examples
The following example shows a callback routine with the type lefwViaCbkType.
int viaCB (lefwCallbackType_e type,
lefiUserData userData) {
int res;
return 0;}
Via Rule
Via Rule routines write a LEF VIARULE statement. A VIARULE or a VIARULE GENERATE
statement is required in a LEF file. You can create more than one VIARULE statement in a
LEF file. For syntax information about the LEF VIARULE statement, see "Via Rule" in the
LEF/DEF Language Reference.
You must use the lefwStartViaRule and lefwEndViaRule routines to start and end the
VIARULE statement. The lefwViaRuleLayer and lefwViaRuleVia routines must be
included between these routines.
For examples of the routines described here, see “Via Rule Examples” on page 250.
In addition to the routines described in this section, you can include a PROPERTY statement
within a VIARULE statement. For more information about these routines, see “Property” on
page 224.
lefwStartViaRule
Starts a VIARULE statement.
Syntax
int lefwStartViaRule(
const char* viaRuleName)
Arguments
viaRuleName
Specifies the name to identify the via rule.
lefwEndViaRule
Ends the VIARULE statement for the specified viaRuleName value.
Syntax
int lefwEndViaRule(
const char* viaRuleName)
lefwViaRuleLayer
Writes a LAYER statement. The LAYER statement is required and must be used exactly twice
in a VIARULE statement.
Syntax
int lefwViaRuleLayer(
const char* layerName,
const char* direction,
double minWidth,
double maxWidth,
double overhang,
double metalOverhang)
Arguments
layerName
Specifies the top or bottom routing layer of the via.
direction
Specifies the wire direction. If you specify a width range, the rule applies to wires of the
specified direction that fall within the range. Otherwise, the rule applies to all wires
on the layer of the specified direction.
Value: HORIZONTAL or VERTICAL
minWidth maxWidth
Optional arguments that specify a wire width range within which the wire must fall in order
for the rule to apply. That is, the wire width must be greater than or equal to minWidth
and less than or equal to maxWidth. Specify 0 to ignore these arguments.
overhang
This argument is obsolete. Specify 0 to ignore this argument.
metalOverhang
This argument is obsolete. Specify 0 to ignore this argument.
lefwViaRuleVia
Writes a VIA statement. The VIA statement is required and can be used more than once after
both lefwViaRuleLayer routines are used.
Syntax
int lefwViaRuleVia(
const char* viaName)
Arguments
viaName
Specifies a previously defined via to test for the current via rule. The first via in the list
that can be placed at the location without design rule violations is selected. The vias must
all have exactly three layers in them. The three layers must include the same routing
layers as listed in the LAYER statements of the VIARULE, and a cut layer that is between
the two routing layers.
res = lefwStartViaRule("VIALIST12");
CHECK_RES(res);
lefwAddComment("Break up the old lefwViaRule into 2
routines");
lefwAddComment("lefwViaRuleLayer and lefwViaRuleVia");
res = lefwViaRuleLayer("M1", "VERTICAL", 9.0, 9.6, 4.5,
0);
CHECK_RES(res);
res = lefwViaRuleLayer("M2", "HORIZONTAL", 3.0, 3.0, 0,
0);
CHECK_RES(res);
res = lefwViaRuleVia("VIACENTER12");
CHECK_RES(res);
res = lefwStringProperty("vrsp", "new");
CHECK_RES(res);
res = lefwIntProperty("vrip", 1);
CHECK_RES(res);
res = lefwRealProperty("vrrp", 4.5);
CHECK_RES(res);
res = lefwEndViaRule("VIALIST12");
CHECK_RES(res);
return 0;}
You must use the lefwStartViaRuleGen and lefwEndViaRuleGen routines to start and
end the VIARULE GENERATE statement. All other routines must be included between these
routines.
Use the Via Rule Generate routines to cover special wiring that is not explicitly defined in the
Via Rule routines.
lefwStartViaRuleGen
Starts a VIARULE GENERATE statement.
Syntax
int lefwStartViaRuleGen(
const char* viaRuleName)
Arguments
viaRuleName
Specifies the name for the via rule (formula).
lefwEndViaRuleGen
Ends the VIARULE GENERATE statement for the specified viaRuleName value.
Syntax
int lefwEndViaRuleGen(
const char* viaRuleName)
lefwViaRuleGenDefault
Writes a DEFAULT statement for the [Link] DEFAULT statement specifies that the via rule
can be used to generate vias for the default routing rule, and to supplement any DEFAULT
fixed vias that might be predefined in the LEF VIA statement, as the router needs them. The
DEFAULT statement is optional and can be used only once for a VIARULE GENERATE
statement.
Syntax
lefwViaRuleGenDefault()
lefwViaRuleGenLayer
Writes a routing LAYER statement. Either the routing LAYER statement or the ENCLOSURE
statement is required and must be used exactly twice in a VIARULE GENERATE statement.
Syntax
int lefwViaRuleGenLayer(
const char* layerName,
const char* direction,
double minWidth,
double maxWidth,
double overhang,
double metalOverhang)
Arguments
layerName
Specifies the routing layer for the top or bottom of the via.
direction
Specifies the wire direction. If you specify a width range, the rule applies to wires of the
specified direction that fall within the range. Otherwise, the rule applies to all wires
on the layer of the specified direction.
Value: HORIZONTAL or VERTICAL
minWidth maxWidth
Optional arguments that specify a wire width range within which the wire must fall in order
for the rule to apply. That is, the wire width must be greater than or equal to minWidth
and less than or equal to maxWidth. Specify 0 to ignore these arguments.
overhang
This argument is obsolete. Specify 0 to ignore this argument.
metalOverhang
This argument is obsolete. Specify 0 to ignore this argument.
lefwViaRuleGenLayer3
Writes a cut LAYER statement. The cut LAYER statement is required and can be used only
once after either both lefwViaRuleGenLayer, or both
lefwViaRuleGenLayerEnclosure routines are used.
Syntax
int lefwViaRuleGenLayer3(
const char* layerName,
double xl,
double yl,
double xh,
double yh,
double xSpacing,
double ySpacing,
double resistance)
Arguments
layerName
Specifies the cut layer for the generated via.
xl yl xh yh
Specifies the location of the lower left contact cut rectangle.
xSpacing ySpacing
Defines center-to-center spacing in the x and y dimensions to create an array of contact
[Link] number of cuts of an array in each direction is the most that can fit within the
bounds of the intersection formed by the two special wires. Cuts are only generated
where they do not violate stacked or adjacent via design rules.
resistance
Optional argument that specifies the resistance of the cut layer, given as the resistance
per contact cut. Specify 0 to ignore this argument.
lefwViaRuleGenLayerEnclosure
Writes an ENCLOSURE statement. Either the ENCLOSURE statement or the routing LAYER
statement is required and must be used exactly twice in a VIARULE GENERATE statement.
Syntax
int lefwViaRuleGenLayerEnclosure(
const char* layerName,
double overhang1,
double overhang2,
double minWidth,
double maxWidth)
Arguments
layerName
Specifies the routing layer for the top or bottom of the via.
overhang1 overhang2
Specifies that the via must be covered by metal on two opposite sides by at least
overhang1, and on the other two sides by at least overhang2. The via generation
code then chooses the direction of overhang that best maximizes the number of cuts that
can fit in the via.
minWidth maxWidth
Optional arguments that specify a wire width range within which the wire must fall in order
for the rule to apply. That is, the wire width must be greater than or equal to minWidth
and less than or equal to maxWidth. Specify 0 to ignore this argument.
res = lefwStartViaRuleGen("VIAGEN12");
CHECK_RES(res);
res = lefwViaRuleGenLayer("M1", "VERTICAL", 0.1, 19, 1.4,
0);
CHECK_RES(res);
res = lefwViaRuleGenLayer("M2", "HORIZONTAL", 0, 0, 1.4,
0);
CHECK_RES(res);
res = lefwViaRuleGenLayer3("V1", -0.8, -0.8, 0.8, 0.8,
5.6, 6.0, 0.2);
CHECK_RES(res);
res = lefwEndViaRuleGen("VIAGEN12");
CHECK_RES(res);
return 0;}
7
LEF Compressed File Routines
The Cadence® Library Exchange Format (LEF) reader provides the following routines for
opening and closing compressed LEF files. These routines are used instead of the fopen
and fclose routines that are used for regular LEF files.
■ lefGZipOpen on page 257
■ lefGZipClose on page 257
■ Example on page 258
lefGZipOpen
Opens a compressed LEF file. If the file opens with no errors, this routine returns a pointer to
the file.
Syntax
lefGZFile lefGZipOpen(
const char* gzipFile,
const char* mode);
Arguments
gzipFile
Specifies the compressed file to open.
mode
Specifies how to open the file. Compressed files should be opened as read only;
therefore, specify “r”.
lefGZipClose
Closes the compressed LEF file. If the file closes with no errors, this routine returns zero.
Syntax
int lefGZipClose(
lefGZFile filePtr) ;
Arguments
filePtr
Specifies a pointer to the compressed file to close.
Example
The following example uses the lefGZipOpen and lefGZipClose routines to open and
close a compressed file.
lefrInit() ;
(void)lefrEnableReadEncrypted();
if (res)
fprintf(stderr, “Reader returns bad status.\n”, inFile[fileCt]);
}
fclose(fout);
return 0;}
8
LEF File Comparison Utility
The Cadence® Library Exchange Format (LEF) reader provides the following utility for
comparing LEF files.
lefdefdiff
Compares two LEF or DEF files and reports any differences between them.
Because LEF and DEF files can be very large, the lefdefdiff utility writes each construct
from a file to an output file in the /tmp directory. The utility writes the constructs using the
format:
section_head/subsection/subsection/ ... /statement
The lefdefdiff utility then sorts the output files and uses the diff program to compare
the two files. Always verify the accuracy of the diff results.
Note: You must specify the -lef or -def, inFileName1, and inFileName2 arguments
in the listed order. All other arguments can be specified in any order after these arguments.
Syntax
lefdefdiff
{-lef | -def}
inFileName1
inFileName2
[-o outFileName]
[-path pathName]
[-quick]
[-d]
[-ignorePinExtra]
[-ignoreRowName]
[-h]
Arguments
-d
Uses the gnu diff program to compare the files for a smaller set of differences. Use this
argument only for UNIX platforms.
-h
Returns the syntax and command usage for the lefdefdiff utility.
-ignorePinExtra
Ignores any .extraN statements in the pin name. This argument can only be used when
comparing DEF files.
-ignoreRowName
Ignores the row name when comparing ROW statements in the DEF files. This argument
can only be used when comparing DEF files.
inFileName1
Specifies the first LEF or DEF file.
inFileName2
Specifies the LEF or DEF file to compare with the first file.
-lef | -def
Specifies whether you are comparing LEF or DEF files.
-o outFileName
Outputs the results of the comparison to the specified file.
Default: Outputs the results to the screen
-path pathName
Temporarily stores the intermediate files created by the lefdefdiff utility in the
specified path directory.
Default: Temporarily stores the files in the current directory
-quick
Uses the bdiff program to perform a faster comparison.
Example
The following example shows an output file created by the lefdefdiff utility after
comparing two LEF files:
A
LEF Reader and Writer Examples
This appendix contains examples of the Cadence® Library Exchange Format (LEF) reader
and writer.
■ LEF Reader Program
■ LEF Writer Program on page 320
#include <stdio.h>
#include <string.h>
#include <iostream.h>
#include <malloc.h>
#ifndef WIN32
# include <unistd.h>
#else
# include <windows.h>
#endif /* not WIN32 */
#include "[Link]"
#include "[Link]"
#include "[Link]"
#include "[Link]"
#include "[Link]"
char defaultName[128];
char defaultOut[128];
FILE* fout;
// TX_DIR:TRANSLATION ON
void dataError() {
fprintf(fout, "ERROR: returned user data is not correct!\n");
}
void checkType(lefrCallbackType_e c) {
if (c >= 0 && c <= lefrLibraryEndCbkType) {
// OK
} else {
fprintf(fout, "ERROR: callback type is out of bounds!\n");
}
}
lefrSetCaseSensitivity(1);
fprintf(fout, "VIA %s ", via->lefiVia::name());
if (via->lefiVia::hasDefault())
fprintf(fout, "DEFAULT");
else if (via->lefiVia::hasGenerated())
fprintf(fout, "GENERATED");
fprintf(fout, "\n");
if (via->lefiVia::hasTopOfStack())
fprintf(fout, " TOPOFSTACKONLY\n");
if (via->lefiVia::hasForeign()) {
fprintf(fout, " FOREIGN %s ", via->lefiVia::foreign());
if (via->lefiVia::hasForeignPnt()) {
fprintf(fout, "( %g %g ) ", via->lefiVia::foreignX(),
via->lefiVia::foreignY());
if (via->lefiVia::hasForeignOrient())
fprintf(fout, "%s ", orientStr(via->lefiVia::foreignOrient()));
}
fprintf(fout, ";\n");
}
if (via->lefiVia::hasProperties()) {
fprintf(fout, " PROPERTY ");
for (i = 0; i < via->lefiVia::numProperties(); i++) {
fprintf(fout, "%s ", via->lefiVia::propName(i));
if (via->lefiVia::propIsNumber(i))
fprintf(fout, "%g ", via->lefiVia::propNumber(i));
if (via->lefiVia::propIsString(i))
fprintf(fout, "%s ", via->lefiVia::propValue(i));
switch (via->lefiVia::propType(i)) {
case 'R': fprintf(fout, "REAL ");
break;
case 'I': fprintf(fout, "INTEGER ");
break;
case 'S': fprintf(fout, "STRING ");
break;
case 'Q': fprintf(fout, "QUOTESTRING ");
break;
case 'N': fprintf(fout, "NUMBER ");
break;
}
}
fprintf(fout, ";\n");
}
if (via->lefiVia::hasResistance())
fprintf(fout, " RESISTANCE %g ;\n", via->lefiVia::resistance());
if (via->lefiVia::numLayers() > 0) {
for (i = 0; i < via->lefiVia::numLayers(); i++) {
fprintf(fout, " LAYER %s\n", via->lefiVia::layerName(i));
for (j = 0; j < via->lefiVia::numRects(i); j++)
return;
}
geometry->lefiGeometries::getWidth(i));
break;
case lefiGeomPathE:
path = geometry->lefiGeometries::getPath(i);
fprintf(fout, " PATH ");
for (j = 0; j < path->numPoints; j++) {
if (j+1 == path->numPoints) // last one on the list
fprintf(fout, " ( %g %g ) ;\n", path->x[j], path->y[j]);
else
fprintf(fout, " ( %g %g )\n", path->x[j], path->y[j]);
}
break;
case lefiGeomPathIterE:
pathIter = geometry->lefiGeometries::getPathIter(i);
fprintf(fout, " PATH ITERATED ");
for (j = 0; j < pathIter->numPoints; j++)
fprintf(fout, " ( %g %g )\n", pathIter->x[j],
pathIter->y[j]);
fprintf(fout, " DO %g BY %g STEP %g %g ;\n", pathIter->xStart,
pathIter->yStart, pathIter->xStep, pathIter->yStep);
break;
case lefiGeomRectE:
rect = geometry->lefiGeometries::getRect(i);
fprintf(fout, " RECT ( %f %f ) ( %f %f ) ;\n", rect->xl,
rect->yl, rect->xh, rect->yh);
break;
case lefiGeomRectIterE:
rectIter = geometry->lefiGeometries::getRectIter(i);
fprintf(fout, " RECT ITERATE ( %f %f ) ( %f %f )\n",
rectIter->xl, rectIter->yl, rectIter->xh, rectIter->yh);
fprintf(fout, " DO %g BY %g STEP %g %g ;\n",
rectIter->xStart, rectIter->yStart, rectIter->xStep,
rectIter->yStep);
break;
case lefiGeomPolygonE:
polygon = geometry->lefiGeometries::getPolygon(i);
fprintf(fout, " POLYGON ");
for (j = 0; j < polygon->numPoints; j++) {
if (j+1 == polygon->numPoints) // last one on the list
fprintf(fout, " ( %g %g ) ;\n", polygon->x[j],
polygon->y[j]);
else
fprintf(fout, " ( %g %g )\n", polygon->x[j],
polygon->y[j]);
}
break;
case lefiGeomPolygonIterE:
polygonIter = geometry->lefiGeometries::getPolygonIter(i);
fprintf(fout, " POLYGON ITERATE");
for (j = 0; j < polygonIter->numPoints; j++)
fprintf(fout, " ( %g %g )\n", polygonIter->x[j],
polygonIter->y[j]);
fprintf(fout, " DO %g BY %g STEP %g %g ;\n",
polygonIter->xStart, polygonIter->yStart,
polygonIter->xStep, polygonIter->yStep);
break;
case lefiGeomViaE:
via = geometry->lefiGeometries::getVia(i);
fprintf(fout, " VIA ( %g %g ) %s ;\n", via->x, via->y,
via->name);
break;
case lefiGeomViaIterE:
viaIter = geometry->lefiGeometries::getViaIter(i);
fprintf(fout, " VIA ITERATE ( %g %g ) %s\n", viaIter->x,
viaIter->y, viaIter->name);
fprintf(fout, " DO %g BY %g STEP %g %g ;\n",
viaIter->xStart, viaIter->yStart,
viaIter->xStep, viaIter->yStep);
break;
default:
fprintf(fout, "BOGUS geometries type.\n");
break;
}
}
}
switch (c) {
case lefrAntennaInputCbkType:
fprintf(fout, "ANTENNAINPUTGATEAREA %g ;\n", value);
break;
case lefrAntennaInoutCbkType:
fprintf(fout, "ANTENNAINOUTDIFFAREA %g ;\n", value);
break;
case lefrAntennaOutputCbkType:
fprintf(fout, "ANTENNAOUTPUTDIFFAREA %g ;\n", value);
break;
case lefrInputAntennaCbkType:
fprintf(fout, "INPUTPINANTENNASIZE %g ;\n", value);
break;
case lefrOutputAntennaCbkType:
fprintf(fout, "OUTPUTPINANTENNASIZE %g ;\n", value);
break;
case lefrInoutAntennaCbkType:
fprintf(fout, "INOUTPINANTENNASIZE %g ;\n", value);
break;
default:
fprintf(fout, "BOGUS antenna type.\n");
break;
}
return 0;
}
checkType(c);
status = lefwStartArray(name);
if (status != LEFW_OK)
return status;
return 0;
}
checkType(c);
if (a->lefiArray::numSitePattern() > 0) {
dataError();
}
}
if (a->lefiArray::numTrack() > 0) {
for (i = 0; i < a->lefiArray::numTrack(); i++) {
track = a->lefiArray::track(i);
fprintf(fout, " TRACKS %s, %g DO %d STEP %g\n",
track->lefiTrackPattern::name(),
track->lefiTrackPattern::start(),
track->lefiTrackPattern::numTracks(),
track->lefiTrackPattern::space());
if (track->lefiTrackPattern::numLayers() > 0) {
fprintf(fout, " LAYER ");
for (j = 0; j < track->lefiTrackPattern::numLayers(); j++)
fprintf(fout, "%s ", track->lefiTrackPattern::layerName(j));
fprintf(fout, ";\n");
}
}
}
if (a->lefiArray::numGcell() > 0) {
for (i = 0; i < a->lefiArray::numGcell(); i++) {
gcell = a->lefiArray::gcell(i);
fprintf(fout, " GCELLGRID %s, %g DO %d STEP %g\n",
gcell->lefiGcellPattern::name(),
gcell->lefiGcellPattern::start(),
gcell->lefiGcellPattern::numCRs(),
gcell->lefiGcellPattern::space());
}
}
if (a->lefiArray::numFloorPlans() > 0) {
for (i = 0; i < a->lefiArray::numFloorPlans(); i++) {
status = lefwStartArrayFloorplan(a->lefiArray::floorPlanName(i));
if (status != LEFW_OK)
dataError();
for (j = 0; j < a->lefiArray::numSites(i); j++) {
pattern = a->lefiArray::site(i, j);
status = lefwArrayFloorplan(a->lefiArray::siteType(i, j),
pattern->lefiSitePattern::name(),
pattern->lefiSitePattern::x(),
pattern->lefiSitePattern::y(),
pattern->lefiSitePattern::orient(),
(int)pattern->lefiSitePattern::xStart(),
(int)pattern->lefiSitePattern::yStart(),
pattern->lefiSitePattern::xStep(),
pattern->lefiSitePattern::yStep());
if (status != LEFW_OK)
dataError();
}
status = lefwEndArrayFloorplan(a->lefiArray::floorPlanName(i));
if (status != LEFW_OK)
dataError();
}
}
defCaps = a->lefiArray::numDefaultCaps();
if (defCaps > 0) {
status = lefwStartArrayDefaultCap(defCaps);
if (status != LEFW_OK)
dataError();
for (i = 0; i < defCaps; i++) {
status = lefwArrayDefaultCap(a->lefiArray::defaultCapMinPins(i),
a->lefiArray::defaultCap(i));
if (status != LEFW_OK)
dataError();
}
status = lefwEndArrayDefaultCap();
if (status != LEFW_OK)
dataError();
}
return 0;
}
checkType(c);
status = lefwEndArray(name);
if (status != LEFW_OK)
return status;
return 0;
}
checkType(c);
status = lefwBusBitChars(busBit);
if (status != LEFW_OK)
dataError();
return 0;
}
if (caseSense == TRUE)
fprintf(fout, "NAMESCASESENSITIVE ON ;\n");
else
fprintf(fout, "NAMESCASESENSITIVE OFF ;\n");
return 0;
}
fprintf(fout, "IRDROP\n");
return 0;
}
checkType(c);
checkType(c);
lefrSetCaseSensitivity(0);
if (parse65nm)
layer->lefiLayer::parse65nmRules();
if (layer->lefiLayer::hasPitch())
fprintf(fout, " PITCH %g ;\n", layer->lefiLayer::pitch());
else if (layer->lefiLayer::hasXYPitch())
fprintf(fout, " PITCH %g %g ;\n", layer->lefiLayer::pitchX(),
layer->lefiLayer::pitchY());
if (layer->lefiLayer::hasOffset())
fprintf(fout, " OFFSET %g ;\n", layer->lefiLayer::offset());
else if (layer->lefiLayer::hasXYOffset())
fprintf(fout, " OFFSET %g %g ;\n", layer->lefiLayer::offsetX(),
layer->lefiLayer::offsetY());
if (layer->lefiLayer::hasDiagPitch())
fprintf(fout, " DIAGPITCH %g ;\n", layer->lefiLayer::diagPitch());
else if (layer->lefiLayer::hasXYDiagPitch())
fprintf(fout, " DIAGPITCH %g %g ;\n", layer->lefiLayer::diagPitchX(),
layer->lefiLayer::diagPitchY());
if (layer->lefiLayer::hasDiagWidth())
fprintf(fout, " DIAGWIDTH %g ;\n", layer->lefiLayer::diagWidth());
if (layer->lefiLayer::hasDiagSpacing())
fprintf(fout, " DIAGSPACING %g ;\n", layer->lefiLayer::diagSpacing());
if (layer->lefiLayer::hasWidth())
fprintf(fout, " WIDTH %g ;\n", layer->lefiLayer::width());
if (layer->lefiLayer::hasArea())
fprintf(fout, " AREA %g ;\n", layer->lefiLayer::area());
if (layer->lefiLayer::hasSlotWireWidth())
fprintf(fout, " SLOTWIREWIDTH %g ;\n", layer->lefiLayer::slotWireWidth());
if (layer->lefiLayer::hasSlotWireLength())
fprintf(fout, " SLOTWIRELENGTH %g ;\n",
layer->lefiLayer::slotWireLength());
if (layer->lefiLayer::hasSlotWidth())
fprintf(fout, " SLOTWIDTH %g ;\n", layer->lefiLayer::slotWidth());
if (layer->lefiLayer::hasSlotLength())
fprintf(fout, " SLOTLENGTH %g ;\n", layer->lefiLayer::slotLength());
if (layer->lefiLayer::hasMaxAdjacentSlotSpacing())
fprintf(fout, " MAXADJACENTSLOTSPACING %g ;\n",
layer->lefiLayer::maxAdjacentSlotSpacing());
if (layer->lefiLayer::hasMaxCoaxialSlotSpacing())
fprintf(fout, " MAXCOAXIALSLOTSPACING %g ;\n",
layer->lefiLayer::maxCoaxialSlotSpacing());
if (layer->lefiLayer::hasMaxEdgeSlotSpacing())
fprintf(fout, " MAXEDGESLOTSPACING %g ;\n",
layer->lefiLayer::maxEdgeSlotSpacing());
if (layer->lefiLayer::hasMaxFloatingArea()) // 5.7
fprintf(fout, " MAXFLOATINGAREA %g ;\n",
layer->lefiLayer::maxFloatingArea());
if (layer->lefiLayer::hasArraySpacing()) { // 5.7
fprintf(fout, " ARRAYSPACING ");
if (layer->lefiLayer::hasLongArray())
fprintf(fout, "LONGARRAY ");
if (layer->lefiLayer::hasViaWidth())
fprintf(fout, "WIDTH %g ", layer->lefiLayer::viaWidth());
fprintf(fout, "CUTSPACING %g", layer->lefiLayer::cutSpacing());
for (i = 0; i < layer->lefiLayer::numArrayCuts(); i++)
fprintf(fout, "\n\tARRAYCUTS %g SPACING %g",
layer->lefiLayer::arrayCuts(i),
layer->lefiLayer::arraySpacing(i));
fprintf(fout, " ;\n");
}
if (layer->lefiLayer::hasSplitWireWidth())
fprintf(fout, " SPLITWIREWIDTH %g ;\n",
layer->lefiLayer::splitWireWidth());
if (layer->lefiLayer::hasMinimumDensity())
fprintf(fout, " MINIMUMDENSITY %g ;\n",
layer->lefiLayer::minimumDensity());
if (layer->lefiLayer::hasMaximumDensity())
fprintf(fout, " MAXIMUMDENSITY %g ;\n",
layer->lefiLayer::maximumDensity());
if (layer->lefiLayer::hasDensityCheckWindow())
fprintf(fout, " DENSITYCHECKWINDOW %g %g ;\n",
layer->lefiLayer::densityCheckWindowLength(),
layer->lefiLayer::densityCheckWindowWidth());
if (layer->lefiLayer::hasDensityCheckStep())
fprintf(fout, " DENSITYCHECKSTEP %g ;\n",
layer->lefiLayer::densityCheckStep());
if (layer->lefiLayer::hasFillActiveSpacing())
fprintf(fout, " FILLACTIVESPACING %g ;\n",
layer->lefiLayer::fillActiveSpacing());
// 5.4.1
numMinCut = layer->lefiLayer::numMinimumcut();
if (numMinCut > 0) {
for (i = 0; i < numMinCut; i++) {
fprintf(fout, " MINIMUMCUT %d WIDTH %g ",
layer->lefiLayer::minimumcut(i),
layer->lefiLayer::minimumcutWidth(i));
if (layer->lefiLayer::hasMinimumcutWithin(i))
fprintf(fout, "WITHIN %g ", layer->lefiLayer::minimumcutWithin(i));
if (layer->lefiLayer::hasMinimumcutConnection(i))
fprintf(fout, "%s ", layer->lefiLayer::minimumcutConnection(i));
if (layer->lefiLayer::hasMinimumcutNumCuts(i))
fprintf(fout, "LENGTH %g WITHIN %g ",
layer->lefiLayer::minimumcutLength(i),
layer->lefiLayer::minimumcutDistance(i));
fprintf(fout, ";\n");
}
}
// 5.4.1
if (layer->lefiLayer::hasMaxwidth()) {
fprintf(fout, " MAXWIDTH %g ;\n", layer->lefiLayer::maxwidth());
}
// 5.5
if (layer->lefiLayer::hasMinwidth()) {
fprintf(fout, " MINWIDTH %g ;\n", layer->lefiLayer::minwidth());
}
// 5.5
numMinenclosed = layer->lefiLayer::numMinenclosedarea();
if (numMinenclosed > 0) {
for (i = 0; i < numMinenclosed; i++) {
fprintf(fout, " MINENCLOSEDAREA %g ",
layer->lefiLayer::minenclosedarea(i));
if (layer->lefiLayer::hasMinenclosedareaWidth(i))
fprintf(fout, "MINENCLOSEDAREAWIDTH %g ",
layer->lefiLayer::minenclosedareaWidth(i));
fprintf (fout, ";\n");
}
}
// 5.4.1 & 5.6
if (layer->lefiLayer::hasMinstep()) {
for (i = 0; i < layer->lefiLayer::numMinstep(); i++) {
fprintf(fout, " MINSTEP %g ", layer->lefiLayer::minstep(i));
if (layer->lefiLayer::hasMinstepType(i))
fprintf(fout, "%s ", layer->lefiLayer::minstepType(i));
if (layer->lefiLayer::hasMinstepLengthsum(i))
fprintf(fout, "LENGTHSUM %g ",
layer->lefiLayer::minstepLengthsum(i));
if (layer->lefiLayer::hasMinstepMaxedges(i))
fprintf(fout, "MAXEDGES %d ", layer->lefiLayer::minstepMaxedges(i));
fprintf(fout, ";\n");
}
}
// 5.4.1
if (layer->lefiLayer::hasProtrusion()) {
fprintf(fout, " PROTRUSIONWIDTH %g LENGTH %g WIDTH %g ;\n",
layer->lefiLayer::protrusionWidth1(),
layer->lefiLayer::protrusionLength(),
layer->lefiLayer::protrusionWidth2());
}
if (layer->lefiLayer::hasSpacingNumber()) {
for (i = 0; i < layer->lefiLayer::numSpacing(); i++) {
fprintf(fout, " SPACING %g ", layer->lefiLayer::spacing(i));
if (layer->lefiLayer::hasSpacingName(i))
fprintf(fout, "LAYER %s ", layer->lefiLayer::spacingName(i));
if (layer->lefiLayer::hasSpacingLayerStack(i))
fprintf(fout, "STACK "); // 5.7
if (layer->lefiLayer::hasSpacingAdjacent(i))
fprintf(fout, "ADJACENTCUTS %d WITHIN %g ",
layer->lefiLayer::spacingAdjacentCuts(i),
layer->lefiLayer::spacingAdjacentWithin(i));
if (layer->lefiLayer::hasSpacingAdjacentExcept(i)) // 5.7
fprintf(fout, "EXCEPTSAMEPGNET ");
if (layer->lefiLayer::hasSpacingCenterToCenter(i))
fprintf(fout, "CENTERTOCENTER ");
if (layer->lefiLayer::hasSpacingSamenet(i)) // 5.7
fprintf(fout, "SAMENET ");
if (layer->lefiLayer::hasSpacingSamenetPGonly(i)) // 5.7
fprintf(fout, "PGONLY ");
if (layer->lefiLayer::hasSpacingArea(i)) // 5.7
fprintf(fout, "AREA %g ", layer->lefiLayer::spacingArea(i));
if (layer->lefiLayer::hasSpacingRange(i)) {
fprintf(fout, "RANGE %g %g ", layer->lefiLayer::spacingRangeMin(i),
layer->lefiLayer::spacingRangeMax(i));
if (layer->lefiLayer::hasSpacingRangeUseLengthThreshold(i))
fprintf(fout, "USELENGTHTHRESHOLD ");
else if (layer->lefiLayer::hasSpacingRangeInfluence(i)) {
fprintf(fout, "INFLUENCE %g ",
layer->lefiLayer::spacingRangeInfluence(i));
if (layer->lefiLayer::hasSpacingRangeInfluenceRange(i))
fprintf(fout, "RANGE %g %g ",
layer->lefiLayer::spacingRangeInfluenceMin(i),
layer->lefiLayer::spacingRangeInfluenceMax(i));
} else if (layer->lefiLayer::hasSpacingRangeRange(i))
fprintf(fout, "RANGE %g %g ",
layer->lefiLayer::spacingRangeRangeMin(i),
layer->lefiLayer::spacingRangeRangeMax(i));
} else if (layer->lefiLayer::hasSpacingLengthThreshold(i)) {
fprintf(fout, "LENGTHTHRESHOLD %g ",
layer->lefiLayer::spacingLengthThreshold(i));
if (layer->lefiLayer::hasSpacingLengthThresholdRange(i))
fprintf(fout, "RANGE %g %g",
layer->lefiLayer::spacingLengthThresholdRangeMin(i),
layer->lefiLayer::spacingLengthThresholdRangeMax(i));
} else if (layer->lefiLayer::hasSpacingNotchLength(i)) {// 5.7
fprintf(fout, "NOTCHLENGTH %g",
layer->lefiLayer::spacingNotchLength(i));
} else if (layer->lefiLayer::hasSpacingEndOfNotchWidth(i)) // 5.7
fprintf(fout, "ENDOFNOTCHWIDTH %g NOTCHSPACING %g, NOTCHLENGTH %g",
layer->lefiLayer::spacingEndOfNotchWidth(i),
layer->lefiLayer::spacingEndOfNotchSpacing(i),
layer->lefiLayer::spacingEndOfNotchLength(i));
if (layer->lefiLayer::hasSpacingParallelOverlap(i)) // 5.7
fprintf(fout, "PARALLELOVERLAP ");
if (layer->lefiLayer::hasSpacingEndOfLine(i)) { // 5.7
fprintf(fout, "ENDOFLINE %g WITHING %g ",
layer->lefiLayer::spacingEolWidth(i),
layer->lefiLayer::spacingEolWithin(i));
if (layer->lefiLayer::hasSpacingParellelEdge(i)) {
fprintf(fout, "PARALLELEDGE %g WITHING %g ",
layer->lefiLayer::spacingParSpace(i),
layer->lefiLayer::spacingParWithin(i));
if (layer->lefiLayer::hasSpacingTwoEdges(i)) {
fprintf(fout, "TWOEDGES ");
}
}
}
fprintf(fout, ";\n");
}
}
if (layer->lefiLayer::hasSpacingTableOrtho()) { // 5.7
fprintf(fout, "SPACINGTABLE ORTHOGONAL");
ortho = layer->lefiLayer::orthogonal();
for (i = 0; i < ortho->lefiOrthogonal::numOrthogonal(); i++) {
fprintf(fout, "\n WITHIN %g SPACING %g",
ortho->lefiOrthogonal::cutWithin(i),
ortho->lefiOrthogonal::orthoSpacing(i));
}
fprintf(fout, ";\n");
}
for (i = 0; i < layer->lefiLayer::numEnclosure(); i++) {
fprintf(fout, "ENCLOSURE ");
if (layer->lefiLayer::hasEnclosureRule(i))
fprintf(fout, "%s ", layer->lefiLayer::enclosureRule(i));
fprintf(fout, "%g %g ", layer->lefiLayer::enclosureOverhang1(i),
layer->lefiLayer::enclosureOverhang2(i));
if (layer->lefiLayer::hasEnclosureWidth(i))
fprintf(fout, "WIDTH %g ", layer->lefiLayer::enclosureMinWidth(i));
if (layer->lefiLayer::hasEnclosureExceptExtraCut(i))
fprintf(fout, "EXCEPTEXTRACUT %g ",
layer->lefiLayer::enclosureExceptExtraCut(i));
if (layer->lefiLayer::hasEnclosureMinLength(i))
fprintf(fout, "LENGTH %g ", layer->lefiLayer::enclosureMinLength(i));
fprintf(fout, ";\n");
}
for (i = 0; i < layer->lefiLayer::numPreferEnclosure(); i++) {
fprintf(fout, "PREFERENCLOSURE ");
if (layer->lefiLayer::hasPreferEnclosureRule(i))
fprintf(fout, "%s ", layer->lefiLayer::preferEnclosureRule(i));
fprintf(fout, "%g %g ", layer->lefiLayer::preferEnclosureOverhang1(i),
layer->lefiLayer::preferEnclosureOverhang2(i));
if (layer->lefiLayer::hasPreferEnclosureWidth(i))
fprintf(fout, "WIDTH %g ",layer->lefiLayer::preferEnclosureMinWidth(i));
fprintf(fout, ";\n");
}
if (layer->lefiLayer::hasResistancePerCut())
fprintf(fout, " RESISTANCE %g ;\n",
layer->lefiLayer::resistancePerCut());
if (layer->lefiLayer::hasCurrentDensityPoint())
fprintf(fout, " CURRENTDEN %g ;\n",
layer->lefiLayer::currentDensityPoint());
if (layer->lefiLayer::hasCurrentDensityArray()) {
layer->lefiLayer::currentDensityArray(&numPoints, &widths, ¤t);
for (i = 0; i < numPoints; i++)
fprintf(fout, " CURRENTDEN ( %g %g ) ;\n", widths[i], current[i]);
}
if (layer->lefiLayer::hasDirection())
fprintf(fout, " DIRECTION %s ;\n", layer->lefiLayer::direction());
if (layer->lefiLayer::hasResistance())
fprintf(fout, " RESISTANCE RPERSQ %g ;\n",
layer->lefiLayer::resistance());
if (layer->lefiLayer::hasCapacitance())
fprintf(fout, " CAPACITANCE CPERSQDIST %g ;\n",
layer->lefiLayer::capacitance());
if (layer->lefiLayer::hasEdgeCap())
fprintf(fout, " EDGECAPACITANCE %g ;\n", layer->lefiLayer::edgeCap());
if (layer->lefiLayer::hasHeight())
fprintf(fout, " TYPE %g ;\n", layer->lefiLayer::height());
if (layer->lefiLayer::hasThickness())
fprintf(fout, " THICKNESS %g ;\n", layer->lefiLayer::thickness());
if (layer->lefiLayer::hasWireExtension())
fprintf(fout, " WIREEXTENSION %g ;\n", layer->lefiLayer::wireExtension());
if (layer->lefiLayer::hasShrinkage())
fprintf(fout, " SHRINKAGE %g ;\n", layer->lefiLayer::shrinkage());
if (layer->lefiLayer::hasCapMultiplier())
fprintf(fout, " CAPMULTIPLIER %g ;\n", layer->lefiLayer::capMultiplier());
if (layer->lefiLayer::hasAntennaArea())
fprintf(fout, " ANTENNAAREAFACTOR %g ;\n",
layer->lefiLayer::antennaArea());
if (layer->lefiLayer::hasAntennaLength())
fprintf(fout, " ANTENNALENGTHFACTOR %g ;\n",
layer->lefiLayer::antennaLength());
// 5.5 AntennaModel
for (i = 0; i < layer->lefiLayer::numAntennaModel(); i++) {
aModel = layer->lefiLayer::antennaModel(i);
if (aModel->lefiAntennaModel::hasAntennaAreaRatio())
pwl = aModel->lefiAntennaModel::antennaDiffSideAreaRatioPWL();
fprintf(fout, " ANTENNADIFFSIDEAREARATIO PWL ( ");
for (j = 0; j < pwl->lefiAntennaPWL::numPWL(); j++)
fprintf(fout, "( %g %g ) ", pwl->lefiAntennaPWL::PWLdiffusion(j),
pwl->lefiAntennaPWL::PWLratio(j));
fprintf(fout, ") ;\n");
}
if (aModel->lefiAntennaModel::hasAntennaCumSideAreaRatio())
fprintf(fout, " ANTENNACUMSIDEAREARATIO %g ;\n",
aModel->lefiAntennaModel::antennaCumSideAreaRatio());
if (aModel->lefiAntennaModel::hasAntennaCumDiffSideAreaRatio())
fprintf(fout, " ANTENNACUMDIFFSIDEAREARATIO %g\n",
aModel->lefiAntennaModel::antennaCumDiffSideAreaRatio());
else if (aModel->lefiAntennaModel::hasAntennaCumDiffSideAreaRatioPWL()) {
pwl = aModel->lefiAntennaModel::antennaCumDiffSideAreaRatioPWL();
fprintf(fout, " ANTENNACUMDIFFSIDEAREARATIO PWL ( ");
for (j = 0; j < pwl->lefiAntennaPWL::numPWL(); j++)
fprintf(fout, "( %g %g ) ", pwl->lefiAntennaPWL::PWLdiffusion(j),
pwl->lefiAntennaPWL::PWLratio(j));
fprintf(fout, ") ;\n");
}
if (aModel->lefiAntennaModel::hasAntennaSideAreaFactor()) {
fprintf(fout, " ANTENNASIDEAREAFACTOR %g ",
aModel->lefiAntennaModel::antennaSideAreaFactor());
if (aModel->lefiAntennaModel::hasAntennaSideAreaFactorDUO())
fprintf(fout, " DIFFUSEONLY ");
fprintf(fout, ";\n");
}
if (aModel->lefiAntennaModel::hasAntennaCumRoutingPlusCut())
fprintf(fout, " ANTENNACUMROUTINGPLUSCUT ;\n");
if (aModel->lefiAntennaModel::hasAntennaGatePlusDiff())
fprintf(fout, " ANTENNAGATEPLUSDIFF %g ;\n",
aModel->lefiAntennaModel::antennaGatePlusDiff());
if (aModel->lefiAntennaModel::hasAntennaAreaMinusDiff())
fprintf(fout, " ANTENNAAREAMINUSDIFF %g ;\n",
aModel->lefiAntennaModel::antennaAreaMinusDiff());
if (aModel->lefiAntennaModel::hasAntennaAreaDiffReducePWL()) {
pwl = aModel->lefiAntennaModel::antennaAreaDiffReducePWL();
fprintf(fout, " ANTENNAAREADIFFREDUCEPWL ( ");
for (j = 0; j < pwl->lefiAntennaPWL::numPWL(); j++)
fprintf(fout, "( %g %g ) ", pwl->lefiAntennaPWL::PWLdiffusion(j),
pwl->lefiAntennaPWL::PWLratio(j));
fprintf(fout, ") ;\n");
}
}
if (layer->lefiLayer::numAccurrentDensity()) {
for (i = 0; i < layer->lefiLayer::numAccurrentDensity(); i++) {
density = layer->lefiLayer::accurrent(i);
fprintf(fout, " ACCURRENTDENSITY %s", density->type());
if (density->hasOneEntry())
fprintf(fout, " %g ;\n", density->oneEntry());
else {
fprintf(fout, "\n");
if (density->numFrequency()) {
fprintf(fout, " FREQUENCY");
for (j = 0; j < density->numFrequency(); j++)
fprintf(fout, " %g", density->frequency(j));
fprintf(fout, " ;\n");
}
if (density->numCutareas()) {
fprintf(fout, " CUTAREA");
for (j = 0; j < density->numCutareas(); j++)
fprintf(fout, " %g", density->cutArea(j));
fprintf(fout, " ;\n");
}
if (density->numWidths()) {
fprintf(fout, " WIDTH");
for (j = 0; j < density->numWidths(); j++)
fprintf(fout, " %g", density->width(j));
fprintf(fout, " ;\n");
}
if (density->numTableEntries()) {
k = 5;
fprintf(fout, " TABLEENTRIES");
for (j = 0; j < density->numTableEntries(); j++)
if (k > 4) {
fprintf(fout, "\n %g", density->tableEntry(j));
k = 1;
} else {
fprintf(fout, " %g", density->tableEntry(j));
k++;
}
fprintf(fout, " ;\n");
}
}
}
}
if (layer->lefiLayer::numDccurrentDensity()) {
for (i = 0; i < layer->lefiLayer::numDccurrentDensity(); i++) {
density = layer->lefiLayer::dccurrent(i);
fprintf(fout, " DCCURRENTDENSITY %s", density->type());
if (density->hasOneEntry())
fprintf(fout, " %g ;\n", density->oneEntry());
else {
fprintf(fout, "\n");
if (density->numCutareas()) {
fprintf(fout, " CUTAREA");
for (j = 0; j < density->numCutareas(); j++)
fprintf(fout, " %g", density->cutArea(j));
fprintf(fout, " ;\n");
}
if (density->numWidths()) {
fprintf(fout, " WIDTH");
for (j = 0; j < density->numWidths(); j++)
fprintf(fout, " %g", density->width(j));
fprintf(fout, " ;\n");
}
if (density->numTableEntries()) {
fprintf(fout, " TABLEENTRIES");
for (j = 0; j < density->numTableEntries(); j++)
fprintf(fout, " %g", density->tableEntry(j));
fprintf(fout, " ;\n");
}
}
}
}
propNum = layer->lefiLayer::numProps();
if (propNum > 0) {
fprintf(fout, " PROPERTY ");
for (i = 0; i < propNum; i++) {
return 0;
}
checkType(c);
if (macro->lefiMacro::hasClass())
fprintf(fout, " CLASS %s ;\n", macro->lefiMacro::macroClass());
if (macro->lefiMacro::hasEEQ())
fprintf(fout, " EEQ %s ;\n", macro->lefiMacro::EEQ());
if (macro->lefiMacro::hasLEQ())
fprintf(fout, " LEQ %s ;\n", macro->lefiMacro::LEQ());
if (macro->lefiMacro::hasSource())
fprintf(fout, " SOURCE %s ;\n", macro->lefiMacro::source());
if (macro->lefiMacro::hasXSymmetry()) {
fprintf(fout, " SYMMETRY X ");
hasPrtSym = 1;
}
if (macro->lefiMacro::hasYSymmetry()) { // print X Y & R90 in one line
if (!hasPrtSym) {
fprintf(fout, " SYMMETRY Y ");
hasPrtSym = 1;
}
else
fprintf(fout, "Y ");
}
if (macro->lefiMacro::has90Symmetry()) {
if (!hasPrtSym) {
fprintf(fout, " SYMMETRY R90 ");
hasPrtSym = 1;
}
else
fprintf(fout, "R90 ");
}
if (hasPrtSym) {
fprintf (fout, ";\n");
hasPrtSym = 0;
}
if (macro->lefiMacro::hasSiteName())
fprintf(fout, " SITE %s ;\n", macro->lefiMacro::siteName());
if (macro->lefiMacro::hasSitePattern()) {
for (i = 0; i < macro->lefiMacro::numSitePattern(); i++ ) {
pattern = macro->lefiMacro::sitePattern(i);
if (pattern->lefiSitePattern::hasStepPattern()) {
fprintf(fout, " SITE %s %g %g %s DO %g BY %g STEP %g %g ;\n",
pattern->lefiSitePattern::name(), pattern->lefiSitePattern::x(),
pattern->lefiSitePattern::y(),
orientStr(pattern->lefiSitePattern::orient()),
pattern->lefiSitePattern::xStart(),
pattern->lefiSitePattern::yStart(),
pattern->lefiSitePattern::xStep(),
pattern->lefiSitePattern::yStep());
} else {
fprintf(fout, " SITE %s %g %g %s ;\n",
pattern->lefiSitePattern::name(), pattern->lefiSitePattern::x(),
pattern->lefiSitePattern::y(),
orientStr(pattern->lefiSitePattern::orient()));
}
}
}
if (macro->lefiMacro::hasSize())
fprintf(fout, " SIZE %g BY %g ;\n", macro->lefiMacro::sizeX(),
macro->lefiMacro::sizeY());
if (macro->lefiMacro::hasForeign()) {
for (i = 0; i < macro->lefiMacro::numForeigns(); i++) {
switch (macro->lefiMacro::propType(i)) {
case 'R': fprintf(fout, "REAL ");
break;
case 'I': fprintf(fout, "INTEGER ");
break;
case 'S': fprintf(fout, "STRING ");
break;
case 'Q': fprintf(fout, "QUOTESTRING ");
break;
case 'N': fprintf(fout, "NUMBER ");
break;
}
}
fprintf(fout, ";\n");
}
return 0;
}
int i;
lefiVia* via;
lefiSpacing* spacing;
checkType(c);
// handle usevia
for (i = 0; i < def->lefiNonDefault::numUseVia(); i++)
fprintf(fout, " USEVIA %s ;\n", def->lefiNonDefault::viaName(i));
// handle useviarule
for (i = 0; i < def->lefiNonDefault::numUseViaRule(); i++)
fprintf(fout, " USEVIARULE %s ;\n",
def->lefiNonDefault::viaRuleName(i));
// handle mincuts
for (i = 0; i < def->lefiNonDefault::numMinCuts(); i++) {
fprintf(fout, " MINCUTS %s %d ;\n", def->lefiNonDefault::cutLayerName(i),
def->lefiNonDefault::numCuts(i));
}
}
fprintf(fout, ";\n");
}
fprintf(fout, "END %s ;\n", def->lefiNonDefault::name());
return 0;
}
checkType(c);
checkType(c);
if (pin->lefiPin::hasRiseVoltage())
fprintf(fout, " RISEVOLTAGETHRESHOLD %g ;\n",
pin->lefiPin::riseVoltage());
if (pin->lefiPin::hasFallVoltage())
fprintf(fout, " FALLVOLTAGETHRESHOLD %g ;\n",
pin->lefiPin::fallVoltage());
if (pin->lefiPin::hasRiseThresh())
fprintf(fout, " RISETHRESH %g ;\n", pin->lefiPin::riseThresh());
if (pin->lefiPin::hasFallThresh())
fprintf(fout, " FALLTHRESH %g ;\n", pin->lefiPin::fallThresh());
if (pin->lefiPin::hasRiseSatcur())
fprintf(fout, " RISESATCUR %g ;\n", pin->lefiPin::riseSatcur());
if (pin->lefiPin::hasFallSatcur())
fprintf(fout, " FALLSATCUR %g ;\n", pin->lefiPin::fallSatcur());
if (pin->lefiPin::hasRiseSlewLimit())
fprintf(fout, " RISESLEWLIMIT %g ;\n", pin->lefiPin::riseSlewLimit());
if (pin->lefiPin::hasFallSlewLimit())
fprintf(fout, " FALLSLEWLIMIT %g ;\n", pin->lefiPin::fallSlewLimit());
if (pin->lefiPin::hasCurrentSource())
fprintf(fout, " CURRENTSOURCE %s ;\n", pin->lefiPin::currentSource());
if (pin->lefiPin::hasTables())
fprintf(fout, " IV_TABLES %s %s ;\n", pin->lefiPin::tableHighName(),
pin->lefiPin::tableLowName());
if (pin->lefiPin::hasTaperRule())
fprintf(fout, " TAPERRULE %s ;\n", pin->lefiPin::taperRule());
if (pin->lefiPin::hasNetExpr())
fprintf(fout, " NETEXPR \"%s\" ;\n", pin->lefiPin::netExpr());
if (pin->lefiPin::hasSupplySensitivity())
fprintf(fout, " SUPPLYSENSITIVITY %s ;\n",
pin->lefiPin::supplySensitivity());
if (pin->lefiPin::hasGroundSensitivity())
fprintf(fout, " GROUNDSENSITIVITY %s ;\n",
pin->lefiPin::groundSensitivity());
if (pin->lefiPin::hasAntennaSize()) {
for (i = 0; i < pin->lefiPin::numAntennaSize(); i++) {
fprintf(fout, " ANTENNASIZE %g ", pin->lefiPin::antennaSize(i));
if (pin->lefiPin::antennaSizeLayer(i))
fprintf(fout, "LAYER %s ", pin->lefiPin::antennaSizeLayer(i));
fprintf(fout, ";\n");
}
}
if (pin->lefiPin::hasAntennaMetalArea()) {
for (i = 0; i < pin->lefiPin::numAntennaMetalArea(); i++) {
fprintf(fout, " ANTENNAMETALAREA %g ",
pin->lefiPin::antennaMetalArea(i));
if (pin->lefiPin::antennaMetalAreaLayer(i))
fprintf(fout, "LAYER %s ", pin->lefiPin::antennaMetalAreaLayer(i));
fprintf(fout, ";\n");
}
}
if (pin->lefiPin::hasAntennaMetalLength()) {
for (i = 0; i < pin->lefiPin::numAntennaMetalLength(); i++) {
fprintf(fout, " ANTENNAMETALLENGTH %g ",
pin->lefiPin::antennaMetalLength(i));
if (pin->lefiPin::antennaMetalLengthLayer(i))
fprintf(fout, "LAYER %s ", pin->lefiPin::antennaMetalLengthLayer(i));
fprintf(fout, ";\n");
}
}
if (pin->lefiPin::hasAntennaPartialMetalArea()) {
for (i = 0; i < pin->lefiPin::numAntennaPartialMetalArea(); i++) {
fprintf(fout, " ANTENNAPARTIALMETALAREA %g ",
pin->lefiPin::antennaPartialMetalArea(i));
if (pin->lefiPin::antennaPartialMetalAreaLayer(i))
fprintf(fout, "LAYER %s ",
pin->lefiPin::antennaPartialMetalAreaLayer(i));
fprintf(fout, ";\n");
}
}
if (pin->lefiPin::hasAntennaPartialMetalSideArea()) {
for (i = 0; i < pin->lefiPin::numAntennaPartialMetalSideArea(); i++) {
fprintf(fout, " ANTENNAPARTIALMETALSIDEAREA %g ",
pin->lefiPin::antennaPartialMetalSideArea(i));
if (pin->lefiPin::antennaPartialMetalSideAreaLayer(i))
fprintf(fout, "LAYER %s ",
pin->lefiPin::antennaPartialMetalSideAreaLayer(i));
fprintf(fout, ";\n");
}
}
if (pin->lefiPin::hasAntennaPartialCutArea()) {
for (i = 0; i < pin->lefiPin::numAntennaPartialCutArea(); i++) {
fprintf(fout, " ANTENNAPARTIALCUTAREA %g ",
pin->lefiPin::antennaPartialCutArea(i));
if (pin->lefiPin::antennaPartialCutAreaLayer(i))
fprintf(fout, "LAYER %s ",
pin->lefiPin::antennaPartialCutAreaLayer(i));
fprintf(fout, ";\n");
}
}
if (pin->lefiPin::hasAntennaDiffArea()) {
for (i = 0; i < pin->lefiPin::numAntennaDiffArea(); i++) {
fprintf(fout, " ANTENNADIFFAREA %g ",
pin->lefiPin::antennaDiffArea(i));
if (pin->lefiPin::antennaDiffAreaLayer(i))
fprintf(fout, "LAYER %s ", pin->lefiPin::antennaDiffAreaLayer(i));
fprintf(fout, ";\n");
}
}
if (aModel->lefiPinAntennaModel::hasAntennaGateArea()) {
for (i = 0; i < aModel->lefiPinAntennaModel::numAntennaGateArea(); i++)
{
fprintf(fout, " ANTENNAGATEAREA %g ",
aModel->lefiPinAntennaModel::antennaGateArea(i));
if (aModel->lefiPinAntennaModel::antennaGateAreaLayer(i))
fprintf(fout, "LAYER %s ",
aModel->lefiPinAntennaModel::antennaGateAreaLayer(i));
fprintf(fout, ";\n");
}
}
if (aModel->lefiPinAntennaModel::hasAntennaMaxAreaCar()) {
for (i = 0; i < aModel->lefiPinAntennaModel::numAntennaMaxAreaCar();
i++) {
fprintf(fout, " ANTENNAMAXAREACAR %g ",
aModel->lefiPinAntennaModel::antennaMaxAreaCar(i));
if (aModel->lefiPinAntennaModel::antennaMaxAreaCarLayer(i))
fprintf(fout, "LAYER %s ",
aModel->lefiPinAntennaModel::antennaMaxAreaCarLayer(i));
fprintf(fout, ";\n");
}
}
if (aModel->lefiPinAntennaModel::hasAntennaMaxSideAreaCar()) {
for (i = 0; i < aModel->lefiPinAntennaModel::numAntennaMaxSideAreaCar();
i++) {
fprintf(fout, " ANTENNAMAXSIDEAREACAR %g ",
aModel->lefiPinAntennaModel::antennaMaxSideAreaCar(i));
if (aModel->lefiPinAntennaModel::antennaMaxSideAreaCarLayer(i))
fprintf(fout, "LAYER %s ",
aModel->lefiPinAntennaModel::antennaMaxSideAreaCarLayer(i));
fprintf(fout, ";\n");
}
}
if (aModel->lefiPinAntennaModel::hasAntennaMaxCutCar()) {
for (i = 0; i < aModel->lefiPinAntennaModel::numAntennaMaxCutCar(); i++)
{
fprintf(fout, " ANTENNAMAXCUTCAR %g ",
aModel->lefiPinAntennaModel::antennaMaxCutCar(i));
if (aModel->lefiPinAntennaModel::antennaMaxCutCarLayer(i))
fprintf(fout, "LAYER %s ",
aModel->lefiPinAntennaModel::antennaMaxCutCarLayer(i));
fprintf(fout, ";\n");
}
}
}
if (pin->lefiPin::numProperties() > 0) {
fprintf(fout, " PROPERTY ");
for (i = 0; i < pin->lefiPin::numProperties(); i++) {
// value can either be a string or number
if (pin->lefiPin::propValue(i)) {
fprintf(fout, "%s %s ", pin->lefiPin::propName(i),
pin->lefiPin::propValue(i));
}
else
fprintf(fout, "%s %g ", pin->lefiPin::propName(i),
pin->lefiPin::propNum(i));
switch (pin->lefiPin::propType(i)) {
case 'R': fprintf(fout, "REAL ");
break;
case 'I': fprintf(fout, "INTEGER ");
break;
case 'S': fprintf(fout, "STRING ");
break;
case 'Q': fprintf(fout, "QUOTESTRING ");
break;
case 'N': fprintf(fout, "NUMBER ");
break;
}
}
fprintf(fout, ";\n");
}
numPorts = pin->lefiPin::numPorts();
for (i = 0; i < numPorts; i++) {
fprintf(fout," PORT\n");
geometry = pin->lefiPin::port(i);
prtGeometry(geometry);
fprintf(fout, " END\n");
}
fprintf(fout, " END %s\n", pin->lefiPin::name());
return 0;
}
checkType(c);
checkType(c);
fprintf(fout, "PROPERTYDEFINITIONS\n");
return 0;
}
checkType(c);
prop->lefiProp::right());
if (prop->lefiProp::hasString())
fprintf(fout, " %s", prop->lefiProp::string());
fprintf(fout, "\n");
return 0;
}
checkType(c);
checkType(c);
hasPrtSym = 1;
}
}
if (hasPrtSym)
fprintf(fout, ";\n");
if (site->lefiSite::hasSize())
fprintf(fout, " SIZE %g BY %g ;\n", site->lefiSite::sizeX(),
site->lefiSite::sizeY());
if (site->hasRowPattern()) {
fprintf(fout, " ROWPATTERN ");
for (i = 0; i < site->lefiSite::numSites(); i++)
fprintf(fout, " %s %s ", site->lefiSite::siteName(i),
site->lefiSite::siteOrientStr(i));
fprintf(fout, ";\n");
}
fprintf(fout, "SPACING\n");
return 0;
}
lefSpacing(spacing);
return 0;
}
fprintf(fout, "TIMING\n");
for (i = 0; i < timing->numFromPins(); i++)
fprintf(fout, " FROMPIN %s ;\n", timing->fromPin(i));
for (i = 0; i < timing->numToPins(); i++)
fprintf(fout, " TOPIN %s ;\n", timing->toPin(i));
fprintf(fout, " RISE SLEW1 %g %g %g %g ;\n", timing->riseSlewOne(),
timing->riseSlewTwo(), timing->riseSlewThree(),
timing->riseSlewFour());
if (timing->hasRiseSlew2())
fprintf(fout, " RISE SLEW2 %g %g %g ;\n", timing->riseSlewFive(),
timing->riseSlewSix(), timing->riseSlewSeven());
if (timing->hasFallSlew())
fprintf(fout, " FALL SLEW1 %g %g %g %g ;\n", timing->fallSlewOne(),
timing->fallSlewTwo(), timing->fallSlewThree(),
timing->fallSlewFour());
if (timing->hasFallSlew2())
fprintf(fout, " FALL SLEW2 %g %g %g ;\n", timing->fallSlewFive(),
timing->fallSlewSix(), timing->riseSlewSeven());
if (timing->hasRiseIntrinsic()) {
fprintf(fout, "TIMING RISE INTRINSIC %g %g ;\n",
timing->riseIntrinsicOne(), timing->riseIntrinsicTwo());
fprintf(fout, "TIMING RISE VARIABLE %g %g ;\n",
timing->riseIntrinsicThree(), timing->riseIntrinsicFour());
}
if (timing->hasFallIntrinsic()) {
fprintf(fout, "TIMING FALL INTRINSIC %g %g ;\n",
timing->fallIntrinsicOne(), timing->fallIntrinsicTwo());
fprintf(fout, "TIMING RISE VARIABLE %g %g ;\n",
timing->fallIntrinsicThree(), timing->fallIntrinsicFour());
}
if (timing->hasRiseRS())
fprintf(fout, "TIMING RISERS %g %g ;\n",
timing->riseRSOne(), timing->riseRSTwo());
if (timing->hasRiseCS())
fprintf(fout, "TIMING RISECS %g %g ;\n",
timing->riseCSOne(), timing->riseCSTwo());
if (timing->hasFallRS())
fprintf(fout, "TIMING FALLRS %g %g ;\n",
timing->fallRSOne(), timing->fallRSTwo());
if (timing->hasFallCS())
fprintf(fout, "TIMING FALLCS %g %g ;\n",
timing->fallCSOne(), timing->fallCSTwo());
if (timing->hasUnateness())
fprintf(fout, "TIMING UNATENESS %s ;\n", timing->unateness());
if (timing->hasRiseAtt1())
fprintf(fout, "TIMING RISESATT1 %g %g ;\n", timing->riseAtt1One(),
timing->riseAtt1Two());
if (timing->hasFallAtt1())
fprintf(fout, "TIMING FALLSATT1 %g %g ;\n", timing->fallAtt1One(),
timing->fallAtt1Two());
if (timing->hasRiseTo())
fprintf(fout, "TIMING RISET0 %g %g ;\n", timing->riseToOne(),
timing->riseToTwo());
if (timing->hasFallTo())
fprintf(fout, "TIMING FALLT0 %g %g ;\n", timing->fallToOne(),
timing->fallToTwo());
if (timing->hasSDFonePinTrigger())
fprintf(fout, " %s TABLEDIMENSION %g %g %g ;\n",
timing->SDFonePinTriggerType(), timing->SDFtriggerOne(),
timing->SDFtriggerTwo(), timing->SDFtriggerThree());
if (timing->hasSDFtwoPinTrigger())
fprintf(fout, " %s %s %s TABLEDIMENSION %g %g %g ;\n",
timing->SDFtwoPinTriggerType(), timing->SDFfromTrigger(),
timing->SDFtoTrigger(), timing->SDFtriggerOne(),
timing->SDFtriggerTwo(), timing->SDFtriggerThree());
fprintf(fout, "END TIMING\n");
return 0;
}
fprintf(fout, "UNITS\n");
if (unit->lefiUnits::hasDatabase())
fprintf(fout, " DATABASE %s %g ;\n", unit->lefiUnits::databaseName(),
unit->lefiUnits::databaseNumber());
if (unit->lefiUnits::hasCapacitance())
lefVia(via);
return 0;
}
checkType(c);
numLayers = viaRule->lefiViaRule::numLayers();
for (i = 0; i < numLayers; i++) {
vLayer = viaRule->lefiViaRule::layer(i);
lefViaRuleLayer(vLayer);
}
if (viaRule->lefiViaRule::propValue(i))
fprintf(fout, "%s ", viaRule->lefiViaRule::propValue(i));
switch (viaRule->lefiViaRule::propType(i)) {
case 'R': fprintf(fout, "REAL ");
break;
case 'I': fprintf(fout, "INTEGER ");
break;
case 'S': fprintf(fout, "STRING ");
break;
case 'Q': fprintf(fout, "QUOTESTRING ");
break;
case 'N': fprintf(fout, "NUMBER ");
break;
}
}
fprintf(fout, ";\n");
}
fprintf(fout, "END %s\n", viaRule->lefiViaRule::name());
return 0;
}
int
main(int argc, char** argv) {
char* inFile[100];
char* outFile;
FILE* f;
int res;
int noCalls = 0;
int num;
int status;
int retStr = 0;
int numInFile = 0;
int fileCt = 0;
int relax = 0;
char* version;
int setVer = 0;
char* userData;
int msgCb = 0;
outFile = defaultOut;
fout = stdout;
argc--;
argv++;
while (argc--) {
if (strcmp(*argv, "-d") == 0) {
argv++;
argc--;
sscanf(*argv, "%d", &num);
lefiSetDebug(num, 1);
} else {
fprintf(stderr, "ERROR: Illegal command line option: '%s'\n", *argv);
return 2;
}
argv++;
}
if (noCalls == 0) {
lefrSetAntennaInputCbk(antennaCB);
lefrSetAntennaInoutCbk(antennaCB);
lefrSetAntennaOutputCbk(antennaCB);
lefrSetArrayBeginCbk(arrayBeginCB);
lefrSetArrayCbk(arrayCB);
lefrSetArrayEndCbk(arrayEndCB);
lefrSetBusBitCharsCbk(busBitCharsCB);
lefrSetCaseSensitiveCbk(caseSensCB);
lefrSetClearanceMeasureCbk(clearanceCB);
lefrSetDensityCbk(densityCB);
lefrSetDividerCharCbk(dividerCB);
lefrSetNoWireExtensionCbk(noWireExtCB);
lefrSetEdgeRateThreshold1Cbk(edge1CB);
lefrSetEdgeRateThreshold2Cbk(edge2CB);
lefrSetEdgeRateScaleFactorCbk(edgeScaleCB);
lefrSetExtensionCbk(extensionCB);
lefrSetDielectricCbk(dielectricCB);
lefrSetIRDropBeginCbk(irdropBeginCB);
lefrSetIRDropCbk(irdropCB);
lefrSetIRDropEndCbk(irdropEndCB);
lefrSetLayerCbk(layerCB);
lefrSetLibraryEndCbk(doneCB);
lefrSetMacroBeginCbk(macroBeginCB);
lefrSetMacroCbk(macroCB);
lefrSetMacroClassTypeCbk(macroClassTypeCB);
lefrSetMacroEndCbk(macroEndCB);
lefrSetManufacturingCbk(manufacturingCB);
lefrSetMaxStackViaCbk(maxStackViaCB);
lefrSetMinFeatureCbk(minFeatureCB);
lefrSetNonDefaultCbk(nonDefaultCB);
lefrSetObstructionCbk(obstructionCB);
lefrSetPinCbk(pinCB);
lefrSetPropBeginCbk(propDefBeginCB);
lefrSetPropCbk(propDefCB);
lefrSetPropEndCbk(propDefEndCB);
lefrSetSiteCbk(siteCB);
lefrSetSpacingBeginCbk(spacingBeginCB);
lefrSetSpacingCbk(spacingCB);
lefrSetSpacingEndCbk(spacingEndCB);
lefrSetTimingCbk(timingCB);
lefrSetUnitsCbk(unitsCB);
lefrSetUseMinSpacingCbk(useMinSpacingCB);
lefrSetUserData((void*)3);
if (!retStr)
lefrSetVersionCbk(versionCB);
else
lefrSetVersionStrCbk(versionStrCB);
lefrSetViaCbk(viaCB);
lefrSetViaRuleCbk(viaRuleCB);
lefrSetInputAntennaCbk(antennaCB);
lefrSetOutputAntennaCbk(antennaCB);
lefrSetInoutAntennaCbk(antennaCB);
if (msgCb) {
lefrSetLogFunction(errorCB);
lefrSetWarningLogFunction(warningCB);
}
lefrSetMallocFunction(mallocCB);
lefrSetReallocFunction(reallocCB);
lefrSetFreeFunction(freeCB);
lefrSetLineNumberFunction(lineNumberCB);
lefrSetDeltaNumberLines(50);
lefrSetRegisterUnusedCallbacks();
if (relax)
lefrSetRelaxMode();
if (setVer)
(void)lefrSetVersionValue(version);
lefrSetAntennaInoutWarnings(30);
lefrSetAntennaInputWarnings(30);
lefrSetAntennaOutputWarnings(30);
lefrSetArrayWarnings(30);
lefrSetCaseSensitiveWarnings(30);
lefrSetCorrectionTableWarnings(30);
lefrSetDielectricWarnings(30);
lefrSetEdgeRateThreshold1Warnings(30);
lefrSetEdgeRateThreshold2Warnings(30);
lefrSetEdgeRateScaleFactorWarnings(30);
lefrSetInoutAntennaWarnings(30);
lefrSetInputAntennaWarnings(30);
lefrSetIRDropWarnings(30);
lefrSetLayerWarnings(30);
lefrSetMacroWarnings(30);
lefrSetMaxStackViaWarnings(30);
lefrSetMinFeatureWarnings(30);
lefrSetNoiseMarginWarnings(30);
lefrSetNoiseTableWarnings(30);
lefrSetNonDefaultWarnings(30);
lefrSetNoWireExtensionWarnings(30);
lefrSetOutputAntennaWarnings(30);
lefrSetPinWarnings(30);
lefrSetSiteWarnings(30);
lefrSetSpacingWarnings(30);
lefrSetTimingWarnings(30);
lefrSetUnitsWarnings(30);
lefrSetUseMinSpacingWarnings(30);
lefrSetViaRuleWarnings(30);
lefrSetViaWarnings(30);
}
lefrInit();
if ((f = fopen(inFile[fileCt],"r")) == 0) {
fprintf(stderr,"Couldn't open input file '%s'\n", inFile[fileCt]);
return(2);
}
(void)lefrEnableReadEncrypted();
if (res)
fprintf(stderr, "Reader returns bad status.\n", inFile[fileCt]);
(void)lefrPrintUnusedCallbacks(fout);
(void)lefrReleaseNResetMemory();
}
fclose(fout);
return 0;
}
char defaultOut[128];
// Global variables
FILE* fout;
#define CHECK_STATUS(status) \
if (status) { \
lefwPrintError(status); \
return(status); \
}
double *xpath;
double *ypath;
double *xl;
double *yl;
double *wthn, *spng;
argc--;
argv++;
while (argc--) {
if (strcmp(*argv, "-o") == 0) { // output filename
argv++;
argc--;
outfile = *argv;
if ((fout = fopen(outfile, "w")) == 0) {
fprintf(stderr, "ERROR: could not open output file\n");
return 2;
}
} else if (strncmp(*argv, "-h", 2) == 0) { // compare with -h[elp]
fprintf(stderr, "Usage: lefwrite [-o <filename>] [-help]\n");
return 1;
} else {
fprintf(stderr, "ERROR: Illegal command line option: '%s'\n", *argv);
return 2;
}
argv++;
}
// initalize
status = lefwInit(fout);
CHECK_STATUS(status);
status = lefwVersion(5, 7);
CHECK_STATUS(status);
status = lefwBusBitChars("<>");
CHECK_STATUS(status);
status = lefwDividerChar(":");
CHECK_STATUS(status);
status = lefwManufacturingGrid(3.5);
CHECK_STATUS(status);
status = lefwUseMinSpacing("OBS", "OFF");
CHECK_STATUS(status);
status = lefwClearanceMeasure("EUCLIDEAN");
CHECK_STATUS(status);
status = lefwNewLine();
CHECK_STATUS(status);
// 5.4 ANTENNA
status = lefwAntennaInputGateArea(45);
CHECK_STATUS(status);
status = lefwAntennaInOutDiffArea(65);
CHECK_STATUS(status);
status = lefwAntennaOutputDiffArea(55);
CHECK_STATUS(status);
status = lefwNewLine();
CHECK_STATUS(status);
// UNITS
status = lefwStartUnits();
CHECK_STATUS(status);
status = lefwUnits(100, 10, 10000, 10000, 10000, 1000, 20000);
CHECK_STATUS(status);
status = lefwUnitsFrequency(10);
CHECK_STATUS(status);
status = lefwEndUnits();
CHECK_STATUS(status);
// PROPERTYDEFINITIONS
status = lefwStartPropDef();
CHECK_STATUS(status);
status = lefwStringPropDef("LIBRARY", "NAME", 0, 0, "Cadence96");
CHECK_STATUS(status);
status = lefwIntPropDef("LIBRARY", "intNum", 0, 0, 20);
CHECK_STATUS(status);
status = lefwRealPropDef("LIBRARY", "realNum", 0, 0, 21.22);
CHECK_STATUS(status);
status = lefwStringPropDef("PIN", "TYPE", 0, 0, 0);
CHECK_STATUS(status);
status = lefwIntPropDef("PIN", "intProp", 0, 0, 0);
CHECK_STATUS(status);
status = lefwRealPropDef("PIN", "realProp", 0, 0, 0);
CHECK_STATUS(status);
status = lefwStringPropDef("MACRO", "stringProp", 0, 0, 0);
CHECK_STATUS(status);
status = lefwIntPropDef("MACRO", "integerProp", 0, 0, 0);
CHECK_STATUS(status);
status = lefwRealPropDef("MACRO", "WEIGHT", 1.0, 100.0, 0);
CHECK_STATUS(status);
status = lefwStringPropDef("VIA", "stringProperty", 0, 0, 0);
CHECK_STATUS(status);
status = lefwRealPropDef("VIA", "realProp", 0, 0, 0);
CHECK_STATUS(status);
status = lefwIntPropDef("VIA", "COUNT", 1, 100, 0);
CHECK_STATUS(status);
// LAYERS
double *current;
double *diffs;
double *ratios;
double *area;
double *width;
current = (double*)malloc(sizeof(double)*15);
diffs = (double*)malloc(sizeof(double)*15);
ratios = (double*)malloc(sizeof(double)*15);
CHECK_STATUS(status);
status = lefwStartLayerRouting("RX");
CHECK_STATUS(status);
status = lefwLayerRouting("HORIZONTAL", 1);
CHECK_STATUS(status);
status = lefwLayerRoutingPitch(1.8);
CHECK_STATUS(status);
status = lefwLayerRoutingDiagPitch(1.5);
CHECK_STATUS(status);
status = lefwLayerRoutingDiagWidth(1.0);
CHECK_STATUS(status);
status = lefwLayerRoutingDiagSpacing(0.05);
CHECK_STATUS(status);
status = lefwLayerRoutingDiagMinEdgeLength(0.07);
CHECK_STATUS(status);
status = lefwLayerRoutingArea(34.1);
CHECK_STATUS(status);
xl = (double*)malloc(sizeof(double)*2);
yl = (double*)malloc(sizeof(double)*2);
xl[0] = 0.14;
yl[0] = 0.30;
xl[1] = 0.08;
yl[1] = 0.33;
yl = (double*)malloc(sizeof(double)*5);
xl[0] = 0.0;
yl[0] = 1.0;
xl[1] = 0.09999;
yl[1] = 1.0;
xl[2] = 0.1;
yl[2] = 0.2;
xl[3] = 1.0;
yl[3] = 0.1;
xl[4] = 100;
yl[4] = 0.1;
status = lefwLayerAntennaAreaDiffReducePwl(5, xl, yl); // 5.7
CHECK_STATUS(status);
free((char*)xl);
free((char*)yl);
status = lefwLayerAntennaCumDiffAreaRatio(1000); // 5.7
CHECK_STATUS(status);
status = lefwLayerRoutingAntennaLength(1);
CHECK_STATUS(status);
status = lefwLayerACCurrentDensity("PEAK", 0);
CHECK_STATUS(status);
current[0] = 1E6;
current[1] = 100E6;
current[2] = 400E6;
status = lefwLayerACFrequency(3, current);
CHECK_STATUS(status);
current[0] = 0.4;
current[1] = 0.8;
current[2] = 10.0;
current[3] = 50.0;
status = lefwLayerACCutarea(4, current);
CHECK_STATUS(status);
current[0] = 0.4;
current[1] = 0.8;
current[2] = 10.0;
current[3] = 50.0;
current[4] = 100.0;
status = lefwLayerACWidth(5, current);
CHECK_STATUS(status);
current[0] = 2.0E-6;
current[1] = 1.9E-6;
current[2] = 1.8E-6;
current[3] = 1.7E-6;
current[4] = 1.5E-6;
current[5] = 1.4E-6;
current[6] = 1.3E-6;
current[7] = 1.2E-6;
current[8] = 1.1E-6;
current[9] = 1.0E-6;
current[10] = 0.9E-6;
current[11] = 0.8E-6;
current[12] = 0.7E-6;
current[13] = 0.6E-6;
current[14] = 0.4E-6;
status = lefwLayerACTableEntries(15, current);
CHECK_STATUS(status);
status = lefwLayerACCurrentDensity("AVERAGE", 0);
CHECK_STATUS(status);
current[0] = 1E6;
current[1] = 100E6;
current[2] = 400E6;
status = lefwLayerACFrequency(3, current);
CHECK_STATUS(status);
current[0] = 0.6E-6;
current[1] = 0.5E-6;
current[2] = 0.4E-6;
status = lefwLayerACTableEntries(3, current);
CHECK_STATUS(status);
status = lefwLayerACCurrentDensity("RMS", 0);
CHECK_STATUS(status);
current[0] = 1E6;
current[1] = 400E6;
current[2] = 800E6;
status = lefwLayerACFrequency(3, current);
CHECK_STATUS(status);
current[0] = 0.4;
current[1] = 0.8;
current[2] = 10.0;
current[3] = 50.0;
current[4] = 100.0;
status = lefwLayerACWidth(5, current);
CHECK_STATUS(status);
current[0] = 2.0E-6;
current[1] = 1.9E-6;
current[2] = 1.8E-6;
current[3] = 1.7E-6;
current[4] = 1.5E-6;
current[5] = 1.4E-6;
current[6] = 1.3E-6;
current[7] = 1.2E-6;
current[8] = 1.1E-6;
current[9] = 1.0E-6;
current[10] = 0.9E-6;
current[11] = 0.8E-6;
current[12] = 0.7E-6;
current[13] = 0.6E-6;
current[14] = 0.4E-6;
status = lefwLayerACTableEntries(15, current);
CHECK_STATUS(status);
status = lefwEndLayerRouting("RX");
CHECK_STATUS(status);
CHECK_STATUS(status);
status = lefwLayerCutSpacing(1.2); // 5.7
CHECK_STATUS(status);
status = lefwLayerCutSpacingAdjacent(2, 1.5, 0); // 5.7
CHECK_STATUS(status);
status = lefwLayerCutSpacingEnd(); // 5.7
CHECK_STATUS(status);
status = lefwLayerAntennaModel("OXIDE1");
CHECK_STATUS(status);
status = lefwLayerAntennaAreaRatio(5.6);
CHECK_STATUS(status);
status = lefwLayerAntennaDiffAreaRatio(6.5);
CHECK_STATUS(status);
status = lefwLayerAntennaAreaFactor(5.4, 0);
CHECK_STATUS(status);
status = lefwLayerAntennaCumDiffAreaRatio(4.5);
CHECK_STATUS(status);
diffs[0] = 5.4;
ratios[0] = 5.4;
diffs[1] = 6.5;
ratios[1] = 6.5;
diffs[2] = 7.5;
ratios[2] = 7.5;
status = lefwLayerAntennaCumDiffAreaRatioPwl(3, diffs, ratios);
CHECK_STATUS(status);
status = lefwLayerAntennaCumAreaRatio(6.7);
CHECK_STATUS(status);
status = lefwLayerAntennaModel("OXIDE2");
CHECK_STATUS(status);
status = lefwLayerAntennaCumAreaRatio(300);
CHECK_STATUS(status);
status = lefwLayerAntennaCumRoutingPlusCut(); // 5.7
CHECK_STATUS(status);
status = lefwLayerAntennaAreaMinusDiff(100.0); // 5.7
CHECK_STATUS(status);
status = lefwLayerAntennaGatePlusDiff(2.0); // 5.7
CHECK_STATUS(status);
status = lefwLayerAntennaDiffAreaRatio(1000); // 5.7
CHECK_STATUS(status);
status = lefwLayerAntennaCumDiffAreaRatio(5000); // 5.7
CHECK_STATUS(status);
xl = (double*)malloc(sizeof(double)*5);
yl = (double*)malloc(sizeof(double)*5);
xl[0] = 0.0;
yl[0] = 1.0;
xl[1] = 0.09999;
yl[1] = 1.0;
xl[2] = 0.1;
yl[2] = 0.2;
xl[3] = 1.0;
yl[3] = 0.1;
xl[4] = 100;
yl[4] = 0.1;
status = lefwLayerAntennaAreaDiffReducePwl(5, xl, yl); // 5.7
CHECK_STATUS(status);
free((char*)xl);
free((char*)yl);
diffs[0] = 1;
ratios[0] = 4;
diffs[1] = 2;
ratios[1] = 5;
status = lefwLayerAntennaCumDiffAreaRatioPwl(2, diffs, ratios);
CHECK_STATUS(status);
status = lefwLayerACCurrentDensity("PEAK", 0);
CHECK_STATUS(status);
current[0] = 1E6;
current[1] = 100E6;
status = lefwLayerACFrequency(2, current);
CHECK_STATUS(status);
current[0] = 0.5E-6;
current[1] = 0.4E-6;
status = lefwLayerACTableEntries(2, current);
CHECK_STATUS(status);
status = lefwLayerACCurrentDensity("AVERAGE", 0);
CHECK_STATUS(status);
current[0] = 1E6;
current[1] = 100E6;
status = lefwLayerACFrequency(2, current);
CHECK_STATUS(status);
current[0] = 0.6E-6;
current[1] = 0.5E-6;
status = lefwLayerACTableEntries(2, current);
CHECK_STATUS(status);
status = lefwLayerACCurrentDensity("RMS", 0);
CHECK_STATUS(status);
current[0] = 100E6;
current[1] = 800E6;
status = lefwLayerACFrequency(2, current);
CHECK_STATUS(status);
current[0] = 0.5E-6;
current[1] = 0.4E-6;
status = lefwLayerACTableEntries(2, current);
CHECK_STATUS(status);
status = lefwEndLayer("CUT12");
CHECK_STATUS(status);
status = lefwStartLayerRouting("PC");
CHECK_STATUS(status);
status = lefwLayerRouting("DIAG45", 1);
CHECK_STATUS(status);
status = lefwLayerRoutingPitch(1.8);
CHECK_STATUS(status);
status = lefwLayerRoutingWireExtension(0.4);
CHECK_STATUS(status);
status = lefwLayerRoutingSpacing(0.6);
CHECK_STATUS(status);
status = lefwLayerRoutingSpacing(1.2); // 5.7
CHECK_STATUS(status);
status = lefwLayerRoutingSpacingEndOfLine(1.3, 0.6); // 5.7
CHECK_STATUS(status);
status = lefwLayerRoutingSpacing(1.3); // 5.7
CHECK_STATUS(status);
status = lefwLayerRoutingSpacingEndOfLine(1.4, 0.7); // 5.7
CHECK_STATUS(status);
status = lefwLayerRoutingSpacingEOLParallel(1.1, 0.5, 1); // 5.7
CHECK_STATUS(status);
status = lefwLayerRoutingSpacing(1.4); // 5.7
CHECK_STATUS(status);
status = lefwLayerRoutingSpacingEndOfLine(1.5, 0.8); // 5.7
CHECK_STATUS(status);
status = lefwLayerRoutingSpacingEOLParallel(1.2, 0.6, 0); // 5.7
CHECK_STATUS(status);
status = lefwLayerRoutingOffsetXYDistance(0.9, 0.7);
CHECK_STATUS(status);
status = lefwLayerRoutingResistance("PWL ( ( 1 0.103 ) )");
CHECK_STATUS(status);
status = lefwLayerRoutingCapacitance("PWL ( ( 1 0.000156 ) ( 10 0.001 ) )");
CHECK_STATUS(status);
status = lefwLayerAntennaAreaRatio(5.4);
CHECK_STATUS(status);
status = lefwLayerAntennaDiffAreaRatio(6.5);
CHECK_STATUS(status);
diffs[0] = 4.0;
ratios[0] = 4.1;
diffs[1] = 4.2;
ratios[1] = 4.3;
status = lefwLayerAntennaDiffAreaRatioPwl(2, diffs, ratios);
CHECK_STATUS(status);
status = lefwLayerAntennaCumAreaRatio(7.5);
CHECK_STATUS(status);
diffs[0] = 5.0;
ratios[0] = 5.1;
diffs[1] = 6.0;
ratios[1] = 6.1;
status = lefwLayerAntennaCumDiffAreaRatioPwl(2, diffs, ratios);
CHECK_STATUS(status);
status = lefwLayerAntennaAreaFactor(4.5, 0);
CHECK_STATUS(status);
status = lefwLayerAntennaSideAreaRatio(6.5);
CHECK_STATUS(status);
status = lefwLayerAntennaCumDiffSideAreaRatio(4.6);
CHECK_STATUS(status);
diffs[0] = 8.0;
ratios[0] = 8.1;
diffs[1] = 8.2;
ratios[1] = 8.3;
diffs[2] = 8.4;
ratios[2] = 8.5;
diffs[3] = 8.6;
ratios[3] = 8.7;
status = lefwLayerAntennaCumDiffSideAreaRatioPwl(4, diffs, ratios);
CHECK_STATUS(status);
status = lefwLayerAntennaCumSideAreaRatio(7.4);
CHECK_STATUS(status);
diffs[0] = 7.0;
ratios[0] = 7.1;
diffs[1] = 7.2;
ratios[1] = 7.3;
status = lefwLayerAntennaDiffSideAreaRatioPwl(2, diffs, ratios);
CHECK_STATUS(status);
status = lefwLayerAntennaSideAreaFactor(9.0, "DIFFUSEONLY");
CHECK_STATUS(status);
status = lefwLayerDCCurrentDensity("AVERAGE", 0);
CHECK_STATUS(status);
current[0] = 20.0;
current[1] = 50.0;
current[2] = 100.0;
status = lefwLayerDCWidth(3, current);
CHECK_STATUS(status);
current[0] = 1.0E-6;
current[1] = 0.7E-6;
current[2] = 0.5E-6;
status = lefwLayerDCTableEntries(3, current);
CHECK_STATUS(status);
status = lefwEndLayerRouting("PC");
CHECK_STATUS(status);
status = lefwStartLayerRouting("M1");
CHECK_STATUS(status);
status = lefwLayerRouting("DIAG135", 1);
CHECK_STATUS(status);
status = lefwLayerRoutingPitch(1.8);
CHECK_STATUS(status);
status = lefwLayerRoutingSpacing(0.6);
CHECK_STATUS(status);
status = lefwLayerRoutingSpacingRange(1.1, 100.1);
CHECK_STATUS(status);
status = lefwLayerRoutingSpacingRangeUseLengthThreshold();
CHECK_STATUS(status);
status = lefwLayerRoutingSpacing(0.61);
CHECK_STATUS(status);
status = lefwLayerRoutingSpacingRange(1.1, 100.1);
CHECK_STATUS(status);
status = lefwLayerRoutingSpacingRangeInfluence(2.01, 2.0, 1000.0);
CHECK_STATUS(status);
status = lefwLayerRoutingSpacing(0.62);
CHECK_STATUS(status);
status = lefwLayerRoutingSpacingRange(1.1, 100.1);
CHECK_STATUS(status);
status = lefwLayerRoutingSpacingRangeRange(4.1, 6.5);
CHECK_STATUS(status);
status = lefwLayerRoutingSpacing(0.63);
CHECK_STATUS(status);
status = lefwLayerRoutingSpacingLengthThreshold(1.34, 4.5, 6.5);
CHECK_STATUS(status);
status = lefwLayerRoutingWireExtension(7);
CHECK_STATUS(status);
status = lefwLayerRoutingResistance("0.103");
CHECK_STATUS(status);
status = lefwLayerRoutingCapacitance("0.000156");
CHECK_STATUS(status);
current[0] = 0.00;
current[1] = 0.50;
current[2] = 3.00;
current[3] = 5.00;
status = lefwLayerRoutingStartSpacingtableParallel(4, current);
CHECK_STATUS(status);
current[0] = 0.15;
current[1] = 0.15;
current[2] = 0.15;
current[3] = 0.15;
status = lefwLayerRoutingSpacingtableParallelWidth(0.00, 4, current);
CHECK_STATUS(status);
current[0] = 0.15;
current[1] = 0.20;
current[2] = 0.20;
current[3] = 0.20;
status = lefwLayerRoutingSpacingtableParallelWidth(0.25, 4, current);
CHECK_STATUS(status);
current[0] = 0.15;
current[1] = 0.50;
current[2] = 0.50;
current[3] = 0.50;
status = lefwLayerRoutingSpacingtableParallelWidth(1.50, 4, current);
CHECK_STATUS(status);
current[0] = 0.15;
current[1] = 0.50;
current[2] = 1.00;
current[3] = 1.00;
status = lefwLayerRoutingSpacingtableParallelWidth(3.00, 4, current);
CHECK_STATUS(status);
current[0] = 0.15;
current[1] = 0.50;
current[2] = 1.00;
current[3] = 2.00;
status = lefwLayerRoutingSpacingtableParallelWidth(5.00, 4, current);
CHECK_STATUS(status);
status = lefwLayerRoutineEndSpacingtable();
CHECK_STATUS(status);
status = lefwLayerRoutingStartSpacingtableInfluence();
CHECK_STATUS(status);
status = lefwLayerRoutingSpacingInfluenceWidth(1.5, 0.5, 0.5);
CHECK_STATUS(status);
status = lefwLayerRoutingSpacingInfluenceWidth(3.0, 1.0, 1.0);
CHECK_STATUS(status);
status = lefwLayerRoutingSpacingInfluenceWidth(5.0, 2.0, 2.0);
CHECK_STATUS(status);
status = lefwLayerRoutineEndSpacingtable();
CHECK_STATUS(status);
status = lefwLayerRoutingStartSpacingtableInfluence();
CHECK_STATUS(status);
status = lefwLayerRoutingSpacingInfluenceWidth(1.5, 0.5, 0.5);
CHECK_STATUS(status);
status = lefwLayerRoutingSpacingInfluenceWidth(5.0, 2.0, 2.0);
CHECK_STATUS(status);
status = lefwLayerRoutineEndSpacingtable();
CHECK_STATUS(status);
current[0] = 0.00;
current[1] = 0.50;
current[2] = 5.00;
status = lefwLayerRoutingStartSpacingtableParallel(3, current);
CHECK_STATUS(status);
current[0] = 0.15;
current[1] = 0.15;
current[2] = 0.15;
status = lefwLayerRoutingSpacingtableParallelWidth(0.00, 3, current);
CHECK_STATUS(status);
current[0] = 0.15;
current[1] = 0.20;
current[2] = 0.20;
status = lefwLayerRoutingSpacingtableParallelWidth(0.25, 3, current);
CHECK_STATUS(status);
current[0] = 0.15;
current[1] = 0.50;
current[2] = 1.00;
status = lefwLayerRoutingSpacingtableParallelWidth(3.00, 3, current);
CHECK_STATUS(status);
current[0] = 0.15;
current[1] = 0.50;
current[2] = 2.00;
status = lefwLayerRoutingSpacingtableParallelWidth(5.00, 3, current);
CHECK_STATUS(status);
status = lefwLayerRoutineEndSpacingtable();
CHECK_STATUS(status);
free((char*)current);
free((char*)diffs);
free((char*)ratios);
status = lefwLayerAntennaGatePlusDiff(2.0); // 5.7
CHECK_STATUS(status);
status = lefwLayerAntennaDiffAreaRatio(1000); // 5.7
CHECK_STATUS(status);
status = lefwLayerAntennaCumDiffAreaRatio(5000); // 5.7
CHECK_STATUS(status);
status = lefwEndLayerRouting("M1");
CHECK_STATUS(status);
status = lefwStartLayerRouting("M2");
CHECK_STATUS(status);
status = lefwLayerRouting("VERTICAL", 0.9);
CHECK_STATUS(status);
status = lefwLayerRoutingPitch(1.8);
CHECK_STATUS(status);
status = lefwLayerRoutingWireExtension(8);
CHECK_STATUS(status);
status = lefwLayerRoutingSpacing(0.9);
CHECK_STATUS(status);
status = lefwLayerRoutingSpacingLengthThreshold(100.9, 0, 0);
CHECK_STATUS(status);
status = lefwLayerRoutingSpacing(0.5);
CHECK_STATUS(status);
status = lefwLayerRoutingSpacingLengthThreshold(0.9, 0, 0.1);
CHECK_STATUS(status);
status = lefwLayerRoutingSpacing(0.6);
CHECK_STATUS(status);
status = lefwLayerRoutingSpacingLengthThreshold(1.9, 0, 0);
CHECK_STATUS(status);
status = lefwLayerRoutingSpacing(1.0); // 5.7
CHECK_STATUS(status);
status = lefwLayerRoutingSpacingSameNet(1); // 5.7
CHECK_STATUS(status);
status = lefwLayerRoutingSpacing(1.1); // 5.7
CHECK_STATUS(status);
status = lefwLayerRoutingSpacingSameNet(0); // 5.7
CHECK_STATUS(status);
status = lefwLayerRoutingResistance("0.0608");
CHECK_STATUS(status);
status = lefwLayerRoutingCapacitance("0.000184");
CHECK_STATUS(status);
status = lefwEndLayerRouting("M2");
CHECK_STATUS(status);
status = lefwStartLayerRouting("M3");
CHECK_STATUS(status);
area = (double*)malloc(sizeof(double)*3);
width = (double*)malloc(sizeof(double)*3);
status = lefwStartLayerRouting("M4");
CHECK_STATUS(status);
status = lefwLayerRouting("HORIZONTAL", 0.9);
CHECK_STATUS(status);
status = lefwLayerRoutingMinimumcut(2, 0.50);
CHECK_STATUS(status);
status = lefwLayerRoutingMinimumcut(2, 0.70);
CHECK_STATUS(status);
status = lefwLayerRoutingMinimumcutConnections("FROMBELOW");
CHECK_STATUS(status);
status = lefwLayerRoutingMinimumcut(4, 1.0);
CHECK_STATUS(status);
status = lefwLayerRoutingMinimumcutConnections("FROMABOVE");
CHECK_STATUS(status);
status = lefwLayerRoutingMinimumcut(2, 1.1);
CHECK_STATUS(status);
status = lefwLayerRoutingMinimumcutLengthWithin(20.0, 5.0);
CHECK_STATUS(status);
area[0] = 0.40;
width[0] = 0;
area[1] = 0.40;
width[1] = 0.15;
area[2] = 0.80;
width[2] = 0.50;
status = lefwLayerRoutingMinenclosedarea(3, area, width);
CHECK_STATUS(status);
status = lefwLayerRoutingMaxwidth(10.0);
CHECK_STATUS(status);
status = lefwLayerRoutingProtrusion(0.30, 0.60, 1.20);
CHECK_STATUS(status);
status = lefwLayerRoutingMinstep(0.20);
CHECK_STATUS(status);
status = lefwLayerRoutingMinstep(0.05);
CHECK_STATUS(status);
status = lefwLayerRoutingMinstepWithOptions(0.05, NULL, 0.08);
CHECK_STATUS(status);
status = lefwLayerRoutingMinstepWithOptions(0.05, NULL, 0.16);
CHECK_STATUS(status);
status = lefwLayerRoutingMinstepWithOptions(0.05, "INSDECORNER", 0);
CHECK_STATUS(status);
status = lefwLayerRoutingMinstepWithOptions(0.05, "INSIDECORNER", 0.15);
CHECK_STATUS(status);
status = lefwLayerRoutingMinstepWithOptions(0.05, "STEP", 0);
CHECK_STATUS(status);
status = lefwLayerRoutingMinstepWithOptions(0.05, "STEP", 0.08);
CHECK_STATUS(status);
status = lefwLayerRoutingMinstepWithOptions(0.04, "STEP", 0);
CHECK_STATUS(status);
status = lefwLayerRoutingMinstepMaxEdges(1.0, 2); // 5.7
CHECK_STATUS(status);
status = lefwEndLayerRouting("M4");
CHECK_STATUS(status);
free((char*)area);
free((char*)width);
CHECK_STATUS(status);
status = lefwEndLayer("implant1");
CHECK_STATUS(status);
status = lefwStartLayerRouting("MT");
CHECK_STATUS(status);
status = lefwLayerRouting("VERTICAL", 0.9);
CHECK_STATUS(status);
status = lefwLayerRoutingPitch(1.8);
CHECK_STATUS(status);
status = lefwLayerRoutingSpacing(0.9);
CHECK_STATUS(status);
status = lefwLayerRoutingResistance("0.0608");
CHECK_STATUS(status);
status = lefwLayerRoutingCapacitance("0.000184");
CHECK_STATUS(status);
status = lefwEndLayerRouting("MT");
CHECK_STATUS(status);
status = lefwStartLayerRouting("MET2");
CHECK_STATUS(status);
status = lefwLayerRouting("VERTICAL", 0.9);
CHECK_STATUS(status);
status = lefwMinimumDensity(20.2);
CHECK_STATUS(status);
status = lefwMaximumDensity(80.0);
CHECK_STATUS(status);
status = lefwDensityCheckWindow(200.0, 200.0);
CHECK_STATUS(status);
status = lefwDensityCheckStep(100.0);
CHECK_STATUS(status);
status = lefwFillActiveSpacing(3.0);
CHECK_STATUS(status);
status = lefwEndLayerRouting("MET2");
CHECK_STATUS(status);
spng[2] = 0.15;
status = lefwLayerCutSpacingTableOrtho(3, wthn, spng);
CHECK_STATUS(status);
wthn[0] = 3;
spng[0] = 1;
status = lefwLayerArraySpacing(0, 2.0, 0.2, 1, wthn, spng);
CHECK_STATUS(status);
wthn[0] = 3;
spng[0] = 1;
wthn[1] = 4;
spng[1] = 1.5;
wthn[2] = 5;
spng[2] = 2.0;
status = lefwLayerArraySpacing(1, 2.0, 0.2, 3, wthn, spng);
CHECK_STATUS(status);
free((char*)wthn);
free((char*)spng);
status = lefwEndLayer("cut23");
CHECK_STATUS(status);
CHECK_STATUS(status);
status = lefwLayerRoutingPitch(1.2); // 5.7
CHECK_STATUS(status);
status = lefwLayerRouting("HORIZONTAL", 1); // 5.7
CHECK_STATUS(status);
status = lefwLayerRoutingWireExtension(7); // 5.7
CHECK_STATUS(status);
status = lefwLayerRoutingStartSpacingtableTwoWidths(); // 5.7
CHECK_STATUS(status);
wthn = (double*)malloc(sizeof(double)*4); // 5.7
wthn[0] = 0.15;
wthn[1] = 0.20;
wthn[2] = 0.50;
wthn[3] = 1.00;
status = lefwLayerRoutingSpacingtableTwoWidthsWidth(0.0, 0, 4, wthn); // 5.7
CHECK_STATUS(status);
wthn[0] = 0.20;
wthn[1] = 0.25;
wthn[2] = 0.50;
wthn[3] = 1.00;
status = lefwLayerRoutingSpacingtableTwoWidthsWidth(0.25, 0.1, 4, wthn);// 5.7
CHECK_STATUS(status);
wthn[0] = 0.50;
wthn[1] = 0.50;
wthn[2] = 0.60;
wthn[3] = 1.00;
status = lefwLayerRoutingSpacingtableTwoWidthsWidth(1.5, 1.5, 4, wthn);// 5.7
CHECK_STATUS(status);
wthn[0] = 1.00;
wthn[1] = 1.00;
wthn[2] = 1.00;
wthn[3] = 1.20;
status = lefwLayerRoutingSpacingtableTwoWidthsWidth(3.0, 3.0, 4, wthn);// 5.7
CHECK_STATUS(status);
free(wthn);
status = lefwLayerRoutineEndSpacingtable();
CHECK_STATUS(status);
status = lefwEndLayerRouting("cut25"); // 5.7
CHECK_STATUS(status);
// MAXVIASTACK
// VIA
status = lefwStartVia("RX_PC", "DEFAULT");
CHECK_STATUS(status);
status = lefwViaResistance(2);
CHECK_STATUS(status);
status = lefwViaLayer("RX");
CHECK_STATUS(status);
status = lefwViaLayerRect(-0.7, -0.7, 0.7, 0.7);
CHECK_STATUS(status);
status = lefwViaLayer("CUT12");
CHECK_STATUS(status);
status = lefwViaLayerRect(-0.25, -0.25, 0.25, 0.25);
CHECK_STATUS(status);
status = lefwViaLayer("PC");
CHECK_STATUS(status);
status = lefwViaLayerRect(-0.6, -0.6, 0.6, 0.6);
CHECK_STATUS(status);
status = lefwStringProperty("stringProperty", "DEFAULT");
CHECK_STATUS(status);
status = lefwRealProperty("realProperty", 32.33);
CHECK_STATUS(status);
status = lefwIntProperty("COUNT", 34);
CHECK_STATUS(status);
status = lefwEndVia("PC");
CHECK_STATUS(status);
xl = (double*)malloc(sizeof(double)*6);
yl = (double*)malloc(sizeof(double)*6);
status = lefwStartVia("IN1X", 0);
CHECK_STATUS(status);
status = lefwViaLayer("metal2");
CHECK_STATUS(status);
xl[0] = -2.1;
yl[0] = -1.0;
xl[1] = -0.2;
yl[1] = 1.0;
xl[2] = 2.1;
yl[2] = 1.0;
xl[3] = 0.2;
yl[3] = -1.0;
xl[4] = 0.2;
yl[4] = -1.0;
xl[5] = 0.2;
yl[5] = -1.0;
status = lefwViaLayerPolygon(6, xl, yl);
CHECK_STATUS(status);
xl[0] = -1.1;
yl[0] = -2.0;
xl[1] = -0.1;
yl[1] = 2.0;
xl[2] = 1.1;
yl[2] = 2.0;
xl[3] = 0.1;
yl[3] = -2.0;
status = lefwViaLayerPolygon(4, xl, yl);
CHECK_STATUS(status);
xl[0] = -3.1;
yl[0] = -2.0;
xl[1] = -0.3;
yl[1] = 2.0;
xl[2] = 3.1;
yl[2] = 2.0;
xl[3] = 0.3;
yl[3] = -2.0;
status = lefwViaLayerPolygon(4, xl, yl);
CHECK_STATUS(status);
xl[0] = -4.1;
yl[0] = -2.0;
xl[1] = -0.4;
yl[1] = 2.0;
xl[2] = 4.1;
yl[2] = 2.0;
xl[3] = 0.4;
yl[3] = -2.0;
status = lefwViaLayerPolygon(4, xl, yl);
CHECK_STATUS(status);
status = lefwViaLayer("cut23");
CHECK_STATUS(status);
status = lefwViaLayerRect(-0.4, -0.4, 0.4, 0.4);
CHECK_STATUS(status);
xl[0] = -2.1;
yl[0] = -1.0;
xl[1] = -0.2;
yl[1] = 1.0;
xl[2] = 2.1;
yl[2] = 1.0;
xl[3] = 0.2;
yl[3] = -1.0;
status = lefwViaLayerPolygon(4, xl, yl);
CHECK_STATUS(status);
status = lefwEndVia("IN1X");
CHECK_STATUS(status);
CHECK_STATUS(status);
status = lefwViaViaruleRowCol(1, 2);
CHECK_STATUS(status);
status = lefwViaViaruleOrigin(1.5, 2.5);
CHECK_STATUS(status);
status = lefwViaViaruleOffset(1.5, 2.5, 3.5, 4.5);
CHECK_STATUS(status);
status = lefwViaViarulePattern("2_1RF1RF1R71R0_3_R1FFFF");
CHECK_STATUS(status);
status = lefwEndVia("myBlockVia");
CHECK_STATUS(status);
free((char*)xl);
free((char*)yl);
// VIARULE
status = lefwStartViaRule("VIALIST12");
CHECK_STATUS(status);
lefwAddComment("Break up the old lefwViaRule into 2 routines");
lefwAddComment("lefwViaRuleLayer and lefwViaRuleVia");
status = lefwViaRuleLayer("M1", NULL, 9.0, 9.6, 0, 0);
CHECK_STATUS(status);
status = lefwViaRuleLayer("M2", NULL, 3.0, 3.0, 0, 0);
CHECK_STATUS(status);
status = lefwViaRuleVia("VIACENTER12");
CHECK_STATUS(status);
status = lefwStringProperty("vrsp", "new");
CHECK_STATUS(status);
status = lefwIntProperty("vrip", 1);
CHECK_STATUS(status);
status = lefwRealProperty("vrrp", 4.5);
CHECK_STATUS(status);
status = lefwEndViaRule("VIALIST12");
CHECK_STATUS(status);
// NONDEFAULTRULE
status = lefwStartNonDefaultRule("RULE1");
CHECK_STATUS(status);
status = lefwNonDefaultRuleHardspacing();
CHECK_STATUS(status);
status = lefwNonDefaultRuleLayer("RX", 10.0, 2.2, 6, 0, 0, 0);
CHECK_STATUS(status);
status = lefwNonDefaultRuleLayer("PC", 10.0, 2.2, 0, 0, 0, 0);
CHECK_STATUS(status);
status = lefwNonDefaultRuleLayer("M1", 10.0, 2.2, 0, 0, 0, 0);
CHECK_STATUS(status);
status = lefwStartVia("nd1VARX0", NULL);
CHECK_STATUS(status);
status = lefwViaResistance(0.2);
CHECK_STATUS(status);
status = lefwViaLayer("RX");
CHECK_STATUS(status);
status = lefwViaLayerRect(-3, -3, 3, 3);
CHECK_STATUS(status);
status = lefwViaLayer("CUT12");
CHECK_STATUS(status);
status = lefwViaLayerRect(-1.0, -1.0, 1.0, 1.0);
CHECK_STATUS(status);
status = lefwViaLayer("PC");
CHECK_STATUS(status);
status = lefwViaLayerRect(-3, -3, 3, 3);
CHECK_STATUS(status);
status = lefwEndVia("nd1VARX0");
CHECK_STATUS(status);
status = lefwStartSpacing();
CHECK_STATUS(status);
status = lefwSpacing("CUT01", "RX", 0.1, "STACK");
CHECK_STATUS(status);
status = lefwEndSpacing();
CHECK_STATUS(status);
status = lefwEndNonDefaultRule("RULE1");
CHECK_STATUS(status);
status = lefwStartNonDefaultRule("wide1_5x");
CHECK_STATUS(status);
status = lefwNonDefaultRuleLayer("fw", 4.8, 4.8, 0, 0, 0, 0);
CHECK_STATUS(status);
status = lefwNonDefaultRuleStartVia("nd1VIARX0", "DEFAULT");
CHECK_STATUS(status);
status = lefwViaResistance(0.2);
CHECK_STATUS(status);
status = lefwViaLayer("RX");
CHECK_STATUS(status);
status = lefwViaLayerRect(-3, -3, 3, 3);
CHECK_STATUS(status);
status = lefwViaLayer("CUT12");
CHECK_STATUS(status);
status = lefwViaLayerRect(-1.0, -1.0, 1.0, 1.0);
CHECK_STATUS(status);
status = lefwViaLayer("PC");
CHECK_STATUS(status);
status = lefwViaLayerRect(-3, -3, 3, 3);
CHECK_STATUS(status);
status = lefwNonDefaultRuleEndVia("nd1VIARX0");
CHECK_STATUS(status);
status = lefwNonDefaultRuleUseVia("via12_fixed_analog_via");
CHECK_STATUS(status);
status = lefwNonDefaultRuleMinCuts("cut12", 2);
CHECK_STATUS(status);
status = lefwNonDefaultRuleUseVia("via23_fixed_analog_via");
CHECK_STATUS(status);
status = lefwNonDefaultRuleMinCuts("cut23", 2);
CHECK_STATUS(status);
status = lefwNonDefaultRuleUseViaRule("viaRule23_fixed_analog_via");
CHECK_STATUS(status);
status = lefwEndNonDefaultRule("wide1_5x");
CHECK_STATUS(status);
// SPACING
status = lefwStartSpacing();
CHECK_STATUS(status);
status = lefwSpacing("CUT01", "CA", 1.5, NULL);
CHECK_STATUS(status);
status = lefwSpacing("CA", "V1", 1.5, "STACK");
CHECK_STATUS(status);
status = lefwSpacing("M1", "M1", 3.5, "STACK");
CHECK_STATUS(status);
status = lefwSpacing("V1", "V2", 1.5, "STACK");
CHECK_STATUS(status);
// SITE
status = lefwSite("CORE1", "CORE", "X", 67.2, 6);
CHECK_STATUS(status);
status = lefwSiteRowPattern("Fsite", 0);
CHECK_STATUS(status);
status = lefwSiteRowPatternStr("Lsite", "N");
CHECK_STATUS(status);
status = lefwSiteRowPatternStr("Lsite", "FS");
CHECK_STATUS(status);
lefwEndSite("CORE1");
CHECK_STATUS(status);
status = lefwSite("CORE", "CORE", "Y", 3.6, 28.8);
CHECK_STATUS(status);
lefwEndSite("CORE");
CHECK_STATUS(status);
status = lefwSite("MRCORE", "CORE", "Y", 3.6, 28.8);
CHECK_STATUS(status);
lefwEndSite("MRCORE");
CHECK_STATUS(status);
status = lefwSite("IOWIRED", "PAD", NULL, 57.6, 432);
CHECK_STATUS(status);
lefwEndSite("IOWIRED");
CHECK_STATUS(status);
// ARRAY
status = lefwStartArray("M7E4XXX");
CHECK_STATUS(status);
status = lefwArraySite("CORE", -5021.450, -4998.000, 0, 14346, 595, 0.700,
16.800);
CHECK_STATUS(status);
status = lefwArraySiteStr("CORE", -5021.450, -4998.600, "FS", 14346, 595,
0.700, 16.800);
CHECK_STATUS(status);
status = lefwArraySite("IO", 6148.800, 5800.000, 3, 1, 1, 0.000, 0.000);
CHECK_STATUS(status);
status = lefwArraySiteStr("IO", 6148.800, 5240.000, "E", 1, 1, 0.000, 0.000);
CHECK_STATUS(status);
status = lefwArraySite("COVER", -7315.0, -7315.000, 1, 1, 1, 0.000, 0.000);
CHECK_STATUS(status);
status = lefwArraySiteStr("COVER", 7315.0, 7315.000, "FN", 1, 1, 0.000, 0.000);
CHECK_STATUS(status);
status = lefwArrayCanplace("COVER", -7315.000, -7315.000, 0, 1, 1, 0.000,
0.000);
CHECK_STATUS(status);
status = lefwArrayCanplaceStr("COVER", -7250.000, -7250.000, "N", 5, 1,
40.000, 0.000);
CHECK_STATUS(status);
status = lefwArrayCannotoccupy("CORE", -5021.450, -4989.600, 6, 100, 595,
0.700, 16.800);
CHECK_STATUS(status);
status = lefwArrayCannotoccupyStr("CORE", -5021.450, -4989.600, "N", 100, 595,
0.700, 16.800);
CHECK_STATUS(status);
status = lefwArrayTracks("X", -6148.800, 17569, 0.700, "RX");
CHECK_STATUS(status);
status = lefwArrayTracks("Y", -6148.800, 20497, 0.600, "RX");
CHECK_STATUS(status);
status = lefwStartArrayFloorplan("100%");
CHECK_STATUS(status);
status = lefwArrayFloorplan("CANPLACE", "COVER", -7315.000, -7315.000, 1, 1,
1, 0.000, 0.000);
CHECK_STATUS(status);
status = lefwArrayFloorplanStr("CANPLACE", "COVER", -7250.000, -7250.000,
"N", 5, 1, 40.000, 0.000);
CHECK_STATUS(status);
status = lefwArrayFloorplan("CANPLACE", "CORE", -5021.000, -4998.000, 1,
14346, 595, 0.700, 16.800);
CHECK_STATUS(status);
status = lefwArrayFloorplanStr("CANPLACE", "CORE", -5021.000, -4998.000, "FS",
// MACRO
status = lefwStartMacro("CHK3A");
CHECK_STATUS(status);
status = lefwMacroClass("RING", NULL);
CHECK_STATUS(status);
status = lefwMacroOrigin(0.9, 0.9);
CHECK_STATUS(status);
status = lefwMacroSize(10.8, 28.8);
CHECK_STATUS(status);
status = lefwMacroSymmetry("X Y R90");
CHECK_STATUS(status);
status = lefwMacroSite("CORE");
CHECK_STATUS(status);
status = lefwStartMacroPin("GND");
CHECK_STATUS(status);
status = lefwMacroPinDirection("INOUT");
CHECK_STATUS(status);
status = lefwMacroPinMustjoin("PA3");
CHECK_STATUS(status);
status = lefwMacroPinTaperRule("RULE1");
CHECK_STATUS(status);
status = lefwMacroPinUse("GROUND");
CHECK_STATUS(status);
status = lefwMacroPinShape("ABUTMENT");
CHECK_STATUS(status);
status = lefwMacroPinSupplySensitivity("vddpin1");
CHECK_STATUS(status);
status = lefwMacroPinNetExpr("power1 VDD1");
CHECK_STATUS(status);
status = lefwMacroPinAntennaMetalArea(3, "M1");
CHECK_STATUS(status);
// MACRO - PIN
status = lefwStartMacroPinPort(NULL);
CHECK_STATUS(status);
status = lefwMacroPinPortLayer("M1", 0.05);
CHECK_STATUS(status);
status = lefwMacroPinPortLayerRect(-0.9, 3, 9.9, 6, 0, 0, 0, 0);
CHECK_STATUS(status);
status = lefwEndMacroPinPort();
CHECK_STATUS(status);
status = lefwStringProperty("TYPE", "special");
CHECK_STATUS(status);
status = lefwIntProperty("intProp", 23);
CHECK_STATUS(status);
status = lefwRealProperty("realProp", 24.25);
CHECK_STATUS(status);
status = lefwMacroPinAntennaModel("OXIDE1");
CHECK_STATUS(status);
status = lefwEndMacroPin("GND");
CHECK_STATUS(status);
status = lefwStartMacroPin("VDD");
CHECK_STATUS(status);
status = lefwMacroPinDirection("INOUT");
CHECK_STATUS(status);
status = lefwMacroPinUse("POWER");
CHECK_STATUS(status);
status = lefwMacroPinShape("ABUTMENT");
CHECK_STATUS(status);
status = lefwMacroPinNetExpr("power2 VDD2");
CHECK_STATUS(status);
// MACRO - PIN - PORT
status = lefwStartMacroPinPort(NULL);
CHECK_STATUS(status);
status = lefwMacroPinPortLayer("M1", 0);
CHECK_STATUS(status);
CHECK_STATUS(status);
status = lefwMacroPinNetExpr("gnd1 GND");
CHECK_STATUS(status);
// 5.4
status = lefwMacroPinAntennaPartialMetalArea(4, "M1");
CHECK_STATUS(status);
status = lefwMacroPinAntennaPartialMetalArea(5, "M2");
CHECK_STATUS(status);
status = lefwMacroPinAntennaPartialMetalSideArea(5, "M2");
CHECK_STATUS(status);
status = lefwMacroPinAntennaGateArea(1, "M1");
CHECK_STATUS(status);
status = lefwMacroPinAntennaGateArea(2, 0);
CHECK_STATUS(status);
status = lefwMacroPinAntennaGateArea(3, "M3");
CHECK_STATUS(status);
status = lefwMacroPinAntennaDiffArea(1, "M1");
CHECK_STATUS(status);
status = lefwMacroPinAntennaMaxAreaCar(1, "L1");
CHECK_STATUS(status);
status = lefwMacroPinAntennaMaxSideAreaCar(1, 0);
CHECK_STATUS(status);
status = lefwMacroPinAntennaPartialCutArea(1, 0);
CHECK_STATUS(status);
status = lefwMacroPinAntennaPartialCutArea(2, "M2");
CHECK_STATUS(status);
status = lefwMacroPinAntennaPartialCutArea(3, 0);
CHECK_STATUS(status);
status = lefwMacroPinAntennaPartialCutArea(4, "M4");
CHECK_STATUS(status);
status = lefwMacroPinAntennaMaxCutCar(1, 0);
CHECK_STATUS(status);
status = lefwStartMacroPinPort("CORE");
CHECK_STATUS(status);
status = lefwMacroPinPortLayer("M1", 0.02);
CHECK_STATUS(status);
status = lefwMacroPinPortLayerRect(1.35, -0.45, 2.25, 0.45, 0, 0, 0, 0);
CHECK_STATUS(status);
status = lefwMacroPinPortLayerRect(-0.45, -0.45, 0.45, 0.45, 0, 0, 0, 0);
CHECK_STATUS(status);
status = lefwEndMacroPinPort();
CHECK_STATUS(status);
status = lefwStartMacroPinPort(NULL);
CHECK_STATUS(status);
status = lefwMacroPinPortLayer("PC", 0);
CHECK_STATUS(status);
status = lefwMacroPinPortLayerRect(-0.45, 12.15, 0.45, 13.05, 0, 0, 0, 0);
CHECK_STATUS(status);
status = lefwEndMacroPinPort();
CHECK_STATUS(status);
status = lefwStartMacroPinPort(NULL);
CHECK_STATUS(status);
status = lefwMacroPinPortDesignRuleWidth("PC", 2);
CHECK_STATUS(status);
status = lefwMacroPinPortLayerRect(8.55, 8.55, 9.45, 9.45, 0, 0, 0, 0);
CHECK_STATUS(status);
status = lefwMacroPinPortLayerRect(6.75, 6.75, 7.65, 7.65, 0, 0, 0, 0);
CHECK_STATUS(status);
status = lefwMacroPinPortLayerRect(6.75, 8.75, 7.65, 9.65, 0, 0, 0, 0);
CHECK_STATUS(status);
status = lefwMacroPinPortLayerRect(6.75, 10.35, 7.65, 11.25, 0, 0, 0, 0);
CHECK_STATUS(status);
status = lefwEndMacroPinPort();
CHECK_STATUS(status);
status = lefwEndMacroPin("PA3");
CHECK_STATUS(status);
// MACRO - OBS
status = lefwStartMacroObs();
CHECK_STATUS(status);
status = lefwMacroObsLayer("M1", 5.6);
CHECK_STATUS(status);
status = lefwMacroObsLayerWidth(5.4);
CHECK_STATUS(status);
status = lefwMacroObsLayerRect(6.6, -0.6, 9.6, 0.6, 0, 0, 0, 0);
CHECK_STATUS(status);
status = lefwMacroObsLayerRect(4.8, 12.9, 9.6, 13.2, 0, 0, 0, 0);
CHECK_STATUS(status);
status = lefwMacroObsLayerRect(3, 13.8, 7.8, 16.8, 0, 0, 0, 0);
CHECK_STATUS(status);
status = lefwMacroObsLayerRect(3, -0.6, 6, 0.6, 0, 0, 0, 0);
CHECK_STATUS(status);
status = lefwEndMacroObs();
CHECK_STATUS(status);
status = lefwStringProperty("stringProp", "first");
CHECK_STATUS(status);
status = lefwIntProperty("integerProp", 1);
CHECK_STATUS(status);
status = lefwRealProperty("WEIGHT", 30.31);
CHECK_STATUS(status);
status = lefwEndMacro("CHK3A");
CHECK_STATUS(status);
// 2nd MACRO
status = lefwStartMacro("INV");
CHECK_STATUS(status);
status = lefwMacroEEQ("CHK1");
CHECK_STATUS(status);
status = lefwMacroClass("CORE", "SPACER");
CHECK_STATUS(status);
status = lefwMacroForeign("INVS", 0, 0, -1);
CHECK_STATUS(status);
status = lefwMacroSize(67.2, 24);
CHECK_STATUS(status);
status = lefwMacroSymmetry("X Y R90");
CHECK_STATUS(status);
status = lefwMacroSite("CORE1");
CHECK_STATUS(status);
status = lefwStartMacroDensity("metal1");
CHECK_STATUS(status);
status = lefwMacroDensityLayerRect(0, 0, 100, 100, 45.5);
CHECK_STATUS(status);
status = lefwMacroDensityLayerRect(100, 0, 200, 100, 42.2);
CHECK_STATUS(status);
status = lefwEndMacroDensity();
CHECK_STATUS(status);
status = lefwStartMacroDensity("metal2");
CHECK_STATUS(status);
status = lefwMacroDensityLayerRect(200, 1, 300, 200, 43.3);
CHECK_STATUS(status);
status = lefwEndMacroDensity();
CHECK_STATUS(status);
status = lefwStartMacroPin("Z");
CHECK_STATUS(status);
status = lefwMacroPinDirection("OUTPUT");
CHECK_STATUS(status);
status = lefwMacroPinUse("SIGNAL");
CHECK_STATUS(status);
status = lefwMacroPinShape("ABUTMENT");
CHECK_STATUS(status);
status = lefwMacroPinAntennaModel("OXIDE1");
CHECK_STATUS(status);
status = lefwStartMacroPinPort(NULL);
CHECK_STATUS(status);
status = lefwMacroPinPortLayer("M2", 0);
CHECK_STATUS(status);
status = lefwMacroPinPortLayerWidth(5.6);
CHECK_STATUS(status);
xpath = (double*)malloc(sizeof(double)*7);
ypath = (double*)malloc(sizeof(double)*7);
xpath[0] = 30.8;
ypath[0] = 9;
xpath[1] = 42;
ypath[1] = 9;
xpath[2] = 30.8;
ypath[2] = 9;
xpath[3] = 42;
ypath[3] = 9;
xpath[4] = 30.8;
ypath[4] = 9;
xpath[5] = 42;
ypath[5] = 9;
xpath[6] = 30.8;
ypath[6] = 9;
status = lefwMacroPinPortLayerPath(7, xpath, ypath, 0, 0, 0, 0);
CHECK_STATUS(status);
status = lefwEndMacroPinPort();
CHECK_STATUS(status);
status = lefwEndMacroPin("Z");
free((char*)xpath);
free((char*)ypath);
// MACRO - OBS
status = lefwStartMacroObs();
CHECK_STATUS(status);
status = lefwMacroObsDesignRuleWidth("M1", 2);
CHECK_STATUS(status);
status = lefwMacroObsLayerRect(24.1, 1.5, 43.5, 208.5, 0, 0, 0, 0);
CHECK_STATUS(status);
xpath = (double*)malloc(sizeof(double)*2);
ypath = (double*)malloc(sizeof(double)*2);
xpath[0] = 8.4;
ypath[0] = 3;
xpath[1] = 8.4;
ypath[1] = 124;
status = lefwMacroObsLayerPath(2, xpath, ypath, 0, 0, 0, 0);
CHECK_STATUS(status);
xpath[0] = 58.8;
ypath[0] = 3;
xpath[1] = 58.8;
ypath[1] = 123;
status = lefwMacroObsLayerPath(2, xpath, ypath, 0, 0, 0, 0);
CHECK_STATUS(status);
xpath[0] = 64.4;
ypath[0] = 3;
xpath[1] = 64.4;
ypath[1] = 123;
status = lefwMacroObsLayerPath(2, xpath, ypath, 0, 0, 0, 0);
CHECK_STATUS(status);
free((char*)xpath);
free((char*)ypath);
xl = (double*)malloc(sizeof(double)*5);
yl = (double*)malloc(sizeof(double)*5);
xl[0] = 6.4;
xl[1] = 3.4;
xl[2] = 5.4;
xl[3] = 8.4;
xl[4] = 9.4;
yl[0] = 9.2;
yl[1] = 0.2;
yl[2] = 7.2;
yl[3] = 8.2;
yl[4] = 1.2;
status = lefwMacroObsLayerPolygon(5, xl, yl, 0, 0, 0, 0);
CHECK_STATUS(status);
free((char*)xl);
free((char*)yl);
status = lefwEndMacroObs();
CHECK_STATUS(status);
status = lefwEndMacro("INV");
CHECK_STATUS(status);
// 3rd MACRO
status = lefwStartMacro("DFF3");
CHECK_STATUS(status);
status = lefwMacroClass("CORE", "ANTENNACELL");
CHECK_STATUS(status);
status = lefwMacroForeignStr("DFF3S", 0, 0, "N");
CHECK_STATUS(status);
status = lefwMacroSize(67.2, 210);
CHECK_STATUS(status);
status = lefwMacroSymmetry("X Y R90");
CHECK_STATUS(status);
status = lefwMacroSitePattern("CORE", 34, 54, 7, 30, 3, 1, 1);
CHECK_STATUS(status);
status = lefwMacroSitePatternStr("CORE1", 21, 68, "S", 30, 3, 2, 2);
CHECK_STATUS(status);
status = lefwEndMacro("DFF3");
CHECK_STATUS(status);
status = lefwStartMacro("DFF4");
CHECK_STATUS(status);
status = lefwMacroClass("COVER", "BUMP");
CHECK_STATUS(status);
status = lefwMacroForeignStr("DFF3S", 0, 0, "");
CHECK_STATUS(status);
status = lefwEndMacro("DFF4");
CHECK_STATUS(status);
status = lefwStartMacro("DFF5");
CHECK_STATUS(status);
status = lefwMacroClass("COVER", NULL);
CHECK_STATUS(status);
status = lefwMacroForeignStr("DFF3S", 0, 0, "");
CHECK_STATUS(status);
status = lefwEndMacro("DFF5");
CHECK_STATUS(status);
status = lefwStartMacro("DFF6");
CHECK_STATUS(status);
status = lefwMacroClass("BLOCK", "BLACKBOX");
CHECK_STATUS(status);
status = lefwMacroForeignStr("DFF3S", 0, 0, "");
CHECK_STATUS(status);
status = lefwEndMacro("DFF6");
CHECK_STATUS(status);
status = lefwStartMacro("DFF7");
CHECK_STATUS(status);
status = lefwMacroClass("PAD", "AREAIO");
CHECK_STATUS(status);
status = lefwMacroForeignStr("DFF3S", 0, 0, "");
CHECK_STATUS(status);
status = lefwEndMacro("DFF7");
CHECK_STATUS(status);
status = lefwStartMacro("DFF8");
CHECK_STATUS(status);
status = lefwMacroClass("BLOCK", "SOFT");
CHECK_STATUS(status);
status = lefwEndMacro("DFF8");
CHECK_STATUS(status);
status = lefwStartMacro("DFF9");
CHECK_STATUS(status);
status = lefwMacroClass("CORE", "WELLTAP");
CHECK_STATUS(status);
status = lefwEndMacro("DFF9");
CHECK_STATUS(status);
status = lefwStartMacro("myTest");
CHECK_STATUS(status);
status = lefwMacroClass("CORE", NULL);
CHECK_STATUS(status);
status = lefwMacroSize(10.0, 14.0);
CHECK_STATUS(status);
status = lefwMacroSymmetry("X");
CHECK_STATUS(status);
status = lefwMacroSitePatternStr("Fsite", 0, 0, "N", 0, 0, 0, 0);
CHECK_STATUS(status);
status = lefwMacroSitePatternStr("Fsite", 0, 7.0, "FS", 30, 3, 2, 2);
CHECK_STATUS(status);
status = lefwMacroSitePatternStr("Fsite", 4.0, 0, "N", 0, 0, 0, 0);
CHECK_STATUS(status);
status = lefwEndMacro("myTest");
CHECK_STATUS(status);
// ANTENNA, this will generate error for 5.4 since I already have ANTENNA
// somewhere
status = lefwAntenna("INPUTPINANTENNASIZE", 1);
CHECK_STATUS(status);
status = lefwAntenna("OUTPUTPINANTENNASIZE", -1);
CHECK_STATUS(status);
status = lefwAntenna("INOUTPINANTENNASIZE", -1);
CHECK_STATUS(status);
status = lefwNewLine();
CHECK_STATUS(status);
// BEGINEXT
status = lefwStartBeginext("SIGNATURE");
CHECK_STATUS(status);
lefwAddIndent();
status = lefwBeginextCreator("CADENCE");
CHECK_STATUS(status);
status = lefwEndBeginext();
CHECK_STATUS(status);
status = lefwEnd();
CHECK_STATUS(status);
lineNum = lefwCurrentLineNumber();
if (lineNum == 0)
fprintf(stderr, "ERROR: Nothing has been written!!!\n");
fclose(fout);
return 0;
}