diff --git a/.gitmodules b/.gitmodules index 3df0a577..e69de29b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +0,0 @@ -[submodule "lef"] - path = src/lef - url =../lef.git -[submodule "src/def"] - path = src/def - url = ../def.git diff --git a/src/def b/src/def deleted file mode 160000 index c0fe2837..00000000 --- a/src/def +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c0fe2837a89f2a0947c2e8e10cef64e704214035 diff --git a/src/def/CMakeLists.txt b/src/def/CMakeLists.txt new file mode 100644 index 00000000..ee1ccfe2 --- /dev/null +++ b/src/def/CMakeLists.txt @@ -0,0 +1,151 @@ +# DEF PARSER CMAKE Compile Settings +project(DEF_PARSER + LANGUAGES CXX +) + +cmake_minimum_required(VERSION 3.1) + +set(DEFLIB_HOME ${CMAKE_CURRENT_SOURCE_DIR}) + +# BISON and ZLIB is required to compile DEF/LEF Parsers. +find_package(BISON) +find_package(ZLIB) + +############################################################ +# Create a library for DEF +############################################################ +set( DEFLIB_DEF_SRC + def/defiAlias.cpp + def/defiAssertion.cpp + def/defiBlockage.cpp + def/defiComponent.cpp + def/defiDebug.cpp + def/defiFill.cpp + def/defiFPC.cpp + def/defiGroup.cpp + def/defiIOTiming.cpp + def/defiMisc.cpp + def/defiNet.cpp + def/defiNonDefault.cpp + def/defiPartition.cpp + def/defiPath.cpp + def/defiPinCap.cpp + def/defiPinProp.cpp + def/defiProp.cpp + def/defiPropType.cpp + def/defiRegion.cpp + def/defiRowTrack.cpp + def/defiScanchain.cpp + def/defiSite.cpp + def/defiSlot.cpp + def/defiTimingDisable.cpp + def/defiUtil.cpp + def/defiVia.cpp + def/def_keywords.cpp + def/defrCallbacks.cpp + def/defrData.cpp + def/defrReader.cpp + def/defrSettings.cpp + def/defwWriterCalls.cpp + def/defwWriter.cpp + def/def.tab.cpp + ) + +set( DEFLIB_DEFZLIB_SRC + defzlib/defzlib.cpp + ) + +set (DEFLIB_HEADERS + def/def.tab.h + def/lex.h + def/defiAlias.hpp + def/defiAssertion.hpp + def/defiBlockage.hpp + def/defiComponent.hpp + def/defiDebug.hpp + def/defiDefs.hpp + def/defiFill.hpp + def/defiFPC.hpp + def/defiGroup.hpp + def/defiIOTiming.hpp + def/defiKRDefs.hpp + def/defiMisc.hpp + def/defiNet.hpp + def/defiNonDefault.hpp + def/defiPartition.hpp + def/defiPath.hpp + def/defiPinCap.hpp + def/defiPinProp.hpp + def/defiProp.hpp + def/defiPropType.hpp + def/defiRegion.hpp + def/defiRowTrack.hpp + def/defiScanchain.hpp + def/defiSite.hpp + def/defiSlot.hpp + def/defiTimingDisable.hpp + def/defiUser.hpp + def/defiUtil.hpp + def/defiVia.hpp + def/defrCallBacks.hpp + def/defrData.hpp + def/defrReader.hpp + def/defrSettings.hpp + def/defwWriterCalls.hpp + def/defwWriter.hpp + + defzlib/defzlib.hpp +) + + +# BISON dependencies +add_custom_command( + OUTPUT ${DEFLIB_HOME}/def/def.tab.cpp + COMMAND ${BISON_EXECUTABLE} -v -pdefyy -d ${DEFLIB_HOME}/def/def.y + COMMAND mv def.tab.h ${DEFLIB_HOME}/def/def.tab.h + COMMAND mv def.tab.c ${DEFLIB_HOME}/def/def.tab.cpp +) +add_custom_target(DefBisonTarget ALL DEPENDS def/def.tab.cpp) + + +add_library( def ${DEFLIB_DEF_SRC} ) +add_library( defzlib ${DEFLIB_DEFZLIB_SRC} ) + +set_target_properties( def + PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY ${DEFLIB_HOME}/lib + LIBRARY_OUTPUT_DIRECTORY ${DEFLIB_HOME}/lib + RUNTIME_OUTPUT_DIRECTORY ${DEFLIB_HOME}/lib + # python regression requirement (gag me) -cherry + POSITION_INDEPENDENT_CODE ON +) + +set_target_properties( defzlib + PROPERTIES + ARCHIVE_OUTPUT_DIRECTORY ${DEFLIB_HOME}/lib + LIBRARY_OUTPUT_DIRECTORY ${DEFLIB_HOME}/lib + RUNTIME_OUTPUT_DIRECTORY ${DEFLIB_HOME}/lib + # python regression requirement (gag me) -cherry + POSITION_INDEPENDENT_CODE ON +) + +# include directory settings +target_include_directories( def + PUBLIC + def + ) + +target_include_directories( defzlib + PUBLIC + def + defzlib + ) + +add_dependencies( def DefBisonTarget ) +add_dependencies( defzlib def ) + +###################################################### +# install + +install(FILES ${DEFLIB_HEADERS} DESTINATION include) +install(TARGETS def defzlib DESTINATION lib) diff --git a/src/def/LICENSE.TXT b/src/def/LICENSE.TXT new file mode 100644 index 00000000..b7802a4b --- /dev/null +++ b/src/def/LICENSE.TXT @@ -0,0 +1,13 @@ +Copyright 2012 - 2017, Cadence Design Systems + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/src/def/README.md b/src/def/README.md new file mode 100644 index 00000000..d118e565 --- /dev/null +++ b/src/def/README.md @@ -0,0 +1,3 @@ +Si2 DEF parser 5.8-p027 with CMake support + +See lefdefReadme.txt diff --git a/src/def/TEST/complete.5.8.def b/src/def/TEST/complete.5.8.def new file mode 100644 index 00000000..d4f9a82c --- /dev/null +++ b/src/def/TEST/complete.5.8.def @@ -0,0 +1,1007 @@ +############################################################################### +# DEF57_01 testcase +############################################################################### +VERSION 5.8 ; +NAMESCASESENSITIVE ON ; +DIVIDERCHAR "/" ; +BUSBITCHARS "[]" ; +DESIGN design ; +TECHNOLOGY technology ; +UNITS DISTANCE MICRONS 1000 ; + + + +############################################################################### +# PROPERTYDEFINITIONS +# objectType propName propType [ RANGE min max ] [ value ] ; ... +# END PROPERTYDEFINITIONS +############################################################################### +PROPERTYDEFINITIONS + DESIGN strprop STRING "aString" ; + DESIGN intprop INTEGER 1 ; + DESIGN realprop REAL 1.1 ; + DESIGN intrangeprop INTEGER RANGE 1 100 25 ; + DESIGN realrangeprop REAL RANGE 1.1 100.1 25.25 ; + REGION strprop STRING ; + REGION intprop INTEGER ; + REGION realprop REAL ; + REGION intrangeprop INTEGER RANGE 1 100 ; + REGION realrangeprop REAL RANGE 1.1 100.1 ; + GROUP strprop STRING ; + GROUP intprop INTEGER ; + GROUP realprop REAL ; + GROUP intrangeprop INTEGER RANGE 1 100 ; + GROUP realrangeprop REAL RANGE 1.1 100.1 ; + COMPONENT strprop STRING ; + COMPONENT intprop INTEGER ; + COMPONENT realprop REAL ; + COMPONENT intrangeprop INTEGER RANGE 1 100 ; + COMPONENT realrangeprop REAL RANGE 1.1 100.1 ; + NET strprop STRING ; + NET intprop INTEGER ; + NET realprop REAL ; + NET intrangeprop INTEGER RANGE 1 100 ; + NET realrangeprop REAL RANGE 1.1 100.1 ; + SPECIALNET strprop STRING ; + SPECIALNET intprop INTEGER ; + SPECIALNET realprop REAL ; + SPECIALNET intrangeprop INTEGER RANGE 1 100 ; + SPECIALNET realrangeprop REAL RANGE 1.1 100.1 ; + ROW strprop STRING ; + ROW intprop INTEGER ; + ROW realprop REAL ; + ROW intrangeprop INTEGER RANGE 1 100 ; + ROW realrangeprop REAL RANGE 1.1 100.1 ; + COMPONENTPIN strprop STRING ; + COMPONENTPIN intprop INTEGER ; + COMPONENTPIN realprop REAL ; + COMPONENTPIN intrangeprop INTEGER RANGE 1 100 ; + COMPONENTPIN realrangeprop REAL RANGE 1.1 100.1 ; + NONDEFAULTRULE strprop STRING ; + NONDEFAULTRULE intprop INTEGER ; + NONDEFAULTRULE realprop REAL ; + NONDEFAULTRULE intrangeprop INTEGER RANGE 1 100 ; + NONDEFAULTRULE realrangeprop REAL RANGE 1.1 100.1 ; +END PROPERTYDEFINITIONS + + + +############################################################################### +# DIEAREA pt pt ; +############################################################################### +DIEAREA ( -190000 -120000 ) ( -190000 350000 ) ( 190000 350000 ) + ( 190000 190000 ) ( 190360 190000 ) ( 190360 -120000 ) ; + + + +############################################################################### +# ROW rowName rowType origX origY orient +# { DO numX BY 1 STEP spaceX 0 +# | DO 1 BY numY STEP 0 spaceY } +# + PROPERTY { propName propVal }... ; +############################################################################### +ROW ROW_1 CORE 1000 1000 N DO 100 BY 1 STEP 700 0 + + PROPERTY strprop "aString" + + PROPERTY intprop 1 + + PROPERTY realprop 1.1 + + PROPERTY intrangeprop 25 + + PROPERTY realrangeprop 25.25 ; +ROW ROW_2 CORE 1000 2000 S DO 100 BY 1 STEP 700 0 ; +ROW ROW_3 CORE 1000 3000 E DO 100 BY 1 STEP 8400 0 ; +ROW ROW_4 CORE 1000 4000 W DO 100 BY 1 STEP 8400 0 ; +ROW ROW_5 CORE 1000 5000 FN DO 100 BY 1 STEP 700 0 ; +ROW ROW_6 CORE 1000 6000 FS DO 100 BY 1 STEP 700 0 ; +ROW ROW_7 CORE 1000 7000 FE DO 100 BY 1 STEP 8400 0 ; +ROW ROW_8 CORE 1000 8000 FW DO 100 BY 1 STEP 8400 0 ; + +ROW ROW_VERT_1 CORE -10000 -10000 N DO 1 BY 10 STEP 0 8400 ; +ROW ROW_VERT_2 CORE -9000 -10000 S DO 1 BY 10 STEP 0 8400 ; +ROW ROW_VERT_3 CORE -8000 -10000 E DO 1 BY 10 STEP 0 700 ; +ROW ROW_VERT_4 CORE -7000 -10000 W DO 1 BY 10 STEP 0 700 ; +ROW ROW_VERT_5 CORE -6000 -10000 FN DO 1 BY 10 STEP 0 8400 ; +ROW ROW_VERT_6 CORE -5000 -10000 FS DO 1 BY 10 STEP 0 8400 ; +ROW ROW_VERT_7 CORE -4000 -10000 FE DO 1 BY 10 STEP 0 700 ; +ROW ROW_VERT_8 CORE -3000 -10000 FW DO 1 BY 1 STEP 0 700 ; + +ROW ROW_array0 ARRAYSITE 10000 10000 N DO 100 BY 1 STEP 16000 0 ; +ROW ROW_array1 ARRAYSITE 10000 17000 W DO 100 BY 1 STEP 16000 0 ; +ROW ROW_array2 ARRAYSITE 10000 17000 S DO 100 BY 1 STEP 16000 0 ; +ROW ROW_array3 ARRAYSITE 10000 17000 E DO 100 BY 1 STEP 16000 0 ; +ROW ROW_array4 ARRAYSITE 10000 17000 FN DO 100 BY 1 STEP 16000 0 ; +ROW ROW_array5 ARRAYSITE 10000 17000 FE DO 100 BY 1 STEP 16000 0 ; +ROW ROW_array6 ARRAYSITE 10000 17000 FS DO 100 BY 1 STEP 16000 0 ; +ROW ROW_array7 ARRAYSITE 10000 17000 FW DO 100 BY 1 STEP 16000 0 ; + + + +############################################################################### +# TRACKS +# {X | Y} start +# DO numtracks STEP space +# [ MASK maskNum {SAMEMASK]] +# [ LAYER layerName ...] ; +############################################################################### +TRACKS Y 52 DO 857 STEP 104 MASK 1 ; +TRACKS Y 52 DO 857 STEP 104 MASK 1 SAMEMASK LAYER M1 M2 ; +TRACKS X 52 DO 1720 STEP 104 MASK 2 LAYER M2 ; +TRACKS X 52 DO 1720 STEP 104 ; + + +############################################################################### +# GCELLGRID +# X start DO numColumns+1 STEP space +# Y start DO numRows+1 STEP space ; +############################################################################### +GCELLGRID X 0 DO 100 STEP 600 ; +GCELLGRID Y 10 DO 120 STEP 400 ; + + + +############################################################################### +# VIAS numVias ; +# [- viaName +# [+ PATTERNNAME patternName] +# + RECT layerName [+ MASK maskNUM] pt pt +# | + POLYGON layerName [+ MASK maskNUM] pt pt pt]...;]... +# END VIAS +############################################################################### +VIAS 6 ; +- VIAGEN12_0 + + PATTERNNAME VIAGEN_12_12.800_7.600_I5 + + RECT METAL1 ( -4400 -3800 ) ( 4400 3800 ) + + RECT M2 + MASK 3 ( -4500 -3800 ) ( 4500 3800 ) + + RECT V1 + MASK 2 ( -3600 -3800 ) ( -2000 -2200 ) + + RECT V1 + MASK 1 ( -3600 2200 ) ( -2000 3800 ) + + RECT V1 + MASK 2 ( 2000 -3800 ) ( 3600 -2200 ) + + RECT V1 + MASK 3 ( 2000 2200 ) ( 3600 3800 ) ; + +- VIAGEN12_2 + + PATTERNNAME VIAGEN_12_5.0000_3.000_1.5600_-0.1600_1.0400_1.0400_D + + RECT METAL1 ( -2500 -1500 ) ( 2500 1500 ) + + RECT M2 ( -2500 -1500 ) ( 2500 1500 ) + + RECT V1 ( -2360 -960 ) ( -760 640 ) + + RECT V1 ( -1320 -960 ) ( 280 640 ) + + RECT V1 ( 760 -960 ) ( 2360 640 ) ; + +- VIAGEN12_3 + + PATTERNNAME VIAGEN12 + + RECT METAL1 ( -1600 -1600 ) ( 1600 1600 ) + + RECT M2 ( -1600 -1600 ) ( 1600 1600 ) + + RECT V1 ( -800 -800 ) ( 800 800 ) ; + +- VIAGEN12_4 + + VIARULE VIAGEN12 + + CUTSIZE 1600 1600 + + LAYERS M1 V1 M2 + + CUTSPACING 5600 6100 + + ENCLOSURE 100 100 150 150 + + ROWCOL 5 14 + + PATTERN 2_FFE0_3_FFFF + + ORIGIN 10 -10 + + OFFSET 0 0 20 -20 ; + +- M2_M1rct_0 + + RECT V1 ( -25 -65 ) ( 25 65 ) + + RECT M1 ( -35 -95 ) ( 35 95 ) + + RECT M2 ( -65 -65 ) ( 65 65 ) ; + +- VIAGEN12_1 + + POLYGON METAL1 + MASK 2 ( -2500 -1500 ) ( -2500 2500 ) ( 1500 2500 ) ( 1500 1500 ) ( 2500 1500 ) ( 2500 -1500 ) + + RECT M2 ( -2500 -1500 ) ( 2500 1500 ) + + RECT V1 ( -2400 -960 ) ( -700 640 ) ; + +- CUSTOMVIA + + POLYGON METAL1 + MASK 3 ( -2500 -1500 ) ( -2500 2500 ) ( 1500 2500 ) ( 1500 1500 ) ( 2500 1500 ) ( 2500 -1500 ) ; + +- TURNM1_1 + + RECT METAL1 ( -100 -60 ) ( 100 60 ) ; +- TURNM2_1 + + RECT M2 ( -100 -60 ) ( 100 60 ) ; +- TURNM3_1 + + RECT M3 ( -100 -60 ) ( 100 60 ) ; +- myvia1 + + RECT METAL1 + MASK 2 ( 0 0 ) ( 40000 40000 ) + + RECT V1 + MASK 3 ( 0 0 ) ( 40000 40000 ) + + RECT M2 ( 0 0 ) ( 40000 40000 ) ; +END VIAS + + + +############################################################################### +# [STYLES numStyles ; +# {- STYLE styleNum pt pt pt ;} ... +# END STYLES] +############################################################################### +STYLES 10 ; +- STYLE 0 ( 30 10 ) ( 10 30 ) ( -10 30 ) ( -30 10 ) ( -30 -10 ) ( -10 -30 ) ( 10 -30 ) ( 30 -10 ) ; +- STYLE 1 ( 25 25 ) ( -25 25 ) ( -25 -25 ) ( 25 -25 ) ; +- STYLE 2 ( 50 50 ) ( -50 50 ) ( -50 -50 ) ( 50 -50 ) ; +- STYLE 3 ( 50 21 ) ( 21 50 ) ( -21 50 ) ( -50 21 ) ( -50 -21 ) ( -21 -50 ) ( 21 -50 ) ( 50 -21 ) ; +- STYLE 4 ( -30 -20 ) ( 10 -60 ) ( 50 -20 ) ( 50 40 ) ( 0 40 ) ( -30 10 ) ; +- STYLE 5 ( 0 2000 ) ( 0 -2000 ) ( 0 2000 ) ( 0 -2000 ) ; +- STYLE 6 ( -2000 2000 ) ( 2000 -2000 ) ( * * ) ; +- STYLE 7 ( 0 0 ) ( 0 1000 ) ( 1000 0 ) ; +- STYLE 8 ( -7500 -3110 ) ( -3110 -7500 ) ( 3110 -7500 ) ( 7500 -3110 ) ( 7500 7500 ) ( -7500 7500 ) ; +- STYLE 9 ( 0 -10610 ) ( 7500 -3110 ) ( 7500 3110 ) ( 3110 7500 ) ( -3110 7500 ) ( -10610 0 ) ; +END STYLES + + + +############################################################################### +# [NONDEFAULTRULES numNDRs ; +# {- STYLE styleNum pt pt pt ;} ... +# END NONDEFAULTRULES] +############################################################################### +NONDEFAULTRULES 1 ; +- DEFAULT + + LAYER METAL1 + WIDTH 10.1 + DIAGWIDTH 8.01 + SPACING 2.2 + WIREEXT 1.1 + + LAYER M2 + WIDTH 10.1 + SPACING 2.2 + + LAYER M3 + WIDTH 11.1 + SPACING 3.2 + + VIA M1_M2 + + VIA M2_M3 + + VIARULE VIAGEN12 + + MINCUTS V1 2 + + PROPERTY strprop "aString" + + PROPERTY intprop 1 + + PROPERTY realprop 1.1 + + PROPERTY intrangeprop 25 + + PROPERTY realrangeprop 25.25 ; +- RULE2 + + HARDSPACING + + LAYER METAL1 + WIDTH 10.1 + DIAGWIDTH 8.01 + SPACING 2.2 + WIREEXT 1.1 + + LAYER M2 + WIDTH 10.1 + SPACING 2.2 + + LAYER M3 + WIDTH 11.1 + SPACING 3.2 + + VIA M1_M2 + + VIA M2_M3 + + VIARULE VIAGEN12 + + MINCUTS V1 2 + + PROPERTY strprop "aString" + + PROPERTY intprop 1 + + PROPERTY realprop 1.1 + + PROPERTY intrangeprop 25 + + PROPERTY realrangeprop 25.25 ; +END NONDEFAULTRULES + + +############################################################################### +# REGIONS numRegions; +# [- regionName pt pt [pt pt]... +# [+ TYPE [ FENCE | GUIDE ] +# [+ PROPERTY {propName propVal}...]...;]... +# END REGIONS +############################################################################### +REGIONS 2 ; +- region1 ( -500 -500 ) ( 300 100 ) ( 500 500 ) ( 1000 1000 ) + + TYPE FENCE + + PROPERTY strprop "aString" + + PROPERTY intprop 1 + + PROPERTY realprop 1.1 + + PROPERTY intrangeprop 25 + + PROPERTY realrangeprop 25.25 ; +- region2 ( 4000 0 ) ( 5000 1000 ) + + TYPE GUIDE ; +END REGIONS + + + +############################################################################### +# COMPONENTS numComps ; +# [- compName modelName[netName | *]... +# [+ EEQMASTER macroname] +# [+ GENERATE generatorName [parameters]] +# [+ SOURCE {NETLIST | DIST | USER | TIMING}] +# [+ FOREIGN foreignCellName pt orient]... +# [+ {FIXED pt orient | COVER pt orient | PLACED pt orient | UNPLACED}] +# [+ WEIGHT weight] +# [+ REGION {pt pt | regionName}] +# [+ PROPERTY {propName propVal}...]...; +# ]... +# END COMPONENTS +############################################################################### +COMPONENTMASKSHIFT M3 M2 V1 M1 ; + +COMPONENTS 13 ; +- I1 B + + EEQMASTER A + + GENERATE generator + + SOURCE NETLIST + + FOREIGN gds2name ( -500 -500 ) N + + PLACED ( 100 100 ) N + + WEIGHT 100 + + REGION region1 + + MASKSHIFT 1102 + + HALO 5 6 7 8 + + HALO SOFT 5 6 7 8 + + ROUTEHALO 100 METAL1 M3 + + PROPERTY strprop "aString" + + PROPERTY intprop 1 + + PROPERTY realprop 1.1 + + PROPERTY intrangeprop 25 + + PROPERTY realrangeprop 25.25 ; +- I2 A + + SOURCE DIST + + ROUTEHALO 100 M2 M3 + + PLACED ( 200 200 ) S ; +- I3 A + + SOURCE USER + + PLACED ( 300 300 ) E ; +- I4 A + + SOURCE TIMING + + PLACED ( 400 400 ) W ; +- I5 A + + PLACED ( 500 500 ) FN ; +- I6 A + + PLACED ( 600 600 ) FS ; +- I7 A + + PLACED ( 700 700 ) FE ; +- I8 A + + PLACED ( 800 800 ) FW ; +- I9 A + + FIXED ( 900 900 ) N ; +- I10 A + + COVER ( 1000 1000 ) N ; +- I11 A + + UNPLACED ; +- I12[0] A ; +- I12[1] A ; +- I13[0][10] A ; +- I14\[1\] A ; +- vectormodule[1]/scalarname A ; +- vectormodule[1]/vectorname[1] A ; +- scancell1 CHK3A ; +- scancell2 CHK3A ; +- scancell3 CHK3A ; +- scancell4 CHK3A ; +- scancell5 CHK3A ; +- scancell6 CHK3A ; +- scancell7 CHK3A ; +- scancell8 CHK3A ; +- scancell9 CHK3A ; +- scancell10 CHK3A ; +- scancell11 CHK3A ; +- scancell12 CHK3A ; +- nobrackets A ; +- somethingwith[1] A ; +- more[]brackets A ; +- more[1]brackets A ; +- more\[1\]brackets A ; +- more[1][2] A ; +- more\[1\]\[2\] A ; +- more\[2\] A ; +- foo\[1\]\[2\]/haha\[3\]\[4\] A ; +- foo[2][3]/haha[4][5] A ; +- foo\[3\]\[4\]/haha[5][6] A ; +- foo[4][5]/haha\[6\]\[7\] A ; +- foo[5][6]bar/haha\[7\]\[8\] A ; +- foo[6][7]bar/haha[8][9] A ; +END COMPONENTS + + +############################################################################### +# PINS numPins ; +# [ - pinName + NET netName +# [+ SPECIAL] +# [+ DIRECTION {INPUT | OUTPUT | INOUT | FEEDTHRU}] +# [+ USE {SIGNAL | POWER | GROUND | CLOCK +# | ANALOG | SCAN | RESET}] +# [+ LAYER layerName pt pt] +# [+ {FIXED | PLACED | COVER} pt orient] +# [+ ANTENNAPINPARTIALMETALAREA integer [LAYER layerName] ] ... +# [+ ANTENNAPINPARTIALMETALSIDEAREA integer [LAYER layerName] ] ... +# [+ ANTENNAPINDIFFAREA integer [LAYER layerName] ] ... +# [+ ANTENNAPINPARTIALCUTAREA integer [LAYER cutLayerName] ] ... +# [+ ANTENNAMODEL OXIDE{1,2,3,4} ] +# [+ ANTENNAPINGATEAREA integer [LAYER layerName] ] ... +# [+ ANTENNAPINMAXAREACAR integer LAYER layerName ] +# [+ ANTENNAPINMAXSIDEAREACAR integer LAYER layerName ] +# [+ ANTENNAPINMAXCUTCAR integer LAYER layerName ] +# ; +# ]... +# END PINS +############################################################################### +PINS 11 ; +- P0 + NET N0 + + SPECIAL + + DIRECTION INPUT + + USE SIGNAL + + PORT + + LAYER M2 MASK 2 ( 0 0 ) ( 30 135 ) + + VIA VIAGEN12_0 ( 0 100 ) + + FIXED ( 45 -2160 ) N + + PORT + + LAYER M1 ( 0 0 ) ( 30 135 ) + + VIA M1_M2 MASK 23 ( 100 0 ) + + COVER ( 0 -1000 ) N + + PORT + + LAYER M3 ( 0 0 ) ( 30 135 ) + + PLACED ( 1000 -1000 ) N + + NETEXPR "power1 VDD" + + SUPPLYSENSITIVITY P1 + + GROUNDSENSITIVITY P2 + + ANTENNAPINPARTIALMETALAREA 5 LAYER METAL1 + + ANTENNAPINPARTIALMETALAREA 5 LAYER M2 + + ANTENNAPINPARTIALMETALSIDEAREA 10 LAYER METAL1 + + ANTENNAPINPARTIALMETALSIDEAREA 10 LAYER M2 + + ANTENNAPINDIFFAREA 20 LAYER M1 + + ANTENNAPINDIFFAREA 20 LAYER M2 + + ANTENNAPINPARTIALCUTAREA 35 LAYER V1 + + ANTENNAPINPARTIALCUTAREA 35 LAYER V2 + + ANTENNAMODEL OXIDE1 + + ANTENNAPINGATEAREA 15 LAYER M1 + + ANTENNAPINGATEAREA 15 LAYER M2 + + ANTENNAPINMAXAREACAR 25 LAYER M1 + + ANTENNAPINMAXSIDEAREACAR 30 LAYER M1 + + ANTENNAPINMAXCUTCAR 40 LAYER M1 + + ANTENNAMODEL OXIDE2 + + ANTENNAPINGATEAREA 115 LAYER M1 + + ANTENNAPINGATEAREA 115 LAYER M2 + + ANTENNAPINMAXAREACAR 125 LAYER M1 + + ANTENNAPINMAXSIDEAREACAR 130 LAYER M1 + + ANTENNAPINMAXCUTCAR 140 LAYER M1 + + ANTENNAMODEL OXIDE3 + + ANTENNAPINGATEAREA 115 LAYER M1 + + ANTENNAPINGATEAREA 115 LAYER M2 + + ANTENNAPINMAXAREACAR 125 LAYER M1 + + ANTENNAPINMAXSIDEAREACAR 130 LAYER M1 + + ANTENNAPINMAXCUTCAR 140 LAYER M1 + + ANTENNAMODEL OXIDE4 + + ANTENNAPINGATEAREA 115 LAYER M1 + + ANTENNAPINGATEAREA 115 LAYER M2 + + ANTENNAPINMAXAREACAR 125 LAYER M1 + + ANTENNAPINMAXSIDEAREACAR 130 LAYER M1 + + ANTENNAPINMAXCUTCAR 140 LAYER M1 ; +- P1 + NET N1 + + DIRECTION OUTPUT + + USE POWER + + POLYGON M2 MASK 3 ( 0 0 ) ( 0 100 ) ( 50 100 ) ( 50 50 ) ( 100 50 ) ( 100 0 ) + + PLACED ( 45 -2160 ) N + + NETEXPR "power1 VDD[1]" + + ANTENNAPINPARTIALMETALAREA 5 + + ANTENNAPINPARTIALMETALSIDEAREA 10 + + ANTENNAPINGATEAREA 15 + + ANTENNAPINDIFFAREA 20 + + ANTENNAPINPARTIALCUTAREA 35 ; +- P2 + NET N2 + + DIRECTION INOUT + + USE GROUND + + LAYER M2 MASK 2 ( 0 0 ) ( 30 135 ) + + COVER ( 45 -2160 ) N ; +- P2.extra1 + NET N2 + + DIRECTION INOUT + + USE GROUND + + LAYER METAL1 ( 0 0 ) ( 10 10 ) + + COVER ( 0 0 ) N ; +- P3 + NET N3 + + DIRECTION FEEDTHRU + + USE CLOCK ; +- P4 + NET N4 + + USE SIGNAL ; +- P5 + NET N5 + + USE ANALOG ; +- P6 + NET N6 + + USE SCAN ; +- P7 + NET N7 + + USE RESET ; +- ARRAYPIN[0][10] + NET ARRAYNET[0][10] + + LAYER M2 ( 0 0 ) ( 30 135 ) ; +- ARRAYPIN.extra2[0][10] + NET ARRAYNET[0][10] + + LAYER M2 ( 0 0 ) ( 10 10 ) ; +- scanpin + NET SCAN + + USE SCAN ; +- scanpin2 + NET SCAN + + USE SCAN ; +- INBUS[1] + NET INBUS<1> + + LAYER METAL1 ( 0 0 ) ( 10 10 ) ; +- OUTBUS<1> + NET OUTBUS<1> ; +- INBUS.extra1[1] + NET INBUS<1> + + LAYER M1 ( 10 10 ) ( 100 100 ) ; +- vectorpin[0] + NET vectormodule[1]/vectornet[0] ; +- scalarpin + NET vectormodule[1]/scalarnet ; +- RE_RDY_2 + NET RE_RDY_2 + DIRECTION OUTPUT + USE SIGNAL + + PORT + + VIA myvia1 MASK 123 ( 500 500 ) + + FIXED ( -390000 0 ) N + + PORT + + POLYGON METAL1 MASK 22 ( 40000 40000 ) ( 80000 40000 ) ( 80000 -40000 ) ( 40000 -40000 ) ( 40000 -80000 ) + ( -40000 -80000 ) ( -40000 -40000 ) ( -80000 -40000 ) ( -80000 40000 ) ( -40000 40000 ) ( -40000 80000 ) + ( 40000 80000 ) + + FIXED ( -190000 0 ) N + + PORT + + VIA myvia1 ( 100 100 ) + + FIXED ( 290000 0 ) N ; +END PINS + + +############################################################################### +# PINPROPERTIES num; +# [- { compName | PIN } pinName +# [+ PROPERTY {propName propVal}...]...; +# ]... +# END PINPROPERTIES +############################################################################### +PINPROPERTIES 2 ; +- PIN P0 + + PROPERTY strprop "aString" + + PROPERTY intprop 1 + + PROPERTY realprop 1.1 + + PROPERTY intrangeprop 25 + + PROPERTY realrangeprop 25.25 ; +- I1 A + + PROPERTY strprop "aString" + + PROPERTY intprop 1 + + PROPERTY realprop 1.1 + + PROPERTY intrangeprop 25 + + PROPERTY realrangeprop 25.25 ; +END PINPROPERTIES + + +############################################################################### +# BLOCKAGES numBlockages ; +# - { LAYER layerName +# [+ COMPONENT compName +# |+ SLOTS +# |+ FILLS +# | + PUSHDOWN ] +# | PLACEMENT +# [ + COMPONENT compName +# | + PUSHDOWN ] +# } +# RECT pt pt +# [RECT pt pt ] ... ; +# ... +# END BLOCKAGES +############################################################################### +BLOCKAGES 8 ; + - LAYER METAL1 + MASK 1 + RECT ( 60 70 ) ( 80 90 ) ; + - LAYER M2 + SLOTS + PUSHDOWN + EXCEPTPGNET + COMPONENT I1 + MASK 3 + POLYGON ( 100 100 ) ( 100 200 ) ( 150 200 ) ( 150 150 ) ( 200 150 ) ( 200 100 ) ; + - LAYER M2 + SLOTS + MASK 2 + RECT ( 10 20 ) ( 40 50 ) ; + - LAYER METAL1 + FILLS + MASK 1 + RECT ( -10 20 ) ( 30 40 ) ; + - LAYER M1 + PUSHDOWN + SPACING 3 + MASK 1 + RECT ( 50 30 ) ( 55 40 ) ; + - LAYER M1 + EXCEPTPGNET + DESIGNRULEWIDTH 45 + MASK 1 + RECT ( 50 30 ) ( 55 40 ) ; + - PLACEMENT +# POLYGON ( 100 100 ) ( 100 200 ) ( 150 200 ) ( 150 150 ) ( 200 150 ) ( 200 100 ) ; + RECT ( -15 0 ) ( 0 20 ) + RECT ( -15 20 ) ( 30 40 ) + RECT ( 30 5 ) ( 50 40 ) + RECT ( -10 -15 ) ( 50 0 ) ; #floating + - PLACEMENT + PARTIAL 0.40 + PUSHDOWN + COMPONENT I1 + RECT ( -10 0 ) ( 0 20 ) + RECT ( -10 20 ) ( 30 40 ) + RECT ( 30 0 ) ( 50 40 ) + RECT ( -10 -5 ) ( 50 0 ) ; #coordinate are absolute + - PLACEMENT + PUSHDOWN + RECT ( -5 0 ) ( 0 20 ) + RECT ( -5 20 ) ( 30 40 ) + RECT ( 30 0 ) ( 25 40 ) + RECT ( -5 0 ) ( 50 10 ) ; #coordinate are absolute + - PLACEMENT + SOFT + RECT ( 50 30 ) ( 55 40 ) ; + - PLACEMENT + PARTIAL 0.40 + RECT ( 50 30 ) ( 55 40 ) ; + +END BLOCKAGES + + + +############################################################################### +# SPECIALNETS numNets ; +# [- netName [(compNameRegExpr pinName[+ SYNTHESIZED])]... +# [+ WIDTH layerName width]... +# [+ VOLTAGE mvolts] +# [+ SOURCE {NETLIST | DIST | USER | TIMING}] +# [+ FIXEDBUMP ] +# [+ ORIGINAL netName] +# [+ USE +# { SIGNAL | POWER | GROUND | CLOCK +# | SCAN | RESET | TIEOFF | ANALOG }] +# [+PATTERN +# {STEINER | BALANCED | TRUNK}] +# [+ ESTCAP wireCapacitance] +# [+ WEIGHT weight] +# [+ PROPERTY {propName propVal}...]...;]... +# [+ {ROUTED | FIXED | COVER} layerName width +# [+ SHAPE {RING | STRIPE | FOLLOWPIN | IOWIRE +# | COREWIRE | BLOCKWIRE | FILLWIRE +# | PADRING | BLOCKRING | BLOCKAGEWIRE}] +# (x y) [ (x *) | (* y) | viaName ]... +# [ NEW layerName width +# [+ SHAPE {RING | STRIPE | FOLLOWPIN | IOWIRE | COREWIRE +# | BLOCKWIRE | FILLWIRE +# | PADRING | BLOCKRING | BLOCKAGEWIRE}] +# (x y) [ (x *) | (* y) | +# viaName [ DO numX by numY STEP stepX stepY] ]...]...] +# [+ SHIELD shieldedNetName layerName width +# [+ SHAPE {RING | STRIPE | FOLLOWPIN | IOWIRE +# | COREWIRE | BLOCKWIRE | FILLWIRE +# | PADRING | BLOCKRING | BLOCKAGEWIRE}] +# (x y) [ (x *) | (* y) | viaName ]... +# [NEW layerName width +# [+ SHAPE {RING | STRIPE | FOLLOWPIN | IOWIRE +# | COREWIRE | BLOCKWIRE | FILLWIRE | BLOCKAGEWIRE}] +# (x y) [ [ MASK maskNum ](x *) | [ MASK maskNum ] (* y) | +# [ MASK viaMaskNum ] viaName [ DO numX by numY STEP stepX stepY] ]...]...]... +# ;]... +# END SPECIALNETS +############################################################################### +SPECIALNETS 5 ; +- SN1 ( I1 Z.extra1 ) ( I2 Z ) ( I3 Z ) ( * Z ) + + WIDTH METAL1 200 + + WIDTH M2 300 + + VOLTAGE 3200 + + SOURCE NETLIST + + FIXEDBUMP + + ORIGINAL VDD + + USE SIGNAL + + PATTERN STEINER + + ESTCAP 1500000 + + WEIGHT 30 + + PROPERTY strprop "aString" + + PROPERTY intprop 1 + + PROPERTY realprop 1.1 + + PROPERTY intrangeprop 25 + + PROPERTY realrangeprop 25.25 + + + ROUTED M1 120 + SHAPE RING ( 14000 341440 ) ( 9600 * ) ( * 282400 ) M1_M2 DO 2 BY 2 STEP 200 200 ( 2400 * ) + NEW METAL1 120 + SHAPE STRIPE ( 2400 282400 ) ( 240 * ) M1_M2 + NEW M1 120 + SHAPE FOLLOWPIN ( 2500 282400 ) ( 250 * ) VIAGEN12_0 N + NEW M1 120 + SHAPE IOWIRE ( 2600 282400 ) ( 260 * ) VIAGEN12_2 + NEW METAL1 120 + SHAPE COREWIRE ( 2700 282400 ) ( 270 * ) VIAGEN12_3 + NEW M1 120 + SHAPE BLOCKWIRE ( 2800 282400 ) ( 280 * ) CUSTOMVIA VIAGEN12_1 + NEW M1 120 + SHAPE FILLWIRE ( 2900 282400 ) ( 290 * ) VIAGEN12_4 + NEW M1 120 + SHAPE FILLWIREOPC ( 2900 282400 ) VIAGEN12_4 + NEW M1 120 + SHAPE BLOCKAGEWIRE ( 2000 282400 ) ( 200 * ) VIAGEN12 + NEW M1 120 + SHAPE BLOCKRING ( 2100 282400 ) ( 210 * ) + NEW M1 120 + SHAPE PADRING ( 2200 282400 ) ( 220 * ) + + NEW M1 200 ( 3000 3000 ) TURNM1_1 + NEW M2 200 ( 3100 3100 ) ( 3200 3100 ) TURNM2_1 + NEW M2 200 ( 3300 3300 ) ( 3400 3300 ) TURNM2_1 ( 3400 3600 ) + + NEW M2 200 ( 400 400 ) M1_M2 ( * * ) # case : pt via ( * * ) + NEW M2 200 ( 500 500 ) M1_M2 ( * * ) M1_M2 # case : pt via ( * * ) via + NEW M2 200 ( 700 700 ) M1_M2 ( * * ) ( * 800 ) # case : pt via ( * * ) pt + + NEW M2 15000 + STYLE 9 ( 105000 105000 ) ( 50000 50000 ) + NEW M2 15000 + STYLE 8 ( 105000 155000 ) ( * 105000 ) + + COVER METAL1 100 ( 100 100 ) ( 100 200 ) + + FIXED M1 100 ( 200 200 ) ( 300 200 ) + + ROUTED M1 120 + SHAPE DRCFILL ( 8000 8000 ) ( 8000 8200 ) ( 8400 8200 ) + + SHIELD N1 M2 90 ( 14100 340440 ) ( 8160 * ) M1_M2 ( * 301600 ) M1_M2 FN DO 2 BY 2 STEP 200 200 ( 2400 * ) + ; +- VDD + + VOLTAGE 5000 + + FIXED + SHAPE RING + MASK 2 + POLYGON METAL1 ( 0 0 ) ( 0 100 ) ( 100 100 ) ( 200 200 ) ( 200 0 ) + + COVER + SHAPE RING + MASK 3 + POLYGON M2 ( 100 100 ) ( * 200 ) ( 200 * ) ( 300 300 ) ( 300 100 ) + + VIA M1_M2 N ( 2400 0 ) ( 10 10 ) + + FIXED + SHAPE RING + RECT M3 ( 0 0 ) ( 10 10 ) + + SHIELD N1 + SHAPE BLOCKRING + RECT M3 ( 0 0 ) ( 10 10 ) + + ROUTED M1 20 ( 10 0 ) MASK 3 ( 10 20 ) VIAGEN12_4 + NEW M2 100 ( 10 10 ) ( 20 10 ) MASK 1 ( 20 20 ) MASK 031 VIAGEN12_3 + + SHAPE STRIPE + VIA VIA12_2 ( 30 30 ) ( 40 40 ) + + ROUTED M1 100 ( 0 0 100 ) ( 0 0 50 ) ( 100 0 50 ) M1_M2 ( 100 100 50 ) + + ROUTED M1 50 + STYLE 0 ( 0 0 ) ( 150 150 ) + + ROUTED M1 50 + STYLE 0 ( 150 150 ) ( 0 0 ) + + ROUTED M1 50 + STYLE 0 ( 150 0 ) ( 0 150 ) + + ROUTED M1 50 + STYLE 0 ( 0 150 ) ( 150 0 ) + + ROUTED M1 50 + STYLE 1 ( 150 150 ) ( 300 0 ) ( 400 0 ) + + ROUTED M2 100 + SHAPE RING + STYLE 0 ( 0 0 ) ( 100 100 ) ( 200 100 ) + + ROUTED M1 100 + STYLE 2 ( 0 0 ) M1_M2 ( 600 * ) M1_M2 + + ROUTED M1 50 ( 150 150 ) ( 300 300 ) + ; +- SN2 + + ROUTED M2 100 + STYLE 3 ( 0 0 ) ( 150 150 ) ( 300 0 ) + NEW M2 100 ( 300 0 ) ( 400 0 ) + + ROUTED M1 100 ( 0 0 ) ( 150 150 ) ( 300 0 ) ( 400 0 ) + + ROUTED M1 4000 + STYLE 5 ( 0 0 ) ( 1000 0 ) + + ROUTED M1 4000 + STYLE 6 ( 0 0 ) ( 1000 1000 ) + + ROUTED M1 1000 + STYLE 7 ( 0 0 ) ( * * ) ; +- SN3 + + USE GROUND + + ROUTED M2 100 ( 100 0 ) ( * 3000 ) + NEW M3 100 ( 0 1000 ) ( 3000 * ) + + SHIELD N1 M2 40 + SHAPE FILLWIRE ( 300 80 ) ( * 1920 ) + NEW M2 40 + SHAPE FILLWIRE ( 500 80 ) ( * 1920 ) ; +- DUMMY + + ROUTED M1 100 + SHAPE FILLWIRE ( 0 0 ) ( 100 0 ) ; +- DUMMY2 + + ROUTED M2 100 + SHAPE FILLWIREOPC ( 0 0 ) ( 100 0 ) ; +END SPECIALNETS + + +############################################################################### +# NETS numNets ; +# [- { netName [( {compName | PIN} pinName +# [+ SYNTHESIZED])]... +# | MUSTJOIN (compName pinName) } +# [+ SHIELDNET shieldNetName ] ... +# [+ NOSHIELD lastSegment ] ... +# [+ VPIN vpinName [LAYER layerName] pt pt +# [ { PLACED | FIXED | COVER } pt orient ] ]... +# [+ SUBNET subnetName +# [( {compName | PIN} pinName)| (VPIN vpinName)]... +# [NONDEFAULTRULE rulename] +# [regularWiring]] +# [+ XTALK num] +# [+ NONDEFAULTRULE ruleName] +# [regularWiring]... +# [+ SOURCE {NETLIST | DIST | USER | TEST | TIMING}] +# [+ FIXEDBUMP ] +# [+ FREQUENCY freq ] +# [+ ORIGINAL netName] +# [+ USE +# { SIGNAL | POWER | GROUND | CLOCK +# | SCAN | RESET | TIEOFF | ANALOG}] +# [+ PATTERN +# {STEINER | BALANCED }] +# [+ ESTCAP wireCapacitance] +# [+ WEIGHT weight] +# [+ PROPERTY {propName propVal}...]...; +# ]... +# END NETS +# +# regularWiring = +# {+ ROUTED | + FIXED | + COVER | + NOSHIELD} +# layerName [TAPER | TAPERRULE rulename] [STYLE styleNum ] +# routingPoints +# [NEW layerName [TAPER | TAPERRULE rulename] [STYLE styleNum ] +# routingPoints +# ] ... +# +# routingPoints = +# ( x y [value] ) +# {( x * [value]) | ( * y [value]) | ( * * [value] ) | viaName | + RECT ( delta1x delta1y delta2x delta2y ) | + VIRTUAL ( x y ) ]...] +############################################################################### +NETS 6 ; +- SCAN ( scancell1 PA10 + SYNTHESIZED ) ( scancell2 PA2 + SYNTHESIZED ) + + SOURCE TEST ; +- N1 ( I1 A ) ( PIN P0 ) + + SHIELDNET SN1 + + SHIELDNET VDD + + FIXED M3 ( 10 0 ) MASK 3 ( 10 20 ) MASK 031 M1_M2 + + ROUTED M1 ( 0 0 ) ( 5 0 ) VIRTUAL ( 2 3 ) MASK 1 ( 7 7 ) + + ROUTED M1 ( 0 0 ) ( 5 0 ) VIRTUAL ( 2 3 ) RECT ( 1 2 3 4 ) ( 7 7 ) + + FIXED M1 ( 0 0 ) ( 5 0 ) ( 7 7 ) + + FIXED M1 ( 0 0 ) ( 5 0 ) MASK 3 RECT ( 1 2 3 4 ) ( 7 7 ) + + NOSHIELD M2 ( 14100 341440 ) ( 14000 * ) M1_M2 + + VPIN N1_VP0 LAYER M3 ( -333 -333 ) ( 333 333 ) PLACED ( 189560 27300 ) N + + VPIN N1_VP1 LAYER M3 ( -333 -333 ) ( 333 333 ) PLACED ( 189560 27300 ) S + + VPIN N1_VP2 LAYER M3 ( -333 -333 ) ( 333 333 ) PLACED ( 189560 27300 ) E + + VPIN N1_VP3 LAYER M3 ( -333 -333 ) ( 333 333 ) PLACED ( 189560 27300 ) W + + VPIN N1_VP4 LAYER M3 ( -333 -333 ) ( 333 333 ) PLACED ( 189560 27300 ) FN + + VPIN N1_VP5 LAYER M3 ( -333 -333 ) ( 333 333 ) PLACED ( 189560 27300 ) FS + + VPIN N1_VP6 LAYER M3 ( -333 -333 ) ( 333 333 ) PLACED ( 189560 27300 ) FE + + VPIN N1_VP7 LAYER M3 ( -333 -333 ) ( 333 333 ) PLACED ( 189560 27300 ) FW + + VPIN N1_VP8 ( -333 -333 ) ( 333 333 ) + + SUBNET N1_SUB0 ( I2 A ) ( PIN P1 ) ( VPIN N1_VP9 ) + NONDEFAULTRULE RULE1 + ROUTED M1 ( 168280 63300 700 ) ( * 64500 ) M1_M2 ( 169400 * 800 ) M2_M3 + + XTALK 2 + + NONDEFAULTRULE RULE1 + + ROUTED + M2 ( 14000 341440 ) ( 9600 * ) ( * 282400 ) nd1VIA12 ( 2400 * ) TURNM1_1 + NEW M1 TAPER ( 2400 282400 ) ( 240 * ) + + SOURCE NETLIST + + FIXEDBUMP + + FREQUENCY 100 + + ORIGINAL N2 + + USE SIGNAL + + PATTERN STEINER + + ESTCAP 1500000 + + WEIGHT 100 + + PROPERTY strprop "aString" + + PROPERTY intprop 1 + + PROPERTY realprop 1.1 + + PROPERTY intrangeprop 25 + + PROPERTY realrangeprop 25.25 ; +- N2 ( I3 A ) ( PIN P2 ) + + FIXED + M2 ( 14000 341440 ) ( 9600 * ) ( * 282400 ) M1_M2 ( 2400 * ) + NEW M1 TAPERRULE RULE1 ( 2400 282400 ) ( 240 * ) + + SOURCE DIST + + PATTERN BALANCED + + WEIGHT 500 ; +- N3 ( I4 A ) ( PIN P3 ) + + COVER + M2 ( 14000 341440 ) ( 9600 * ) ( * 282400 ) M1_M2 ( 2400 * ) VIAGEN12_0 N + NEW M1 ( 2400 282400 ) ( 240 * ) + NEW M2 ( 400 400 ) M1_M2 N ( * * ) # case : pt via ( * * ) + NEW M2 ( 500 500 ) M1_M2 ( * * ) M1_M2 # case : pt via ( * * ) via + NEW M2 ( 600 600 10 ) M1_M2 S ( * * 30 ) ( * 800 ) # case : pt via ( * * ext ) + NEW M2 ( 700 700 ) M1_M2 ( * * ) ( * 800 ) # case : pt via ( * * ) pt + NEW M1 ( 0 0 ) M1_M2 FS M2_M3 + NEW M3 ( 0 0 ) M2_M3 W M1_M2 + NEW M1 ( 10 10 ) ( 20 10 ) MASK 1 ( 20 20 ) MASK 031 VIA1_2 + + SOURCE USER + + PATTERN TRUNK ; +- N4 ( I5 A ) ( PIN P4 ) + + SOURCE TEST + + ROUTED M2 STYLE 1 ( 0 0 ) ( 150 150 ) ( 300 0 ) ( 400 0 ) + + ROUTED M1 ( 150 150 ) MASK 3 ( 300 300 ) MASK 032 VIAGEN12 + + NOSHIELD M1 ( 150 150 30 ) ( 150 300 30 ) + + ROUTED M1 STYLE 0 ( 0 0 ) ( 150 150 ) + NEW M1 STYLE 1 ( 150 150 ) MASK 2 ( 300 0 ) ( 400 0 ) + + USE GROUND ; +- N5 ( I6 A ) ( PIN P5 ) + + ROUTED M2 STYLE 3 ( 0 1000 ) ( 150 1150 ) ( 300 1000 ) ( 400 1000 ) + + ROUTED M1 ( 0 1000 ) ( 150 1150 ) ( 300 1000 ) ( 400 1000 ) + + SOURCE TIMING ; +- N6 + + NONDEFAULTRULE RULE2 + + ROUTED M1 STYLE 4 ( 1000 0 ) ( 1100 100 ) + + ROUTED M1 STYLE 4 ( 1200 100 ) ( 1300 0 ) + + ROUTED M1 STYLE 4 ( 1000 -100 ) ( 1300 -100 ) ; +- SCAN ( scancell1 PA10 + SYNTHESIZED ) ( scancell2 PA2 + SYNTHESIZED ) + + SOURCE TEST ; +- MUSTJOIN_1 ( I7 A ) ; +- ARRAYNET[0][10] ; +- vectormodule[1]/vectornet[0] ; +- vectormodule[1]/scalarnet ; +END NETS + + +############################################################################### +# SCANCHAINS numScanChains ; +# [- chainName +# [+ COMMONSCANPINS [(IN pin)][(OUT pin)]] +# [+ START {fixedInComp | PIN} [outPin] ] +# {+ FLOATING {floatingComp [(IN pin)] [(OUT pin)]}...} +# [+ ORDERED +# {fixedComp [(IN pin)] [(OUT pin)] +# fixedComp [(IN pin)] [(OUT pin)]} +# [fixedComp [(IN pin)] [(OUT pin)]] ...}] +# [+ STOP {fixedOutComp | PIN} [inPin] ] +# ;] +# ... +# END SCANCHAINS +############################################################################### +SCANCHAINS 2 ; +- chain1 + + PARTITION clock1 MAXBITS 256 # DEF5.5 + + COMMONSCANPINS ( IN PA1 ) ( OUT PA2 ) + + START I1 B + + STOP I4 B + + ORDERED + scancell1 ( IN PA2 ) + scancell2 ( OUT PA10 ) + ( BITS 4 ) + + FLOATING + scancell3 ( IN PA2 ) + scancell4 ( OUT PA10 ) + ( BITS 4 ) ; +- chain2 + + PARTITION clock1 MAXBITS 256 # DEF5.5 + + COMMONSCANPINS ( IN PA1 ) ( OUT PA2 ) + + START PIN scanpin + + STOP PIN scanpin2 + + ORDERED + scancell5 ( IN PA2 ) + scancell6 ( OUT PA10 ) + ( BITS 4 ) + + FLOATING + scancell7 ( IN PA2 ) + scancell8 ( OUT PA10 ) + ( BITS 4 ) ; +- chain3 + + PARTITION clock1 MAXBITS 256 # DEF5.5 + + COMMONSCANPINS ( IN PA1 ) ( OUT PA2 ) + + START I5 B + + STOP I6 B + + ORDERED + scancell9 ( IN PA2 ) + scancell10 ( OUT PA10 ) + ( BITS 4 ) + + FLOATING + scancell11 ( IN PA2 ) + scancell12 ( OUT PA10 ) + ( BITS 4 ) ; +END SCANCHAINS + + +############################################################################### +# GROUPS numGroups ; +# [- groupName compNameRegExpr... +# [+ SOFT +# [MAXHALFPERIMETER value] +# [MAXX value][MAXY value]] +# [+ REGION {pt pt | regionName} ] +# [+ PROPERTY {propName propVal}...]...;]... +# END GROUPS +############################################################################### +GROUPS 3 ; +- group1 I3 I2 + + SOFT MAXHALFPERIMETER 4000 MAXX 100000 MAXY 100000 + + REGION region1 + + PROPERTY strprop "aString" + + PROPERTY intprop 1 + + PROPERTY realprop 1.1 + + PROPERTY intrangeprop 25 + + PROPERTY realrangeprop 25.25 ; +- group2 I4 + + SOFT MAXHALFPERIMETER 4000 + + REGION ( 0 0 ) ( 100 100 ) ; +- region2 I7 I8 + + REGION region2 ; +END GROUPS + + +############################################################################### +# SLOTS numSlots ; +# - { LAYER layerName +# RECT pt pt +# [RECT pt pt] ... ; +# } +# ... +# END SLOTS +############################################################################### +SLOTS 3 ; + - LAYER M1 + RECT ( 3 3 ) ( 6 8 ) ; + - LAYER M2 + RECT ( 3 3 ) ( 6 8 ) + POLYGON ( 0 0 ) ( 0 10 ) ( 10 10 ) ( 10 20 ) ( 20 20 ) ( 20 0 ) ; + - LAYER M3 + RECT ( 3 3 ) ( 6 8 ) ; +END SLOTS + + +############################################################################### +# FILLS numFills ; +# - { LAYER layerName +# RECT pt pt +# [RECT pt pt] ... ; +# } +# ... +# END FILLS +############################################################################### +FILLS 5 ; + - VIA myvia1 + MASK 2 + OPC + ( 5000 5000 ) + ( 800 800 ) ; + - LAYER M1 + MASK 2 + RECT ( 0 2 ) ( 1 10 ) ; + - LAYER M2 + OPC + RECT ( 0 2 ) ( 1 10 ) + POLYGON ( 0 0 ) ( 0 10 ) ( 10 10 ) ( 10 20 ) ( 20 20 ) ( 20 0 ) ; + - LAYER M3 + RECT ( 0 2 ) ( 1 10 ) ; + - VIA M1_M2 + MASK 202 + OPC ( 2400 0 ) ( 10 10 ) ; + - VIA VIAGEN12_0 + OPC ( 100 100 ) ( 200 100 ) ; +END FILLS + + +############################################################################### +# BEGINEXT "tag" +# extensionText +# ENDEXT +############################################################################### +BEGINEXT "tag" +- CREATOR "Cadence" ; +- OTTER furry + + PROPERTY arrg later + ; +- SEAL cousin to WALRUS ; +ENDEXT + +END DESIGN diff --git a/src/def/TEST/complete.5.8.def.au b/src/def/TEST/complete.5.8.def.au new file mode 100644 index 00000000..e620da31 --- /dev/null +++ b/src/def/TEST/complete.5.8.def.au @@ -0,0 +1,808 @@ +VERSION 5.8 ; +ALIAS alias1 aliasValue1 1 ; +ALIAS alias2 aliasValue2 0 ; +DIVIDERCHAR "/" ; +BUSBITCHARS "[]" ; +DESIGN design ; +TECHNOLOGY technology ; +UNITS DISTANCE MICRONS 1000 ; + +PROPERTYDEFINITIONS +DESIGN strprop STRING "aString" ; +DESIGN intprop INTEGER 1 ; +DESIGN realprop REAL 1.1 ; +DESIGN intrangeprop INTEGER RANGE 1 100 25 ; +DESIGN realrangeprop REAL RANGE 1.1 100.1 25.25 ; +REGION strprop STRING ; +REGION intprop INTEGER ; +REGION realprop REAL ; +REGION intrangeprop INTEGER RANGE 1 100 ; +REGION realrangeprop REAL RANGE 1.1 100.1 ; +GROUP strprop STRING ; +GROUP intprop INTEGER ; +GROUP realprop REAL ; +GROUP intrangeprop INTEGER RANGE 1 100 ; +GROUP realrangeprop REAL RANGE 1.1 100.1 ; +COMPONENT strprop STRING ; +COMPONENT intprop INTEGER ; +COMPONENT realprop REAL ; +COMPONENT intrangeprop INTEGER RANGE 1 100 ; +COMPONENT realrangeprop REAL RANGE 1.1 100.1 ; +NET strprop STRING ; +NET intprop INTEGER ; +NET realprop REAL ; +NET intrangeprop INTEGER RANGE 1 100 ; +NET realrangeprop REAL RANGE 1.1 100.1 ; +SPECIALNET strprop STRING ; +SPECIALNET intprop INTEGER ; +SPECIALNET realprop REAL ; +SPECIALNET intrangeprop INTEGER RANGE 1 100 ; +SPECIALNET realrangeprop REAL RANGE 1.1 100.1 ; +Parsed 50 number of lines!! +ROW strprop STRING ; +ROW intprop INTEGER ; +ROW realprop REAL ; +ROW intrangeprop INTEGER RANGE 1 100 ; +ROW realrangeprop REAL RANGE 1.1 100.1 ; +COMPONENTPIN strprop STRING ; +COMPONENTPIN intprop INTEGER ; +COMPONENTPIN realprop REAL ; +COMPONENTPIN intrangeprop INTEGER RANGE 1 100 ; +COMPONENTPIN realrangeprop REAL RANGE 1.1 100.1 ; +NONDEFAULTRULE strprop STRING ; +NONDEFAULTRULE intprop INTEGER ; +NONDEFAULTRULE realprop REAL ; +NONDEFAULTRULE intrangeprop INTEGER RANGE 1 100 ; +NONDEFAULTRULE realrangeprop REAL RANGE 1.1 100.1 ; +END PROPERTYDEFINITIONS + +DIEAREA -190000 -120000 -190000 350000 ; +DIEAREA -190000 -120000 -190000 350000 190000 350000 190000 190000 190360 190000 190360 -120000 ; +ROW ROW_1 CORE 1000 1000 N DO 100 BY 1 STEP 700 0 ; + + PROPERTY strprop aString STRING + PROPERTY intprop 1 INTEGER + PROPERTY realprop 1.1 REAL + PROPERTY intrangeprop 25 INTEGER + PROPERTY realrangeprop 25.25 REAL ; +ROW ROW_2 CORE 1000 2000 S DO 100 BY 1 STEP 700 0 ; +ROW ROW_3 CORE 1000 3000 E DO 100 BY 1 STEP 8400 0 ; +ROW ROW_4 CORE 1000 4000 W DO 100 BY 1 STEP 8400 0 ; +ROW ROW_5 CORE 1000 5000 FN DO 100 BY 1 STEP 700 0 ; +ROW ROW_6 CORE 1000 6000 FS DO 100 BY 1 STEP 700 0 ; +ROW ROW_7 CORE 1000 7000 FE DO 100 BY 1 STEP 8400 0 ; +ROW ROW_8 CORE 1000 8000 FW DO 100 BY 1 STEP 8400 0 ; +ROW ROW_VERT_1 CORE -10000 -10000 N DO 1 BY 10 STEP 0 8400 ; +ROW ROW_VERT_2 CORE -9000 -10000 S DO 1 BY 10 STEP 0 8400 ; +ROW ROW_VERT_3 CORE -8000 -10000 E DO 1 BY 10 STEP 0 700 ; +Parsed 100 number of lines!! +ROW ROW_VERT_4 CORE -7000 -10000 W DO 1 BY 10 STEP 0 700 ; +ROW ROW_VERT_5 CORE -6000 -10000 FN DO 1 BY 10 STEP 0 8400 ; +ROW ROW_VERT_6 CORE -5000 -10000 FS DO 1 BY 10 STEP 0 8400 ; +ROW ROW_VERT_7 CORE -4000 -10000 FE DO 1 BY 10 STEP 0 700 ; +ROW ROW_VERT_8 CORE -3000 -10000 FW DO 1 BY 1 STEP 0 700 ; +ROW ROW_array0 ARRAYSITE 10000 10000 N DO 100 BY 1 STEP 16000 0 ; +ROW ROW_array1 ARRAYSITE 10000 17000 W DO 100 BY 1 STEP 16000 0 ; +ROW ROW_array2 ARRAYSITE 10000 17000 S DO 100 BY 1 STEP 16000 0 ; +ROW ROW_array3 ARRAYSITE 10000 17000 E DO 100 BY 1 STEP 16000 0 ; +ROW ROW_array4 ARRAYSITE 10000 17000 FN DO 100 BY 1 STEP 16000 0 ; +ROW ROW_array5 ARRAYSITE 10000 17000 FE DO 100 BY 1 STEP 16000 0 ; +ROW ROW_array6 ARRAYSITE 10000 17000 FS DO 100 BY 1 STEP 16000 0 ; +ROW ROW_array7 ARRAYSITE 10000 17000 FW DO 100 BY 1 STEP 16000 0 ; +TRACKS Y 52 DO 857 STEP 104 MASK 1 LAYER ; +TRACKS Y 52 DO 857 STEP 104 MASK 1 SAMEMASK LAYER M1 M2 ; +TRACKS X 52 DO 1720 STEP 104 MASK 2 LAYER M2 ; +TRACKS X 52 DO 1720 STEP 104 LAYER ; +GCELLGRID X 0 DO 100 STEP 600 ; +GCELLGRID Y 10 DO 120 STEP 400 ; + +VIAS 6 ; +Parsed 150 number of lines!! +- VIAGEN12_0 + RECT METAL1 -4400 -3800 4400 3800 ++ RECT M2 + MASK 3 -4500 -3800 4500 3800 ++ RECT V1 + MASK 2 -3600 -3800 -2000 -2200 ++ RECT V1 + MASK 1 -3600 2200 -2000 3800 ++ RECT V1 + MASK 2 2000 -3800 3600 -2200 ++ RECT V1 + MASK 3 2000 2200 3600 3800 + ; +- VIAGEN12_2 + RECT METAL1 -2500 -1500 2500 1500 ++ RECT M2 -2500 -1500 2500 1500 ++ RECT V1 -2360 -960 -760 640 ++ RECT V1 -1320 -960 280 640 ++ RECT V1 760 -960 2360 640 + ; +- VIAGEN12_3 + RECT METAL1 -1600 -1600 1600 1600 ++ RECT M2 -1600 -1600 1600 1600 ++ RECT V1 -800 -800 800 800 + ; +- VIAGEN12_4 ; ++ VIARULE 'VIAGEN12' + + CUTSIZE 1600 1600 + + LAYERS M1 V1 M2 + + CUTSPACING 5600 6100 + + ENCLOSURE 100 100 150 150 + + ROWCOL 5 14 + + ORIGIN 10 -10 + + OFFSET 0 0 20 -20 + + PATTERN '2_FFE0_3_FFFF' +- M2_M1rct_0 + RECT V1 -25 -65 25 65 ++ RECT M1 -35 -95 35 95 ++ RECT M2 -65 -65 65 65 + ; +- VIAGEN12_1 + RECT M2 -2500 -1500 2500 1500 ++ RECT V1 -2400 -960 -700 640 + + + POLYGON METAL1 + MASK 2 -2500 -1500 -2500 2500 1500 2500 1500 1500 2500 1500 2500 -1500 ; +END VIAS +- CUSTOMVIA + + POLYGON METAL1 + MASK 3 -2500 -1500 -2500 2500 1500 2500 1500 1500 2500 1500 2500 -1500 ; +END VIAS +- TURNM1_1 + RECT METAL1 -100 -60 100 60 + ; +END VIAS +- TURNM2_1 + RECT M2 -100 -60 100 60 + ; +END VIAS +Parsed 200 number of lines!! +- TURNM3_1 + RECT M3 -100 -60 100 60 + ; +END VIAS +- myvia1 + RECT METAL1 + MASK 2 0 0 40000 40000 ++ RECT V1 + MASK 3 0 0 40000 40000 ++ RECT M2 0 0 40000 40000 + ; +END VIAS + +STYLES 10 ; +- STYLE 0 30 10 10 30 -10 30 -30 10 -30 -10 -10 -30 10 -30 30 -10 ; +- STYLE 1 25 25 -25 25 -25 -25 25 -25 ; +- STYLE 2 50 50 -50 50 -50 -50 50 -50 ; +- STYLE 3 50 21 21 50 -21 50 -50 21 -50 -21 -21 -50 21 -50 50 -21 ; +- STYLE 4 -30 -20 10 -60 50 -20 50 40 0 40 -30 10 ; +- STYLE 5 0 2000 0 -2000 0 2000 0 -2000 ; +- STYLE 6 -2000 2000 2000 -2000 2000 -2000 ; +- STYLE 7 0 0 0 1000 1000 0 ; +- STYLE 8 -7500 -3110 -3110 -7500 3110 -7500 7500 -3110 7500 7500 -7500 7500 ; +- STYLE 9 0 -10610 7500 -3110 7500 3110 3110 7500 -3110 7500 -10610 0 ; +END STYLES + +NONDEFAULTRULES 1 ; +Parsed 250 number of lines!! +- DEFAULT + + LAYER METAL1 WIDTH 10 DIAGWIDTH 8 SPACING 2 WIREEXT 1 + + LAYER M2 WIDTH 10 SPACING 2 + + LAYER M3 WIDTH 11 SPACING 3 + + VIA M1_M2 + + VIA M2_M3 + + VIARULE VIAGEN12 + + MINCUTS V1 2 + + PROPERTY strprop aString STRING + + PROPERTY intprop 1 INTEGER + + PROPERTY realprop 1.1 REAL + + PROPERTY intrangeprop 25 INTEGER + + PROPERTY realrangeprop 25.25 REAL +END NONDEFAULTRULES +- RULE2 + + HARDSPACING + + LAYER METAL1 WIDTH 10 DIAGWIDTH 8 SPACING 2 WIREEXT 1 + + LAYER M2 WIDTH 10 SPACING 2 + + LAYER M3 WIDTH 11 SPACING 3 + + VIA M1_M2 + + VIA M2_M3 + + VIARULE VIAGEN12 + + MINCUTS V1 2 + + PROPERTY strprop aString STRING + + PROPERTY intprop 1 INTEGER + + PROPERTY realprop 1.1 REAL + + PROPERTY intrangeprop 25 INTEGER + + PROPERTY realrangeprop 25.25 REAL +END NONDEFAULTRULES + +REGIONS 2 ; +- region1 -500 -500 300 100 +500 500 1000 1000 ++ TYPE FENCE ++ PROPERTY strprop aString STRING + PROPERTY intprop 1 INTEGER + PROPERTY realprop 1.1 REAL + PROPERTY intrangeprop 25 INTEGER + PROPERTY realrangeprop 25.25 REAL ; +- region2 4000 0 5000 1000 ++ TYPE GUIDE +; +END REGIONS +Parsed 300 number of lines!! + +COMPONENTMASKSHIFT M3 M2 V1 M1 ; + +COMPONENTS 13 ; +- I1 B + PLACED 100 100 N + SOURCE NETLIST + GENERATE generator + WEIGHT 100 + EEQMASTER A + REGION region1 + MASKSHIFT 1102 ++ HALO SOFT 5 6 7 8 ++ ROUTEHALO 100 METAL1 M3 ++ PROPERTY strprop aString STRING + PROPERTY intprop 1 INTEGER + PROPERTY realprop 1.1 REAL + PROPERTY intrangeprop 25 INTEGER + PROPERTY realrangeprop 25.25 REAL ; +- I2 A + PLACED 200 200 S + SOURCE DIST + ROUTEHALO 100 M2 M3 +; +- I3 A + PLACED 300 300 E + SOURCE USER ; +- I4 A + PLACED 400 400 W + SOURCE TIMING ; +- I5 A + PLACED 500 500 FN ; +Parsed 350 number of lines!! +- I6 A + PLACED 600 600 FS ; +- I7 A + PLACED 700 700 FE ; +- I8 A + PLACED 800 800 FW ; +- I9 A + FIXED 900 900 N ; +- I10 A + COVER 1000 1000 N ; +- I11 A + UNPLACED ; +- I12[0] A ; +- I12[1] A ; +END COMPONENTS +- I13[0][10] A ; +END COMPONENTS +- I14\[1\] A ; +END COMPONENTS +- vectormodule[1]/scalarname A ; +END COMPONENTS +- vectormodule[1]/vectorname[1] A ; +END COMPONENTS +- scancell1 CHK3A ; +END COMPONENTS +- scancell2 CHK3A ; +END COMPONENTS +- scancell3 CHK3A ; +END COMPONENTS +- scancell4 CHK3A ; +END COMPONENTS +- scancell5 CHK3A ; +END COMPONENTS +- scancell6 CHK3A ; +END COMPONENTS +- scancell7 CHK3A ; +END COMPONENTS +- scancell8 CHK3A ; +END COMPONENTS +- scancell9 CHK3A ; +END COMPONENTS +- scancell10 CHK3A ; +END COMPONENTS +- scancell11 CHK3A ; +END COMPONENTS +- scancell12 CHK3A ; +END COMPONENTS +- nobrackets A ; +END COMPONENTS +- somethingwith[1] A ; +END COMPONENTS +- more[]brackets A ; +END COMPONENTS +- more[1]brackets A ; +END COMPONENTS +- more\[1\]brackets A ; +END COMPONENTS +- more[1][2] A ; +END COMPONENTS +- more\[1\]\[2\] A ; +END COMPONENTS +- more\[2\] A ; +END COMPONENTS +- foo\[1\]\[2\]/haha\[3\]\[4\] A ; +END COMPONENTS +- foo[2][3]/haha[4][5] A ; +END COMPONENTS +- foo\[3\]\[4\]/haha[5][6] A ; +END COMPONENTS +- foo[4][5]/haha\[6\]\[7\] A ; +END COMPONENTS +- foo[5][6]bar/haha\[7\]\[8\] A ; +END COMPONENTS +- foo[6][7]bar/haha[8][9] A ; +END COMPONENTS +Parsed 400 number of lines!! + +PINS 11 ; +Parsed 450 number of lines!! +- P0 + NET N0 + DIRECTION INPUT + USE SIGNAL + NETEXPR "power1 VDD" + SUPPLYSENSITIVITY P1 + GROUNDSENSITIVITY P2 + + PORT + + LAYER M2 MASK 2 0 0 30 135 + + VIA VIAGEN12_0 ( 0 100 ) + + FIXED ( 45 -2160 ) N + + PORT + + LAYER M1 0 0 30 135 + + VIA M1_M2 MASK 023 ( 100 0 ) + + COVER ( 0 -1000 ) N + + PORT + + LAYER M3 0 0 30 135 + + PLACED ( 1000 -1000 ) N + SPECIAL ANTENNAPINPARTIALMETALAREA 5 LAYER METAL1 +ANTENNAPINPARTIALMETALAREA 5 LAYER M2 +ANTENNAPINPARTIALMETALSIDEAREA 10 LAYER METAL1 +ANTENNAPINPARTIALMETALSIDEAREA 10 LAYER M2 +ANTENNAPINDIFFAREA 20 LAYER M1 +ANTENNAPINDIFFAREA 20 LAYER M2 +ANTENNAPINPARTIALCUTAREA 35 LAYER V1 +ANTENNAPINPARTIALCUTAREA 35 LAYER V2 +ANTENNAMODEL OXIDE1 +ANTENNAPINGATEAREA 15 LAYER M1 +ANTENNAPINGATEAREA 15 LAYER M2 +ANTENNAPINMAXAREACAR 25 LAYER M1 +ANTENNAPINMAXSIDEAREACAR 30 LAYER M1 +ANTENNAPINMAXCUTCAR 40 LAYER M1 +ANTENNAMODEL OXIDE2 +ANTENNAPINGATEAREA 115 LAYER M1 +ANTENNAPINGATEAREA 115 LAYER M2 +ANTENNAPINMAXAREACAR 125 LAYER M1 +ANTENNAPINMAXSIDEAREACAR 130 LAYER M1 +ANTENNAPINMAXCUTCAR 140 LAYER M1 +ANTENNAMODEL OXIDE3 +ANTENNAPINGATEAREA 115 LAYER M1 +ANTENNAPINGATEAREA 115 LAYER M2 +ANTENNAPINMAXAREACAR 125 LAYER M1 +ANTENNAPINMAXSIDEAREACAR 130 LAYER M1 +ANTENNAPINMAXCUTCAR 140 LAYER M1 +ANTENNAMODEL OXIDE4 +ANTENNAPINGATEAREA 115 LAYER M1 +ANTENNAPINGATEAREA 115 LAYER M2 +ANTENNAPINMAXAREACAR 125 LAYER M1 +ANTENNAPINMAXSIDEAREACAR 130 LAYER M1 +ANTENNAPINMAXCUTCAR 140 LAYER M1 +; +- P1 + NET N1 + DIRECTION OUTPUT + USE POWER + NETEXPR "power1 VDD[1]" + + POLYGON M2 MASK 3 0 0 0 100 50 100 50 50 100 50 100 0 + PLACED ( 45 -2160 ) N ANTENNAPINPARTIALMETALAREA 5 +ANTENNAPINPARTIALMETALSIDEAREA 10 +ANTENNAPINDIFFAREA 20 +ANTENNAPINPARTIALCUTAREA 35 +ANTENNAMODEL OXIDE1 +ANTENNAPINGATEAREA 15 +; +- P2 + NET N2 + DIRECTION INOUT + USE GROUND + + LAYER M2 MASK 2 0 0 30 135 + COVER ( 45 -2160 ) N ; +- P2.extra1 + NET N2 + DIRECTION INOUT + USE GROUND + + LAYER METAL1 0 0 10 10 + COVER ( 0 0 ) N ; +- P3 + NET N3 + DIRECTION FEEDTHRU + USE CLOCK ; +- P4 + NET N4 + USE SIGNAL ; +- P5 + NET N5 + USE ANALOG ; +- P6 + NET N6 + USE SCAN ; +Parsed 500 number of lines!! +- P7 + NET N7 + USE RESET ; +- ARRAYPIN[0][10] + NET ARRAYNET[0][10] + + LAYER M2 0 0 30 135 ; +- ARRAYPIN.extra2[0][10] + NET ARRAYNET[0][10] + + LAYER M2 0 0 10 10 ; +END PINS +- scanpin + NET SCAN + USE SCAN ; +END PINS +- scanpin2 + NET SCAN + USE SCAN ; +END PINS +- INBUS[1] + NET INBUS<1> + + LAYER METAL1 0 0 10 10 ; +END PINS +- OUTBUS<1> + NET OUTBUS<1> ; +END PINS +- INBUS.extra1[1] + NET INBUS<1> + + LAYER M1 10 10 100 100 ; +END PINS +- vectorpin[0] + NET vectormodule[1]/vectornet[0] ; +END PINS +- scalarpin + NET vectormodule[1]/scalarnet ; +END PINS +- RE_RDY_2 + NET RE_RDY_2 + DIRECTION OUTPUT + USE SIGNAL + + PORT + + VIA myvia1 MASK 123 ( 500 500 ) + + FIXED ( -390000 0 ) N + + PORT + + POLYGON METAL1 MASK 22 ( 40000 40000 ) ( 80000 40000 ) ( 80000 -40000 ) ( 40000 -40000 ) ( 40000 -80000 ) ( -40000 -80000 ) ( -40000 -40000 ) ( -80000 -40000 ) ( -80000 40000 ) ( -40000 40000 ) ( -40000 80000 ) ( 40000 80000 ) + + FIXED ( -190000 0 ) N + + PORT + + VIA myvia1 ( 100 100 ) + + FIXED ( 290000 0 ) N ; +END PINS + +PINPROPERTIES 2 ; +- PIN P0 ; + + PROPERTY strprop aString STRING + PROPERTY intprop 1 INTEGER + PROPERTY realprop 1.1 REAL + PROPERTY intrangeprop 25 INTEGER + PROPERTY realrangeprop 25.25 REAL ; +Parsed 550 number of lines!! +- I1 A ; + + PROPERTY strprop aString STRING + PROPERTY intprop 1 INTEGER + PROPERTY realprop 1.1 REAL + PROPERTY intrangeprop 25 INTEGER + PROPERTY realrangeprop 25.25 REAL ; +END PINPROPERTIES + +BLOCKAGES 8 ; +- LAYER METAL1 + + MASK 1 + RECT 60 70 80 90 +; +- LAYER M2 + + COMPONENT I1 + + SLOTS + + PUSHDOWN + + EXCEPTPGNET + + MASK 3 + POLYGON 100 100 100 200 150 200 150 150 200 150 200 100 +; +- LAYER M2 + + SLOTS + + MASK 2 + RECT 10 20 40 50 +; +- LAYER METAL1 + + FILLS + + MASK 1 + RECT -10 20 30 40 +; +- LAYER M1 + + PUSHDOWN + + MASK 1 + + SPACING 3 + RECT 50 30 55 40 +; +- LAYER M1 + + EXCEPTPGNET + + MASK 1 + + DESIGNRULEWIDTH 45 + RECT 50 30 55 40 +; +- PLACEMENT + RECT -15 0 0 20 + RECT -15 20 30 40 + RECT 30 5 50 40 + RECT -10 -15 50 0 +; +- PLACEMENT + + PARTIAL 0.4 + + COMPONENT I1 + + PUSHDOWN + RECT -10 0 0 20 + RECT -10 20 30 40 + RECT 30 0 50 40 + RECT -10 -5 50 0 +; +END BLOCKAGES +- PLACEMENT + + PUSHDOWN + RECT -5 0 0 20 + RECT -5 20 30 40 + RECT 30 0 25 40 + RECT -5 0 50 10 +; +END BLOCKAGES +Parsed 600 number of lines!! +- PLACEMENT + + SOFT + RECT 50 30 55 40 +; +END BLOCKAGES +- PLACEMENT + + PARTIAL 0.4 + RECT 50 30 55 40 +; +END BLOCKAGES + +SPECIALNETS 5 ; +- SN1 Parsed 650 number of lines!! +( I1 Z.extra1 ) ( I2 Z ) ( I3 Z ) ( * Z ) + + ROUTED +M1 120 + SHAPE RING ( 14000 341440 ) ( 9600 341440 ) +( 9600 282400 ) M1_M2 DO 2 BY 2 STEP 200 200 ( 2400 282400 ) NEW METAL1 +120 + SHAPE STRIPE ( 2400 282400 ) ( 240 282400 ) M1_M2 +NEW M1 120 + SHAPE FOLLOWPIN ( 2500 282400 ) ( 250 282400 ) +VIAGEN12_0 N NEW M1 120 + SHAPE IOWIRE +( 2600 282400 ) ( 260 282400 ) VIAGEN12_2 NEW METAL1 120 ++ SHAPE COREWIRE ( 2700 282400 ) ( 270 282400 ) VIAGEN12_3 NEW M1 +120 + SHAPE BLOCKWIRE ( 2800 282400 ) ( 280 282400 ) CUSTOMVIA +VIAGEN12_1 NEW M1 120 + SHAPE FILLWIRE ( 2900 282400 ) +( 290 282400 ) VIAGEN12_4 NEW M1 120 + SHAPE FILLWIREOPC +( 2900 282400 ) VIAGEN12_4 NEW M1 120 + SHAPE BLOCKAGEWIRE +( 2000 282400 ) ( 200 282400 ) VIAGEN12 NEW M1 120 ++ SHAPE BLOCKRING ( 2100 282400 ) ( 210 282400 ) NEW M1 120 ++ SHAPE PADRING ( 2200 282400 ) ( 220 282400 ) NEW M1 200 +( 3000 3000 ) TURNM1_1 NEW M2 200 ( 3100 3100 ) +( 3200 3100 ) TURNM2_1 NEW M2 200 ( 3300 3300 ) +( 3400 3300 ) TURNM2_1 ( 3400 3600 ) NEW M2 200 +( 400 400 ) M1_M2 ( 400 400 ) NEW M2 200 +( 500 500 ) M1_M2 ( 500 500 ) M1_M2 NEW M2 +200 ( 700 700 ) M1_M2 ( 700 700 ) ( 700 800 ) +NEW M2 15000 + STYLE 9 ( 105000 105000 ) ( 50000 50000 ) +NEW M2 15000 + STYLE 8 ( 105000 155000 ) ( 105000 105000 ) + + + COVER METAL1 100 ( 100 100 ) ( 100 200 ) + + + FIXED M1 100 ( 200 200 ) ( 300 200 ) + + + ROUTED M1 120 + SHAPE DRCFILL ( 8000 8000 ) +( 8000 8200 ) ( 8400 8200 ) + + + SHIELD N1 M2 90 ( 14100 340440 ) ( 8160 340440 ) +M1_M2 ( 8160 301600 ) M1_M2 FN DO 2 BY 2 STEP 200 200 +( 2400 301600 ) + + PROPERTY strprop aString STRING + + PROPERTY intprop 1 INTEGER + + PROPERTY realprop 1.1 REAL + + PROPERTY intrangeprop 25 INTEGER + + PROPERTY realrangeprop 25.25 REAL + + + FIXEDBUMP + + VOLTAGE 3200 + + WEIGHT 30 + + SOURCE NETLIST + + PATTERN STEINER + + ORIGINAL VDD + + USE SIGNAL ; +- VDD Parsed 700 number of lines!! + + + ROUTED M1 20 ( 10 0 ) MASK 3 +( 10 20 ) VIAGEN12_4 NEW M2 100 ( 10 10 ) +( 20 10 ) MASK 1 ( 20 20 ) MASK 031 VIAGEN12_3 + + + ROUTED M1 100 ( 0 0 100 ) ( 0 0 50 ) +( 100 0 50 ) M1_M2 ( 100 100 50 ) + + + ROUTED M1 50 + STYLE 0 ( 0 0 ) +( 150 150 ) + + + ROUTED M1 50 + STYLE 0 ( 150 150 ) +( 0 0 ) + + + ROUTED M1 50 + STYLE 0 ( 150 0 ) +( 0 150 ) + + + ROUTED M1 50 + STYLE 0 ( 0 150 ) +( 150 0 ) + + + ROUTED M1 50 + STYLE 1 ( 150 150 ) +( 300 0 ) ( 400 0 ) + + + ROUTED M2 100 + SHAPE RING + STYLE 0 +( 0 0 ) ( 100 100 ) ( 200 100 ) + + + ROUTED M1 100 + STYLE 2 ( 0 0 ) +M1_M2 ( 600 0 ) M1_M2 + + + ROUTED M1 50 ( 150 150 ) ( 300 300 ) + + + FIXED + + SHAPE RING + + MASK 2 + POLYGON METAL1 0 0 0 100 100 100 200 200 200 0 + + COVER + + SHAPE RING + + MASK 3 + POLYGON M2 100 100 100 200 200 200 300 300 300 100 + + FIXED + + SHAPE RING + + RECT M3 0 0 10 10 + + SHIELD + + N1 + + SHAPE BLOCKRING + + RECT M3 0 0 10 10 + + ROUTED + + VIA M1_M2 N 2400 0 10 10; + + + ROUTED + + SHAPE STRIPE + + VIA VIA12_2 N 30 30 40 40; + + + VOLTAGE 5000 ; +- SN2 + + ROUTED M2 100 + STYLE 3 ( 0 0 ) +( 150 150 ) ( 300 0 ) NEW M2 100 ( 300 0 ) +( 400 0 ) + + + ROUTED M1 100 ( 0 0 ) ( 150 150 ) +( 300 0 ) ( 400 0 ) + + + ROUTED M1 4000 + STYLE 5 ( 0 0 ) +( 1000 0 ) + + + ROUTED M1 4000 + STYLE 6 ( 0 0 ) +( 1000 1000 ) + + + ROUTED M1 1000 + STYLE 7 ( 0 0 ) +( 0 0 ) +; +- SN3 + + ROUTED M2 100 ( 100 0 ) ( 100 3000 ) +NEW M3 100 ( 0 1000 ) ( 3000 1000 ) + + + SHIELD N1 M2 40 + SHAPE FILLWIRE ( 300 80 ) +( 300 1920 ) NEW M2 40 + SHAPE FILLWIRE ( 500 80 ) +( 500 1920 ) + + + USE GROUND ; +- DUMMY + + ROUTED M1 100 + SHAPE FILLWIRE ( 0 0 ) +( 100 0 ) +; +END SPECIALNETS +- DUMMY2 + + ROUTED M2 100 + SHAPE FILLWIREOPC ( 0 0 ) +( 100 0 ) +; +END SPECIALNETS +Parsed 750 number of lines!! + +NETS 6 ; +- SCAN ( scancell1 PA10 ) + SYNTHESIZED ( scancell2 PA2 ) + SYNTHESIZED + SOURCE TEST ; +- N1 + SUBNET CBK N1_SUB0 Parsed 800 number of lines!! + + NONDEFAULTRULE CBK RULE1 ( I1 A ) ( PIN P0 ) + NONDEFAULTRULE RULE1 + + N1_VP0 M3 -333 -333 333 333 P 189560 27300 N + + N1_VP1 M3 -333 -333 333 333 P 189560 27300 S + + N1_VP2 M3 -333 -333 333 333 P 189560 27300 E + + N1_VP3 M3 -333 -333 333 333 P 189560 27300 W + + N1_VP4 M3 -333 -333 333 333 P 189560 27300 FN + + N1_VP5 M3 -333 -333 333 333 P 189560 27300 FS + + N1_VP6 M3 -333 -333 333 333 P 189560 27300 FE + + N1_VP7 M3 -333 -333 333 333 P 189560 27300 FW + + N1_VP8 -333 -333 333 333 + + + FIXED M3 ( 10 0 ) MASK 3 ( 10 20 ) +MASK 031 M1_M2 + + + ROUTED M1 ( 0 0 ) ( 5 0 ) VIRTUAL ( 2 3 ) +MASK 1 ( 7 7 ) + + + ROUTED M1 ( 0 0 ) ( 5 0 ) VIRTUAL ( 2 3 ) +RECT ( 1 2 3 4 ) ( 7 7 ) + + + FIXED M1 ( 0 0 ) ( 5 0 ) ( 7 7 ) + + + FIXED M1 ( 0 0 ) ( 5 0 ) MASK 3 +RECT ( 1 2 3 4 ) ( 7 7 ) + + + NOSHIELD M2 ( 14100 341440 ) ( 14000 341440 ) M1_M2 + + + ROUTED M2 ( 14000 341440 ) ( 9600 341440 ) ( 9600 282400 ) +nd1VIA12 ( 2400 282400 ) TURNM1_1 NEW M1 TAPER +( 2400 282400 ) ( 240 282400 ) + + + SHIELDNET SN1 + + SHIELDNET VDD + + SUBNET N1_SUB0 ( I2 A ) + ( PIN P1 ) + ( VPIN N1_VP9 ) + ROUTED M1 ( 168280 63300 700 ) ( 168280 64500 ) M1_M2 +( 169400 64500 800 ) M2_M3 + PROPERTY strprop aString STRING + + PROPERTY intprop 1 INTEGER + + PROPERTY realprop 1.1 REAL + + PROPERTY intrangeprop 25 INTEGER + + PROPERTY realrangeprop 25.25 REAL ++ WEIGHT 100 + ESTCAP 1.5e+06 + SOURCE NETLIST + FIXEDBUMP + FREQUENCY 100 + PATTERN STEINER + ORIGINAL N2 + USE SIGNAL ; +- N2 ( I3 A ) ( PIN P2 ) + + FIXED M2 ( 14000 341440 ) ( 9600 341440 ) ( 9600 282400 ) +M1_M2 ( 2400 282400 ) NEW M1 TAPERRULE RULE1 ( 2400 282400 ) +( 240 282400 ) ++ WEIGHT 500 + SOURCE DIST + PATTERN BALANCED ; +- N3 ( I4 A ) ( PIN P3 ) + + COVER M2 ( 14000 341440 ) ( 9600 341440 ) ( 9600 282400 ) +M1_M2 ( 2400 282400 ) VIAGEN12_0 N NEW M1 +( 2400 282400 ) ( 240 282400 ) NEW M2 ( 400 400 ) M1_M2 +N ( 400 400 ) NEW M2 ( 500 500 ) M1_M2 +( 500 500 ) M1_M2 NEW M2 ( 600 600 10 ) M1_M2 +S ( 600 600 30 ) ( 600 800 ) NEW M2 ( 700 700 ) +M1_M2 ( 700 700 ) ( 700 800 ) NEW M1 ( 0 0 ) +M1_M2 FS M2_M3 NEW M3 ( 0 0 ) +M2_M3 W M1_M2 NEW M1 ( 10 10 ) +( 20 10 ) MASK 1 ( 20 20 ) MASK 031 VIA1_2 ++ SOURCE USER + PATTERN TRUNK ; +- N4 ( I5 A ) ( PIN P4 ) + + ROUTED M2 STYLE 1 ( 0 0 ) ( 150 150 ) +( 300 0 ) ( 400 0 ) + + + ROUTED M1 ( 150 150 ) MASK 3 ( 300 300 ) +MASK 032 VIAGEN12 + + + NOSHIELD M1 ( 150 150 30 ) ( 150 300 30 ) + + + ROUTED M1 STYLE 0 ( 0 0 ) ( 150 150 ) +NEW M1 STYLE 1 ( 150 150 ) MASK 2 ( 300 0 ) +( 400 0 ) ++ SOURCE TEST + USE GROUND ; +- N5 ( I6 A ) ( PIN P5 ) + + ROUTED M2 STYLE 3 ( 0 1000 ) ( 150 1150 ) +( 300 1000 ) ( 400 1000 ) + + + ROUTED M1 ( 0 1000 ) ( 150 1150 ) ( 300 1000 ) +( 400 1000 ) ++ SOURCE TIMING ; +END NETS +Parsed 850 number of lines!! +- N6 + NONDEFAULTRULE CBK RULE2 + NONDEFAULTRULE RULE2 + + + ROUTED M1 STYLE 4 ( 1000 0 ) ( 1100 100 ) + + + ROUTED M1 STYLE 4 ( 1200 100 ) ( 1300 0 ) + + + ROUTED M1 STYLE 4 ( 1000 -100 ) ( 1300 -100 ) +; +END NETS +- SCAN ( scancell1 PA10 ) + SYNTHESIZED ( scancell2 PA2 ) + SYNTHESIZED + SOURCE TEST ; +END NETS +- MUSTJOIN_1 ( I7 A ) ; +END NETS +- ARRAYNET[0][10] ; +END NETS +- vectormodule[1]/vectornet[0] ; +END NETS +- vectormodule[1]/scalarnet ; +END NETS + +SCANCHAINS 2 ; +- chain1 + + START I1 B + + STOP I4 B + + COMMONSCANPINS ( IN PA1 ) ( OUT PA2 ) + + FLOATING + scancell3 ( IN PA2 ) + scancell4 ( OUT PA10 ) ( BITS 4 ) + + ORDERED + scancell1 ( IN PA2 ) + scancell2 ( OUT PA10 ) ( BITS 4 ) + + PARTITION clock1 MAXBITS 256 ; +Parsed 900 number of lines!! +- chain2 + + START PIN scanpin + + STOP PIN scanpin2 + + COMMONSCANPINS ( IN PA1 ) ( OUT PA2 ) + + FLOATING + scancell7 ( IN PA2 ) + scancell8 ( OUT PA10 ) ( BITS 4 ) + + ORDERED + scancell5 ( IN PA2 ) + scancell6 ( OUT PA10 ) ( BITS 4 ) + + PARTITION clock1 MAXBITS 256 ; +END SCANCHAINS +- chain3 + + START I5 B + + STOP I6 B + + COMMONSCANPINS ( IN PA1 ) ( OUT PA2 ) + + FLOATING + scancell11 ( IN PA2 ) + scancell12 ( OUT PA10 ) ( BITS 4 ) + + ORDERED + scancell9 ( IN PA2 ) + scancell10 ( OUT PA10 ) ( BITS 4 ) + + PARTITION clock1 MAXBITS 256 ; +END SCANCHAINS + +GROUPS 3 ; +- group1 I3 I2 + + REGION region1 + + PROPERTY strprop aString STRING + + PROPERTY intprop 1 INTEGER + + PROPERTY realprop 1.1 REAL + + PROPERTY intrangeprop 25 INTEGER + + PROPERTY realrangeprop 25.25 REAL ; +- group2 I4 ; +- region2 I7 I8 + + REGION region2 ; +END GROUPS +Parsed 950 number of lines!! + +SLOTS 3 ; +- LAYER M1 + RECT 3 3 6 8 +; +- LAYER M2 + RECT 3 3 6 8 + POLYGON 0 0 0 10 10 10 10 20 20 20 20 0 ; +; +- LAYER M3 + RECT 3 3 6 8 +; +END SLOTS + +FILLS 5 ; +- VIA myvia1 + MASK 002 + OPC + 5000 5000 800 800; +; +- LAYER M1 + MASK 2 + RECT 0 2 1 10 +; +- LAYER M2 + OPC + RECT 0 2 1 10 + POLYGON 0 0 0 10 10 10 10 20 20 20 20 0 ; +; +- LAYER M3 + RECT 0 2 1 10 +; +- VIA M1_M2 + MASK 202 + OPC + 2400 0 10 10; +; +END FILLS +- VIA VIAGEN12_0 + OPC + 100 100 200 100; +; +END FILLS +Parsed 1000 number of lines!! +BEGINEXT "tag" +- CREATOR "Cadence" ; +- OTTER furry + + PROPERTY arrg later + ; +- SEAL cousin to WALRUS ; +ENDEXT +END DESIGN diff --git a/src/def/cdef/defMsgTable.h b/src/def/cdef/defMsgTable.h new file mode 100644 index 00000000..34eb5341 --- /dev/null +++ b/src/def/cdef/defMsgTable.h @@ -0,0 +1,154 @@ + +/* + * emsMkError: +*/ + +#include +#include "ems.h" + +#ifdef TSIZE +#undef TSIZE +#define TSIZE 2048 +#endif + +emsError_t DEFEmsMsgTable[] = +{ + {5000 , EMS_NONE, "The 'defrRead' function has been called before the 'defrInit' function.\nThe 'defrInit' function should be called prior to the 'defrRead' function.", -1, 0}, + {5001 , EMS_NONE, "DEF statement found in the def file with no callback set.", -1, 0}, + {6000 , EMS_NONE, "The syntax for an ALIAS statement is \"&ALIAS aliasName = aliasDefinition &ENDALIAS\". '=' is missing after the aliasName.", -1, 0}, + {6001 , EMS_NONE, "End of file is reached while parsing in the middle of an ALIAS statement.\nReview you def file and add '&ENDALIAS' in the ALIAS statement.", -1, 0}, + {6002 , EMS_NONE, "The def file is incomplete.", -1, 0}, + {6003 , EMS_NONE, "The BEGINEXT tag is missing in the DEF file. Include the tag and then try again.", -1, 0}, + {6004 , EMS_NONE, "The BEGINEXT tag is empty. Specify a value for the tag and try again.", -1, 0}, + {6005 , EMS_NONE, "The '\"' is missing within the tag. Specify the '\"' in the tag and then try again.", -1, 0}, + {6006 , EMS_NONE, "The ending '\"' is missing in the tag. Specify the ending '\"' in the tag and then try again.", -1, 0}, + {6007 , EMS_NONE, "The ENDEXT statement is missing in the DEF file. Include the statement and then try again.", -1, 0}, + {6008 , EMS_NONE, "Invalid characters found in \'%s\'.\nThese characters might be using the character types other than English.\nCreate characters by specifying valid characters types.", -1, 0}, + {6010 , EMS_NONE, "An error has been reported in callback.", -1, 0}, + {6011 , EMS_NONE, "Too many syntax errors have been reported.", -1, 0}, + {6030 , EMS_NONE, "Invalid direction specified with FPC name. The valid direction is either 'H' or 'V'. Specify a valid vale and then try again.", -1, 0}, + {6060 , EMS_NONE, "Invalid value specified for IOTIMING rise/fall. The valid value for rise is 'R' and for fall is 'F'. Specify a valid value and then try again.", -1, 0}, + {6080 , EMS_NONE, "An internal error has occurred. The index number for the SUBNET wires array is less then or equal to 0.\nContact Cadence Customer Support with this error information.", -1, 0}, + {6081 , EMS_NONE, "An internal error has occurred. The index number for the NET PATH wires array is less then or equal to 0.\nContact Cadence Customer Support with this error information.", -1, 0}, + {6082 , EMS_NONE, "An internal error has occurred. The index number for the NET SHIELDPATH wires array is less then or equal to 0.\nContact Cadence Customer Support with this error information.", -1, 0}, + {6083 , EMS_NONE, "The index number %d specified for the NET INSTANCE is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", -1, 0}, + {6084 , EMS_NONE, "The index number %d specified for the NET PIN is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", -1, 0}, + {6085 , EMS_NONE, "The index number %d specified for the NET POLYGON is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", -1, 0}, + {6086 , EMS_NONE, "The index number %d specified for the NET RECTANGLE is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", -1, 0}, + {6090 , EMS_NONE, "The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", -1, 0}, + {6091 , EMS_NONE, "The index number %d specified for the NONDEFAULT PROPERTY is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", -1, 0}, + {6100 , EMS_NONE, "The value spefified for PARTITION SETUP is invalid. The valid value for SETUP is 'R' or 'F'. Specify a valid value for SETUP and then try again.", -1, 0}, + {6101 , EMS_NONE, "The value spefified for PARTITION HOLD is invalid. The valid value for HOLD is 'R' or 'F'. Specify a valid value for HOLD and then try again.", -1, 0}, + {6120 , EMS_NONE, "The index number %d specified for the PIN PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", -1, 0}, + {6130 , EMS_NONE, "The index number %d specified for the REGION PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", -1, 0}, + {6131 , EMS_NONE, "The index number %d specified for the REGION RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", -1, 0}, + {6140 , EMS_NONE, "The index number %d specified for the VIA LAYER RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", -1, 0}, + {6150 , EMS_NONE, "The START statement in the SCANCHAINS has defined more than one time in the SCANCHAINS statement.\nUpdate the DEF file to only one START statement and then try again.", -1, 0}, + {6151 , EMS_NONE, "The STOP statment in the SCANCHAINS has defined more than one time in the SCANCHAINS statement.\nUpdate the DEF file to only one STOP statement and then try again.", -1, 0}, + {6160 , EMS_NONE, "The index number %d specified for the SLOT RECTANGLE is invalid.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", -1, 0}, + {6170 , EMS_NONE, "The TimingDisable type is invalid. The valid types are FROMPIN, & THRUPIN. Specify the valid type and then try again.", -1, 0}, + {6180 , EMS_NONE, "The index number %d specified for the VIA POLYGON is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again", -1, 0}, + {6200 , EMS_NONE, "The ASSERTION statement is invalid because it has an invalid operand rule.\nValid operand rule is either NET or PATH. Specify a valid operand and then try again.", -1, 0}, + {6201 , EMS_NONE, "Unable to process the DEF file. Both WIREDLOGIC and DELAY statements are defined in constraint/assertion.\nUpdate the DEF file to define either a WIREDLOGIC or DELAY statement only.", -1, 0}, + {6202 , EMS_NONE, "Unable to process the DEF file. Both SUM and DIFF statements are defined in constraint/assertion.\nUpdate the DEF file to define either a SUM or DIFF statement only.", -1, 0}, + {6501 , EMS_NONE, "An error has been found while processing the DEF file '%s'\nUnit %d is a 5.6 or later syntax. Define the DEF file as 5.6 and then try again.", -1, 0}, + {6502 , EMS_NONE, "The value %d defined for DEF UNITS DISTANCE MICRON is invalid\n. The valid values are 100, 200, 1000, 2000, 10000, or 20000. Specify a valid value and then try again.", -1, 0}, + {6503 , EMS_NONE, "The execution has been stopped because the DEF parser 5.7 does not support DEF file with version %s.\nUpdate your DEF file to version 5.7 or earlier.", -1, 0}, + {6504 , EMS_NONE, "Def parser version 5.7 and later does not support NAMESCASESENSITIVE OFF.\nEither remove this optional construct or set it to ON.", -1, 0}, + {6505 , EMS_NONE, "The NONDEFAULTRULE statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", -1, 0}, + {6506 , EMS_NONE, "The NETEXPR statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", -1, 0}, + {6507 , EMS_NONE, "The SUPPLYSENSITIVITY statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", -1, 0}, + {6508 , EMS_NONE, "The GROUNDSENSITIVITY statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", -1, 0}, + {6509 , EMS_NONE, "The POLYGON statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", -1, 0}, + {6510 , EMS_NONE, "The ANTENNAPINPARTIALMETALAREA statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g.", -1, 0}, + {6511 , EMS_NONE, "The ANTENNAPINPARTIALMETALSIDEAREA statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g", -1, 0}, + {6512 , EMS_NONE, "The ANTENNAPINGATEAREA statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g", -1, 0}, + {6513 , EMS_NONE, "The ANTENNAPINDIFFAREA statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g", -1, 0}, + {6514 , EMS_NONE, "The ANTENNAPINMAXAREACAR statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g", -1, 0}, + {6515 , EMS_NONE, "The ANTENNAPINMAXSIDEAREACAR statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g", -1, 0}, + {6516 , EMS_NONE, "The ANTENNAPINPARTIALCUTAREA statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g", -1, 0}, + {6517 , EMS_NONE, "The ANTENNAPINMAXCUTCAR statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g", -1, 0}, + {6518 , EMS_NONE, "The ANTENNAMODEL statement is available in version 5.5 and later.\nHowever, your DEF file is defined with version %g", -1, 0}, + {6519 , EMS_NONE, "The SPACING statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", -1, 0}, + {6520 , EMS_NONE, "The DESIGNRULEWIDTH statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", -1, 0}, + {6523 , EMS_NONE, "Invalid ROW statement defined in the DEF file. The DO statement which is required in the ROW statement is not defined.\nUpdate your DEF file with a DO statement.", -1, 0}, + {6524 , EMS_NONE, "Invalid syntax specified. The valid syntax is either \"DO 1 BY num or DO num BY 1\". Specify the valid syntax and try again.", -1, 0}, + {6525 , EMS_NONE, "The DO number %g in TRACK is invalid.\nThe number value has to be greater than 0. Specify the valid syntax and try again.", -1, 0}, + {6526 , EMS_NONE, "The STEP number %g in TRACK is invalid.\nThe number value has to be greater than 0. Specify the valid syntax and try again.", -1, 0}, + {6527 , EMS_NONE, "The DO number %g in GCELLGRID is invalid.\nThe number value has to be greater than 0. Specify the valid syntax and try again.", -1, 0}, + {6528 , EMS_NONE, "The STEP number %g in GCELLGRID is invalid.\nThe number value has to be greater than 0. Specify the valid syntax and try again.", -1, 0}, + {6529 , EMS_NONE, "The HALO statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", -1, 0}, + {6530 , EMS_NONE, "The FIXEDBUMP statement is available in version 5.5 and later.\nHowever, your DEF file is defined with version %g", -1, 0}, + {6531 , EMS_NONE, "The layerName which is required in path is missing. Include the layerName in the path and then try again.", -1, 0}, + {6532 , EMS_NONE, "The VIA DO statement is available in version 5.5 and later.\nHowever, your DEF file is defined with version %g", -1, 0}, + {6533 , EMS_NONE, "Either the numX or numY in the VIA DO statement has invalid value. The value specified is 0.\nUpdate your DEF file with the correct value and then try again.", -1, 0}, + {6534 , EMS_NONE, "The STYLE statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", -1, 0}, + {6535 , EMS_NONE, "The POLYGON statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", -1, 0}, + {6536 , EMS_NONE, "The RECT statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", -1, 0}, + {6537 , EMS_NONE, "The value %s for statement VOLTAGE is invalid. The value can only be integer.\nSpecify a valid value in units of millivolts", -1, 0}, + {6538 , EMS_NONE, "The PARTITION statement is available in version 5.5 and later.\nHowever, your DEF file is defined with version %g", -1, 0}, + {6539 , EMS_NONE, "Invalid BLOCKAGE statement defined in the DEF file. The BLOCKAGE statment has both the LAYER and the PLACEMENT statements defined.\nUpdate your DEF file to have either BLOCKAGE or PLACEMENT statement only.", -1, 0}, + {6540 , EMS_NONE, "The SPACING statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", -1, 0}, + {6541 , EMS_NONE, "The SPACING statement is defined in the LAYER statement,\nbut there is already either a SPACING statement or DESIGNRULEWIDTH statement has defined in the LAYER statement.\nUpdate your DEF file to have either SPACING statement or a DESIGNRULEWIDTH statement.", -1, 0}, + {6542 , EMS_NONE, "The defined BLOCKAGES COMPONENT statement has either COMPONENT, SLOTS, FILLS, PUSHDOWN or EXCEPTPGNET defined.\nOnly one of these statements is allowed per LAYER. Updated the DEF file to define a valid BLOCKAGES COMPONENT statement per layer.", -1, 0}, + {6543 , EMS_NONE, "The defined BLOCKAGES PLACEMENT statement has either COMPONENT, PUSHDOWN, SOFT or PARTIAL defined.\nOnly one of these statements is allowed per LAYER. Updated the DEF file to define a valid BLOCKAGES PLACEMENT statement.", -1, 0}, + {6544 , EMS_NONE, "A POLYGON statement is defined in the BLOCKAGE statement,\nbut it is not defined in the BLOCKAGE LAYER statement.\nUpdate your DEF file to either remove the POLYGON statement from the BLOCKAGE statement or\ndefine the POLYGON statement in a BLOCKAGE LAYER statement.", -1, 0}, + {6545 , EMS_NONE, "The NONDEFAULTRULE statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", -1, 0}, + {6546 , EMS_NONE, "The STYLES statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", -1, 0}, + {6547 , EMS_NONE, "The PLACEMENT SOFT is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", -1, 0}, + {6548 , EMS_NONE, "The PARTIAL is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", -1, 0}, + {6549 , EMS_NONE, "The EXCEPTPGNET is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", -1, 0}, + {6550 , EMS_NONE, "The HALO SOFT is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", -1, 0}, + {6551 , EMS_NONE, "The ROUTEHALO is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", -1, 0}, + {6552 , EMS_NONE, "The FILLWIREOPC is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", -1, 0}, + {6553 , EMS_NONE, "The LAYER OPC is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", -1, 0}, + {6554 , EMS_NONE, "The VIA OPC is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", -1, 0}, + {6555 , EMS_NONE, "The PORT in PINS is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", -1, 0}, + {6556 , EMS_NONE, "The PIN VIA statement is available in version 5.7 and later.\nHowever, your DEF file is defined with version %g.", -1, 0}, + {6557 , EMS_NONE, "The VIARULE statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g,", -1, 0}, + {6558 , EMS_NONE, "The FREQUENCY statement is available in version 5.5 and later.\nHowever, your DEF file is defined with version %g", -1, 0}, + {6559 , EMS_NONE, "The ROWCOL statement is missing from the VIARULE statement. Ensure that it exists in the VIARULE statement.", -1, 0}, + {6560 , EMS_NONE, "The ORIGIN statement is missing from the VIARULE statement. Ensure that it exists in the VIARULE statement.", -1, 0}, + {6561 , EMS_NONE, " The OFFSET statement is missing from the VIARULE statement. Ensure that it exists in the VIARULE statement.", -1, 0}, + {6562 , EMS_NONE, "The PATTERN statement is missing from the VIARULE statement. Ensure that it exists in the VIARULE statement.", -1, 0}, + {6563 , EMS_NONE, "The TYPE statement already exists. It has been defined in the REGION statement.", -1, 0}, + {6564 , EMS_NONE, "POLYGON statement in FILLS LAYER is a version 5.6 and later syntax.\nYour def file is defined with version %g,", -1, 0}, + {7000 , EMS_NONE, "The specified string has exceeded 4096 characters. The extra characters will be truncated. Specify a string less than or equal to 4096 characters.", -1, 0}, + {7010 , EMS_NONE, "The PropName %s is not defined for %s.", -1, 0}, + {7011 , EMS_NONE, "The NAMESCASESENSITIVE statement is obsolete in version 5.6 and later.\nThe DEF parser will ignore this statement.", -1, 0}, + {7012 , EMS_NONE, "The DEF file is invalid because the VERSION statement is not defined in it.\nThe VERSION statement is required in DEF file. Define this statement by refering to the LEF/DEF Language Reference manual.", -1, 0}, + {7013 , EMS_NONE, "The DEF file is invalid if NAMESCASESENSITIVE is undefined.\nNAMESCASESENSITIVE is a mandatory statement in the DEF file with version 5.6 and earlier.\nTo define the NAMESCASESENSITIVE statement, refer to the LEF/DEF 5.5 and earlier Language Reference manual.", -1, 0}, + {7014 , EMS_NONE, "The DEF file is invalid if BUSBITCHARS is undefined.\nBUSBITCHARS is a mandatory statement in the DEF file with version 5.6 and earlier.\nTo define the BUSBITCHARS statement, refer to the LEF/DEF 5.5 and earlier Language Reference manual.", -1, 0}, + {7015 , EMS_NONE, "The DEF file is invalid if DIVIDERCHAR is undefined.\nDIVIDERCHAR is a mandatory statement in the DEF file with version 5.6 and earlier.\nTo define the DIVIDERCHAR statement, refer to the LEF/DEF 5.5 and earlier Language Reference manual.", -1, 0}, + {7016 , EMS_NONE, "DESIGN is a mandatory statement in the DEF file. Ensure that it exists in the file.", -1, 0}, + {7017 , EMS_NONE, "The DEFAULTCAP statement is obsolete in version 5.4 and later.\nThe DEF parser will ignore this statement.", -1, 0}, + {7018 , EMS_NONE, "The DO statement in the ROW statement with the name %s has invalid syntax.\nThe valid syntax is \"DO numX BY 1 STEP spaceX 0 | DO 1 BY numY STEP 0 spaceY\".\nSpecify the valid syntax and try again.", -1, 0}, + {7019 , EMS_NONE, "The PATTERNNAME statement is obsolete in version 5.6 and later.\nThe DEF parser will ignore this statement.", -1, 0}, + {7020 , EMS_NONE, "The REGION pt pt statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement.", -1, 0}, + {7021 , EMS_NONE, "The FOREIGN statement is obsolete in version 5.6 and later.\nThe DEF parser will ignore this statement.", -1, 0}, + {7022 , EMS_NONE, "In the COMPONENT UNPLACED statement, the point and orient are invalid in version 5.4 and later.\nThe DEF parser will ignore this statement.", -1, 0}, + {7023 , EMS_NONE, "The SPECIAL NET statement, with type %s, does not have any net statement defined.\nThe DEF parser will ignore this statement.", -1, 0}, + {7024 , EMS_NONE, "The ESTCAP statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement.", -1, 0}, + {7025 , EMS_NONE, "The SPECIAL NET SHIELD statement, does not have any shield net statement defined.\nThe DEF parser will ignore this statement.", -1, 0}, + {7026 , EMS_NONE, "The WIDTH statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement.", -1, 0}, + {7027 , EMS_NONE, "The GROUP REGION pt pt statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement.", -1, 0}, + {7028 , EMS_NONE, "The GROUP SOFT MAXX statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement.", -1, 0}, + {7029 , EMS_NONE, "The GROUP SOFT MAXY statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement.", -1, 0}, + {7030 , EMS_NONE, "The GROUP SOFT MAXHALFPERIMETER statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement.", -1, 0}, + {7031 , EMS_NONE, "The ASSERTIONS statement is obsolete in version 5.4 and later.\nThe DEF parser will ignore this statement.", -1, 0}, + {7032 , EMS_NONE, "The CONSTRAINTS statement is obsolete in version 5.4 and later.\nThe DEF parser will ignore this statement.", -1, 0}, + {7035 , EMS_NONE, "The IOTIMINGS statement is obsolete in version 5.4 and later.\nThe DEF parser will ignore this statement.", -1, 0}, + {7500 , EMS_NONE, "Unable to open the file defRWarning.log in %s.\nWarning messages will not be written out in the log file.\nCheck if you have write permission on the directory.", -1, 0}, + {8000 , EMS_NONE, "The data still exists after the END DESIGN statement. The DEF parser will ignore this data.", -1, 0}, + {8500 , EMS_NONE, "Unable to open the file defRWarning.log in %s.\nInfo messages will not be written out in the log file.\nCheck if you have write permission on the directory.", -1, 0}, + {9000 , EMS_NONE, "The DEF writer has detected that the function defwInitCbk has already been called and you are trying to call defwInit.\nOnly defwInitCbk or defwInit can be called but not both.\nUpdate your program and then try again.", -1, 0}, + {9001 , EMS_NONE, "The DEF writer has detected that the function defwInit has already been called and you are trying to call defwInitCbk.\nOnly defwInitCbk or defwInit can be called but not both.\nUpdate your program and then try again.", -1, 0}, + {9010 , EMS_NONE, "The function defwWrite is called before the function defwInitCbk.\nYou need to call defwInitCbk before calling any other functions.\nUpdate your program and then try again.", -1, 0}, + {9011 , EMS_NONE, "You program has called the function defwInit to initialize the writer.\nIf you want to use the callback option you need to use the function defwInitCbk.", -1, 0}, + {9012 , EMS_NONE, "You are calling the function defwPrintUnusedCallbacks but you did call the function defwSetRegisterUnusedCallbacks which is required before you can call defwPrintUnusedCallbacks.", -1, 0}, + {-1 , EMS_NONE, "", -1, 0} +}; + +/* + * End machine generated table. +*/ diff --git a/src/def/cdef/defiAlias.h b/src/def/cdef/defiAlias.h new file mode 100644 index 00000000..f6a9bf4d --- /dev/null +++ b/src/def/cdef/defiAlias.h @@ -0,0 +1,40 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: arakhman $ */ +/* $Revision: #4 $ */ +/* $Date: 2014/04/30 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFIALIAS_H +#define CDEFIALIAS_H + +#include +#include "defiTypedefs.h" + +#endif diff --git a/src/def/cdef/defiAssertion.h b/src/def/cdef/defiAssertion.h new file mode 100644 index 00000000..bf4dca2e --- /dev/null +++ b/src/def/cdef/defiAssertion.h @@ -0,0 +1,82 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFIASSERTION_H +#define CDEFIASSERTION_H + +#include +#include "defiTypedefs.h" + +/* Struct holds the data for one assertion/constraint. */ +/* An assertion or constraint is either a net/path rule or a */ +/* wired logic rule. */ +/* */ +/* A net/path rule is an item or list of items plus specifications. */ +/* The specifications are: rise/fall min/max. */ +/* The items are a list of (one or more) net names or paths or a */ +/* combination of both. */ +/* */ +/* A wired logic rule is a netname and a distance. */ +/* */ +/* We will NOT allow the mixing of wired logic rules and net/path delays */ +/* in the same assertion/constraint. */ +/* */ +/* We will allow the rule to be a sum of sums (which will be interpreted */ +/* as just one list). */ +/* */ + +EXTERN int defiAssertion_isAssertion (const defiAssertion* obj); +EXTERN int defiAssertion_isConstraint (const defiAssertion* obj); +EXTERN int defiAssertion_isWiredlogic (const defiAssertion* obj); +EXTERN int defiAssertion_isDelay (const defiAssertion* obj); +EXTERN int defiAssertion_isSum (const defiAssertion* obj); +EXTERN int defiAssertion_isDiff (const defiAssertion* obj); +EXTERN int defiAssertion_hasRiseMin (const defiAssertion* obj); +EXTERN int defiAssertion_hasRiseMax (const defiAssertion* obj); +EXTERN int defiAssertion_hasFallMin (const defiAssertion* obj); +EXTERN int defiAssertion_hasFallMax (const defiAssertion* obj); +EXTERN double defiAssertion_riseMin (const defiAssertion* obj); +EXTERN double defiAssertion_riseMax (const defiAssertion* obj); +EXTERN double defiAssertion_fallMin (const defiAssertion* obj); +EXTERN double defiAssertion_fallMax (const defiAssertion* obj); +EXTERN const char* defiAssertion_netName (const defiAssertion* obj); +EXTERN double defiAssertion_distance (const defiAssertion* obj); +EXTERN int defiAssertion_numItems (const defiAssertion* obj); +EXTERN int defiAssertion_isPath (const defiAssertion* obj, int index); +EXTERN int defiAssertion_isNet (const defiAssertion* obj, int index); +EXTERN void defiAssertion_path (const defiAssertion* obj, int index, char** fromInst, char** fromPin, char** toInst, char** toPin); +EXTERN void defiAssertion_net (const defiAssertion* obj, int index, char** netName); + +EXTERN void defiAssertion_print (const defiAssertion* obj, FILE* f); + +#endif diff --git a/src/def/cdef/defiBlockage.h b/src/def/cdef/defiBlockage.h new file mode 100644 index 00000000..7c194089 --- /dev/null +++ b/src/def/cdef/defiBlockage.h @@ -0,0 +1,71 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFIBLOCKAGE_H +#define CDEFIBLOCKAGE_H + +#include +#include "defiTypedefs.h" + +EXTERN int defiBlockage_hasLayer (const defiBlockage* obj); +EXTERN int defiBlockage_hasPlacement (const defiBlockage* obj); +EXTERN int defiBlockage_hasComponent (const defiBlockage* obj); +EXTERN int defiBlockage_hasSlots (const defiBlockage* obj); +EXTERN int defiBlockage_hasFills (const defiBlockage* obj); +EXTERN int defiBlockage_hasPushdown (const defiBlockage* obj); +EXTERN int defiBlockage_hasExceptpgnet (const defiBlockage* obj); +EXTERN int defiBlockage_hasSoft (const defiBlockage* obj); +EXTERN int defiBlockage_hasPartial (const defiBlockage* obj); +EXTERN int defiBlockage_hasSpacing (const defiBlockage* obj); +EXTERN int defiBlockage_hasDesignRuleWidth (const defiBlockage* obj); +EXTERN int defiBlockage_hasMask (const defiBlockage* obj); +EXTERN int defiBlockage_mask (const defiBlockage* obj); +EXTERN int defiBlockage_minSpacing (const defiBlockage* obj); +EXTERN int defiBlockage_designRuleWidth (const defiBlockage* obj); +EXTERN double defiBlockage_placementMaxDensity (const defiBlockage* obj); +EXTERN const char* defiBlockage_layerName (const defiBlockage* obj); +EXTERN const char* defiBlockage_layerComponentName (const defiBlockage* obj); +EXTERN const char* defiBlockage_placementComponentName (const defiBlockage* obj); + +EXTERN int defiBlockage_numRectangles (const defiBlockage* obj); +EXTERN int defiBlockage_xl (const defiBlockage* obj, int index); +EXTERN int defiBlockage_yl (const defiBlockage* obj, int index); +EXTERN int defiBlockage_xh (const defiBlockage* obj, int index); +EXTERN int defiBlockage_yh (const defiBlockage* obj, int index); + +EXTERN int defiBlockage_numPolygons (const defiBlockage* obj); +EXTERN struct defiPoints defiBlockage_getPolygon (const defiBlockage* obj, int index); + +EXTERN void defiBlockage_print (const defiBlockage* obj, FILE* f); + +#endif diff --git a/src/def/cdef/defiComponent.h b/src/def/cdef/defiComponent.h new file mode 100644 index 00000000..d3f0c2fd --- /dev/null +++ b/src/def/cdef/defiComponent.h @@ -0,0 +1,116 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFICOMPONENT_H +#define CDEFICOMPONENT_H + +#include +#include "defiTypedefs.h" + +/* Placement status for the component. */ +/* Default is 0 */ +#define DEFI_COMPONENT_UNPLACED 1 +#define DEFI_COMPONENT_PLACED 2 +#define DEFI_COMPONENT_FIXED 3 +#define DEFI_COMPONENT_COVER 4 + +/* Struct holds the data for componentMaskShiftLayers. */ + +EXTERN int defiComponentMaskShiftLayer_numMaskShiftLayers (const defiComponentMaskShiftLayer* obj); +EXTERN const char* defiComponentMaskShiftLayer_maskShiftLayer (const defiComponentMaskShiftLayer* obj, int index); + +/* Struct holds the data for one component. */ + + /* 5.7 */ + + /* For OA to modify the Id & Name */ + +EXTERN const char* defiComponent_id (const defiComponent* obj); +EXTERN const char* defiComponent_name (const defiComponent* obj); +EXTERN int defiComponent_placementStatus (const defiComponent* obj); +EXTERN int defiComponent_isUnplaced (const defiComponent* obj); +EXTERN int defiComponent_isPlaced (const defiComponent* obj); +EXTERN int defiComponent_isFixed (const defiComponent* obj); +EXTERN int defiComponent_isCover (const defiComponent* obj); +EXTERN int defiComponent_placementX (const defiComponent* obj); +EXTERN int defiComponent_placementY (const defiComponent* obj); +EXTERN int defiComponent_placementOrient (const defiComponent* obj); +EXTERN const char* defiComponent_placementOrientStr (const defiComponent* obj); +EXTERN int defiComponent_hasRegionName (const defiComponent* obj); +EXTERN int defiComponent_hasRegionBounds (const defiComponent* obj); +EXTERN int defiComponent_hasEEQ (const defiComponent* obj); +EXTERN int defiComponent_hasGenerate (const defiComponent* obj); +EXTERN int defiComponent_hasSource (const defiComponent* obj); +EXTERN int defiComponent_hasWeight (const defiComponent* obj); +EXTERN int defiComponent_weight (const defiComponent* obj); +EXTERN int defiComponent_maskShiftSize (const defiComponent* obj); +EXTERN int defiComponent_maskShift (const defiComponent* obj, int index); +EXTERN int defiComponent_hasNets (const defiComponent* obj); +EXTERN int defiComponent_numNets (const defiComponent* obj); +EXTERN const char* defiComponent_net (const defiComponent* obj, int index); +EXTERN const char* defiComponent_regionName (const defiComponent* obj); +EXTERN const char* defiComponent_source (const defiComponent* obj); +EXTERN const char* defiComponent_EEQ (const defiComponent* obj); +EXTERN const char* defiComponent_generateName (const defiComponent* obj); +EXTERN const char* defiComponent_macroName (const defiComponent* obj); +EXTERN int defiComponent_hasHalo (const defiComponent* obj); +EXTERN int defiComponent_hasHaloSoft (const defiComponent* obj); +EXTERN int defiComponent_hasRouteHalo (const defiComponent* obj); +EXTERN int defiComponent_haloDist (const defiComponent* obj); +EXTERN const char* defiComponent_minLayer (const defiComponent* obj); +EXTERN const char* defiComponent_maxLayer (const defiComponent* obj); + + /* Returns arrays for the ll and ur of the rectangles in the region. */ + /* The number of items in the arrays is given in size. */ +EXTERN void defiComponent_regionBounds (const defiComponent* obj, int* size, int** xl, int** yl, int** xh, int** yh); + +EXTERN int defiComponent_hasForeignName (const defiComponent* obj); +EXTERN const char* defiComponent_foreignName (const defiComponent* obj); +EXTERN int defiComponent_foreignX (const defiComponent* obj); +EXTERN int defiComponent_foreignY (const defiComponent* obj); +EXTERN const char* defiComponent_foreignOri (const defiComponent* obj); +EXTERN int defiComponent_foreignOrient (const defiComponent* obj); +EXTERN int defiComponent_hasFori (const defiComponent* obj); + +EXTERN int defiComponent_numProps (const defiComponent* obj); +EXTERN char* defiComponent_propName (const defiComponent* obj, int index); +EXTERN char* defiComponent_propValue (const defiComponent* obj, int index); +EXTERN double defiComponent_propNumber (const defiComponent* obj, int index); +EXTERN char defiComponent_propType (const defiComponent* obj, int index); +EXTERN int defiComponent_propIsNumber (const defiComponent* obj, int index); +EXTERN int defiComponent_propIsString (const defiComponent* obj, int index); + + /* Debug printing */ +EXTERN void defiComponent_print (const defiComponent* obj, FILE* fout); + +#endif diff --git a/src/def/cdef/defiDebug.h b/src/def/cdef/defiDebug.h new file mode 100644 index 00000000..233b113a --- /dev/null +++ b/src/def/cdef/defiDebug.h @@ -0,0 +1,53 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFIDEBUG_H +#define CDEFIDEBUG_H + +#include +#include "defiTypedefs.h" + +/* Set flag */ +EXTERN void defiSetDebug (int num, int value); + +/* Read flag */ +EXTERN int defiDebug (int num); + +/* Error loggin function */ +EXTERN void defiError (int check, int msgNum, const char* message); + +/* for auto upshifting names in case insensitive files */ +EXTERN const char* upperCase (const char* c); +EXTERN const char* DEFCASE (const char* ch); + +#endif diff --git a/src/def/cdef/defiDefs.h b/src/def/cdef/defiDefs.h new file mode 100644 index 00000000..40bcd1cf --- /dev/null +++ b/src/def/cdef/defiDefs.h @@ -0,0 +1,28 @@ +/************************************************************************* + * Copyright 2012, Cadence Design Systems + * + * This file is part of the Cadence LEF/DEF Open Source Distribution, + * Product Version 5.8. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For updates, support, or to become part of the LEF/DEF Community, + * check www.openeda.org for details. + * +*************************************************************************/ + +/************************************************************************* + * THE FILE WAS OBSOLETED IN LEF/DEF 5.8 +*************************************************************************/ diff --git a/src/def/cdef/defiFPC.h b/src/def/cdef/defiFPC.h new file mode 100644 index 00000000..b63c058e --- /dev/null +++ b/src/def/cdef/defiFPC.h @@ -0,0 +1,63 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFIFPC_H +#define CDEFIFPC_H + +#include +#include "defiTypedefs.h" + +EXTERN const char* defiFPC_name (const defiFPC* obj); +EXTERN int defiFPC_isVertical (const defiFPC* obj); +EXTERN int defiFPC_isHorizontal (const defiFPC* obj); +EXTERN int defiFPC_hasAlign (const defiFPC* obj); +EXTERN int defiFPC_hasMax (const defiFPC* obj); +EXTERN int defiFPC_hasMin (const defiFPC* obj); +EXTERN int defiFPC_hasEqual (const defiFPC* obj); +EXTERN double defiFPC_alignMax (const defiFPC* obj); +EXTERN double defiFPC_alignMin (const defiFPC* obj); +EXTERN double defiFPC_equal (const defiFPC* obj); + +EXTERN int defiFPC_numParts (const defiFPC* obj); + + /* Return the constraint number "index" where index is */ + /* from 0 to numParts() */ + /* The returned corner is 'B' for bottom left 'T' for topright */ + /* The returned typ is 'R' for rows 'C' for comps */ + /* The returned char* points to name of the item. */ +EXTERN void defiFPC_getPart (const defiFPC* obj, int index, int* corner, int* typ, char** name); + + /* debug print */ +EXTERN void defiFPC_print (const defiFPC* obj, FILE* f); + +#endif diff --git a/src/def/cdef/defiFill.h b/src/def/cdef/defiFill.h new file mode 100644 index 00000000..e016b10c --- /dev/null +++ b/src/def/cdef/defiFill.h @@ -0,0 +1,67 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFIFILL_H +#define CDEFIFILL_H + +#include +#include "defiTypedefs.h" + +EXTERN int defiFill_hasLayer (const defiFill* obj); +EXTERN const char* defiFill_layerName (const defiFill* obj); +EXTERN int defiFill_hasLayerOpc (const defiFill* obj); + +EXTERN int defiFill_layerMask (const defiFill* obj); +EXTERN int defiFill_viaTopMask (const defiFill* obj); +EXTERN int defiFill_viaCutMask (const defiFill* obj); +EXTERN int defiFill_viaBottomMask (const defiFill* obj); + +EXTERN int defiFill_numRectangles (const defiFill* obj); +EXTERN int defiFill_xl (const defiFill* obj, int index); +EXTERN int defiFill_yl (const defiFill* obj, int index); +EXTERN int defiFill_xh (const defiFill* obj, int index); +EXTERN int defiFill_yh (const defiFill* obj, int index); + +EXTERN int defiFill_numPolygons (const defiFill* obj); +EXTERN struct defiPoints defiFill_getPolygon (const defiFill* obj, int index); + +EXTERN int defiFill_hasVia (const defiFill* obj); +EXTERN const char* defiFill_viaName (const defiFill* obj); +EXTERN int defiFill_hasViaOpc (const defiFill* obj); + +EXTERN int defiFill_numViaPts (const defiFill* obj); +EXTERN struct defiPoints defiFill_getViaPts (const defiFill* obj, int index); + +EXTERN void defiFill_print (const defiFill* obj, FILE* f); + +#endif diff --git a/src/def/cdef/defiGroup.h b/src/def/cdef/defiGroup.h new file mode 100644 index 00000000..832b69b5 --- /dev/null +++ b/src/def/cdef/defiGroup.h @@ -0,0 +1,65 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFIGROUP_H +#define CDEFIGROUP_H + +#include +#include "defiTypedefs.h" + +/* Struct holds the data for one property. */ + +EXTERN const char* defiGroup_name (const defiGroup* obj); +EXTERN const char* defiGroup_regionName (const defiGroup* obj); +EXTERN int defiGroup_hasRegionBox (const defiGroup* obj); +EXTERN int defiGroup_hasRegionName (const defiGroup* obj); +EXTERN int defiGroup_hasMaxX (const defiGroup* obj); +EXTERN int defiGroup_hasMaxY (const defiGroup* obj); +EXTERN int defiGroup_hasPerim (const defiGroup* obj); +EXTERN void defiGroup_regionRects (const defiGroup* obj, int* size, int** xl, int** yl, int** xh, int** yh); +EXTERN int defiGroup_maxX (const defiGroup* obj); +EXTERN int defiGroup_maxY (const defiGroup* obj); +EXTERN int defiGroup_perim (const defiGroup* obj); + +EXTERN int defiGroup_numProps (const defiGroup* obj); +EXTERN const char* defiGroup_propName (const defiGroup* obj, int index); +EXTERN const char* defiGroup_propValue (const defiGroup* obj, int index); +EXTERN double defiGroup_propNumber (const defiGroup* obj, int index); +EXTERN char defiGroup_propType (const defiGroup* obj, int index); +EXTERN int defiGroup_propIsNumber (const defiGroup* obj, int index); +EXTERN int defiGroup_propIsString (const defiGroup* obj, int index); + + /* debug print */ +EXTERN void defiGroup_print (const defiGroup* obj, FILE* f); + +#endif diff --git a/src/def/cdef/defiIOTiming.h b/src/def/cdef/defiIOTiming.h new file mode 100644 index 00000000..c2064438 --- /dev/null +++ b/src/def/cdef/defiIOTiming.h @@ -0,0 +1,69 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFIIOTIMING_H +#define CDEFIIOTIMING_H + +#include +#include "defiTypedefs.h" + +EXTERN int defiIOTiming_hasVariableRise (const defiIOTiming* obj); +EXTERN int defiIOTiming_hasVariableFall (const defiIOTiming* obj); +EXTERN int defiIOTiming_hasSlewRise (const defiIOTiming* obj); +EXTERN int defiIOTiming_hasSlewFall (const defiIOTiming* obj); +EXTERN int defiIOTiming_hasCapacitance (const defiIOTiming* obj); +EXTERN int defiIOTiming_hasDriveCell (const defiIOTiming* obj); +EXTERN int defiIOTiming_hasFrom (const defiIOTiming* obj); +EXTERN int defiIOTiming_hasTo (const defiIOTiming* obj); +EXTERN int defiIOTiming_hasParallel (const defiIOTiming* obj); + +EXTERN const char* defiIOTiming_inst (const defiIOTiming* obj); +EXTERN const char* defiIOTiming_pin (const defiIOTiming* obj); +EXTERN double defiIOTiming_variableFallMin (const defiIOTiming* obj); +EXTERN double defiIOTiming_variableRiseMin (const defiIOTiming* obj); +EXTERN double defiIOTiming_variableFallMax (const defiIOTiming* obj); +EXTERN double defiIOTiming_variableRiseMax (const defiIOTiming* obj); +EXTERN double defiIOTiming_slewFallMin (const defiIOTiming* obj); +EXTERN double defiIOTiming_slewRiseMin (const defiIOTiming* obj); +EXTERN double defiIOTiming_slewFallMax (const defiIOTiming* obj); +EXTERN double defiIOTiming_slewRiseMax (const defiIOTiming* obj); +EXTERN double defiIOTiming_capacitance (const defiIOTiming* obj); +EXTERN const char* defiIOTiming_driveCell (const defiIOTiming* obj); +EXTERN const char* defiIOTiming_from (const defiIOTiming* obj); +EXTERN const char* defiIOTiming_to (const defiIOTiming* obj); +EXTERN double defiIOTiming_parallel (const defiIOTiming* obj); + + /* debug print */ +EXTERN void defiIOTiming_print (const defiIOTiming* obj, FILE* f); + +#endif diff --git a/src/def/cdef/defiKRDefs.h b/src/def/cdef/defiKRDefs.h new file mode 100644 index 00000000..40bcd1cf --- /dev/null +++ b/src/def/cdef/defiKRDefs.h @@ -0,0 +1,28 @@ +/************************************************************************* + * Copyright 2012, Cadence Design Systems + * + * This file is part of the Cadence LEF/DEF Open Source Distribution, + * Product Version 5.8. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + * + * For updates, support, or to become part of the LEF/DEF Community, + * check www.openeda.org for details. + * +*************************************************************************/ + +/************************************************************************* + * THE FILE WAS OBSOLETED IN LEF/DEF 5.8 +*************************************************************************/ diff --git a/src/def/cdef/defiMisc.h b/src/def/cdef/defiMisc.h new file mode 100644 index 00000000..f0b0eedf --- /dev/null +++ b/src/def/cdef/defiMisc.h @@ -0,0 +1,46 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFIMISC_H +#define CDEFIMISC_H + +#include +#include "defiTypedefs.h" + +EXTERN int defiGeometries_numPoints (const defiGeometries* obj); +EXTERN void defiGeometries_points (const defiGeometries* obj, int index, int* x, int* y); + +EXTERN int defiStyles_style (const defiStyles* obj); +EXTERN struct defiPoints defiStyles_getPolygon (const defiStyles* obj); + +#endif diff --git a/src/def/cdef/defiNet.h b/src/def/cdef/defiNet.h new file mode 100644 index 00000000..f79fe421 --- /dev/null +++ b/src/def/cdef/defiNet.h @@ -0,0 +1,247 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFINET_H +#define CDEFINET_H + +#include +#include "defiTypedefs.h" + +/* Return codes for defiNet::viaOrient + DEF_ORIENT_N 0 + DEF_ORIENT_W 1 + DEF_ORIENT_S 2 + DEF_ORIENT_E 3 + DEF_ORIENT_FN 4 + DEF_ORIENT_FW 5 + DEF_ORIENT_FS 6 + DEF_ORIENT_FE 7 +*/ + +EXTERN const char* defiWire_wireType (const defiWire* obj); +EXTERN const char* defiWire_wireShieldNetName (const defiWire* obj); +EXTERN int defiWire_numPaths (const defiWire* obj); + +EXTERN const defiPath* defiWire_path (const defiWire* obj, int index); + + /* WMD -- the following will be removed by the next release */ + + /* NEW: a net can have more than 1 wire */ + + /* Debug printing */ +EXTERN void defiSubnet_print (const defiSubnet* obj, FILE* f); + +EXTERN const char* defiSubnet_name (const defiSubnet* obj); +EXTERN int defiSubnet_numConnections (const defiSubnet* obj); +EXTERN const char* defiSubnet_instance (const defiSubnet* obj, int index); +EXTERN const char* defiSubnet_pin (const defiSubnet* obj, int index); +EXTERN int defiSubnet_pinIsSynthesized (const defiSubnet* obj, int index); +EXTERN int defiSubnet_pinIsMustJoin (const defiSubnet* obj, int index); + + /* WMD -- the following will be removed by the next release */ +EXTERN int defiSubnet_isFixed (const defiSubnet* obj); +EXTERN int defiSubnet_isRouted (const defiSubnet* obj); +EXTERN int defiSubnet_isCover (const defiSubnet* obj); + +EXTERN int defiSubnet_hasNonDefaultRule (const defiSubnet* obj); + + /* WMD -- the following will be removed by the next release */ +EXTERN int defiSubnet_numPaths (const defiSubnet* obj); +EXTERN const defiPath* defiSubnet_path (const defiSubnet* obj, int index); + +EXTERN const char* defiSubnet_nonDefaultRule (const defiSubnet* obj); + +EXTERN int defiSubnet_numWires (const defiSubnet* obj); +EXTERN const defiWire* defiSubnet_wire (const defiSubnet* obj, int index); + + /* WMD -- the following will be removed by the next release */ + +EXTERN int defiVpin_xl (const defiVpin* obj); +EXTERN int defiVpin_yl (const defiVpin* obj); +EXTERN int defiVpin_xh (const defiVpin* obj); +EXTERN int defiVpin_yh (const defiVpin* obj); +EXTERN char defiVpin_status (const defiVpin* obj); +EXTERN int defiVpin_orient (const defiVpin* obj); +EXTERN const char* defiVpin_orientStr (const defiVpin* obj); +EXTERN int defiVpin_xLoc (const defiVpin* obj); +EXTERN int defiVpin_yLoc (const defiVpin* obj); +EXTERN const char* defiVpin_name (const defiVpin* obj); +EXTERN const char* defiVpin_layer (const defiVpin* obj); + +/* Pre 5.4 */ + +EXTERN const char* defiShield_shieldName (const defiShield* obj); +EXTERN int defiShield_numPaths (const defiShield* obj); + +EXTERN const defiPath* defiShield_path (const defiShield* obj, int index); + +/* Struct holds the data for one component. */ + + /* Routines used by YACC to set the fields in the net. */ + + /* WMD -- the following will be removed by the next release */ + + /* NEW: a net can have more than 1 wire */ + + /* 5.6 */ + + /* For OA to modify the netName, id & pinName */ + + /* Routines to return the value of net data. */ +EXTERN const char* defiNet_name (const defiNet* obj); +EXTERN int defiNet_weight (const defiNet* obj); +EXTERN int defiNet_numProps (const defiNet* obj); +EXTERN const char* defiNet_propName (const defiNet* obj, int index); +EXTERN const char* defiNet_propValue (const defiNet* obj, int index); +EXTERN double defiNet_propNumber (const defiNet* obj, int index); +EXTERN char defiNet_propType (const defiNet* obj, int index); +EXTERN int defiNet_propIsNumber (const defiNet* obj, int index); +EXTERN int defiNet_propIsString (const defiNet* obj, int index); +EXTERN int defiNet_numConnections (const defiNet* obj); +EXTERN const char* defiNet_instance (const defiNet* obj, int index); +EXTERN const char* defiNet_pin (const defiNet* obj, int index); +EXTERN int defiNet_pinIsMustJoin (const defiNet* obj, int index); +EXTERN int defiNet_pinIsSynthesized (const defiNet* obj, int index); +EXTERN int defiNet_numSubnets (const defiNet* obj); + +EXTERN const defiSubnet* defiNet_subnet (const defiNet* obj, int index); + + /* WMD -- the following will be removed by the next release */ +EXTERN int defiNet_isFixed (const defiNet* obj); +EXTERN int defiNet_isRouted (const defiNet* obj); +EXTERN int defiNet_isCover (const defiNet* obj); + + /* The following routines are for wiring */ +EXTERN int defiNet_numWires (const defiNet* obj); + +EXTERN const defiWire* defiNet_wire (const defiNet* obj, int index); + + /* Routines to get the information about Virtual Pins. */ +EXTERN int defiNet_numVpins (const defiNet* obj); + +EXTERN const defiVpin* defiNet_vpin (const defiNet* obj, int index); + +EXTERN int defiNet_hasProps (const defiNet* obj); +EXTERN int defiNet_hasWeight (const defiNet* obj); +EXTERN int defiNet_hasSubnets (const defiNet* obj); +EXTERN int defiNet_hasSource (const defiNet* obj); +EXTERN int defiNet_hasFixedbump (const defiNet* obj); +EXTERN int defiNet_hasFrequency (const defiNet* obj); +EXTERN int defiNet_hasPattern (const defiNet* obj); +EXTERN int defiNet_hasOriginal (const defiNet* obj); +EXTERN int defiNet_hasCap (const defiNet* obj); +EXTERN int defiNet_hasUse (const defiNet* obj); +EXTERN int defiNet_hasStyle (const defiNet* obj); +EXTERN int defiNet_hasNonDefaultRule (const defiNet* obj); +EXTERN int defiNet_hasVoltage (const defiNet* obj); +EXTERN int defiNet_hasSpacingRules (const defiNet* obj); +EXTERN int defiNet_hasWidthRules (const defiNet* obj); +EXTERN int defiNet_hasXTalk (const defiNet* obj); + +EXTERN int defiNet_numSpacingRules (const defiNet* obj); +EXTERN void defiNet_spacingRule (const defiNet* obj, int index, char** layer, double* dist, double* left, double* right); +EXTERN int defiNet_numWidthRules (const defiNet* obj); +EXTERN void defiNet_widthRule (const defiNet* obj, int index, char** layer, double* dist); +EXTERN double defiNet_voltage (const defiNet* obj); + +EXTERN int defiNet_XTalk (const defiNet* obj); +EXTERN const char* defiNet_source (const defiNet* obj); +EXTERN double defiNet_frequency (const defiNet* obj); +EXTERN const char* defiNet_original (const defiNet* obj); +EXTERN const char* defiNet_pattern (const defiNet* obj); +EXTERN double defiNet_cap (const defiNet* obj); +EXTERN const char* defiNet_use (const defiNet* obj); +EXTERN int defiNet_style (const defiNet* obj); +EXTERN const char* defiNet_nonDefaultRule (const defiNet* obj); + + /* WMD -- the following will be removed by the next release */ +EXTERN int defiNet_numPaths (const defiNet* obj); + +EXTERN const defiPath* defiNet_path (const defiNet* obj, int index); + +EXTERN int defiNet_numShields (const defiNet* obj); + +EXTERN const defiShield* defiNet_shield (const defiNet* obj, int index); + +EXTERN int defiNet_numShieldNets (const defiNet* obj); +EXTERN const char* defiNet_shieldNet (const defiNet* obj, int index); +EXTERN int defiNet_numNoShields (const defiNet* obj); + +EXTERN const defiShield* defiNet_noShield (const defiNet* obj, int index); + + /* 5.6 */ +EXTERN int defiNet_numPolygons (const defiNet* obj); +EXTERN const char* defiNet_polygonName (const defiNet* obj, int index); +EXTERN struct defiPoints defiNet_getPolygon (const defiNet* obj, int index); +EXTERN int defiNet_polyMask (const defiNet* obj, int index); +EXTERN const char* defiNet_polyRouteStatus (const defiNet* obj, int index); +EXTERN const char* defiNet_polyRouteStatusShieldName (const defiNet* obj, int index); +EXTERN const char* defiNet_polyShapeType (const defiNet* obj, int index); + +EXTERN int defiNet_numRectangles (const defiNet* obj); +EXTERN const char* defiNet_rectName (const defiNet* obj, int index); +EXTERN int defiNet_xl (const defiNet* obj, int index); +EXTERN int defiNet_yl (const defiNet* obj, int index); +EXTERN int defiNet_xh (const defiNet* obj, int index); +EXTERN int defiNet_yh (const defiNet* obj, int index); +EXTERN int defiNet_rectMask (const defiNet* obj, int index); +EXTERN const char* defiNet_rectRouteStatus (const defiNet* obj, int index); +EXTERN const char* defiNet_rectRouteStatusShieldName (const defiNet* obj, int index); +EXTERN const char* defiNet_rectShapeType (const defiNet* obj, int index); + + /* 5.8 */ +EXTERN int defiNet_numViaSpecs (const defiNet* obj); +EXTERN struct defiPoints defiNet_getViaPts (const defiNet* obj, int index); +EXTERN const char* defiNet_viaName (const defiNet* obj, int index); +EXTERN int defiNet_viaOrient (const defiNet* obj, int index); +EXTERN const char* defiNet_viaOrientStr (const defiNet* obj, int index); +EXTERN int defiNet_topMaskNum (const defiNet* obj, int index); +EXTERN int defiNet_cutMaskNum (const defiNet* obj, int index); +EXTERN int defiNet_bottomMaskNum (const defiNet* obj, int index); +EXTERN const char* defiNet_viaRouteStatus (const defiNet* obj, int index); +EXTERN const char* defiNet_viaRouteStatusShieldName (const defiNet* obj, int index); +EXTERN const char* defiNet_viaShapeType (const defiNet* obj, int index); + + /* Debug printing */ +EXTERN void defiNet_print (const defiNet* obj, FILE* f); + + /* The method freeWire() is added is user select to have a callback */ + /* per wire within a net This is an internal method and is not public */ + + /* Clear the rectangles & polygons data if partial path callback is set */ + + /* WMD -- the following will be removed by the nex release */ + + /* WMD -- the following will be removed by the nex release */ + +#endif diff --git a/src/def/cdef/defiNonDefault.h b/src/def/cdef/defiNonDefault.h new file mode 100644 index 00000000..fe5da5aa --- /dev/null +++ b/src/def/cdef/defiNonDefault.h @@ -0,0 +1,79 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFINONDEFAULT_H +#define CDEFINONDEFAULT_H + +#include +#include "defiTypedefs.h" + +EXTERN const char* defiNonDefault_name (const defiNonDefault* obj); +EXTERN int defiNonDefault_hasHardspacing (const defiNonDefault* obj); + +EXTERN int defiNonDefault_numProps (const defiNonDefault* obj); +EXTERN const char* defiNonDefault_propName (const defiNonDefault* obj, int index); +EXTERN const char* defiNonDefault_propValue (const defiNonDefault* obj, int index); +EXTERN double defiNonDefault_propNumber (const defiNonDefault* obj, int index); +EXTERN char defiNonDefault_propType (const defiNonDefault* obj, int index); +EXTERN int defiNonDefault_propIsNumber (const defiNonDefault* obj, int index); +EXTERN int defiNonDefault_propIsString (const defiNonDefault* obj, int index); + + /* A non default rule can have one or more layers. */ + /* The layer information is kept in an array. */ +EXTERN int defiNonDefault_numLayers (const defiNonDefault* obj); +EXTERN const char* defiNonDefault_layerName (const defiNonDefault* obj, int index); +EXTERN double defiNonDefault_layerWidth (const defiNonDefault* obj, int index); +EXTERN int defiNonDefault_layerWidthVal (const defiNonDefault* obj, int index); +EXTERN int defiNonDefault_hasLayerDiagWidth (const defiNonDefault* obj, int index); +EXTERN double defiNonDefault_layerDiagWidth (const defiNonDefault* obj, int index); +EXTERN int defiNonDefault_layerDiagWidthVal (const defiNonDefault* obj, int index); +EXTERN int defiNonDefault_hasLayerSpacing (const defiNonDefault* obj, int index); +EXTERN double defiNonDefault_layerSpacing (const defiNonDefault* obj, int index); +EXTERN int defiNonDefault_layerSpacingVal (const defiNonDefault* obj, int index); +EXTERN int defiNonDefault_hasLayerWireExt (const defiNonDefault* obj, int index); +EXTERN double defiNonDefault_layerWireExt (const defiNonDefault* obj, int index); +EXTERN int defiNonDefault_layerWireExtVal (const defiNonDefault* obj, int index); +EXTERN int defiNonDefault_numVias (const defiNonDefault* obj); +EXTERN const char* defiNonDefault_viaName (const defiNonDefault* obj, int index); +EXTERN int defiNonDefault_numViaRules (const defiNonDefault* obj); +EXTERN const char* defiNonDefault_viaRuleName (const defiNonDefault* obj, int index); +EXTERN int defiNonDefault_numMinCuts (const defiNonDefault* obj); +EXTERN const char* defiNonDefault_cutLayerName (const defiNonDefault* obj, int index); +EXTERN int defiNonDefault_numCuts (const defiNonDefault* obj, int index); + + /* Debug print */ +EXTERN void defiNonDefault_print (const defiNonDefault* obj, FILE* f); + + /* Layer information */ + +#endif diff --git a/src/def/cdef/defiPartition.h b/src/def/cdef/defiPartition.h new file mode 100644 index 00000000..183af732 --- /dev/null +++ b/src/def/cdef/defiPartition.h @@ -0,0 +1,84 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFIPARTITION_H +#define CDEFIPARTITION_H + +#include +#include "defiTypedefs.h" + +EXTERN const char* defiPartition_name (const defiPartition* obj); +EXTERN char defiPartition_direction (const defiPartition* obj); +EXTERN const char* defiPartition_itemType (const defiPartition* obj); +EXTERN const char* defiPartition_pinName (const defiPartition* obj); +EXTERN const char* defiPartition_instName (const defiPartition* obj); + +EXTERN int defiPartition_numPins (const defiPartition* obj); +EXTERN const char* defiPartition_pin (const defiPartition* obj, int index); + +EXTERN int defiPartition_isSetupRise (const defiPartition* obj); +EXTERN int defiPartition_isSetupFall (const defiPartition* obj); +EXTERN int defiPartition_isHoldRise (const defiPartition* obj); +EXTERN int defiPartition_isHoldFall (const defiPartition* obj); +EXTERN int defiPartition_hasMin (const defiPartition* obj); +EXTERN int defiPartition_hasMax (const defiPartition* obj); +EXTERN int defiPartition_hasRiseMin (const defiPartition* obj); +EXTERN int defiPartition_hasFallMin (const defiPartition* obj); +EXTERN int defiPartition_hasRiseMax (const defiPartition* obj); +EXTERN int defiPartition_hasFallMax (const defiPartition* obj); +EXTERN int defiPartition_hasRiseMinRange (const defiPartition* obj); +EXTERN int defiPartition_hasFallMinRange (const defiPartition* obj); +EXTERN int defiPartition_hasRiseMaxRange (const defiPartition* obj); +EXTERN int defiPartition_hasFallMaxRange (const defiPartition* obj); + +EXTERN double defiPartition_partitionMin (const defiPartition* obj); +EXTERN double defiPartition_partitionMax (const defiPartition* obj); + +EXTERN double defiPartition_riseMin (const defiPartition* obj); +EXTERN double defiPartition_fallMin (const defiPartition* obj); +EXTERN double defiPartition_riseMax (const defiPartition* obj); +EXTERN double defiPartition_fallMax (const defiPartition* obj); + +EXTERN double defiPartition_riseMinLeft (const defiPartition* obj); +EXTERN double defiPartition_fallMinLeft (const defiPartition* obj); +EXTERN double defiPartition_riseMaxLeft (const defiPartition* obj); +EXTERN double defiPartition_fallMaxLeft (const defiPartition* obj); +EXTERN double defiPartition_riseMinRight (const defiPartition* obj); +EXTERN double defiPartition_fallMinRight (const defiPartition* obj); +EXTERN double defiPartition_riseMaxRight (const defiPartition* obj); +EXTERN double defiPartition_fallMaxRight (const defiPartition* obj); + + /* debug print */ +EXTERN void defiPartition_print (const defiPartition* obj, FILE* f); + +#endif diff --git a/src/def/cdef/defiPath.h b/src/def/cdef/defiPath.h new file mode 100644 index 00000000..ab0daf99 --- /dev/null +++ b/src/def/cdef/defiPath.h @@ -0,0 +1,98 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013-2014, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFIPATH_H +#define CDEFIPATH_H + +#include +#include "defiTypedefs.h" + +/* TX_DIR:TRANSLATION ON */ + +/* 5.4.1 1-D & 2-D Arrays of Vias in SPECIALNET Section */ + +/* value returned by the next() routine. */ +enum defiPath_e { + DEFIPATH_DONE = 0, + DEFIPATH_LAYER = 1, + DEFIPATH_VIA = 2, + DEFIPATH_VIAROTATION = 3, + DEFIPATH_WIDTH = 4, + DEFIPATH_POINT = 5, + DEFIPATH_FLUSHPOINT = 6, + DEFIPATH_TAPER = 7, + DEFIPATH_SHAPE = 8, + DEFIPATH_STYLE = 9, + DEFIPATH_TAPERRULE = 10, + DEFIPATH_VIADATA = 11, + DEFIPATH_RECT = 12, + DEFIPATH_VIRTUALPOINT = 13, + DEFIPATH_MASK = 14, + DEFIPATH_VIAMASK = 15 + } ; + + /* This is 'data ownership transfer' constructor. */ + + /* To traverse the path and get the parts. */ +EXTERN void defiPath_initTraverse (const defiPath* obj); +EXTERN void defiPath_initTraverseBackwards (const defiPath* obj); +EXTERN int defiPath_next (const defiPath* obj); +EXTERN int defiPath_prev (const defiPath* obj); +EXTERN const char* defiPath_getLayer (const defiPath* obj); +EXTERN const char* defiPath_getTaperRule (const defiPath* obj); +EXTERN const char* defiPath_getVia (const defiPath* obj); +EXTERN const char* defiPath_getShape (const defiPath* obj); +EXTERN int defiPath_getTaper (const defiPath* obj); +EXTERN int defiPath_getStyle (const defiPath* obj); +EXTERN int defiPath_getViaRotation (const defiPath* obj); +EXTERN void defiPath_getViaRect (const defiPath* obj, int* deltaX1, int* deltaY1, int* deltaX2, int* deltaY2); +EXTERN const char* defiPath_getViaRotationStr (const defiPath* obj); +EXTERN void defiPath_getViaData (const defiPath* obj, int* numX, int* numY, int* stepX, int* stepY); +EXTERN int defiPath_getWidth (const defiPath* obj); +EXTERN void defiPath_getPoint (const defiPath* obj, int* x, int* y); +EXTERN void defiPath_getFlushPoint (const defiPath* obj, int* x, int* y, int* ext); +EXTERN void defiPath_getVirtualPoint (const defiPath* obj, int* x, int* y); +EXTERN int defiPath_getMask (const defiPath* obj); +EXTERN int defiPath_getViaTopMask (const defiPath* obj); +EXTERN int defiPath_getViaCutMask (const defiPath* obj); +EXTERN int defiPath_getViaBottomMask (const defiPath* obj); +EXTERN int defiPath_getRectMask (const defiPath* obj); + + /* These routines are called by the parser to fill the path. */ + + /* debug printing */ +EXTERN void defiPath_print (const defiPath* obj, FILE* fout); + + /* as iterator in const traversal functions. */ + +#endif diff --git a/src/def/cdef/defiPinCap.h b/src/def/cdef/defiPinCap.h new file mode 100644 index 00000000..5b483db2 --- /dev/null +++ b/src/def/cdef/defiPinCap.h @@ -0,0 +1,194 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFIPINCAP_H +#define CDEFIPINCAP_H + +#include +#include "defiTypedefs.h" + +EXTERN int defiPinCap_pin (const defiPinCap* obj); +EXTERN double defiPinCap_cap (const defiPinCap* obj); + +EXTERN void defiPinCap_print (const defiPinCap* obj, FILE* f); + +/* 5.5 */ + +EXTERN char* defiPinAntennaModel_antennaOxide (const defiPinAntennaModel* obj); + +EXTERN int defiPinAntennaModel_hasAPinGateArea (const defiPinAntennaModel* obj); +EXTERN int defiPinAntennaModel_numAPinGateArea (const defiPinAntennaModel* obj); +EXTERN int defiPinAntennaModel_APinGateArea (const defiPinAntennaModel* obj, int index); +EXTERN int defiPinAntennaModel_hasAPinGateAreaLayer (const defiPinAntennaModel* obj, int index); +EXTERN const char* defiPinAntennaModel_APinGateAreaLayer (const defiPinAntennaModel* obj, int index); + +EXTERN int defiPinAntennaModel_hasAPinMaxAreaCar (const defiPinAntennaModel* obj); +EXTERN int defiPinAntennaModel_numAPinMaxAreaCar (const defiPinAntennaModel* obj); +EXTERN int defiPinAntennaModel_APinMaxAreaCar (const defiPinAntennaModel* obj, int index); +EXTERN int defiPinAntennaModel_hasAPinMaxAreaCarLayer (const defiPinAntennaModel* obj, int index); +EXTERN const char* defiPinAntennaModel_APinMaxAreaCarLayer (const defiPinAntennaModel* obj, int index); + +EXTERN int defiPinAntennaModel_hasAPinMaxSideAreaCar (const defiPinAntennaModel* obj); +EXTERN int defiPinAntennaModel_numAPinMaxSideAreaCar (const defiPinAntennaModel* obj); +EXTERN int defiPinAntennaModel_APinMaxSideAreaCar (const defiPinAntennaModel* obj, int index); +EXTERN int defiPinAntennaModel_hasAPinMaxSideAreaCarLayer (const defiPinAntennaModel* obj, int index); +EXTERN const char* defiPinAntennaModel_APinMaxSideAreaCarLayer (const defiPinAntennaModel* obj, int index); + +EXTERN int defiPinAntennaModel_hasAPinMaxCutCar (const defiPinAntennaModel* obj); +EXTERN int defiPinAntennaModel_numAPinMaxCutCar (const defiPinAntennaModel* obj); +EXTERN int defiPinAntennaModel_APinMaxCutCar (const defiPinAntennaModel* obj, int index); +EXTERN int defiPinAntennaModel_hasAPinMaxCutCarLayer (const defiPinAntennaModel* obj, int index); +EXTERN const char* defiPinAntennaModel_APinMaxCutCarLayer (const defiPinAntennaModel* obj, int index); + +EXTERN int defiPinPort_numLayer (const defiPinPort* obj); +EXTERN const char* defiPinPort_layer (const defiPinPort* obj, int index); +EXTERN void defiPinPort_bounds (const defiPinPort* obj, int index, int* xl, int* yl, int* xh, int* yh); +EXTERN int defiPinPort_hasLayerSpacing (const defiPinPort* obj, int index); +EXTERN int defiPinPort_hasLayerDesignRuleWidth (const defiPinPort* obj, int index); +EXTERN int defiPinPort_layerSpacing (const defiPinPort* obj, int index); +EXTERN int defiPinPort_layerMask (const defiPinPort* obj, int index); +EXTERN int defiPinPort_layerDesignRuleWidth (const defiPinPort* obj, int index); +EXTERN int defiPinPort_numPolygons (const defiPinPort* obj); +EXTERN const char* defiPinPort_polygonName (const defiPinPort* obj, int index); +EXTERN struct defiPoints defiPinPort_getPolygon (const defiPinPort* obj, int index); +EXTERN int defiPinPort_hasPolygonSpacing (const defiPinPort* obj, int index); +EXTERN int defiPinPort_hasPolygonDesignRuleWidth (const defiPinPort* obj, int index); +EXTERN int defiPinPort_polygonSpacing (const defiPinPort* obj, int index); +EXTERN int defiPinPort_polygonDesignRuleWidth (const defiPinPort* obj, int index); +EXTERN int defiPinPort_polygonMask (const defiPinPort* obj, int index); +EXTERN int defiPinPort_numVias (const defiPinPort* obj); +EXTERN const char* defiPinPort_viaName (const defiPinPort* obj, int index); +EXTERN int defiPinPort_viaPtX (const defiPinPort* obj, int index); +EXTERN int defiPinPort_viaPtY (const defiPinPort* obj, int index); +EXTERN int defiPinPort_viaTopMask (const defiPinPort* obj, int index); +EXTERN int defiPinPort_viaCutMask (const defiPinPort* obj, int index); +EXTERN int defiPinPort_viaBottomMask (const defiPinPort* obj, int index); +EXTERN int defiPinPort_hasPlacement (const defiPinPort* obj); +EXTERN int defiPinPort_isPlaced (const defiPinPort* obj); +EXTERN int defiPinPort_isCover (const defiPinPort* obj); +EXTERN int defiPinPort_isFixed (const defiPinPort* obj); +EXTERN int defiPinPort_placementX (const defiPinPort* obj); +EXTERN int defiPinPort_placementY (const defiPinPort* obj); +EXTERN int defiPinPort_orient (const defiPinPort* obj); +EXTERN const char* defiPinPort_orientStr (const defiPinPort* obj); + + /* 5.6 setLayer is changed to addLayer due to multiple LAYER are allowed */ + /* in 5.6 */ + /* 5.7 port statements, which may have LAYER, POLYGON, &| VIA */ + +EXTERN const char* defiPin_pinName (const defiPin* obj); +EXTERN const char* defiPin_netName (const defiPin* obj); + /* optional parts */ +EXTERN int defiPin_hasDirection (const defiPin* obj); +EXTERN int defiPin_hasUse (const defiPin* obj); +EXTERN int defiPin_hasLayer (const defiPin* obj); +EXTERN int defiPin_hasPlacement (const defiPin* obj); +EXTERN int defiPin_isUnplaced (const defiPin* obj); +EXTERN int defiPin_isPlaced (const defiPin* obj); +EXTERN int defiPin_isCover (const defiPin* obj); +EXTERN int defiPin_isFixed (const defiPin* obj); +EXTERN int defiPin_placementX (const defiPin* obj); +EXTERN int defiPin_placementY (const defiPin* obj); +EXTERN const char* defiPin_direction (const defiPin* obj); +EXTERN const char* defiPin_use (const defiPin* obj); +EXTERN int defiPin_numLayer (const defiPin* obj); +EXTERN const char* defiPin_layer (const defiPin* obj, int index); +EXTERN void defiPin_bounds (const defiPin* obj, int index, int* xl, int* yl, int* xh, int* yh); +EXTERN int defiPin_layerMask (const defiPin* obj, int index); +EXTERN int defiPin_hasLayerSpacing (const defiPin* obj, int index); +EXTERN int defiPin_hasLayerDesignRuleWidth (const defiPin* obj, int index); +EXTERN int defiPin_layerSpacing (const defiPin* obj, int index); +EXTERN int defiPin_layerDesignRuleWidth (const defiPin* obj, int index); +EXTERN int defiPin_numPolygons (const defiPin* obj); +EXTERN const char* defiPin_polygonName (const defiPin* obj, int index); +EXTERN struct defiPoints defiPin_getPolygon (const defiPin* obj, int index); +EXTERN int defiPin_polygonMask (const defiPin* obj, int index); +EXTERN int defiPin_hasPolygonSpacing (const defiPin* obj, int index); +EXTERN int defiPin_hasPolygonDesignRuleWidth (const defiPin* obj, int index); +EXTERN int defiPin_polygonSpacing (const defiPin* obj, int index); +EXTERN int defiPin_polygonDesignRuleWidth (const defiPin* obj, int index); +EXTERN int defiPin_hasNetExpr (const defiPin* obj); +EXTERN int defiPin_hasSupplySensitivity (const defiPin* obj); +EXTERN int defiPin_hasGroundSensitivity (const defiPin* obj); +EXTERN const char* defiPin_netExpr (const defiPin* obj); +EXTERN const char* defiPin_supplySensitivity (const defiPin* obj); +EXTERN const char* defiPin_groundSensitivity (const defiPin* obj); +EXTERN int defiPin_orient (const defiPin* obj); +EXTERN const char* defiPin_orientStr (const defiPin* obj); +EXTERN int defiPin_hasSpecial (const defiPin* obj); +EXTERN int defiPin_numVias (const defiPin* obj); +EXTERN const char* defiPin_viaName (const defiPin* obj, int index); +EXTERN int defiPin_viaTopMask (const defiPin* obj, int index); +EXTERN int defiPin_viaCutMask (const defiPin* obj, int index); +EXTERN int defiPin_viaBottomMask (const defiPin* obj, int index); +EXTERN int defiPin_viaPtX (const defiPin* obj, int index); +EXTERN int defiPin_viaPtY (const defiPin* obj, int index); + + /* 5.4 */ +EXTERN int defiPin_hasAPinPartialMetalArea (const defiPin* obj); +EXTERN int defiPin_numAPinPartialMetalArea (const defiPin* obj); +EXTERN int defiPin_APinPartialMetalArea (const defiPin* obj, int index); +EXTERN int defiPin_hasAPinPartialMetalAreaLayer (const defiPin* obj, int index); +EXTERN const char* defiPin_APinPartialMetalAreaLayer (const defiPin* obj, int index); + +EXTERN int defiPin_hasAPinPartialMetalSideArea (const defiPin* obj); +EXTERN int defiPin_numAPinPartialMetalSideArea (const defiPin* obj); +EXTERN int defiPin_APinPartialMetalSideArea (const defiPin* obj, int index); +EXTERN int defiPin_hasAPinPartialMetalSideAreaLayer (const defiPin* obj, int index); +EXTERN const char* defiPin_APinPartialMetalSideAreaLayer (const defiPin* obj, int index); + +EXTERN int defiPin_hasAPinDiffArea (const defiPin* obj); +EXTERN int defiPin_numAPinDiffArea (const defiPin* obj); +EXTERN int defiPin_APinDiffArea (const defiPin* obj, int index); +EXTERN int defiPin_hasAPinDiffAreaLayer (const defiPin* obj, int index); +EXTERN const char* defiPin_APinDiffAreaLayer (const defiPin* obj, int index); + +EXTERN int defiPin_hasAPinPartialCutArea (const defiPin* obj); +EXTERN int defiPin_numAPinPartialCutArea (const defiPin* obj); +EXTERN int defiPin_APinPartialCutArea (const defiPin* obj, int index); +EXTERN int defiPin_hasAPinPartialCutAreaLayer (const defiPin* obj, int index); +EXTERN const char* defiPin_APinPartialCutAreaLayer (const defiPin* obj, int index); + + /* 5.5 */ +EXTERN int defiPin_numAntennaModel (const defiPin* obj); +EXTERN const defiPinAntennaModel* defiPin_antennaModel (const defiPin* obj, int index); + + /* 5.7 */ +EXTERN int defiPin_hasPort (const defiPin* obj); +EXTERN int defiPin_numPorts (const defiPin* obj); +EXTERN const defiPinPort* defiPin_pinPort (const defiPin* obj, int index); +EXTERN void defiPin_print (const defiPin* obj, FILE* f); + + /* 5.5 AntennaModel */ + +#endif diff --git a/src/def/cdef/defiPinProp.h b/src/def/cdef/defiPinProp.h new file mode 100644 index 00000000..aca15104 --- /dev/null +++ b/src/def/cdef/defiPinProp.h @@ -0,0 +1,54 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFIPINPROP_H +#define CDEFIPINPROP_H + +#include +#include "defiTypedefs.h" + +EXTERN int defiPinProp_isPin (const defiPinProp* obj); +EXTERN const char* defiPinProp_instName (const defiPinProp* obj); +EXTERN const char* defiPinProp_pinName (const defiPinProp* obj); + +EXTERN int defiPinProp_numProps (const defiPinProp* obj); +EXTERN const char* defiPinProp_propName (const defiPinProp* obj, int index); +EXTERN const char* defiPinProp_propValue (const defiPinProp* obj, int index); +EXTERN double defiPinProp_propNumber (const defiPinProp* obj, int index); +EXTERN char defiPinProp_propType (const defiPinProp* obj, int index); +EXTERN int defiPinProp_propIsNumber (const defiPinProp* obj, int index); +EXTERN int defiPinProp_propIsString (const defiPinProp* obj, int index); + +EXTERN void defiPinProp_print (const defiPinProp* obj, FILE* f); + +#endif diff --git a/src/def/cdef/defiProp.h b/src/def/cdef/defiProp.h new file mode 100644 index 00000000..d8a9cca3 --- /dev/null +++ b/src/def/cdef/defiProp.h @@ -0,0 +1,59 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFIPROP_H +#define CDEFIPROP_H + +#include +#include "defiTypedefs.h" + +/* Struct holds the data for one property. */ + +EXTERN const char* defiProp_string (const defiProp* obj); +EXTERN const char* defiProp_propType (const defiProp* obj); +EXTERN const char* defiProp_propName (const defiProp* obj); +EXTERN char defiProp_dataType (const defiProp* obj); + /* either I:integer R:real S:string Q:quotedstring N:nameMapString */ +EXTERN int defiProp_hasNumber (const defiProp* obj); +EXTERN int defiProp_hasRange (const defiProp* obj); +EXTERN int defiProp_hasString (const defiProp* obj); +EXTERN int defiProp_hasNameMapString (const defiProp* obj); +EXTERN double defiProp_number (const defiProp* obj); +EXTERN double defiProp_left (const defiProp* obj); +EXTERN double defiProp_right (const defiProp* obj); + +EXTERN void defiProp_print (const defiProp* obj, FILE* f); + + /* N:nameMapString */ + +#endif diff --git a/src/def/cdef/defiPropType.h b/src/def/cdef/defiPropType.h new file mode 100644 index 00000000..40608f03 --- /dev/null +++ b/src/def/cdef/defiPropType.h @@ -0,0 +1,45 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFIPROPTYPE_H +#define CDEFIPROPTYPE_H + +#include +#include "defiTypedefs.h" + +/* Struct holds the data type for one property, if the property is */ +/* either REAL or INTEGER. */ + +EXTERN char defiPropType_propType (const defiPropType* obj, char* name); + +#endif diff --git a/src/def/cdef/defiRegion.h b/src/def/cdef/defiRegion.h new file mode 100644 index 00000000..ecebad1f --- /dev/null +++ b/src/def/cdef/defiRegion.h @@ -0,0 +1,63 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFIREGION_H +#define CDEFIREGION_H + +#include +#include "defiTypedefs.h" + +/* Struct holds the data for one property. */ + +EXTERN const char* defiRegion_name (const defiRegion* obj); + +EXTERN int defiRegion_numProps (const defiRegion* obj); +EXTERN const char* defiRegion_propName (const defiRegion* obj, int index); +EXTERN const char* defiRegion_propValue (const defiRegion* obj, int index); +EXTERN double defiRegion_propNumber (const defiRegion* obj, int index); +EXTERN char defiRegion_propType (const defiRegion* obj, int index); +EXTERN int defiRegion_propIsNumber (const defiRegion* obj, int index); +EXTERN int defiRegion_propIsString (const defiRegion* obj, int index); + +EXTERN int defiRegion_hasType (const defiRegion* obj); +EXTERN const char* defiRegion_type (const defiRegion* obj); + +EXTERN int defiRegion_numRectangles (const defiRegion* obj); +EXTERN int defiRegion_xl (const defiRegion* obj, int index); +EXTERN int defiRegion_yl (const defiRegion* obj, int index); +EXTERN int defiRegion_xh (const defiRegion* obj, int index); +EXTERN int defiRegion_yh (const defiRegion* obj, int index); + +EXTERN void defiRegion_print (const defiRegion* obj, FILE* f); + +#endif diff --git a/src/def/cdef/defiRowTrack.h b/src/def/cdef/defiRowTrack.h new file mode 100644 index 00000000..aade5817 --- /dev/null +++ b/src/def/cdef/defiRowTrack.h @@ -0,0 +1,81 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFIROWTRACK_H +#define CDEFIROWTRACK_H + +#include +#include "defiTypedefs.h" + +EXTERN const char* defiRow_name (const defiRow* obj); +EXTERN const char* defiRow_macro (const defiRow* obj); +EXTERN double defiRow_x (const defiRow* obj); +EXTERN double defiRow_y (const defiRow* obj); +EXTERN int defiRow_orient (const defiRow* obj); +EXTERN const char* defiRow_orientStr (const defiRow* obj); +EXTERN int defiRow_hasDo (const defiRow* obj); +EXTERN double defiRow_xNum (const defiRow* obj); +EXTERN double defiRow_yNum (const defiRow* obj); +EXTERN int defiRow_hasDoStep (const defiRow* obj); +EXTERN double defiRow_xStep (const defiRow* obj); +EXTERN double defiRow_yStep (const defiRow* obj); + +EXTERN int defiRow_numProps (const defiRow* obj); +EXTERN const char* defiRow_propName (const defiRow* obj, int index); +EXTERN const char* defiRow_propValue (const defiRow* obj, int index); +EXTERN double defiRow_propNumber (const defiRow* obj, int index); +EXTERN char defiRow_propType (const defiRow* obj, int index); +EXTERN int defiRow_propIsNumber (const defiRow* obj, int index); +EXTERN int defiRow_propIsString (const defiRow* obj, int index); + +EXTERN void defiRow_print (const defiRow* obj, FILE* f); + +EXTERN const char* defiTrack_macro (const defiTrack* obj); +EXTERN double defiTrack_x (const defiTrack* obj); +EXTERN double defiTrack_xNum (const defiTrack* obj); +EXTERN double defiTrack_xStep (const defiTrack* obj); +EXTERN int defiTrack_numLayers (const defiTrack* obj); +EXTERN const char* defiTrack_layer (const defiTrack* obj, int index); +EXTERN int defiTrack_firstTrackMask (const defiTrack* obj); +EXTERN int defiTrack_sameMask (const defiTrack* obj); + +EXTERN void defiTrack_print (const defiTrack* obj, FILE* f); + +EXTERN const char* defiGcellGrid_macro (const defiGcellGrid* obj); +EXTERN int defiGcellGrid_x (const defiGcellGrid* obj); +EXTERN int defiGcellGrid_xNum (const defiGcellGrid* obj); +EXTERN double defiGcellGrid_xStep (const defiGcellGrid* obj); + +EXTERN void defiGcellGrid_print (const defiGcellGrid* obj, FILE* f); + +#endif diff --git a/src/def/cdef/defiScanchain.h b/src/def/cdef/defiScanchain.h new file mode 100644 index 00000000..8449c4ff --- /dev/null +++ b/src/def/cdef/defiScanchain.h @@ -0,0 +1,93 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFISCANCHAIN_H +#define CDEFISCANCHAIN_H + +#include +#include "defiTypedefs.h" + +EXTERN int defiOrdered_num (const defiOrdered* obj); +EXTERN char** defiOrdered_inst (const defiOrdered* obj); +EXTERN char** defiOrdered_in (const defiOrdered* obj); +EXTERN char** defiOrdered_out (const defiOrdered* obj); +EXTERN int* defiOrdered_bits (const defiOrdered* obj); + +/* Struct holds the data for one Scan chain. */ +/* */ + +EXTERN const char* defiScanchain_name (const defiScanchain* obj); +EXTERN int defiScanchain_hasStart (const defiScanchain* obj); +EXTERN int defiScanchain_hasStop (const defiScanchain* obj); +EXTERN int defiScanchain_hasFloating (const defiScanchain* obj); +EXTERN int defiScanchain_hasOrdered (const defiScanchain* obj); +EXTERN int defiScanchain_hasCommonInPin (const defiScanchain* obj); +EXTERN int defiScanchain_hasCommonOutPin (const defiScanchain* obj); +EXTERN int defiScanchain_hasPartition (const defiScanchain* obj); +EXTERN int defiScanchain_hasPartitionMaxBits (const defiScanchain* obj); + + /* If the pin part of these routines were not supplied in the DEF */ + /* then a NULL pointer will be returned. */ +EXTERN void defiScanchain_start (const defiScanchain* obj, char** inst, char** pin); +EXTERN void defiScanchain_stop (const defiScanchain* obj, char** inst, char** pin); + + /* There could be many ORDERED constructs in the DEF. The data in */ + /* each ORDERED construct is stored in its own array. The numOrderedLists( */ + /* routine tells how many lists there are. */ +EXTERN int defiScanchain_numOrderedLists (const defiScanchain* obj); + + /* This routine will return an array of instances and */ + /* an array of in and out pins. */ + /* The number if things in the arrays is returned in size. */ + /* The inPin and outPin entry is optional for each instance. */ + /* If an entry is not given, then that char* is NULL. */ + /* For example if the second instance has */ + /* instnam= "FOO" and IN="A", but no OUT given, then inst[1] points */ + /* to "FOO" inPin[1] points to "A" and outPin[1] is a NULL pointer. */ +EXTERN void defiScanchain_ordered (const defiScanchain* obj, int index, int* size, char*** inst, char*** inPin, char*** outPin, int** bits); + + /* All of the floating constructs in the scan chain are */ + /* stored in this one array. */ + /* If the IN or OUT of an entry is not supplied then the array will have */ + /* a NULL pointer in that place. */ +EXTERN void defiScanchain_floating (const defiScanchain* obj, int* size, char*** inst, char*** inPin, char*** outPin, int** bits); + +EXTERN const char* defiScanchain_commonInPin (const defiScanchain* obj); +EXTERN const char* defiScanchain_commonOutPin (const defiScanchain* obj); + +EXTERN const char* defiScanchain_partitionName (const defiScanchain* obj); +EXTERN int defiScanchain_partitionMaxBits (const defiScanchain* obj); + +EXTERN void defiScanchain_print (const defiScanchain* obj, FILE* f); + +#endif diff --git a/src/def/cdef/defiSite.h b/src/def/cdef/defiSite.h new file mode 100644 index 00000000..7353ceb8 --- /dev/null +++ b/src/def/cdef/defiSite.h @@ -0,0 +1,74 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFISITE_H +#define CDEFISITE_H + +#include +#include "defiTypedefs.h" + +/* + * Struct holds the data for one site. + * It is also used for a canplace and cannotoccupy. + */ + +EXTERN double defiSite_x_num (const defiSite* obj); +EXTERN double defiSite_y_num (const defiSite* obj); +EXTERN double defiSite_x_step (const defiSite* obj); +EXTERN double defiSite_y_step (const defiSite* obj); +EXTERN double defiSite_x_orig (const defiSite* obj); +EXTERN double defiSite_y_orig (const defiSite* obj); +EXTERN int defiSite_orient (const defiSite* obj); +EXTERN const char* defiSite_orientStr (const defiSite* obj); +EXTERN const char* defiSite_name (const defiSite* obj); + +EXTERN void defiSite_print (const defiSite* obj, FILE* f); + +/* Struct holds the data for a Box */ + /* Use the default destructor and constructor. */ + /* 5.6 changed to use it own constructor & destructor */ + + /* NOTE: 5.6 */ + /* The following methods are still here for backward compatibility */ + /* For new reader they should use numPoints & getPoint to get the */ + /* data. */ +EXTERN int defiBox_xl (const defiBox* obj); +EXTERN int defiBox_yl (const defiBox* obj); +EXTERN int defiBox_xh (const defiBox* obj); +EXTERN int defiBox_yh (const defiBox* obj); + +EXTERN struct defiPoints defiBox_getPoint (const defiBox* obj); + +EXTERN void defiBox_print (const defiBox* obj, FILE* f); + +#endif diff --git a/src/def/cdef/defiSlot.h b/src/def/cdef/defiSlot.h new file mode 100644 index 00000000..a1194234 --- /dev/null +++ b/src/def/cdef/defiSlot.h @@ -0,0 +1,54 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFISLOT_H +#define CDEFISLOT_H + +#include +#include "defiTypedefs.h" + +EXTERN int defiSlot_hasLayer (const defiSlot* obj); +EXTERN const char* defiSlot_layerName (const defiSlot* obj); + +EXTERN int defiSlot_numRectangles (const defiSlot* obj); +EXTERN int defiSlot_xl (const defiSlot* obj, int index); +EXTERN int defiSlot_yl (const defiSlot* obj, int index); +EXTERN int defiSlot_xh (const defiSlot* obj, int index); +EXTERN int defiSlot_yh (const defiSlot* obj, int index); + +EXTERN int defiSlot_numPolygons (const defiSlot* obj); +EXTERN struct defiPoints defiSlot_getPolygon (const defiSlot* obj, int index); + +EXTERN void defiSlot_print (const defiSlot* obj, FILE* f); + +#endif diff --git a/src/def/cdef/defiTimingDisable.h b/src/def/cdef/defiTimingDisable.h new file mode 100644 index 00000000..5106ae9f --- /dev/null +++ b/src/def/cdef/defiTimingDisable.h @@ -0,0 +1,60 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFITIMINGDISABLE_H +#define CDEFITIMINGDISABLE_H + +#include +#include "defiTypedefs.h" + +/* A Timing disable can be a from-to or a thru or a macro. */ +/* A macro is either a fromto macro or a thru macro. */ + +EXTERN int defiTimingDisable_hasMacroThru (const defiTimingDisable* obj); +EXTERN int defiTimingDisable_hasMacroFromTo (const defiTimingDisable* obj); +EXTERN int defiTimingDisable_hasThru (const defiTimingDisable* obj); +EXTERN int defiTimingDisable_hasFromTo (const defiTimingDisable* obj); +EXTERN int defiTimingDisable_hasReentrantPathsFlag (const defiTimingDisable* obj); + +EXTERN const char* defiTimingDisable_fromPin (const defiTimingDisable* obj); +EXTERN const char* defiTimingDisable_toPin (const defiTimingDisable* obj); +EXTERN const char* defiTimingDisable_fromInst (const defiTimingDisable* obj); +EXTERN const char* defiTimingDisable_toInst (const defiTimingDisable* obj); +EXTERN const char* defiTimingDisable_macroName (const defiTimingDisable* obj); +EXTERN const char* defiTimingDisable_thruPin (const defiTimingDisable* obj); +EXTERN const char* defiTimingDisable_thruInst (const defiTimingDisable* obj); + + /* debug print */ +EXTERN void defiTimingDisable_print (const defiTimingDisable* obj, FILE* f); + +#endif diff --git a/src/def/cdef/defiTypedefs.h b/src/def/cdef/defiTypedefs.h new file mode 100644 index 00000000..08580948 --- /dev/null +++ b/src/def/cdef/defiTypedefs.h @@ -0,0 +1,115 @@ + /* ***************************************************************************** */ + /* ***************************************************************************** */ + /* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ + /* ***************************************************************************** */ + /* ***************************************************************************** */ + /* Copyright 2012, Cadence Design Systems */ + /* */ + /* This file is part of the Cadence LEF/DEF Open Source */ + /* Distribution, Product Version 5.8. */ + /* */ + /* Licensed under the Apache License, Version 2.0 (the \"License\"); */ + /* you may not use this file except in compliance with the License. */ + /* You may obtain a copy of the License at */ + /* */ + /* http://www.apache.org/licenses/LICENSE-2.0 */ + /* */ + /* Unless required by applicable law or agreed to in writing, software */ + /* distributed under the License is distributed on an \"AS IS\" BASIS, */ + /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ + /* implied. See the License for the specific language governing */ + /* permissions and limitations under the License. */ + /* */ + /* */ + /* For updates, support, or to become part of the LEF/DEF Community, */ + /* check www.openeda.org for details. */ + /* */ + /* $Author: xxx $ */ + /* $Revision: xxx $ */ + /* $Date: xxx $ */ + /* $State: xxx $ */ + /* ***************************************************************************** */ + /* ***************************************************************************** */ + +#ifndef CLEFITYPEDEFS_H +#define CLEFITYPEDEFS_H + +#ifndef EXTERN +#define EXTERN extern +#endif + +#define bool int +#define defiUserData void * +#define defiUserDataHandle void ** + +/* Typedefs */ + +/* Pointers to C++ classes */ +typedef void *defiPinPort; +typedef void *defiTimingDisable; +typedef void *defiPartition; +typedef void *defiAssertion; +typedef void *defiPinAntennaModel; +typedef void *defiIOTiming; +typedef void *defiRegion; +typedef void *defiSubnet; +typedef void *defiTrack; +typedef void *defiProp; +typedef void *defiRow; +typedef void *defiFPC; +typedef void *defiShield; +typedef void *defiVia; +typedef void *defiNonDefault; +typedef void *defiBox; +typedef void *defiWire; +typedef void *defiOrdered; +typedef void *defiPropType; +typedef void *defiAlias_itr; +typedef void *defiScanchain; +typedef void *defiComponent; +typedef void *defiFill; +typedef void *defiSite; +typedef void *defiPin; +typedef void *defiPinProp; +typedef void *defiStyles; +typedef void *defiBlockage; +typedef void *defiGeometries; +typedef void *defiVpin; +typedef void *defiNet; +typedef void *defiSlot; +typedef void *defiGcellGrid; +typedef void *defiPath; +typedef void *defiGroup; +typedef void *defiPinCap; +typedef void *defiComponentMaskShiftLayer; +typedef void *defrData; + +/* Data structures definitions */ +struct defiPoints { + int numPoints; + int* x; + int* y; +}; + +struct defiPnt { + int x; + int y; + int ext; +}; + +struct defiViaData { + int numX; + int numY; + int stepX; + int stepY; +}; + +struct defiViaRect { + int deltaX1; + int deltaY1; + int deltaX2; + int deltaY2; +}; + + +#endif diff --git a/src/def/cdef/defiUser.h b/src/def/cdef/defiUser.h new file mode 100644 index 00000000..6a113a51 --- /dev/null +++ b/src/def/cdef/defiUser.h @@ -0,0 +1,89 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + +/* + * User header file for the DEF Interface. This includes + * all of the header files which are relevant to both the + * reader and the writer. + * + * defrReader.h and defwWriter.h include this file, so that + * an application only needs to include either defwReader.h + * or defwWriter.h. + */ + + +#ifndef CDEFIUSER_H +#define CDEFIUSER_H + +#include "defiAlias.h" +#include "defiAssertion.h" +#include "defiBlockage.h" +#include "defiComponent.h" +#include "defiDebug.h" +#include "defiFill.h" +#include "defiFPC.h" +#include "defiGroup.h" +#include "defiIOTiming.h" +#include "defiMisc.h" +#include "defiNet.h" +#include "defiNonDefault.h" +#include "defiPartition.h" +#include "defiPath.h" +#include "defiPinCap.h" +#include "defiPinProp.h" +#include "defiProp.h" +#include "defiPropType.h" +#include "defiRegion.h" +#include "defiRowTrack.h" +#include "defiScanchain.h" +#include "defiSite.h" +#include "defiSlot.h" +#include "defiTimingDisable.h" +#include "defiVia.h" + + +/* General utilities. */ +/* #include "defiMalloc.hpp" */ +/* #include "defiUtils.hpp" */ + +/* + * API objects + */ + +/* NEW CALLBACK - If you are creating a new .cpp and .hpp file to + * describe a new class of object in the parser, then add a reference + * to the .hpp here. + * + * You must also add an entry for the .h and the .hpp in the package_list + * file of the ../../../release directory. */ + +#endif diff --git a/src/def/cdef/defiVia.h b/src/def/cdef/defiVia.h new file mode 100644 index 00000000..9d3d4171 --- /dev/null +++ b/src/def/cdef/defiVia.h @@ -0,0 +1,69 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFIVIA_H +#define CDEFIVIA_H + +#include +#include "defiTypedefs.h" + +/* Struct holds the data for one property. */ + + /* 5.6 */ + +EXTERN const char* defiVia_name (const defiVia* obj); +EXTERN const char* defiVia_pattern (const defiVia* obj); +EXTERN int defiVia_hasPattern (const defiVia* obj); +EXTERN int defiVia_numLayers (const defiVia* obj); +EXTERN void defiVia_layer (const defiVia* obj, int index, char** layer, int* xl, int* yl, int* xh, int* yh); +EXTERN int defiVia_numPolygons (const defiVia* obj); +EXTERN const char* defiVia_polygonName (const defiVia* obj, int index); +EXTERN struct defiPoints defiVia_getPolygon (const defiVia* obj, int index); +EXTERN int defiVia_hasViaRule (const defiVia* obj); +EXTERN void defiVia_viaRule (const defiVia* obj, char** viaRuleName, int* xSize, int* ySize, char** botLayer, char** cutLayer, char** topLayer, int* xCutSpacing, int* yCutSpacing, int* xBotEnc, int* yBotEnc, int* xTopEnc, int* yTopEnc); +EXTERN int defiVia_hasRowCol (const defiVia* obj); +EXTERN void defiVia_rowCol (const defiVia* obj, int* numCutRows, int* numCutCols); +EXTERN int defiVia_hasOrigin (const defiVia* obj); +EXTERN void defiVia_origin (const defiVia* obj, int* xOffset, int* yOffset); +EXTERN int defiVia_hasOffset (const defiVia* obj); +EXTERN void defiVia_offset (const defiVia* obj, int* xBotOffset, int* yBotOffset, int* xTopOffset, int* yTopOffset); +EXTERN int defiVia_hasCutPattern (const defiVia* obj); +EXTERN const char* defiVia_cutPattern (const defiVia* obj); +EXTERN int defiVia_hasRectMask (const defiVia* obj, int index); +EXTERN int defiVia_rectMask (const defiVia* obj, int index); +EXTERN int defiVia_hasPolyMask (const defiVia* obj, int index); +EXTERN int defiVia_polyMask (const defiVia* obj, int index); + +EXTERN void defiVia_print (const defiVia* obj, FILE* f); + +#endif diff --git a/src/def/cdef/defrReader.h b/src/def/cdef/defrReader.h new file mode 100644 index 00000000..de48194d --- /dev/null +++ b/src/def/cdef/defrReader.h @@ -0,0 +1,668 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013-2014, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFRREADER_H +#define CDEFRREADER_H + +#include +#include "defiTypedefs.h" + +#define DEF_MSGS 4013 +#define CBMAX 150 + +/* An enum describing all of the types of reader callbacks. */ +typedef enum { + defrUnspecifiedCbkType = 0, + defrDesignStartCbkType = 1, + defrTechNameCbkType = 2, + defrPropCbkType = 3, + defrPropDefEndCbkType = 4, + defrPropDefStartCbkType = 5, + defrFloorPlanNameCbkType = 6, + defrArrayNameCbkType = 7, + defrUnitsCbkType = 8, + defrDividerCbkType = 9, + defrBusBitCbkType = 10, + defrSiteCbkType = 11, + defrComponentStartCbkType = 12, + defrComponentCbkType = 13, + defrComponentEndCbkType = 14, + defrNetStartCbkType = 15, + defrNetCbkType = 16, + defrNetNameCbkType = 17, + defrNetNonDefaultRuleCbkType = 18, + defrNetSubnetNameCbkType = 19, + defrNetEndCbkType = 20, + defrPathCbkType = 21, + defrVersionCbkType = 22, + defrVersionStrCbkType = 23, + defrComponentExtCbkType = 24, + defrPinExtCbkType = 25, + defrViaExtCbkType = 26, + defrNetConnectionExtCbkType = 27, + defrNetExtCbkType = 28, + defrGroupExtCbkType = 29, + defrScanChainExtCbkType = 30, + defrIoTimingsExtCbkType = 31, + defrPartitionsExtCbkType = 32, + defrHistoryCbkType = 33, + defrDieAreaCbkType = 34, + defrCanplaceCbkType = 35, + defrCannotOccupyCbkType = 36, + defrPinCapCbkType = 37, + defrDefaultCapCbkType = 38, + defrStartPinsCbkType = 39, + defrPinCbkType = 40, + defrPinEndCbkType = 41, + defrRowCbkType = 42, + defrTrackCbkType = 43, + defrGcellGridCbkType = 44, + defrViaStartCbkType = 45, + defrViaCbkType = 46, + defrViaEndCbkType = 47, + defrRegionStartCbkType = 48, + defrRegionCbkType = 49, + defrRegionEndCbkType = 50, + defrSNetStartCbkType = 51, + defrSNetCbkType = 52, + defrSNetPartialPathCbkType = 53, + defrSNetWireCbkType = 54, + defrSNetEndCbkType = 55, + defrGroupsStartCbkType = 56, + defrGroupNameCbkType = 57, + defrGroupMemberCbkType = 58, + defrGroupCbkType = 59, + defrGroupsEndCbkType = 60, + defrAssertionsStartCbkType = 61, + defrAssertionCbkType = 62, + defrAssertionsEndCbkType = 63, + defrConstraintsStartCbkType = 64, + defrConstraintCbkType = 65, + defrConstraintsEndCbkType = 66, + defrScanchainsStartCbkType = 67, + defrScanchainCbkType = 68, + defrScanchainsEndCbkType = 69, + defrIOTimingsStartCbkType = 70, + defrIOTimingCbkType = 71, + defrIOTimingsEndCbkType = 72, + defrFPCStartCbkType = 73, + defrFPCCbkType = 74, + defrFPCEndCbkType = 75, + defrTimingDisablesStartCbkType = 76, + defrTimingDisableCbkType = 77, + defrTimingDisablesEndCbkType = 78, + defrPartitionsStartCbkType = 79, + defrPartitionCbkType = 80, + defrPartitionsEndCbkType = 81, + defrPinPropStartCbkType = 82, + defrPinPropCbkType = 83, + defrPinPropEndCbkType = 84, + defrBlockageStartCbkType = 85, + defrBlockageCbkType = 86, + defrBlockageEndCbkType = 87, + defrSlotStartCbkType = 88, + defrSlotCbkType = 89, + defrSlotEndCbkType = 90, + defrFillStartCbkType = 91, + defrFillCbkType = 92, + defrFillEndCbkType = 93, + defrCaseSensitiveCbkType = 94, + defrNonDefaultStartCbkType = 95, + defrNonDefaultCbkType = 96, + defrNonDefaultEndCbkType = 97, + defrStylesStartCbkType = 98, + defrStylesCbkType = 99, + defrStylesEndCbkType = 100, + defrExtensionCbkType = 101, + + /* NEW CALLBACK - If you are creating a new callback, you must add */ + /* a unique item to this enum for each callback routine. When the */ + /* callback is called in def.y you have to supply this enum item */ + /* as an argument in the call. */ + + defrComponentMaskShiftLayerCbkType = 102, + defrDesignEndCbkType = 103 +} defrCallbackType_e; + +/* Declarations of function signatures for each type of callback. */ +/* These declarations are type-safe when compiling with ANSI C */ +/* or C++; you will only be able to register a function pointer */ +/* with the correct signature for a given type of callback. */ +/* */ +/* Each callback function is expected to return 0 if successful. */ +/* A non-zero return code will cause the reader to abort. */ +/* */ +/* The defrDesignStart and defrDesignEnd callback is only called once. */ +/* Other callbacks may be called multiple times, each time with a different */ +/* set of data. */ +/* */ +/* For each callback, the Def API will make the callback to the */ +/* function supplied by the client, which should either make a copy */ +/* of the Def object, or store the data in the client's own data structures. */ +/* The Def API will delete or reuse each object after making the callback, */ +/* so the client should not keep a pointer to it. */ +/* */ +/* All callbacks pass the user data pointer provided in defrRead() */ +/* or defrSetUserData() back to the client; this can be used by the */ +/* client to obtain access to the rest of the client's data structures. */ +/* */ +/* The user data pointer is obtained using defrGetUserData() immediately */ +/* prior to making each callback, so the client is free to change the */ +/* user data on the fly if necessary. */ +/* */ +/* Callbacks with the same signature are passed a callback type */ +/* parameter, which allows an application to write a single callback */ +/* function, register that function for multiple callbacks, then */ +/* switch based on the callback type to handle the appropriate type of */ +/* data. */ + +/* A declaration of the signature of all callbacks that return nothing. */ +typedef int (*defrVoidCbkFnType) (defrCallbackType_e, void* v, defiUserData); + +/* A declaration of the signature of all callbacks that return a string. */ +typedef int (*defrStringCbkFnType) (defrCallbackType_e, const char *string, defiUserData); + +/* A declaration of the signature of all callbacks that return a integer. */ +typedef int (*defrIntegerCbkFnType) (defrCallbackType_e, int number, defiUserData); + +/* A declaration of the signature of all callbacks that return a double. */ +typedef int (*defrDoubleCbkFnType) (defrCallbackType_e, double number, defiUserData); + +/* A declaration of the signature of all callbacks that return a defiProp. */ +typedef int (*defrPropCbkFnType) (defrCallbackType_e, defiProp *prop, defiUserData); + +/* A declaration of the signature of all callbacks that return a defiSite. */ +typedef int (*defrSiteCbkFnType) (defrCallbackType_e, defiSite *site, defiUserData); + +/* A declaration of the signature of all callbacks that return a defComponent */ +typedef int (*defrComponentCbkFnType) (defrCallbackType_e, defiComponent *comp, defiUserData); + +/* A declaration of the signature of all callbacks that return a defComponent */ +typedef int (*defrComponentMaskShiftLayerCbkFnType) (defrCallbackType_e, defiComponentMaskShiftLayer *comp, defiUserData); + +/* A declaration of the signature of all callbacks that return a defNet. */ +typedef int (*defrNetCbkFnType) (defrCallbackType_e, defiNet *net, defiUserData); + +/* A declaration of the signature of all callbacks that return a defPath. */ +typedef int (*defrPathCbkFnType) (defrCallbackType_e, defiPath *path, defiUserData); + +/* A declaration of the signature of all callbacks that return a defiBox. */ +typedef int (*defrBoxCbkFnType) (defrCallbackType_e, defiBox *box, defiUserData); + +/* A declaration of the signature of all callbacks that return a defiPinCap. */ +typedef int (*defrPinCapCbkFnType) (defrCallbackType_e, defiPinCap *pincap, defiUserData); + +/* A declaration of the signature of all callbacks that return a defiPin. */ +typedef int (*defrPinCbkFnType) (defrCallbackType_e, defiPin *pin, defiUserData); + +/* A declaration of the signature of all callbacks that return a defiRow. */ +typedef int (*defrRowCbkFnType) (defrCallbackType_e, defiRow *row, defiUserData); + +/* A declaration of the signature of all callbacks that return a defiTrack. */ +typedef int (*defrTrackCbkFnType) (defrCallbackType_e, defiTrack *track, defiUserData); + +/* A declaration of the signature of all callbacks that return a defiGcellGri */ +typedef int (*defrGcellGridCbkFnType) (defrCallbackType_e, defiGcellGrid *grid, defiUserData); + +/* A declaration of the signature of all callbacks that return a defiVia. */ +typedef int (*defrViaCbkFnType) (defrCallbackType_e, defiVia *, defiUserData); + +/* A declaration of the signature of all callbacks that return a defiRegion. */ +typedef int (*defrRegionCbkFnType) (defrCallbackType_e, defiRegion *, defiUserData); + +/* A declaration of the signature of all callbacks that return a defiGroup. */ +typedef int (*defrGroupCbkFnType) (defrCallbackType_e, defiGroup *, defiUserData); + +/* A declaration of the signature of all callbacks that return a defiAssertio */ +typedef int (*defrAssertionCbkFnType) (defrCallbackType_e, defiAssertion *, defiUserData); + +/* A declaration of the signature of all callbacks that return a defiScanChai */ +typedef int (*defrScanchainCbkFnType) (defrCallbackType_e, defiScanchain *, defiUserData); + +/* A declaration of the signature of all callbacks that return a defiIOTiming */ +typedef int (*defrIOTimingCbkFnType) (defrCallbackType_e, defiIOTiming *, defiUserData); + +/* A declaration of the signature of all callbacks that return a defiFPC. */ +typedef int (*defrFPCCbkFnType) (defrCallbackType_e, defiFPC *, defiUserData); + +/* A declaration of the signature of all callbacks that return a defiTimingDi */ +typedef int (*defrTimingDisableCbkFnType) (defrCallbackType_e, defiTimingDisable *, defiUserData); + +/* A declaration of the signature of all callbacks that return a defiPartitio */ +typedef int (*defrPartitionCbkFnType) (defrCallbackType_e, defiPartition *, defiUserData); + +/* A declaration of the signature of all callbacks that return a defiPinProp. */ +typedef int (*defrPinPropCbkFnType) (defrCallbackType_e, defiPinProp *, defiUserData); + +/* A declaration of the signature of all callbacks that return a defiBlockage */ +typedef int (*defrBlockageCbkFnType) (defrCallbackType_e, defiBlockage *, defiUserData); + +/* A declaration of the signature of all callbacks that return a defiSlot. */ +typedef int (*defrSlotCbkFnType) (defrCallbackType_e, defiSlot *, defiUserData); + +/* A declaration of the signature of all callbacks that return a defiFill. */ +typedef int (*defrFillCbkFnType) (defrCallbackType_e, defiFill *, defiUserData); + +/* A declaration of the signature of all callbacks that return a defiNonDefau */ +typedef int (*defrNonDefaultCbkFnType) (defrCallbackType_e, defiNonDefault *, defiUserData); + +/* A declaration of the signature of all callbacks that return a defiStyles. */ +typedef int (*defrStylesCbkFnType) (defrCallbackType_e, defiStyles *, defiUserData); + +/* NEW CALLBACK - Each callback must return user data, enum, and */ +/* OUR-DATA item. We must define a callback function type for */ +/* each type of OUR-DATA. Some routines return a string, some */ +/* return an integer, and some return a pointer to a class. */ +/* If you create a new class, then you must create a new function */ +/* type here to return that class to the user. */ + +/* The reader initialization. Must be called before defrRead(). */ +EXTERN int defrInit (); +EXTERN int defrInitSession (int startSession); + +/* obsoleted now. */ +EXTERN int defrReset (); + +/*Sets all parser memory into init state. */ +EXTERN int defrClear (); + +/* Change the comment character in the DEF file. The default */ +/* is '#' */ +EXTERN void defrSetCommentChar (char c); + +/* Functions to call to set specific actions in the parser. */ +EXTERN void defrSetAddPathToNet (); +EXTERN void defrSetAllowComponentNets (); +EXTERN int defrGetAllowComponentNets (); +EXTERN void defrSetCaseSensitivity (int caseSense); + +/* Functions to keep track of callbacks that the user did not */ +/* supply. Normally all parts of the DEF file that the user */ +/* does not supply a callback for will be ignored. These */ +/* routines tell the parser count the DEF constructs that are */ +/* present in the input file, but did not trigger a callback. */ +/* This should help you find any "important" DEF constructs that */ +/* you are ignoring. */ +EXTERN void defrSetRegisterUnusedCallbacks (); +EXTERN void defrPrintUnusedCallbacks (FILE* log); + +/* Obsoleted now. */ +EXTERN int defrReleaseNResetMemory (); + +/* The main reader function. */ +/* The file should already be opened. This requirement allows */ +/* the reader to be used with stdin or a pipe. The file name */ +/* is only used for error messages. */ +EXTERN int defrRead (FILE * file, const char * fileName, defiUserData userData, int case_sensitive); + +/* Set/get the client-provided user data. defi doesn't look at */ +/* this data at all, it simply passes the opaque defiUserData pointer */ +/* back to the application with each callback. The client can */ +/* change the data at any time, and it will take effect on the */ +/* next callback. The defi reader and writer maintain separate */ +/* user data pointers. */ +EXTERN void defrSetUserData (defiUserData p0); +EXTERN defiUserData defrGetUserData (); + +/* Functions to call to register a callback function or get the function */ +/*pointer after it has been registered. */ +/* */ + +/* Register one function for all callbacks with the same signature */ +EXTERN void defrSetArrayNameCbk (defrStringCbkFnType p0); +EXTERN void defrSetAssertionCbk (defrAssertionCbkFnType p0); +EXTERN void defrSetAssertionsStartCbk (defrIntegerCbkFnType p0); +EXTERN void defrSetAssertionsEndCbk (defrVoidCbkFnType p0); +EXTERN void defrSetBlockageCbk (defrBlockageCbkFnType p0); +EXTERN void defrSetBlockageStartCbk (defrIntegerCbkFnType p0); +EXTERN void defrSetBlockageEndCbk (defrVoidCbkFnType p0); +EXTERN void defrSetBusBitCbk (defrStringCbkFnType p0); +EXTERN void defrSetCannotOccupyCbk (defrSiteCbkFnType p0); +EXTERN void defrSetCanplaceCbk (defrSiteCbkFnType p0); +EXTERN void defrSetCaseSensitiveCbk (defrIntegerCbkFnType p0); +EXTERN void defrSetComponentCbk (defrComponentCbkFnType p0); +EXTERN void defrSetComponentExtCbk (defrStringCbkFnType p0); +EXTERN void defrSetComponentStartCbk (defrIntegerCbkFnType p0); +EXTERN void defrSetComponentEndCbk (defrVoidCbkFnType p0); +EXTERN void defrSetConstraintCbk (defrAssertionCbkFnType p0); +EXTERN void defrSetConstraintsStartCbk (defrIntegerCbkFnType p0); +EXTERN void defrSetConstraintsEndCbk (defrVoidCbkFnType p0); +EXTERN void defrSetDefaultCapCbk (defrIntegerCbkFnType p0); +EXTERN void defrSetDesignCbk (defrStringCbkFnType p0); +EXTERN void defrSetDesignEndCbk (defrVoidCbkFnType p0); +EXTERN void defrSetDieAreaCbk (defrBoxCbkFnType p0); +EXTERN void defrSetDividerCbk (defrStringCbkFnType p0); +EXTERN void defrSetExtensionCbk (defrStringCbkFnType p0); +EXTERN void defrSetFillCbk (defrFillCbkFnType p0); +EXTERN void defrSetFillStartCbk (defrIntegerCbkFnType p0); +EXTERN void defrSetFillEndCbk (defrVoidCbkFnType p0); +EXTERN void defrSetFPCCbk (defrFPCCbkFnType p0); +EXTERN void defrSetFPCStartCbk (defrIntegerCbkFnType p0); +EXTERN void defrSetFPCEndCbk (defrVoidCbkFnType p0); +EXTERN void defrSetFloorPlanNameCbk (defrStringCbkFnType p0); +EXTERN void defrSetGcellGridCbk (defrGcellGridCbkFnType p0); +EXTERN void defrSetGroupNameCbk (defrStringCbkFnType p0); +EXTERN void defrSetGroupMemberCbk (defrStringCbkFnType p0); +EXTERN void defrSetComponentMaskShiftLayerCbk (defrComponentMaskShiftLayerCbkFnType p0); +EXTERN void defrSetGroupCbk (defrGroupCbkFnType p0); +EXTERN void defrSetGroupExtCbk (defrStringCbkFnType p0); +EXTERN void defrSetGroupsStartCbk (defrIntegerCbkFnType p0); +EXTERN void defrSetGroupsEndCbk (defrVoidCbkFnType p0); +EXTERN void defrSetHistoryCbk (defrStringCbkFnType p0); +EXTERN void defrSetIOTimingCbk (defrIOTimingCbkFnType p0); +EXTERN void defrSetIOTimingsStartCbk (defrIntegerCbkFnType p0); +EXTERN void defrSetIOTimingsEndCbk (defrVoidCbkFnType p0); +EXTERN void defrSetIoTimingsExtCbk (defrStringCbkFnType p0); +EXTERN void defrSetNetCbk (defrNetCbkFnType p0); +EXTERN void defrSetNetNameCbk (defrStringCbkFnType p0); +EXTERN void defrSetNetNonDefaultRuleCbk (defrStringCbkFnType p0); +EXTERN void defrSetNetConnectionExtCbk (defrStringCbkFnType p0); +EXTERN void defrSetNetExtCbk (defrStringCbkFnType p0); +EXTERN void defrSetNetPartialPathCbk (defrNetCbkFnType p0); +EXTERN void defrSetNetSubnetNameCbk (defrStringCbkFnType p0); +EXTERN void defrSetNetStartCbk (defrIntegerCbkFnType p0); +EXTERN void defrSetNetEndCbk (defrVoidCbkFnType p0); +EXTERN void defrSetNonDefaultCbk (defrNonDefaultCbkFnType p0); +EXTERN void defrSetNonDefaultStartCbk (defrIntegerCbkFnType p0); +EXTERN void defrSetNonDefaultEndCbk (defrVoidCbkFnType p0); +EXTERN void defrSetPartitionCbk (defrPartitionCbkFnType p0); +EXTERN void defrSetPartitionsExtCbk (defrStringCbkFnType p0); +EXTERN void defrSetPartitionsStartCbk (defrIntegerCbkFnType p0); +EXTERN void defrSetPartitionsEndCbk (defrVoidCbkFnType p0); +EXTERN void defrSetPathCbk (defrPathCbkFnType p0); +EXTERN void defrSetPinCapCbk (defrPinCapCbkFnType p0); +EXTERN void defrSetPinCbk (defrPinCbkFnType p0); +EXTERN void defrSetPinExtCbk (defrStringCbkFnType p0); +EXTERN void defrSetPinPropCbk (defrPinPropCbkFnType p0); +EXTERN void defrSetPinPropStartCbk (defrIntegerCbkFnType p0); +EXTERN void defrSetPinPropEndCbk (defrVoidCbkFnType p0); +EXTERN void defrSetPropCbk (defrPropCbkFnType p0); +EXTERN void defrSetPropDefEndCbk (defrVoidCbkFnType p0); +EXTERN void defrSetPropDefStartCbk (defrVoidCbkFnType p0); +EXTERN void defrSetRegionCbk (defrRegionCbkFnType p0); +EXTERN void defrSetRegionStartCbk (defrIntegerCbkFnType p0); +EXTERN void defrSetRegionEndCbk (defrVoidCbkFnType p0); +EXTERN void defrSetRowCbk (defrRowCbkFnType p0); +EXTERN void defrSetSNetCbk (defrNetCbkFnType p0); +EXTERN void defrSetSNetStartCbk (defrIntegerCbkFnType p0); +EXTERN void defrSetSNetEndCbk (defrVoidCbkFnType p0); +EXTERN void defrSetSNetPartialPathCbk (defrNetCbkFnType p0); +EXTERN void defrSetSNetWireCbk (defrNetCbkFnType p0); +EXTERN void defrSetScanChainExtCbk (defrStringCbkFnType p0); +EXTERN void defrSetScanchainCbk (defrScanchainCbkFnType p0); +EXTERN void defrSetScanchainsStartCbk (defrIntegerCbkFnType p0); +EXTERN void defrSetScanchainsEndCbk (defrVoidCbkFnType p0); +EXTERN void defrSetSiteCbk (defrSiteCbkFnType p0); +EXTERN void defrSetSlotCbk (defrSlotCbkFnType p0); +EXTERN void defrSetSlotStartCbk (defrIntegerCbkFnType p0); +EXTERN void defrSetSlotEndCbk (defrVoidCbkFnType p0); +EXTERN void defrSetStartPinsCbk (defrIntegerCbkFnType p0); +EXTERN void defrSetStylesCbk (defrStylesCbkFnType p0); +EXTERN void defrSetStylesStartCbk (defrIntegerCbkFnType p0); +EXTERN void defrSetStylesEndCbk (defrVoidCbkFnType p0); +EXTERN void defrSetPinEndCbk (defrVoidCbkFnType p0); +EXTERN void defrSetTechnologyCbk (defrStringCbkFnType p0); +EXTERN void defrSetTimingDisableCbk (defrTimingDisableCbkFnType p0); +EXTERN void defrSetTimingDisablesStartCbk (defrIntegerCbkFnType p0); +EXTERN void defrSetTimingDisablesEndCbk (defrVoidCbkFnType p0); +EXTERN void defrSetTrackCbk (defrTrackCbkFnType p0); +EXTERN void defrSetUnitsCbk (defrDoubleCbkFnType p0); +EXTERN void defrSetVersionCbk (defrDoubleCbkFnType p0); +EXTERN void defrSetVersionStrCbk (defrStringCbkFnType p0); +EXTERN void defrSetViaCbk (defrViaCbkFnType p0); +EXTERN void defrSetViaExtCbk (defrStringCbkFnType p0); +EXTERN void defrSetViaStartCbk (defrIntegerCbkFnType p0); +EXTERN void defrSetViaEndCbk (defrVoidCbkFnType p0); + +/* NEW CALLBACK - For each new callback you create, you must */ +/* create a routine that allows the user to set it. Add the */ +/* setting routines here. */ + +/*Set all of the callbacks that have not yet been set to the following */ +/*function. This is especially useful if you want to check to see */ +/*if you forgot anything. */ +EXTERN void defrUnsetCallbacks (); + +/* Functions to call to unregister a callback function. */ +EXTERN void defrUnsetArrayNameCbk (); +EXTERN void defrUnsetAssertionCbk (); +EXTERN void defrUnsetAssertionsStartCbk (); +EXTERN void defrUnsetAssertionsEndCbk (); +EXTERN void defrUnsetBlockageCbk (); +EXTERN void defrUnsetBlockageStartCbk (); +EXTERN void defrUnsetBlockageEndCbk (); +EXTERN void defrUnsetBusBitCbk (); +EXTERN void defrUnsetCannotOccupyCbk (); +EXTERN void defrUnsetCanplaceCbk (); +EXTERN void defrUnsetCaseSensitiveCbk (); +EXTERN void defrUnsetComponentCbk (); +EXTERN void defrUnsetComponentExtCbk (); +EXTERN void defrUnsetComponentStartCbk (); +EXTERN void defrUnsetComponentEndCbk (); +EXTERN void defrUnsetConstraintCbk (); +EXTERN void defrUnsetConstraintsStartCbk (); +EXTERN void defrUnsetConstraintsEndCbk (); +EXTERN void defrUnsetDefaultCapCbk (); +EXTERN void defrUnsetDesignCbk (); +EXTERN void defrUnsetDesignEndCbk (); +EXTERN void defrUnsetDieAreaCbk (); +EXTERN void defrUnsetDividerCbk (); +EXTERN void defrUnsetExtensionCbk (); +EXTERN void defrUnsetFillCbk (); +EXTERN void defrUnsetFillStartCbk (); +EXTERN void defrUnsetFillEndCbk (); +EXTERN void defrUnsetFPCCbk (); +EXTERN void defrUnsetFPCStartCbk (); +EXTERN void defrUnsetFPCEndCbk (); +EXTERN void defrUnsetFloorPlanNameCbk (); +EXTERN void defrUnsetGcellGridCbk (); +EXTERN void defrUnsetGroupCbk (); +EXTERN void defrUnsetGroupExtCbk (); +EXTERN void defrUnsetGroupMemberCbk (); +EXTERN void defrUnsetComponentMaskShiftLayerCbk (); +EXTERN void defrUnsetGroupNameCbk (); +EXTERN void defrUnsetGroupsStartCbk (); +EXTERN void defrUnsetGroupsEndCbk (); +EXTERN void defrUnsetHistoryCbk (); +EXTERN void defrUnsetIOTimingCbk (); +EXTERN void defrUnsetIOTimingsStartCbk (); +EXTERN void defrUnsetIOTimingsEndCbk (); +EXTERN void defrUnsetIOTimingsExtCbk (); +EXTERN void defrUnsetNetCbk (); +EXTERN void defrUnsetNetNameCbk (); +EXTERN void defrUnsetNetNonDefaultRuleCbk (); +EXTERN void defrUnsetNetConnectionExtCbk (); +EXTERN void defrUnsetNetExtCbk (); +EXTERN void defrUnsetNetPartialPathCbk (); +EXTERN void defrUnsetNetSubnetNameCbk (); +EXTERN void defrUnsetNetStartCbk (); +EXTERN void defrUnsetNetEndCbk (); +EXTERN void defrUnsetNonDefaultCbk (); +EXTERN void defrUnsetNonDefaultStartCbk (); +EXTERN void defrUnsetNonDefaultEndCbk (); +EXTERN void defrUnsetPartitionCbk (); +EXTERN void defrUnsetPartitionsExtCbk (); +EXTERN void defrUnsetPartitionsStartCbk (); +EXTERN void defrUnsetPartitionsEndCbk (); +EXTERN void defrUnsetPathCbk (); +EXTERN void defrUnsetPinCapCbk (); +EXTERN void defrUnsetPinCbk (); +EXTERN void defrUnsetPinEndCbk (); +EXTERN void defrUnsetPinExtCbk (); +EXTERN void defrUnsetPinPropCbk (); +EXTERN void defrUnsetPinPropStartCbk (); +EXTERN void defrUnsetPinPropEndCbk (); +EXTERN void defrUnsetPropCbk (); +EXTERN void defrUnsetPropDefEndCbk (); +EXTERN void defrUnsetPropDefStartCbk (); +EXTERN void defrUnsetRegionCbk (); +EXTERN void defrUnsetRegionStartCbk (); +EXTERN void defrUnsetRegionEndCbk (); +EXTERN void defrUnsetRowCbk (); +EXTERN void defrUnsetScanChainExtCbk (); +EXTERN void defrUnsetScanchainCbk (); +EXTERN void defrUnsetScanchainsStartCbk (); +EXTERN void defrUnsetScanchainsEndCbk (); +EXTERN void defrUnsetSiteCbk (); +EXTERN void defrUnsetSlotCbk (); +EXTERN void defrUnsetSlotStartCbk (); +EXTERN void defrUnsetSlotEndCbk (); +EXTERN void defrUnsetSNetWireCbk (); +EXTERN void defrUnsetSNetCbk (); +EXTERN void defrUnsetSNetStartCbk (); +EXTERN void defrUnsetSNetEndCbk (); +EXTERN void defrUnsetSNetPartialPathCbk (); +EXTERN void defrUnsetStartPinsCbk (); +EXTERN void defrUnsetStylesCbk (); +EXTERN void defrUnsetStylesStartCbk (); +EXTERN void defrUnsetStylesEndCbk (); +EXTERN void defrUnsetTechnologyCbk (); +EXTERN void defrUnsetTimingDisableCbk (); +EXTERN void defrUnsetTimingDisablesStartCbk (); +EXTERN void defrUnsetTimingDisablesEndCbk (); +EXTERN void defrUnsetTrackCbk (); +EXTERN void defrUnsetUnitsCbk (); +EXTERN void defrUnsetVersionCbk (); +EXTERN void defrUnsetVersionStrCbk (); +EXTERN void defrUnsetViaCbk (); +EXTERN void defrUnsetViaExtCbk (); +EXTERN void defrUnsetViaStartCbk (); +EXTERN void defrUnsetViaEndCbk (); + +/* Routine to set all unused callbacks. This is useful for checking */ +/*to see if you missed something. */ +EXTERN void defrSetUnusedCallbacks (defrVoidCbkFnType func); + +/* Return the current line number in the input file. */ +EXTERN int defrLineNumber (); +EXTERN long long defrLongLineNumber (); + +/* Routine to set the message logging routine for errors */ + typedef void (*DEFI_LOG_FUNCTION) (const char*); +EXTERN void defrSetLogFunction (DEFI_LOG_FUNCTION p0); + +/* Routine to set the message logging routine for warnings */ +#ifndef DEFI_WARNING_LOG_FUNCTION + typedef void (*DEFI_WARNING_LOG_FUNCTION) (const char*); +#endif +EXTERN void defrSetWarningLogFunction (DEFI_WARNING_LOG_FUNCTION p0); + +/* Routine to set the user defined malloc routine */ +typedef void* (*DEFI_MALLOC_FUNCTION) (size_t); +EXTERN void defrSetMallocFunction (DEFI_MALLOC_FUNCTION p0); + +/* Routine to set the user defined realloc routine */ +typedef void* (*DEFI_REALLOC_FUNCTION) (void*, size_t); +EXTERN void defrSetReallocFunction (DEFI_REALLOC_FUNCTION p0); + +/* Routine to set the user defined free routine */ +typedef void (*DEFI_FREE_FUNCTION) (void *); +EXTERN void defrSetFreeFunction (DEFI_FREE_FUNCTION p0); + +/* Routine to set the line number of the file that is parsing routine (takes */ +typedef void (*DEFI_LINE_NUMBER_FUNCTION) (int); +EXTERN void defrSetLineNumberFunction (DEFI_LINE_NUMBER_FUNCTION p0); + +/* Routine to set the line number of the file that is parsing routine (takes */ +typedef void (*DEFI_LONG_LINE_NUMBER_FUNCTION) (long long); +EXTERN void defrSetLongLineNumberFunction (DEFI_LONG_LINE_NUMBER_FUNCTION p0); + +/* Set the number of lines before calling the line function callback routine */ +/* Default is 10000 */ +EXTERN void defrSetDeltaNumberLines (int p0); + +/* Routine to set the read function */ +typedef size_t (*DEFI_READ_FUNCTION) (FILE*, char*, size_t); +EXTERN void defrSetReadFunction (DEFI_READ_FUNCTION p0); +EXTERN void defrUnsetReadFunction (); + +/* Routine to set the defrWarning.log to open as append instead for write */ +/* New in 5.7 */ +EXTERN void defrSetOpenLogFileAppend (); +EXTERN void defrUnsetOpenLogFileAppend (); + +/* Routine to set the magic comment found routine */ +typedef void (*DEFI_MAGIC_COMMENT_FOUND_FUNCTION) (); +EXTERN void defrSetMagicCommentFoundFunction (DEFI_MAGIC_COMMENT_FOUND_FUNCTION p0); + +/* Routine to set the magic comment string */ +EXTERN void defrSetMagicCommentString (char * p0); + +/* Routine to disable string property value process, default it will process */ +/* the value string */ +EXTERN void defrDisablePropStrProcess (); + +/* Testing purposes only */ +EXTERN void defrSetNLines (long long n); + +/* Routine to set the max number of warnings for a perticular section */ + +EXTERN void defrSetAssertionWarnings (int warn); +EXTERN void defrSetBlockageWarnings (int warn); +EXTERN void defrSetCaseSensitiveWarnings (int warn); +EXTERN void defrSetComponentWarnings (int warn); +EXTERN void defrSetConstraintWarnings (int warn); +EXTERN void defrSetDefaultCapWarnings (int warn); +EXTERN void defrSetGcellGridWarnings (int warn); +EXTERN void defrSetIOTimingWarnings (int warn); +EXTERN void defrSetNetWarnings (int warn); +EXTERN void defrSetNonDefaultWarnings (int warn); +EXTERN void defrSetPinExtWarnings (int warn); +EXTERN void defrSetPinWarnings (int warn); +EXTERN void defrSetRegionWarnings (int warn); +EXTERN void defrSetRowWarnings (int warn); +EXTERN void defrSetScanchainWarnings (int warn); +EXTERN void defrSetSNetWarnings (int warn); +EXTERN void defrSetStylesWarnings (int warn); +EXTERN void defrSetTrackWarnings (int warn); +EXTERN void defrSetUnitsWarnings (int warn); +EXTERN void defrSetVersionWarnings (int warn); +EXTERN void defrSetViaWarnings (int warn); + +/* Handling output messages */ +EXTERN void defrDisableParserMsgs (int nMsg, int* msgs); +EXTERN void defrEnableParserMsgs (int nMsg, int* msgs); +EXTERN void defrEnableAllMsgs (); +EXTERN void defrSetTotalMsgLimit (int totNumMsgs); +EXTERN void defrSetLimitPerMsg (int msgId, int numMsg); + +/* Return codes for the user callbacks. */ +/*The user should return one of these values. */ +#define PARSE_OK 0 +#define STOP_PARSE 1 +#define PARSE_ERROR 2 + +/* Add this alias to the list for the parser */ +EXTERN void defrAddAlias (const char* key, const char* value, int marked, defrData * data); + +#endif diff --git a/src/def/cdef/defwWriter.h b/src/def/cdef/defwWriter.h new file mode 100644 index 00000000..d880c8b7 --- /dev/null +++ b/src/def/cdef/defwWriter.h @@ -0,0 +1,1455 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFWWRITER_H +#define CDEFWWRITER_H + +#include +#include "defiTypedefs.h" + +/* Return codes for writing functions: */ +#define DEFW_OK 0 +#define DEFW_UNINITIALIZED 1 +#define DEFW_BAD_ORDER 2 +#define DEFW_BAD_DATA 3 +#define DEFW_ALREADY_DEFINED 4 +#define DEFW_WRONG_VERSION 5 +#define DEFW_OBSOLETE 6 +#define DEFW_TOO_MANY_STMS 7 + /* section is smaller than the actual numbe */ + /* of statements defined in that section */ + +/* orient + 0 = N + 1 = W + 2 = S + 3 = E + 4 = FN + 5 = FW + 6 = FS + 7 = FE +*/ + +/* This routine will write a new line */ +EXTERN int defwNewLine (); + +/* The DEF writer initialization. Must be called first. + * Either this routine or defwInitCbk should be call only. + * Can't call both routines in one program. + * This routine is for user who does not want to use the callback machanism. + * Returns 0 if successful. */ +EXTERN int defwInit (FILE* f, int vers1, int version2, const char* caseSensitive, const char* dividerChar, const char* busBitChars, const char* designName, const char* technology, const char* array, const char* floorplan, double units); + +/* The DEF writer initialization. Must be called first. + * Either this routine or defwInit should be call only. + * Can't call both routines in one program. + * This routine is for user who choose to use the callback machanism. + * If user uses the callback for the writer, they need to provide + * callbacks for Version, NamesCaseSensitive, BusBitChars and DividerChar. + * These sections are required by the def. If any of these callbacks + * are missing, defaults will be used. + * Returns 0 if successful. */ +EXTERN int defwInitCbk (FILE* f); + +/* This routine must be called after the defwInit. + * This routine is required. + * Returns 0 if successful. + * The routine can be called only once. */ +EXTERN int defwVersion (int vers1, int vers2); + +/* This routine must be called after the defwInit. + * This routine is required. + * Returns 0 if successful. + * The routine can be called only once. */ +EXTERN int defwCaseSensitive (const char* caseSensitive); + +/* This routine must be called after the defwInit. + * This routine is required. + * Returns 0 if successful. + * The routine can be called only once. */ +EXTERN int defwBusBitChars (const char* busBitChars); + +/* This routine must be called after the defwInit. + * This routine is required. + * Returns 0 if successful. + * The routine can be called only once. */ +EXTERN int defwDividerChar (const char* dividerChar); + +/* This routine must be called after the defwInit. + * This routine is required. + * Returns 0 if successful. + * The routine can be called only once. */ +EXTERN int defwDesignName (const char* name); + +/* This routine must be called after the defwInit. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called only once. */ +EXTERN int defwTechnology (const char* technology); + +/* This routine must be called after the defwInit. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called only once. */ +EXTERN int defwArray (const char* array); + +/* This routine must be called after the defwInit. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called only once. */ +EXTERN int defwFloorplan (const char* floorplan); + +/* This routine must be called after the defwInit. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called only once. */ +EXTERN int defwUnits (int units); + +/* This routine must be called after the defwInit. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called 0 to many times. */ +EXTERN int defwHistory (const char* string); + +/* This routine must be called after the history routines (if any). + * This routine is optional. + * Returns 0 if successful. + * The routine can be called only once. */ +EXTERN int defwStartPropDef (); + +/* This routine must be called after defwStartPropDef. + * This routine can be called multiple times. + * It adds integer property definition to the statement. + * Returns 0 if successfull. + * The objType can be LIBRARY or VIA or MACRO or PIN. */ + /* NONDEFAULTRULE | MACRO | PIN */ +EXTERN int defwIntPropDef (const char* objType, const char* propName, double leftRange, double rightRange, int propValue); + +/* This routine must be called after defwStartPropDef. + * This routine can be called multiple times. + * It adds real property definition to the statement. + * Returns 0 if successfull. + * The objType can be LIBRARY or VIA or MACRO or PIN. */ + /* NONDEFAULTRULE | MACRO | PIN */ +EXTERN int defwRealPropDef (const char* objType, const char* propName, double leftRange, double rightRange, double propValue); + +/* This routine must be called after defwStartPropDef. + * This routine can be called multiple times. + * It adds string property definition to the statement. + * Returns 0 if successfull. + * The objType can be LIBRARY or VIA or MACRO or PIN. */ + /* NONDEFAULTRULE | MACRO | PIN */ +EXTERN int defwStringPropDef (const char* objType, const char* propName, double leftRange, double rightRange, const char* propValue); + +/* This routine must be called after all the properties have been + * added to the file. + * If you called defwPropertyDefinitions then this routine is NOT optional. + * Returns 0 if successful. + * The routine can be called only once. */ +EXTERN int defwEndPropDef (); + +/* This routine can be called after defwRow, defwRegion, defwComponent, + * defwPin, defwSpecialNet, defwNet, and defwGroup + * This routine is optional, it adds string property to the statement. + * Returns 0 if successful. + * This routine can be called 0 to many times */ +EXTERN int defwStringProperty (const char* propName, const char* propValue); + +/* This routine can be called after defwRow, defwRegion, defwComponent, + * defwPin, defwSpecialNet, defwNet, and defwGroup + * This routine is optional, it adds real property to the statement. + * Returns 0 if successful. + * This routine can be called 0 to many times */ +EXTERN int defwRealProperty (const char* propName, double propValue); + +/* This routine can be called after defwRow, defwRegion, defwComponent, + * defwPin, defwSpecialNet, defwNet, and defwGroup + * This routine is optional, it adds int property to the statement. + * Returns 0 if successful. + * This routine can be called 0 to many times */ +EXTERN int defwIntProperty (const char* propName, int propValue); + +/* This routine must be called after the property definitions (if any). + * This routine is optional. + * Returns 0 if successful. + * The routine can be called only once. */ +EXTERN int defwDieArea (int xl, int yl, int xh, int yh); + +/* This routine must be called after the property definitions (if any). + * This routine is optional. + * This routine is the same as defwDieArea, but accept more than 2 points + * This is a 5.6 syntax + * Returns 0 if successful. + * The routine can be called only once. */ +EXTERN int defwDieAreaList (int num_points, int* xl, int* yh); + +/* This routine must be called after the Die Area (if any). + * This routine is optional. + * Returns 0 if successful. + * The integer "orient" and operation of the do is explained in + * the documentation. + * In 5.6, the DO syntax is optional and the STEP syntax is optional in DO */ +EXTERN int defwRow (const char* rowName, const char* rowType, int x_orig, int y_orig, int orient, int do_count, int do_increment, int xstep, int ystep); + +/* This routine must be called after the Die Area (if any). + * This routine is optional. + * Returns 0 if successful. + * This routine is the same as defwRow, excpet orient is a char* */ +EXTERN int defwRowStr (const char* rowName, const char* rowType, int x_orig, int y_orig, const char* orient, int do_count, int do_increment, int xstep, int ystep); + +/* This routine must be called after the defwRow (if any). + * This routine is optional. + * Returns 0 if successful. + * The operation of the do is explained in the documentation. */ +EXTERN int defwTracks (const char* master, int doStart, int doCount, int doStep, int numLayers, const char** layers, int mask, int sameMask); + +/* This routine must be called after the defwTracks (if any). + * This routine is optional. + * Returns 0 if successful. + * The operation of the do is explained in the documentation. */ +EXTERN int defwGcellGrid (const char* master, int doStart, int doCount, int doStep); + +/* This routine must be called after the defwTracks (if any). + * This section of routines is optional. + * Returns 0 if successful. + * The routine starts the default capacitance section. All of the + * capacitances must follow. + * The count is the number of defwDefaultCap calls to follow. + * The routine can be called only once. + * This api is obsolete in 5.4. */ +EXTERN int defwStartDefaultCap (int count); + +/* This routine is called once for each default cap. The calls must + * be preceeded by a call to defwStartDefaultCap and must be + * terminated by a call to defwEndDefaultCap. + * Returns 0 if successful. + * This api is obsolete in 5.4. */ +EXTERN int defwDefaultCap (int pins, double cap); + +/* This routine must be called after the defwDefaultCap calls (if any). + * Returns 0 if successful. + * If the count in StartDefaultCap is not the same as the number of + * calls to DefaultCap then DEFW_BAD_DATA will return returned. + * The routine can be called only once. + * This api is obsolete in 5.4. */ +EXTERN int defwEndDefaultCap (); + +/* This routine must be called after the defwDefaultCap calls (if any). + * The operation of the do is explained in the documentation. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called many times. */ +EXTERN int defwCanPlace (const char* master, int xOrig, int yOrig, int orient, int doCnt, int doInc, int xStep, int yStep); + +/* This routine must be called after the defwDefaultCap calls (if any). + * The operation of the do is explained in the documentation. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called many times. + * This routine is the same as defwCanPlace, except orient is a char* */ +EXTERN int defwCanPlaceStr (const char* master, int xOrig, int yOrig, const char* orient, int doCnt, int doInc, int xStep, int yStep); + +/* This routine must be called after the defwCanPlace calls (if any). + * The operation of the do is explained in the documentation. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called many times. */ +EXTERN int defwCannotOccupy (const char* master, int xOrig, int yOrig, int orient, int doCnt, int doInc, int xStep, int yStep); + +/* This routine must be called after the defwCanPlace calls (if any). + * The operation of the do is explained in the documentation. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called many times. + * This routine is the same as defwCannotOccupy, except orient is a char* */ +EXTERN int defwCannotOccupyStr (const char* master, int xOrig, int yOrig, const char* orient, int doCnt, int doInc, int xStep, int yStep); + +/* This routine must be called after defwCannotOccupy (if any). + * This section of routines is optional. + * Returns 0 if successful. + * The routine starts the via section. All of the vias must follow. + * The count is the number of defwVia calls to follow. + * The routine can be called only once. */ +EXTERN int defwStartVias (int count); + +/* These routines enter each via into the file. + * These routines must be called after the defwStartVias call. + * defwViaName should be called first, follow either by defwViaPattern or + * defwViaLayer. At the end of each via, defwOneViaEnd should be called + * These routines are for [- viaName [+ PATTERNNAME patternName + RECT layerName + * pt pt]...;]... + * Returns 0 if successful. + * The routines can be called many times. */ +EXTERN int defwViaName (const char* name); + +EXTERN int defwViaPattern (const char* patternName); + +/* This routine can be called multiple times. */ +/* mask is 5.8 syntax */ +EXTERN int defwViaRect (const char* layerName, int xl, int yl, int xh, int yh, int mask); + +/* This is a 5.6 syntax + * This routine can be called multiple times. */ +/* mask is 5.8 syntax */ +EXTERN int defwViaPolygon (const char* layerName, int num_polys, double* xl, double* yl, int mask); + +/* These routine must be called after defwViaName. + * Either this routine or defwViaPattern can be called after each + * defwViaName is called. + * This is a 5.6 syntax + * Returns 0 if successful + * The routine can be called only once per defwViaName called. */ +EXTERN int defwViaViarule (const char* viaRuleName, double xCutSize, double yCutSize, const char* botMetalLayer, const char* cutLayer, const char* topMetalLayer, double xCutSpacing, double yCutSpacing, double xBotEnc, double yBotEnc, double xTopEnc, double yTopEnc); + +/* This routine can call only after defwViaViarule. + * It can only be called once. + * This is a 5.6 syntax. + * Returns 0 if successful. */ +EXTERN int defwViaViaruleRowCol (int numCutRows, int numCutCols); + +/* This routine can call only after defwViaViarule. + * It can only be called once. + * This is a 5.6 syntax. + * Returns 0 if successful. */ +EXTERN int defwViaViaruleOrigin (int xOffset, int yOffset); + +/* This routine can call only after defwViaViarule. + * It can only be called once. + * This is a 5.6 syntax. + * Returns 0 if successful. */ +EXTERN int defwViaViaruleOffset (int xBotOffset, int yBotOffset, int xTopOffset, int yTopOffset); + +/* This routine can call only after defwViaViarule. + * It can only be called once. + * This is a 5.6 syntax. + * Returns 0 if successful. */ +EXTERN int defwViaViarulePattern (const char* cutPattern); + +EXTERN int defwOneViaEnd (); + +/* This routine must be called after the defwVia calls. + * Returns 0 if successful. + * If the count in StartVias is not the same as the number of + * calls to Via or ViaPattern then DEFW_BAD_DATA will return returned. + * The routine can be called only once. */ +EXTERN int defwEndVias (); + +/* This routine must be called after via section (if any). + * This section of routines is optional. + * Returns 0 if successful. + * The routine starts the region section. All of the regions must follow. + * The count is the number of defwRegion calls to follow. + * The routine can be called only once. */ +EXTERN int defwStartRegions (int count); + +/* This routine enter each region into the file. + * This routine must be called after the defwStartRegions call. + * Returns 0 if successful. + * The routine can be called many times. */ +EXTERN int defwRegionName (const char* name); + +/* This routine enter the region point to the region name. + * This routine must be called after the defwRegionName call. + * Returns 0 if successful. + * The routine can be called many times. */ +EXTERN int defwRegionPoints (int xl, int yl, int xh, int yh); + +/* This routine enter the region type, FENCE | GUIDE. + * This routine must be called after the defwRegionName call. + * This is a 5.4.1 syntax. + * Returns 0 if successful. + * The routine can be called only once. */ +EXTERN int defwRegionType (const char* type); + +/* This routine must be called after the defwRegion calls. + * Returns 0 if successful. + * If the count in StartRegions is not the same as the number of + * calls to Region or RegionPattern then DEFW_BAD_DATA will return returned. + * The routine can be called only once. */ +EXTERN int defwEndRegions (); + +/* This is a 5.8 syntax. + * Returns 0 if successful. + * The routine can be called only once. */ +EXTERN int defwComponentMaskShiftLayers (const char** layerNames, int numLayerName); + +/* This routine must be called after the regions section (if any). + * This section of routines is NOT optional. + * Returns 0 if successful. + * The routine starts the components section. All of the components + * must follow. + * The count is the number of defwComponent calls to follow. + * The routine can be called only once. */ +EXTERN int defwStartComponents (int count); + +/* This routine enter each component into the file. + * This routine must be called after the defwStartComponents call. + * The optional fields will be ignored if they are set to zero + * (except for weight which must be set to -1.0). + * Returns 0 if successful. + * The routine can be called many times. */ + + /* USER | TIMING */ + /* foreignx, foreigny & orients */ + /* PLACED | UNPLACED */ + /* xh, yh or region */ +EXTERN int defwComponent (const char* instance, const char* master, int numNetName, const char** netNames, const char* eeq, const char* genName, const char* genParemeters, const char* source, int numForeign, const char** foreigns, int* foreignX, int* foreignY, int* foreignOrients, const char* status, int statusX, int statusY, int statusOrient, double weight, const char* region, int xl, int yl, int xh, int yh); + +/* This routine enter each component into the file. + * This routine must be called after the defwStartComponents call. + * The optional fields will be ignored if they are set to zero + * (except for weight which must be set to -1.0). + * Returns 0 if successful. + * The routine can be called many times. + * This routine is the same as defwComponent, except orient is a char** */ + /* */ + /* USER | TIMING */ + /* foreignx, foreigny & orients */ + /* PLACED | UNPLACED */ + /* xh, yh or region */ +EXTERN int defwComponentStr (const char* instance, const char* master, int numNetName, const char** netNames, const char* eeq, const char* genName, const char* genParemeters, const char* source, int numForeign, const char** foreigns, int* foreignX, int* foreignY, const char** foreignOrients, const char* status, int statusX, int statusY, const char* statusOrient, double weight, const char* region, int xl, int yl, int xh, int yh); + +/* This is a 5.8 syntax. + * Returns 0 if successful. + * The routine can be called only once. */ +EXTERN int defwComponentMaskShift (int shiftLayerMasks); + +/* This routine must be called after either the defwComponent or + * defwComponentStr. + * This routine can only called once per component. + * Either this routine or defwComponentHaloSoft can be called, but not both + * This routine is optional. + * This is a 5.6 syntax. + * Returns 0 if successful. */ +EXTERN int defwComponentHalo (int left, int bottom, int right, int top); + +/* This routine must be called after either the defwComponent or + * defwComponentStr. + * This routine can only called once per component. + * This routine is just like defwComponentHalo, except it writes the option SOFT + * Either this routine or defwComponentHalo can be called, but not both + * This routine is optional. + * This is a 5.7 syntax. + * Returns 0 if successful. */ +EXTERN int defwComponentHaloSoft (int left, int bottom, int right, int top); + +/* This routine must be called after either the defwComponent or + * defwComponentStr. + * This routine can only called once per component. + * This routine is optional. + * This is a 5.7 syntax. + * Returns 0 if successful. */ +EXTERN int defwComponentRouteHalo (int haloDist, const char* minLayer, const char* maxLayer); + +/* This routine must be called after the defwComponent calls. + * Returns 0 if successful. + * If the count in StartComponents is not the same as the number of + * calls to Component then DEFW_BAD_DATA will return returned. + * The routine can be called only once. */ +EXTERN int defwEndComponents (); + +/* This routine must be called after the components section (if any). + * This section of routines is optional. + * Returns 0 if successful. + * The routine starts the pins section. All of the pins must follow. + * The count is the number of defwPin calls to follow. + * The routine can be called only once. */ +EXTERN int defwStartPins (int count); + +/* This routine enter each pin into the file. + * This routine must be called after the defwStartPins call. + * The optional fields will be ignored if they are set to zero. + * Returns 0 if successful. + * The routine can be called many times. + * NOTE: Use defwPinLayer to write out layer with SPACING or DESIGNRULEWIDTH */ + /* INOUT | FEEDTHRU */ + /* GROUND | CLOCK | TIEOFF | ANALOG */ + /* COVER */ +EXTERN int defwPin (const char* name, const char* net, int special, const char* direction, const char* use, const char* status, int statusX, int statusY, int orient, const char* layer, int xl, int yl, int xh, int yh); + +/* This routine enter each pin into the file. + * This routine must be called after the defwStartPins call. + * The optional fields will be ignored if they are set to zero. + * Returns 0 if successful. + * The routine can be called many times. + * This routine is the same as defwPin, except orient is a char* + * NOTE: Use defwPinLayer to write out layer with SPACING or DESIGNRULEWIDTH */ + /* INOUT | FEEDTHRU */ + /* GROUND | CLOCK | TIEOFF | ANALOG */ + /* COVER */ +EXTERN int defwPinStr (const char* name, const char* net, int special, const char* direction, const char* use, const char* status, int statusX, int statusY, const char* orient, const char* layer, int xl, int yl, int xh, int yh); + +/* This routine should be called if the layer has either SPACING or + * DESIGNRULEWIDTH. If this routine is used and the pin has only one + * layer, the layer in defwPin or defwPinStr has to be null, otherwise + * the layer will be written out twice. + * This routine must be called after defwPin or defwPinStr. + * This is a 5.6 syntax. + * This routine is optional. + * Returns 0 if successful. + * This routine can be called multiple times within a pin. */ +EXTERN int defwPinLayer (const char* layerName, int spacing, int designRuleWidth, int xl, int yl, int xh, int yh, int mask); + +/* This routine must be called after defwPin or defwPinStr. + * This routine is to write out layer with polygon. + * This is a 5.6 syntax. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called multiple times within a pin. */ +EXTERN int defwPinPolygon (const char* layerName, int spacing, int designRuleWidth, int num_polys, double* xl, double* yl, int mask); + +/* This routine must be called after defwPin or defwPinStr. + * This routine is to write out layer with via. + * This is a 5.7 syntax. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called multiple times within a pin. */ +EXTERN int defwPinVia (const char* viaName, int xl, int yl, int mask); + +/* This routine must be called after defwPin or defwPinStr. + * This routine is to write out pin with port. + * This is a 5.7 syntax. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called multiple times within a pin. */ +EXTERN int defwPinPort (); + +/* This routine is called after defwPinPort. + * This is a 5.7 syntax. + * This routine is optional. + * Returns 0 if successful. + * This routine can be called multiple times within a pin. */ +EXTERN int defwPinPortLayer (const char* layerName, int spacing, int designRuleWidth, int xl, int yl, int xh, int yh, int mask); + +/* This routine must be called after defwPinPort. + * This is a 5.7 syntax. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called multiple times within a pin. */ +EXTERN int defwPinPortPolygon (const char* layerName, int spacing, int designRuleWidth, int num_polys, double* xl, double* yl, int mask); + +/* This routine must be called after defwPinPort. + * This is a 5.7 syntax. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called multiple times within a pin. */ +EXTERN int defwPinPortVia (const char* viaName, int xl, int yl, int mask); + +/* This routine must be called after defwPinPort. + * This is a 5.7 syntax. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called many times. + * NOTE: Use defwPinLayer to write out layer with SPACING or DESIGNRULEWIDTH */ +EXTERN int defwPinPortLocation (const char* status, int statusX, int statusY, const char* orient); + +/* This routine must be called after defwPin. + * Returns 0 if successful. + * This is a 5.6 syntax. + * The routine can be called only once per pin. */ +EXTERN int defwPinNetExpr (const char* pinExpr); + +/* This routine must be called after defwPin. + * Returns 0 if successful. + * This is a 5.6 syntax. + * The routine can be called only once per pin. */ +EXTERN int defwPinSupplySensitivity (const char* pinName); + +/* This routine must be called after defwPin. + * Returns 0 if successful. + * This is a 5.6 syntax. + * The routine can be called only once per pin. */ +EXTERN int defwPinGroundSensitivity (const char* pinName); + +/* This routine must be called after defwPin. + * Returns 0 if successful. + * This is a 5.4 syntax. + * The routine can be called multiple times. */ +EXTERN int defwPinAntennaPinPartialMetalArea (int value, const char* layerName); + +/* This routine must be called after defwPin. + * Returns 0 if successful. + * This is a 5.4 syntax. + * The routine can be called multiple times. */ +EXTERN int defwPinAntennaPinPartialMetalSideArea (int value, const char* layerName); + +/* This routine must be called after defwPin. + * Returns 0 if successful. + * This is a 5.4 syntax. + * The routine can be called multiple times. */ +EXTERN int defwPinAntennaPinPartialCutArea (int value, const char* layerName); + +/* This routine must be called after defwPin. + * Returns 0 if successful. + * This is a 5.4 syntax. + * The routine can be called multiple times. */ +EXTERN int defwPinAntennaPinDiffArea (int value, const char* layerName); + +/* This routine must be called after defwPin. + * Returns 0 if successful. + * This is a 5.5 syntax. + * The oxide can be either OXIDE1, OXIDE2, OXIDE3, or OXIDE4. + * Each oxide value can be called only once after defwPin. */ +EXTERN int defwPinAntennaModel (const char* oxide); + +/* This routine must be called after defwPin. + * Returns 0 if successful. + * This is a 5.4 syntax. + * The routine can be called multiple times. */ +EXTERN int defwPinAntennaPinGateArea (int value, const char* layerName); + +/* This routine must be called after defwPin. + * Returns 0 if successful. + * This is a 5.4 syntax. + * The routine can be called multiple times. */ +EXTERN int defwPinAntennaPinMaxAreaCar (int value, const char* layerName); + +/* This routine must be called after defwPin. + * Returns 0 if successful. + * This is a 5.4 syntax. + * The routine can be called multiple times. */ +EXTERN int defwPinAntennaPinMaxSideAreaCar (int value, const char* layerName); + +/* This routine must be called after defwPin. + * Returns 0 if successful. + * This is a 5.4 syntax. + * The routine can be called multiple times. */ +EXTERN int defwPinAntennaPinMaxCutCar (int value, const char* layerName); + +/* This routine must be called after the defwPin calls. + * Returns 0 if successful. + * If the count in StartPins is not the same as the number of + * calls to Pin then DEFW_BAD_DATA will return returned. + * The routine can be called only once. */ +EXTERN int defwEndPins (); + +/* This routine must be called after the pin section (if any). + * This section of routines is optional. + * Returns 0 if successful. + * The routine starts the pinproperties section. All of the pinproperties + * must follow. + * The count is the number of defwPinProp calls to follow. + * The routine can be called only once. */ +EXTERN int defwStartPinProperties (int count); + +/* This routine enter each pinproperty into the file. + * This routine must be called after the defwStartPinProperties call. + * The optional fields will be ignored if they are set to zero. + * Returns 0 if successful. + * The routine can be called many times. */ +EXTERN int defwPinProperty (const char* name, const char* pinName); + +/* This routine must be called after the defwPinProperty calls. + * Returns 0 if successful. + * If the count in StartPins is not the same as the number of + * calls to Pin then DEFW_BAD_DATA will return returned. + * The routine can be called only once. */ +EXTERN int defwEndPinProperties (); + +/* Routines to enter a special net or nets into the file. + * You must first call defwStartSpecialNets with the number of + * nets. This section is required, even if you do not have any nets. + * For each net you should call defwSpecialNet followed by + * one or more defwSpecialNetConnection calls. + * After the connections come the options. Options are + * NOT required. + * Each net is completed by calling defwSpecialNetEndOneNet(). + * The nets section is finished by calling defwEndNets(). */ +EXTERN int defwStartSpecialNets (int count); + +/* This routine must be called after the defwStartSpecialNets it is for + * - netName */ +EXTERN int defwSpecialNet (const char* name); + +/* This routine is for compNameRegExpr, pinName, and SYNTHESIZED */ +/* It can be called multiple times */ +EXTERN int defwSpecialNetConnection (const char* inst, const char* pin, int synthesized); + +/* This routine is for + FIXEDBUMP + * This is a 5.4.1 syntax */ +EXTERN int defwSpecialNetFixedbump (); + +/* This routine is for + VOLTAGE volts */ +EXTERN int defwSpecialNetVoltage (double v); + +/* This routine is for + SPACING layerName spacing [RANGE minwidth maxwidth */ +EXTERN int defwSpecialNetSpacing (const char* layer, int spacing, double minwidth, double maxwidth); + +/* This routine is for + WIDTH layerName width */ +EXTERN int defwSpecialNetWidth (const char* layer, int width); + +/* This routine is for + SOURCE {NETLIST | DIST | USER | TIMING} */ +EXTERN int defwSpecialNetSource (const char* name); + +/* This routine is for + ORIGINAL netName */ +EXTERN int defwSpecialNetOriginal (const char* name); + +/* This routine is for + PATTERN {STEINER | BALANCED | WIREDLOGIC | TRUNK} */ +EXTERN int defwSpecialNetPattern (const char* name); + +/* This routine is for + USE {SIGNAL | POWER | GROUND | CLOCK | TIEOFF | + ANALOG | SCAN | RESET} */ +EXTERN int defwSpecialNetUse (const char* name); + +/* This routine is for + WEIGHT weight */ +EXTERN int defwSpecialNetWeight (double value); + +/* This routine is for + ESTCAP wireCapacitance */ +EXTERN int defwSpecialNetEstCap (double value); + +/* Paths are a special type of option. A path must begin + * with a defwSpecialNetPathStart and end with a defwSpecialNetPathEnd(). + * The individual parts of the path can be entered in + * any order. */ +EXTERN int defwSpecialNetPathStart (const char* typ); + /* SHIELD | NEW */ +EXTERN int defwSpecialNetShieldNetName (const char* name); + +EXTERN int defwSpecialNetPathLayer (const char* name); + +EXTERN int defwSpecialNetPathWidth (int width); + +/* This routine is optional. + * This is a 5.6 syntax. */ +EXTERN int defwSpecialNetPathStyle (int styleNum); + +EXTERN int defwSpecialNetPathShape (const char* shapeType); + /* FOLLOWPIN | IOWIRE | COREWIRE | BLOCKWIRE | FILLWIRE | BLOCKAGEWIR */ + +/* This routine is optional. + This is a 5.8 syntax. + * Returns 0 if successful. */ +EXTERN int defwSpecialNetPathMask (int colorMask); + +/* x and y location of the path */ +EXTERN int defwSpecialNetPathPoint (int numPts, double* pointx, double* pointy); +EXTERN int defwSpecialNetPathVia (const char* name); + +/* This routine is called after defwSpecialNetPath + * This is a 5.4.1 syntax */ +EXTERN int defwSpecialNetPathViaData (int numX, int numY, int stepX, int stepY); + +/* x and y location of the path */ +EXTERN int defwSpecialNetPathPointWithWireExt (int numPts, double* pointx, double* pointy, double* optValue); + +EXTERN int defwSpecialNetPathEnd (); + +/* This is a 5.6 syntax + * This routine can be called multiple times. */ +EXTERN int defwSpecialNetPolygon (const char* layerName, int num_polys, double* xl, double* yl); + +/* This is a 5.6 syntax + * This routine can be called multiple times. */ +EXTERN int defwSpecialNetRect (const char* layerName, int xl, int yl, int xh, int yh); + +EXTERN int defwSpecialNetVia (const char* layerName); + +EXTERN int defwSpecialNetViaWithOrient (const char* layerName, int orient); + +EXTERN int defwSpecialNetViaPoints (int num_points, double* xl, double* yl); + +/* This routine is called at the end of each net */ +EXTERN int defwSpecialNetEndOneNet (); + +/* 5.3 for special net */ +/* Shields are a special type of option. A shield must begin + * with a defwSpecialNetShieldStart and end with a defwSpecialNetShieldEnd(). + * The individual parts of the shield can be entered in + * any order. */ +EXTERN int defwSpecialNetShieldStart (const char* name); + +EXTERN int defwSpecialNetShieldLayer (const char* name); +EXTERN int defwSpecialNetShieldWidth (int width); +EXTERN int defwSpecialNetShieldShape (const char* shapeType); + /* FOLLOWPIN | IOWIRE | COREWIRE | BLOCKWIRE | FILLWIRE | BLOCKAGEWIR */ + +/* x and y location of the path */ +EXTERN int defwSpecialNetShieldPoint (int numPts, double* pointx, double* pointy); +EXTERN int defwSpecialNetShieldVia (const char* name); + +/* A 5.4.1 syntax */ +EXTERN int defwSpecialNetShieldViaData (int numX, int numY, int stepX, int stepY); +EXTERN int defwSpecialNetShieldEnd (); +/* end 5.3 */ + +/* This routine is called at the end of the special net section */ +EXTERN int defwEndSpecialNets (); + +/* Routines to enter a net or nets into the file. + * You must first call defwNets with the number of nets. + * This section is required, even if you do not have any nets. + * For each net you should call defwNet followed by one or + * more defwNetConnection calls. + * After the connections come the options. Options are + * NOT required. + * Each net is completed by calling defwNetEndOneNet(). + * The nets section is finished by calling defwEndNets(). */ +EXTERN int defwStartNets (int count); + +/* This routine must be called after the defwStartNets, it is for - netName */ +EXTERN int defwNet (const char* name); + +/* This routine is for { compName | PIN } pinName [+ SYNTHESIZED] */ +/* It can be called multiple times */ +EXTERN int defwNetConnection (const char* inst, const char* pin, int synthesized); + +/* This routine is for MUSTJOIN, compName, pinName */ +EXTERN int defwNetMustjoinConnection (const char* inst, const char* pin); + +/* This routine is for + VPIN vpinName [LAYER layerName pt pt + * [{ PLACED | FIXED | COVER } pt orient] */ +EXTERN int defwNetVpin (const char* vpinName, const char* layerName, int layerXl, int layerYl, int layerXh, int layerYh, const char* status, int statusX, int statusY, int orient); + +/* This routine is for + VPIN vpinName [LAYER layerName pt pt + * [{ PLACED | FIXED | COVER } pt orient] + * This routine is the same as defwNetVpin, except orient is a char* */ +EXTERN int defwNetVpinStr (const char* vpinName, const char* layerName, int layerXl, int layerYl, int layerXh, int layerYh, const char* status, int statusX, int statusY, const char* orient); + +/* This routine can be called either within net or subnet. + * it is for NONDEFAULTRULE rulename */ +EXTERN int defwNetNondefaultRule (const char* name); + +/* This routine is for + XTALK num */ +EXTERN int defwNetXtalk (int xtalk); + +/* This routine is for + FIXEDBUMP + * This is a 5.4.1 syntax */ +EXTERN int defwNetFixedbump (); + +/* This routine is for + FREQUENCY + * This is a 5.4.1 syntax */ +EXTERN int defwNetFrequency (double frequency); + +/* This routine is for + SOURCE {NETLIST | DIST | USER | TEST | TIMING} */ +EXTERN int defwNetSource (const char* name); + +/* This routine is for + ORIGINAL netname */ +EXTERN int defwNetOriginal (const char* name); + +/* This routine is for + USE {SIGNAL | POWER | GROUND | CLOCK | TIEOFF | + * ANALOG} */ +EXTERN int defwNetUse (const char* name); + +/* This routine is for + PATTERN {STEINER | BALANCED | WIREDLOGIC} */ +EXTERN int defwNetPattern (const char* name); + +/* This routine is for + ESTCAP wireCapacitance */ +EXTERN int defwNetEstCap (double value); + +/* This routine is for + WEIGHT weight */ +EXTERN int defwNetWeight (double value); + +/* 5.3 for net */ +/* This routine is for + SHIELDNET weight */ +EXTERN int defwNetShieldnet (const char* name); + +/* Noshield are a special type of option. A noshield must begin + * with a defwNetNoshieldStart and end with a defwNetNoshieldEnd(). + * The individual parts of the noshield can be entered in + * any order. */ +EXTERN int defwNetNoshieldStart (const char* name); + +/* x and y location of the path */ +EXTERN int defwNetNoshieldPoint (int numPts, const char** pointx, const char** pointy); +EXTERN int defwNetNoshieldVia (const char* name); +EXTERN int defwNetNoshieldEnd (); +/* end 5.3 */ + +/* Subnet are a special type of option. A subnet must begin + * with a defwNetSubnetStart and end with a defwNetSubnetEnd(). + * Routines to call within the subnet are: defwNetSubnetPin, + * defwNetNondefaultRule and defwNetPathStart... */ +EXTERN int defwNetSubnetStart (const char* name); + +/* This routine is called after the defwNetSubnet, it is for + * [({compName | PIN} pinName) | (VPIN vpinName)]... */ +EXTERN int defwNetSubnetPin (const char* compName, const char* pinName); + +EXTERN int defwNetSubnetEnd (); + +/* Paths are a special type of option. A path must begin + * with a defwNetPathStart and end with a defwPathEnd(). + * The individual parts of the path can be entered in + * any order. */ +EXTERN int defwNetPathStart (const char* typ); + /* NOSHIELD | NEW */ +EXTERN int defwNetPathWidth (int w); +EXTERN int defwNetPathLayer (const char* name, int isTaper, const char* rulename); + /*rulename can be assigned */ +/* This routine is optional. + * This is a 5.6 syntax. */ +EXTERN int defwNetPathStyle (int styleNum); + +/* This routine is optional. + * This is a 5.8 syntax. */ +EXTERN int defwNetPathMask (int maskNum); + +EXTERN int defwNetPathRect (int deltaX1, int deltaY1, int deltaX2, int deltaY2); + +EXTERN int defwNetPathVirtual (int x, int y); + +/* x and y location of the path */ +EXTERN int defwNetPathPoint (int numPts, double* pointx, double* pointy); + +EXTERN int defwNetPathPointWithExt (int numPts, double* pointx, double* pointy, double* optValue); + +EXTERN int defwNetPathVia (const char* name); + +EXTERN int defwNetPathViaWithOrient (const char* name, int orient); + +EXTERN int defwNetPathViaWithOrientStr (const char* name, const char* orient); +EXTERN int defwNetPathEnd (); + +/* This routine is called at the end of each net */ +EXTERN int defwNetEndOneNet (); + +/* This routine is called at the end of the net section */ +EXTERN int defwEndNets (); + +/* This section of routines is optional. + * Returns 0 if successful. + * The routine starts the I/O Timing section. All of the iotimings options + * must follow. + * The count is the number of defwIOTiming calls to follow. + * The routine can be called only once. + * This api is obsolete in 5.4. */ +EXTERN int defwStartIOTimings (int count); + +/* This routine can be called after defwStaratIOTiming + * It is for - - {(comp pin) | (PIN name)} + * This api is obsolete in 5.4. */ +EXTERN int defwIOTiming (const char* inst, const char* pin); + +/* This routine is for + { RISE | FALL } VARIABLE min max + * This api is obsolete in 5.4. */ +EXTERN int defwIOTimingVariable (const char* riseFall, int num1, int num2); + +/* This routine is for + { RISE | FALL } SLEWRATE min max + * This api is obsolete in 5.4. */ +EXTERN int defwIOTimingSlewrate (const char* riseFall, int num1, int num2); + +/* This routine is for + DRIVECELL macroName [[FROMPIN pinName] TOPIN pinName] + * [PARALLEL numDrivers] + * This api is obsolete in 5.4. */ +EXTERN int defwIOTimingDrivecell (const char* name, const char* fromPin, const char* toPin, int numDrivers); + +/* This routine is for + CAPACITANCE capacitance + * This api is obsolete in 5.4. */ +EXTERN int defwIOTimingCapacitance (double num); + +/* This api is obsolete in 5.4. */ +EXTERN int defwEndIOTimings (); + +/* Routines to enter scan chains. This section is optional + * The section must start with a defwStartScanchains() call and + * end with a defwEndScanchain() call. + * Each scan chain begins with a defwScanchain() call. + * The rest of the calls follow. */ +EXTERN int defwStartScanchains (int count); + +/* This routine can be called after defwStartScanchains + * It is for - chainName */ +EXTERN int defwScanchain (const char* name); + +/* This routine is for + COMMONSCANPINS [IN pin] [OUT pin] */ +EXTERN int defwScanchainCommonscanpins (const char* inst1, const char* pin1, const char* inst2, const char* pin2); + +/* This routine is for + PARTITION paratitionName [MAXBITS maxBits] */ +/* This is 5.4.1 syntax */ +EXTERN int defwScanchainPartition (const char* name, int maxBits); + +/* This routine is for + START {fixedInComp | PIN } [outPin] */ +EXTERN int defwScanchainStart (const char* inst, const char* pin); + +/* This routine is for + STOP {fixedOutComp | PIN } [inPin] */ +EXTERN int defwScanchainStop (const char* inst, const char* pin); + +/* This routine is for + FLOATING {floatingComp [IN pin] [OUT pin]} + * This is a 5.4.1 syntax */ +EXTERN int defwScanchainFloating (const char* name, const char* inst1, const char* pin1, const char* inst2, const char* pin2); + +/* This routine is for + FLOATING {floatingComp [IN pin] [OUT pin]} + * This is a 5.4.1 syntax. + * This routine is the same as defwScanchainFloating. But also added + * the option BITS. */ +EXTERN int defwScanchainFloatingBits (const char* name, const char* inst1, const char* pin1, const char* inst2, const char* pin2, int bits); + +/* This routine is for + ORDERED {fixedComp [IN pin] [OUT pin] + * fixedComp [IN pin] [OUT pin]. + * When this routine is called for the 1st time within a scanchain, + * both name1 and name2 are required. Only name1 is required is the + * routine is called more than once. */ +EXTERN int defwScanchainOrdered (const char* name1, const char* inst1, const char* pin1, const char* inst2, const char* pin2, const char* name2, const char* inst3, const char* pin3, const char* inst4, const char* pin4); + +/* This routine is for + ORDERED {fixedComp [IN pin] [OUT pin] + * fixedComp [IN pin] [OUT pin]. + * When this routine is called for the 1st time within a scanchain, + * both name1 and name2 are required. Only name1 is required is the + * routine is called more than once. + * This is a 5.4.1 syntax. + * This routine is the same as defwScanchainOrdered. But also added + * the option BITS */ +EXTERN int defwScanchainOrderedBits (const char* name1, const char* inst1, const char* pin1, const char* inst2, const char* pin2, int bits1, const char* name2, const char* inst3, const char* pin3, const char* inst4, const char* pin4, int bits2); + +EXTERN int defwEndScanchain (); + +/* Routines to enter constraints. This section is optional + * The section must start with a defwStartConstrains() call and + * end with a defwEndConstraints() call. + * Each contraint will call the defwConstraint...(). + * This api is obsolete in 5.4. */ +EXTERN int defwStartConstraints (int count); + +/* The following routines are for - {operand [+ RISEMAX time] [+ FALLMAX time] + * [+ RISEMIN time] [+ FALLMIN time] | WIREDLOGIC netName MAXDIST distance };} + * operand - NET netName | PATH comp fromPin comp toPin | SUM (operand, ...) + * The following apis are obsolete in 5.4. */ +EXTERN int defwConstraintOperand (); +EXTERN int defwConstraintOperandNet (const char* netName); +EXTERN int defwConstraintOperandPath (const char* comp1, const char* fromPin, const char* comp2, const char* toPin); +EXTERN int defwConstraintOperandSum (); +EXTERN int defwConstraintOperandSumEnd (); +EXTERN int defwConstraintOperandTime (const char* timeType, int time); +EXTERN int defwConstraintOperandEnd (); + +/* This routine is for - WIRELOGIC netName MAXDIST distance */ +EXTERN int defwConstraintWiredlogic (const char* netName, int distance); + +EXTERN int defwEndConstraints (); + +/* Routines to enter groups. This section is optional + * The section must start with a defwStartGroups() call and + * end with a defwEndGroups() call. + * Each group will call the defwGroup...(). */ +EXTERN int defwStartGroups (int count); + +/* This routine is for - groupName compNameRegExpr ... */ +EXTERN int defwGroup (const char* groupName, int numExpr, const char** groupExpr); + +/* This routine is for + SOFT [MAXHALFPERIMETER value] [MAXX value] + * [MAXY value] */ +EXTERN int defwGroupSoft (const char* type1, double value1, const char* type2, double value2, const char* type3, double value3); + +/* This routine is for + REGION {pt pt | regionName} */ +EXTERN int defwGroupRegion (int xl, int yl, int xh, int yh, const char* regionName); + +EXTERN int defwEndGroups (); + +/* Routines to enter Blockages. This section is optional + * The section must start with a defwStartBlockages() call and + * end with a defwEndBlockages() call. + * Each blockage will call the defwBlockages...(). + * This is a 5.4 syntax. */ +EXTERN int defwStartBlockages (int count); + +/* This routine is for - layerName +* This routine is called per entry within a blockage for layer. +* This is a 5.4 syntax. */ +EXTERN int defwBlockagesLayer (const char* layerName); + +/* This routine is for - slots +* This routine is called per entry within a blockage layer, can't be more then one. +* This is a 5.4 syntax. */ +EXTERN int defwBlockagesLayerSlots (); + +/* This routine is for - fills +* This routine is called per entry within a blockage layer, can't be more then one. +* This is a 5.4 syntax. */ +EXTERN int defwBlockagesLayerFills (); + +/* This routine is for - pushdown +* This routine is called per entry within a blockage layer, can't be more then one. +* This is a 5.4 syntax. */ +EXTERN int defwBlockagesLayerPushdown (); + +/* This routine is for - exceptpgnet +* This routine is called per entry within a blockage layer, can't be more then one. +* This is a 5.7 syntax. */ +EXTERN int defwBlockagesLayerExceptpgnet (); + +/* This routine is for - component +* This routine called per entry within a blockage layer, can't be more than one. +* This is a 5.6 syntax. */ +EXTERN int defwBlockagesLayerComponent (const char* compName); + +/* This routine is for - spacing +* Either this routine or defwBlockagesDesignRuleWidth is called per entry +* within a blockage layer, can't be more than one. +* This is a 5.6 syntax. */ +EXTERN int defwBlockagesLayerSpacing (int minSpacing); + +/* This routine is for - designrulewidth +* Either this routine or defwBlockagesSpacing is called per entry +* within a blockage layer, can't be more than one. +* This is a 5.6 syntax. */ +EXTERN int defwBlockagesLayerDesignRuleWidth (int effectiveWidth); + +/* This routine is for - mask. +* This routine called per entry within a blockage layer, can't be more than one. +* This is a 5.8 syntax. */ +EXTERN int defwBlockagesLayerMask (int maskColor); + +/* This routine is for - layerName & compName + * Either this routine, defBlockageLayerSlots, defBlockageLayerFills, + * or defwBlockagePlacement is called per entry within + * a blockage, can't be more then one. + * This is a 5.4 syntax. */ +EXTERN int defwBlockageLayer (const char* layerName, const char* compName); + +/* This routine is for - layerName & slots + * Either this routine, defBlockageLayer, defBlockageLayerFills, + * defwBlockagePlacement, or defwBlockagePushdown is called per entry within + * a blockage, can't be more then one. + * This is a 5.4 syntax. */ +EXTERN int defwBlockageLayerSlots (const char* layerName); + +/* This routine is for - layerName & fills + * Either this routine, defBlockageLayer, defBlockageLayerSlots, + * defwBlockagePlacement, or defwBlockagePushdown is called per entry within + * a blockage, can't be more then one. + * This is a 5.4 syntax. */ +EXTERN int defwBlockageLayerFills (const char* layerName); + +/* This routine is for - layerName & pushdown + * Either this routine, defBlockageLayer, defBlockageLayerSlots, + * defwBlockagePlacement, or defwBlockageFills is called per entry within + * a blockage, can't be more then one. + * This is a 5.4 syntax. */ +EXTERN int defwBlockageLayerPushdown (const char* layerName); + +/* This routine is for - exceptpgnet + * Either this routine, defBlockageLayer, defBlockageLayerSlots, + * defwBlockagePlacement, or defwBlockageFills is called per entry within + * a blockage, can't be more then one. + * This is a 5.7 syntax. */ +EXTERN int defwBlockageLayerExceptpgnet (const char* layerName); + +/* This routine is for - spacing + * Either this routine or defwBlockageDesignRuleWidth is called per entry + * within a blockage, can't be more than one. + * This is a 5.6 syntax. */ +EXTERN int defwBlockageSpacing (int minSpacing); + +/* This routine is for - designrulewidth + * Either this routine or defwBlockageSpacing is called per entry + * within a blockage, can't be more than one. + * This is a 5.6 syntax. */ +EXTERN int defwBlockageDesignRuleWidth (int effectiveWidth); + +/* This routine is for - placement + * This routine is called per entry within blockage for placement. + * This is a 5.4 syntax. + * 11/25/2002 - bug fix: submitted by Craig Files (cfiles@ftc.agilent.com) + * this routine allows to call blockage without a component. */ +EXTERN int defwBlockagesPlacement (); + +/* This routine is for - component +* This routine is called per entry within blockage placement, can't be more then one. +* This is a 5.4 syntax. */ +EXTERN int defwBlockagesPlacementComponent (const char* compName); + +/* This routine is for - Pushdown +* This routine is called per entry within blockage placement, can't be more then one. +* This is a 5.4 syntax. */ +EXTERN int defwBlockagesPlacementPushdown (); + +/* This routine is for - soft +* Either this routine or defwBlockagesPlacementPartial +* is called per entry within blockage placement, can't be more then one. +* This is a 5.7 syntax. */ +EXTERN int defwBlockagesPlacementSoft (); + +/* This routine is for - Partial +* Either this routine or defwBlockagesPlacementSoft +* is called per entry within blockage placement, can't be more then one. +* This is a 5.7 syntax. */ +EXTERN int defwBlockagesPlacementPartial (double maxDensity); + +/* This routine is for rectangle. +* This routine is optional and can be called multiple time. +* This is a 5.4 syntax. */ +EXTERN int defwBlockagesRect (int xl, int yl, int xh, int yh); + +/* This routine is for polygon. +* This routine is optional and can be called multiple time. +* This is a 5.6 syntax. */ +EXTERN int defwBlockagesPolygon (int num_polys, int* xl, int* yl); + +/* This routine is for - placement +* Either this routine or defBlockageLayer +* is called per entry within blockage, can't be more then one. +* This is a 5.4 syntax. +* 11/25/2002 - bug fix: submitted by Craig Files (cfiles@ftc.agilent.com) +* this routine allows to call blockage without a component. */ +EXTERN int defwBlockagePlacement (); + +/* This routine is for - placement & component + * Either this routine or defwBlockagePlacementPushdown + * is called per entry within blockage, can't be more then one. + * This is a 5.4 syntax. */ +EXTERN int defwBlockagePlacementComponent (const char* compName); + +/* This routine is for - placement & Pushdown + * Either this routine or defwBlockagePlacementComponent + * is called per entry within blockage, can't be more then one. + * This is a 5.4 syntax. */ +EXTERN int defwBlockagePlacementPushdown (); + +/* This routine is for - placement & soft + * Either this routine or defwBlockagePlacementPushdown + * is called per entry within blockage, can't be more then one. + * This is a 5.7 syntax. */ +EXTERN int defwBlockagePlacementSoft (); + +/* This routine is for - placement & Partial + * Either this routine or defwBlockagePlacementComponent + * is called per entry within blockage, can't be more then one. + * This is a 5.7 syntax. */ +EXTERN int defwBlockagePlacementPartial (double maxDensity); + +/* This routine is optional. + * This is a 5.8 syntax. */ +EXTERN int defwBlockageMask (int maskColor); + +/* This routine is for rectangle. + * This is a 5.4 syntax. */ +EXTERN int defwBlockageRect (int xl, int yl, int xh, int yh); + +/* This routine is for polygon. + * This routine is optinal and can be called multiple time. + * This is a 5.6 syntax. */ +EXTERN int defwBlockagePolygon (int num_polys, int* xl, int* yl); + +/* This is a 5.4 syntax. */ +EXTERN int defwEndBlockages (); + +/* Routines to enter Slots. This section is optional + * The section must start with a defwStartSlots() call and + * end with a defwEndSlots() call. + * Each slots will call the defwSlots...(). + * This is a 5.4 syntax. */ +EXTERN int defwStartSlots (int count); + +/* This routine is for - layerName & compName + * Either this routine, defSlots, defSlotsLayerFills, + * or defwSlotsPlacement is called per entry within + * a slot, can't be more then one. + * This is a 5.4 syntax. */ +EXTERN int defwSlotLayer (const char* layerName); + +/* This routine is for rectangle + * This is a 5.4 syntax. */ +EXTERN int defwSlotRect (int xl, int yl, int xh, int yh); + +/* This routine is for rectangle + * This is a 5.6 syntax and can be called multiple time. */ +EXTERN int defwSlotPolygon (int num_polys, double* xl, double* yl); + +/* This is a 5.4 syntax. */ +EXTERN int defwEndSlots (); + +/* Routines to enter Fills. This section is optional + * The section must start with a defwStartFills() call and + * end with a defwEndFills() call. + * Each fills will call the defwFills...(). + * This is a 5.4 syntax. */ +EXTERN int defwStartFills (int count); + +/* This routine is for - layerName & compName + * Either this routine, defFills, defFillsLayerFills, + * or defwFillsPlacement is called per entry within + * a fill, can't be more then one. + * This is a 5.4 syntax. */ +EXTERN int defwFillLayer (const char* layerName); + +/* This routine is optional. + * This is a 5.8 syntax. */ +EXTERN int defwFillLayerMask (int maskColor); + +/* This routine has to be called after defwFillLayer + * This routine is optional. + * This is a 5.7 syntax. */ +EXTERN int defwFillLayerOPC (); + +/* This routine is for rectangle. + * This is a 5.4 syntax. */ +EXTERN int defwFillRect (int xl, int yl, int xh, int yh); + +/* This routine is for polygon. + * This is a 5.6 syntax and can be called multiple time. */ +EXTERN int defwFillPolygon (int num_polys, double* xl, double* yl); + +/* This routine is for via. + * This routine is optional. + * This is a 5.7 syntax and can be called multiple time. */ +EXTERN int defwFillVia (const char* viaName); + +/* This routine is optional. + * This is a 5.8 syntax. */ +EXTERN int defwFillViaMask (int colorMask); + +/* This routine is for via OPC. + * This routine can only be called after defwFillVia. + * This routine is optional. + * This is a 5.7 syntax and can be called multiple time. */ +EXTERN int defwFillViaOPC (); + +/* This routine is for via OPC. + * This routine can only be called after defwFillVia. + * This routine is required following defwFillVia. + * This is a 5.7 syntax and can be called multiple time. */ +EXTERN int defwFillPoints (int num_points, double* xl, double* yl); + +/* This is a 5.4 syntax. */ +EXTERN int defwEndFills (); + +/* Routines to enter NONDEFAULTRULES. This section is required + * The section must start with a defwStartNonDefaultRules() and + * end with defwEndNonDefaultRules() call. + * This is a 5.6 syntax. */ +EXTERN int defwStartNonDefaultRules (int count); + +/* This routine is for Layer within the NONDEFAULTRULES + * This routine can be called multiple times. It is required. + * This is a 5.6 syntax. + * Returns 0 if successful. */ +EXTERN int defwNonDefaultRule (const char* ruleName, int hardSpacing); + +/* Routines to enter NONDEFAULTRULES. This section is required + * This routine must be called after the defwNonDefaultRule. + * This routine can be called multiple times. + * This is a 5.6 syntax. + * Returns 0 if successful. */ +EXTERN int defwNonDefaultRuleLayer (const char* layerName, int width, int diagWidth, int spacing, int wireExt); + +/* Routines to enter NONDEFAULTRULES. This section is optional. + * This routine must be called after the defwNonDefaultRule. + * This routine can be called multiple times. + * This is a 5.6 syntax. + * Returns 0 if successful. */ +EXTERN int defwNonDefaultRuleVia (const char* viaName); + +/* Routines to enter NONDEFAULTRULES. This section is optional. + * This routine must be called after the defwNonDefaultRule. + * This routine can be called multiple times. + * This is a 5.6 syntax. + * Returns 0 if successful. */ +EXTERN int defwNonDefaultRuleViaRule (const char* viaRuleName); + +/* Routines to enter NONDEFAULTRULES. This section is optional. + * This routine must be called after the defwNonDefaultRule. + * This routine can be called multiple times. + * This is a 5.6 syntax. + * Returns 0 if successful. */ +EXTERN int defwNonDefaultRuleMinCuts (const char* cutLayerName, int numCutS); + +/* This is a 5.4 syntax. */ +EXTERN int defwEndNonDefaultRules (); + +/* Routines to enter STYLES. This section is required + * The section must start with a defwStartStyles() and + * end with defwEndStyles() call. + * This is a 5.6 syntax. */ +EXTERN int defwStartStyles (int count); + +/* This routine is for Layer within the NONDEFAULTRULES + * This routine can be called multiple times. It is required. + * This is a 5.6 syntax. + * Returns 0 if successful. */ +EXTERN int defwStyles (int styleNums, int num_points, double* xp, double* yp); + +/* This is a 5.4 syntax. */ +EXTERN int defwEndStyles (); + +/* This routine is called after defwInit. + * This routine is optional and it can be called only once. + * Returns 0 if successful. */ +EXTERN int defwStartBeginext (const char* name); + +/* This routine is called after defwBeginext. + * This routine is optional, it can be called only once. + * Returns 0 if successful. */ +EXTERN int defwBeginextCreator (const char* creatorName); + +/* This routine is called after defwBeginext. + * This routine is optional, it can be called only once. + * It gets the current system time and date. + * Returns 0 if successful. */ +EXTERN int defwBeginextDate (); + +/* This routine is called after defwBeginext. + * This routine is optional, it can be called only once. + * Returns 0 if successful. */ +EXTERN int defwBeginextRevision (int vers1, int vers2); + +/* This routine is called after defwBeginext. + * This routine is optional, it can be called many times. + * It allows user to customize their own syntax. + * Returns 0 if successful. */ +EXTERN int defwBeginextSyntax (const char* title, const char* string); + +/* This routine is called after defwInit. + * This routine is optional and it can be called only once. + * Returns 0 if successful. */ +EXTERN int defwEndBeginext (); + +/* End the DEF file. + * This routine IS NOT OPTIONAL. + * The routine must be called LAST. */ +EXTERN int defwEnd (); + +/* General routines that can be called anytime after the Init is called. + */ +EXTERN int defwCurrentLineNumber (); + +/* + * extern void defwError ( const char *, ... ); + * extern void defwWarning ( const char *, ... ); + * extern void defwVError ( const char *, va_list ); + * extern void defwVWarning ( const char *, va_list ); + * extern int defwGetCurrentLineNumber (void); + * extern const char *defwGetCurrentFileName (void); + */ + +/* This routine will print the error message. */ +EXTERN void defwPrintError (int status); + +/* This routine will allow user to write their own comemnt. It will + * automactically add a # infront of the line. + */ +EXTERN void defwAddComment (const char* comment); + +/* This routine will indent 3 blank spaces */ +EXTERN void defwAddIndent (); + +#endif diff --git a/src/def/cdef/defwWriterCalls.h b/src/def/cdef/defwWriterCalls.h new file mode 100644 index 00000000..fee6d4e2 --- /dev/null +++ b/src/def/cdef/defwWriterCalls.h @@ -0,0 +1,207 @@ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! */ +/* ************************************************************************** */ +/* ************************************************************************** */ +/* Copyright 2013-2014, Cadence Design Systems */ +/* */ +/* This file is part of the Cadence LEF/DEF Open Source */ +/* Distribution, Product Version 5.8. */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* For updates, support, or to become part of the LEF/DEF Community, */ +/* check www.openeda.org for details. */ +/* */ +/* $Author: dell $ */ +/* $Revision: #1 $ */ +/* $Date: 2017/06/06 $ */ +/* $State: $ */ +/* ************************************************************************** */ +/* ************************************************************************** */ + + +#ifndef CDEFWWRITERCALLS_H +#define CDEFWWRITERCALLS_H + +#include +#include "defiTypedefs.h" + +/* + * The main writer function. + * The file should already be opened. This requirement allows + * the writer to be used with stdin or a pipe. The file name + * is only used for error messages. The includeSearchPath is + * a colon-delimited list of directories in which to find + * include files. + */ +EXTERN int defwWrite (FILE * file, const char * fileName, defiUserData userData); + +/* + * Set all of the callbacks that have not yet been set to a function + * that will add up how many times a given def data type was ignored + * (ie no callback was done). The statistics can later be printed out. + */ +EXTERN void defwSetRegisterUnusedCallbacks (); +EXTERN void defwPrintUnusedCallbacks (FILE* log); + +/* + * Set/get the client-provided user data. defi doesn't look at + * this data at all, it simply passes the opaque defiUserData pointer + * back to the application with each callback. The client can + * change the data at any time, and it will take effect on the + * next callback. The defi writer and writer maintain separate + * user data pointers. + */ +EXTERN void defwSetUserData (defiUserData p0); +EXTERN defiUserData defwGetUserData (); + +/* + * An enum describing all of the types of writer callbacks. + */ +typedef enum { + defwUnspecifiedCbkType = 0, + defwVersionCbkType = 1, + defwCaseSensitiveCbkType = 2, + defwBusBitCbkType = 3, + defwDividerCbkType = 4, + defwDesignCbkType = 5, + defwTechCbkType = 6, + defwArrayCbkType = 7, + defwFloorPlanCbkType = 8, + defwUnitsCbkType = 9, + defwHistoryCbkType = 10, + defwPropDefCbkType = 11, + defwDieAreaCbkType = 12, + defwRowCbkType = 13, + defwTrackCbkType = 14, + defwGcellGridCbkType = 15, + defwDefaultCapCbkType = 16, + defwCanplaceCbkType = 17, + defwCannotOccupyCbkType = 18, + defwViaCbkType = 19, + defwRegionCbkType = 20, + defwComponentCbkType = 21, + defwPinCbkType = 22, + defwPinPropCbkType = 23, + defwSNetCbkType = 24, + defwNetCbkType = 25, + defwIOTimingCbkType = 26, + defwScanchainCbkType = 27, + defwConstraintCbkType = 28, + defwAssertionCbkType = 29, + defwGroupCbkType = 30, + defwBlockageCbkType = 31, + defwExtCbkType = 32, + defwDesignEndCbkType = 33 + + /* NEW CALLBACKS - each callback has its own type. For each callback + * that you add, you must add an item to this enum. */ + +} defwCallbackType_e; + +/* Declarations of function signatures for each type of callback. + * These declarations are type-safe when compiling with ANSI C + * or C++; you will only be able to register a function pointer + * with the correct signature for a given type of callback. + * + * Each callback function is expected to return 0 if successful. + * A non-zero return code will cause the writer to abort. + * + * The defwDesignStart and defwDesignEnd callback is only called once. + * Other callbacks may be called multiple times, each time with a different + * set of data. + * + * For each callback, the Def API will make the callback to the + * function supplied by the client, which should either make a copy + * of the Def object, or store the data in the client's own data structures. + * The Def API will delete or reuse each object after making the callback, + * so the client should not keep a pointer to it. + * + * All callbacks pass the user data pointer provided in defwRead() + * or defwSetUserData() back to the client; this can be used by the + * client to obtain access to the rest of the client's data structures. + * + * The user data pointer is obtained using defwGetUserData() immediately + * prior to making each callback, so the client is free to change the + * user data on the fly if necessary. + * + * Callbacks with the same signature are passed a callback type + * parameter, which allows an application to write a single callback + * function, register that function for multiple callbacks, then + * switch based on the callback type to handle the appropriate type of + * data. + */ + +/* A declaration of the signature of all callbacks that return nothing. */ +typedef int (*defwVoidCbkFnType) ( defwCallbackType_e, defiUserData ); + +/* Functions to call to register a callback function. + */ +EXTERN void defwSetArrayCbk (defwVoidCbkFnType p0); +EXTERN void defwSetAssertionCbk (defwVoidCbkFnType p0); +EXTERN void defwSetBlockageCbk (defwVoidCbkFnType p0); +EXTERN void defwSetBusBitCbk (defwVoidCbkFnType p0); +EXTERN void defwSetCannotOccupyCbk (defwVoidCbkFnType p0); +EXTERN void defwSetCanplaceCbk (defwVoidCbkFnType p0); +EXTERN void defwSetCaseSensitiveCbk (defwVoidCbkFnType p0); +EXTERN void defwSetComponentCbk (defwVoidCbkFnType p0); +EXTERN void defwSetConstraintCbk (defwVoidCbkFnType p0); +EXTERN void defwSetDefaultCapCbk (defwVoidCbkFnType p0); +EXTERN void defwSetDesignCbk (defwVoidCbkFnType p0); +EXTERN void defwSetDesignEndCbk (defwVoidCbkFnType p0); +EXTERN void defwSetDieAreaCbk (defwVoidCbkFnType p0); +EXTERN void defwSetDividerCbk (defwVoidCbkFnType p0); +EXTERN void defwSetExtCbk (defwVoidCbkFnType p0); +EXTERN void defwSetFloorPlanCbk (defwVoidCbkFnType p0); +EXTERN void defwSetGcellGridCbk (defwVoidCbkFnType p0); +EXTERN void defwSetGroupCbk (defwVoidCbkFnType p0); +EXTERN void defwSetHistoryCbk (defwVoidCbkFnType p0); +EXTERN void defwSetIOTimingCbk (defwVoidCbkFnType p0); +EXTERN void defwSetNetCbk (defwVoidCbkFnType p0); +EXTERN void defwSetPinCbk (defwVoidCbkFnType p0); +EXTERN void defwSetPinPropCbk (defwVoidCbkFnType p0); +EXTERN void defwSetPropDefCbk (defwVoidCbkFnType p0); +EXTERN void defwSetRegionCbk (defwVoidCbkFnType p0); +EXTERN void defwSetRowCbk (defwVoidCbkFnType p0); +EXTERN void defwSetSNetCbk (defwVoidCbkFnType p0); +EXTERN void defwSetScanchainCbk (defwVoidCbkFnType p0); +EXTERN void defwSetTechnologyCbk (defwVoidCbkFnType p0); +EXTERN void defwSetTrackCbk (defwVoidCbkFnType p0); +EXTERN void defwSetUnitsCbk (defwVoidCbkFnType p0); +EXTERN void defwSetVersionCbk (defwVoidCbkFnType p0); +EXTERN void defwSetViaCbk (defwVoidCbkFnType p0); + +/* NEW CALLBACK - each callback must have a function to allow the user + * to set it. Add the function here. */ + +/* + * Set all of the callbacks that have not yet been set to the following + * function. This is especially useful if you want to check to see + * if you forgot anything. + */ +EXTERN void defwSetUnusedCallbacks (defwVoidCbkFnType func); + +/* Routine to set the message logging routine for errors */ + typedef void (*DEFI_LOG_FUNCTION) (const char*); + +EXTERN void defwSetLogFunction (DEFI_LOG_FUNCTION p0); + +/* Routine to set the message logging routine for warnings */ +#ifndef DEFI_WARNING_LOG_FUNCTION + typedef void (*DEFI_WARNING_LOG_FUNCTION)(const char*); +#endif + +EXTERN void defwSetWarningLogFunction (DEFI_WARNING_LOG_FUNCTION p0); + +#endif diff --git a/src/def/cdef/xdefiAssertion.cpp b/src/def/cdef/xdefiAssertion.cpp new file mode 100644 index 00000000..bd500e97 --- /dev/null +++ b/src/def/cdef/xdefiAssertion.cpp @@ -0,0 +1,127 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defiAssertion.h" +#include "defiAssertion.hpp" + +// Wrappers definitions. +int defiAssertion_isAssertion (const ::defiAssertion* obj) { + return ((LefDefParser::defiAssertion*)obj)->isAssertion(); +} + +int defiAssertion_isConstraint (const ::defiAssertion* obj) { + return ((LefDefParser::defiAssertion*)obj)->isConstraint(); +} + +int defiAssertion_isWiredlogic (const ::defiAssertion* obj) { + return ((LefDefParser::defiAssertion*)obj)->isWiredlogic(); +} + +int defiAssertion_isDelay (const ::defiAssertion* obj) { + return ((LefDefParser::defiAssertion*)obj)->isDelay(); +} + +int defiAssertion_isSum (const ::defiAssertion* obj) { + return ((LefDefParser::defiAssertion*)obj)->isSum(); +} + +int defiAssertion_isDiff (const ::defiAssertion* obj) { + return ((LefDefParser::defiAssertion*)obj)->isDiff(); +} + +int defiAssertion_hasRiseMin (const ::defiAssertion* obj) { + return ((LefDefParser::defiAssertion*)obj)->hasRiseMin(); +} + +int defiAssertion_hasRiseMax (const ::defiAssertion* obj) { + return ((LefDefParser::defiAssertion*)obj)->hasRiseMax(); +} + +int defiAssertion_hasFallMin (const ::defiAssertion* obj) { + return ((LefDefParser::defiAssertion*)obj)->hasFallMin(); +} + +int defiAssertion_hasFallMax (const ::defiAssertion* obj) { + return ((LefDefParser::defiAssertion*)obj)->hasFallMax(); +} + +double defiAssertion_riseMin (const ::defiAssertion* obj) { + return ((LefDefParser::defiAssertion*)obj)->riseMin(); +} + +double defiAssertion_riseMax (const ::defiAssertion* obj) { + return ((LefDefParser::defiAssertion*)obj)->riseMax(); +} + +double defiAssertion_fallMin (const ::defiAssertion* obj) { + return ((LefDefParser::defiAssertion*)obj)->fallMin(); +} + +double defiAssertion_fallMax (const ::defiAssertion* obj) { + return ((LefDefParser::defiAssertion*)obj)->fallMax(); +} + +const char* defiAssertion_netName (const ::defiAssertion* obj) { + return ((const LefDefParser::defiAssertion*)obj)->netName(); +} + +double defiAssertion_distance (const ::defiAssertion* obj) { + return ((LefDefParser::defiAssertion*)obj)->distance(); +} + +int defiAssertion_numItems (const ::defiAssertion* obj) { + return ((LefDefParser::defiAssertion*)obj)->numItems(); +} + +int defiAssertion_isPath (const ::defiAssertion* obj, int index) { + return ((LefDefParser::defiAssertion*)obj)->isPath(index); +} + +int defiAssertion_isNet (const ::defiAssertion* obj, int index) { + return ((LefDefParser::defiAssertion*)obj)->isNet(index); +} + +void defiAssertion_path (const ::defiAssertion* obj, int index, char** fromInst, char** fromPin, char** toInst, char** toPin) { + ((LefDefParser::defiAssertion*)obj)->path(index, fromInst, fromPin, toInst, toPin); +} + +void defiAssertion_net (const ::defiAssertion* obj, int index, char** netName) { + ((LefDefParser::defiAssertion*)obj)->net(index, netName); +} + +void defiAssertion_print (const ::defiAssertion* obj, FILE* f) { + ((LefDefParser::defiAssertion*)obj)->print(f); +} + diff --git a/src/def/cdef/xdefiBlockage.cpp b/src/def/cdef/xdefiBlockage.cpp new file mode 100644 index 00000000..a8003558 --- /dev/null +++ b/src/def/cdef/xdefiBlockage.cpp @@ -0,0 +1,149 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defiBlockage.h" +#include "defiBlockage.hpp" + +// Wrappers definitions. +int defiBlockage_hasLayer (const ::defiBlockage* obj) { + return ((LefDefParser::defiBlockage*)obj)->hasLayer(); +} + +int defiBlockage_hasPlacement (const ::defiBlockage* obj) { + return ((LefDefParser::defiBlockage*)obj)->hasPlacement(); +} + +int defiBlockage_hasComponent (const ::defiBlockage* obj) { + return ((LefDefParser::defiBlockage*)obj)->hasComponent(); +} + +int defiBlockage_hasSlots (const ::defiBlockage* obj) { + return ((LefDefParser::defiBlockage*)obj)->hasSlots(); +} + +int defiBlockage_hasFills (const ::defiBlockage* obj) { + return ((LefDefParser::defiBlockage*)obj)->hasFills(); +} + +int defiBlockage_hasPushdown (const ::defiBlockage* obj) { + return ((LefDefParser::defiBlockage*)obj)->hasPushdown(); +} + +int defiBlockage_hasExceptpgnet (const ::defiBlockage* obj) { + return ((LefDefParser::defiBlockage*)obj)->hasExceptpgnet(); +} + +int defiBlockage_hasSoft (const ::defiBlockage* obj) { + return ((LefDefParser::defiBlockage*)obj)->hasSoft(); +} + +int defiBlockage_hasPartial (const ::defiBlockage* obj) { + return ((LefDefParser::defiBlockage*)obj)->hasPartial(); +} + +int defiBlockage_hasSpacing (const ::defiBlockage* obj) { + return ((LefDefParser::defiBlockage*)obj)->hasSpacing(); +} + +int defiBlockage_hasDesignRuleWidth (const ::defiBlockage* obj) { + return ((LefDefParser::defiBlockage*)obj)->hasDesignRuleWidth(); +} + +int defiBlockage_hasMask (const ::defiBlockage* obj) { + return ((LefDefParser::defiBlockage*)obj)->hasMask(); +} + +int defiBlockage_mask (const ::defiBlockage* obj) { + return ((LefDefParser::defiBlockage*)obj)->mask(); +} + +int defiBlockage_minSpacing (const ::defiBlockage* obj) { + return ((LefDefParser::defiBlockage*)obj)->minSpacing(); +} + +int defiBlockage_designRuleWidth (const ::defiBlockage* obj) { + return ((LefDefParser::defiBlockage*)obj)->designRuleWidth(); +} + +double defiBlockage_placementMaxDensity (const ::defiBlockage* obj) { + return ((LefDefParser::defiBlockage*)obj)->placementMaxDensity(); +} + +const char* defiBlockage_layerName (const ::defiBlockage* obj) { + return ((const LefDefParser::defiBlockage*)obj)->layerName(); +} + +const char* defiBlockage_layerComponentName (const ::defiBlockage* obj) { + return ((const LefDefParser::defiBlockage*)obj)->layerComponentName(); +} + +const char* defiBlockage_placementComponentName (const ::defiBlockage* obj) { + return ((const LefDefParser::defiBlockage*)obj)->placementComponentName(); +} + +int defiBlockage_numRectangles (const ::defiBlockage* obj) { + return ((LefDefParser::defiBlockage*)obj)->numRectangles(); +} + +int defiBlockage_xl (const ::defiBlockage* obj, int index) { + return ((LefDefParser::defiBlockage*)obj)->xl(index); +} + +int defiBlockage_yl (const ::defiBlockage* obj, int index) { + return ((LefDefParser::defiBlockage*)obj)->yl(index); +} + +int defiBlockage_xh (const ::defiBlockage* obj, int index) { + return ((LefDefParser::defiBlockage*)obj)->xh(index); +} + +int defiBlockage_yh (const ::defiBlockage* obj, int index) { + return ((LefDefParser::defiBlockage*)obj)->yh(index); +} + +int defiBlockage_numPolygons (const ::defiBlockage* obj) { + return ((LefDefParser::defiBlockage*)obj)->numPolygons(); +} + +::defiPoints defiBlockage_getPolygon (const ::defiBlockage* obj, int index) { + LefDefParser::defiPoints tmp; + tmp = ((LefDefParser::defiBlockage*)obj)->getPolygon(index); + return *((::defiPoints*)&tmp); +} + +void defiBlockage_print (const ::defiBlockage* obj, FILE* f) { + ((LefDefParser::defiBlockage*)obj)->print(f); +} + diff --git a/src/def/cdef/xdefiComponent.cpp b/src/def/cdef/xdefiComponent.cpp new file mode 100644 index 00000000..a0896de4 --- /dev/null +++ b/src/def/cdef/xdefiComponent.cpp @@ -0,0 +1,247 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defiComponent.h" +#include "defiComponent.hpp" + +// Wrappers definitions. +int defiComponentMaskShiftLayer_numMaskShiftLayers (const ::defiComponentMaskShiftLayer* obj) { + return ((LefDefParser::defiComponentMaskShiftLayer*)obj)->numMaskShiftLayers(); +} + +const char* defiComponentMaskShiftLayer_maskShiftLayer (const ::defiComponentMaskShiftLayer* obj, int index) { + return ((const LefDefParser::defiComponentMaskShiftLayer*)obj)->maskShiftLayer(index); +} + +const char* defiComponent_id (const ::defiComponent* obj) { + return ((const LefDefParser::defiComponent*)obj)->id(); +} + +const char* defiComponent_name (const ::defiComponent* obj) { + return ((const LefDefParser::defiComponent*)obj)->name(); +} + +int defiComponent_placementStatus (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->placementStatus(); +} + +int defiComponent_isUnplaced (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->isUnplaced(); +} + +int defiComponent_isPlaced (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->isPlaced(); +} + +int defiComponent_isFixed (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->isFixed(); +} + +int defiComponent_isCover (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->isCover(); +} + +int defiComponent_placementX (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->placementX(); +} + +int defiComponent_placementY (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->placementY(); +} + +int defiComponent_placementOrient (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->placementOrient(); +} + +const char* defiComponent_placementOrientStr (const ::defiComponent* obj) { + return ((const LefDefParser::defiComponent*)obj)->placementOrientStr(); +} + +int defiComponent_hasRegionName (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->hasRegionName(); +} + +int defiComponent_hasRegionBounds (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->hasRegionBounds(); +} + +int defiComponent_hasEEQ (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->hasEEQ(); +} + +int defiComponent_hasGenerate (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->hasGenerate(); +} + +int defiComponent_hasSource (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->hasSource(); +} + +int defiComponent_hasWeight (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->hasWeight(); +} + +int defiComponent_weight (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->weight(); +} + +int defiComponent_maskShiftSize (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->maskShiftSize(); +} + +int defiComponent_maskShift (const ::defiComponent* obj, int index) { + return ((LefDefParser::defiComponent*)obj)->maskShift(index); +} + +int defiComponent_hasNets (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->hasNets(); +} + +int defiComponent_numNets (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->numNets(); +} + +const char* defiComponent_net (const ::defiComponent* obj, int index) { + return ((const LefDefParser::defiComponent*)obj)->net(index); +} + +const char* defiComponent_regionName (const ::defiComponent* obj) { + return ((const LefDefParser::defiComponent*)obj)->regionName(); +} + +const char* defiComponent_source (const ::defiComponent* obj) { + return ((const LefDefParser::defiComponent*)obj)->source(); +} + +const char* defiComponent_EEQ (const ::defiComponent* obj) { + return ((const LefDefParser::defiComponent*)obj)->EEQ(); +} + +const char* defiComponent_generateName (const ::defiComponent* obj) { + return ((const LefDefParser::defiComponent*)obj)->generateName(); +} + +const char* defiComponent_macroName (const ::defiComponent* obj) { + return ((const LefDefParser::defiComponent*)obj)->macroName(); +} + +int defiComponent_hasHalo (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->hasHalo(); +} + +int defiComponent_hasHaloSoft (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->hasHaloSoft(); +} + +int defiComponent_hasRouteHalo (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->hasRouteHalo(); +} + +int defiComponent_haloDist (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->haloDist(); +} + +const char* defiComponent_minLayer (const ::defiComponent* obj) { + return ((const LefDefParser::defiComponent*)obj)->minLayer(); +} + +const char* defiComponent_maxLayer (const ::defiComponent* obj) { + return ((const LefDefParser::defiComponent*)obj)->maxLayer(); +} + +void defiComponent_regionBounds (const ::defiComponent* obj, int* size, int** xl, int** yl, int** xh, int** yh) { + ((LefDefParser::defiComponent*)obj)->regionBounds(size, xl, yl, xh, yh); +} + +int defiComponent_hasForeignName (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->hasForeignName(); +} + +const char* defiComponent_foreignName (const ::defiComponent* obj) { + return ((const LefDefParser::defiComponent*)obj)->foreignName(); +} + +int defiComponent_foreignX (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->foreignX(); +} + +int defiComponent_foreignY (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->foreignY(); +} + +const char* defiComponent_foreignOri (const ::defiComponent* obj) { + return ((const LefDefParser::defiComponent*)obj)->foreignOri(); +} + +int defiComponent_foreignOrient (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->foreignOrient(); +} + +int defiComponent_hasFori (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->hasFori(); +} + +int defiComponent_numProps (const ::defiComponent* obj) { + return ((LefDefParser::defiComponent*)obj)->numProps(); +} + +char* defiComponent_propName (const ::defiComponent* obj, int index) { + return ((LefDefParser::defiComponent*)obj)->propName(index); +} + +char* defiComponent_propValue (const ::defiComponent* obj, int index) { + return ((LefDefParser::defiComponent*)obj)->propValue(index); +} + +double defiComponent_propNumber (const ::defiComponent* obj, int index) { + return ((LefDefParser::defiComponent*)obj)->propNumber(index); +} + +char defiComponent_propType (const ::defiComponent* obj, int index) { + return ((LefDefParser::defiComponent*)obj)->propType(index); +} + +int defiComponent_propIsNumber (const ::defiComponent* obj, int index) { + return ((LefDefParser::defiComponent*)obj)->propIsNumber(index); +} + +int defiComponent_propIsString (const ::defiComponent* obj, int index) { + return ((LefDefParser::defiComponent*)obj)->propIsString(index); +} + +void defiComponent_print (const ::defiComponent* obj, FILE* fout) { + ((LefDefParser::defiComponent*)obj)->print(fout); +} + diff --git a/src/def/cdef/xdefiDebug.cpp b/src/def/cdef/xdefiDebug.cpp new file mode 100644 index 00000000..e1f0b564 --- /dev/null +++ b/src/def/cdef/xdefiDebug.cpp @@ -0,0 +1,59 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defiDebug.h" +#include "defiDebug.hpp" + +// Wrappers definitions. +void defiSetDebug (int num, int value) { + LefDefParser::defiSetDebug(num, value); +} + +int defiDebug (int num) { + return LefDefParser::defiDebug(num); +} + +void defiError (int check, int msgNum, const char* message) { + LefDefParser::defiError(check, msgNum, message); +} + +const char* upperCase (const char* c) { + return LefDefParser::upperCase(c); +} + +const char* DEFCASE (const char* ch) { + return LefDefParser::DEFCASE(ch); +} + diff --git a/src/def/cdef/xdefiFPC.cpp b/src/def/cdef/xdefiFPC.cpp new file mode 100644 index 00000000..e6f73fbd --- /dev/null +++ b/src/def/cdef/xdefiFPC.cpp @@ -0,0 +1,91 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defiFPC.h" +#include "defiFPC.hpp" + +// Wrappers definitions. +const char* defiFPC_name (const ::defiFPC* obj) { + return ((const LefDefParser::defiFPC*)obj)->name(); +} + +int defiFPC_isVertical (const ::defiFPC* obj) { + return ((LefDefParser::defiFPC*)obj)->isVertical(); +} + +int defiFPC_isHorizontal (const ::defiFPC* obj) { + return ((LefDefParser::defiFPC*)obj)->isHorizontal(); +} + +int defiFPC_hasAlign (const ::defiFPC* obj) { + return ((LefDefParser::defiFPC*)obj)->hasAlign(); +} + +int defiFPC_hasMax (const ::defiFPC* obj) { + return ((LefDefParser::defiFPC*)obj)->hasMax(); +} + +int defiFPC_hasMin (const ::defiFPC* obj) { + return ((LefDefParser::defiFPC*)obj)->hasMin(); +} + +int defiFPC_hasEqual (const ::defiFPC* obj) { + return ((LefDefParser::defiFPC*)obj)->hasEqual(); +} + +double defiFPC_alignMax (const ::defiFPC* obj) { + return ((LefDefParser::defiFPC*)obj)->alignMax(); +} + +double defiFPC_alignMin (const ::defiFPC* obj) { + return ((LefDefParser::defiFPC*)obj)->alignMin(); +} + +double defiFPC_equal (const ::defiFPC* obj) { + return ((LefDefParser::defiFPC*)obj)->equal(); +} + +int defiFPC_numParts (const ::defiFPC* obj) { + return ((LefDefParser::defiFPC*)obj)->numParts(); +} + +void defiFPC_getPart (const ::defiFPC* obj, int index, int* corner, int* typ, char** name) { + ((LefDefParser::defiFPC*)obj)->getPart(index, corner, typ, name); +} + +void defiFPC_print (const ::defiFPC* obj, FILE* f) { + ((LefDefParser::defiFPC*)obj)->print(f); +} + diff --git a/src/def/cdef/xdefiFill.cpp b/src/def/cdef/xdefiFill.cpp new file mode 100644 index 00000000..5556aa49 --- /dev/null +++ b/src/def/cdef/xdefiFill.cpp @@ -0,0 +1,123 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defiFill.h" +#include "defiFill.hpp" + +// Wrappers definitions. +int defiFill_hasLayer (const ::defiFill* obj) { + return ((LefDefParser::defiFill*)obj)->hasLayer(); +} + +const char* defiFill_layerName (const ::defiFill* obj) { + return ((const LefDefParser::defiFill*)obj)->layerName(); +} + +int defiFill_hasLayerOpc (const ::defiFill* obj) { + return ((LefDefParser::defiFill*)obj)->hasLayerOpc(); +} + +int defiFill_layerMask (const ::defiFill* obj) { + return ((LefDefParser::defiFill*)obj)->layerMask(); +} + +int defiFill_viaTopMask (const ::defiFill* obj) { + return ((LefDefParser::defiFill*)obj)->viaTopMask(); +} + +int defiFill_viaCutMask (const ::defiFill* obj) { + return ((LefDefParser::defiFill*)obj)->viaCutMask(); +} + +int defiFill_viaBottomMask (const ::defiFill* obj) { + return ((LefDefParser::defiFill*)obj)->viaBottomMask(); +} + +int defiFill_numRectangles (const ::defiFill* obj) { + return ((LefDefParser::defiFill*)obj)->numRectangles(); +} + +int defiFill_xl (const ::defiFill* obj, int index) { + return ((LefDefParser::defiFill*)obj)->xl(index); +} + +int defiFill_yl (const ::defiFill* obj, int index) { + return ((LefDefParser::defiFill*)obj)->yl(index); +} + +int defiFill_xh (const ::defiFill* obj, int index) { + return ((LefDefParser::defiFill*)obj)->xh(index); +} + +int defiFill_yh (const ::defiFill* obj, int index) { + return ((LefDefParser::defiFill*)obj)->yh(index); +} + +int defiFill_numPolygons (const ::defiFill* obj) { + return ((LefDefParser::defiFill*)obj)->numPolygons(); +} + +::defiPoints defiFill_getPolygon (const ::defiFill* obj, int index) { + LefDefParser::defiPoints tmp; + tmp = ((LefDefParser::defiFill*)obj)->getPolygon(index); + return *((::defiPoints*)&tmp); +} + +int defiFill_hasVia (const ::defiFill* obj) { + return ((LefDefParser::defiFill*)obj)->hasVia(); +} + +const char* defiFill_viaName (const ::defiFill* obj) { + return ((const LefDefParser::defiFill*)obj)->viaName(); +} + +int defiFill_hasViaOpc (const ::defiFill* obj) { + return ((LefDefParser::defiFill*)obj)->hasViaOpc(); +} + +int defiFill_numViaPts (const ::defiFill* obj) { + return ((LefDefParser::defiFill*)obj)->numViaPts(); +} + +::defiPoints defiFill_getViaPts (const ::defiFill* obj, int index) { + LefDefParser::defiPoints tmp; + tmp = ((LefDefParser::defiFill*)obj)->getViaPts(index); + return *((::defiPoints*)&tmp); +} + +void defiFill_print (const ::defiFill* obj, FILE* f) { + ((LefDefParser::defiFill*)obj)->print(f); +} + diff --git a/src/def/cdef/xdefiGroup.cpp b/src/def/cdef/xdefiGroup.cpp new file mode 100644 index 00000000..b64ab906 --- /dev/null +++ b/src/def/cdef/xdefiGroup.cpp @@ -0,0 +1,115 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defiGroup.h" +#include "defiGroup.hpp" + +// Wrappers definitions. +const char* defiGroup_name (const ::defiGroup* obj) { + return ((const LefDefParser::defiGroup*)obj)->name(); +} + +const char* defiGroup_regionName (const ::defiGroup* obj) { + return ((const LefDefParser::defiGroup*)obj)->regionName(); +} + +int defiGroup_hasRegionBox (const ::defiGroup* obj) { + return ((LefDefParser::defiGroup*)obj)->hasRegionBox(); +} + +int defiGroup_hasRegionName (const ::defiGroup* obj) { + return ((LefDefParser::defiGroup*)obj)->hasRegionName(); +} + +int defiGroup_hasMaxX (const ::defiGroup* obj) { + return ((LefDefParser::defiGroup*)obj)->hasMaxX(); +} + +int defiGroup_hasMaxY (const ::defiGroup* obj) { + return ((LefDefParser::defiGroup*)obj)->hasMaxY(); +} + +int defiGroup_hasPerim (const ::defiGroup* obj) { + return ((LefDefParser::defiGroup*)obj)->hasPerim(); +} + +void defiGroup_regionRects (const ::defiGroup* obj, int* size, int** xl, int** yl, int** xh, int** yh) { + ((LefDefParser::defiGroup*)obj)->regionRects(size, xl, yl, xh, yh); +} + +int defiGroup_maxX (const ::defiGroup* obj) { + return ((LefDefParser::defiGroup*)obj)->maxX(); +} + +int defiGroup_maxY (const ::defiGroup* obj) { + return ((LefDefParser::defiGroup*)obj)->maxY(); +} + +int defiGroup_perim (const ::defiGroup* obj) { + return ((LefDefParser::defiGroup*)obj)->perim(); +} + +int defiGroup_numProps (const ::defiGroup* obj) { + return ((LefDefParser::defiGroup*)obj)->numProps(); +} + +const char* defiGroup_propName (const ::defiGroup* obj, int index) { + return ((const LefDefParser::defiGroup*)obj)->propName(index); +} + +const char* defiGroup_propValue (const ::defiGroup* obj, int index) { + return ((const LefDefParser::defiGroup*)obj)->propValue(index); +} + +double defiGroup_propNumber (const ::defiGroup* obj, int index) { + return ((LefDefParser::defiGroup*)obj)->propNumber(index); +} + +char defiGroup_propType (const ::defiGroup* obj, int index) { + return ((const LefDefParser::defiGroup*)obj)->propType(index); +} + +int defiGroup_propIsNumber (const ::defiGroup* obj, int index) { + return ((LefDefParser::defiGroup*)obj)->propIsNumber(index); +} + +int defiGroup_propIsString (const ::defiGroup* obj, int index) { + return ((LefDefParser::defiGroup*)obj)->propIsString(index); +} + +void defiGroup_print (const ::defiGroup* obj, FILE* f) { + ((LefDefParser::defiGroup*)obj)->print(f); +} + diff --git a/src/def/cdef/xdefiIOTiming.cpp b/src/def/cdef/xdefiIOTiming.cpp new file mode 100644 index 00000000..861a6f38 --- /dev/null +++ b/src/def/cdef/xdefiIOTiming.cpp @@ -0,0 +1,139 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defiIOTiming.h" +#include "defiIOTiming.hpp" + +// Wrappers definitions. +int defiIOTiming_hasVariableRise (const ::defiIOTiming* obj) { + return ((LefDefParser::defiIOTiming*)obj)->hasVariableRise(); +} + +int defiIOTiming_hasVariableFall (const ::defiIOTiming* obj) { + return ((LefDefParser::defiIOTiming*)obj)->hasVariableFall(); +} + +int defiIOTiming_hasSlewRise (const ::defiIOTiming* obj) { + return ((LefDefParser::defiIOTiming*)obj)->hasSlewRise(); +} + +int defiIOTiming_hasSlewFall (const ::defiIOTiming* obj) { + return ((LefDefParser::defiIOTiming*)obj)->hasSlewFall(); +} + +int defiIOTiming_hasCapacitance (const ::defiIOTiming* obj) { + return ((LefDefParser::defiIOTiming*)obj)->hasCapacitance(); +} + +int defiIOTiming_hasDriveCell (const ::defiIOTiming* obj) { + return ((LefDefParser::defiIOTiming*)obj)->hasDriveCell(); +} + +int defiIOTiming_hasFrom (const ::defiIOTiming* obj) { + return ((LefDefParser::defiIOTiming*)obj)->hasFrom(); +} + +int defiIOTiming_hasTo (const ::defiIOTiming* obj) { + return ((LefDefParser::defiIOTiming*)obj)->hasTo(); +} + +int defiIOTiming_hasParallel (const ::defiIOTiming* obj) { + return ((LefDefParser::defiIOTiming*)obj)->hasParallel(); +} + +const char* defiIOTiming_inst (const ::defiIOTiming* obj) { + return ((const LefDefParser::defiIOTiming*)obj)->inst(); +} + +const char* defiIOTiming_pin (const ::defiIOTiming* obj) { + return ((const LefDefParser::defiIOTiming*)obj)->pin(); +} + +double defiIOTiming_variableFallMin (const ::defiIOTiming* obj) { + return ((LefDefParser::defiIOTiming*)obj)->variableFallMin(); +} + +double defiIOTiming_variableRiseMin (const ::defiIOTiming* obj) { + return ((LefDefParser::defiIOTiming*)obj)->variableRiseMin(); +} + +double defiIOTiming_variableFallMax (const ::defiIOTiming* obj) { + return ((LefDefParser::defiIOTiming*)obj)->variableFallMax(); +} + +double defiIOTiming_variableRiseMax (const ::defiIOTiming* obj) { + return ((LefDefParser::defiIOTiming*)obj)->variableRiseMax(); +} + +double defiIOTiming_slewFallMin (const ::defiIOTiming* obj) { + return ((LefDefParser::defiIOTiming*)obj)->slewFallMin(); +} + +double defiIOTiming_slewRiseMin (const ::defiIOTiming* obj) { + return ((LefDefParser::defiIOTiming*)obj)->slewRiseMin(); +} + +double defiIOTiming_slewFallMax (const ::defiIOTiming* obj) { + return ((LefDefParser::defiIOTiming*)obj)->slewFallMax(); +} + +double defiIOTiming_slewRiseMax (const ::defiIOTiming* obj) { + return ((LefDefParser::defiIOTiming*)obj)->slewRiseMax(); +} + +double defiIOTiming_capacitance (const ::defiIOTiming* obj) { + return ((LefDefParser::defiIOTiming*)obj)->capacitance(); +} + +const char* defiIOTiming_driveCell (const ::defiIOTiming* obj) { + return ((const LefDefParser::defiIOTiming*)obj)->driveCell(); +} + +const char* defiIOTiming_from (const ::defiIOTiming* obj) { + return ((const LefDefParser::defiIOTiming*)obj)->from(); +} + +const char* defiIOTiming_to (const ::defiIOTiming* obj) { + return ((const LefDefParser::defiIOTiming*)obj)->to(); +} + +double defiIOTiming_parallel (const ::defiIOTiming* obj) { + return ((LefDefParser::defiIOTiming*)obj)->parallel(); +} + +void defiIOTiming_print (const ::defiIOTiming* obj, FILE* f) { + ((LefDefParser::defiIOTiming*)obj)->print(f); +} + diff --git a/src/def/cdef/xdefiMisc.cpp b/src/def/cdef/xdefiMisc.cpp new file mode 100644 index 00000000..df6f2cb6 --- /dev/null +++ b/src/def/cdef/xdefiMisc.cpp @@ -0,0 +1,57 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defiMisc.h" +#include "defiMisc.hpp" + +// Wrappers definitions. +int defiGeometries_numPoints (const ::defiGeometries* obj) { + return ((LefDefParser::defiGeometries*)obj)->numPoints(); +} + +void defiGeometries_points (const ::defiGeometries* obj, int index, int* x, int* y) { + ((LefDefParser::defiGeometries*)obj)->points(index, x, y); +} + +int defiStyles_style (const ::defiStyles* obj) { + return ((LefDefParser::defiStyles*)obj)->style(); +} + +::defiPoints defiStyles_getPolygon (const ::defiStyles* obj) { + LefDefParser::defiPoints tmp; + tmp = ((LefDefParser::defiStyles*)obj)->getPolygon(); + return *((::defiPoints*)&tmp); +} + diff --git a/src/def/cdef/xdefiNet.cpp b/src/def/cdef/xdefiNet.cpp new file mode 100644 index 00000000..4fad7ee1 --- /dev/null +++ b/src/def/cdef/xdefiNet.cpp @@ -0,0 +1,539 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defiNet.h" +#include "defiNet.hpp" + +// Wrappers definitions. +const char* defiWire_wireType (const ::defiWire* obj) { + return ((const LefDefParser::defiWire*)obj)->wireType(); +} + +const char* defiWire_wireShieldNetName (const ::defiWire* obj) { + return ((const LefDefParser::defiWire*)obj)->wireShieldNetName(); +} + +int defiWire_numPaths (const ::defiWire* obj) { + return ((LefDefParser::defiWire*)obj)->numPaths(); +} + +const ::defiPath* defiWire_path (const ::defiWire* obj, int index) { + return (const ::defiPath*) ((const LefDefParser::defiWire*)obj)->path(index); +} + +void defiSubnet_print (const ::defiSubnet* obj, FILE* f) { + ((LefDefParser::defiSubnet*)obj)->print(f); +} + +const char* defiSubnet_name (const ::defiSubnet* obj) { + return ((const LefDefParser::defiSubnet*)obj)->name(); +} + +int defiSubnet_numConnections (const ::defiSubnet* obj) { + return ((LefDefParser::defiSubnet*)obj)->numConnections(); +} + +const char* defiSubnet_instance (const ::defiSubnet* obj, int index) { + return ((const LefDefParser::defiSubnet*)obj)->instance(index); +} + +const char* defiSubnet_pin (const ::defiSubnet* obj, int index) { + return ((const LefDefParser::defiSubnet*)obj)->pin(index); +} + +int defiSubnet_pinIsSynthesized (const ::defiSubnet* obj, int index) { + return ((LefDefParser::defiSubnet*)obj)->pinIsSynthesized(index); +} + +int defiSubnet_pinIsMustJoin (const ::defiSubnet* obj, int index) { + return ((LefDefParser::defiSubnet*)obj)->pinIsMustJoin(index); +} + +int defiSubnet_isFixed (const ::defiSubnet* obj) { + return ((LefDefParser::defiSubnet*)obj)->isFixed(); +} + +int defiSubnet_isRouted (const ::defiSubnet* obj) { + return ((LefDefParser::defiSubnet*)obj)->isRouted(); +} + +int defiSubnet_isCover (const ::defiSubnet* obj) { + return ((LefDefParser::defiSubnet*)obj)->isCover(); +} + +int defiSubnet_hasNonDefaultRule (const ::defiSubnet* obj) { + return ((LefDefParser::defiSubnet*)obj)->hasNonDefaultRule(); +} + +int defiSubnet_numPaths (const ::defiSubnet* obj) { + return ((LefDefParser::defiSubnet*)obj)->numPaths(); +} + +const ::defiPath* defiSubnet_path (const ::defiSubnet* obj, int index) { + return (const ::defiPath*) ((const LefDefParser::defiSubnet*)obj)->path(index); +} + +const char* defiSubnet_nonDefaultRule (const ::defiSubnet* obj) { + return ((const LefDefParser::defiSubnet*)obj)->nonDefaultRule(); +} + +int defiSubnet_numWires (const ::defiSubnet* obj) { + return ((LefDefParser::defiSubnet*)obj)->numWires(); +} + +const ::defiWire* defiSubnet_wire (const ::defiSubnet* obj, int index) { + return (const ::defiWire*) ((const LefDefParser::defiSubnet*)obj)->wire(index); +} + +int defiVpin_xl (const ::defiVpin* obj) { + return ((LefDefParser::defiVpin*)obj)->xl(); +} + +int defiVpin_yl (const ::defiVpin* obj) { + return ((LefDefParser::defiVpin*)obj)->yl(); +} + +int defiVpin_xh (const ::defiVpin* obj) { + return ((LefDefParser::defiVpin*)obj)->xh(); +} + +int defiVpin_yh (const ::defiVpin* obj) { + return ((LefDefParser::defiVpin*)obj)->yh(); +} + +char defiVpin_status (const ::defiVpin* obj) { + return ((LefDefParser::defiVpin*)obj)->status(); +} + +int defiVpin_orient (const ::defiVpin* obj) { + return ((LefDefParser::defiVpin*)obj)->orient(); +} + +const char* defiVpin_orientStr (const ::defiVpin* obj) { + return ((const LefDefParser::defiVpin*)obj)->orientStr(); +} + +int defiVpin_xLoc (const ::defiVpin* obj) { + return ((LefDefParser::defiVpin*)obj)->xLoc(); +} + +int defiVpin_yLoc (const ::defiVpin* obj) { + return ((LefDefParser::defiVpin*)obj)->yLoc(); +} + +const char* defiVpin_name (const ::defiVpin* obj) { + return ((const LefDefParser::defiVpin*)obj)->name(); +} + +const char* defiVpin_layer (const ::defiVpin* obj) { + return ((const LefDefParser::defiVpin*)obj)->layer(); +} + +const char* defiShield_shieldName (const ::defiShield* obj) { + return ((const LefDefParser::defiShield*)obj)->shieldName(); +} + +int defiShield_numPaths (const ::defiShield* obj) { + return ((LefDefParser::defiShield*)obj)->numPaths(); +} + +const ::defiPath* defiShield_path (const ::defiShield* obj, int index) { + return (const ::defiPath*) ((const LefDefParser::defiShield*)obj)->path(index); +} + +const char* defiNet_name (const ::defiNet* obj) { + return ((const LefDefParser::defiNet*)obj)->name(); +} + +int defiNet_weight (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->weight(); +} + +int defiNet_numProps (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->numProps(); +} + +const char* defiNet_propName (const ::defiNet* obj, int index) { + return ((const LefDefParser::defiNet*)obj)->propName(index); +} + +const char* defiNet_propValue (const ::defiNet* obj, int index) { + return ((const LefDefParser::defiNet*)obj)->propValue(index); +} + +double defiNet_propNumber (const ::defiNet* obj, int index) { + return ((LefDefParser::defiNet*)obj)->propNumber(index); +} + +char defiNet_propType (const ::defiNet* obj, int index) { + return ((const LefDefParser::defiNet*)obj)->propType(index); +} + +int defiNet_propIsNumber (const ::defiNet* obj, int index) { + return ((LefDefParser::defiNet*)obj)->propIsNumber(index); +} + +int defiNet_propIsString (const ::defiNet* obj, int index) { + return ((LefDefParser::defiNet*)obj)->propIsString(index); +} + +int defiNet_numConnections (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->numConnections(); +} + +const char* defiNet_instance (const ::defiNet* obj, int index) { + return ((const LefDefParser::defiNet*)obj)->instance(index); +} + +const char* defiNet_pin (const ::defiNet* obj, int index) { + return ((const LefDefParser::defiNet*)obj)->pin(index); +} + +int defiNet_pinIsMustJoin (const ::defiNet* obj, int index) { + return ((LefDefParser::defiNet*)obj)->pinIsMustJoin(index); +} + +int defiNet_pinIsSynthesized (const ::defiNet* obj, int index) { + return ((LefDefParser::defiNet*)obj)->pinIsSynthesized(index); +} + +int defiNet_numSubnets (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->numSubnets(); +} + +const ::defiSubnet* defiNet_subnet (const ::defiNet* obj, int index) { + return (const ::defiSubnet*) ((const LefDefParser::defiNet*)obj)->subnet(index); +} + +int defiNet_isFixed (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->isFixed(); +} + +int defiNet_isRouted (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->isRouted(); +} + +int defiNet_isCover (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->isCover(); +} + +int defiNet_numWires (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->numWires(); +} + +const ::defiWire* defiNet_wire (const ::defiNet* obj, int index) { + return (const ::defiWire*) ((const LefDefParser::defiNet*)obj)->wire(index); +} + +int defiNet_numVpins (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->numVpins(); +} + +const ::defiVpin* defiNet_vpin (const ::defiNet* obj, int index) { + return (const ::defiVpin*) ((const LefDefParser::defiNet*)obj)->vpin(index); +} + +int defiNet_hasProps (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->hasProps(); +} + +int defiNet_hasWeight (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->hasWeight(); +} + +int defiNet_hasSubnets (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->hasSubnets(); +} + +int defiNet_hasSource (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->hasSource(); +} + +int defiNet_hasFixedbump (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->hasFixedbump(); +} + +int defiNet_hasFrequency (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->hasFrequency(); +} + +int defiNet_hasPattern (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->hasPattern(); +} + +int defiNet_hasOriginal (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->hasOriginal(); +} + +int defiNet_hasCap (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->hasCap(); +} + +int defiNet_hasUse (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->hasUse(); +} + +int defiNet_hasStyle (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->hasStyle(); +} + +int defiNet_hasNonDefaultRule (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->hasNonDefaultRule(); +} + +int defiNet_hasVoltage (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->hasVoltage(); +} + +int defiNet_hasSpacingRules (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->hasSpacingRules(); +} + +int defiNet_hasWidthRules (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->hasWidthRules(); +} + +int defiNet_hasXTalk (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->hasXTalk(); +} + +int defiNet_numSpacingRules (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->numSpacingRules(); +} + +void defiNet_spacingRule (const ::defiNet* obj, int index, char** layer, double* dist, double* left, double* right) { + ((LefDefParser::defiNet*)obj)->spacingRule(index, layer, dist, left, right); +} + +int defiNet_numWidthRules (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->numWidthRules(); +} + +void defiNet_widthRule (const ::defiNet* obj, int index, char** layer, double* dist) { + ((LefDefParser::defiNet*)obj)->widthRule(index, layer, dist); +} + +double defiNet_voltage (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->voltage(); +} + +int defiNet_XTalk (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->XTalk(); +} + +const char* defiNet_source (const ::defiNet* obj) { + return ((const LefDefParser::defiNet*)obj)->source(); +} + +double defiNet_frequency (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->frequency(); +} + +const char* defiNet_original (const ::defiNet* obj) { + return ((const LefDefParser::defiNet*)obj)->original(); +} + +const char* defiNet_pattern (const ::defiNet* obj) { + return ((const LefDefParser::defiNet*)obj)->pattern(); +} + +double defiNet_cap (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->cap(); +} + +const char* defiNet_use (const ::defiNet* obj) { + return ((const LefDefParser::defiNet*)obj)->use(); +} + +int defiNet_style (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->style(); +} + +const char* defiNet_nonDefaultRule (const ::defiNet* obj) { + return ((const LefDefParser::defiNet*)obj)->nonDefaultRule(); +} + +int defiNet_numPaths (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->numPaths(); +} + +const ::defiPath* defiNet_path (const ::defiNet* obj, int index) { + return (const ::defiPath*) ((const LefDefParser::defiNet*)obj)->path(index); +} + +int defiNet_numShields (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->numShields(); +} + +const ::defiShield* defiNet_shield (const ::defiNet* obj, int index) { + return (const ::defiShield*) ((const LefDefParser::defiNet*)obj)->shield(index); +} + +int defiNet_numShieldNets (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->numShieldNets(); +} + +const char* defiNet_shieldNet (const ::defiNet* obj, int index) { + return ((const LefDefParser::defiNet*)obj)->shieldNet(index); +} + +int defiNet_numNoShields (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->numNoShields(); +} + +const ::defiShield* defiNet_noShield (const ::defiNet* obj, int index) { + return (const ::defiShield*) ((const LefDefParser::defiNet*)obj)->noShield(index); +} + +int defiNet_numPolygons (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->numPolygons(); +} + +const char* defiNet_polygonName (const ::defiNet* obj, int index) { + return ((const LefDefParser::defiNet*)obj)->polygonName(index); +} + +::defiPoints defiNet_getPolygon (const ::defiNet* obj, int index) { + LefDefParser::defiPoints tmp; + tmp = ((LefDefParser::defiNet*)obj)->getPolygon(index); + return *((::defiPoints*)&tmp); +} + +int defiNet_polyMask (const ::defiNet* obj, int index) { + return ((LefDefParser::defiNet*)obj)->polyMask(index); +} + +const char* defiNet_polyRouteStatus (const ::defiNet* obj, int index) { + return ((const LefDefParser::defiNet*)obj)->polyRouteStatus(index); +} + +const char* defiNet_polyRouteStatusShieldName (const ::defiNet* obj, int index) { + return ((const LefDefParser::defiNet*)obj)->polyRouteStatusShieldName(index); +} + +const char* defiNet_polyShapeType (const ::defiNet* obj, int index) { + return ((const LefDefParser::defiNet*)obj)->polyShapeType(index); +} + +int defiNet_numRectangles (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->numRectangles(); +} + +const char* defiNet_rectName (const ::defiNet* obj, int index) { + return ((const LefDefParser::defiNet*)obj)->rectName(index); +} + +int defiNet_xl (const ::defiNet* obj, int index) { + return ((LefDefParser::defiNet*)obj)->xl(index); +} + +int defiNet_yl (const ::defiNet* obj, int index) { + return ((LefDefParser::defiNet*)obj)->yl(index); +} + +int defiNet_xh (const ::defiNet* obj, int index) { + return ((LefDefParser::defiNet*)obj)->xh(index); +} + +int defiNet_yh (const ::defiNet* obj, int index) { + return ((LefDefParser::defiNet*)obj)->yh(index); +} + +int defiNet_rectMask (const ::defiNet* obj, int index) { + return ((LefDefParser::defiNet*)obj)->rectMask(index); +} + +const char* defiNet_rectRouteStatus (const ::defiNet* obj, int index) { + return ((const LefDefParser::defiNet*)obj)->rectRouteStatus(index); +} + +const char* defiNet_rectRouteStatusShieldName (const ::defiNet* obj, int index) { + return ((const LefDefParser::defiNet*)obj)->rectRouteStatusShieldName(index); +} + +const char* defiNet_rectShapeType (const ::defiNet* obj, int index) { + return ((const LefDefParser::defiNet*)obj)->rectShapeType(index); +} + +int defiNet_numViaSpecs (const ::defiNet* obj) { + return ((LefDefParser::defiNet*)obj)->numViaSpecs(); +} + +::defiPoints defiNet_getViaPts (const ::defiNet* obj, int index) { + LefDefParser::defiPoints tmp; + tmp = ((LefDefParser::defiNet*)obj)->getViaPts(index); + return *((::defiPoints*)&tmp); +} + +const char* defiNet_viaName (const ::defiNet* obj, int index) { + return ((const LefDefParser::defiNet*)obj)->viaName(index); +} + +int defiNet_viaOrient (const ::defiNet* obj, int index) { + return ((const LefDefParser::defiNet*)obj)->viaOrient(index); +} + +const char* defiNet_viaOrientStr (const ::defiNet* obj, int index) { + return ((const LefDefParser::defiNet*)obj)->viaOrientStr(index); +} + +int defiNet_topMaskNum (const ::defiNet* obj, int index) { + return ((const LefDefParser::defiNet*)obj)->topMaskNum(index); +} + +int defiNet_cutMaskNum (const ::defiNet* obj, int index) { + return ((const LefDefParser::defiNet*)obj)->cutMaskNum(index); +} + +int defiNet_bottomMaskNum (const ::defiNet* obj, int index) { + return ((const LefDefParser::defiNet*)obj)->bottomMaskNum(index); +} + +const char* defiNet_viaRouteStatus (const ::defiNet* obj, int index) { + return ((const LefDefParser::defiNet*)obj)->viaRouteStatus(index); +} + +const char* defiNet_viaRouteStatusShieldName (const ::defiNet* obj, int index) { + return ((const LefDefParser::defiNet*)obj)->viaRouteStatusShieldName(index); +} + +const char* defiNet_viaShapeType (const ::defiNet* obj, int index) { + return ((const LefDefParser::defiNet*)obj)->viaShapeType(index); +} + +void defiNet_print (const ::defiNet* obj, FILE* f) { + ((LefDefParser::defiNet*)obj)->print(f); +} + diff --git a/src/def/cdef/xdefiNonDefault.cpp b/src/def/cdef/xdefiNonDefault.cpp new file mode 100644 index 00000000..98096136 --- /dev/null +++ b/src/def/cdef/xdefiNonDefault.cpp @@ -0,0 +1,159 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defiNonDefault.h" +#include "defiNonDefault.hpp" + +// Wrappers definitions. +const char* defiNonDefault_name (const ::defiNonDefault* obj) { + return ((const LefDefParser::defiNonDefault*)obj)->name(); +} + +int defiNonDefault_hasHardspacing (const ::defiNonDefault* obj) { + return ((LefDefParser::defiNonDefault*)obj)->hasHardspacing(); +} + +int defiNonDefault_numProps (const ::defiNonDefault* obj) { + return ((LefDefParser::defiNonDefault*)obj)->numProps(); +} + +const char* defiNonDefault_propName (const ::defiNonDefault* obj, int index) { + return ((const LefDefParser::defiNonDefault*)obj)->propName(index); +} + +const char* defiNonDefault_propValue (const ::defiNonDefault* obj, int index) { + return ((const LefDefParser::defiNonDefault*)obj)->propValue(index); +} + +double defiNonDefault_propNumber (const ::defiNonDefault* obj, int index) { + return ((LefDefParser::defiNonDefault*)obj)->propNumber(index); +} + +char defiNonDefault_propType (const ::defiNonDefault* obj, int index) { + return ((const LefDefParser::defiNonDefault*)obj)->propType(index); +} + +int defiNonDefault_propIsNumber (const ::defiNonDefault* obj, int index) { + return ((LefDefParser::defiNonDefault*)obj)->propIsNumber(index); +} + +int defiNonDefault_propIsString (const ::defiNonDefault* obj, int index) { + return ((LefDefParser::defiNonDefault*)obj)->propIsString(index); +} + +int defiNonDefault_numLayers (const ::defiNonDefault* obj) { + return ((LefDefParser::defiNonDefault*)obj)->numLayers(); +} + +const char* defiNonDefault_layerName (const ::defiNonDefault* obj, int index) { + return ((const LefDefParser::defiNonDefault*)obj)->layerName(index); +} + +double defiNonDefault_layerWidth (const ::defiNonDefault* obj, int index) { + return ((LefDefParser::defiNonDefault*)obj)->layerWidth(index); +} + +int defiNonDefault_layerWidthVal (const ::defiNonDefault* obj, int index) { + return ((LefDefParser::defiNonDefault*)obj)->layerWidthVal(index); +} + +int defiNonDefault_hasLayerDiagWidth (const ::defiNonDefault* obj, int index) { + return ((LefDefParser::defiNonDefault*)obj)->hasLayerDiagWidth(index); +} + +double defiNonDefault_layerDiagWidth (const ::defiNonDefault* obj, int index) { + return ((LefDefParser::defiNonDefault*)obj)->layerDiagWidth(index); +} + +int defiNonDefault_layerDiagWidthVal (const ::defiNonDefault* obj, int index) { + return ((LefDefParser::defiNonDefault*)obj)->layerDiagWidthVal(index); +} + +int defiNonDefault_hasLayerSpacing (const ::defiNonDefault* obj, int index) { + return ((LefDefParser::defiNonDefault*)obj)->hasLayerSpacing(index); +} + +double defiNonDefault_layerSpacing (const ::defiNonDefault* obj, int index) { + return ((LefDefParser::defiNonDefault*)obj)->layerSpacing(index); +} + +int defiNonDefault_layerSpacingVal (const ::defiNonDefault* obj, int index) { + return ((LefDefParser::defiNonDefault*)obj)->layerSpacingVal(index); +} + +int defiNonDefault_hasLayerWireExt (const ::defiNonDefault* obj, int index) { + return ((LefDefParser::defiNonDefault*)obj)->hasLayerWireExt(index); +} + +double defiNonDefault_layerWireExt (const ::defiNonDefault* obj, int index) { + return ((LefDefParser::defiNonDefault*)obj)->layerWireExt(index); +} + +int defiNonDefault_layerWireExtVal (const ::defiNonDefault* obj, int index) { + return ((LefDefParser::defiNonDefault*)obj)->layerWireExtVal(index); +} + +int defiNonDefault_numVias (const ::defiNonDefault* obj) { + return ((LefDefParser::defiNonDefault*)obj)->numVias(); +} + +const char* defiNonDefault_viaName (const ::defiNonDefault* obj, int index) { + return ((const LefDefParser::defiNonDefault*)obj)->viaName(index); +} + +int defiNonDefault_numViaRules (const ::defiNonDefault* obj) { + return ((LefDefParser::defiNonDefault*)obj)->numViaRules(); +} + +const char* defiNonDefault_viaRuleName (const ::defiNonDefault* obj, int index) { + return ((const LefDefParser::defiNonDefault*)obj)->viaRuleName(index); +} + +int defiNonDefault_numMinCuts (const ::defiNonDefault* obj) { + return ((LefDefParser::defiNonDefault*)obj)->numMinCuts(); +} + +const char* defiNonDefault_cutLayerName (const ::defiNonDefault* obj, int index) { + return ((const LefDefParser::defiNonDefault*)obj)->cutLayerName(index); +} + +int defiNonDefault_numCuts (const ::defiNonDefault* obj, int index) { + return ((LefDefParser::defiNonDefault*)obj)->numCuts(index); +} + +void defiNonDefault_print (const ::defiNonDefault* obj, FILE* f) { + ((LefDefParser::defiNonDefault*)obj)->print(f); +} + diff --git a/src/def/cdef/xdefiPartition.cpp b/src/def/cdef/xdefiPartition.cpp new file mode 100644 index 00000000..daab84d6 --- /dev/null +++ b/src/def/cdef/xdefiPartition.cpp @@ -0,0 +1,183 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defiPartition.h" +#include "defiPartition.hpp" + +// Wrappers definitions. +const char* defiPartition_name (const ::defiPartition* obj) { + return ((const LefDefParser::defiPartition*)obj)->name(); +} + +char defiPartition_direction (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->direction(); +} + +const char* defiPartition_itemType (const ::defiPartition* obj) { + return ((const LefDefParser::defiPartition*)obj)->itemType(); +} + +const char* defiPartition_pinName (const ::defiPartition* obj) { + return ((const LefDefParser::defiPartition*)obj)->pinName(); +} + +const char* defiPartition_instName (const ::defiPartition* obj) { + return ((const LefDefParser::defiPartition*)obj)->instName(); +} + +int defiPartition_numPins (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->numPins(); +} + +const char* defiPartition_pin (const ::defiPartition* obj, int index) { + return ((const LefDefParser::defiPartition*)obj)->pin(index); +} + +int defiPartition_isSetupRise (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->isSetupRise(); +} + +int defiPartition_isSetupFall (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->isSetupFall(); +} + +int defiPartition_isHoldRise (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->isHoldRise(); +} + +int defiPartition_isHoldFall (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->isHoldFall(); +} + +int defiPartition_hasMin (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->hasMin(); +} + +int defiPartition_hasMax (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->hasMax(); +} + +int defiPartition_hasRiseMin (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->hasRiseMin(); +} + +int defiPartition_hasFallMin (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->hasFallMin(); +} + +int defiPartition_hasRiseMax (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->hasRiseMax(); +} + +int defiPartition_hasFallMax (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->hasFallMax(); +} + +int defiPartition_hasRiseMinRange (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->hasRiseMinRange(); +} + +int defiPartition_hasFallMinRange (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->hasFallMinRange(); +} + +int defiPartition_hasRiseMaxRange (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->hasRiseMaxRange(); +} + +int defiPartition_hasFallMaxRange (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->hasFallMaxRange(); +} + +double defiPartition_partitionMin (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->partitionMin(); +} + +double defiPartition_partitionMax (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->partitionMax(); +} + +double defiPartition_riseMin (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->riseMin(); +} + +double defiPartition_fallMin (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->fallMin(); +} + +double defiPartition_riseMax (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->riseMax(); +} + +double defiPartition_fallMax (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->fallMax(); +} + +double defiPartition_riseMinLeft (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->riseMinLeft(); +} + +double defiPartition_fallMinLeft (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->fallMinLeft(); +} + +double defiPartition_riseMaxLeft (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->riseMaxLeft(); +} + +double defiPartition_fallMaxLeft (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->fallMaxLeft(); +} + +double defiPartition_riseMinRight (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->riseMinRight(); +} + +double defiPartition_fallMinRight (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->fallMinRight(); +} + +double defiPartition_riseMaxRight (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->riseMaxRight(); +} + +double defiPartition_fallMaxRight (const ::defiPartition* obj) { + return ((LefDefParser::defiPartition*)obj)->fallMaxRight(); +} + +void defiPartition_print (const ::defiPartition* obj, FILE* f) { + ((LefDefParser::defiPartition*)obj)->print(f); +} + diff --git a/src/def/cdef/xdefiPath.cpp b/src/def/cdef/xdefiPath.cpp new file mode 100644 index 00000000..ef904fda --- /dev/null +++ b/src/def/cdef/xdefiPath.cpp @@ -0,0 +1,135 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defiPath.h" +#include "defiPath.hpp" + +// Wrappers definitions. +void defiPath_initTraverse (const ::defiPath* obj) { + ((LefDefParser::defiPath*)obj)->initTraverse(); +} + +void defiPath_initTraverseBackwards (const ::defiPath* obj) { + ((LefDefParser::defiPath*)obj)->initTraverseBackwards(); +} + +int defiPath_next (const ::defiPath* obj) { + return ((LefDefParser::defiPath*)obj)->next(); +} + +int defiPath_prev (const ::defiPath* obj) { + return ((LefDefParser::defiPath*)obj)->prev(); +} + +const char* defiPath_getLayer (const ::defiPath* obj) { + return ((const LefDefParser::defiPath*)obj)->getLayer(); +} + +const char* defiPath_getTaperRule (const ::defiPath* obj) { + return ((const LefDefParser::defiPath*)obj)->getTaperRule(); +} + +const char* defiPath_getVia (const ::defiPath* obj) { + return ((const LefDefParser::defiPath*)obj)->getVia(); +} + +const char* defiPath_getShape (const ::defiPath* obj) { + return ((const LefDefParser::defiPath*)obj)->getShape(); +} + +int defiPath_getTaper (const ::defiPath* obj) { + return ((LefDefParser::defiPath*)obj)->getTaper(); +} + +int defiPath_getStyle (const ::defiPath* obj) { + return ((LefDefParser::defiPath*)obj)->getStyle(); +} + +int defiPath_getViaRotation (const ::defiPath* obj) { + return ((LefDefParser::defiPath*)obj)->getViaRotation(); +} + +void defiPath_getViaRect (const ::defiPath* obj, int* deltaX1, int* deltaY1, int* deltaX2, int* deltaY2) { + ((LefDefParser::defiPath*)obj)->getViaRect(deltaX1, deltaY1, deltaX2, deltaY2); +} + +const char* defiPath_getViaRotationStr (const ::defiPath* obj) { + return ((const LefDefParser::defiPath*)obj)->getViaRotationStr(); +} + +void defiPath_getViaData (const ::defiPath* obj, int* numX, int* numY, int* stepX, int* stepY) { + ((LefDefParser::defiPath*)obj)->getViaData(numX, numY, stepX, stepY); +} + +int defiPath_getWidth (const ::defiPath* obj) { + return ((LefDefParser::defiPath*)obj)->getWidth(); +} + +void defiPath_getPoint (const ::defiPath* obj, int* x, int* y) { + ((LefDefParser::defiPath*)obj)->getPoint(x, y); +} + +void defiPath_getFlushPoint (const ::defiPath* obj, int* x, int* y, int* ext) { + ((LefDefParser::defiPath*)obj)->getFlushPoint(x, y, ext); +} + +void defiPath_getVirtualPoint (const ::defiPath* obj, int* x, int* y) { + ((LefDefParser::defiPath*)obj)->getVirtualPoint(x, y); +} + +int defiPath_getMask (const ::defiPath* obj) { + return ((LefDefParser::defiPath*)obj)->getMask(); +} + +int defiPath_getViaTopMask (const ::defiPath* obj) { + return ((LefDefParser::defiPath*)obj)->getViaTopMask(); +} + +int defiPath_getViaCutMask (const ::defiPath* obj) { + return ((LefDefParser::defiPath*)obj)->getViaCutMask(); +} + +int defiPath_getViaBottomMask (const ::defiPath* obj) { + return ((LefDefParser::defiPath*)obj)->getViaBottomMask(); +} + +int defiPath_getRectMask (const ::defiPath* obj) { + return ((LefDefParser::defiPath*)obj)->getRectMask(); +} + +void defiPath_print (const ::defiPath* obj, FILE* fout) { + ((LefDefParser::defiPath*)obj)->print(fout); +} + diff --git a/src/def/cdef/xdefiPinCap.cpp b/src/def/cdef/xdefiPinCap.cpp new file mode 100644 index 00000000..76a0f911 --- /dev/null +++ b/src/def/cdef/xdefiPinCap.cpp @@ -0,0 +1,551 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defiPinCap.h" +#include "defiPinCap.hpp" + +// Wrappers definitions. +int defiPinCap_pin (const ::defiPinCap* obj) { + return ((LefDefParser::defiPinCap*)obj)->pin(); +} + +double defiPinCap_cap (const ::defiPinCap* obj) { + return ((LefDefParser::defiPinCap*)obj)->cap(); +} + +void defiPinCap_print (const ::defiPinCap* obj, FILE* f) { + ((LefDefParser::defiPinCap*)obj)->print(f); +} + +char* defiPinAntennaModel_antennaOxide (const ::defiPinAntennaModel* obj) { + return ((LefDefParser::defiPinAntennaModel*)obj)->antennaOxide(); +} + +int defiPinAntennaModel_hasAPinGateArea (const ::defiPinAntennaModel* obj) { + return ((LefDefParser::defiPinAntennaModel*)obj)->hasAPinGateArea(); +} + +int defiPinAntennaModel_numAPinGateArea (const ::defiPinAntennaModel* obj) { + return ((LefDefParser::defiPinAntennaModel*)obj)->numAPinGateArea(); +} + +int defiPinAntennaModel_APinGateArea (const ::defiPinAntennaModel* obj, int index) { + return ((LefDefParser::defiPinAntennaModel*)obj)->APinGateArea(index); +} + +int defiPinAntennaModel_hasAPinGateAreaLayer (const ::defiPinAntennaModel* obj, int index) { + return ((LefDefParser::defiPinAntennaModel*)obj)->hasAPinGateAreaLayer(index); +} + +const char* defiPinAntennaModel_APinGateAreaLayer (const ::defiPinAntennaModel* obj, int index) { + return ((const LefDefParser::defiPinAntennaModel*)obj)->APinGateAreaLayer(index); +} + +int defiPinAntennaModel_hasAPinMaxAreaCar (const ::defiPinAntennaModel* obj) { + return ((LefDefParser::defiPinAntennaModel*)obj)->hasAPinMaxAreaCar(); +} + +int defiPinAntennaModel_numAPinMaxAreaCar (const ::defiPinAntennaModel* obj) { + return ((LefDefParser::defiPinAntennaModel*)obj)->numAPinMaxAreaCar(); +} + +int defiPinAntennaModel_APinMaxAreaCar (const ::defiPinAntennaModel* obj, int index) { + return ((LefDefParser::defiPinAntennaModel*)obj)->APinMaxAreaCar(index); +} + +int defiPinAntennaModel_hasAPinMaxAreaCarLayer (const ::defiPinAntennaModel* obj, int index) { + return ((LefDefParser::defiPinAntennaModel*)obj)->hasAPinMaxAreaCarLayer(index); +} + +const char* defiPinAntennaModel_APinMaxAreaCarLayer (const ::defiPinAntennaModel* obj, int index) { + return ((const LefDefParser::defiPinAntennaModel*)obj)->APinMaxAreaCarLayer(index); +} + +int defiPinAntennaModel_hasAPinMaxSideAreaCar (const ::defiPinAntennaModel* obj) { + return ((LefDefParser::defiPinAntennaModel*)obj)->hasAPinMaxSideAreaCar(); +} + +int defiPinAntennaModel_numAPinMaxSideAreaCar (const ::defiPinAntennaModel* obj) { + return ((LefDefParser::defiPinAntennaModel*)obj)->numAPinMaxSideAreaCar(); +} + +int defiPinAntennaModel_APinMaxSideAreaCar (const ::defiPinAntennaModel* obj, int index) { + return ((LefDefParser::defiPinAntennaModel*)obj)->APinMaxSideAreaCar(index); +} + +int defiPinAntennaModel_hasAPinMaxSideAreaCarLayer (const ::defiPinAntennaModel* obj, int index) { + return ((LefDefParser::defiPinAntennaModel*)obj)->hasAPinMaxSideAreaCarLayer(index); +} + +const char* defiPinAntennaModel_APinMaxSideAreaCarLayer (const ::defiPinAntennaModel* obj, int index) { + return ((const LefDefParser::defiPinAntennaModel*)obj)->APinMaxSideAreaCarLayer(index); +} + +int defiPinAntennaModel_hasAPinMaxCutCar (const ::defiPinAntennaModel* obj) { + return ((LefDefParser::defiPinAntennaModel*)obj)->hasAPinMaxCutCar(); +} + +int defiPinAntennaModel_numAPinMaxCutCar (const ::defiPinAntennaModel* obj) { + return ((LefDefParser::defiPinAntennaModel*)obj)->numAPinMaxCutCar(); +} + +int defiPinAntennaModel_APinMaxCutCar (const ::defiPinAntennaModel* obj, int index) { + return ((LefDefParser::defiPinAntennaModel*)obj)->APinMaxCutCar(index); +} + +int defiPinAntennaModel_hasAPinMaxCutCarLayer (const ::defiPinAntennaModel* obj, int index) { + return ((LefDefParser::defiPinAntennaModel*)obj)->hasAPinMaxCutCarLayer(index); +} + +const char* defiPinAntennaModel_APinMaxCutCarLayer (const ::defiPinAntennaModel* obj, int index) { + return ((const LefDefParser::defiPinAntennaModel*)obj)->APinMaxCutCarLayer(index); +} + +int defiPinPort_numLayer (const ::defiPinPort* obj) { + return ((LefDefParser::defiPinPort*)obj)->numLayer(); +} + +const char* defiPinPort_layer (const ::defiPinPort* obj, int index) { + return ((const LefDefParser::defiPinPort*)obj)->layer(index); +} + +void defiPinPort_bounds (const ::defiPinPort* obj, int index, int* xl, int* yl, int* xh, int* yh) { + ((LefDefParser::defiPinPort*)obj)->bounds(index, xl, yl, xh, yh); +} + +int defiPinPort_hasLayerSpacing (const ::defiPinPort* obj, int index) { + return ((LefDefParser::defiPinPort*)obj)->hasLayerSpacing(index); +} + +int defiPinPort_hasLayerDesignRuleWidth (const ::defiPinPort* obj, int index) { + return ((LefDefParser::defiPinPort*)obj)->hasLayerDesignRuleWidth(index); +} + +int defiPinPort_layerSpacing (const ::defiPinPort* obj, int index) { + return ((LefDefParser::defiPinPort*)obj)->layerSpacing(index); +} + +int defiPinPort_layerMask (const ::defiPinPort* obj, int index) { + return ((LefDefParser::defiPinPort*)obj)->layerMask(index); +} + +int defiPinPort_layerDesignRuleWidth (const ::defiPinPort* obj, int index) { + return ((LefDefParser::defiPinPort*)obj)->layerDesignRuleWidth(index); +} + +int defiPinPort_numPolygons (const ::defiPinPort* obj) { + return ((LefDefParser::defiPinPort*)obj)->numPolygons(); +} + +const char* defiPinPort_polygonName (const ::defiPinPort* obj, int index) { + return ((const LefDefParser::defiPinPort*)obj)->polygonName(index); +} + +::defiPoints defiPinPort_getPolygon (const ::defiPinPort* obj, int index) { + LefDefParser::defiPoints tmp; + tmp = ((LefDefParser::defiPinPort*)obj)->getPolygon(index); + return *((::defiPoints*)&tmp); +} + +int defiPinPort_hasPolygonSpacing (const ::defiPinPort* obj, int index) { + return ((LefDefParser::defiPinPort*)obj)->hasPolygonSpacing(index); +} + +int defiPinPort_hasPolygonDesignRuleWidth (const ::defiPinPort* obj, int index) { + return ((LefDefParser::defiPinPort*)obj)->hasPolygonDesignRuleWidth(index); +} + +int defiPinPort_polygonSpacing (const ::defiPinPort* obj, int index) { + return ((LefDefParser::defiPinPort*)obj)->polygonSpacing(index); +} + +int defiPinPort_polygonDesignRuleWidth (const ::defiPinPort* obj, int index) { + return ((LefDefParser::defiPinPort*)obj)->polygonDesignRuleWidth(index); +} + +int defiPinPort_polygonMask (const ::defiPinPort* obj, int index) { + return ((LefDefParser::defiPinPort*)obj)->polygonMask(index); +} + +int defiPinPort_numVias (const ::defiPinPort* obj) { + return ((LefDefParser::defiPinPort*)obj)->numVias(); +} + +const char* defiPinPort_viaName (const ::defiPinPort* obj, int index) { + return ((const LefDefParser::defiPinPort*)obj)->viaName(index); +} + +int defiPinPort_viaPtX (const ::defiPinPort* obj, int index) { + return ((LefDefParser::defiPinPort*)obj)->viaPtX(index); +} + +int defiPinPort_viaPtY (const ::defiPinPort* obj, int index) { + return ((LefDefParser::defiPinPort*)obj)->viaPtY(index); +} + +int defiPinPort_viaTopMask (const ::defiPinPort* obj, int index) { + return ((LefDefParser::defiPinPort*)obj)->viaTopMask(index); +} + +int defiPinPort_viaCutMask (const ::defiPinPort* obj, int index) { + return ((LefDefParser::defiPinPort*)obj)->viaCutMask(index); +} + +int defiPinPort_viaBottomMask (const ::defiPinPort* obj, int index) { + return ((LefDefParser::defiPinPort*)obj)->viaBottomMask(index); +} + +int defiPinPort_hasPlacement (const ::defiPinPort* obj) { + return ((LefDefParser::defiPinPort*)obj)->hasPlacement(); +} + +int defiPinPort_isPlaced (const ::defiPinPort* obj) { + return ((LefDefParser::defiPinPort*)obj)->isPlaced(); +} + +int defiPinPort_isCover (const ::defiPinPort* obj) { + return ((LefDefParser::defiPinPort*)obj)->isCover(); +} + +int defiPinPort_isFixed (const ::defiPinPort* obj) { + return ((LefDefParser::defiPinPort*)obj)->isFixed(); +} + +int defiPinPort_placementX (const ::defiPinPort* obj) { + return ((LefDefParser::defiPinPort*)obj)->placementX(); +} + +int defiPinPort_placementY (const ::defiPinPort* obj) { + return ((LefDefParser::defiPinPort*)obj)->placementY(); +} + +int defiPinPort_orient (const ::defiPinPort* obj) { + return ((LefDefParser::defiPinPort*)obj)->orient(); +} + +const char* defiPinPort_orientStr (const ::defiPinPort* obj) { + return ((const LefDefParser::defiPinPort*)obj)->orientStr(); +} + +const char* defiPin_pinName (const ::defiPin* obj) { + return ((const LefDefParser::defiPin*)obj)->pinName(); +} + +const char* defiPin_netName (const ::defiPin* obj) { + return ((const LefDefParser::defiPin*)obj)->netName(); +} + +int defiPin_hasDirection (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->hasDirection(); +} + +int defiPin_hasUse (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->hasUse(); +} + +int defiPin_hasLayer (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->hasLayer(); +} + +int defiPin_hasPlacement (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->hasPlacement(); +} + +int defiPin_isUnplaced (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->isUnplaced(); +} + +int defiPin_isPlaced (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->isPlaced(); +} + +int defiPin_isCover (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->isCover(); +} + +int defiPin_isFixed (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->isFixed(); +} + +int defiPin_placementX (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->placementX(); +} + +int defiPin_placementY (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->placementY(); +} + +const char* defiPin_direction (const ::defiPin* obj) { + return ((const LefDefParser::defiPin*)obj)->direction(); +} + +const char* defiPin_use (const ::defiPin* obj) { + return ((const LefDefParser::defiPin*)obj)->use(); +} + +int defiPin_numLayer (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->numLayer(); +} + +const char* defiPin_layer (const ::defiPin* obj, int index) { + return ((const LefDefParser::defiPin*)obj)->layer(index); +} + +void defiPin_bounds (const ::defiPin* obj, int index, int* xl, int* yl, int* xh, int* yh) { + ((LefDefParser::defiPin*)obj)->bounds(index, xl, yl, xh, yh); +} + +int defiPin_layerMask (const ::defiPin* obj, int index) { + return ((LefDefParser::defiPin*)obj)->layerMask(index); +} + +int defiPin_hasLayerSpacing (const ::defiPin* obj, int index) { + return ((LefDefParser::defiPin*)obj)->hasLayerSpacing(index); +} + +int defiPin_hasLayerDesignRuleWidth (const ::defiPin* obj, int index) { + return ((LefDefParser::defiPin*)obj)->hasLayerDesignRuleWidth(index); +} + +int defiPin_layerSpacing (const ::defiPin* obj, int index) { + return ((LefDefParser::defiPin*)obj)->layerSpacing(index); +} + +int defiPin_layerDesignRuleWidth (const ::defiPin* obj, int index) { + return ((LefDefParser::defiPin*)obj)->layerDesignRuleWidth(index); +} + +int defiPin_numPolygons (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->numPolygons(); +} + +const char* defiPin_polygonName (const ::defiPin* obj, int index) { + return ((const LefDefParser::defiPin*)obj)->polygonName(index); +} + +::defiPoints defiPin_getPolygon (const ::defiPin* obj, int index) { + LefDefParser::defiPoints tmp; + tmp = ((LefDefParser::defiPin*)obj)->getPolygon(index); + return *((::defiPoints*)&tmp); +} + +int defiPin_polygonMask (const ::defiPin* obj, int index) { + return ((LefDefParser::defiPin*)obj)->polygonMask(index); +} + +int defiPin_hasPolygonSpacing (const ::defiPin* obj, int index) { + return ((LefDefParser::defiPin*)obj)->hasPolygonSpacing(index); +} + +int defiPin_hasPolygonDesignRuleWidth (const ::defiPin* obj, int index) { + return ((LefDefParser::defiPin*)obj)->hasPolygonDesignRuleWidth(index); +} + +int defiPin_polygonSpacing (const ::defiPin* obj, int index) { + return ((LefDefParser::defiPin*)obj)->polygonSpacing(index); +} + +int defiPin_polygonDesignRuleWidth (const ::defiPin* obj, int index) { + return ((LefDefParser::defiPin*)obj)->polygonDesignRuleWidth(index); +} + +int defiPin_hasNetExpr (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->hasNetExpr(); +} + +int defiPin_hasSupplySensitivity (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->hasSupplySensitivity(); +} + +int defiPin_hasGroundSensitivity (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->hasGroundSensitivity(); +} + +const char* defiPin_netExpr (const ::defiPin* obj) { + return ((const LefDefParser::defiPin*)obj)->netExpr(); +} + +const char* defiPin_supplySensitivity (const ::defiPin* obj) { + return ((const LefDefParser::defiPin*)obj)->supplySensitivity(); +} + +const char* defiPin_groundSensitivity (const ::defiPin* obj) { + return ((const LefDefParser::defiPin*)obj)->groundSensitivity(); +} + +int defiPin_orient (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->orient(); +} + +const char* defiPin_orientStr (const ::defiPin* obj) { + return ((const LefDefParser::defiPin*)obj)->orientStr(); +} + +int defiPin_hasSpecial (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->hasSpecial(); +} + +int defiPin_numVias (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->numVias(); +} + +const char* defiPin_viaName (const ::defiPin* obj, int index) { + return ((const LefDefParser::defiPin*)obj)->viaName(index); +} + +int defiPin_viaTopMask (const ::defiPin* obj, int index) { + return ((LefDefParser::defiPin*)obj)->viaTopMask(index); +} + +int defiPin_viaCutMask (const ::defiPin* obj, int index) { + return ((LefDefParser::defiPin*)obj)->viaCutMask(index); +} + +int defiPin_viaBottomMask (const ::defiPin* obj, int index) { + return ((LefDefParser::defiPin*)obj)->viaBottomMask(index); +} + +int defiPin_viaPtX (const ::defiPin* obj, int index) { + return ((LefDefParser::defiPin*)obj)->viaPtX(index); +} + +int defiPin_viaPtY (const ::defiPin* obj, int index) { + return ((LefDefParser::defiPin*)obj)->viaPtY(index); +} + +int defiPin_hasAPinPartialMetalArea (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->hasAPinPartialMetalArea(); +} + +int defiPin_numAPinPartialMetalArea (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->numAPinPartialMetalArea(); +} + +int defiPin_APinPartialMetalArea (const ::defiPin* obj, int index) { + return ((LefDefParser::defiPin*)obj)->APinPartialMetalArea(index); +} + +int defiPin_hasAPinPartialMetalAreaLayer (const ::defiPin* obj, int index) { + return ((LefDefParser::defiPin*)obj)->hasAPinPartialMetalAreaLayer(index); +} + +const char* defiPin_APinPartialMetalAreaLayer (const ::defiPin* obj, int index) { + return ((const LefDefParser::defiPin*)obj)->APinPartialMetalAreaLayer(index); +} + +int defiPin_hasAPinPartialMetalSideArea (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->hasAPinPartialMetalSideArea(); +} + +int defiPin_numAPinPartialMetalSideArea (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->numAPinPartialMetalSideArea(); +} + +int defiPin_APinPartialMetalSideArea (const ::defiPin* obj, int index) { + return ((LefDefParser::defiPin*)obj)->APinPartialMetalSideArea(index); +} + +int defiPin_hasAPinPartialMetalSideAreaLayer (const ::defiPin* obj, int index) { + return ((LefDefParser::defiPin*)obj)->hasAPinPartialMetalSideAreaLayer(index); +} + +const char* defiPin_APinPartialMetalSideAreaLayer (const ::defiPin* obj, int index) { + return ((const LefDefParser::defiPin*)obj)->APinPartialMetalSideAreaLayer(index); +} + +int defiPin_hasAPinDiffArea (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->hasAPinDiffArea(); +} + +int defiPin_numAPinDiffArea (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->numAPinDiffArea(); +} + +int defiPin_APinDiffArea (const ::defiPin* obj, int index) { + return ((LefDefParser::defiPin*)obj)->APinDiffArea(index); +} + +int defiPin_hasAPinDiffAreaLayer (const ::defiPin* obj, int index) { + return ((LefDefParser::defiPin*)obj)->hasAPinDiffAreaLayer(index); +} + +const char* defiPin_APinDiffAreaLayer (const ::defiPin* obj, int index) { + return ((const LefDefParser::defiPin*)obj)->APinDiffAreaLayer(index); +} + +int defiPin_hasAPinPartialCutArea (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->hasAPinPartialCutArea(); +} + +int defiPin_numAPinPartialCutArea (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->numAPinPartialCutArea(); +} + +int defiPin_APinPartialCutArea (const ::defiPin* obj, int index) { + return ((LefDefParser::defiPin*)obj)->APinPartialCutArea(index); +} + +int defiPin_hasAPinPartialCutAreaLayer (const ::defiPin* obj, int index) { + return ((LefDefParser::defiPin*)obj)->hasAPinPartialCutAreaLayer(index); +} + +const char* defiPin_APinPartialCutAreaLayer (const ::defiPin* obj, int index) { + return ((const LefDefParser::defiPin*)obj)->APinPartialCutAreaLayer(index); +} + +int defiPin_numAntennaModel (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->numAntennaModel(); +} + +const ::defiPinAntennaModel* defiPin_antennaModel (const ::defiPin* obj, int index) { + return (const ::defiPinAntennaModel*) ((LefDefParser::defiPin*)obj)->antennaModel(index); +} + +int defiPin_hasPort (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->hasPort(); +} + +int defiPin_numPorts (const ::defiPin* obj) { + return ((LefDefParser::defiPin*)obj)->numPorts(); +} + +const ::defiPinPort* defiPin_pinPort (const ::defiPin* obj, int index) { + return (const ::defiPinPort*) ((LefDefParser::defiPin*)obj)->pinPort(index); +} + +void defiPin_print (const ::defiPin* obj, FILE* f) { + ((LefDefParser::defiPin*)obj)->print(f); +} + diff --git a/src/def/cdef/xdefiPinProp.cpp b/src/def/cdef/xdefiPinProp.cpp new file mode 100644 index 00000000..31ea958c --- /dev/null +++ b/src/def/cdef/xdefiPinProp.cpp @@ -0,0 +1,83 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defiPinProp.h" +#include "defiPinProp.hpp" + +// Wrappers definitions. +int defiPinProp_isPin (const ::defiPinProp* obj) { + return ((LefDefParser::defiPinProp*)obj)->isPin(); +} + +const char* defiPinProp_instName (const ::defiPinProp* obj) { + return ((const LefDefParser::defiPinProp*)obj)->instName(); +} + +const char* defiPinProp_pinName (const ::defiPinProp* obj) { + return ((const LefDefParser::defiPinProp*)obj)->pinName(); +} + +int defiPinProp_numProps (const ::defiPinProp* obj) { + return ((LefDefParser::defiPinProp*)obj)->numProps(); +} + +const char* defiPinProp_propName (const ::defiPinProp* obj, int index) { + return ((const LefDefParser::defiPinProp*)obj)->propName(index); +} + +const char* defiPinProp_propValue (const ::defiPinProp* obj, int index) { + return ((const LefDefParser::defiPinProp*)obj)->propValue(index); +} + +double defiPinProp_propNumber (const ::defiPinProp* obj, int index) { + return ((LefDefParser::defiPinProp*)obj)->propNumber(index); +} + +char defiPinProp_propType (const ::defiPinProp* obj, int index) { + return ((const LefDefParser::defiPinProp*)obj)->propType(index); +} + +int defiPinProp_propIsNumber (const ::defiPinProp* obj, int index) { + return ((LefDefParser::defiPinProp*)obj)->propIsNumber(index); +} + +int defiPinProp_propIsString (const ::defiPinProp* obj, int index) { + return ((LefDefParser::defiPinProp*)obj)->propIsString(index); +} + +void defiPinProp_print (const ::defiPinProp* obj, FILE* f) { + ((LefDefParser::defiPinProp*)obj)->print(f); +} + diff --git a/src/def/cdef/xdefiProp.cpp b/src/def/cdef/xdefiProp.cpp new file mode 100644 index 00000000..8db54574 --- /dev/null +++ b/src/def/cdef/xdefiProp.cpp @@ -0,0 +1,87 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defiProp.h" +#include "defiProp.hpp" + +// Wrappers definitions. +const char* defiProp_string (const ::defiProp* obj) { + return ((const LefDefParser::defiProp*)obj)->string(); +} + +const char* defiProp_propType (const ::defiProp* obj) { + return ((const LefDefParser::defiProp*)obj)->propType(); +} + +const char* defiProp_propName (const ::defiProp* obj) { + return ((const LefDefParser::defiProp*)obj)->propName(); +} + +char defiProp_dataType (const ::defiProp* obj) { + return ((LefDefParser::defiProp*)obj)->dataType(); +} + +int defiProp_hasNumber (const ::defiProp* obj) { + return ((LefDefParser::defiProp*)obj)->hasNumber(); +} + +int defiProp_hasRange (const ::defiProp* obj) { + return ((LefDefParser::defiProp*)obj)->hasRange(); +} + +int defiProp_hasString (const ::defiProp* obj) { + return ((LefDefParser::defiProp*)obj)->hasString(); +} + +int defiProp_hasNameMapString (const ::defiProp* obj) { + return ((LefDefParser::defiProp*)obj)->hasNameMapString(); +} + +double defiProp_number (const ::defiProp* obj) { + return ((LefDefParser::defiProp*)obj)->number(); +} + +double defiProp_left (const ::defiProp* obj) { + return ((LefDefParser::defiProp*)obj)->left(); +} + +double defiProp_right (const ::defiProp* obj) { + return ((LefDefParser::defiProp*)obj)->right(); +} + +void defiProp_print (const ::defiProp* obj, FILE* f) { + ((LefDefParser::defiProp*)obj)->print(f); +} + diff --git a/src/def/cdef/xdefiPropType.cpp b/src/def/cdef/xdefiPropType.cpp new file mode 100644 index 00000000..e08a33f9 --- /dev/null +++ b/src/def/cdef/xdefiPropType.cpp @@ -0,0 +1,43 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defiPropType.h" +#include "defiPropType.hpp" + +// Wrappers definitions. +char defiPropType_propType (const ::defiPropType* obj, char* name) { + return ((const LefDefParser::defiPropType*)obj)->propType(name); +} + diff --git a/src/def/cdef/xdefiRegion.cpp b/src/def/cdef/xdefiRegion.cpp new file mode 100644 index 00000000..6db3e9ee --- /dev/null +++ b/src/def/cdef/xdefiRegion.cpp @@ -0,0 +1,103 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defiRegion.h" +#include "defiRegion.hpp" + +// Wrappers definitions. +const char* defiRegion_name (const ::defiRegion* obj) { + return ((const LefDefParser::defiRegion*)obj)->name(); +} + +int defiRegion_numProps (const ::defiRegion* obj) { + return ((LefDefParser::defiRegion*)obj)->numProps(); +} + +const char* defiRegion_propName (const ::defiRegion* obj, int index) { + return ((const LefDefParser::defiRegion*)obj)->propName(index); +} + +const char* defiRegion_propValue (const ::defiRegion* obj, int index) { + return ((const LefDefParser::defiRegion*)obj)->propValue(index); +} + +double defiRegion_propNumber (const ::defiRegion* obj, int index) { + return ((LefDefParser::defiRegion*)obj)->propNumber(index); +} + +char defiRegion_propType (const ::defiRegion* obj, int index) { + return ((const LefDefParser::defiRegion*)obj)->propType(index); +} + +int defiRegion_propIsNumber (const ::defiRegion* obj, int index) { + return ((LefDefParser::defiRegion*)obj)->propIsNumber(index); +} + +int defiRegion_propIsString (const ::defiRegion* obj, int index) { + return ((LefDefParser::defiRegion*)obj)->propIsString(index); +} + +int defiRegion_hasType (const ::defiRegion* obj) { + return ((LefDefParser::defiRegion*)obj)->hasType(); +} + +const char* defiRegion_type (const ::defiRegion* obj) { + return ((const LefDefParser::defiRegion*)obj)->type(); +} + +int defiRegion_numRectangles (const ::defiRegion* obj) { + return ((LefDefParser::defiRegion*)obj)->numRectangles(); +} + +int defiRegion_xl (const ::defiRegion* obj, int index) { + return ((LefDefParser::defiRegion*)obj)->xl(index); +} + +int defiRegion_yl (const ::defiRegion* obj, int index) { + return ((LefDefParser::defiRegion*)obj)->yl(index); +} + +int defiRegion_xh (const ::defiRegion* obj, int index) { + return ((LefDefParser::defiRegion*)obj)->xh(index); +} + +int defiRegion_yh (const ::defiRegion* obj, int index) { + return ((LefDefParser::defiRegion*)obj)->yh(index); +} + +void defiRegion_print (const ::defiRegion* obj, FILE* f) { + ((LefDefParser::defiRegion*)obj)->print(f); +} + diff --git a/src/def/cdef/xdefiRowTrack.cpp b/src/def/cdef/xdefiRowTrack.cpp new file mode 100644 index 00000000..beecc0d2 --- /dev/null +++ b/src/def/cdef/xdefiRowTrack.cpp @@ -0,0 +1,175 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defiRowTrack.h" +#include "defiRowTrack.hpp" + +// Wrappers definitions. +const char* defiRow_name (const ::defiRow* obj) { + return ((const LefDefParser::defiRow*)obj)->name(); +} + +const char* defiRow_macro (const ::defiRow* obj) { + return ((const LefDefParser::defiRow*)obj)->macro(); +} + +double defiRow_x (const ::defiRow* obj) { + return ((LefDefParser::defiRow*)obj)->x(); +} + +double defiRow_y (const ::defiRow* obj) { + return ((LefDefParser::defiRow*)obj)->y(); +} + +int defiRow_orient (const ::defiRow* obj) { + return ((LefDefParser::defiRow*)obj)->orient(); +} + +const char* defiRow_orientStr (const ::defiRow* obj) { + return ((const LefDefParser::defiRow*)obj)->orientStr(); +} + +int defiRow_hasDo (const ::defiRow* obj) { + return ((LefDefParser::defiRow*)obj)->hasDo(); +} + +double defiRow_xNum (const ::defiRow* obj) { + return ((LefDefParser::defiRow*)obj)->xNum(); +} + +double defiRow_yNum (const ::defiRow* obj) { + return ((LefDefParser::defiRow*)obj)->yNum(); +} + +int defiRow_hasDoStep (const ::defiRow* obj) { + return ((LefDefParser::defiRow*)obj)->hasDoStep(); +} + +double defiRow_xStep (const ::defiRow* obj) { + return ((LefDefParser::defiRow*)obj)->xStep(); +} + +double defiRow_yStep (const ::defiRow* obj) { + return ((LefDefParser::defiRow*)obj)->yStep(); +} + +int defiRow_numProps (const ::defiRow* obj) { + return ((LefDefParser::defiRow*)obj)->numProps(); +} + +const char* defiRow_propName (const ::defiRow* obj, int index) { + return ((const LefDefParser::defiRow*)obj)->propName(index); +} + +const char* defiRow_propValue (const ::defiRow* obj, int index) { + return ((const LefDefParser::defiRow*)obj)->propValue(index); +} + +double defiRow_propNumber (const ::defiRow* obj, int index) { + return ((LefDefParser::defiRow*)obj)->propNumber(index); +} + +char defiRow_propType (const ::defiRow* obj, int index) { + return ((const LefDefParser::defiRow*)obj)->propType(index); +} + +int defiRow_propIsNumber (const ::defiRow* obj, int index) { + return ((LefDefParser::defiRow*)obj)->propIsNumber(index); +} + +int defiRow_propIsString (const ::defiRow* obj, int index) { + return ((LefDefParser::defiRow*)obj)->propIsString(index); +} + +void defiRow_print (const ::defiRow* obj, FILE* f) { + ((LefDefParser::defiRow*)obj)->print(f); +} + +const char* defiTrack_macro (const ::defiTrack* obj) { + return ((const LefDefParser::defiTrack*)obj)->macro(); +} + +double defiTrack_x (const ::defiTrack* obj) { + return ((LefDefParser::defiTrack*)obj)->x(); +} + +double defiTrack_xNum (const ::defiTrack* obj) { + return ((LefDefParser::defiTrack*)obj)->xNum(); +} + +double defiTrack_xStep (const ::defiTrack* obj) { + return ((LefDefParser::defiTrack*)obj)->xStep(); +} + +int defiTrack_numLayers (const ::defiTrack* obj) { + return ((LefDefParser::defiTrack*)obj)->numLayers(); +} + +const char* defiTrack_layer (const ::defiTrack* obj, int index) { + return ((const LefDefParser::defiTrack*)obj)->layer(index); +} + +int defiTrack_firstTrackMask (const ::defiTrack* obj) { + return ((LefDefParser::defiTrack*)obj)->firstTrackMask(); +} + +int defiTrack_sameMask (const ::defiTrack* obj) { + return ((LefDefParser::defiTrack*)obj)->sameMask(); +} + +void defiTrack_print (const ::defiTrack* obj, FILE* f) { + ((LefDefParser::defiTrack*)obj)->print(f); +} + +const char* defiGcellGrid_macro (const ::defiGcellGrid* obj) { + return ((const LefDefParser::defiGcellGrid*)obj)->macro(); +} + +int defiGcellGrid_x (const ::defiGcellGrid* obj) { + return ((LefDefParser::defiGcellGrid*)obj)->x(); +} + +int defiGcellGrid_xNum (const ::defiGcellGrid* obj) { + return ((LefDefParser::defiGcellGrid*)obj)->xNum(); +} + +double defiGcellGrid_xStep (const ::defiGcellGrid* obj) { + return ((LefDefParser::defiGcellGrid*)obj)->xStep(); +} + +void defiGcellGrid_print (const ::defiGcellGrid* obj, FILE* f) { + ((LefDefParser::defiGcellGrid*)obj)->print(f); +} + diff --git a/src/def/cdef/xdefiScanchain.cpp b/src/def/cdef/xdefiScanchain.cpp new file mode 100644 index 00000000..53e360c1 --- /dev/null +++ b/src/def/cdef/xdefiScanchain.cpp @@ -0,0 +1,135 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defiScanchain.h" +#include "defiScanchain.hpp" + +// Wrappers definitions. +int defiOrdered_num (const ::defiOrdered* obj) { + return ((LefDefParser::defiOrdered*)obj)->num(); +} + +char** defiOrdered_inst (const ::defiOrdered* obj) { + return ((LefDefParser::defiOrdered*)obj)->inst(); +} + +char** defiOrdered_in (const ::defiOrdered* obj) { + return ((LefDefParser::defiOrdered*)obj)->in(); +} + +char** defiOrdered_out (const ::defiOrdered* obj) { + return ((LefDefParser::defiOrdered*)obj)->out(); +} + +int* defiOrdered_bits (const ::defiOrdered* obj) { + return ((LefDefParser::defiOrdered*)obj)->bits(); +} + +const char* defiScanchain_name (const ::defiScanchain* obj) { + return ((const LefDefParser::defiScanchain*)obj)->name(); +} + +int defiScanchain_hasStart (const ::defiScanchain* obj) { + return ((LefDefParser::defiScanchain*)obj)->hasStart(); +} + +int defiScanchain_hasStop (const ::defiScanchain* obj) { + return ((LefDefParser::defiScanchain*)obj)->hasStop(); +} + +int defiScanchain_hasFloating (const ::defiScanchain* obj) { + return ((LefDefParser::defiScanchain*)obj)->hasFloating(); +} + +int defiScanchain_hasOrdered (const ::defiScanchain* obj) { + return ((LefDefParser::defiScanchain*)obj)->hasOrdered(); +} + +int defiScanchain_hasCommonInPin (const ::defiScanchain* obj) { + return ((LefDefParser::defiScanchain*)obj)->hasCommonInPin(); +} + +int defiScanchain_hasCommonOutPin (const ::defiScanchain* obj) { + return ((LefDefParser::defiScanchain*)obj)->hasCommonOutPin(); +} + +int defiScanchain_hasPartition (const ::defiScanchain* obj) { + return ((LefDefParser::defiScanchain*)obj)->hasPartition(); +} + +int defiScanchain_hasPartitionMaxBits (const ::defiScanchain* obj) { + return ((LefDefParser::defiScanchain*)obj)->hasPartitionMaxBits(); +} + +void defiScanchain_start (const ::defiScanchain* obj, char** inst, char** pin) { + ((LefDefParser::defiScanchain*)obj)->start(inst, pin); +} + +void defiScanchain_stop (const ::defiScanchain* obj, char** inst, char** pin) { + ((LefDefParser::defiScanchain*)obj)->stop(inst, pin); +} + +int defiScanchain_numOrderedLists (const ::defiScanchain* obj) { + return ((LefDefParser::defiScanchain*)obj)->numOrderedLists(); +} + +void defiScanchain_ordered (const ::defiScanchain* obj, int index, int* size, char*** inst, char*** inPin, char*** outPin, int** bits) { + ((LefDefParser::defiScanchain*)obj)->ordered(index, size, inst, inPin, outPin, bits); +} + +void defiScanchain_floating (const ::defiScanchain* obj, int* size, char*** inst, char*** inPin, char*** outPin, int** bits) { + ((LefDefParser::defiScanchain*)obj)->floating(size, inst, inPin, outPin, bits); +} + +const char* defiScanchain_commonInPin (const ::defiScanchain* obj) { + return ((const LefDefParser::defiScanchain*)obj)->commonInPin(); +} + +const char* defiScanchain_commonOutPin (const ::defiScanchain* obj) { + return ((const LefDefParser::defiScanchain*)obj)->commonOutPin(); +} + +const char* defiScanchain_partitionName (const ::defiScanchain* obj) { + return ((const LefDefParser::defiScanchain*)obj)->partitionName(); +} + +int defiScanchain_partitionMaxBits (const ::defiScanchain* obj) { + return ((LefDefParser::defiScanchain*)obj)->partitionMaxBits(); +} + +void defiScanchain_print (const ::defiScanchain* obj, FILE* f) { + ((LefDefParser::defiScanchain*)obj)->print(f); +} + diff --git a/src/def/cdef/xdefiSite.cpp b/src/def/cdef/xdefiSite.cpp new file mode 100644 index 00000000..d80664e3 --- /dev/null +++ b/src/def/cdef/xdefiSite.cpp @@ -0,0 +1,105 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defiSite.h" +#include "defiSite.hpp" + +// Wrappers definitions. +double defiSite_x_num (const ::defiSite* obj) { + return ((LefDefParser::defiSite*)obj)->x_num(); +} + +double defiSite_y_num (const ::defiSite* obj) { + return ((LefDefParser::defiSite*)obj)->y_num(); +} + +double defiSite_x_step (const ::defiSite* obj) { + return ((LefDefParser::defiSite*)obj)->x_step(); +} + +double defiSite_y_step (const ::defiSite* obj) { + return ((LefDefParser::defiSite*)obj)->y_step(); +} + +double defiSite_x_orig (const ::defiSite* obj) { + return ((LefDefParser::defiSite*)obj)->x_orig(); +} + +double defiSite_y_orig (const ::defiSite* obj) { + return ((LefDefParser::defiSite*)obj)->y_orig(); +} + +int defiSite_orient (const ::defiSite* obj) { + return ((LefDefParser::defiSite*)obj)->orient(); +} + +const char* defiSite_orientStr (const ::defiSite* obj) { + return ((const LefDefParser::defiSite*)obj)->orientStr(); +} + +const char* defiSite_name (const ::defiSite* obj) { + return ((const LefDefParser::defiSite*)obj)->name(); +} + +void defiSite_print (const ::defiSite* obj, FILE* f) { + ((LefDefParser::defiSite*)obj)->print(f); +} + +int defiBox_xl (const ::defiBox* obj) { + return ((LefDefParser::defiBox*)obj)->xl(); +} + +int defiBox_yl (const ::defiBox* obj) { + return ((LefDefParser::defiBox*)obj)->yl(); +} + +int defiBox_xh (const ::defiBox* obj) { + return ((LefDefParser::defiBox*)obj)->xh(); +} + +int defiBox_yh (const ::defiBox* obj) { + return ((LefDefParser::defiBox*)obj)->yh(); +} + +::defiPoints defiBox_getPoint (const ::defiBox* obj) { + LefDefParser::defiPoints tmp; + tmp = ((LefDefParser::defiBox*)obj)->getPoint(); + return *((::defiPoints*)&tmp); +} + +void defiBox_print (const ::defiBox* obj, FILE* f) { + ((LefDefParser::defiBox*)obj)->print(f); +} + diff --git a/src/def/cdef/xdefiSlot.cpp b/src/def/cdef/xdefiSlot.cpp new file mode 100644 index 00000000..e610b584 --- /dev/null +++ b/src/def/cdef/xdefiSlot.cpp @@ -0,0 +1,81 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defiSlot.h" +#include "defiSlot.hpp" + +// Wrappers definitions. +int defiSlot_hasLayer (const ::defiSlot* obj) { + return ((LefDefParser::defiSlot*)obj)->hasLayer(); +} + +const char* defiSlot_layerName (const ::defiSlot* obj) { + return ((const LefDefParser::defiSlot*)obj)->layerName(); +} + +int defiSlot_numRectangles (const ::defiSlot* obj) { + return ((LefDefParser::defiSlot*)obj)->numRectangles(); +} + +int defiSlot_xl (const ::defiSlot* obj, int index) { + return ((LefDefParser::defiSlot*)obj)->xl(index); +} + +int defiSlot_yl (const ::defiSlot* obj, int index) { + return ((LefDefParser::defiSlot*)obj)->yl(index); +} + +int defiSlot_xh (const ::defiSlot* obj, int index) { + return ((LefDefParser::defiSlot*)obj)->xh(index); +} + +int defiSlot_yh (const ::defiSlot* obj, int index) { + return ((LefDefParser::defiSlot*)obj)->yh(index); +} + +int defiSlot_numPolygons (const ::defiSlot* obj) { + return ((LefDefParser::defiSlot*)obj)->numPolygons(); +} + +::defiPoints defiSlot_getPolygon (const ::defiSlot* obj, int index) { + LefDefParser::defiPoints tmp; + tmp = ((LefDefParser::defiSlot*)obj)->getPolygon(index); + return *((::defiPoints*)&tmp); +} + +void defiSlot_print (const ::defiSlot* obj, FILE* f) { + ((LefDefParser::defiSlot*)obj)->print(f); +} + diff --git a/src/def/cdef/xdefiTimingDisable.cpp b/src/def/cdef/xdefiTimingDisable.cpp new file mode 100644 index 00000000..ae1d0f80 --- /dev/null +++ b/src/def/cdef/xdefiTimingDisable.cpp @@ -0,0 +1,91 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defiTimingDisable.h" +#include "defiTimingDisable.hpp" + +// Wrappers definitions. +int defiTimingDisable_hasMacroThru (const ::defiTimingDisable* obj) { + return ((LefDefParser::defiTimingDisable*)obj)->hasMacroThru(); +} + +int defiTimingDisable_hasMacroFromTo (const ::defiTimingDisable* obj) { + return ((LefDefParser::defiTimingDisable*)obj)->hasMacroFromTo(); +} + +int defiTimingDisable_hasThru (const ::defiTimingDisable* obj) { + return ((LefDefParser::defiTimingDisable*)obj)->hasThru(); +} + +int defiTimingDisable_hasFromTo (const ::defiTimingDisable* obj) { + return ((LefDefParser::defiTimingDisable*)obj)->hasFromTo(); +} + +int defiTimingDisable_hasReentrantPathsFlag (const ::defiTimingDisable* obj) { + return ((LefDefParser::defiTimingDisable*)obj)->hasReentrantPathsFlag(); +} + +const char* defiTimingDisable_fromPin (const ::defiTimingDisable* obj) { + return ((const LefDefParser::defiTimingDisable*)obj)->fromPin(); +} + +const char* defiTimingDisable_toPin (const ::defiTimingDisable* obj) { + return ((const LefDefParser::defiTimingDisable*)obj)->toPin(); +} + +const char* defiTimingDisable_fromInst (const ::defiTimingDisable* obj) { + return ((const LefDefParser::defiTimingDisable*)obj)->fromInst(); +} + +const char* defiTimingDisable_toInst (const ::defiTimingDisable* obj) { + return ((const LefDefParser::defiTimingDisable*)obj)->toInst(); +} + +const char* defiTimingDisable_macroName (const ::defiTimingDisable* obj) { + return ((const LefDefParser::defiTimingDisable*)obj)->macroName(); +} + +const char* defiTimingDisable_thruPin (const ::defiTimingDisable* obj) { + return ((const LefDefParser::defiTimingDisable*)obj)->thruPin(); +} + +const char* defiTimingDisable_thruInst (const ::defiTimingDisable* obj) { + return ((const LefDefParser::defiTimingDisable*)obj)->thruInst(); +} + +void defiTimingDisable_print (const ::defiTimingDisable* obj, FILE* f) { + ((LefDefParser::defiTimingDisable*)obj)->print(f); +} + diff --git a/src/def/cdef/xdefiVia.cpp b/src/def/cdef/xdefiVia.cpp new file mode 100644 index 00000000..bf8ebcb4 --- /dev/null +++ b/src/def/cdef/xdefiVia.cpp @@ -0,0 +1,133 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defiVia.h" +#include "defiVia.hpp" + +// Wrappers definitions. +const char* defiVia_name (const ::defiVia* obj) { + return ((const LefDefParser::defiVia*)obj)->name(); +} + +const char* defiVia_pattern (const ::defiVia* obj) { + return ((const LefDefParser::defiVia*)obj)->pattern(); +} + +int defiVia_hasPattern (const ::defiVia* obj) { + return ((LefDefParser::defiVia*)obj)->hasPattern(); +} + +int defiVia_numLayers (const ::defiVia* obj) { + return ((LefDefParser::defiVia*)obj)->numLayers(); +} + +void defiVia_layer (const ::defiVia* obj, int index, char** layer, int* xl, int* yl, int* xh, int* yh) { + ((LefDefParser::defiVia*)obj)->layer(index, layer, xl, yl, xh, yh); +} + +int defiVia_numPolygons (const ::defiVia* obj) { + return ((LefDefParser::defiVia*)obj)->numPolygons(); +} + +const char* defiVia_polygonName (const ::defiVia* obj, int index) { + return ((const LefDefParser::defiVia*)obj)->polygonName(index); +} + +::defiPoints defiVia_getPolygon (const ::defiVia* obj, int index) { + LefDefParser::defiPoints tmp; + tmp = ((LefDefParser::defiVia*)obj)->getPolygon(index); + return *((::defiPoints*)&tmp); +} + +int defiVia_hasViaRule (const ::defiVia* obj) { + return ((LefDefParser::defiVia*)obj)->hasViaRule(); +} + +void defiVia_viaRule (const ::defiVia* obj, char** viaRuleName, int* xSize, int* ySize, char** botLayer, char** cutLayer, char** topLayer, int* xCutSpacing, int* yCutSpacing, int* xBotEnc, int* yBotEnc, int* xTopEnc, int* yTopEnc) { + ((LefDefParser::defiVia*)obj)->viaRule(viaRuleName, xSize, ySize, botLayer, cutLayer, topLayer, xCutSpacing, yCutSpacing, xBotEnc, yBotEnc, xTopEnc, yTopEnc); +} + +int defiVia_hasRowCol (const ::defiVia* obj) { + return ((LefDefParser::defiVia*)obj)->hasRowCol(); +} + +void defiVia_rowCol (const ::defiVia* obj, int* numCutRows, int* numCutCols) { + ((LefDefParser::defiVia*)obj)->rowCol(numCutRows, numCutCols); +} + +int defiVia_hasOrigin (const ::defiVia* obj) { + return ((LefDefParser::defiVia*)obj)->hasOrigin(); +} + +void defiVia_origin (const ::defiVia* obj, int* xOffset, int* yOffset) { + ((LefDefParser::defiVia*)obj)->origin(xOffset, yOffset); +} + +int defiVia_hasOffset (const ::defiVia* obj) { + return ((LefDefParser::defiVia*)obj)->hasOffset(); +} + +void defiVia_offset (const ::defiVia* obj, int* xBotOffset, int* yBotOffset, int* xTopOffset, int* yTopOffset) { + ((LefDefParser::defiVia*)obj)->offset(xBotOffset, yBotOffset, xTopOffset, yTopOffset); +} + +int defiVia_hasCutPattern (const ::defiVia* obj) { + return ((LefDefParser::defiVia*)obj)->hasCutPattern(); +} + +const char* defiVia_cutPattern (const ::defiVia* obj) { + return ((const LefDefParser::defiVia*)obj)->cutPattern(); +} + +int defiVia_hasRectMask (const ::defiVia* obj, int index) { + return ((LefDefParser::defiVia*)obj)->hasRectMask(index); +} + +int defiVia_rectMask (const ::defiVia* obj, int index) { + return ((LefDefParser::defiVia*)obj)->rectMask(index); +} + +int defiVia_hasPolyMask (const ::defiVia* obj, int index) { + return ((LefDefParser::defiVia*)obj)->hasPolyMask(index); +} + +int defiVia_polyMask (const ::defiVia* obj, int index) { + return ((LefDefParser::defiVia*)obj)->polyMask(index); +} + +void defiVia_print (const ::defiVia* obj, FILE* f) { + ((LefDefParser::defiVia*)obj)->print(f); +} + diff --git a/src/def/cdef/xdefrReader.cpp b/src/def/cdef/xdefrReader.cpp new file mode 100644 index 00000000..fa1faaab --- /dev/null +++ b/src/def/cdef/xdefrReader.cpp @@ -0,0 +1,1119 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defrReader.h" +#include "defrReader.hpp" + +// Wrappers definitions. +int defrInit () { + return LefDefParser::defrInit(); +} + +int defrInitSession (int startSession) { + return LefDefParser::defrInitSession(startSession); +} + +int defrReset () { + return LefDefParser::defrReset(); +} + +int defrClear () { + return LefDefParser::defrClear(); +} + +void defrSetCommentChar (char c) { + LefDefParser::defrSetCommentChar(c); +} + +void defrSetAddPathToNet () { + LefDefParser::defrSetAddPathToNet(); +} + +void defrSetAllowComponentNets () { + LefDefParser::defrSetAllowComponentNets(); +} + +int defrGetAllowComponentNets () { + return LefDefParser::defrGetAllowComponentNets(); +} + +void defrSetCaseSensitivity (int caseSense) { + LefDefParser::defrSetCaseSensitivity(caseSense); +} + +void defrSetRegisterUnusedCallbacks () { + LefDefParser::defrSetRegisterUnusedCallbacks(); +} + +void defrPrintUnusedCallbacks (FILE* log) { + LefDefParser::defrPrintUnusedCallbacks(log); +} + +int defrReleaseNResetMemory () { + return LefDefParser::defrReleaseNResetMemory(); +} + +int defrRead (FILE * file, const char * fileName, defiUserData userData, int case_sensitive) { + return LefDefParser::defrRead(file, fileName, userData, case_sensitive); +} + +void defrSetUserData (defiUserData p0) { + LefDefParser::defrSetUserData(p0); +} + +defiUserData defrGetUserData () { + return LefDefParser::defrGetUserData(); +} + +void defrSetArrayNameCbk (::defrStringCbkFnType p0) { + LefDefParser::defrSetArrayNameCbk((LefDefParser::defrStringCbkFnType) p0); +} + +void defrSetAssertionCbk (::defrAssertionCbkFnType p0) { + LefDefParser::defrSetAssertionCbk((LefDefParser::defrAssertionCbkFnType) p0); +} + +void defrSetAssertionsStartCbk (::defrIntegerCbkFnType p0) { + LefDefParser::defrSetAssertionsStartCbk((LefDefParser::defrIntegerCbkFnType) p0); +} + +void defrSetAssertionsEndCbk (::defrVoidCbkFnType p0) { + LefDefParser::defrSetAssertionsEndCbk((LefDefParser::defrVoidCbkFnType) p0); +} + +void defrSetBlockageCbk (::defrBlockageCbkFnType p0) { + LefDefParser::defrSetBlockageCbk((LefDefParser::defrBlockageCbkFnType) p0); +} + +void defrSetBlockageStartCbk (::defrIntegerCbkFnType p0) { + LefDefParser::defrSetBlockageStartCbk((LefDefParser::defrIntegerCbkFnType) p0); +} + +void defrSetBlockageEndCbk (::defrVoidCbkFnType p0) { + LefDefParser::defrSetBlockageEndCbk((LefDefParser::defrVoidCbkFnType) p0); +} + +void defrSetBusBitCbk (::defrStringCbkFnType p0) { + LefDefParser::defrSetBusBitCbk((LefDefParser::defrStringCbkFnType) p0); +} + +void defrSetCannotOccupyCbk (::defrSiteCbkFnType p0) { + LefDefParser::defrSetCannotOccupyCbk((LefDefParser::defrSiteCbkFnType) p0); +} + +void defrSetCanplaceCbk (::defrSiteCbkFnType p0) { + LefDefParser::defrSetCanplaceCbk((LefDefParser::defrSiteCbkFnType) p0); +} + +void defrSetCaseSensitiveCbk (::defrIntegerCbkFnType p0) { + LefDefParser::defrSetCaseSensitiveCbk((LefDefParser::defrIntegerCbkFnType) p0); +} + +void defrSetComponentCbk (::defrComponentCbkFnType p0) { + LefDefParser::defrSetComponentCbk((LefDefParser::defrComponentCbkFnType) p0); +} + +void defrSetComponentExtCbk (::defrStringCbkFnType p0) { + LefDefParser::defrSetComponentExtCbk((LefDefParser::defrStringCbkFnType) p0); +} + +void defrSetComponentStartCbk (::defrIntegerCbkFnType p0) { + LefDefParser::defrSetComponentStartCbk((LefDefParser::defrIntegerCbkFnType) p0); +} + +void defrSetComponentEndCbk (::defrVoidCbkFnType p0) { + LefDefParser::defrSetComponentEndCbk((LefDefParser::defrVoidCbkFnType) p0); +} + +void defrSetConstraintCbk (::defrAssertionCbkFnType p0) { + LefDefParser::defrSetConstraintCbk((LefDefParser::defrAssertionCbkFnType) p0); +} + +void defrSetConstraintsStartCbk (::defrIntegerCbkFnType p0) { + LefDefParser::defrSetConstraintsStartCbk((LefDefParser::defrIntegerCbkFnType) p0); +} + +void defrSetConstraintsEndCbk (::defrVoidCbkFnType p0) { + LefDefParser::defrSetConstraintsEndCbk((LefDefParser::defrVoidCbkFnType) p0); +} + +void defrSetDefaultCapCbk (::defrIntegerCbkFnType p0) { + LefDefParser::defrSetDefaultCapCbk((LefDefParser::defrIntegerCbkFnType) p0); +} + +void defrSetDesignCbk (::defrStringCbkFnType p0) { + LefDefParser::defrSetDesignCbk((LefDefParser::defrStringCbkFnType) p0); +} + +void defrSetDesignEndCbk (::defrVoidCbkFnType p0) { + LefDefParser::defrSetDesignEndCbk((LefDefParser::defrVoidCbkFnType) p0); +} + +void defrSetDieAreaCbk (::defrBoxCbkFnType p0) { + LefDefParser::defrSetDieAreaCbk((LefDefParser::defrBoxCbkFnType) p0); +} + +void defrSetDividerCbk (::defrStringCbkFnType p0) { + LefDefParser::defrSetDividerCbk((LefDefParser::defrStringCbkFnType) p0); +} + +void defrSetExtensionCbk (::defrStringCbkFnType p0) { + LefDefParser::defrSetExtensionCbk((LefDefParser::defrStringCbkFnType) p0); +} + +void defrSetFillCbk (::defrFillCbkFnType p0) { + LefDefParser::defrSetFillCbk((LefDefParser::defrFillCbkFnType) p0); +} + +void defrSetFillStartCbk (::defrIntegerCbkFnType p0) { + LefDefParser::defrSetFillStartCbk((LefDefParser::defrIntegerCbkFnType) p0); +} + +void defrSetFillEndCbk (::defrVoidCbkFnType p0) { + LefDefParser::defrSetFillEndCbk((LefDefParser::defrVoidCbkFnType) p0); +} + +void defrSetFPCCbk (::defrFPCCbkFnType p0) { + LefDefParser::defrSetFPCCbk((LefDefParser::defrFPCCbkFnType) p0); +} + +void defrSetFPCStartCbk (::defrIntegerCbkFnType p0) { + LefDefParser::defrSetFPCStartCbk((LefDefParser::defrIntegerCbkFnType) p0); +} + +void defrSetFPCEndCbk (::defrVoidCbkFnType p0) { + LefDefParser::defrSetFPCEndCbk((LefDefParser::defrVoidCbkFnType) p0); +} + +void defrSetFloorPlanNameCbk (::defrStringCbkFnType p0) { + LefDefParser::defrSetFloorPlanNameCbk((LefDefParser::defrStringCbkFnType) p0); +} + +void defrSetGcellGridCbk (::defrGcellGridCbkFnType p0) { + LefDefParser::defrSetGcellGridCbk((LefDefParser::defrGcellGridCbkFnType) p0); +} + +void defrSetGroupNameCbk (::defrStringCbkFnType p0) { + LefDefParser::defrSetGroupNameCbk((LefDefParser::defrStringCbkFnType) p0); +} + +void defrSetGroupMemberCbk (::defrStringCbkFnType p0) { + LefDefParser::defrSetGroupMemberCbk((LefDefParser::defrStringCbkFnType) p0); +} + +void defrSetComponentMaskShiftLayerCbk (::defrComponentMaskShiftLayerCbkFnType p0) { + LefDefParser::defrSetComponentMaskShiftLayerCbk((LefDefParser::defrComponentMaskShiftLayerCbkFnType) p0); +} + +void defrSetGroupCbk (::defrGroupCbkFnType p0) { + LefDefParser::defrSetGroupCbk((LefDefParser::defrGroupCbkFnType) p0); +} + +void defrSetGroupExtCbk (::defrStringCbkFnType p0) { + LefDefParser::defrSetGroupExtCbk((LefDefParser::defrStringCbkFnType) p0); +} + +void defrSetGroupsStartCbk (::defrIntegerCbkFnType p0) { + LefDefParser::defrSetGroupsStartCbk((LefDefParser::defrIntegerCbkFnType) p0); +} + +void defrSetGroupsEndCbk (::defrVoidCbkFnType p0) { + LefDefParser::defrSetGroupsEndCbk((LefDefParser::defrVoidCbkFnType) p0); +} + +void defrSetHistoryCbk (::defrStringCbkFnType p0) { + LefDefParser::defrSetHistoryCbk((LefDefParser::defrStringCbkFnType) p0); +} + +void defrSetIOTimingCbk (::defrIOTimingCbkFnType p0) { + LefDefParser::defrSetIOTimingCbk((LefDefParser::defrIOTimingCbkFnType) p0); +} + +void defrSetIOTimingsStartCbk (::defrIntegerCbkFnType p0) { + LefDefParser::defrSetIOTimingsStartCbk((LefDefParser::defrIntegerCbkFnType) p0); +} + +void defrSetIOTimingsEndCbk (::defrVoidCbkFnType p0) { + LefDefParser::defrSetIOTimingsEndCbk((LefDefParser::defrVoidCbkFnType) p0); +} + +void defrSetIoTimingsExtCbk (::defrStringCbkFnType p0) { + LefDefParser::defrSetIoTimingsExtCbk((LefDefParser::defrStringCbkFnType) p0); +} + +void defrSetNetCbk (::defrNetCbkFnType p0) { + LefDefParser::defrSetNetCbk((LefDefParser::defrNetCbkFnType) p0); +} + +void defrSetNetNameCbk (::defrStringCbkFnType p0) { + LefDefParser::defrSetNetNameCbk((LefDefParser::defrStringCbkFnType) p0); +} + +void defrSetNetNonDefaultRuleCbk (::defrStringCbkFnType p0) { + LefDefParser::defrSetNetNonDefaultRuleCbk((LefDefParser::defrStringCbkFnType) p0); +} + +void defrSetNetConnectionExtCbk (::defrStringCbkFnType p0) { + LefDefParser::defrSetNetConnectionExtCbk((LefDefParser::defrStringCbkFnType) p0); +} + +void defrSetNetExtCbk (::defrStringCbkFnType p0) { + LefDefParser::defrSetNetExtCbk((LefDefParser::defrStringCbkFnType) p0); +} + +void defrSetNetPartialPathCbk (::defrNetCbkFnType p0) { + LefDefParser::defrSetNetPartialPathCbk((LefDefParser::defrNetCbkFnType) p0); +} + +void defrSetNetSubnetNameCbk (::defrStringCbkFnType p0) { + LefDefParser::defrSetNetSubnetNameCbk((LefDefParser::defrStringCbkFnType) p0); +} + +void defrSetNetStartCbk (::defrIntegerCbkFnType p0) { + LefDefParser::defrSetNetStartCbk((LefDefParser::defrIntegerCbkFnType) p0); +} + +void defrSetNetEndCbk (::defrVoidCbkFnType p0) { + LefDefParser::defrSetNetEndCbk((LefDefParser::defrVoidCbkFnType) p0); +} + +void defrSetNonDefaultCbk (::defrNonDefaultCbkFnType p0) { + LefDefParser::defrSetNonDefaultCbk((LefDefParser::defrNonDefaultCbkFnType) p0); +} + +void defrSetNonDefaultStartCbk (::defrIntegerCbkFnType p0) { + LefDefParser::defrSetNonDefaultStartCbk((LefDefParser::defrIntegerCbkFnType) p0); +} + +void defrSetNonDefaultEndCbk (::defrVoidCbkFnType p0) { + LefDefParser::defrSetNonDefaultEndCbk((LefDefParser::defrVoidCbkFnType) p0); +} + +void defrSetPartitionCbk (::defrPartitionCbkFnType p0) { + LefDefParser::defrSetPartitionCbk((LefDefParser::defrPartitionCbkFnType) p0); +} + +void defrSetPartitionsExtCbk (::defrStringCbkFnType p0) { + LefDefParser::defrSetPartitionsExtCbk((LefDefParser::defrStringCbkFnType) p0); +} + +void defrSetPartitionsStartCbk (::defrIntegerCbkFnType p0) { + LefDefParser::defrSetPartitionsStartCbk((LefDefParser::defrIntegerCbkFnType) p0); +} + +void defrSetPartitionsEndCbk (::defrVoidCbkFnType p0) { + LefDefParser::defrSetPartitionsEndCbk((LefDefParser::defrVoidCbkFnType) p0); +} + +void defrSetPathCbk (::defrPathCbkFnType p0) { + LefDefParser::defrSetPathCbk((LefDefParser::defrPathCbkFnType) p0); +} + +void defrSetPinCapCbk (::defrPinCapCbkFnType p0) { + LefDefParser::defrSetPinCapCbk((LefDefParser::defrPinCapCbkFnType) p0); +} + +void defrSetPinCbk (::defrPinCbkFnType p0) { + LefDefParser::defrSetPinCbk((LefDefParser::defrPinCbkFnType) p0); +} + +void defrSetPinExtCbk (::defrStringCbkFnType p0) { + LefDefParser::defrSetPinExtCbk((LefDefParser::defrStringCbkFnType) p0); +} + +void defrSetPinPropCbk (::defrPinPropCbkFnType p0) { + LefDefParser::defrSetPinPropCbk((LefDefParser::defrPinPropCbkFnType) p0); +} + +void defrSetPinPropStartCbk (::defrIntegerCbkFnType p0) { + LefDefParser::defrSetPinPropStartCbk((LefDefParser::defrIntegerCbkFnType) p0); +} + +void defrSetPinPropEndCbk (::defrVoidCbkFnType p0) { + LefDefParser::defrSetPinPropEndCbk((LefDefParser::defrVoidCbkFnType) p0); +} + +void defrSetPropCbk (::defrPropCbkFnType p0) { + LefDefParser::defrSetPropCbk((LefDefParser::defrPropCbkFnType) p0); +} + +void defrSetPropDefEndCbk (::defrVoidCbkFnType p0) { + LefDefParser::defrSetPropDefEndCbk((LefDefParser::defrVoidCbkFnType) p0); +} + +void defrSetPropDefStartCbk (::defrVoidCbkFnType p0) { + LefDefParser::defrSetPropDefStartCbk((LefDefParser::defrVoidCbkFnType) p0); +} + +void defrSetRegionCbk (::defrRegionCbkFnType p0) { + LefDefParser::defrSetRegionCbk((LefDefParser::defrRegionCbkFnType) p0); +} + +void defrSetRegionStartCbk (::defrIntegerCbkFnType p0) { + LefDefParser::defrSetRegionStartCbk((LefDefParser::defrIntegerCbkFnType) p0); +} + +void defrSetRegionEndCbk (::defrVoidCbkFnType p0) { + LefDefParser::defrSetRegionEndCbk((LefDefParser::defrVoidCbkFnType) p0); +} + +void defrSetRowCbk (::defrRowCbkFnType p0) { + LefDefParser::defrSetRowCbk((LefDefParser::defrRowCbkFnType) p0); +} + +void defrSetSNetCbk (::defrNetCbkFnType p0) { + LefDefParser::defrSetSNetCbk((LefDefParser::defrNetCbkFnType) p0); +} + +void defrSetSNetStartCbk (::defrIntegerCbkFnType p0) { + LefDefParser::defrSetSNetStartCbk((LefDefParser::defrIntegerCbkFnType) p0); +} + +void defrSetSNetEndCbk (::defrVoidCbkFnType p0) { + LefDefParser::defrSetSNetEndCbk((LefDefParser::defrVoidCbkFnType) p0); +} + +void defrSetSNetPartialPathCbk (::defrNetCbkFnType p0) { + LefDefParser::defrSetSNetPartialPathCbk((LefDefParser::defrNetCbkFnType) p0); +} + +void defrSetSNetWireCbk (::defrNetCbkFnType p0) { + LefDefParser::defrSetSNetWireCbk((LefDefParser::defrNetCbkFnType) p0); +} + +void defrSetScanChainExtCbk (::defrStringCbkFnType p0) { + LefDefParser::defrSetScanChainExtCbk((LefDefParser::defrStringCbkFnType) p0); +} + +void defrSetScanchainCbk (::defrScanchainCbkFnType p0) { + LefDefParser::defrSetScanchainCbk((LefDefParser::defrScanchainCbkFnType) p0); +} + +void defrSetScanchainsStartCbk (::defrIntegerCbkFnType p0) { + LefDefParser::defrSetScanchainsStartCbk((LefDefParser::defrIntegerCbkFnType) p0); +} + +void defrSetScanchainsEndCbk (::defrVoidCbkFnType p0) { + LefDefParser::defrSetScanchainsEndCbk((LefDefParser::defrVoidCbkFnType) p0); +} + +void defrSetSiteCbk (::defrSiteCbkFnType p0) { + LefDefParser::defrSetSiteCbk((LefDefParser::defrSiteCbkFnType) p0); +} + +void defrSetSlotCbk (::defrSlotCbkFnType p0) { + LefDefParser::defrSetSlotCbk((LefDefParser::defrSlotCbkFnType) p0); +} + +void defrSetSlotStartCbk (::defrIntegerCbkFnType p0) { + LefDefParser::defrSetSlotStartCbk((LefDefParser::defrIntegerCbkFnType) p0); +} + +void defrSetSlotEndCbk (::defrVoidCbkFnType p0) { + LefDefParser::defrSetSlotEndCbk((LefDefParser::defrVoidCbkFnType) p0); +} + +void defrSetStartPinsCbk (::defrIntegerCbkFnType p0) { + LefDefParser::defrSetStartPinsCbk((LefDefParser::defrIntegerCbkFnType) p0); +} + +void defrSetStylesCbk (::defrStylesCbkFnType p0) { + LefDefParser::defrSetStylesCbk((LefDefParser::defrStylesCbkFnType) p0); +} + +void defrSetStylesStartCbk (::defrIntegerCbkFnType p0) { + LefDefParser::defrSetStylesStartCbk((LefDefParser::defrIntegerCbkFnType) p0); +} + +void defrSetStylesEndCbk (::defrVoidCbkFnType p0) { + LefDefParser::defrSetStylesEndCbk((LefDefParser::defrVoidCbkFnType) p0); +} + +void defrSetPinEndCbk (::defrVoidCbkFnType p0) { + LefDefParser::defrSetPinEndCbk((LefDefParser::defrVoidCbkFnType) p0); +} + +void defrSetTechnologyCbk (::defrStringCbkFnType p0) { + LefDefParser::defrSetTechnologyCbk((LefDefParser::defrStringCbkFnType) p0); +} + +void defrSetTimingDisableCbk (::defrTimingDisableCbkFnType p0) { + LefDefParser::defrSetTimingDisableCbk((LefDefParser::defrTimingDisableCbkFnType) p0); +} + +void defrSetTimingDisablesStartCbk (::defrIntegerCbkFnType p0) { + LefDefParser::defrSetTimingDisablesStartCbk((LefDefParser::defrIntegerCbkFnType) p0); +} + +void defrSetTimingDisablesEndCbk (::defrVoidCbkFnType p0) { + LefDefParser::defrSetTimingDisablesEndCbk((LefDefParser::defrVoidCbkFnType) p0); +} + +void defrSetTrackCbk (::defrTrackCbkFnType p0) { + LefDefParser::defrSetTrackCbk((LefDefParser::defrTrackCbkFnType) p0); +} + +void defrSetUnitsCbk (::defrDoubleCbkFnType p0) { + LefDefParser::defrSetUnitsCbk((LefDefParser::defrDoubleCbkFnType) p0); +} + +void defrSetVersionCbk (::defrDoubleCbkFnType p0) { + LefDefParser::defrSetVersionCbk((LefDefParser::defrDoubleCbkFnType) p0); +} + +void defrSetVersionStrCbk (::defrStringCbkFnType p0) { + LefDefParser::defrSetVersionStrCbk((LefDefParser::defrStringCbkFnType) p0); +} + +void defrSetViaCbk (::defrViaCbkFnType p0) { + LefDefParser::defrSetViaCbk((LefDefParser::defrViaCbkFnType) p0); +} + +void defrSetViaExtCbk (::defrStringCbkFnType p0) { + LefDefParser::defrSetViaExtCbk((LefDefParser::defrStringCbkFnType) p0); +} + +void defrSetViaStartCbk (::defrIntegerCbkFnType p0) { + LefDefParser::defrSetViaStartCbk((LefDefParser::defrIntegerCbkFnType) p0); +} + +void defrSetViaEndCbk (::defrVoidCbkFnType p0) { + LefDefParser::defrSetViaEndCbk((LefDefParser::defrVoidCbkFnType) p0); +} + +void defrUnsetCallbacks () { + LefDefParser::defrUnsetCallbacks(); +} + +void defrUnsetArrayNameCbk () { + LefDefParser::defrUnsetArrayNameCbk(); +} + +void defrUnsetAssertionCbk () { + LefDefParser::defrUnsetAssertionCbk(); +} + +void defrUnsetAssertionsStartCbk () { + LefDefParser::defrUnsetAssertionsStartCbk(); +} + +void defrUnsetAssertionsEndCbk () { + LefDefParser::defrUnsetAssertionsEndCbk(); +} + +void defrUnsetBlockageCbk () { + LefDefParser::defrUnsetBlockageCbk(); +} + +void defrUnsetBlockageStartCbk () { + LefDefParser::defrUnsetBlockageStartCbk(); +} + +void defrUnsetBlockageEndCbk () { + LefDefParser::defrUnsetBlockageEndCbk(); +} + +void defrUnsetBusBitCbk () { + LefDefParser::defrUnsetBusBitCbk(); +} + +void defrUnsetCannotOccupyCbk () { + LefDefParser::defrUnsetCannotOccupyCbk(); +} + +void defrUnsetCanplaceCbk () { + LefDefParser::defrUnsetCanplaceCbk(); +} + +void defrUnsetCaseSensitiveCbk () { + LefDefParser::defrUnsetCaseSensitiveCbk(); +} + +void defrUnsetComponentCbk () { + LefDefParser::defrUnsetComponentCbk(); +} + +void defrUnsetComponentExtCbk () { + LefDefParser::defrUnsetComponentExtCbk(); +} + +void defrUnsetComponentStartCbk () { + LefDefParser::defrUnsetComponentStartCbk(); +} + +void defrUnsetComponentEndCbk () { + LefDefParser::defrUnsetComponentEndCbk(); +} + +void defrUnsetConstraintCbk () { + LefDefParser::defrUnsetConstraintCbk(); +} + +void defrUnsetConstraintsStartCbk () { + LefDefParser::defrUnsetConstraintsStartCbk(); +} + +void defrUnsetConstraintsEndCbk () { + LefDefParser::defrUnsetConstraintsEndCbk(); +} + +void defrUnsetDefaultCapCbk () { + LefDefParser::defrUnsetDefaultCapCbk(); +} + +void defrUnsetDesignCbk () { + LefDefParser::defrUnsetDesignCbk(); +} + +void defrUnsetDesignEndCbk () { + LefDefParser::defrUnsetDesignEndCbk(); +} + +void defrUnsetDieAreaCbk () { + LefDefParser::defrUnsetDieAreaCbk(); +} + +void defrUnsetDividerCbk () { + LefDefParser::defrUnsetDividerCbk(); +} + +void defrUnsetExtensionCbk () { + LefDefParser::defrUnsetExtensionCbk(); +} + +void defrUnsetFillCbk () { + LefDefParser::defrUnsetFillCbk(); +} + +void defrUnsetFillStartCbk () { + LefDefParser::defrUnsetFillStartCbk(); +} + +void defrUnsetFillEndCbk () { + LefDefParser::defrUnsetFillEndCbk(); +} + +void defrUnsetFPCCbk () { + LefDefParser::defrUnsetFPCCbk(); +} + +void defrUnsetFPCStartCbk () { + LefDefParser::defrUnsetFPCStartCbk(); +} + +void defrUnsetFPCEndCbk () { + LefDefParser::defrUnsetFPCEndCbk(); +} + +void defrUnsetFloorPlanNameCbk () { + LefDefParser::defrUnsetFloorPlanNameCbk(); +} + +void defrUnsetGcellGridCbk () { + LefDefParser::defrUnsetGcellGridCbk(); +} + +void defrUnsetGroupCbk () { + LefDefParser::defrUnsetGroupCbk(); +} + +void defrUnsetGroupExtCbk () { + LefDefParser::defrUnsetGroupExtCbk(); +} + +void defrUnsetGroupMemberCbk () { + LefDefParser::defrUnsetGroupMemberCbk(); +} + +void defrUnsetComponentMaskShiftLayerCbk () { + LefDefParser::defrUnsetComponentMaskShiftLayerCbk(); +} + +void defrUnsetGroupNameCbk () { + LefDefParser::defrUnsetGroupNameCbk(); +} + +void defrUnsetGroupsStartCbk () { + LefDefParser::defrUnsetGroupsStartCbk(); +} + +void defrUnsetGroupsEndCbk () { + LefDefParser::defrUnsetGroupsEndCbk(); +} + +void defrUnsetHistoryCbk () { + LefDefParser::defrUnsetHistoryCbk(); +} + +void defrUnsetIOTimingCbk () { + LefDefParser::defrUnsetIOTimingCbk(); +} + +void defrUnsetIOTimingsStartCbk () { + LefDefParser::defrUnsetIOTimingsStartCbk(); +} + +void defrUnsetIOTimingsEndCbk () { + LefDefParser::defrUnsetIOTimingsEndCbk(); +} + +void defrUnsetIOTimingsExtCbk () { + LefDefParser::defrUnsetIOTimingsExtCbk(); +} + +void defrUnsetNetCbk () { + LefDefParser::defrUnsetNetCbk(); +} + +void defrUnsetNetNameCbk () { + LefDefParser::defrUnsetNetNameCbk(); +} + +void defrUnsetNetNonDefaultRuleCbk () { + LefDefParser::defrUnsetNetNonDefaultRuleCbk(); +} + +void defrUnsetNetConnectionExtCbk () { + LefDefParser::defrUnsetNetConnectionExtCbk(); +} + +void defrUnsetNetExtCbk () { + LefDefParser::defrUnsetNetExtCbk(); +} + +void defrUnsetNetPartialPathCbk () { + LefDefParser::defrUnsetNetPartialPathCbk(); +} + +void defrUnsetNetSubnetNameCbk () { + LefDefParser::defrUnsetNetSubnetNameCbk(); +} + +void defrUnsetNetStartCbk () { + LefDefParser::defrUnsetNetStartCbk(); +} + +void defrUnsetNetEndCbk () { + LefDefParser::defrUnsetNetEndCbk(); +} + +void defrUnsetNonDefaultCbk () { + LefDefParser::defrUnsetNonDefaultCbk(); +} + +void defrUnsetNonDefaultStartCbk () { + LefDefParser::defrUnsetNonDefaultStartCbk(); +} + +void defrUnsetNonDefaultEndCbk () { + LefDefParser::defrUnsetNonDefaultEndCbk(); +} + +void defrUnsetPartitionCbk () { + LefDefParser::defrUnsetPartitionCbk(); +} + +void defrUnsetPartitionsExtCbk () { + LefDefParser::defrUnsetPartitionsExtCbk(); +} + +void defrUnsetPartitionsStartCbk () { + LefDefParser::defrUnsetPartitionsStartCbk(); +} + +void defrUnsetPartitionsEndCbk () { + LefDefParser::defrUnsetPartitionsEndCbk(); +} + +void defrUnsetPathCbk () { + LefDefParser::defrUnsetPathCbk(); +} + +void defrUnsetPinCapCbk () { + LefDefParser::defrUnsetPinCapCbk(); +} + +void defrUnsetPinCbk () { + LefDefParser::defrUnsetPinCbk(); +} + +void defrUnsetPinEndCbk () { + LefDefParser::defrUnsetPinEndCbk(); +} + +void defrUnsetPinExtCbk () { + LefDefParser::defrUnsetPinExtCbk(); +} + +void defrUnsetPinPropCbk () { + LefDefParser::defrUnsetPinPropCbk(); +} + +void defrUnsetPinPropStartCbk () { + LefDefParser::defrUnsetPinPropStartCbk(); +} + +void defrUnsetPinPropEndCbk () { + LefDefParser::defrUnsetPinPropEndCbk(); +} + +void defrUnsetPropCbk () { + LefDefParser::defrUnsetPropCbk(); +} + +void defrUnsetPropDefEndCbk () { + LefDefParser::defrUnsetPropDefEndCbk(); +} + +void defrUnsetPropDefStartCbk () { + LefDefParser::defrUnsetPropDefStartCbk(); +} + +void defrUnsetRegionCbk () { + LefDefParser::defrUnsetRegionCbk(); +} + +void defrUnsetRegionStartCbk () { + LefDefParser::defrUnsetRegionStartCbk(); +} + +void defrUnsetRegionEndCbk () { + LefDefParser::defrUnsetRegionEndCbk(); +} + +void defrUnsetRowCbk () { + LefDefParser::defrUnsetRowCbk(); +} + +void defrUnsetScanChainExtCbk () { + LefDefParser::defrUnsetScanChainExtCbk(); +} + +void defrUnsetScanchainCbk () { + LefDefParser::defrUnsetScanchainCbk(); +} + +void defrUnsetScanchainsStartCbk () { + LefDefParser::defrUnsetScanchainsStartCbk(); +} + +void defrUnsetScanchainsEndCbk () { + LefDefParser::defrUnsetScanchainsEndCbk(); +} + +void defrUnsetSiteCbk () { + LefDefParser::defrUnsetSiteCbk(); +} + +void defrUnsetSlotCbk () { + LefDefParser::defrUnsetSlotCbk(); +} + +void defrUnsetSlotStartCbk () { + LefDefParser::defrUnsetSlotStartCbk(); +} + +void defrUnsetSlotEndCbk () { + LefDefParser::defrUnsetSlotEndCbk(); +} + +void defrUnsetSNetWireCbk () { + LefDefParser::defrUnsetSNetWireCbk(); +} + +void defrUnsetSNetCbk () { + LefDefParser::defrUnsetSNetCbk(); +} + +void defrUnsetSNetStartCbk () { + LefDefParser::defrUnsetSNetStartCbk(); +} + +void defrUnsetSNetEndCbk () { + LefDefParser::defrUnsetSNetEndCbk(); +} + +void defrUnsetSNetPartialPathCbk () { + LefDefParser::defrUnsetSNetPartialPathCbk(); +} + +void defrUnsetStartPinsCbk () { + LefDefParser::defrUnsetStartPinsCbk(); +} + +void defrUnsetStylesCbk () { + LefDefParser::defrUnsetStylesCbk(); +} + +void defrUnsetStylesStartCbk () { + LefDefParser::defrUnsetStylesStartCbk(); +} + +void defrUnsetStylesEndCbk () { + LefDefParser::defrUnsetStylesEndCbk(); +} + +void defrUnsetTechnologyCbk () { + LefDefParser::defrUnsetTechnologyCbk(); +} + +void defrUnsetTimingDisableCbk () { + LefDefParser::defrUnsetTimingDisableCbk(); +} + +void defrUnsetTimingDisablesStartCbk () { + LefDefParser::defrUnsetTimingDisablesStartCbk(); +} + +void defrUnsetTimingDisablesEndCbk () { + LefDefParser::defrUnsetTimingDisablesEndCbk(); +} + +void defrUnsetTrackCbk () { + LefDefParser::defrUnsetTrackCbk(); +} + +void defrUnsetUnitsCbk () { + LefDefParser::defrUnsetUnitsCbk(); +} + +void defrUnsetVersionCbk () { + LefDefParser::defrUnsetVersionCbk(); +} + +void defrUnsetVersionStrCbk () { + LefDefParser::defrUnsetVersionStrCbk(); +} + +void defrUnsetViaCbk () { + LefDefParser::defrUnsetViaCbk(); +} + +void defrUnsetViaExtCbk () { + LefDefParser::defrUnsetViaExtCbk(); +} + +void defrUnsetViaStartCbk () { + LefDefParser::defrUnsetViaStartCbk(); +} + +void defrUnsetViaEndCbk () { + LefDefParser::defrUnsetViaEndCbk(); +} + +void defrSetUnusedCallbacks (::defrVoidCbkFnType func) { + LefDefParser::defrSetUnusedCallbacks((LefDefParser::defrVoidCbkFnType ) func); +} + +int defrLineNumber () { + return LefDefParser::defrLineNumber(); +} + +long long defrLongLineNumber () { + return LefDefParser::defrLongLineNumber(); +} + +void defrSetLogFunction (::DEFI_LOG_FUNCTION p0) { + LefDefParser::defrSetLogFunction(p0); +} + +void defrSetWarningLogFunction (::DEFI_WARNING_LOG_FUNCTION p0) { + LefDefParser::defrSetWarningLogFunction(p0); +} + +void defrSetMallocFunction (::DEFI_MALLOC_FUNCTION p0) { + LefDefParser::defrSetMallocFunction(p0); +} + +void defrSetReallocFunction (::DEFI_REALLOC_FUNCTION p0) { + LefDefParser::defrSetReallocFunction(p0); +} + +void defrSetFreeFunction (::DEFI_FREE_FUNCTION p0) { + LefDefParser::defrSetFreeFunction(p0); +} + +void defrSetLineNumberFunction (::DEFI_LINE_NUMBER_FUNCTION p0) { + LefDefParser::defrSetLineNumberFunction(p0); +} + +void defrSetLongLineNumberFunction (::DEFI_LONG_LINE_NUMBER_FUNCTION p0) { + LefDefParser::defrSetLongLineNumberFunction(p0); +} + +void defrSetDeltaNumberLines (int p0) { + LefDefParser::defrSetDeltaNumberLines(p0); +} + +void defrSetReadFunction (::DEFI_READ_FUNCTION p0) { + LefDefParser::defrSetReadFunction(p0); +} + +void defrUnsetReadFunction () { + LefDefParser::defrUnsetReadFunction(); +} + +void defrSetOpenLogFileAppend () { + LefDefParser::defrSetOpenLogFileAppend(); +} + +void defrUnsetOpenLogFileAppend () { + LefDefParser::defrUnsetOpenLogFileAppend(); +} + +void defrSetMagicCommentFoundFunction (::DEFI_MAGIC_COMMENT_FOUND_FUNCTION p0) { + LefDefParser::defrSetMagicCommentFoundFunction(p0); +} + +void defrSetMagicCommentString (char * p0) { + LefDefParser::defrSetMagicCommentString(p0); +} + +void defrDisablePropStrProcess () { + LefDefParser::defrDisablePropStrProcess(); +} + +void defrSetNLines (long long n) { + LefDefParser::defrSetNLines(n); +} + +void defrSetAssertionWarnings (int warn) { + LefDefParser::defrSetAssertionWarnings(warn); +} + +void defrSetBlockageWarnings (int warn) { + LefDefParser::defrSetBlockageWarnings(warn); +} + +void defrSetCaseSensitiveWarnings (int warn) { + LefDefParser::defrSetCaseSensitiveWarnings(warn); +} + +void defrSetComponentWarnings (int warn) { + LefDefParser::defrSetComponentWarnings(warn); +} + +void defrSetConstraintWarnings (int warn) { + LefDefParser::defrSetConstraintWarnings(warn); +} + +void defrSetDefaultCapWarnings (int warn) { + LefDefParser::defrSetDefaultCapWarnings(warn); +} + +void defrSetGcellGridWarnings (int warn) { + LefDefParser::defrSetGcellGridWarnings(warn); +} + +void defrSetIOTimingWarnings (int warn) { + LefDefParser::defrSetIOTimingWarnings(warn); +} + +void defrSetNetWarnings (int warn) { + LefDefParser::defrSetNetWarnings(warn); +} + +void defrSetNonDefaultWarnings (int warn) { + LefDefParser::defrSetNonDefaultWarnings(warn); +} + +void defrSetPinExtWarnings (int warn) { + LefDefParser::defrSetPinExtWarnings(warn); +} + +void defrSetPinWarnings (int warn) { + LefDefParser::defrSetPinWarnings(warn); +} + +void defrSetRegionWarnings (int warn) { + LefDefParser::defrSetRegionWarnings(warn); +} + +void defrSetRowWarnings (int warn) { + LefDefParser::defrSetRowWarnings(warn); +} + +void defrSetScanchainWarnings (int warn) { + LefDefParser::defrSetScanchainWarnings(warn); +} + +void defrSetSNetWarnings (int warn) { + LefDefParser::defrSetSNetWarnings(warn); +} + +void defrSetStylesWarnings (int warn) { + LefDefParser::defrSetStylesWarnings(warn); +} + +void defrSetTrackWarnings (int warn) { + LefDefParser::defrSetTrackWarnings(warn); +} + +void defrSetUnitsWarnings (int warn) { + LefDefParser::defrSetUnitsWarnings(warn); +} + +void defrSetVersionWarnings (int warn) { + LefDefParser::defrSetVersionWarnings(warn); +} + +void defrSetViaWarnings (int warn) { + LefDefParser::defrSetViaWarnings(warn); +} + +void defrDisableParserMsgs (int nMsg, int* msgs) { + LefDefParser::defrDisableParserMsgs(nMsg, msgs); +} + +void defrEnableParserMsgs (int nMsg, int* msgs) { + LefDefParser::defrEnableParserMsgs(nMsg, msgs); +} + +void defrEnableAllMsgs () { + LefDefParser::defrEnableAllMsgs(); +} + +void defrSetTotalMsgLimit (int totNumMsgs) { + LefDefParser::defrSetTotalMsgLimit(totNumMsgs); +} + +void defrSetLimitPerMsg (int msgId, int numMsg) { + LefDefParser::defrSetLimitPerMsg(msgId, numMsg); +} + +void defrAddAlias (const char* key, const char* value, int marked) { + LefDefParser::defrAddAlias(key, value, marked); +} + diff --git a/src/def/cdef/xdefwWriter.cpp b/src/def/cdef/xdefwWriter.cpp new file mode 100644 index 00000000..c736a7e9 --- /dev/null +++ b/src/def/cdef/xdefwWriter.cpp @@ -0,0 +1,1115 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defwWriter.h" +#include "defwWriter.hpp" + +// Wrappers definitions. +int defwNewLine () { + return LefDefParser::defwNewLine(); +} + +int defwInit (FILE* f, int vers1, int version2, const char* caseSensitive, const char* dividerChar, const char* busBitChars, const char* designName, const char* technology, const char* array, const char* floorplan, double units) { + return LefDefParser::defwInit(f, vers1, version2, caseSensitive, dividerChar, busBitChars, designName, technology, array, floorplan, units); +} + +int defwInitCbk (FILE* f) { + return LefDefParser::defwInitCbk(f); +} + +int defwVersion (int vers1, int vers2) { + return LefDefParser::defwVersion(vers1, vers2); +} + +int defwCaseSensitive (const char* caseSensitive) { + return LefDefParser::defwCaseSensitive(caseSensitive); +} + +int defwBusBitChars (const char* busBitChars) { + return LefDefParser::defwBusBitChars(busBitChars); +} + +int defwDividerChar (const char* dividerChar) { + return LefDefParser::defwDividerChar(dividerChar); +} + +int defwDesignName (const char* name) { + return LefDefParser::defwDesignName(name); +} + +int defwTechnology (const char* technology) { + return LefDefParser::defwTechnology(technology); +} + +int defwArray (const char* array) { + return LefDefParser::defwArray(array); +} + +int defwFloorplan (const char* floorplan) { + return LefDefParser::defwFloorplan(floorplan); +} + +int defwUnits (int units) { + return LefDefParser::defwUnits(units); +} + +int defwHistory (const char* string) { + return LefDefParser::defwHistory(string); +} + +int defwStartPropDef () { + return LefDefParser::defwStartPropDef(); +} + +int defwIntPropDef (const char* objType, const char* propName, double leftRange, double rightRange, int propValue) { + return LefDefParser::defwIntPropDef(objType, propName, leftRange, rightRange, propValue); +} + +int defwRealPropDef (const char* objType, const char* propName, double leftRange, double rightRange, double propValue) { + return LefDefParser::defwRealPropDef(objType, propName, leftRange, rightRange, propValue); +} + +int defwStringPropDef (const char* objType, const char* propName, double leftRange, double rightRange, const char* propValue) { + return LefDefParser::defwStringPropDef(objType, propName, leftRange, rightRange, propValue); +} + +int defwEndPropDef () { + return LefDefParser::defwEndPropDef(); +} + +int defwStringProperty (const char* propName, const char* propValue) { + return LefDefParser::defwStringProperty(propName, propValue); +} + +int defwRealProperty (const char* propName, double propValue) { + return LefDefParser::defwRealProperty(propName, propValue); +} + +int defwIntProperty (const char* propName, int propValue) { + return LefDefParser::defwIntProperty(propName, propValue); +} + +int defwDieArea (int xl, int yl, int xh, int yh) { + return LefDefParser::defwDieArea(xl, yl, xh, yh); +} + +int defwDieAreaList (int num_points, int* xl, int* yh) { + return LefDefParser::defwDieAreaList(num_points, xl, yh); +} + +int defwRow (const char* rowName, const char* rowType, int x_orig, int y_orig, int orient, int do_count, int do_increment, int xstep, int ystep) { + return LefDefParser::defwRow(rowName, rowType, x_orig, y_orig, orient, do_count, do_increment, xstep, ystep); +} + +int defwRowStr (const char* rowName, const char* rowType, int x_orig, int y_orig, const char* orient, int do_count, int do_increment, int xstep, int ystep) { + return LefDefParser::defwRowStr(rowName, rowType, x_orig, y_orig, orient, do_count, do_increment, xstep, ystep); +} + +int defwTracks (const char* master, int doStart, int doCount, int doStep, int numLayers, const char** layers, int mask, int sameMask) { + return LefDefParser::defwTracks(master, doStart, doCount, doStep, numLayers, layers, mask, sameMask); +} + +int defwGcellGrid (const char* master, int doStart, int doCount, int doStep) { + return LefDefParser::defwGcellGrid(master, doStart, doCount, doStep); +} + +int defwStartDefaultCap (int count) { + return LefDefParser::defwStartDefaultCap(count); +} + +int defwDefaultCap (int pins, double cap) { + return LefDefParser::defwDefaultCap(pins, cap); +} + +int defwEndDefaultCap () { + return LefDefParser::defwEndDefaultCap(); +} + +int defwCanPlace (const char* master, int xOrig, int yOrig, int orient, int doCnt, int doInc, int xStep, int yStep) { + return LefDefParser::defwCanPlace(master, xOrig, yOrig, orient, doCnt, doInc, xStep, yStep); +} + +int defwCanPlaceStr (const char* master, int xOrig, int yOrig, const char* orient, int doCnt, int doInc, int xStep, int yStep) { + return LefDefParser::defwCanPlaceStr(master, xOrig, yOrig, orient, doCnt, doInc, xStep, yStep); +} + +int defwCannotOccupy (const char* master, int xOrig, int yOrig, int orient, int doCnt, int doInc, int xStep, int yStep) { + return LefDefParser::defwCannotOccupy(master, xOrig, yOrig, orient, doCnt, doInc, xStep, yStep); +} + +int defwCannotOccupyStr (const char* master, int xOrig, int yOrig, const char* orient, int doCnt, int doInc, int xStep, int yStep) { + return LefDefParser::defwCannotOccupyStr(master, xOrig, yOrig, orient, doCnt, doInc, xStep, yStep); +} + +int defwStartVias (int count) { + return LefDefParser::defwStartVias(count); +} + +int defwViaName (const char* name) { + return LefDefParser::defwViaName(name); +} + +int defwViaPattern (const char* patternName) { + return LefDefParser::defwViaPattern(patternName); +} + +int defwViaRect (const char* layerName, int xl, int yl, int xh, int yh, int mask) { + return LefDefParser::defwViaRect(layerName, xl, yl, xh, yh, mask); +} + +int defwViaPolygon (const char* layerName, int num_polys, double* xl, double* yl, int mask) { + return LefDefParser::defwViaPolygon(layerName, num_polys, xl, yl, mask); +} + +int defwViaViarule (const char* viaRuleName, double xCutSize, double yCutSize, const char* botMetalLayer, const char* cutLayer, const char* topMetalLayer, double xCutSpacing, double yCutSpacing, double xBotEnc, double yBotEnc, double xTopEnc, double yTopEnc) { + return LefDefParser::defwViaViarule(viaRuleName, xCutSize, yCutSize, botMetalLayer, cutLayer, topMetalLayer, xCutSpacing, yCutSpacing, xBotEnc, yBotEnc, xTopEnc, yTopEnc); +} + +int defwViaViaruleRowCol (int numCutRows, int numCutCols) { + return LefDefParser::defwViaViaruleRowCol(numCutRows, numCutCols); +} + +int defwViaViaruleOrigin (int xOffset, int yOffset) { + return LefDefParser::defwViaViaruleOrigin(xOffset, yOffset); +} + +int defwViaViaruleOffset (int xBotOffset, int yBotOffset, int xTopOffset, int yTopOffset) { + return LefDefParser::defwViaViaruleOffset(xBotOffset, yBotOffset, xTopOffset, yTopOffset); +} + +int defwViaViarulePattern (const char* cutPattern) { + return LefDefParser::defwViaViarulePattern(cutPattern); +} + +int defwOneViaEnd () { + return LefDefParser::defwOneViaEnd(); +} + +int defwEndVias () { + return LefDefParser::defwEndVias(); +} + +int defwStartRegions (int count) { + return LefDefParser::defwStartRegions(count); +} + +int defwRegionName (const char* name) { + return LefDefParser::defwRegionName(name); +} + +int defwRegionPoints (int xl, int yl, int xh, int yh) { + return LefDefParser::defwRegionPoints(xl, yl, xh, yh); +} + +int defwRegionType (const char* type) { + return LefDefParser::defwRegionType(type); +} + +int defwEndRegions () { + return LefDefParser::defwEndRegions(); +} + +int defwComponentMaskShiftLayers (const char** layerNames, int numLayerName) { + return LefDefParser::defwComponentMaskShiftLayers(layerNames, numLayerName); +} + +int defwStartComponents (int count) { + return LefDefParser::defwStartComponents(count); +} + +int defwComponent (const char* instance, const char* master, int numNetName, const char** netNames, const char* eeq, const char* genName, const char* genParemeters, const char* source, int numForeign, const char** foreigns, int* foreignX, int* foreignY, int* foreignOrients, const char* status, int statusX, int statusY, int statusOrient, double weight, const char* region, int xl, int yl, int xh, int yh) { + return LefDefParser::defwComponent(instance, master, numNetName, netNames, eeq, genName, genParemeters, source, numForeign, foreigns, foreignX, foreignY, foreignOrients, status, statusX, statusY, statusOrient, weight, region, xl, yl, xh, yh); +} + +int defwComponentStr (const char* instance, const char* master, int numNetName, const char** netNames, const char* eeq, const char* genName, const char* genParemeters, const char* source, int numForeign, const char** foreigns, int* foreignX, int* foreignY, const char** foreignOrients, const char* status, int statusX, int statusY, const char* statusOrient, double weight, const char* region, int xl, int yl, int xh, int yh) { + return LefDefParser::defwComponentStr(instance, master, numNetName, netNames, eeq, genName, genParemeters, source, numForeign, foreigns, foreignX, foreignY, foreignOrients, status, statusX, statusY, statusOrient, weight, region, xl, yl, xh, yh); +} + +int defwComponentMaskShift (int shiftLayerMasks) { + return LefDefParser::defwComponentMaskShift(shiftLayerMasks); +} + +int defwComponentHalo (int left, int bottom, int right, int top) { + return LefDefParser::defwComponentHalo(left, bottom, right, top); +} + +int defwComponentHaloSoft (int left, int bottom, int right, int top) { + return LefDefParser::defwComponentHaloSoft(left, bottom, right, top); +} + +int defwComponentRouteHalo (int haloDist, const char* minLayer, const char* maxLayer) { + return LefDefParser::defwComponentRouteHalo(haloDist, minLayer, maxLayer); +} + +int defwEndComponents () { + return LefDefParser::defwEndComponents(); +} + +int defwStartPins (int count) { + return LefDefParser::defwStartPins(count); +} + +int defwPin (const char* name, const char* net, int special, const char* direction, const char* use, const char* status, int statusX, int statusY, int orient, const char* layer, int xl, int yl, int xh, int yh) { + return LefDefParser::defwPin(name, net, special, direction, use, status, statusX, statusY, orient, layer, xl, yl, xh, yh); +} + +int defwPinStr (const char* name, const char* net, int special, const char* direction, const char* use, const char* status, int statusX, int statusY, const char* orient, const char* layer, int xl, int yl, int xh, int yh) { + return LefDefParser::defwPinStr(name, net, special, direction, use, status, statusX, statusY, orient, layer, xl, yl, xh, yh); +} + +int defwPinLayer (const char* layerName, int spacing, int designRuleWidth, int xl, int yl, int xh, int yh, int mask) { + return LefDefParser::defwPinLayer(layerName, spacing, designRuleWidth, xl, yl, xh, yh, mask); +} + +int defwPinPolygon (const char* layerName, int spacing, int designRuleWidth, int num_polys, double* xl, double* yl, int mask) { + return LefDefParser::defwPinPolygon(layerName, spacing, designRuleWidth, num_polys, xl, yl, mask); +} + +int defwPinVia (const char* viaName, int xl, int yl, int mask) { + return LefDefParser::defwPinVia(viaName, xl, yl, mask); +} + +int defwPinPort () { + return LefDefParser::defwPinPort(); +} + +int defwPinPortLayer (const char* layerName, int spacing, int designRuleWidth, int xl, int yl, int xh, int yh, int mask) { + return LefDefParser::defwPinPortLayer(layerName, spacing, designRuleWidth, xl, yl, xh, yh, mask); +} + +int defwPinPortPolygon (const char* layerName, int spacing, int designRuleWidth, int num_polys, double* xl, double* yl, int mask) { + return LefDefParser::defwPinPortPolygon(layerName, spacing, designRuleWidth, num_polys, xl, yl, mask); +} + +int defwPinPortVia (const char* viaName, int xl, int yl, int mask) { + return LefDefParser::defwPinPortVia(viaName, xl, yl, mask); +} + +int defwPinPortLocation (const char* status, int statusX, int statusY, const char* orient) { + return LefDefParser::defwPinPortLocation(status, statusX, statusY, orient); +} + +int defwPinNetExpr (const char* pinExpr) { + return LefDefParser::defwPinNetExpr(pinExpr); +} + +int defwPinSupplySensitivity (const char* pinName) { + return LefDefParser::defwPinSupplySensitivity(pinName); +} + +int defwPinGroundSensitivity (const char* pinName) { + return LefDefParser::defwPinGroundSensitivity(pinName); +} + +int defwPinAntennaPinPartialMetalArea (int value, const char* layerName) { + return LefDefParser::defwPinAntennaPinPartialMetalArea(value, layerName); +} + +int defwPinAntennaPinPartialMetalSideArea (int value, const char* layerName) { + return LefDefParser::defwPinAntennaPinPartialMetalSideArea(value, layerName); +} + +int defwPinAntennaPinPartialCutArea (int value, const char* layerName) { + return LefDefParser::defwPinAntennaPinPartialCutArea(value, layerName); +} + +int defwPinAntennaPinDiffArea (int value, const char* layerName) { + return LefDefParser::defwPinAntennaPinDiffArea(value, layerName); +} + +int defwPinAntennaModel (const char* oxide) { + return LefDefParser::defwPinAntennaModel(oxide); +} + +int defwPinAntennaPinGateArea (int value, const char* layerName) { + return LefDefParser::defwPinAntennaPinGateArea(value, layerName); +} + +int defwPinAntennaPinMaxAreaCar (int value, const char* layerName) { + return LefDefParser::defwPinAntennaPinMaxAreaCar(value, layerName); +} + +int defwPinAntennaPinMaxSideAreaCar (int value, const char* layerName) { + return LefDefParser::defwPinAntennaPinMaxSideAreaCar(value, layerName); +} + +int defwPinAntennaPinMaxCutCar (int value, const char* layerName) { + return LefDefParser::defwPinAntennaPinMaxCutCar(value, layerName); +} + +int defwEndPins () { + return LefDefParser::defwEndPins(); +} + +int defwStartPinProperties (int count) { + return LefDefParser::defwStartPinProperties(count); +} + +int defwPinProperty (const char* name, const char* pinName) { + return LefDefParser::defwPinProperty(name, pinName); +} + +int defwEndPinProperties () { + return LefDefParser::defwEndPinProperties(); +} + +int defwStartSpecialNets (int count) { + return LefDefParser::defwStartSpecialNets(count); +} + +int defwSpecialNet (const char* name) { + return LefDefParser::defwSpecialNet(name); +} + +int defwSpecialNetConnection (const char* inst, const char* pin, int synthesized) { + return LefDefParser::defwSpecialNetConnection(inst, pin, synthesized); +} + +int defwSpecialNetFixedbump () { + return LefDefParser::defwSpecialNetFixedbump(); +} + +int defwSpecialNetVoltage (double v) { + return LefDefParser::defwSpecialNetVoltage(v); +} + +int defwSpecialNetSpacing (const char* layer, int spacing, double minwidth, double maxwidth) { + return LefDefParser::defwSpecialNetSpacing(layer, spacing, minwidth, maxwidth); +} + +int defwSpecialNetWidth (const char* layer, int width) { + return LefDefParser::defwSpecialNetWidth(layer, width); +} + +int defwSpecialNetSource (const char* name) { + return LefDefParser::defwSpecialNetSource(name); +} + +int defwSpecialNetOriginal (const char* name) { + return LefDefParser::defwSpecialNetOriginal(name); +} + +int defwSpecialNetPattern (const char* name) { + return LefDefParser::defwSpecialNetPattern(name); +} + +int defwSpecialNetUse (const char* name) { + return LefDefParser::defwSpecialNetUse(name); +} + +int defwSpecialNetWeight (double value) { + return LefDefParser::defwSpecialNetWeight(value); +} + +int defwSpecialNetEstCap (double value) { + return LefDefParser::defwSpecialNetEstCap(value); +} + +int defwSpecialNetPathStart (const char* typ) { + return LefDefParser::defwSpecialNetPathStart(typ); +} + +int defwSpecialNetShieldNetName (const char* name) { + return LefDefParser::defwSpecialNetShieldNetName(name); +} + +int defwSpecialNetPathLayer (const char* name) { + return LefDefParser::defwSpecialNetPathLayer(name); +} + +int defwSpecialNetPathWidth (int width) { + return LefDefParser::defwSpecialNetPathWidth(width); +} + +int defwSpecialNetPathStyle (int styleNum) { + return LefDefParser::defwSpecialNetPathStyle(styleNum); +} + +int defwSpecialNetPathShape (const char* shapeType) { + return LefDefParser::defwSpecialNetPathShape(shapeType); +} + +int defwSpecialNetPathMask (int colorMask) { + return LefDefParser::defwSpecialNetPathMask(colorMask); +} + +int defwSpecialNetPathPoint (int numPts, double* pointx, double* pointy) { + return LefDefParser::defwSpecialNetPathPoint(numPts, pointx, pointy); +} + +int defwSpecialNetPathVia (const char* name) { + return LefDefParser::defwSpecialNetPathVia(name); +} + +int defwSpecialNetPathViaData (int numX, int numY, int stepX, int stepY) { + return LefDefParser::defwSpecialNetPathViaData(numX, numY, stepX, stepY); +} + +int defwSpecialNetPathPointWithWireExt (int numPts, double* pointx, double* pointy, double* optValue) { + return LefDefParser::defwSpecialNetPathPointWithWireExt(numPts, pointx, pointy, optValue); +} + +int defwSpecialNetPathEnd () { + return LefDefParser::defwSpecialNetPathEnd(); +} + +int defwSpecialNetPolygon (const char* layerName, int num_polys, double* xl, double* yl) { + return LefDefParser::defwSpecialNetPolygon(layerName, num_polys, xl, yl); +} + +int defwSpecialNetRect (const char* layerName, int xl, int yl, int xh, int yh) { + return LefDefParser::defwSpecialNetRect(layerName, xl, yl, xh, yh); +} + +int defwSpecialNetVia (const char* layerName) { + return LefDefParser::defwSpecialNetVia(layerName); +} + +int defwSpecialNetViaWithOrient (const char* layerName, int orient) { + return LefDefParser::defwSpecialNetViaWithOrient(layerName, orient); +} + +int defwSpecialNetViaPoints (int num_points, double* xl, double* yl) { + return LefDefParser::defwSpecialNetViaPoints(num_points, xl, yl); +} + +int defwSpecialNetEndOneNet () { + return LefDefParser::defwSpecialNetEndOneNet(); +} + +int defwSpecialNetShieldStart (const char* name) { + return LefDefParser::defwSpecialNetShieldStart(name); +} + +int defwSpecialNetShieldLayer (const char* name) { + return LefDefParser::defwSpecialNetShieldLayer(name); +} + +int defwSpecialNetShieldWidth (int width) { + return LefDefParser::defwSpecialNetShieldWidth(width); +} + +int defwSpecialNetShieldShape (const char* shapeType) { + return LefDefParser::defwSpecialNetShieldShape(shapeType); +} + +int defwSpecialNetShieldPoint (int numPts, double* pointx, double* pointy) { + return LefDefParser::defwSpecialNetShieldPoint(numPts, pointx, pointy); +} + +int defwSpecialNetShieldVia (const char* name) { + return LefDefParser::defwSpecialNetShieldVia(name); +} + +int defwSpecialNetShieldViaData (int numX, int numY, int stepX, int stepY) { + return LefDefParser::defwSpecialNetShieldViaData(numX, numY, stepX, stepY); +} + +int defwSpecialNetShieldEnd () { + return LefDefParser::defwSpecialNetShieldEnd(); +} + +int defwEndSpecialNets () { + return LefDefParser::defwEndSpecialNets(); +} + +int defwStartNets (int count) { + return LefDefParser::defwStartNets(count); +} + +int defwNet (const char* name) { + return LefDefParser::defwNet(name); +} + +int defwNetConnection (const char* inst, const char* pin, int synthesized) { + return LefDefParser::defwNetConnection(inst, pin, synthesized); +} + +int defwNetMustjoinConnection (const char* inst, const char* pin) { + return LefDefParser::defwNetMustjoinConnection(inst, pin); +} + +int defwNetVpin (const char* vpinName, const char* layerName, int layerXl, int layerYl, int layerXh, int layerYh, const char* status, int statusX, int statusY, int orient) { + return LefDefParser::defwNetVpin(vpinName, layerName, layerXl, layerYl, layerXh, layerYh, status, statusX, statusY, orient); +} + +int defwNetVpinStr (const char* vpinName, const char* layerName, int layerXl, int layerYl, int layerXh, int layerYh, const char* status, int statusX, int statusY, const char* orient) { + return LefDefParser::defwNetVpinStr(vpinName, layerName, layerXl, layerYl, layerXh, layerYh, status, statusX, statusY, orient); +} + +int defwNetNondefaultRule (const char* name) { + return LefDefParser::defwNetNondefaultRule(name); +} + +int defwNetXtalk (int xtalk) { + return LefDefParser::defwNetXtalk(xtalk); +} + +int defwNetFixedbump () { + return LefDefParser::defwNetFixedbump(); +} + +int defwNetFrequency (double frequency) { + return LefDefParser::defwNetFrequency(frequency); +} + +int defwNetSource (const char* name) { + return LefDefParser::defwNetSource(name); +} + +int defwNetOriginal (const char* name) { + return LefDefParser::defwNetOriginal(name); +} + +int defwNetUse (const char* name) { + return LefDefParser::defwNetUse(name); +} + +int defwNetPattern (const char* name) { + return LefDefParser::defwNetPattern(name); +} + +int defwNetEstCap (double value) { + return LefDefParser::defwNetEstCap(value); +} + +int defwNetWeight (double value) { + return LefDefParser::defwNetWeight(value); +} + +int defwNetShieldnet (const char* name) { + return LefDefParser::defwNetShieldnet(name); +} + +int defwNetNoshieldStart (const char* name) { + return LefDefParser::defwNetNoshieldStart(name); +} + +int defwNetNoshieldPoint (int numPts, const char** pointx, const char** pointy) { + return LefDefParser::defwNetNoshieldPoint(numPts, pointx, pointy); +} + +int defwNetNoshieldVia (const char* name) { + return LefDefParser::defwNetNoshieldVia(name); +} + +int defwNetNoshieldEnd () { + return LefDefParser::defwNetNoshieldEnd(); +} + +int defwNetSubnetStart (const char* name) { + return LefDefParser::defwNetSubnetStart(name); +} + +int defwNetSubnetPin (const char* compName, const char* pinName) { + return LefDefParser::defwNetSubnetPin(compName, pinName); +} + +int defwNetSubnetEnd () { + return LefDefParser::defwNetSubnetEnd(); +} + +int defwNetPathStart (const char* typ) { + return LefDefParser::defwNetPathStart(typ); +} + +int defwNetPathWidth (int w) { + return LefDefParser::defwNetPathWidth(w); +} + +int defwNetPathLayer (const char* name, int isTaper, const char* rulename) { + return LefDefParser::defwNetPathLayer(name, isTaper, rulename); +} + +int defwNetPathStyle (int styleNum) { + return LefDefParser::defwNetPathStyle(styleNum); +} + +int defwNetPathMask (int maskNum) { + return LefDefParser::defwNetPathMask(maskNum); +} + +int defwNetPathRect (int deltaX1, int deltaY1, int deltaX2, int deltaY2) { + return LefDefParser::defwNetPathRect(deltaX1, deltaY1, deltaX2, deltaY2); +} + +int defwNetPathVirtual (int x, int y) { + return LefDefParser::defwNetPathVirtual(x, y); +} + +int defwNetPathPoint (int numPts, double* pointx, double* pointy) { + return LefDefParser::defwNetPathPoint(numPts, pointx, pointy); +} + +int defwNetPathPointWithExt (int numPts, double* pointx, double* pointy, double* optValue) { + return LefDefParser::defwNetPathPointWithExt(numPts, pointx, pointy, optValue); +} + +int defwNetPathVia (const char* name) { + return LefDefParser::defwNetPathVia(name); +} + +int defwNetPathViaWithOrient (const char* name, int orient) { + return LefDefParser::defwNetPathViaWithOrient(name, orient); +} + +int defwNetPathViaWithOrientStr (const char* name, const char* orient) { + return LefDefParser::defwNetPathViaWithOrientStr(name, orient); +} + +int defwNetPathEnd () { + return LefDefParser::defwNetPathEnd(); +} + +int defwNetEndOneNet () { + return LefDefParser::defwNetEndOneNet(); +} + +int defwEndNets () { + return LefDefParser::defwEndNets(); +} + +int defwStartIOTimings (int count) { + return LefDefParser::defwStartIOTimings(count); +} + +int defwIOTiming (const char* inst, const char* pin) { + return LefDefParser::defwIOTiming(inst, pin); +} + +int defwIOTimingVariable (const char* riseFall, int num1, int num2) { + return LefDefParser::defwIOTimingVariable(riseFall, num1, num2); +} + +int defwIOTimingSlewrate (const char* riseFall, int num1, int num2) { + return LefDefParser::defwIOTimingSlewrate(riseFall, num1, num2); +} + +int defwIOTimingDrivecell (const char* name, const char* fromPin, const char* toPin, int numDrivers) { + return LefDefParser::defwIOTimingDrivecell(name, fromPin, toPin, numDrivers); +} + +int defwIOTimingCapacitance (double num) { + return LefDefParser::defwIOTimingCapacitance(num); +} + +int defwEndIOTimings () { + return LefDefParser::defwEndIOTimings(); +} + +int defwStartScanchains (int count) { + return LefDefParser::defwStartScanchains(count); +} + +int defwScanchain (const char* name) { + return LefDefParser::defwScanchain(name); +} + +int defwScanchainCommonscanpins (const char* inst1, const char* pin1, const char* inst2, const char* pin2) { + return LefDefParser::defwScanchainCommonscanpins(inst1, pin1, inst2, pin2); +} + +int defwScanchainPartition (const char* name, int maxBits) { + return LefDefParser::defwScanchainPartition(name, maxBits); +} + +int defwScanchainStart (const char* inst, const char* pin) { + return LefDefParser::defwScanchainStart(inst, pin); +} + +int defwScanchainStop (const char* inst, const char* pin) { + return LefDefParser::defwScanchainStop(inst, pin); +} + +int defwScanchainFloating (const char* name, const char* inst1, const char* pin1, const char* inst2, const char* pin2) { + return LefDefParser::defwScanchainFloating(name, inst1, pin1, inst2, pin2); +} + +int defwScanchainFloatingBits (const char* name, const char* inst1, const char* pin1, const char* inst2, const char* pin2, int bits) { + return LefDefParser::defwScanchainFloatingBits(name, inst1, pin1, inst2, pin2, bits); +} + +int defwScanchainOrdered (const char* name1, const char* inst1, const char* pin1, const char* inst2, const char* pin2, const char* name2, const char* inst3, const char* pin3, const char* inst4, const char* pin4) { + return LefDefParser::defwScanchainOrdered(name1, inst1, pin1, inst2, pin2, name2, inst3, pin3, inst4, pin4); +} + +int defwScanchainOrderedBits (const char* name1, const char* inst1, const char* pin1, const char* inst2, const char* pin2, int bits1, const char* name2, const char* inst3, const char* pin3, const char* inst4, const char* pin4, int bits2) { + return LefDefParser::defwScanchainOrderedBits(name1, inst1, pin1, inst2, pin2, bits1, name2, inst3, pin3, inst4, pin4, bits2); +} + +int defwEndScanchain () { + return LefDefParser::defwEndScanchain(); +} + +int defwStartConstraints (int count) { + return LefDefParser::defwStartConstraints(count); +} + +int defwConstraintOperand () { + return LefDefParser::defwConstraintOperand(); +} + +int defwConstraintOperandNet (const char* netName) { + return LefDefParser::defwConstraintOperandNet(netName); +} + +int defwConstraintOperandPath (const char* comp1, const char* fromPin, const char* comp2, const char* toPin) { + return LefDefParser::defwConstraintOperandPath(comp1, fromPin, comp2, toPin); +} + +int defwConstraintOperandSum () { + return LefDefParser::defwConstraintOperandSum(); +} + +int defwConstraintOperandSumEnd () { + return LefDefParser::defwConstraintOperandSumEnd(); +} + +int defwConstraintOperandTime (const char* timeType, int time) { + return LefDefParser::defwConstraintOperandTime(timeType, time); +} + +int defwConstraintOperandEnd () { + return LefDefParser::defwConstraintOperandEnd(); +} + +int defwConstraintWiredlogic (const char* netName, int distance) { + return LefDefParser::defwConstraintWiredlogic(netName, distance); +} + +int defwEndConstraints () { + return LefDefParser::defwEndConstraints(); +} + +int defwStartGroups (int count) { + return LefDefParser::defwStartGroups(count); +} + +int defwGroup (const char* groupName, int numExpr, const char** groupExpr) { + return LefDefParser::defwGroup(groupName, numExpr, groupExpr); +} + +int defwGroupSoft (const char* type1, double value1, const char* type2, double value2, const char* type3, double value3) { + return LefDefParser::defwGroupSoft(type1, value1, type2, value2, type3, value3); +} + +int defwGroupRegion (int xl, int yl, int xh, int yh, const char* regionName) { + return LefDefParser::defwGroupRegion(xl, yl, xh, yh, regionName); +} + +int defwEndGroups () { + return LefDefParser::defwEndGroups(); +} + +int defwStartBlockages (int count) { + return LefDefParser::defwStartBlockages(count); +} + +int defwBlockagesLayer (const char* layerName) { + return LefDefParser::defwBlockagesLayer(layerName); +} + +int defwBlockagesLayerSlots () { + return LefDefParser::defwBlockagesLayerSlots(); +} + +int defwBlockagesLayerFills () { + return LefDefParser::defwBlockagesLayerFills(); +} + +int defwBlockagesLayerPushdown () { + return LefDefParser::defwBlockagesLayerPushdown(); +} + +int defwBlockagesLayerExceptpgnet () { + return LefDefParser::defwBlockagesLayerExceptpgnet(); +} + +int defwBlockagesLayerComponent (const char* compName) { + return LefDefParser::defwBlockagesLayerComponent(compName); +} + +int defwBlockagesLayerSpacing (int minSpacing) { + return LefDefParser::defwBlockagesLayerSpacing(minSpacing); +} + +int defwBlockagesLayerDesignRuleWidth (int effectiveWidth) { + return LefDefParser::defwBlockagesLayerDesignRuleWidth(effectiveWidth); +} + +int defwBlockagesLayerMask (int maskColor) { + return LefDefParser::defwBlockagesLayerMask(maskColor); +} + +int defwBlockageLayer (const char* layerName, const char* compName) { + return LefDefParser::defwBlockageLayer(layerName, compName); +} + +int defwBlockageLayerSlots (const char* layerName) { + return LefDefParser::defwBlockageLayerSlots(layerName); +} + +int defwBlockageLayerFills (const char* layerName) { + return LefDefParser::defwBlockageLayerFills(layerName); +} + +int defwBlockageLayerPushdown (const char* layerName) { + return LefDefParser::defwBlockageLayerPushdown(layerName); +} + +int defwBlockageLayerExceptpgnet (const char* layerName) { + return LefDefParser::defwBlockageLayerExceptpgnet(layerName); +} + +int defwBlockageSpacing (int minSpacing) { + return LefDefParser::defwBlockageSpacing(minSpacing); +} + +int defwBlockageDesignRuleWidth (int effectiveWidth) { + return LefDefParser::defwBlockageDesignRuleWidth(effectiveWidth); +} + +int defwBlockagesPlacement () { + return LefDefParser::defwBlockagesPlacement(); +} + +int defwBlockagesPlacementComponent (const char* compName) { + return LefDefParser::defwBlockagesPlacementComponent(compName); +} + +int defwBlockagesPlacementPushdown () { + return LefDefParser::defwBlockagesPlacementPushdown(); +} + +int defwBlockagesPlacementSoft () { + return LefDefParser::defwBlockagesPlacementSoft(); +} + +int defwBlockagesPlacementPartial (double maxDensity) { + return LefDefParser::defwBlockagesPlacementPartial(maxDensity); +} + +int defwBlockagesRect (int xl, int yl, int xh, int yh) { + return LefDefParser::defwBlockagesRect(xl, yl, xh, yh); +} + +int defwBlockagesPolygon (int num_polys, int* xl, int* yl) { + return LefDefParser::defwBlockagesPolygon(num_polys, xl, yl); +} + +int defwBlockagePlacement () { + return LefDefParser::defwBlockagePlacement(); +} + +int defwBlockagePlacementComponent (const char* compName) { + return LefDefParser::defwBlockagePlacementComponent(compName); +} + +int defwBlockagePlacementPushdown () { + return LefDefParser::defwBlockagePlacementPushdown(); +} + +int defwBlockagePlacementSoft () { + return LefDefParser::defwBlockagePlacementSoft(); +} + +int defwBlockagePlacementPartial (double maxDensity) { + return LefDefParser::defwBlockagePlacementPartial(maxDensity); +} + +int defwBlockageMask (int maskColor) { + return LefDefParser::defwBlockageMask(maskColor); +} + +int defwBlockageRect (int xl, int yl, int xh, int yh) { + return LefDefParser::defwBlockageRect(xl, yl, xh, yh); +} + +int defwBlockagePolygon (int num_polys, int* xl, int* yl) { + return LefDefParser::defwBlockagePolygon(num_polys, xl, yl); +} + +int defwEndBlockages () { + return LefDefParser::defwEndBlockages(); +} + +int defwStartSlots (int count) { + return LefDefParser::defwStartSlots(count); +} + +int defwSlotLayer (const char* layerName) { + return LefDefParser::defwSlotLayer(layerName); +} + +int defwSlotRect (int xl, int yl, int xh, int yh) { + return LefDefParser::defwSlotRect(xl, yl, xh, yh); +} + +int defwSlotPolygon (int num_polys, double* xl, double* yl) { + return LefDefParser::defwSlotPolygon(num_polys, xl, yl); +} + +int defwEndSlots () { + return LefDefParser::defwEndSlots(); +} + +int defwStartFills (int count) { + return LefDefParser::defwStartFills(count); +} + +int defwFillLayer (const char* layerName) { + return LefDefParser::defwFillLayer(layerName); +} + +int defwFillLayerMask (int maskColor) { + return LefDefParser::defwFillLayerMask(maskColor); +} + +int defwFillLayerOPC () { + return LefDefParser::defwFillLayerOPC(); +} + +int defwFillRect (int xl, int yl, int xh, int yh) { + return LefDefParser::defwFillRect(xl, yl, xh, yh); +} + +int defwFillPolygon (int num_polys, double* xl, double* yl) { + return LefDefParser::defwFillPolygon(num_polys, xl, yl); +} + +int defwFillVia (const char* viaName) { + return LefDefParser::defwFillVia(viaName); +} + +int defwFillViaMask (int colorMask) { + return LefDefParser::defwFillViaMask(colorMask); +} + +int defwFillViaOPC () { + return LefDefParser::defwFillViaOPC(); +} + +int defwFillPoints (int num_points, double* xl, double* yl) { + return LefDefParser::defwFillPoints(num_points, xl, yl); +} + +int defwEndFills () { + return LefDefParser::defwEndFills(); +} + +int defwStartNonDefaultRules (int count) { + return LefDefParser::defwStartNonDefaultRules(count); +} + +int defwNonDefaultRule (const char* ruleName, int hardSpacing) { + return LefDefParser::defwNonDefaultRule(ruleName, hardSpacing); +} + +int defwNonDefaultRuleLayer (const char* layerName, int width, int diagWidth, int spacing, int wireExt) { + return LefDefParser::defwNonDefaultRuleLayer(layerName, width, diagWidth, spacing, wireExt); +} + +int defwNonDefaultRuleVia (const char* viaName) { + return LefDefParser::defwNonDefaultRuleVia(viaName); +} + +int defwNonDefaultRuleViaRule (const char* viaRuleName) { + return LefDefParser::defwNonDefaultRuleViaRule(viaRuleName); +} + +int defwNonDefaultRuleMinCuts (const char* cutLayerName, int numCutS) { + return LefDefParser::defwNonDefaultRuleMinCuts(cutLayerName, numCutS); +} + +int defwEndNonDefaultRules () { + return LefDefParser::defwEndNonDefaultRules(); +} + +int defwStartStyles (int count) { + return LefDefParser::defwStartStyles(count); +} + +int defwStyles (int styleNums, int num_points, double* xp, double* yp) { + return LefDefParser::defwStyles(styleNums, num_points, xp, yp); +} + +int defwEndStyles () { + return LefDefParser::defwEndStyles(); +} + +int defwStartBeginext (const char* name) { + return LefDefParser::defwStartBeginext(name); +} + +int defwBeginextCreator (const char* creatorName) { + return LefDefParser::defwBeginextCreator(creatorName); +} + +int defwBeginextDate () { + return LefDefParser::defwBeginextDate(); +} + +int defwBeginextRevision (int vers1, int vers2) { + return LefDefParser::defwBeginextRevision(vers1, vers2); +} + +int defwBeginextSyntax (const char* title, const char* string) { + return LefDefParser::defwBeginextSyntax(title, string); +} + +int defwEndBeginext () { + return LefDefParser::defwEndBeginext(); +} + +int defwEnd () { + return LefDefParser::defwEnd(); +} + +int defwCurrentLineNumber () { + return LefDefParser::defwCurrentLineNumber(); +} + +void defwPrintError (int status) { + LefDefParser::defwPrintError(status); +} + +void defwAddComment (const char* comment) { + LefDefParser::defwAddComment(comment); +} + +void defwAddIndent () { + LefDefParser::defwAddIndent(); +} + diff --git a/src/def/cdef/xdefwWriterCalls.cpp b/src/def/cdef/xdefwWriterCalls.cpp new file mode 100644 index 00000000..ec61589a --- /dev/null +++ b/src/def/cdef/xdefwWriterCalls.cpp @@ -0,0 +1,203 @@ +// ***************************************************************************** +// ***************************************************************************** +// ATTENTION: THIS IS AN AUTO-GENERATED FILE. DO NOT CHANGE IT! +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the \"License\"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an \"AS IS\" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: xxx $ +// $Revision: xxx $ +// $Date: xxx $ +// $State: xxx $ +// ***************************************************************************** +// ***************************************************************************** + +#define EXTERN extern "C" + +#include "defwWriterCalls.h" +#include "defwWriterCalls.hpp" + +// Wrappers definitions. +int defwWrite (FILE * file, const char * fileName, defiUserData userData) { + return LefDefParser::defwWrite(file, fileName, userData); +} + +void defwSetRegisterUnusedCallbacks () { + LefDefParser::defwSetRegisterUnusedCallbacks(); +} + +void defwPrintUnusedCallbacks (FILE* log) { + LefDefParser::defwPrintUnusedCallbacks(log); +} + +void defwSetUserData (defiUserData p0) { + LefDefParser::defwSetUserData(p0); +} + +defiUserData defwGetUserData () { + return LefDefParser::defwGetUserData(); +} + +void defwSetArrayCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetArrayCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetAssertionCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetAssertionCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetBlockageCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetBlockageCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetBusBitCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetBusBitCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetCannotOccupyCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetCannotOccupyCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetCanplaceCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetCanplaceCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetCaseSensitiveCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetCaseSensitiveCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetComponentCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetComponentCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetConstraintCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetConstraintCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetDefaultCapCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetDefaultCapCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetDesignCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetDesignCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetDesignEndCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetDesignEndCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetDieAreaCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetDieAreaCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetDividerCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetDividerCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetExtCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetExtCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetFloorPlanCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetFloorPlanCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetGcellGridCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetGcellGridCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetGroupCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetGroupCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetHistoryCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetHistoryCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetIOTimingCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetIOTimingCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetNetCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetNetCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetPinCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetPinCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetPinPropCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetPinPropCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetPropDefCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetPropDefCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetRegionCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetRegionCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetRowCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetRowCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetSNetCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetSNetCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetScanchainCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetScanchainCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetTechnologyCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetTechnologyCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetTrackCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetTrackCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetUnitsCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetUnitsCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetVersionCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetVersionCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetViaCbk (::defwVoidCbkFnType p0) { + LefDefParser::defwSetViaCbk((LefDefParser::defwVoidCbkFnType) p0); +} + +void defwSetUnusedCallbacks (::defwVoidCbkFnType func) { + LefDefParser::defwSetUnusedCallbacks((LefDefParser::defwVoidCbkFnType ) func); +} + +void defwSetLogFunction (::DEFI_LOG_FUNCTION p0) { + LefDefParser::defwSetLogFunction(p0); +} + +void defwSetWarningLogFunction (::DEFI_WARNING_LOG_FUNCTION p0) { + LefDefParser::defwSetWarningLogFunction(p0); +} + diff --git a/src/def/cdefzlib/cdefzlib.c b/src/def/cdefzlib/cdefzlib.c new file mode 100644 index 00000000..0deddf00 --- /dev/null +++ b/src/def/cdefzlib/cdefzlib.c @@ -0,0 +1,69 @@ +/******************************************************************************* + ******************************************************************************* + * Copyright 2014, Cadence Design Systems + * + * This file is part of the Cadence LEF/DEF Open Source + * Distribution, Product Version 5.8. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + * + * For updates, support, or to become part of the LEF/DEF Community, + * check www.openeda.org for details. + ******************************************************************************* + ******************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include "zlib.h" +#include "defzlib.h" +#include "defrReader.h" + +/* + * Private functions: + */ +size_t defGZip_read(FILE* file, char* buf, size_t len) { + return gzread((gzFile)file, buf, (unsigned int)len); +} + +/* + * Public functions: + */ +defGZFile +defGZipOpen(const char *gzipPath, const char* mode) { + defGZFile fptr; + + if (!gzipPath) + return NULL; + + fptr = gzopen(gzipPath, mode); + + if (fptr) { + /* successfully open the gzip file */ + /* set the read function to read from a compressed file */ + defrSetReadFunction(defGZip_read); + return (defGZFile)fptr; + } else + return NULL; +} + +int defGZipClose(defGZFile filePtr) { + return (gzclose((gzFile)filePtr)); +} + +int defrReadGZip(defGZFile file, const char* gzipFile, defiUserData uData) { + return defrRead((FILE*)file, gzipFile, uData, 1); +} diff --git a/src/def/cdefzlib/defzlib.h b/src/def/cdefzlib/defzlib.h new file mode 100644 index 00000000..dc5a6899 --- /dev/null +++ b/src/def/cdefzlib/defzlib.h @@ -0,0 +1,51 @@ +/******************************************************************************* + ******************************************************************************* + * Copyright 2012, Cadence Design Systems + * + * This file is part of the Cadence LEF/DEF Open Source + * Distribution, Product Version 5.8. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + * + * For updates, support, or to become part of the LEF/DEF Community, + * check www.openeda.org for details. + ******************************************************************************* + ******************************************************************************/ + +#ifndef CLEFDEFZIP_H +#define CLEFDEFZIP_H + +typedef void* defGZFile; + +/* + * Name: defGZipOpen + * Description: Open a gzip file + * Returns: A file pointer + */ +extern defGZFile defGZipOpen(const char* gzipFile, const char* mode); + +/* + * Name: defGZipClose + * Description: Close a gzip file + * Returns: 0 if no errors + */ +extern int defGZipClose(defGZFile filePtr); + +/* + * Name: defrReadGZip + * Description: Parse a def gzip file + * Returns: 0 if no errors + */ +extern int defrReadGZip(defGZFile file, const char* gzipFile, void* uData); + +#endif diff --git a/src/def/def/def.msg b/src/def/def/def.msg new file mode 100644 index 00000000..eb58c0d3 --- /dev/null +++ b/src/def/def/def.msg @@ -0,0 +1,163 @@ +# Error message number: +# 6000 - out of memory +# 6010 - defiBlockage.cpp +# 6020 - defiComponent.cpp +# 6030 - defiFPC.cpp +# 6040 - defiFill.cpp +# 6050 - defiGroup.cpp +# 6060 - defiIOTiming.cpp +# 6070 - defiMisc.cpp +# 6080 - defiNet.cpp +# 6090 - defiNonDefault.cpp +# 6100 - defiPartition.cpp +# 6110 - defiPinCap.cpp +# 6120 - defiPinProp.cpp +# 6130 - defiRegion.cpp +# 6140 - defiRowTrack.cpp +# 6150 - defiScanchain.cpp +# 6160 - defiSlot.cpp +# 6170 - defiTimingDisable.cpp +# 6180 - defiVia.cpp +# 6200 - defiAssertion.cpp +# 5000 - def reader, defrReader.cpp +# 5500 - lex.cpph, yyerror +# 6000 - def parser, error, lex.cpph, def.y (CALLBACK and CHKERR) +# 6500 - def parser, error, def.y +# 7000 - def parser, warning, lex.cpph +# 7500 - def parser, warning, lef.y +# 8000 - def parser, info, lex.cpph +# 9000 - def writer +# emsMkError DEF -b defMsgTable -m def.msg -e -n +5000 "The 'defrRead' function has been called before the 'defrInit' function.\nThe 'defrInit' function should be called prior to the 'defrRead' function." +5001 "DEF statement found in the def file with no callback set." +6000 "The syntax for an ALIAS statement is \"&ALIAS aliasName = aliasDefinition &ENDALIAS\". '=' is missing after the aliasName." +6001 "End of file is reached while parsing in the middle of an ALIAS statement.\nReview you def file and add '&ENDALIAS' in the ALIAS statement." +6002 "The def file is incomplete." +6003 "The BEGINEXT tag is missing in the DEF file. Include the tag and then try again." +6004 "The BEGINEXT tag is empty. Specify a value for the tag and try again." +6005 "The '\"' is missing within the tag. Specify the '\"' in the tag and then try again." +6006 "The ending '\"' is missing in the tag. Specify the ending '\"' in the tag and then try again." +6007 "The ENDEXT statement is missing in the DEF file. Include the statement and then try again." +6008 "Invalid characters found in \'%s\'.\nThese characters might be using the character types other than English.\nCreate characters by specifying valid characters types." +6010 "An error has been reported in callback." +6011 "Too many syntax errors have been reported." +6030 "Invalid direction specified with FPC name. The valid direction is either 'H' or 'V'. Specify a valid vale and then try again." +6060 "Invalid value specified for IOTIMING rise/fall. The valid value for rise is 'R' and for fall is 'F'. Specify a valid value and then try again." +6080 "An internal error has occurred. The index number for the SUBNET wires array is less then or equal to 0.\nContact Cadence Customer Support with this error information." +6081 "An internal error has occurred. The index number for the NET PATH wires array is less then or equal to 0.\nContact Cadence Customer Support with this error information." +6082 "An internal error has occurred. The index number for the NET SHIELDPATH wires array is less then or equal to 0.\nContact Cadence Customer Support with this error information." +6083 "The index number %d specified for the NET INSTANCE is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again." +6084 "The index number %d specified for the NET PIN is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again." +6085 "The index number %d specified for the NET POLYGON is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again." +6086 "The index number %d specified for the NET RECTANGLE is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again." +6090 "The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again." +6091 "The index number %d specified for the NONDEFAULT PROPERTY is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again." +6100 "The value spefified for PARTITION SETUP is invalid. The valid value for SETUP is 'R' or 'F'. Specify a valid value for SETUP and then try again." +6101 "The value spefified for PARTITION HOLD is invalid. The valid value for HOLD is 'R' or 'F'. Specify a valid value for HOLD and then try again." +6120 "The index number %d specified for the PIN PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again." +6130 "The index number %d specified for the REGION PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again." +6131 "The index number %d specified for the REGION RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again." +6140 "The index number %d specified for the VIA LAYER RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again." +6150 "The START statement in the SCANCHAINS has defined more than one time in the SCANCHAINS statement.\nUpdate the DEF file to only one START statement and then try again." +6151 "The STOP statment in the SCANCHAINS has defined more than one time in the SCANCHAINS statement.\nUpdate the DEF file to only one STOP statement and then try again." +6160 "The index number %d specified for the SLOT RECTANGLE is invalid.\nValid index number is from 0 to %d. Specify a valid index number and then try again." +6170 "The TimingDisable type is invalid. The valid types are FROMPIN, & THRUPIN. Specify the valid type and then try again." +6180 "The index number %d specified for the VIA POLYGON is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again" +6200 "The ASSERTION statement is invalid because it has an invalid operand rule.\nValid operand rule is either NET or PATH. Specify a valid operand and then try again." +6201 "Unable to process the DEF file. Both WIREDLOGIC and DELAY statements are defined in constraint/assertion.\nUpdate the DEF file to define either a WIREDLOGIC or DELAY statement only." +6202 "Unable to process the DEF file. Both SUM and DIFF statements are defined in constraint/assertion.\nUpdate the DEF file to define either a SUM or DIFF statement only." +6501 "An error has been found while processing the DEF file '%s'\nUnit %d is a 5.6 or later syntax. Define the DEF file as 5.6 and then try again." +6502 "The value %d defined for DEF UNITS DISTANCE MICRON is invalid\n. The valid values are 100, 200, 1000, 2000, 10000, or 20000. Specify a valid value and then try again." +6503 "The execution has been stopped because the DEF parser 5.7 does not support DEF file with version %s.\nUpdate your DEF file to version 5.7 or earlier." +6504 "Def parser version 5.7 and later does not support NAMESCASESENSITIVE OFF.\nEither remove this optional construct or set it to ON." +6505 "The NONDEFAULTRULE statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g." +6506 "The NETEXPR statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g." +6507 "The SUPPLYSENSITIVITY statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g." +6508 "The GROUNDSENSITIVITY statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g." +6509 "The POLYGON statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g." +6510 "The ANTENNAPINPARTIALMETALAREA statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g." +6511 "The ANTENNAPINPARTIALMETALSIDEAREA statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g" +6512 "The ANTENNAPINGATEAREA statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g" +6513 "The ANTENNAPINDIFFAREA statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g" +6514 "The ANTENNAPINMAXAREACAR statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g" +6515 "The ANTENNAPINMAXSIDEAREACAR statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g" +6516 "The ANTENNAPINPARTIALCUTAREA statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g" +6517 "The ANTENNAPINMAXCUTCAR statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g" +6518 "The ANTENNAMODEL statement is available in version 5.5 and later.\nHowever, your DEF file is defined with version %g" +6519 "The SPACING statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g" +6520 "The DESIGNRULEWIDTH statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g" +6523 "Invalid ROW statement defined in the DEF file. The DO statement which is required in the ROW statement is not defined.\nUpdate your DEF file with a DO statement." +6524 "Invalid syntax specified. The valid syntax is either \"DO 1 BY num or DO num BY 1\". Specify the valid syntax and try again." +6525 "The DO number %g in TRACK is invalid.\nThe number value has to be greater than 0. Specify the valid syntax and try again." +6526 "The STEP number %g in TRACK is invalid.\nThe number value has to be greater than 0. Specify the valid syntax and try again." +6527 "The DO number %g in GCELLGRID is invalid.\nThe number value has to be greater than 0. Specify the valid syntax and try again." +6528 "The STEP number %g in GCELLGRID is invalid.\nThe number value has to be greater than 0. Specify the valid syntax and try again." +6529 "The HALO statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g" +6530 "The FIXEDBUMP statement is available in version 5.5 and later.\nHowever, your DEF file is defined with version %g" +6531 "The layerName which is required in path is missing. Include the layerName in the path and then try again." +6532 "The VIA DO statement is available in version 5.5 and later.\nHowever, your DEF file is defined with version %g" +6533 "Either the numX or numY in the VIA DO statement has invalid value. The value specified is 0.\nUpdate your DEF file with the correct value and then try again." +6534 "The STYLE statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g" +6535 "The POLYGON statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g" +6536 "The RECT statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g" +6537 "The value %s for statement VOLTAGE is invalid. The value can only be integer.\nSpecify a valid value in units of millivolts" +6538 "The PARTITION statement is available in version 5.5 and later.\nHowever, your DEF file is defined with version %g" +6539 "Invalid BLOCKAGE statement defined in the DEF file. The BLOCKAGE statment has both the LAYER and the PLACEMENT statements defined.\nUpdate your DEF file to have either BLOCKAGE or PLACEMENT statement only." +6540 "The SPACING statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g" +6541 "The SPACING statement is defined in the LAYER statement,\nbut there is already either a SPACING statement or DESIGNRULEWIDTH statement has defined in the LAYER statement.\nUpdate your DEF file to have either SPACING statement or a DESIGNRULEWIDTH statement." +6542 "The defined BLOCKAGES COMPONENT statement has either COMPONENT, SLOTS, FILLS, PUSHDOWN or EXCEPTPGNET defined.\nOnly one of these statements is allowed per LAYER. Updated the DEF file to define a valid BLOCKAGES COMPONENT statement per layer." +6543 "The defined BLOCKAGES PLACEMENT statement has either COMPONENT, PUSHDOWN, SOFT or PARTIAL defined.\nOnly one of these statements is allowed per LAYER. Updated the DEF file to define a valid BLOCKAGES PLACEMENT statement." +6544 "A POLYGON statement is defined in the BLOCKAGE statement,\nbut it is not defined in the BLOCKAGE LAYER statement.\nUpdate your DEF file to either remove the POLYGON statement from the BLOCKAGE statement or\ndefine the POLYGON statement in a BLOCKAGE LAYER statement." +6545 "The NONDEFAULTRULE statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g." +6546 "The STYLES statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g" +6547 "The PLACEMENT SOFT is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g." +6548 "The PARTIAL is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g." +6549 "The EXCEPTPGNET is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g." +6550 "The HALO SOFT is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g." +6551 "The ROUTEHALO is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g." +6552 "The FILLWIREOPC is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g." +6553 "The LAYER OPC is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g." +6554 "The VIA OPC is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g." +6555 "The PORT in PINS is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g." +6556 "The PIN VIA statement is available in version 5.7 and later.\nHowever, your DEF file is defined with version %g." +6557 "The VIARULE statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", +6558 "The FREQUENCY statement is available in version 5.5 and later.\nHowever, your DEF file is defined with version %g" +6559 "The ROWCOL statement is missing from the VIARULE statement. Ensure that it exists in the VIARULE statement." +6560 "The ORIGIN statement is missing from the VIARULE statement. Ensure that it exists in the VIARULE statement." +6561 " The OFFSET statement is missing from the VIARULE statement. Ensure that it exists in the VIARULE statement." +6562 "The PATTERN statement is missing from the VIARULE statement. Ensure that it exists in the VIARULE statement." +6563 "The TYPE statement already exists. It has been defined in the REGION statement." +6564 "POLYGON statement in FILLS LAYER is a version 5.6 and later syntax.\nYour def file is defined with version %g", +7000 "The specified string has exceeded 4096 characters. The extra characters will be truncated. Specify a string less than or equal to 4096 characters." +7010 "The PropName %s is not defined for %s." +7011 "The NAMESCASESENSITIVE statement is obsolete in version 5.6 and later.\nThe DEF parser will ignore this statement." +7012 "No VERSION statement found, using the default value %2g." +7013 "The DEF file is invalid if NAMESCASESENSITIVE is undefined.\nNAMESCASESENSITIVE is a mandatory statement in the DEF file with version 5.6 and earlier.\nTo define the NAMESCASESENSITIVE statement, refer to the LEF/DEF 5.5 and earlier Language Reference manual." +7014 "The DEF file is invalid if BUSBITCHARS is undefined.\nBUSBITCHARS is a mandatory statement in the DEF file with version 5.6 and earlier.\nTo define the BUSBITCHARS statement, refer to the LEF/DEF 5.5 and earlier Language Reference manual." +7015 "The DEF file is invalid if DIVIDERCHAR is undefined.\nDIVIDERCHAR is a mandatory statement in the DEF file with version 5.6 and earlier.\nTo define the DIVIDERCHAR statement, refer to the LEF/DEF 5.5 and earlier Language Reference manual." +7016 "DESIGN is a mandatory statement in the DEF file. Ensure that it exists in the file." +7017 "The DEFAULTCAP statement is obsolete in version 5.4 and later.\nThe DEF parser will ignore this statement." +7018 "The DO statement in the ROW statement with the name %s has invalid syntax.\nThe valid syntax is \"DO numX BY 1 STEP spaceX 0 | DO 1 BY numY STEP 0 spaceY\".\nSpecify the valid syntax and try again." +7019 "The PATTERNNAME statement is obsolete in version 5.6 and later.\nThe DEF parser will ignore this statement." +7020 "The REGION pt pt statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement." +7021 "The FOREIGN statement is obsolete in version 5.6 and later.\nThe DEF parser will ignore this statement." +7022 "In the COMPONENT UNPLACED statement, the point and orient are invalid in version 5.4 and later.\nThe DEF parser will ignore this statement." +7023 "The SPECIAL NET statement, with type %s, does not have any net statement defined.\nThe DEF parser will ignore this statement." +7024 "The ESTCAP statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement." +7025 "The SPECIAL NET SHIELD statement, does not have any shield net statement defined.\nThe DEF parser will ignore this statement." +7026 "The WIDTH statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement." +7027 "The GROUP REGION pt pt statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement." +7028 "The GROUP SOFT MAXX statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement." +7029 "The GROUP SOFT MAXY statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement." +7030 "The GROUP SOFT MAXHALFPERIMETER statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement." +7031 "The ASSERTIONS statement is obsolete in version 5.4 and later.\nThe DEF parser will ignore this statement." +7032 "The CONSTRAINTS statement is obsolete in version 5.4 and later.\nThe DEF parser will ignore this statement." +7035 "The IOTIMINGS statement is obsolete in version 5.4 and later.\nThe DEF parser will ignore this statement." +7500 "Unable to open the file defRWarning.log in %s.\nWarning messages will not be written out in the log file.\nCheck if you have write permission on the directory." +8000 "The data still exists after the END DESIGN statement. The DEF parser will ignore this data." +8500 "Unable to open the file defRWarning.log in %s.\nInfo messages will not be written out in the log file.\nCheck if you have write permission on the directory." +9000 "The DEF writer has detected that the function defwInitCbk has already been called and you are trying to call defwInit.\nOnly defwInitCbk or defwInit can be called but not both.\nUpdate your program and then try again." +9001 "The DEF writer has detected that the function defwInit has already been called and you are trying to call defwInitCbk.\nOnly defwInitCbk or defwInit can be called but not both.\nUpdate your program and then try again." +9010 "The function defwWrite is called before the function defwInitCbk.\nYou need to call defwInitCbk before calling any other functions.\nUpdate your program and then try again." +9011 "You program has called the function defwInit to initialize the writer.\nIf you want to use the callback option you need to use the function defwInitCbk." +9012 "You are calling the function defwPrintUnusedCallbacks but you did call the function defwSetRegisterUnusedCallbacks which is required before you can call defwPrintUnusedCallbacks." diff --git a/src/def/def/def.y b/src/def/def/def.y new file mode 100644 index 00000000..9455c4eb --- /dev/null +++ b/src/def/def/def.y @@ -0,0 +1,5199 @@ +// ****************************************************************************** +// ****************************************************************************** +// Copyright 2013-2017, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// ****************************************************************************** +// +// $Author: icftcm $ +// $Revision: #2 $ +// $Date: 2017/06/07 $ +// $State: $ +// **************************************************************************** + +// Error message number: +// 5000 - def reader, defrReader.cpp +// 5500 - lex.cpph, yyerror +// 6000 - def parser, error, lex.cpph, def.y (CALLBACK & CHKERR) +// 6010 - defiBlockage.cpp +// 6020 - defiComponent.cpp +// 6030 - defiFPC.cpp +// 6040 - defiFill.cpp +// 6050 - defiGroup.cpp +// 6060 - defiIOTiming.cpp +// 6070 - defiMisc.cpp +// 6080 - defiNet.cpp +// 6090 - defiNonDefault.cpp +// 6100 - defiPartition.cpp +// 6110 - defiPinCap.cpp +// 6120 - defiPinProp.cpp +// 6130 - defiRegion.cpp +// 6140 - defiRowTrack.cpp +// 6150 - defiScanchain.cpp +// 6160 - defiSlot.cpp +// 6170 - defiTimingDisable.cpp +// 6180 - defiVia.cpp +// 6500 - def parser, error, def.y +%define api.pure +%lex-param {defrData *defData} +%parse-param {defrData *defData} + + +%{ +#include +#include +#include "defrReader.hpp" +#include "defiUser.hpp" +#include "defrCallBacks.hpp" +#include "lex.h" + +#define DEF_MAX_INT 2147483647 +#define YYDEBUG 1 // this is temp fix for pcr 755132 +// TX_DIR:TRANSLATION ON + + +#include "defrData.hpp" +#include "defrSettings.hpp" +#include "defrCallBacks.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +// Macro to describe how we handle a callback. +// If the function was set then call it. +// If the function returns non zero then there was an error +// so call the error routine and exit. +// +#define CALLBACK(func, typ, data) \ + if (!defData->errors) {\ + if (func) { \ + if ((defData->defRetVal = (*func)(typ, data, defData->session->UserData)) == PARSE_OK) { \ + } else if (defData->defRetVal == STOP_PARSE) { \ + return defData->defRetVal; \ + } else { \ + defData->defError(6010, "An error has been reported in callback."); \ + return defData->defRetVal; \ + } \ + } \ + } + +#define CHKERR() \ + if (defData->checkErrors()) { \ + return 1; \ + } + +#define CHKPROPTYPE(propType, propName, name) \ + if (propType == 'N') { \ + defData->warningMsg = (char*)malloc(strlen(propName)+strlen(name)+40); \ + sprintf(defData->warningMsg, "The PropName %s is not defined for %s.", \ + propName, name); \ + defData->defWarning(7010, defData->warningMsg); \ + free(defData->warningMsg); \ + } + +int yylex(YYSTYPE *pYylval, defrData *defData) +{ + return defData->defyylex(pYylval); +} + + +void yyerror(defrData *defData, const char *s) +{ + return defData->defyyerror(s); +} + + + + +#define FIXED 1 +#define COVER 2 +#define PLACED 3 +#define UNPLACED 4 +%} + + + + + + + + + + +%token QSTRING +%token T_STRING SITE_PATTERN +%token NUMBER +%token K_HISTORY K_NAMESCASESENSITIVE +%token K_DESIGN K_VIAS K_TECH K_UNITS K_ARRAY K_FLOORPLAN +%token K_SITE K_CANPLACE K_CANNOTOCCUPY K_DIEAREA +%token K_PINS +%token K_DEFAULTCAP K_MINPINS K_WIRECAP +%token K_TRACKS K_GCELLGRID +%token K_DO K_BY K_STEP K_LAYER K_ROW K_RECT +%token K_COMPS K_COMP_GEN K_SOURCE K_WEIGHT K_EEQMASTER +%token K_FIXED K_COVER K_UNPLACED K_PLACED K_FOREIGN K_REGION +%token K_REGIONS +%token K_NETS K_START_NET K_MUSTJOIN K_ORIGINAL K_USE K_STYLE +%token K_PATTERN K_PATTERNNAME K_ESTCAP K_ROUTED K_NEW +%token K_SNETS K_SHAPE K_WIDTH K_VOLTAGE K_SPACING K_NONDEFAULTRULE +%token K_NONDEFAULTRULES +%token K_N K_S K_E K_W K_FN K_FE K_FS K_FW +%token K_GROUPS K_GROUP K_SOFT K_MAXX K_MAXY K_MAXHALFPERIMETER +%token K_CONSTRAINTS K_NET K_PATH K_SUM K_DIFF +%token K_SCANCHAINS K_START K_FLOATING K_ORDERED K_STOP K_IN K_OUT +%token K_RISEMIN K_RISEMAX K_FALLMIN K_FALLMAX K_WIREDLOGIC +%token K_MAXDIST +%token K_ASSERTIONS +%token K_DISTANCE K_MICRONS +%token K_END +%token K_IOTIMINGS K_RISE K_FALL K_VARIABLE K_SLEWRATE K_CAPACITANCE +%token K_DRIVECELL K_FROMPIN K_TOPIN K_PARALLEL +%token K_TIMINGDISABLES K_THRUPIN K_MACRO +%token K_PARTITIONS K_TURNOFF +%token K_FROMCLOCKPIN K_FROMCOMPPIN K_FROMIOPIN +%token K_TOCLOCKPIN K_TOCOMPPIN K_TOIOPIN +%token K_SETUPRISE K_SETUPFALL K_HOLDRISE K_HOLDFALL +%token K_VPIN K_SUBNET K_XTALK K_PIN K_SYNTHESIZED +%token K_DEFINE K_DEFINES K_DEFINEB K_IF K_THEN K_ELSE K_FALSE K_TRUE +%token K_EQ K_NE K_LE K_LT K_GE K_GT K_OR K_AND K_NOT +%token K_SPECIAL K_DIRECTION K_RANGE +%token K_FPC K_HORIZONTAL K_VERTICAL K_ALIGN K_MIN K_MAX K_EQUAL +%token K_BOTTOMLEFT K_TOPRIGHT K_ROWS K_TAPER K_TAPERRULE +%token K_VERSION K_DIVIDERCHAR K_BUSBITCHARS +%token K_PROPERTYDEFINITIONS K_STRING K_REAL K_INTEGER K_PROPERTY +%token K_BEGINEXT K_ENDEXT K_NAMEMAPSTRING K_ON K_OFF K_X K_Y +%token K_COMPONENT K_MASK K_MASKSHIFT K_COMPSMASKSHIFT K_SAMEMASK +%token K_PINPROPERTIES K_TEST +%token K_COMMONSCANPINS K_SNET K_COMPONENTPIN K_REENTRANTPATHS +%token K_SHIELD K_SHIELDNET K_NOSHIELD K_VIRTUAL +%token K_ANTENNAPINPARTIALMETALAREA K_ANTENNAPINPARTIALMETALSIDEAREA +%token K_ANTENNAPINGATEAREA K_ANTENNAPINDIFFAREA +%token K_ANTENNAPINMAXAREACAR K_ANTENNAPINMAXSIDEAREACAR +%token K_ANTENNAPINPARTIALCUTAREA K_ANTENNAPINMAXCUTCAR +%token K_SIGNAL K_POWER K_GROUND K_CLOCK K_TIEOFF K_ANALOG K_SCAN +%token K_RESET K_RING K_STRIPE K_FOLLOWPIN K_IOWIRE K_COREWIRE +%token K_BLOCKWIRE K_FILLWIRE K_BLOCKAGEWIRE K_PADRING K_BLOCKRING +%token K_BLOCKAGES K_PLACEMENT K_SLOTS K_FILLS K_PUSHDOWN +%token K_NETLIST K_DIST K_USER K_TIMING K_BALANCED K_STEINER K_TRUNK +%token K_FIXEDBUMP K_FENCE K_FREQUENCY K_GUIDE K_MAXBITS +%token K_PARTITION K_TYPE K_ANTENNAMODEL K_DRCFILL +%token K_OXIDE1 K_OXIDE2 K_OXIDE3 K_OXIDE4 +%token K_CUTSIZE K_CUTSPACING K_DESIGNRULEWIDTH K_DIAGWIDTH +%token K_ENCLOSURE K_HALO K_GROUNDSENSITIVITY +%token K_HARDSPACING K_LAYERS K_MINCUTS K_NETEXPR +%token K_OFFSET K_ORIGIN K_ROWCOL K_STYLES +%token K_POLYGON K_PORT K_SUPPLYSENSITIVITY K_VIA K_VIARULE K_WIREEXT +%token K_EXCEPTPGNET K_FILLWIREOPC K_OPC K_PARTIAL K_ROUTEHALO +%type pt opt_paren +%type comp_net_list subnet_opt_syn +%type orient pin_via_mask_opt +%type placement_status +%type net_type subnet_type track_start use_type shape_type source_type +%type pattern_type netsource_type +%type path paths new_path +%type risefall opt_pin opt_pattern pin_layer_opt +%type vpin_status opt_plus track_type region_type +%type h_or_v turnoff_setup turnoff_hold +%type conn_opt partition_maxbits same_mask mask orient_pt + +%% + +def_file: version_stmt case_sens_stmt rules end_design + ; + +version_stmt: // empty + | K_VERSION { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING ';' + { + defData->VersionNum = defrData::convert_defname2num($3); + if (defData->VersionNum > CURRENT_VERSION) { + char temp[300]; + sprintf(temp, + "The execution has been stopped because the DEF parser %.1f does not support DEF file with version %s.\nUpdate your DEF file to version 5.8 or earlier.", + CURRENT_VERSION, $3); + defData->defError(6503, temp); + return 1; + } + if (defData->callbacks->VersionStrCbk) { + CALLBACK(defData->callbacks->VersionStrCbk, defrVersionStrCbkType, $3); + } else if (defData->callbacks->VersionCbk) { + CALLBACK(defData->callbacks->VersionCbk, defrVersionCbkType, defData->VersionNum); + } + if (defData->VersionNum > 5.3 && defData->VersionNum < 5.4) + defData->defIgnoreVersion = 1; + if (defData->VersionNum < 5.6) // default to false before 5.6 + defData->names_case_sensitive = defData->session->reader_case_sensitive; + else + defData->names_case_sensitive = 1; + defData->hasVer = 1; + defData->doneDesign = 0; + } + +case_sens_stmt: // empty + | K_NAMESCASESENSITIVE K_ON ';' + { + if (defData->VersionNum < 5.6) { + defData->names_case_sensitive = 1; + if (defData->callbacks->CaseSensitiveCbk) + CALLBACK(defData->callbacks->CaseSensitiveCbk, defrCaseSensitiveCbkType, + defData->names_case_sensitive); + defData->hasNameCase = 1; + } else + if (defData->callbacks->CaseSensitiveCbk) // write error only if cbk is set + if (defData->caseSensitiveWarnings++ < defData->settings->CaseSensitiveWarnings) + defData->defWarning(7011, "The NAMESCASESENSITIVE statement is obsolete in version 5.6 and later.\nThe DEF parser will ignore this statement."); + } + | K_NAMESCASESENSITIVE K_OFF ';' + { + if (defData->VersionNum < 5.6) { + defData->names_case_sensitive = 0; + if (defData->callbacks->CaseSensitiveCbk) + CALLBACK(defData->callbacks->CaseSensitiveCbk, defrCaseSensitiveCbkType, + defData->names_case_sensitive); + defData->hasNameCase = 1; + } else { + if (defData->callbacks->CaseSensitiveCbk) { // write error only if cbk is set + if (defData->caseSensitiveWarnings++ < defData->settings->CaseSensitiveWarnings) { + defData->defError(6504, "Def parser version 5.7 and later does not support NAMESCASESENSITIVE OFF.\nEither remove this optional construct or set it to ON."); + CHKERR(); + } + } + } + } + +rules: // empty + | rules rule + | error + ; + +rule: design_section | assertions_section | blockage_section | comps_section + | constraint_section | extension_section | fill_section | comps_maskShift_section + | floorplan_contraints_section | groups_section | iotiming_section + | nets_section | nondefaultrule_section | partitions_section + | pin_props_section | regions_section | scanchains_section + | slot_section | snets_section | styles_section | timingdisables_section + | via_section + ; + +design_section: array_name | bus_bit_chars | canplace | cannotoccupy | + design_name | die_area | divider_char | + floorplan_name | gcellgrid | history | + pin_cap_rule | pin_rule | prop_def_section | + row_rule | tech_name | tracks_rule | units + ; + + + +design_name: K_DESIGN {defData->dumb_mode = 1; defData->no_num = 1; } T_STRING ';' + { + if (defData->callbacks->DesignCbk) + CALLBACK(defData->callbacks->DesignCbk, defrDesignStartCbkType, $3); + defData->hasDes = 1; + } + +end_design: K_END K_DESIGN + { + defData->doneDesign = 1; + if (defData->callbacks->DesignEndCbk) + CALLBACK(defData->callbacks->DesignEndCbk, defrDesignEndCbkType, 0); + // 11/16/2001 - pcr 408334 + // Return 1 if there is any defData->errors during parsing + if (defData->errors) + return 1; + + if (!defData->hasVer) { + char temp[300]; + sprintf(temp, "No VERSION statement found, using the default value %2g.", defData->VersionNum); + defData->defWarning(7012, temp); + } + if (!defData->hasNameCase && defData->VersionNum < 5.6) + defData->defWarning(7013, "The DEF file is invalid if NAMESCASESENSITIVE is undefined.\nNAMESCASESENSITIVE is a mandatory statement in the DEF file with version 5.6 and earlier.\nTo define the NAMESCASESENSITIVE statement, refer to the LEF/DEF 5.5 and earlier Language Reference manual."); + if (!defData->hasBusBit && defData->VersionNum < 5.6) + defData->defWarning(7014, "The DEF file is invalid if BUSBITCHARS is undefined.\nBUSBITCHARS is a mandatory statement in the DEF file with version 5.6 and earlier.\nTo define the BUSBITCHARS statement, refer to the LEF/DEF 5.5 and earlier Language Reference manual."); + if (!defData->hasDivChar && defData->VersionNum < 5.6) + defData->defWarning(7015, "The DEF file is invalid if DIVIDERCHAR is undefined.\nDIVIDERCHAR is a mandatory statement in the DEF file with version 5.6 and earlier.\nTo define the DIVIDERCHAR statement, refer to the LEF/DEF 5.5 and earlier Language Reference manual."); + if (!defData->hasDes) + defData->defWarning(7016, "DESIGN is a mandatory statement in the DEF file. Ensure that it exists in the file."); + } + +tech_name: K_TECH { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING ';' + { + if (defData->callbacks->TechnologyCbk) + CALLBACK(defData->callbacks->TechnologyCbk, defrTechNameCbkType, $3); + } + +array_name: K_ARRAY {defData->dumb_mode = 1; defData->no_num = 1;} T_STRING ';' + { + if (defData->callbacks->ArrayNameCbk) + CALLBACK(defData->callbacks->ArrayNameCbk, defrArrayNameCbkType, $3); + } + +floorplan_name: K_FLOORPLAN { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING ';' + { + if (defData->callbacks->FloorPlanNameCbk) + CALLBACK(defData->callbacks->FloorPlanNameCbk, defrFloorPlanNameCbkType, $3); + } + +history: K_HISTORY + { + if (defData->callbacks->HistoryCbk) + CALLBACK(defData->callbacks->HistoryCbk, defrHistoryCbkType, &defData->History_text[0]); + } + +prop_def_section: K_PROPERTYDEFINITIONS + { + if (defData->callbacks->PropDefStartCbk) + CALLBACK(defData->callbacks->PropDefStartCbk, defrPropDefStartCbkType, 0); + } + property_defs K_END K_PROPERTYDEFINITIONS + { + if (defData->callbacks->PropDefEndCbk) + CALLBACK(defData->callbacks->PropDefEndCbk, defrPropDefEndCbkType, 0); + defData->real_num = 0; // just want to make sure it is reset + } + +property_defs: // empty + | property_defs property_def + { } + +property_def: K_DESIGN {defData->dumb_mode = 1; defData->no_num = 1; defData->Prop.clear(); } + T_STRING property_type_and_val ';' + { + if (defData->callbacks->PropCbk) { + defData->Prop.setPropType("design", $3); + CALLBACK(defData->callbacks->PropCbk, defrPropCbkType, &defData->Prop); + } + defData->session->DesignProp.setPropType(defData->DEFCASE($3), defData->defPropDefType); + } + | K_NET { defData->dumb_mode = 1 ; defData->no_num = 1; defData->Prop.clear(); } + T_STRING property_type_and_val ';' + { + if (defData->callbacks->PropCbk) { + defData->Prop.setPropType("net", $3); + CALLBACK(defData->callbacks->PropCbk, defrPropCbkType, &defData->Prop); + } + defData->session->NetProp.setPropType(defData->DEFCASE($3), defData->defPropDefType); + } + | K_SNET { defData->dumb_mode = 1 ; defData->no_num = 1; defData->Prop.clear(); } + T_STRING property_type_and_val ';' + { + if (defData->callbacks->PropCbk) { + defData->Prop.setPropType("specialnet", $3); + CALLBACK(defData->callbacks->PropCbk, defrPropCbkType, &defData->Prop); + } + defData->session->SNetProp.setPropType(defData->DEFCASE($3), defData->defPropDefType); + } + | K_REGION { defData->dumb_mode = 1 ; defData->no_num = 1; defData->Prop.clear(); } + T_STRING property_type_and_val ';' + { + if (defData->callbacks->PropCbk) { + defData->Prop.setPropType("region", $3); + CALLBACK(defData->callbacks->PropCbk, defrPropCbkType, &defData->Prop); + } + defData->session->RegionProp.setPropType(defData->DEFCASE($3), defData->defPropDefType); + } + | K_GROUP { defData->dumb_mode = 1 ; defData->no_num = 1; defData->Prop.clear(); } + T_STRING property_type_and_val ';' + { + if (defData->callbacks->PropCbk) { + defData->Prop.setPropType("group", $3); + CALLBACK(defData->callbacks->PropCbk, defrPropCbkType, &defData->Prop); + } + defData->session->GroupProp.setPropType(defData->DEFCASE($3), defData->defPropDefType); + } + | K_COMPONENT { defData->dumb_mode = 1 ; defData->no_num = 1; defData->Prop.clear(); } + T_STRING property_type_and_val ';' + { + if (defData->callbacks->PropCbk) { + defData->Prop.setPropType("component", $3); + CALLBACK(defData->callbacks->PropCbk, defrPropCbkType, &defData->Prop); + } + defData->session->CompProp.setPropType(defData->DEFCASE($3), defData->defPropDefType); + } + | K_ROW { defData->dumb_mode = 1 ; defData->no_num = 1; defData->Prop.clear(); } + T_STRING property_type_and_val ';' + { + if (defData->callbacks->PropCbk) { + defData->Prop.setPropType("row", $3); + CALLBACK(defData->callbacks->PropCbk, defrPropCbkType, &defData->Prop); + } + defData->session->RowProp.setPropType(defData->DEFCASE($3), defData->defPropDefType); + } + + | K_COMPONENTPIN + { defData->dumb_mode = 1 ; defData->no_num = 1; defData->Prop.clear(); } + T_STRING property_type_and_val ';' + { + if (defData->callbacks->PropCbk) { + defData->Prop.setPropType("componentpin", $3); + CALLBACK(defData->callbacks->PropCbk, defrPropCbkType, &defData->Prop); + } + defData->session->CompPinProp.setPropType(defData->DEFCASE($3), defData->defPropDefType); + } + | K_NONDEFAULTRULE + { defData->dumb_mode = 1 ; defData->no_num = 1; defData->Prop.clear(); } + T_STRING property_type_and_val ';' + { + if (defData->VersionNum < 5.6) { + if (defData->nonDefaultWarnings++ < defData->settings->NonDefaultWarnings) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The NONDEFAULTRULE statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6505, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } else { + if (defData->callbacks->PropCbk) { + defData->Prop.setPropType("nondefaultrule", $3); + CALLBACK(defData->callbacks->PropCbk, defrPropCbkType, &defData->Prop); + } + defData->session->NDefProp.setPropType(defData->DEFCASE($3), defData->defPropDefType); + } + } + | error ';' { yyerrok; yyclearin;}; + +property_type_and_val: K_INTEGER { defData->real_num = 0; } opt_range opt_num_val + { + if (defData->callbacks->PropCbk) defData->Prop.setPropInteger(); + defData->defPropDefType = 'I'; + } + | K_REAL { defData->real_num = 1; } opt_range opt_num_val + { + if (defData->callbacks->PropCbk) defData->Prop.setPropReal(); + defData->defPropDefType = 'R'; + defData->real_num = 0; + } + | K_STRING + { + if (defData->callbacks->PropCbk) defData->Prop.setPropString(); + defData->defPropDefType = 'S'; + } + | K_STRING QSTRING + { + if (defData->callbacks->PropCbk) defData->Prop.setPropQString($2); + defData->defPropDefType = 'Q'; + } + | K_NAMEMAPSTRING T_STRING + { + if (defData->callbacks->PropCbk) defData->Prop.setPropNameMapString($2); + defData->defPropDefType = 'S'; + } + +opt_num_val: // empty + | NUMBER + { if (defData->callbacks->PropCbk) defData->Prop.setNumber($1); } + +units: K_UNITS K_DISTANCE K_MICRONS NUMBER ';' + { + if (defData->callbacks->UnitsCbk) { + if (defData->defValidNum((int)$4)) + CALLBACK(defData->callbacks->UnitsCbk, defrUnitsCbkType, $4); + } + } + +divider_char: K_DIVIDERCHAR QSTRING ';' + { + if (defData->callbacks->DividerCbk) + CALLBACK(defData->callbacks->DividerCbk, defrDividerCbkType, $2); + defData->hasDivChar = 1; + } + +bus_bit_chars: K_BUSBITCHARS QSTRING ';' + { + if (defData->callbacks->BusBitCbk) + CALLBACK(defData->callbacks->BusBitCbk, defrBusBitCbkType, $2); + defData->hasBusBit = 1; + } + +canplace: K_CANPLACE {defData->dumb_mode = 1;defData->no_num = 1; } T_STRING NUMBER NUMBER + orient K_DO NUMBER K_BY NUMBER K_STEP NUMBER NUMBER ';' + { + if (defData->callbacks->CanplaceCbk) { + defData->Canplace.setName($3); + defData->Canplace.setLocation($4,$5); + defData->Canplace.setOrient($6); + defData->Canplace.setDo($8,$10,$12,$13); + CALLBACK(defData->callbacks->CanplaceCbk, defrCanplaceCbkType, + &(defData->Canplace)); + } + } +cannotoccupy: K_CANNOTOCCUPY {defData->dumb_mode = 1;defData->no_num = 1; } T_STRING NUMBER NUMBER + orient K_DO NUMBER K_BY NUMBER K_STEP NUMBER NUMBER ';' + { + if (defData->callbacks->CannotOccupyCbk) { + defData->CannotOccupy.setName($3); + defData->CannotOccupy.setLocation($4,$5); + defData->CannotOccupy.setOrient($6); + defData->CannotOccupy.setDo($8,$10,$12,$13); + CALLBACK(defData->callbacks->CannotOccupyCbk, defrCannotOccupyCbkType, + &(defData->CannotOccupy)); + } + } + +orient: K_N {$$ = 0;} + | K_W {$$ = 1;} + | K_S {$$ = 2;} + | K_E {$$ = 3;} + | K_FN {$$ = 4;} + | K_FW {$$ = 5;} + | K_FS {$$ = 6;} + | K_FE {$$ = 7;} + +die_area: K_DIEAREA + { + defData->Geometries.Reset(); + } + firstPt nextPt otherPts ';' + { + if (defData->callbacks->DieAreaCbk) { + defData->DieArea.addPoint(&defData->Geometries); + CALLBACK(defData->callbacks->DieAreaCbk, defrDieAreaCbkType, &(defData->DieArea)); + } + } + +// 8/31/2001 - This is obsolete in 5.4 +pin_cap_rule: start_def_cap pin_caps end_def_cap + { } + +start_def_cap: K_DEFAULTCAP NUMBER + { + if (defData->VersionNum < 5.4) { + if (defData->callbacks->DefaultCapCbk) + CALLBACK(defData->callbacks->DefaultCapCbk, defrDefaultCapCbkType, ROUND($2)); + } else { + if (defData->callbacks->DefaultCapCbk) // write error only if cbk is set + if (defData->defaultCapWarnings++ < defData->settings->DefaultCapWarnings) + defData->defWarning(7017, "The DEFAULTCAP statement is obsolete in version 5.4 and later.\nThe DEF parser will ignore this statement."); + } + } + +pin_caps: // empty + | pin_caps pin_cap + ; + +pin_cap: K_MINPINS NUMBER K_WIRECAP NUMBER ';' + { + if (defData->VersionNum < 5.4) { + if (defData->callbacks->PinCapCbk) { + defData->PinCap.setPin(ROUND($2)); + defData->PinCap.setCap($4); + CALLBACK(defData->callbacks->PinCapCbk, defrPinCapCbkType, &(defData->PinCap)); + } + } + } + +end_def_cap: K_END K_DEFAULTCAP + { } + +pin_rule: start_pins pins end_pins + { } + +start_pins: K_PINS NUMBER ';' + { + if (defData->callbacks->StartPinsCbk) + CALLBACK(defData->callbacks->StartPinsCbk, defrStartPinsCbkType, ROUND($2)); + } + +pins: // empty + | pins pin + ; + +pin: '-' {defData->dumb_mode = 1; defData->no_num = 1; } T_STRING '+' K_NET + {defData->dumb_mode = 1; defData->no_num = 1; } T_STRING + { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + defData->Pin.Setup($3, $7); + } + defData->hasPort = 0; + } + pin_options ';' + { + if (defData->callbacks->PinCbk) + CALLBACK(defData->callbacks->PinCbk, defrPinCbkType, &defData->Pin); + } + +pin_options: // empty + | pin_options pin_option + +pin_option: '+' K_SPECIAL + { + if (defData->callbacks->PinCbk) + defData->Pin.setSpecial(); + } + + | extension_stmt + { + if (defData->callbacks->PinExtCbk) + CALLBACK(defData->callbacks->PinExtCbk, defrPinExtCbkType, &defData->History_text[0]); + } + + | '+' K_DIRECTION T_STRING + { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) + defData->Pin.setDirection($3); + } + + | '+' K_NETEXPR QSTRING + { + if (defData->VersionNum < 5.6) { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if ((defData->pinWarnings++ < defData->settings->PinWarnings) && + (defData->pinWarnings++ < defData->settings->PinExtWarnings)) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The NETEXPR statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6506, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } else { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) + defData->Pin.setNetExpr($3); + + } + } + + | '+' K_SUPPLYSENSITIVITY { defData->dumb_mode = 1; } T_STRING + { + if (defData->VersionNum < 5.6) { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if ((defData->pinWarnings++ < defData->settings->PinWarnings) && + (defData->pinWarnings++ < defData->settings->PinExtWarnings)) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The SUPPLYSENSITIVITY statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6507, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } else { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) + defData->Pin.setSupplySens($4); + } + } + + | '+' K_GROUNDSENSITIVITY { defData->dumb_mode = 1; } T_STRING + { + if (defData->VersionNum < 5.6) { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if ((defData->pinWarnings++ < defData->settings->PinWarnings) && + (defData->pinWarnings++ < defData->settings->PinExtWarnings)) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The GROUNDSENSITIVITY statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6508, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } else { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) + defData->Pin.setGroundSens($4); + } + } + + | '+' K_USE use_type + { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) defData->Pin.setUse($3); + } + | '+' K_PORT // 5.7 + { + if (defData->VersionNum < 5.7) { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if ((defData->pinWarnings++ < defData->settings->PinWarnings) && + (defData->pinWarnings++ < defData->settings->PinExtWarnings)) { + defData->defMsg = (char*)malloc(10000); + sprintf (defData->defMsg, + "The PORT in PINS is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6555, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } else { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) + defData->Pin.addPort(); + defData->hasPort = 1; + } + } + + | '+' K_LAYER { defData->dumb_mode = 1; } T_STRING + { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if (defData->hasPort) + defData->Pin.addPortLayer($4); + else + defData->Pin.addLayer($4); + } + } + pin_layer_mask_opt pin_layer_spacing_opt pt pt + { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if (defData->hasPort) + defData->Pin.addPortLayerPts($8.x, $8.y, $9.x, $9.y); + else + defData->Pin.addLayerPts($8.x, $8.y, $9.x, $9.y); + } + } + + | '+' K_POLYGON { defData->dumb_mode = 1; } T_STRING + { + if (defData->VersionNum < 5.6) { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if ((defData->pinWarnings++ < defData->settings->PinWarnings) && + (defData->pinWarnings++ < defData->settings->PinExtWarnings)) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The POLYGON statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6509, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } else { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if (defData->hasPort) + defData->Pin.addPortPolygon($4); + else + defData->Pin.addPolygon($4); + } + } + + defData->Geometries.Reset(); + } + pin_poly_mask_opt pin_poly_spacing_opt firstPt nextPt nextPt otherPts + { + if (defData->VersionNum >= 5.6) { // only add if 5.6 or beyond + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if (defData->hasPort) + defData->Pin.addPortPolygonPts(&defData->Geometries); + else + defData->Pin.addPolygonPts(&defData->Geometries); + } + } + } + | '+' K_VIA { defData->dumb_mode = 1; } T_STRING pin_via_mask_opt '(' NUMBER NUMBER ')' // 5.7 + { + if (defData->VersionNum < 5.7) { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if ((defData->pinWarnings++ < defData->settings->PinWarnings) && + (defData->pinWarnings++ < defData->settings->PinExtWarnings)) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The PIN VIA statement is available in version 5.7 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6556, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } else { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if (defData->hasPort) + defData->Pin.addPortVia($4, (int)$7, + (int)$8, $5); + else + defData->Pin.addVia($4, (int)$7, + (int)$8, $5); + } + } + } + + | placement_status pt orient + { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if (defData->hasPort) { + defData->Pin.setPortPlacement($1, $2.x, $2.y, $3); + defData->hasPort = 0; + } else + defData->Pin.setPlacement($1, $2.x, $2.y, $3); + } + } + + // The following is 5.4 syntax + | '+' K_ANTENNAPINPARTIALMETALAREA NUMBER pin_layer_opt + { + if (defData->VersionNum <= 5.3) { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if ((defData->pinWarnings++ < defData->settings->PinWarnings) && + (defData->pinWarnings++ < defData->settings->PinExtWarnings)) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The ANTENNAPINPARTIALMETALAREA statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6510, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) + defData->Pin.addAPinPartialMetalArea((int)$3, $4); + } + | '+' K_ANTENNAPINPARTIALMETALSIDEAREA NUMBER pin_layer_opt + { + if (defData->VersionNum <= 5.3) { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if ((defData->pinWarnings++ < defData->settings->PinWarnings) && + (defData->pinWarnings++ < defData->settings->PinExtWarnings)) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The ANTENNAPINPARTIALMETALSIDEAREA statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6511, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) + defData->Pin.addAPinPartialMetalSideArea((int)$3, $4); + } + | '+' K_ANTENNAPINGATEAREA NUMBER pin_layer_opt + { + if (defData->VersionNum <= 5.3) { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if ((defData->pinWarnings++ < defData->settings->PinWarnings) && + (defData->pinWarnings++ < defData->settings->PinExtWarnings)) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The ANTENNAPINGATEAREA statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6512, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) + defData->Pin.addAPinGateArea((int)$3, $4); + } + | '+' K_ANTENNAPINDIFFAREA NUMBER pin_layer_opt + { + if (defData->VersionNum <= 5.3) { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if ((defData->pinWarnings++ < defData->settings->PinWarnings) && + (defData->pinWarnings++ < defData->settings->PinExtWarnings)) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The ANTENNAPINDIFFAREA statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6513, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) + defData->Pin.addAPinDiffArea((int)$3, $4); + } + | '+' K_ANTENNAPINMAXAREACAR NUMBER K_LAYER {defData->dumb_mode=1;} T_STRING + { + if (defData->VersionNum <= 5.3) { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if ((defData->pinWarnings++ < defData->settings->PinWarnings) && + (defData->pinWarnings++ < defData->settings->PinExtWarnings)) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The ANTENNAPINMAXAREACAR statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6514, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) + defData->Pin.addAPinMaxAreaCar((int)$3, $6); + } + | '+' K_ANTENNAPINMAXSIDEAREACAR NUMBER K_LAYER {defData->dumb_mode=1;} + T_STRING + { + if (defData->VersionNum <= 5.3) { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if ((defData->pinWarnings++ < defData->settings->PinWarnings) && + (defData->pinWarnings++ < defData->settings->PinExtWarnings)) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The ANTENNAPINMAXSIDEAREACAR statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6515, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) + defData->Pin.addAPinMaxSideAreaCar((int)$3, $6); + } + | '+' K_ANTENNAPINPARTIALCUTAREA NUMBER pin_layer_opt + { + if (defData->VersionNum <= 5.3) { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if ((defData->pinWarnings++ < defData->settings->PinWarnings) && + (defData->pinWarnings++ < defData->settings->PinExtWarnings)) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The ANTENNAPINPARTIALCUTAREA statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6516, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) + defData->Pin.addAPinPartialCutArea((int)$3, $4); + } + | '+' K_ANTENNAPINMAXCUTCAR NUMBER K_LAYER {defData->dumb_mode=1;} T_STRING + { + if (defData->VersionNum <= 5.3) { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if ((defData->pinWarnings++ < defData->settings->PinWarnings) && + (defData->pinWarnings++ < defData->settings->PinExtWarnings)) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The ANTENNAPINMAXCUTCAR statement is available in version 5.4 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6517, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) + defData->Pin.addAPinMaxCutCar((int)$3, $6); + } + | '+' K_ANTENNAMODEL pin_oxide + { // 5.5 syntax + if (defData->VersionNum < 5.5) { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if ((defData->pinWarnings++ < defData->settings->PinWarnings) && + (defData->pinWarnings++ < defData->settings->PinExtWarnings)) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The ANTENNAMODEL statement is available in version 5.5 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6518, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } + } + +pin_layer_mask_opt: // empty + | K_MASK NUMBER + { + if (defData->validateMaskInput((int)$2, defData->pinWarnings, defData->settings->PinWarnings)) { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if (defData->hasPort) + defData->Pin.addPortLayerMask((int)$2); + else + defData->Pin.addLayerMask((int)$2); + } + } + } + +pin_via_mask_opt: + // empty + { $$ = 0; } + | K_MASK NUMBER + { + if (defData->validateMaskInput((int)$2, defData->pinWarnings, defData->settings->PinWarnings)) { + $$ = $2; + } + } + +pin_poly_mask_opt: // empty + | K_MASK NUMBER + { + if (defData->validateMaskInput((int)$2, defData->pinWarnings, defData->settings->PinWarnings)) { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if (defData->hasPort) + defData->Pin.addPortPolyMask((int)$2); + else + defData->Pin.addPolyMask((int)$2); + } + } + } + + +pin_layer_spacing_opt: // empty + | K_SPACING NUMBER + { + if (defData->VersionNum < 5.6) { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if ((defData->pinWarnings++ < defData->settings->PinWarnings) && + (defData->pinWarnings++ < defData->settings->PinExtWarnings)) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The SPACING statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6519, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } else { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if (defData->hasPort) + defData->Pin.addPortLayerSpacing((int)$2); + else + defData->Pin.addLayerSpacing((int)$2); + } + } + } + | K_DESIGNRULEWIDTH NUMBER + { + if (defData->VersionNum < 5.6) { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if ((defData->pinWarnings++ < defData->settings->PinWarnings) && + (defData->pinWarnings++ < defData->settings->PinExtWarnings)) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "DESIGNRULEWIDTH statement is a version 5.6 and later syntax.\nYour def file is defined with version %g", defData->VersionNum); + defData->defError(6520, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } else { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if (defData->hasPort) + defData->Pin.addPortLayerDesignRuleWidth((int)$2); + else + defData->Pin.addLayerDesignRuleWidth((int)$2); + } + } + } + +pin_poly_spacing_opt: // empty + | K_SPACING NUMBER + { + if (defData->VersionNum < 5.6) { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if ((defData->pinWarnings++ < defData->settings->PinWarnings) && + (defData->pinWarnings++ < defData->settings->PinExtWarnings)) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "SPACING statement is a version 5.6 and later syntax.\nYour def file is defined with version %g", defData->VersionNum); + defData->defError(6521, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } else { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if (defData->hasPort) + defData->Pin.addPortPolySpacing((int)$2); + else + defData->Pin.addPolySpacing((int)$2); + } + } + } + | K_DESIGNRULEWIDTH NUMBER + { + if (defData->VersionNum < 5.6) { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if ((defData->pinWarnings++ < defData->settings->PinWarnings) && + (defData->pinWarnings++ < defData->settings->PinExtWarnings)) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The DESIGNRULEWIDTH statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6520, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } else { + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) { + if (defData->hasPort) + defData->Pin.addPortPolyDesignRuleWidth((int)$2); + else + defData->Pin.addPolyDesignRuleWidth((int)$2); + } + } + } + +pin_oxide: K_OXIDE1 + { defData->aOxide = 1; + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) + defData->Pin.addAntennaModel(defData->aOxide); + } + | K_OXIDE2 + { defData->aOxide = 2; + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) + defData->Pin.addAntennaModel(defData->aOxide); + } + | K_OXIDE3 + { defData->aOxide = 3; + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) + defData->Pin.addAntennaModel(defData->aOxide); + } + | K_OXIDE4 + { defData->aOxide = 4; + if (defData->callbacks->PinCbk || defData->callbacks->PinExtCbk) + defData->Pin.addAntennaModel(defData->aOxide); + } + +use_type: K_SIGNAL + { $$ = (char*)"SIGNAL"; } + | K_POWER + { $$ = (char*)"POWER"; } + | K_GROUND + { $$ = (char*)"GROUND"; } + | K_CLOCK + { $$ = (char*)"CLOCK"; } + | K_TIEOFF + { $$ = (char*)"TIEOFF"; } + | K_ANALOG + { $$ = (char*)"ANALOG"; } + | K_SCAN + { $$ = (char*)"SCAN"; } + | K_RESET + { $$ = (char*)"RESET"; } + +pin_layer_opt: + // empty + { $$ = (char*)""; } + | K_LAYER {defData->dumb_mode=1;} T_STRING + { $$ = $3; } + +end_pins: K_END K_PINS + { + if (defData->callbacks->PinEndCbk) + CALLBACK(defData->callbacks->PinEndCbk, defrPinEndCbkType, 0); + } + +row_rule: K_ROW {defData->dumb_mode = 2; defData->no_num = 2; } T_STRING T_STRING NUMBER NUMBER + orient + { + if (defData->callbacks->RowCbk) { + defData->rowName = $3; + defData->Row.setup($3, $4, $5, $6, $7); + } + } + row_do_option + row_options ';' + { + if (defData->callbacks->RowCbk) + CALLBACK(defData->callbacks->RowCbk, defrRowCbkType, &defData->Row); + } + +row_do_option: // empty + { + if (defData->VersionNum < 5.6) { + if (defData->callbacks->RowCbk) { + if (defData->rowWarnings++ < defData->settings->RowWarnings) { + defData->defError(6523, "Invalid ROW statement defined in the DEF file. The DO statement which is required in the ROW statement is not defined.\nUpdate your DEF file with a DO statement."); + CHKERR(); + } + } + } + } + | K_DO NUMBER K_BY NUMBER row_step_option + { + // 06/05/2002 - pcr 448455 + // Check for 1 and 0 in the correct position + // 07/26/2002 - Commented out due to pcr 459218 + if (defData->hasDoStep) { + // 04/29/2004 - pcr 695535 + // changed the testing + if ((($4 == 1) && (defData->yStep == 0)) || + (($2 == 1) && (defData->xStep == 0))) { + // do nothing + } else + if (defData->VersionNum < 5.6) { + if (defData->callbacks->RowCbk) { + if (defData->rowWarnings++ < defData->settings->RowWarnings) { + defData->defMsg = (char*)malloc(1000); + sprintf(defData->defMsg, + "The DO statement in the ROW statement with the name %s has invalid syntax.\nThe valid syntax is \"DO numX BY 1 STEP spaceX 0 | DO 1 BY numY STEP 0 spaceY\".\nSpecify the valid syntax and try again.", defData->rowName); + defData->defWarning(7018, defData->defMsg); + free(defData->defMsg); + } + } + } + } + // pcr 459218 - Error if at least numX or numY does not equal 1 + if (($2 != 1) && ($4 != 1)) { + if (defData->callbacks->RowCbk) { + if (defData->rowWarnings++ < defData->settings->RowWarnings) { + defData->defError(6524, "Invalid syntax specified. The valid syntax is either \"DO 1 BY num or DO num BY 1\". Specify the valid syntax and try again."); + CHKERR(); + } + } + } + if (defData->callbacks->RowCbk) + defData->Row.setDo(ROUND($2), ROUND($4), defData->xStep, defData->yStep); + } + +row_step_option: // empty + { + defData->hasDoStep = 0; + } + | K_STEP NUMBER NUMBER + { + defData->hasDoStep = 1; + defData->Row.setHasDoStep(); + defData->xStep = $2; + defData->yStep = $3; + } + +row_options: // empty + | row_options row_option + ; + +row_option : '+' K_PROPERTY {defData->dumb_mode = DEF_MAX_INT; } + row_prop_list + { defData->dumb_mode = 0; } + +row_prop_list : // empty + | row_prop_list row_prop + ; + +row_prop : T_STRING NUMBER + { + if (defData->callbacks->RowCbk) { + char propTp; + char* str = defData->ringCopy(" "); + propTp = defData->session->RowProp.propType($1); + CHKPROPTYPE(propTp, $1, "ROW"); + // For backword compatibility, also set the string value + sprintf(str, "%g", $2); + defData->Row.addNumProperty($1, $2, str, propTp); + } + } + | T_STRING QSTRING + { + if (defData->callbacks->RowCbk) { + char propTp; + propTp = defData->session->RowProp.propType($1); + CHKPROPTYPE(propTp, $1, "ROW"); + defData->Row.addProperty($1, $2, propTp); + } + } + | T_STRING T_STRING + { + if (defData->callbacks->RowCbk) { + char propTp; + propTp = defData->session->RowProp.propType($1); + CHKPROPTYPE(propTp, $1, "ROW"); + defData->Row.addProperty($1, $2, propTp); + } + } + +tracks_rule: track_start NUMBER + { + if (defData->callbacks->TrackCbk) { + defData->Track.setup($1); + } + } + K_DO NUMBER K_STEP NUMBER track_opts ';' + { + if (($5 <= 0) && (defData->VersionNum >= 5.4)) { + if (defData->callbacks->TrackCbk) + if (defData->trackWarnings++ < defData->settings->TrackWarnings) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The DO number %g in TRACK is invalid.\nThe number value has to be greater than 0. Specify the valid syntax and try again.", $5); + defData->defError(6525, defData->defMsg); + free(defData->defMsg); + } + } + if ($7 < 0) { + if (defData->callbacks->TrackCbk) + if (defData->trackWarnings++ < defData->settings->TrackWarnings) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The STEP number %g in TRACK is invalid.\nThe number value has to be greater than 0. Specify the valid syntax and try again.", $7); + defData->defError(6526, defData->defMsg); + free(defData->defMsg); + } + } + if (defData->callbacks->TrackCbk) { + defData->Track.setDo(ROUND($2), ROUND($5), $7); + CALLBACK(defData->callbacks->TrackCbk, defrTrackCbkType, &defData->Track); + } + } + +track_start: K_TRACKS track_type + { + $$ = $2; + } + +track_type: K_X + { $$ = (char*)"X";} + | K_Y + { $$ = (char*)"Y";} + +track_opts: track_mask_statement track_layer_statement + +track_mask_statement: // empty + | K_MASK NUMBER same_mask + { + if (defData->validateMaskInput((int)$2, defData->trackWarnings, defData->settings->TrackWarnings)) { + if (defData->callbacks->TrackCbk) { + defData->Track.addMask($2, $3); + } + } + } + +same_mask: + // empty + { $$ = 0; } + | K_SAMEMASK + { $$ = 1; } + +track_layer_statement: // empty + | K_LAYER { defData->dumb_mode = 1000; } track_layer track_layers + { defData->dumb_mode = 0; } + +track_layers: // empty + | track_layer track_layers + ; + +track_layer: T_STRING + { + if (defData->callbacks->TrackCbk) + defData->Track.addLayer($1); + } + +gcellgrid: K_GCELLGRID track_type NUMBER + K_DO NUMBER K_STEP NUMBER ';' + { + if ($5 <= 0) { + if (defData->callbacks->GcellGridCbk) + if (defData->gcellGridWarnings++ < defData->settings->GcellGridWarnings) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The DO number %g in GCELLGRID is invalid.\nThe number value has to be greater than 0. Specify the valid syntax and try again.", $5); + defData->defError(6527, defData->defMsg); + free(defData->defMsg); + } + } + if ($7 < 0) { + if (defData->callbacks->GcellGridCbk) + if (defData->gcellGridWarnings++ < defData->settings->GcellGridWarnings) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The STEP number %g in GCELLGRID is invalid.\nThe number value has to be greater than 0. Specify the valid syntax and try again.", $7); + defData->defError(6528, defData->defMsg); + free(defData->defMsg); + } + } + if (defData->callbacks->GcellGridCbk) { + defData->GcellGrid.setup($2, ROUND($3), ROUND($5), $7); + CALLBACK(defData->callbacks->GcellGridCbk, defrGcellGridCbkType, &defData->GcellGrid); + } + } + +extension_section: K_BEGINEXT + { + if (defData->callbacks->ExtensionCbk) + CALLBACK(defData->callbacks->ExtensionCbk, defrExtensionCbkType, &defData->History_text[0]); + } + +extension_stmt: '+' K_BEGINEXT + { } + +via_section: via via_declarations via_end + ; + +via: K_VIAS NUMBER ';' + { + if (defData->callbacks->ViaStartCbk) + CALLBACK(defData->callbacks->ViaStartCbk, defrViaStartCbkType, ROUND($2)); + } + +via_declarations: // empty + | via_declarations via_declaration + ; + +via_declaration: '-' {defData->dumb_mode = 1;defData->no_num = 1; } T_STRING + { + if (defData->callbacks->ViaCbk) defData->Via.setup($3); + defData->viaRule = 0; + } + layer_stmts ';' + { + if (defData->callbacks->ViaCbk) + CALLBACK(defData->callbacks->ViaCbk, defrViaCbkType, &defData->Via); + defData->Via.clear(); + } + +layer_stmts: // empty + | layer_stmts layer_stmt + ; + +layer_stmt: '+' K_RECT {defData->dumb_mode = 1;defData->no_num = 1; } T_STRING mask pt pt + { + if (defData->callbacks->ViaCbk) + if (defData->validateMaskInput($5, defData->viaWarnings, defData->settings->ViaWarnings)) { + defData->Via.addLayer($4, $6.x, $6.y, $7.x, $7.y, $5); + } + } + | '+' K_POLYGON { defData->dumb_mode = 1; } T_STRING mask + { + if (defData->VersionNum < 5.6) { + if (defData->callbacks->ViaCbk) { + if (defData->viaWarnings++ < defData->settings->ViaWarnings) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The POLYGON statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6509, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } + + defData->Geometries.Reset(); + + } + firstPt nextPt nextPt otherPts + { + if (defData->VersionNum >= 5.6) { // only add if 5.6 or beyond + if (defData->callbacks->ViaCbk) + if (defData->validateMaskInput($5, defData->viaWarnings, defData->settings->ViaWarnings)) { + defData->Via.addPolygon($4, &defData->Geometries, $5); + } + } + } + | '+' K_PATTERNNAME {defData->dumb_mode = 1;defData->no_num = 1; } T_STRING + { + if (defData->VersionNum < 5.6) { + if (defData->callbacks->ViaCbk) + defData->Via.addPattern($4); + } else + if (defData->callbacks->ViaCbk) + if (defData->viaWarnings++ < defData->settings->ViaWarnings) + defData->defWarning(7019, "The PATTERNNAME statement is obsolete in version 5.6 and later.\nThe DEF parser will ignore this statement."); + } + | '+' K_VIARULE {defData->dumb_mode = 1;defData->no_num = 1; } T_STRING + '+' K_CUTSIZE NUMBER NUMBER + '+' K_LAYERS {defData->dumb_mode = 3;defData->no_num = 1; } T_STRING T_STRING T_STRING + '+' K_CUTSPACING NUMBER NUMBER + '+' K_ENCLOSURE NUMBER NUMBER NUMBER NUMBER + { + defData->viaRule = 1; + if (defData->VersionNum < 5.6) { + if (defData->callbacks->ViaCbk) { + if (defData->viaWarnings++ < defData->settings->ViaWarnings) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The VIARULE statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6557, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } else { + if (defData->callbacks->ViaCbk) + defData->Via.addViaRule($4, (int)$7, (int)$8, $12, $13, + $14, (int)$17, (int)$18, (int)$21, + (int)$22, (int)$23, (int)$24); + } + } + | layer_viarule_opts + | extension_stmt + { + if (defData->callbacks->ViaExtCbk) + CALLBACK(defData->callbacks->ViaExtCbk, defrViaExtCbkType, &defData->History_text[0]); + } + +layer_viarule_opts: '+' K_ROWCOL NUMBER NUMBER + { + if (!defData->viaRule) { + if (defData->callbacks->ViaCbk) { + if (defData->viaWarnings++ < defData->settings->ViaWarnings) { + defData->defError(6559, "The ROWCOL statement is missing from the VIARULE statement. Ensure that it exists in the VIARULE statement."); + CHKERR(); + } + } + } else if (defData->callbacks->ViaCbk) + defData->Via.addRowCol((int)$3, (int)$4); + } + | '+' K_ORIGIN NUMBER NUMBER + { + if (!defData->viaRule) { + if (defData->callbacks->ViaCbk) { + if (defData->viaWarnings++ < defData->settings->ViaWarnings) { + defData->defError(6560, "The ORIGIN statement is missing from the VIARULE statement. Ensure that it exists in the VIARULE statement."); + CHKERR(); + } + } + } else if (defData->callbacks->ViaCbk) + defData->Via.addOrigin((int)$3, (int)$4); + } + | '+' K_OFFSET NUMBER NUMBER NUMBER NUMBER + { + if (!defData->viaRule) { + if (defData->callbacks->ViaCbk) { + if (defData->viaWarnings++ < defData->settings->ViaWarnings) { + defData->defError(6561, "The OFFSET statement is missing from the VIARULE statement. Ensure that it exists in the VIARULE statement."); + CHKERR(); + } + } + } else if (defData->callbacks->ViaCbk) + defData->Via.addOffset((int)$3, (int)$4, (int)$5, (int)$6); + } + | '+' K_PATTERN {defData->dumb_mode = 1;defData->no_num = 1; } T_STRING + { + if (!defData->viaRule) { + if (defData->callbacks->ViaCbk) { + if (defData->viaWarnings++ < defData->settings->ViaWarnings) { + defData->defError(6562, "The PATTERN statement is missing from the VIARULE statement. Ensure that it exists in the VIARULE statement."); + CHKERR(); + } + } + } else if (defData->callbacks->ViaCbk) + defData->Via.addCutPattern($4); + } + +firstPt: pt + { defData->Geometries.startList($1.x, $1.y); } + +nextPt: pt + { defData->Geometries.addToList($1.x, $1.y); } + +otherPts: // empty + | otherPts nextPt + ; + +pt: '(' NUMBER NUMBER ')' + { + defData->save_x = $2; + defData->save_y = $3; + $$.x = ROUND($2); + $$.y = ROUND($3); + } + | '(' '*' NUMBER ')' + { + defData->save_y = $3; + $$.x = ROUND(defData->save_x); + $$.y = ROUND($3); + } + | '(' NUMBER '*' ')' + { + defData->save_x = $2; + $$.x = ROUND($2); + $$.y = ROUND(defData->save_y); + } + | '(' '*' '*' ')' + { + $$.x = ROUND(defData->save_x); + $$.y = ROUND(defData->save_y); + } + +mask: // empty + { $$ = 0; } + | '+' K_MASK NUMBER + { $$ = $3; } + +via_end: K_END K_VIAS + { + if (defData->callbacks->ViaEndCbk) + CALLBACK(defData->callbacks->ViaEndCbk, defrViaEndCbkType, 0); + } + +regions_section: regions_start regions_stmts K_END K_REGIONS + { + if (defData->callbacks->RegionEndCbk) + CALLBACK(defData->callbacks->RegionEndCbk, defrRegionEndCbkType, 0); + } + +regions_start: K_REGIONS NUMBER ';' + { + if (defData->callbacks->RegionStartCbk) + CALLBACK(defData->callbacks->RegionStartCbk, defrRegionStartCbkType, ROUND($2)); + } + +regions_stmts: // empty + | regions_stmts regions_stmt + {} + +regions_stmt: '-' { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING + { + if (defData->callbacks->RegionCbk) + defData->Region.setup($3); + defData->regTypeDef = 0; + } + rect_list region_options ';' + { CALLBACK(defData->callbacks->RegionCbk, defrRegionCbkType, &defData->Region); } + +rect_list : + pt pt + { if (defData->callbacks->RegionCbk) + defData->Region.addRect($1.x, $1.y, $2.x, $2.y); } + | rect_list pt pt + { if (defData->callbacks->RegionCbk) + defData->Region.addRect($2.x, $2.y, $3.x, $3.y); } + ; + +region_options: // empty + | region_options region_option + ; + +region_option : '+' K_PROPERTY {defData->dumb_mode = DEF_MAX_INT; } + region_prop_list + { defData->dumb_mode = 0; } + | '+' K_TYPE region_type // 5.4.1 + { + if (defData->regTypeDef) { + if (defData->callbacks->RegionCbk) { + if (defData->regionWarnings++ < defData->settings->RegionWarnings) { + defData->defError(6563, "The TYPE statement already exists. It has been defined in the REGION statement."); + CHKERR(); + } + } + } + if (defData->callbacks->RegionCbk) defData->Region.setType($3); + defData->regTypeDef = 1; + } + ; + +region_prop_list : // empty + | region_prop_list region_prop + ; + +region_prop : T_STRING NUMBER + { + if (defData->callbacks->RegionCbk) { + char propTp; + char* str = defData->ringCopy(" "); + propTp = defData->session->RegionProp.propType($1); + CHKPROPTYPE(propTp, $1, "REGION"); + // For backword compatibility, also set the string value + // We will use a temporary string to store the number. + // The string space is borrowed from the ring buffer + // in the lexer. + sprintf(str, "%g", $2); + defData->Region.addNumProperty($1, $2, str, propTp); + } + } + | T_STRING QSTRING + { + if (defData->callbacks->RegionCbk) { + char propTp; + propTp = defData->session->RegionProp.propType($1); + CHKPROPTYPE(propTp, $1, "REGION"); + defData->Region.addProperty($1, $2, propTp); + } + } + | T_STRING T_STRING + { + if (defData->callbacks->RegionCbk) { + char propTp; + propTp = defData->session->RegionProp.propType($1); + CHKPROPTYPE(propTp, $1, "REGION"); + defData->Region.addProperty($1, $2, propTp); + } + } + +region_type: K_FENCE + { $$ = (char*)"FENCE"; } + | K_GUIDE + { $$ = (char*)"GUIDE"; } + +comps_maskShift_section : K_COMPSMASKSHIFT layer_statement ';' + { + if (defData->VersionNum < 5.8) { + if (defData->componentWarnings++ < defData->settings->ComponentWarnings) { + defData->defMsg = (char*)malloc(10000); + sprintf (defData->defMsg, + "The MASKSHIFT statement is available in version 5.8 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); + defData->defError(7415, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + if (defData->callbacks->ComponentMaskShiftLayerCbk) { + CALLBACK(defData->callbacks->ComponentMaskShiftLayerCbk, defrComponentMaskShiftLayerCbkType, &defData->ComponentMaskShiftLayer); + } + } + +comps_section: start_comps comps_rule end_comps + ; + +start_comps: K_COMPS NUMBER ';' + { + if (defData->callbacks->ComponentStartCbk) + CALLBACK(defData->callbacks->ComponentStartCbk, defrComponentStartCbkType, + ROUND($2)); + } + +layer_statement : // empty + | layer_statement maskLayer + ; + +maskLayer: T_STRING + { + if (defData->callbacks->ComponentMaskShiftLayerCbk) { + defData->ComponentMaskShiftLayer.addMaskShiftLayer($1); + } + } + +comps_rule: // empty + | comps_rule comp + ; + +comp: comp_start comp_options ';' + { + if (defData->callbacks->ComponentCbk) + CALLBACK(defData->callbacks->ComponentCbk, defrComponentCbkType, &defData->Component); + } + +comp_start: comp_id_and_name comp_net_list + { + defData->dumb_mode = 0; + defData->no_num = 0; + } + +comp_id_and_name: '-' {defData->dumb_mode = DEF_MAX_INT; defData->no_num = DEF_MAX_INT; } + T_STRING T_STRING + { + if (defData->callbacks->ComponentCbk) + defData->Component.IdAndName($3, $4); + } + +comp_net_list: // empty + { } + | comp_net_list '*' + { + if (defData->callbacks->ComponentCbk) + defData->Component.addNet("*"); + } + | comp_net_list T_STRING + { + if (defData->callbacks->ComponentCbk) + defData->Component.addNet($2); + } + +comp_options: // empty + | comp_options comp_option + ; + +comp_option: comp_generate | comp_source | comp_type | weight | maskShift | + comp_foreign | comp_region | comp_eeq | comp_halo | + comp_routehalo | comp_property | comp_extension_stmt + ; + +comp_extension_stmt: extension_stmt + { + if (defData->callbacks->ComponentCbk) + CALLBACK(defData->callbacks->ComponentExtCbk, defrComponentExtCbkType, + &defData->History_text[0]); + } + +comp_eeq: '+' K_EEQMASTER {defData->dumb_mode=1; defData->no_num = 1; } T_STRING + { + if (defData->callbacks->ComponentCbk) + defData->Component.setEEQ($4); + } + +comp_generate: '+' K_COMP_GEN { defData->dumb_mode = 2; defData->no_num = 2; } T_STRING + opt_pattern + { + if (defData->callbacks->ComponentCbk) + defData->Component.setGenerate($4, $5); + } +opt_pattern : + // empty + { $$ = (char*)""; } + | T_STRING + { $$ = $1; } + +comp_source: '+' K_SOURCE source_type + { + if (defData->callbacks->ComponentCbk) + defData->Component.setSource($3); + } + +source_type: K_NETLIST + { $$ = (char*)"NETLIST"; } + | K_DIST + { $$ = (char*)"DIST"; } + | K_USER + { $$ = (char*)"USER"; } + | K_TIMING + { $$ = (char*)"TIMING"; } + + +comp_region: + comp_region_start comp_pnt_list + { } + | comp_region_start T_STRING + { + if (defData->callbacks->ComponentCbk) + defData->Component.setRegionName($2); + } + +comp_pnt_list: pt pt + { + // 11/12/2002 - this is obsolete in 5.5, & will be ignored + if (defData->VersionNum < 5.5) { + if (defData->callbacks->ComponentCbk) + defData->Component.setRegionBounds($1.x, $1.y, + $2.x, $2.y); + } + else + defData->defWarning(7020, "The REGION pt pt statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement."); + } + | comp_pnt_list pt pt + { + // 11/12/2002 - this is obsolete in 5.5, & will be ignored + if (defData->VersionNum < 5.5) { + if (defData->callbacks->ComponentCbk) + defData->Component.setRegionBounds($2.x, $2.y, + $3.x, $3.y); + } + else + defData->defWarning(7020, "The REGION pt pt statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement."); + } + +comp_halo: '+' K_HALO // 5.7 + { + if (defData->VersionNum < 5.6) { + if (defData->callbacks->ComponentCbk) { + if (defData->componentWarnings++ < defData->settings->ComponentWarnings) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The HALO statement is a version 5.6 and later syntax.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6529, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } + } + halo_soft NUMBER NUMBER NUMBER NUMBER + { + if (defData->callbacks->ComponentCbk) + defData->Component.setHalo((int)$5, (int)$6, + (int)$7, (int)$8); + } + +halo_soft: // 5.7 + | K_SOFT + { + if (defData->VersionNum < 5.7) { + if (defData->callbacks->ComponentCbk) { + if (defData->componentWarnings++ < defData->settings->ComponentWarnings) { + defData->defMsg = (char*)malloc(10000); + sprintf (defData->defMsg, + "The HALO SOFT is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6550, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } else { + if (defData->callbacks->ComponentCbk) + defData->Component.setHaloSoft(); + } + } + +// 5.7 +comp_routehalo: '+' K_ROUTEHALO NUMBER { defData->dumb_mode = 2; defData->no_num = 2; } T_STRING T_STRING + { + if (defData->VersionNum < 5.7) { + if (defData->callbacks->ComponentCbk) { + if (defData->componentWarnings++ < defData->settings->ComponentWarnings) { + defData->defMsg = (char*)malloc(10000); + sprintf (defData->defMsg, + "The ROUTEHALO is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6551, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } else { + if (defData->callbacks->ComponentCbk) + defData->Component.setRouteHalo( + (int)$3, $5, $6); + } + } + +comp_property: '+' K_PROPERTY { defData->dumb_mode = DEF_MAX_INT; } + comp_prop_list + { defData->dumb_mode = 0; } + +comp_prop_list: comp_prop + | comp_prop_list comp_prop + ; + +comp_prop: T_STRING NUMBER + { + if (defData->callbacks->ComponentCbk) { + char propTp; + char* str = defData->ringCopy(" "); + propTp = defData->session->CompProp.propType($1); + CHKPROPTYPE(propTp, $1, "COMPONENT"); + sprintf(str, "%g", $2); + defData->Component.addNumProperty($1, $2, str, propTp); + } + } + | T_STRING QSTRING + { + if (defData->callbacks->ComponentCbk) { + char propTp; + propTp = defData->session->CompProp.propType($1); + CHKPROPTYPE(propTp, $1, "COMPONENT"); + defData->Component.addProperty($1, $2, propTp); + } + } + | T_STRING T_STRING + { + if (defData->callbacks->ComponentCbk) { + char propTp; + propTp = defData->session->CompProp.propType($1); + CHKPROPTYPE(propTp, $1, "COMPONENT"); + defData->Component.addProperty($1, $2, propTp); + } + } + +comp_region_start: '+' K_REGION + { defData->dumb_mode = 1; defData->no_num = 1; } + +comp_foreign: '+' K_FOREIGN { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING + opt_paren orient + { + if (defData->VersionNum < 5.6) { + if (defData->callbacks->ComponentCbk) { + defData->Component.setForeignName($4); + defData->Component.setForeignLocation($5.x, $5.y, $6); + } + } else + if (defData->callbacks->ComponentCbk) + if (defData->componentWarnings++ < defData->settings->ComponentWarnings) + defData->defWarning(7021, "The FOREIGN statement is obsolete in version 5.6 and later.\nThe DEF parser will ignore this statement."); + } + +opt_paren: + pt + { $$ = $1; } + | NUMBER NUMBER + { $$.x = ROUND($1); $$.y = ROUND($2); } + +comp_type: placement_status pt orient + { + if (defData->callbacks->ComponentCbk) { + defData->Component.setPlacementStatus($1); + defData->Component.setPlacementLocation($2.x, $2.y, $3); + } + } + | '+' K_UNPLACED + { + if (defData->callbacks->ComponentCbk) + defData->Component.setPlacementStatus( + DEFI_COMPONENT_UNPLACED); + defData->Component.setPlacementLocation(-1, -1, -1); + } + | '+' K_UNPLACED pt orient + { + if (defData->VersionNum < 5.4) { // PCR 495463 + if (defData->callbacks->ComponentCbk) { + defData->Component.setPlacementStatus( + DEFI_COMPONENT_UNPLACED); + defData->Component.setPlacementLocation($3.x, $3.y, $4); + } + } else { + if (defData->componentWarnings++ < defData->settings->ComponentWarnings) + defData->defWarning(7022, "In the COMPONENT UNPLACED statement, point and orient are invalid in version 5.4 and later.\nThe DEF parser will ignore this statement."); + } + } + + // Adding 'no_num' modification, otherwise the token will be parsed as number (double). +maskShift: '+' K_MASKSHIFT { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING + { + if (defData->callbacks->ComponentCbk) { + if (defData->validateMaskShiftInput($4, defData->componentWarnings, defData->settings->ComponentWarnings)) { + defData->Component.setMaskShift($4); + } + } + } + +placement_status: '+' K_FIXED + { $$ = DEFI_COMPONENT_FIXED; } + | '+' K_COVER + { $$ = DEFI_COMPONENT_COVER; } + | '+' K_PLACED + { $$ = DEFI_COMPONENT_PLACED; } + +weight: '+' K_WEIGHT NUMBER + { + if (defData->callbacks->ComponentCbk) + defData->Component.setWeight(ROUND($3)); + } + +end_comps: K_END K_COMPS + { + if (defData->callbacks->ComponentCbk) + CALLBACK(defData->callbacks->ComponentEndCbk, defrComponentEndCbkType, 0); + } + +nets_section: start_nets net_rules end_nets + ; + +start_nets: K_NETS NUMBER ';' + { + if (defData->callbacks->NetStartCbk) + CALLBACK(defData->callbacks->NetStartCbk, defrNetStartCbkType, ROUND($2)); + defData->netOsnet = 1; + } + +net_rules: // empty + | net_rules one_net + ; + +one_net: net_and_connections net_options ';' + { + if (defData->callbacks->NetCbk) + CALLBACK(defData->callbacks->NetCbk, defrNetCbkType, &defData->Net); + } +/* +** net_and_connections: net_start {defData->dumb_mode = DEF_MAX_INT; no_num = DEF_MAX_INT;} +** net_connections +** wmd -- this can be used to replace +** | '(' K_PIN {defData->dumb_mode = 1; no_num = 1;} T_STRING conn_opt ')' (???) +*/ +net_and_connections: net_start + {defData->dumb_mode = 0; defData->no_num = 0; } + +/* pcr 235555 & 236210 */ +net_start: '-' {defData->dumb_mode = DEF_MAX_INT; defData->no_num = DEF_MAX_INT; defData->nondef_is_keyword = TRUE; defData->mustjoin_is_keyword = TRUE;} net_name + +net_name: T_STRING + { + // 9/22/1999 + // this is shared by both net and special net + if ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || (defData->callbacks->SNetCbk && (defData->netOsnet==2))) + defData->Net.setName($1); + if (defData->callbacks->NetNameCbk) + CALLBACK(defData->callbacks->NetNameCbk, defrNetNameCbkType, $1); + } net_connections + | K_MUSTJOIN '(' T_STRING {defData->dumb_mode = 1; defData->no_num = 1;} T_STRING ')' + { + if ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || (defData->callbacks->SNetCbk && (defData->netOsnet==2))) + defData->Net.addMustPin($3, $5, 0); + defData->dumb_mode = 3; + defData->no_num = 3; + } + +net_connections: // empty + | net_connections net_connection + ; + +net_connection: '(' T_STRING {defData->dumb_mode = DEF_MAX_INT; defData->no_num = DEF_MAX_INT;} + T_STRING conn_opt ')' + { + // 9/22/1999 + // since the code is shared by both net & special net, + // need to check on both flags + if ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || (defData->callbacks->SNetCbk && (defData->netOsnet==2))) + defData->Net.addPin($2, $4, $5); + // 1/14/2000 - pcr 289156 + // reset defData->dumb_mode & defData->no_num to 3 , just in case + // the next statement is another net_connection + defData->dumb_mode = 3; + defData->no_num = 3; + } + | '(' '*' {defData->dumb_mode = 1; defData->no_num = 1;} T_STRING conn_opt ')' + { + if ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || (defData->callbacks->SNetCbk && (defData->netOsnet==2))) + defData->Net.addPin("*", $4, $5); + defData->dumb_mode = 3; + defData->no_num = 3; + } + | '(' K_PIN {defData->dumb_mode = 1; defData->no_num = 1;} T_STRING conn_opt ')' + { + if ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || (defData->callbacks->SNetCbk && (defData->netOsnet==2))) + defData->Net.addPin("PIN", $4, $5); + defData->dumb_mode = 3; + defData->no_num = 3; + } + +conn_opt: // empty + { $$ = 0; } + | extension_stmt + { + if (defData->callbacks->NetConnectionExtCbk) + CALLBACK(defData->callbacks->NetConnectionExtCbk, defrNetConnectionExtCbkType, + &defData->History_text[0]); + $$ = 0; + } + | '+' K_SYNTHESIZED + { $$ = 1; } + + +// These are all the optional fields for a net that go after the '+' +net_options: // empty + | net_options net_option + ; + +net_option: '+' net_type + { + if (defData->callbacks->NetCbk) defData->Net.addWire($2, NULL); + } + paths + { + defData->by_is_keyword = FALSE; + defData->do_is_keyword = FALSE; + defData->new_is_keyword = FALSE; + defData->nondef_is_keyword = FALSE; + defData->mustjoin_is_keyword = FALSE; + defData->step_is_keyword = FALSE; + defData->orient_is_keyword = FALSE; + defData->virtual_is_keyword = FALSE; + defData->rect_is_keyword = FALSE; + defData->mask_is_keyword = FALSE; + defData->needNPCbk = 0; + } + + | '+' K_SOURCE netsource_type + { if (defData->callbacks->NetCbk) defData->Net.setSource($3); } + + | '+' K_FIXEDBUMP + { + if (defData->VersionNum < 5.5) { + if (defData->callbacks->NetCbk) { + if (defData->netWarnings++ < defData->settings->NetWarnings) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The FIXEDBUMP statement is available in version 5.5 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6530, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } + if (defData->callbacks->NetCbk) defData->Net.setFixedbump(); + } + + | '+' K_FREQUENCY { defData->real_num = 1; } NUMBER + { + if (defData->VersionNum < 5.5) { + if (defData->callbacks->NetCbk) { + if (defData->netWarnings++ < defData->settings->NetWarnings) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The FREQUENCY statement is a version 5.5 and later syntax.\nHowever, your DEF file is defined with version %g", defData->VersionNum); + defData->defError(6558, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } + if (defData->callbacks->NetCbk) defData->Net.setFrequency($4); + defData->real_num = 0; + } + + | '+' K_ORIGINAL {defData->dumb_mode = 1; defData->no_num = 1;} T_STRING + { if (defData->callbacks->NetCbk) defData->Net.setOriginal($4); } + + | '+' K_PATTERN pattern_type + { if (defData->callbacks->NetCbk) defData->Net.setPattern($3); } + + | '+' K_WEIGHT NUMBER + { if (defData->callbacks->NetCbk) defData->Net.setWeight(ROUND($3)); } + + | '+' K_XTALK NUMBER + { if (defData->callbacks->NetCbk) defData->Net.setXTalk(ROUND($3)); } + + | '+' K_ESTCAP NUMBER + { if (defData->callbacks->NetCbk) defData->Net.setCap($3); } + + | '+' K_USE use_type + { if (defData->callbacks->NetCbk) defData->Net.setUse($3); } + + | '+' K_STYLE NUMBER + { if (defData->callbacks->NetCbk) defData->Net.setStyle((int)$3); } + + | '+' K_NONDEFAULTRULE { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING + { + if (defData->callbacks->NetCbk && defData->callbacks->NetNonDefaultRuleCbk) { + // User wants a callback on nondefaultrule + CALLBACK(defData->callbacks->NetNonDefaultRuleCbk, + defrNetNonDefaultRuleCbkType, $4); + } + // Still save data in the class + if (defData->callbacks->NetCbk) defData->Net.setNonDefaultRule($4); + } + + | vpin_stmt + + | '+' K_SHIELDNET { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING + { if (defData->callbacks->NetCbk) defData->Net.addShieldNet($4); } + + | '+' K_NOSHIELD { defData->dumb_mode = 1; defData->no_num = 1; } + { // since the parser still support 5.3 and earlier, can't + // move NOSHIELD in net_type + if (defData->VersionNum < 5.4) { // PCR 445209 + if (defData->callbacks->NetCbk) defData->Net.addNoShield(""); + defData->by_is_keyword = FALSE; + defData->do_is_keyword = FALSE; + defData->new_is_keyword = FALSE; + defData->step_is_keyword = FALSE; + defData->orient_is_keyword = FALSE; + defData->virtual_is_keyword = FALSE; + defData->mask_is_keyword = FALSE; + defData->rect_is_keyword = FALSE; + defData->shield = TRUE; // save the path info in the defData->shield paths + } else + if (defData->callbacks->NetCbk) defData->Net.addWire("NOSHIELD", NULL); + } + paths + { + if (defData->VersionNum < 5.4) { // PCR 445209 + defData->shield = FALSE; + defData->by_is_keyword = FALSE; + defData->do_is_keyword = FALSE; + defData->new_is_keyword = FALSE; + defData->step_is_keyword = FALSE; + defData->nondef_is_keyword = FALSE; + defData->mustjoin_is_keyword = FALSE; + defData->orient_is_keyword = FALSE; + defData->virtual_is_keyword = FALSE; + defData->rect_is_keyword = FALSE; + defData->mask_is_keyword = FALSE; + } else { + defData->by_is_keyword = FALSE; + defData->do_is_keyword = FALSE; + defData->new_is_keyword = FALSE; + defData->step_is_keyword = FALSE; + defData->nondef_is_keyword = FALSE; + defData->mustjoin_is_keyword = FALSE; + defData->orient_is_keyword = FALSE; + defData->virtual_is_keyword = FALSE; + defData->rect_is_keyword = FALSE; + defData->mask_is_keyword = FALSE; + } + defData->needNPCbk = 0; + } + + | '+' K_SUBNET + { defData->dumb_mode = 1; defData->no_num = 1; + if (defData->callbacks->NetCbk) { + defData->Subnet = new defiSubnet(defData); + } + } + T_STRING { + if (defData->callbacks->NetCbk && defData->callbacks->NetSubnetNameCbk) { + // User wants a callback on Net subnetName + CALLBACK(defData->callbacks->NetSubnetNameCbk, defrNetSubnetNameCbkType, $4); + } + // Still save the subnet name in the class + if (defData->callbacks->NetCbk) { + defData->Subnet->setName($4); + } + } + comp_names { + defData->routed_is_keyword = TRUE; + defData->fixed_is_keyword = TRUE; + defData->cover_is_keyword = TRUE; + } subnet_options { + if (defData->callbacks->NetCbk) { + defData->Net.addSubnet(defData->Subnet); + defData->Subnet = NULL; + defData->routed_is_keyword = FALSE; + defData->fixed_is_keyword = FALSE; + defData->cover_is_keyword = FALSE; + } + } + + | '+' K_PROPERTY {defData->dumb_mode = DEF_MAX_INT; } + net_prop_list + { defData->dumb_mode = 0; } + + | extension_stmt + { + if (defData->callbacks->NetExtCbk) + CALLBACK(defData->callbacks->NetExtCbk, defrNetExtCbkType, &defData->History_text[0]); + } + +net_prop_list: net_prop + | net_prop_list net_prop + ; + +net_prop: T_STRING NUMBER + { + if (defData->callbacks->NetCbk) { + char propTp; + char* str = defData->ringCopy(" "); + propTp = defData->session->NetProp.propType($1); + CHKPROPTYPE(propTp, $1, "NET"); + sprintf(str, "%g", $2); + defData->Net.addNumProp($1, $2, str, propTp); + } + } + | T_STRING QSTRING + { + if (defData->callbacks->NetCbk) { + char propTp; + propTp = defData->session->NetProp.propType($1); + CHKPROPTYPE(propTp, $1, "NET"); + defData->Net.addProp($1, $2, propTp); + } + } + | T_STRING T_STRING + { + if (defData->callbacks->NetCbk) { + char propTp; + propTp = defData->session->NetProp.propType($1); + CHKPROPTYPE(propTp, $1, "NET"); + defData->Net.addProp($1, $2, propTp); + } + } + +netsource_type: K_NETLIST + { $$ = (char*)"NETLIST"; } + | K_DIST + { $$ = (char*)"DIST"; } + | K_USER + { $$ = (char*)"USER"; } + | K_TIMING + { $$ = (char*)"TIMING"; } + | K_TEST + { $$ = (char*)"TEST"; } + +vpin_stmt: vpin_begin vpin_layer_opt pt pt + { + // vpin_options may have to deal with orient + defData->orient_is_keyword = TRUE; + } + vpin_options + { if (defData->callbacks->NetCbk) + defData->Net.addVpinBounds($3.x, $3.y, $4.x, $4.y); + defData->orient_is_keyword = FALSE; + } + +vpin_begin: '+' K_VPIN {defData->dumb_mode = 1; defData->no_num = 1;} T_STRING + { if (defData->callbacks->NetCbk) defData->Net.addVpin($4); } + +vpin_layer_opt: // empty + | K_LAYER {defData->dumb_mode=1;} T_STRING + { if (defData->callbacks->NetCbk) defData->Net.addVpinLayer($3); } + +vpin_options: // empty + | vpin_status pt orient + { if (defData->callbacks->NetCbk) defData->Net.addVpinLoc($1, $2.x, $2.y, $3); } + +vpin_status: K_PLACED + { $$ = (char*)"PLACED"; } + | K_FIXED + { $$ = (char*)"FIXED"; } + | K_COVER + { $$ = (char*)"COVER"; } + +net_type: K_FIXED + { $$ = (char*)"FIXED"; defData->dumb_mode = 1; } + | K_COVER + { $$ = (char*)"COVER"; defData->dumb_mode = 1; } + | K_ROUTED + { $$ = (char*)"ROUTED"; defData->dumb_mode = 1; } + +paths: + path // not necessary to do partial callback for net yet + { if (defData->NeedPathData && defData->callbacks->NetCbk) + defData->pathIsDone(defData->shield, 0, defData->netOsnet, &defData->needNPCbk); + } + | paths new_path + { } + +new_path: K_NEW { defData->dumb_mode = 1; } path + { if (defData->NeedPathData && defData->callbacks->NetCbk) + defData->pathIsDone(defData->shield, 0, defData->netOsnet, &defData->needNPCbk); + } + +path: T_STRING + { + if ((strcmp($1, "TAPER") == 0) || (strcmp($1, "TAPERRULE") == 0)) { + if (defData->NeedPathData && defData->callbacks->NetCbk) { + if (defData->netWarnings++ < defData->settings->NetWarnings) { + defData->defError(6531, "The layerName which is required in path is missing. Include the layerName in the path and then try again."); + CHKERR(); + } + } + // Since there is already error, the next token is insignificant + defData->dumb_mode = 1; defData->no_num = 1; + } else { + // CCR 766289 - Do not accummulate the layer information if there + // is not a callback set + if (defData->NeedPathData && defData->callbacks->NetCbk) + defData->PathObj.addLayer($1); + defData->dumb_mode = 0; defData->no_num = 0; + } + } + opt_taper_style_s path_pt + { defData->dumb_mode = DEF_MAX_INT; defData->by_is_keyword = TRUE; defData->do_is_keyword = TRUE; +/* + dumb_mode = 1; by_is_keyword = TRUE; do_is_keyword = TRUE; +*/ + defData->new_is_keyword = TRUE; defData->step_is_keyword = TRUE; + defData->orient_is_keyword = TRUE; defData->virtual_is_keyword = TRUE; + defData->mask_is_keyword = TRUE, defData->rect_is_keyword = TRUE; } + + path_item_list + + { defData->dumb_mode = 0; defData->virtual_is_keyword = FALSE; defData->mask_is_keyword = FALSE, + defData->rect_is_keyword = FALSE; } + +virtual_statement : + K_VIRTUAL virtual_pt + { + if (defData->VersionNum < 5.8) { + if (defData->callbacks->SNetCbk) { + if (defData->sNetWarnings++ < defData->settings->SNetWarnings) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The VIRTUAL statement is available in version 5.8 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); + defData->defError(6536, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } + } + +rect_statement : + K_RECT rect_pts + { + if (defData->VersionNum < 5.8) { + if (defData->callbacks->SNetCbk) { + if (defData->sNetWarnings++ < defData->settings->SNetWarnings) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The RECT statement is available in version 5.8 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); + defData->defError(6536, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } + } + + +path_item_list: // empty + | path_item_list path_item + ; + + +path_item: + T_STRING + { + if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || + (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) { + if (strcmp($1, "TAPER") == 0) + defData->PathObj.setTaper(); + else { + defData->PathObj.addVia($1); + } + } + } + | K_MASK NUMBER T_STRING + { + if (defData->validateMaskInput((int)$2, defData->sNetWarnings, defData->settings->SNetWarnings)) { + if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || + (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) { + if (strcmp($3, "TAPER") == 0) + defData->PathObj.setTaper(); + else { + defData->PathObj.addViaMask($2); + defData->PathObj.addVia($3); + } + } + } + } + | T_STRING orient + { if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || + (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) { + defData->PathObj.addVia($1); + defData->PathObj.addViaRotation($2); + } + } + | K_MASK NUMBER T_STRING orient + { + if (defData->validateMaskInput((int)$2, defData->sNetWarnings, defData->settings->SNetWarnings)) { + if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || + (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) { + defData->PathObj.addViaMask($2); + defData->PathObj.addVia($3); + defData->PathObj.addViaRotation($4); + } + } + } + | K_MASK NUMBER T_STRING K_DO NUMBER K_BY NUMBER K_STEP NUMBER NUMBER + { + if (defData->validateMaskInput((int)$2, defData->sNetWarnings, defData->settings->SNetWarnings)) { + if (($5 == 0) || ($7 == 0)) { + if (defData->NeedPathData && + defData->callbacks->SNetCbk) { + if (defData->netWarnings++ < defData->settings->NetWarnings) { + defData->defError(6533, "Either the numX or numY in the VIA DO statement has the value. The value specified is 0.\nUpdate your DEF file with the correct value and then try again.\n"); + CHKERR(); + } + } + } + if (defData->NeedPathData && (defData->callbacks->SNetCbk && (defData->netOsnet==2))) { + defData->PathObj.addViaMask($2); + defData->PathObj.addVia($3); + defData->PathObj.addViaData((int)$5, (int)$7, (int)$9, (int)$10); + } else if (defData->NeedPathData && (defData->callbacks->NetCbk && (defData->netOsnet==1))) { + if (defData->netWarnings++ < defData->settings->NetWarnings) { + defData->defError(6567, "The VIA DO statement is defined in the NET statement and is invalid.\nRemove this statement from your DEF file and try again."); + CHKERR(); + } + } + } + } + | T_STRING K_DO NUMBER K_BY NUMBER K_STEP NUMBER NUMBER + { + if (defData->VersionNum < 5.5) { + if (defData->NeedPathData && + defData->callbacks->SNetCbk) { + if (defData->netWarnings++ < defData->settings->NetWarnings) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The VIA DO statement is available in version 5.5 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); + defData->defError(6532, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } + if (($3 == 0) || ($5 == 0)) { + if (defData->NeedPathData && + defData->callbacks->SNetCbk) { + if (defData->netWarnings++ < defData->settings->NetWarnings) { + defData->defError(6533, "Either the numX or numY in the VIA DO statement has the value. The value specified is 0.\nUpdate your DEF file with the correct value and then try again.\n"); + CHKERR(); + } + } + } + if (defData->NeedPathData && (defData->callbacks->SNetCbk && (defData->netOsnet==2))) { + defData->PathObj.addVia($1); + defData->PathObj.addViaData((int)$3, (int)$5, (int)$7, (int)$8); + } else if (defData->NeedPathData && (defData->callbacks->NetCbk && (defData->netOsnet==1))) { + if (defData->netWarnings++ < defData->settings->NetWarnings) { + defData->defError(6567, "The VIA DO statement is defined in the NET statement and is invalid.\nRemove this statement from your DEF file and try again."); + CHKERR(); + } + } + } + | T_STRING orient K_DO NUMBER K_BY NUMBER K_STEP NUMBER NUMBER + { + if (defData->VersionNum < 5.5) { + if (defData->NeedPathData && + defData->callbacks->SNetCbk) { + if (defData->netWarnings++ < defData->settings->NetWarnings) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The VIA DO statement is available in version 5.5 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); + defData->defError(6532, defData->defMsg); + CHKERR(); + } + } + } + if (($4 == 0) || ($6 == 0)) { + if (defData->NeedPathData && + defData->callbacks->SNetCbk) { + if (defData->netWarnings++ < defData->settings->NetWarnings) { + defData->defError(6533, "Either the numX or numY in the VIA DO statement has the value. The value specified is 0.\nUpdate your DEF file with the correct value and then try again.\n"); + CHKERR(); + } + } + } + if (defData->NeedPathData && (defData->callbacks->SNetCbk && (defData->netOsnet==2))) { + defData->PathObj.addVia($1); + defData->PathObj.addViaRotation($2); + defData->PathObj.addViaData((int)$4, (int)$6, (int)$8, (int)$9); + } else if (defData->NeedPathData && (defData->callbacks->NetCbk && (defData->netOsnet==1))) { + if (defData->netWarnings++ < defData->settings->NetWarnings) { + defData->defError(6567, "The VIA DO statement is defined in the NET statement and is invalid.\nRemove this statement from your DEF file and try again."); + CHKERR(); + } + } + } + | K_MASK NUMBER T_STRING orient K_DO NUMBER K_BY NUMBER K_STEP NUMBER NUMBER + { + if (defData->validateMaskInput((int)$2, defData->sNetWarnings, defData->settings->SNetWarnings)) { + if (($6 == 0) || ($8 == 0)) { + if (defData->NeedPathData && + defData->callbacks->SNetCbk) { + if (defData->netWarnings++ < defData->settings->NetWarnings) { + defData->defError(6533, "Either the numX or numY in the VIA DO statement has the value. The value specified is 0.\nUpdate your DEF file with the correct value and then try again.\n"); + CHKERR(); + } + } + } + if (defData->NeedPathData && (defData->callbacks->SNetCbk && (defData->netOsnet==2))) { + defData->PathObj.addViaMask($2); + defData->PathObj.addVia($3); + defData->PathObj.addViaRotation($4);; + defData->PathObj.addViaData((int)$6, (int)$8, (int)$10, (int)$11); + } else if (defData->NeedPathData && (defData->callbacks->NetCbk && (defData->netOsnet==1))) { + if (defData->netWarnings++ < defData->settings->NetWarnings) { + defData->defError(6567, "The VIA DO statement is defined in the NET statement and is invalid.\nRemove this statement from your DEF file and try again."); + CHKERR(); + } + } + } + } + | virtual_statement + | rect_statement + | K_MASK NUMBER K_RECT { defData->dumb_mode = 6; } '(' NUMBER NUMBER NUMBER NUMBER ')' + { + if (defData->validateMaskInput((int)$2, defData->sNetWarnings, defData->settings->SNetWarnings)) { + if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || + (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) { + defData->PathObj.addMask($2); + defData->PathObj.addViaRect($6, $7, $8, $9); + } + } + } + | K_MASK NUMBER + { + if (defData->validateMaskInput((int)$2, defData->sNetWarnings, defData->settings->SNetWarnings)) { + if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || + (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) { + defData->PathObj.addMask($2); + } + } + } + path_pt + | path_pt + { + // reset defData->dumb_mode to 1 just incase the next token is a via of the path + // 2/5/2004 - pcr 686781 + defData->dumb_mode = DEF_MAX_INT; defData->by_is_keyword = TRUE; defData->do_is_keyword = TRUE; + defData->new_is_keyword = TRUE; defData->step_is_keyword = TRUE; + defData->orient_is_keyword = TRUE; + } + + +path_pt : + '(' NUMBER NUMBER ')' + { + if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || + (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) + defData->PathObj.addPoint(ROUND($2), ROUND($3)); + defData->save_x = $2; + defData->save_y = $3; + } + | '(' '*' NUMBER ')' + { + if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || + (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) + defData->PathObj.addPoint(ROUND(defData->save_x), ROUND($3)); + defData->save_y = $3; + } + | '(' NUMBER '*' ')' + { + if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || + (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) + defData->PathObj.addPoint(ROUND($2), ROUND(defData->save_y)); + defData->save_x = $2; + } + | '(' '*' '*' ')' + { + if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || + (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) + defData->PathObj.addPoint(ROUND(defData->save_x), ROUND(defData->save_y)); + } + | '(' NUMBER NUMBER NUMBER ')' + { + if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || + (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) + defData->PathObj.addFlushPoint(ROUND($2), ROUND($3), ROUND($4)); + defData->save_x = $2; + defData->save_y = $3; + } + | '(' '*' NUMBER NUMBER ')' + { + if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || + (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) + defData->PathObj.addFlushPoint(ROUND(defData->save_x), ROUND($3), + ROUND($4)); + defData->save_y = $3; + } + | '(' NUMBER '*' NUMBER ')' + { + if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || + (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) + defData->PathObj.addFlushPoint(ROUND($2), ROUND(defData->save_y), + ROUND($4)); + defData->save_x = $2; + } + | '(' '*' '*' NUMBER ')' + { + if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || + (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) + defData->PathObj.addFlushPoint(ROUND(defData->save_x), ROUND(defData->save_y), + ROUND($4)); + } + +virtual_pt : + '(' NUMBER NUMBER ')' + { + if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || + (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) + defData->PathObj.addVirtualPoint(ROUND($2), ROUND($3)); + defData->save_x = $2; + defData->save_y = $3; + } + | '(' '*' NUMBER ')' + { + if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || + (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) + defData->PathObj.addVirtualPoint(ROUND(defData->save_x), ROUND($3)); + defData->save_y = $3; + } + | '(' NUMBER '*' ')' + { + if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || + (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) + defData->PathObj.addVirtualPoint(ROUND($2), ROUND(defData->save_y)); + defData->save_x = $2; + } + | '(' '*' '*' ')' + { + if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || + (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) + defData->PathObj.addVirtualPoint(ROUND(defData->save_x), ROUND(defData->save_y)); + } + +rect_pts : + '(' NUMBER NUMBER NUMBER NUMBER ')' + { + if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || + (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) { + defData->PathObj.addViaRect($2, $3, $4, $5); + } + } + + +opt_taper_style_s: // empty + | opt_taper_style_s opt_taper_style + ; +opt_taper_style: opt_style + | opt_taper + ; + +opt_taper: K_TAPER + { if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || + (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) + defData->PathObj.setTaper(); } + | K_TAPERRULE { defData->dumb_mode = 1; } T_STRING + { if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || + (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) + defData->PathObj.addTaperRule($3); } + +opt_style: K_STYLE NUMBER + { + if (defData->VersionNum < 5.6) { + if (defData->NeedPathData && (defData->callbacks->NetCbk || + defData->callbacks->SNetCbk)) { + if (defData->netWarnings++ < defData->settings->NetWarnings) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The STYLE statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); + defData->defError(6534, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } else + if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || + (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) + defData->PathObj.addStyle((int)$2); + } + +opt_spaths: // empty + | opt_spaths opt_shape_style + ; + +opt_shape_style: + '+' K_SHAPE shape_type + { if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || + (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) + defData->PathObj.addShape($3); } + | '+' K_STYLE NUMBER + { if (defData->VersionNum < 5.6) { + if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || + (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) { + if (defData->netWarnings++ < defData->settings->NetWarnings) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The STYLE statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); + defData->defError(6534, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } else { + if (defData->NeedPathData && ((defData->callbacks->NetCbk && (defData->netOsnet==1)) || + (defData->callbacks->SNetCbk && (defData->netOsnet==2)))) + defData->PathObj.addStyle((int)$3); + } + } + +end_nets: K_END K_NETS + { + CALLBACK(defData->callbacks->NetEndCbk, defrNetEndCbkType, 0); + defData->netOsnet = 0; + } + +shape_type: K_RING + { $$ = (char*)"RING"; } + | K_STRIPE + { $$ = (char*)"STRIPE"; } + | K_FOLLOWPIN + { $$ = (char*)"FOLLOWPIN"; } + | K_IOWIRE + { $$ = (char*)"IOWIRE"; } + | K_COREWIRE + { $$ = (char*)"COREWIRE"; } + | K_BLOCKWIRE + { $$ = (char*)"BLOCKWIRE"; } + | K_FILLWIRE + { $$ = (char*)"FILLWIRE"; } + | K_FILLWIREOPC // 5.7 + { + if (defData->VersionNum < 5.7) { + if (defData->NeedPathData) { + if (defData->fillWarnings++ < defData->settings->FillWarnings) { + defData->defMsg = (char*)malloc(10000); + sprintf (defData->defMsg, + "The FILLWIREOPC is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6552, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } + $$ = (char*)"FILLWIREOPC"; + } + | K_DRCFILL + { $$ = (char*)"DRCFILL"; } + | K_BLOCKAGEWIRE + { $$ = (char*)"BLOCKAGEWIRE"; } + | K_PADRING + { $$ = (char*)"PADRING"; } + | K_BLOCKRING + { $$ = (char*)"BLOCKRING"; } + +snets_section : start_snets snet_rules end_snets + ; + +snet_rules: // empty + | snet_rules snet_rule + ; + +snet_rule: net_and_connections snet_options ';' + { CALLBACK(defData->callbacks->SNetCbk, defrSNetCbkType, &defData->Net); } + +snet_options: // empty + | snet_options snet_option + ; + +snet_option: snet_width | snet_voltage | + snet_spacing | snet_other_option + ; + +snet_other_option: '+' net_type + { + if (defData->VersionNum >= 5.8) { + defData->specialWire_routeStatus = $2; + } else { + if (defData->callbacks->SNetCbk) { // PCR 902306 + defData->defMsg = (char*)malloc(1024); + sprintf(defData->defMsg, "The SPECIAL NET statement, with type %s, does not have any net statement defined.\nThe DEF parser will ignore this statemnet.", $2); + defData->defWarning(7023, defData->defMsg); + free(defData->defMsg); + } + } + } + | '+' net_type + { + if (defData->callbacks->SNetCbk) defData->Net.addWire($2, NULL); + } + spaths + { + // 7/17/2003 - Fix for pcr 604848, add a callback for each wire + if (defData->callbacks->SNetWireCbk) { + CALLBACK(defData->callbacks->SNetWireCbk, defrSNetWireCbkType, &defData->Net); + defData->Net.freeWire(); + } + defData->by_is_keyword = FALSE; + defData->do_is_keyword = FALSE; + defData->new_is_keyword = FALSE; + defData->step_is_keyword = FALSE; + defData->orient_is_keyword = FALSE; + defData->virtual_is_keyword = FALSE; + defData->mask_is_keyword = FALSE; + defData->rect_is_keyword = FALSE; + defData->needSNPCbk = 0; + } + + | '+' K_SHIELD { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING + { defData->shieldName = $4; + defData->specialWire_routeStatus = (char*)"SHIELD"; + defData->specialWire_routeStatusName = $4; + } + shield_layer + + | '+' K_SHAPE shape_type + { + defData->specialWire_shapeType = $3; + } + | '+' K_MASK NUMBER + { + if (defData->validateMaskInput((int)$3, defData->sNetWarnings, defData->settings->SNetWarnings)) { + defData->specialWire_mask = $3; + } + } + | '+' K_POLYGON { defData->dumb_mode = 1; } T_STRING + { + if (defData->VersionNum < 5.6) { + if (defData->callbacks->SNetCbk) { + if (defData->sNetWarnings++ < defData->settings->SNetWarnings) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The POLYGON statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); + defData->defError(6535, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } + + defData->Geometries.Reset(); + } + firstPt nextPt nextPt otherPts + { + if (defData->VersionNum >= 5.6) { // only add if 5.6 or beyond + if (defData->callbacks->SNetCbk) { + // defData->needSNPCbk will indicate that it has reach the max + // memory and if user has set partialPathCBk, def parser + // will make the callback. + // This will improve performance + // This construct is only in specialnet + defData->Net.addPolygon($4, &defData->Geometries, &defData->needSNPCbk, defData->specialWire_mask, defData->specialWire_routeStatus, defData->specialWire_shapeType, + defData->specialWire_routeStatusName); + defData->specialWire_mask = 0; + defData->specialWire_routeStatus = (char*)"ROUTED"; + defData->specialWire_shapeType = (char*)""; + if (defData->needSNPCbk && defData->callbacks->SNetPartialPathCbk) { + CALLBACK(defData->callbacks->SNetPartialPathCbk, defrSNetPartialPathCbkType, + &defData->Net); + defData->Net.clearRectPolyNPath(); + defData->Net.clearVia(); + } + } + } + } + + | '+' K_RECT { defData->dumb_mode = 1; } T_STRING pt pt + { + if (defData->VersionNum < 5.6) { + if (defData->callbacks->SNetCbk) { + if (defData->sNetWarnings++ < defData->settings->SNetWarnings) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The RECT statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); + defData->defError(6536, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } + if (defData->callbacks->SNetCbk) { + // defData->needSNPCbk will indicate that it has reach the max + // memory and if user has set partialPathCBk, def parser + // will make the callback. + // This will improve performance + // This construct is only in specialnet + defData->Net.addRect($4, $5.x, $5.y, $6.x, $6.y, &defData->needSNPCbk, defData->specialWire_mask, defData->specialWire_routeStatus, defData->specialWire_shapeType, defData->specialWire_routeStatusName); + defData->specialWire_mask = 0; + defData->specialWire_routeStatus = (char*)"ROUTED"; + defData->specialWire_shapeType = (char*)""; + defData->specialWire_routeStatusName = (char*)""; + if (defData->needSNPCbk && defData->callbacks->SNetPartialPathCbk) { + CALLBACK(defData->callbacks->SNetPartialPathCbk, defrSNetPartialPathCbkType, + &defData->Net); + defData->Net.clearRectPolyNPath(); + defData->Net.clearVia(); + } + } + } + | '+' K_VIA { defData->dumb_mode = 1; } T_STRING orient_pt + { + if (defData->VersionNum < 5.8) { + if (defData->callbacks->SNetCbk) { + if (defData->sNetWarnings++ < defData->settings->SNetWarnings) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The VIA statement is available in version 5.8 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); + defData->defError(6536, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } + } + firstPt otherPts + { + if (defData->VersionNum >= 5.8 && defData->callbacks->SNetCbk) { + defData->Net.addPts($4, $5, &defData->Geometries, &defData->needSNPCbk, defData->specialWire_mask, defData->specialWire_routeStatus, defData->specialWire_shapeType, + defData->specialWire_routeStatusName); + defData->specialWire_mask = 0; + defData->specialWire_routeStatus = (char*)"ROUTED"; + defData->specialWire_shapeType = (char*)""; + defData->specialWire_routeStatusName = (char*)""; + if (defData->needSNPCbk && defData->callbacks->SNetPartialPathCbk) { + CALLBACK(defData->callbacks->SNetPartialPathCbk, defrSNetPartialPathCbkType, + &defData->Net); + defData->Net.clearRectPolyNPath(); + defData->Net.clearVia(); + } + } + } + + | '+' K_SOURCE source_type + { if (defData->callbacks->SNetCbk) defData->Net.setSource($3); } + + | '+' K_FIXEDBUMP + { if (defData->callbacks->SNetCbk) defData->Net.setFixedbump(); } + + | '+' K_FREQUENCY NUMBER + { if (defData->callbacks->SNetCbk) defData->Net.setFrequency($3); } + + | '+' K_ORIGINAL {defData->dumb_mode = 1; defData->no_num = 1;} T_STRING + { if (defData->callbacks->SNetCbk) defData->Net.setOriginal($4); } + + | '+' K_PATTERN pattern_type + { if (defData->callbacks->SNetCbk) defData->Net.setPattern($3); } + + | '+' K_WEIGHT NUMBER + { if (defData->callbacks->SNetCbk) defData->Net.setWeight(ROUND($3)); } + + | '+' K_ESTCAP NUMBER + { + // 11/12/2002 - this is obsolete in 5.5, & will be ignored + if (defData->VersionNum < 5.5) { + if (defData->callbacks->SNetCbk) { + defData->Net.setCap($3); + } + } else { + defData->defWarning(7024, "The ESTCAP statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement."); + } + } + + | '+' K_USE use_type + { if (defData->callbacks->SNetCbk) defData->Net.setUse($3); } + + | '+' K_STYLE NUMBER + { if (defData->callbacks->SNetCbk) defData->Net.setStyle((int)$3); } + + | '+' K_PROPERTY {defData->dumb_mode = DEF_MAX_INT; } + snet_prop_list + { defData->dumb_mode = 0; } + + | extension_stmt + { CALLBACK(defData->callbacks->NetExtCbk, defrNetExtCbkType, &defData->History_text[0]); } + +orient_pt: // empty + { $$ = 0; } + | K_N {$$ = 0;} + | K_W {$$ = 1;} + | K_S {$$ = 2;} + | K_E {$$ = 3;} + | K_FN {$$ = 4;} + | K_FW {$$ = 5;} + | K_FS {$$ = 6;} + | K_FE {$$ = 7;} + +shield_layer: // PCR 902306 + { + if (defData->callbacks->SNetCbk) { + if (defData->VersionNum < 5.8) { + defData->defMsg = (char*)malloc(1024); + sprintf(defData->defMsg, "The SPECIAL NET SHIELD statement doesn't have routing points definition.\nWill be ignored."); + defData->defWarning(7025, defData->defMsg); + free(defData->defMsg); + } else { // CCR 1244433 + defData->specialWire_routeStatus = (char*)"SHIELD"; + defData->specialWire_routeStatusName = defData->shieldName; + } + } + } + | + { // since the parser still supports 5.3 and earlier, + // can't just move SHIELD in net_type + if (defData->VersionNum < 5.4) { // PCR 445209 + if (defData->callbacks->SNetCbk) defData->Net.addShield(defData->shieldName); + defData->by_is_keyword = FALSE; + defData->do_is_keyword = FALSE; + defData->new_is_keyword = FALSE; + defData->step_is_keyword = FALSE; + defData->orient_is_keyword = FALSE; + defData->virtual_is_keyword = FALSE; + defData->mask_is_keyword = FALSE; + defData->rect_is_keyword = FALSE; + defData->specialWire_routeStatus = (char*)"ROUTED"; + defData->specialWire_routeStatusName = (char*)""; + defData->shield = TRUE; // save the path info in the defData->shield paths + } else + if (defData->callbacks->SNetCbk) defData->Net.addWire("SHIELD", defData->shieldName); + defData->specialWire_routeStatus = (char*)"ROUTED"; + defData->specialWire_routeStatusName = (char*)""; + } + spaths + { + // 7/17/2003 - Fix for pcr 604848, add a callback for each wire + if (defData->callbacks->SNetWireCbk) { + CALLBACK(defData->callbacks->SNetWireCbk, defrSNetWireCbkType, &defData->Net); + if (defData->VersionNum < 5.4) + defData->Net.freeShield(); + else + defData->Net.freeWire(); + } + if (defData->VersionNum < 5.4) { // PCR 445209 + defData->shield = FALSE; + defData->by_is_keyword = FALSE; + defData->do_is_keyword = FALSE; + defData->new_is_keyword = FALSE; + defData->step_is_keyword = FALSE; + defData->nondef_is_keyword = FALSE; + defData->mustjoin_is_keyword = FALSE; + defData->orient_is_keyword = FALSE; + defData->virtual_is_keyword = FALSE; + defData->mask_is_keyword = FALSE; + defData->rect_is_keyword = FALSE; + } else { + defData->by_is_keyword = FALSE; + defData->do_is_keyword = FALSE; + defData->new_is_keyword = FALSE; + defData->step_is_keyword = FALSE; + defData->orient_is_keyword = FALSE; + defData->virtual_is_keyword = FALSE; + defData->mask_is_keyword = FALSE; + defData->rect_is_keyword = FALSE; + } + defData->needSNPCbk = 0; + } + +snet_width: '+' K_WIDTH { defData->dumb_mode = 1; } T_STRING NUMBER + { + // 11/12/2002 - this is obsolete in 5.5, & will be ignored + if (defData->VersionNum < 5.5) { + if (defData->callbacks->SNetCbk) { + defData->Net.setWidth($4, $5); + } + } else { + defData->defWarning(7026, "The WIDTH statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement."); + } + } + +snet_voltage: '+' K_VOLTAGE { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING + { + if (defrData::numIsInt($4)) { + if (defData->callbacks->SNetCbk) defData->Net.setVoltage(atoi($4)); + } else { + if (defData->callbacks->SNetCbk) { + if (defData->sNetWarnings++ < defData->settings->SNetWarnings) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The value %s for statement VOLTAGE is invalid. The value can only be integer.\nSpecify a valid value in units of millivolts", $4); + defData->defError(6537, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } + } + +snet_spacing: '+' K_SPACING { defData->dumb_mode = 1; } T_STRING NUMBER + { + if (defData->callbacks->SNetCbk) defData->Net.setSpacing($4,$5); + } + opt_snet_range + { + } + +snet_prop_list: snet_prop + | snet_prop_list snet_prop + ; + +snet_prop: T_STRING NUMBER + { + if (defData->callbacks->SNetCbk) { + char propTp; + char* str = defData->ringCopy(" "); + propTp = defData->session->SNetProp.propType($1); + CHKPROPTYPE(propTp, $1, "SPECIAL NET"); + // For backword compatibility, also set the string value + sprintf(str, "%g", $2); + defData->Net.addNumProp($1, $2, str, propTp); + } + } + | T_STRING QSTRING + { + if (defData->callbacks->SNetCbk) { + char propTp; + propTp = defData->session->SNetProp.propType($1); + CHKPROPTYPE(propTp, $1, "SPECIAL NET"); + defData->Net.addProp($1, $2, propTp); + } + } + | T_STRING T_STRING + { + if (defData->callbacks->SNetCbk) { + char propTp; + propTp = defData->session->SNetProp.propType($1); + CHKPROPTYPE(propTp, $1, "SPECIAL NET"); + defData->Net.addProp($1, $2, propTp); + } + } + +opt_snet_range: // nothing + | K_RANGE NUMBER NUMBER + { + if (defData->callbacks->SNetCbk) defData->Net.setRange($2,$3); + } + +opt_range: // nothing + | K_RANGE NUMBER NUMBER + { defData->Prop.setRange($2, $3); } + +pattern_type: K_BALANCED + { $$ = (char*)"BALANCED"; } + | K_STEINER + { $$ = (char*)"STEINER"; } + | K_TRUNK + { $$ = (char*)"TRUNK"; } + | K_WIREDLOGIC + { $$ = (char*)"WIREDLOGIC"; } + +spaths: + spath + { + if (defData->NeedPathData && defData->callbacks->SNetCbk) { + if (defData->needSNPCbk && defData->callbacks->SNetPartialPathCbk) { + // require a callback before proceed because defData->needSNPCbk must be + // set to 1 from the previous pathIsDone and user has registered + // a callback routine. + CALLBACK(defData->callbacks->SNetPartialPathCbk, defrSNetPartialPathCbkType, + &defData->Net); + defData->needSNPCbk = 0; // reset the flag + defData->pathIsDone(defData->shield, 1, defData->netOsnet, &defData->needSNPCbk); + defData->Net.clearRectPolyNPath(); + defData->Net.clearVia(); + } else + defData->pathIsDone(defData->shield, 0, defData->netOsnet, &defData->needSNPCbk); + } + } + | spaths snew_path + { } + +snew_path: K_NEW { defData->dumb_mode = 1; } spath + { if (defData->NeedPathData && defData->callbacks->SNetCbk) { + if (defData->needSNPCbk && defData->callbacks->SNetPartialPathCbk) { + // require a callback before proceed because defData->needSNPCbk must be + // set to 1 from the previous pathIsDone and user has registered + // a callback routine. + CALLBACK(defData->callbacks->SNetPartialPathCbk, defrSNetPartialPathCbkType, + &defData->Net); + defData->needSNPCbk = 0; // reset the flag + defData->pathIsDone(defData->shield, 1, defData->netOsnet, &defData->needSNPCbk); + // reset any poly or rect in special wiring statement + defData->Net.clearRectPolyNPath(); + defData->Net.clearVia(); + } else + defData->pathIsDone(defData->shield, 0, defData->netOsnet, &defData->needSNPCbk); + } + } + +spath: T_STRING + { if (defData->NeedPathData && defData->callbacks->SNetCbk) + defData->PathObj.addLayer($1); + defData->dumb_mode = 0; defData->no_num = 0; + } + width opt_spaths path_pt +/* + { dumb_mode = 1; new_is_keyword = TRUE; } +*/ + { defData->dumb_mode = DEF_MAX_INT; defData->by_is_keyword = TRUE; defData->do_is_keyword = TRUE; + defData->new_is_keyword = TRUE; defData->step_is_keyword = TRUE; + defData->orient_is_keyword = TRUE; defData->rect_is_keyword = TRUE, defData->mask_is_keyword = TRUE; + defData->virtual_is_keyword = TRUE; } + + path_item_list + { defData->dumb_mode = 0; defData->rect_is_keyword = FALSE, defData->mask_is_keyword = FALSE, defData->virtual_is_keyword = FALSE; } + +width: NUMBER + { if (defData->NeedPathData && defData->callbacks->SNetCbk) + defData->PathObj.addWidth(ROUND($1)); + } + +start_snets: K_SNETS NUMBER ';' + { + if (defData->callbacks->SNetStartCbk) + CALLBACK(defData->callbacks->SNetStartCbk, defrSNetStartCbkType, ROUND($2)); + defData->netOsnet = 2; + } + +end_snets: K_END K_SNETS + { + if (defData->callbacks->SNetEndCbk) + CALLBACK(defData->callbacks->SNetEndCbk, defrSNetEndCbkType, 0); + defData->netOsnet = 0; + } + +groups_section: groups_start group_rules groups_end + ; + +groups_start: K_GROUPS NUMBER ';' + { + if (defData->callbacks->GroupsStartCbk) + CALLBACK(defData->callbacks->GroupsStartCbk, defrGroupsStartCbkType, ROUND($2)); + } + +group_rules: // empty + | group_rules group_rule + ; + +group_rule: start_group group_members group_options ';' + { + if (defData->callbacks->GroupCbk) + CALLBACK(defData->callbacks->GroupCbk, defrGroupCbkType, &defData->Group); + } + +start_group: '-' { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING + { + defData->dumb_mode = DEF_MAX_INT; + defData->no_num = DEF_MAX_INT; + /* dumb_mode is automatically turned off at the first + * + in the options or at the ; at the end of the group */ + if (defData->callbacks->GroupCbk) defData->Group.setup($3); + if (defData->callbacks->GroupNameCbk) + CALLBACK(defData->callbacks->GroupNameCbk, defrGroupNameCbkType, $3); + } + +group_members: + | group_members group_member + { } + +group_member: T_STRING + { + // if (defData->callbacks->GroupCbk) defData->Group.addMember($1); + if (defData->callbacks->GroupMemberCbk) + CALLBACK(defData->callbacks->GroupMemberCbk, defrGroupMemberCbkType, $1); + } + +group_options: // empty + | group_options group_option + ; + +group_option: '+' K_SOFT group_soft_options + { } + | '+' K_PROPERTY { defData->dumb_mode = DEF_MAX_INT; } + group_prop_list + { defData->dumb_mode = 0; } + | '+' K_REGION { defData->dumb_mode = 1; defData->no_num = 1; } group_region + { } + | extension_stmt + { + if (defData->callbacks->GroupMemberCbk) + CALLBACK(defData->callbacks->GroupExtCbk, defrGroupExtCbkType, &defData->History_text[0]); + } + +group_region: pt pt + { + // 11/12/2002 - this is obsolete in 5.5, & will be ignored + if (defData->VersionNum < 5.5) { + if (defData->callbacks->GroupCbk) + defData->Group.addRegionRect($1.x, $1.y, $2.x, $2.y); + } + else + defData->defWarning(7027, "The GROUP REGION pt pt statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement."); + } + | T_STRING + { if (defData->callbacks->GroupCbk) + defData->Group.setRegionName($1); + } + +group_prop_list : // empty + | group_prop_list group_prop + ; + +group_prop : T_STRING NUMBER + { + if (defData->callbacks->GroupCbk) { + char propTp; + char* str = defData->ringCopy(" "); + propTp = defData->session->GroupProp.propType($1); + CHKPROPTYPE(propTp, $1, "GROUP"); + sprintf(str, "%g", $2); + defData->Group.addNumProperty($1, $2, str, propTp); + } + } + | T_STRING QSTRING + { + if (defData->callbacks->GroupCbk) { + char propTp; + propTp = defData->session->GroupProp.propType($1); + CHKPROPTYPE(propTp, $1, "GROUP"); + defData->Group.addProperty($1, $2, propTp); + } + } + | T_STRING T_STRING + { + if (defData->callbacks->GroupCbk) { + char propTp; + propTp = defData->session->GroupProp.propType($1); + CHKPROPTYPE(propTp, $1, "GROUP"); + defData->Group.addProperty($1, $2, propTp); + } + } + +group_soft_options: // empty + | group_soft_options group_soft_option + { } + +group_soft_option: K_MAXX NUMBER + { + // 11/12/2002 - this is obsolete in 5.5, & will be ignored + if (defData->VersionNum < 5.5) { + if (defData->callbacks->GroupCbk) { + defData->Group.setMaxX(ROUND($2)); + } + } else { + defData->defWarning(7028, "The GROUP SOFT MAXX statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement."); + } + } + | K_MAXY NUMBER + { + // 11/12/2002 - this is obsolete in 5.5, & will be ignored + if (defData->VersionNum < 5.5) { + if (defData->callbacks->GroupCbk) { + defData->Group.setMaxY(ROUND($2)); + } + } else { + defData->defWarning(7029, "The GROUP SOFT MAXY statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement."); + } + } + | K_MAXHALFPERIMETER NUMBER + { + // 11/12/2002 - this is obsolete in 5.5, & will be ignored + if (defData->VersionNum < 5.5) { + if (defData->callbacks->GroupCbk) { + defData->Group.setPerim(ROUND($2)); + } + } else { + defData->defWarning(7030, "The GROUP SOFT MAXHALFPERIMETER statement is obsolete in version 5.5 and later.\nThe DEF parser will ignore this statement."); + } + } + +groups_end: K_END K_GROUPS + { + if (defData->callbacks->GroupsEndCbk) + CALLBACK(defData->callbacks->GroupsEndCbk, defrGroupsEndCbkType, 0); + } + +// 8/31/2001 - This is obsolete in 5.4 +assertions_section: assertions_start constraint_rules assertions_end + ; + +// 8/31/2001 - This is obsolete in 5.4 +constraint_section: constraints_start constraint_rules constraints_end + ; + +assertions_start: K_ASSERTIONS NUMBER ';' + { + if ((defData->VersionNum < 5.4) && (defData->callbacks->AssertionsStartCbk)) { + CALLBACK(defData->callbacks->AssertionsStartCbk, defrAssertionsStartCbkType, + ROUND($2)); + } else { + if (defData->callbacks->AssertionCbk) + if (defData->assertionWarnings++ < defData->settings->AssertionWarnings) + defData->defWarning(7031, "The ASSERTIONS statement is obsolete in version 5.4 and later.\nThe DEF parser will ignore this statement."); + } + if (defData->callbacks->AssertionCbk) + defData->Assertion.setAssertionMode(); + } + +constraints_start: K_CONSTRAINTS NUMBER ';' + { + if ((defData->VersionNum < 5.4) && (defData->callbacks->ConstraintsStartCbk)) { + CALLBACK(defData->callbacks->ConstraintsStartCbk, defrConstraintsStartCbkType, + ROUND($2)); + } else { + if (defData->callbacks->ConstraintCbk) + if (defData->constraintWarnings++ < defData->settings->ConstraintWarnings) + defData->defWarning(7032, "The CONSTRAINTS statement is obsolete in version 5.4 and later.\nThe DEF parser will ignore this statement."); + } + if (defData->callbacks->ConstraintCbk) + defData->Assertion.setConstraintMode(); + } + +constraint_rules: // empty + | constraint_rules constraint_rule + ; + +constraint_rule: operand_rule + | wiredlogic_rule + { + if ((defData->VersionNum < 5.4) && (defData->callbacks->ConstraintCbk || defData->callbacks->AssertionCbk)) { + if (defData->Assertion.isConstraint()) + CALLBACK(defData->callbacks->ConstraintCbk, defrConstraintCbkType, &defData->Assertion); + if (defData->Assertion.isAssertion()) + CALLBACK(defData->callbacks->AssertionCbk, defrAssertionCbkType, &defData->Assertion); + } + } + +operand_rule: '-' operand delay_specs ';' + { + if ((defData->VersionNum < 5.4) && (defData->callbacks->ConstraintCbk || defData->callbacks->AssertionCbk)) { + if (defData->Assertion.isConstraint()) + CALLBACK(defData->callbacks->ConstraintCbk, defrConstraintCbkType, &defData->Assertion); + if (defData->Assertion.isAssertion()) + CALLBACK(defData->callbacks->AssertionCbk, defrAssertionCbkType, &defData->Assertion); + } + + // reset all the flags and everything + defData->Assertion.clear(); + } + +operand: K_NET { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING + { + if (defData->callbacks->ConstraintCbk || defData->callbacks->AssertionCbk) + defData->Assertion.addNet($3); + } + | K_PATH {defData->dumb_mode = 4; defData->no_num = 4;} T_STRING T_STRING T_STRING T_STRING + { + if (defData->callbacks->ConstraintCbk || defData->callbacks->AssertionCbk) + defData->Assertion.addPath($3, $4, $5, $6); + } + | K_SUM '(' operand_list ')' + { + if (defData->callbacks->ConstraintCbk || defData->callbacks->AssertionCbk) + defData->Assertion.setSum(); + } + | K_DIFF '(' operand_list ')' + { + if (defData->callbacks->ConstraintCbk || defData->callbacks->AssertionCbk) + defData->Assertion.setDiff(); + } + +operand_list: operand + | operand_list operand + { } + | operand_list ',' operand + +wiredlogic_rule: '-' K_WIREDLOGIC { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING + opt_plus K_MAXDIST NUMBER ';' + { + if (defData->callbacks->ConstraintCbk || defData->callbacks->AssertionCbk) + defData->Assertion.setWiredlogic($4, $7); + } + +opt_plus: + // empty + { $$ = (char*)""; } + | '+' + { $$ = (char*)"+"; } + +delay_specs: // empty + | delay_specs delay_spec + ; + +delay_spec: '+' K_RISEMIN NUMBER + { + if (defData->callbacks->ConstraintCbk || defData->callbacks->AssertionCbk) + defData->Assertion.setRiseMin($3); + } + | '+' K_RISEMAX NUMBER + { + if (defData->callbacks->ConstraintCbk || defData->callbacks->AssertionCbk) + defData->Assertion.setRiseMax($3); + } + | '+' K_FALLMIN NUMBER + { + if (defData->callbacks->ConstraintCbk || defData->callbacks->AssertionCbk) + defData->Assertion.setFallMin($3); + } + | '+' K_FALLMAX NUMBER + { + if (defData->callbacks->ConstraintCbk || defData->callbacks->AssertionCbk) + defData->Assertion.setFallMax($3); + } + +constraints_end: K_END K_CONSTRAINTS + { if ((defData->VersionNum < 5.4) && defData->callbacks->ConstraintsEndCbk) { + CALLBACK(defData->callbacks->ConstraintsEndCbk, defrConstraintsEndCbkType, 0); + } else { + if (defData->callbacks->ConstraintsEndCbk) { + if (defData->constraintWarnings++ < defData->settings->ConstraintWarnings) + defData->defWarning(7032, "The CONSTRAINTS statement is obsolete in version 5.4 and later.\nThe DEF parser will ignore this statement."); + } + } + } + +assertions_end: K_END K_ASSERTIONS + { if ((defData->VersionNum < 5.4) && defData->callbacks->AssertionsEndCbk) { + CALLBACK(defData->callbacks->AssertionsEndCbk, defrAssertionsEndCbkType, 0); + } else { + if (defData->callbacks->AssertionsEndCbk) { + if (defData->assertionWarnings++ < defData->settings->AssertionWarnings) + defData->defWarning(7031, "The ASSERTIONS statement is obsolete in version 5.4 and later.\nThe DEF parser will ignore this statement."); + } + } + } + +scanchains_section: scanchain_start scanchain_rules scanchain_end + ; + +scanchain_start: K_SCANCHAINS NUMBER ';' + { if (defData->callbacks->ScanchainsStartCbk) + CALLBACK(defData->callbacks->ScanchainsStartCbk, defrScanchainsStartCbkType, + ROUND($2)); + } + +scanchain_rules: // empty + | scanchain_rules scan_rule + {} + +scan_rule: start_scan scan_members ';' + { + if (defData->callbacks->ScanchainCbk) + CALLBACK(defData->callbacks->ScanchainCbk, defrScanchainCbkType, &defData->Scanchain); + } + +start_scan: '-' {defData->dumb_mode = 1; defData->no_num = 1;} T_STRING + { + if (defData->callbacks->ScanchainCbk) + defData->Scanchain.setName($3); + defData->bit_is_keyword = TRUE; + } + +scan_members: + | scan_members scan_member + ; + +opt_pin : + // empty + { $$ = (char*)""; } + | T_STRING + { $$ = $1; } + +scan_member: '+' K_START {defData->dumb_mode = 2; defData->no_num = 2;} T_STRING opt_pin + { if (defData->callbacks->ScanchainCbk) + defData->Scanchain.setStart($4, $5); + } + | '+' K_FLOATING { defData->dumb_mode = 1; defData->no_num = 1; } floating_inst_list + { defData->dumb_mode = 0; defData->no_num = 0; } + | '+' K_ORDERED + { + defData->dumb_mode = 1; + defData->no_num = 1; + if (defData->callbacks->ScanchainCbk) + defData->Scanchain.addOrderedList(); + } + ordered_inst_list + { defData->dumb_mode = 0; defData->no_num = 0; } + | '+' K_STOP {defData->dumb_mode = 2; defData->no_num = 2; } T_STRING opt_pin + { if (defData->callbacks->ScanchainCbk) + defData->Scanchain.setStop($4, $5); + } + | '+' K_COMMONSCANPINS { defData->dumb_mode = 10; defData->no_num = 10; } opt_common_pins + { defData->dumb_mode = 0; defData->no_num = 0; } + | '+' K_PARTITION { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING // 5.5 + partition_maxbits + { + if (defData->VersionNum < 5.5) { + if (defData->callbacks->ScanchainCbk) { + if (defData->scanchainWarnings++ < defData->settings->ScanchainWarnings) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The PARTITION statement is available in version 5.5 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); + defData->defError(6538, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } + if (defData->callbacks->ScanchainCbk) + defData->Scanchain.setPartition($4, $5); + } + | extension_stmt + { + if (defData->callbacks->ScanChainExtCbk) + CALLBACK(defData->callbacks->ScanChainExtCbk, defrScanChainExtCbkType, &defData->History_text[0]); + } + +opt_common_pins: // empty + { } + | '(' T_STRING T_STRING ')' + { + if (defData->callbacks->ScanchainCbk) { + if (strcmp($2, "IN") == 0 || strcmp($2, "in") == 0) + defData->Scanchain.setCommonIn($3); + else if (strcmp($2, "OUT") == 0 || strcmp($2, "out") == 0) + defData->Scanchain.setCommonOut($3); + } + } + | '(' T_STRING T_STRING ')' '(' T_STRING T_STRING ')' + { + if (defData->callbacks->ScanchainCbk) { + if (strcmp($2, "IN") == 0 || strcmp($2, "in") == 0) + defData->Scanchain.setCommonIn($3); + else if (strcmp($2, "OUT") == 0 || strcmp($2, "out") == 0) + defData->Scanchain.setCommonOut($3); + if (strcmp($6, "IN") == 0 || strcmp($6, "in") == 0) + defData->Scanchain.setCommonIn($7); + else if (strcmp($6, "OUT") == 0 || strcmp($6, "out") == 0) + defData->Scanchain.setCommonOut($7); + } + } + +floating_inst_list: // empty + | floating_inst_list one_floating_inst + ; + +one_floating_inst: T_STRING + { + defData->dumb_mode = 1000; + defData->no_num = 1000; + if (defData->callbacks->ScanchainCbk) + defData->Scanchain.addFloatingInst($1); + } + floating_pins + { defData->dumb_mode = 1; defData->no_num = 1; } + +floating_pins: // empty + { } + | '(' T_STRING T_STRING ')' + { + if (defData->callbacks->ScanchainCbk) { + if (strcmp($2, "IN") == 0 || strcmp($2, "in") == 0) + defData->Scanchain.addFloatingIn($3); + else if (strcmp($2, "OUT") == 0 || strcmp($2, "out") == 0) + defData->Scanchain.addFloatingOut($3); + else if (strcmp($2, "BITS") == 0 || strcmp($2, "bits") == 0) { + defData->bitsNum = atoi($3); + defData->Scanchain.setFloatingBits(defData->bitsNum); + } + } + } + | '(' T_STRING T_STRING ')' '(' T_STRING T_STRING ')' + { + if (defData->callbacks->ScanchainCbk) { + if (strcmp($2, "IN") == 0 || strcmp($2, "in") == 0) + defData->Scanchain.addFloatingIn($3); + else if (strcmp($2, "OUT") == 0 || strcmp($2, "out") == 0) + defData->Scanchain.addFloatingOut($3); + else if (strcmp($2, "BITS") == 0 || strcmp($2, "bits") == 0) { + defData->bitsNum = atoi($3); + defData->Scanchain.setFloatingBits(defData->bitsNum); + } + if (strcmp($6, "IN") == 0 || strcmp($6, "in") == 0) + defData->Scanchain.addFloatingIn($7); + else if (strcmp($6, "OUT") == 0 || strcmp($6, "out") == 0) + defData->Scanchain.addFloatingOut($7); + else if (strcmp($6, "BITS") == 0 || strcmp($6, "bits") == 0) { + defData->bitsNum = atoi($7); + defData->Scanchain.setFloatingBits(defData->bitsNum); + } + } + } + | '(' T_STRING T_STRING ')' '(' T_STRING T_STRING ')' '(' T_STRING + T_STRING ')' + { + if (defData->callbacks->ScanchainCbk) { + if (strcmp($2, "IN") == 0 || strcmp($2, "in") == 0) + defData->Scanchain.addFloatingIn($3); + else if (strcmp($2, "OUT") == 0 || strcmp($2, "out") == 0) + defData->Scanchain.addFloatingOut($3); + else if (strcmp($2, "BITS") == 0 || strcmp($2, "bits") == 0) { + defData->bitsNum = atoi($3); + defData->Scanchain.setFloatingBits(defData->bitsNum); + } + if (strcmp($6, "IN") == 0 || strcmp($6, "in") == 0) + defData->Scanchain.addFloatingIn($7); + else if (strcmp($6, "OUT") == 0 || strcmp($6, "out") == 0) + defData->Scanchain.addFloatingOut($7); + else if (strcmp($6, "BITS") == 0 || strcmp($6, "bits") == 0) { + defData->bitsNum = atoi($7); + defData->Scanchain.setFloatingBits(defData->bitsNum); + } + if (strcmp($10, "IN") == 0 || strcmp($10, "in") == 0) + defData->Scanchain.addFloatingIn($11); + else if (strcmp($10, "OUT") == 0 || strcmp($10, "out") == 0) + defData->Scanchain.addFloatingOut($11); + else if (strcmp($10, "BITS") == 0 || strcmp($10, "bits") == 0) { + defData->bitsNum = atoi($11); + defData->Scanchain.setFloatingBits(defData->bitsNum); + } + } + } + +ordered_inst_list: // empty + | ordered_inst_list one_ordered_inst + ; + +one_ordered_inst: T_STRING + { defData->dumb_mode = 1000; defData->no_num = 1000; + if (defData->callbacks->ScanchainCbk) + defData->Scanchain.addOrderedInst($1); + } + ordered_pins + { defData->dumb_mode = 1; defData->no_num = 1; } + +ordered_pins: // empty + { } + | '(' T_STRING T_STRING ')' + { + if (defData->callbacks->ScanchainCbk) { + if (strcmp($2, "IN") == 0 || strcmp($2, "in") == 0) + defData->Scanchain.addOrderedIn($3); + else if (strcmp($2, "OUT") == 0 || strcmp($2, "out") == 0) + defData->Scanchain.addOrderedOut($3); + else if (strcmp($2, "BITS") == 0 || strcmp($2, "bits") == 0) { + defData->bitsNum = atoi($3); + defData->Scanchain.setOrderedBits(defData->bitsNum); + } + } + } + | '(' T_STRING T_STRING ')' '(' T_STRING T_STRING ')' + { + if (defData->callbacks->ScanchainCbk) { + if (strcmp($2, "IN") == 0 || strcmp($2, "in") == 0) + defData->Scanchain.addOrderedIn($3); + else if (strcmp($2, "OUT") == 0 || strcmp($2, "out") == 0) + defData->Scanchain.addOrderedOut($3); + else if (strcmp($2, "BITS") == 0 || strcmp($2, "bits") == 0) { + defData->bitsNum = atoi($3); + defData->Scanchain.setOrderedBits(defData->bitsNum); + } + if (strcmp($6, "IN") == 0 || strcmp($6, "in") == 0) + defData->Scanchain.addOrderedIn($7); + else if (strcmp($6, "OUT") == 0 || strcmp($6, "out") == 0) + defData->Scanchain.addOrderedOut($7); + else if (strcmp($6, "BITS") == 0 || strcmp($6, "bits") == 0) { + defData->bitsNum = atoi($7); + defData->Scanchain.setOrderedBits(defData->bitsNum); + } + } + } + | '(' T_STRING T_STRING ')' '(' T_STRING T_STRING ')' '(' T_STRING + T_STRING ')' + { + if (defData->callbacks->ScanchainCbk) { + if (strcmp($2, "IN") == 0 || strcmp($2, "in") == 0) + defData->Scanchain.addOrderedIn($3); + else if (strcmp($2, "OUT") == 0 || strcmp($2, "out") == 0) + defData->Scanchain.addOrderedOut($3); + else if (strcmp($2, "BITS") == 0 || strcmp($2, "bits") == 0) { + defData->bitsNum = atoi($3); + defData->Scanchain.setOrderedBits(defData->bitsNum); + } + if (strcmp($6, "IN") == 0 || strcmp($6, "in") == 0) + defData->Scanchain.addOrderedIn($7); + else if (strcmp($6, "OUT") == 0 || strcmp($6, "out") == 0) + defData->Scanchain.addOrderedOut($7); + else if (strcmp($6, "BITS") == 0 || strcmp($6, "bits") == 0) { + defData->bitsNum = atoi($7); + defData->Scanchain.setOrderedBits(defData->bitsNum); + } + if (strcmp($10, "IN") == 0 || strcmp($10, "in") == 0) + defData->Scanchain.addOrderedIn($11); + else if (strcmp($10, "OUT") == 0 || strcmp($10, "out") == 0) + defData->Scanchain.addOrderedOut($11); + else if (strcmp($10, "BITS") == 0 || strcmp($10, "bits") == 0) { + defData->bitsNum = atoi($11); + defData->Scanchain.setOrderedBits(defData->bitsNum); + } + } + } + +partition_maxbits: // empty + { $$ = -1; } + | K_MAXBITS NUMBER + { $$ = ROUND($2); } + +scanchain_end: K_END K_SCANCHAINS + { + if (defData->callbacks->ScanchainsEndCbk) + CALLBACK(defData->callbacks->ScanchainsEndCbk, defrScanchainsEndCbkType, 0); + defData->bit_is_keyword = FALSE; + defData->dumb_mode = 0; defData->no_num = 0; + } + +// 8/31/2001 - This is obsolete in 5.4 +iotiming_section: iotiming_start iotiming_rules iotiming_end + ; + +iotiming_start: K_IOTIMINGS NUMBER ';' + { + if (defData->VersionNum < 5.4 && defData->callbacks->IOTimingsStartCbk) { + CALLBACK(defData->callbacks->IOTimingsStartCbk, defrIOTimingsStartCbkType, ROUND($2)); + } else { + if (defData->callbacks->IOTimingsStartCbk) + if (defData->iOTimingWarnings++ < defData->settings->IOTimingWarnings) + defData->defWarning(7035, "The IOTIMINGS statement is obsolete in version 5.4 and later.\nThe DEF parser will ignore this statement."); + } + } + +iotiming_rules: // empty + | iotiming_rules iotiming_rule + { } + +iotiming_rule: start_iotiming iotiming_members ';' + { + if (defData->VersionNum < 5.4 && defData->callbacks->IOTimingCbk) + CALLBACK(defData->callbacks->IOTimingCbk, defrIOTimingCbkType, &defData->IOTiming); + } + +start_iotiming: '-' '(' {defData->dumb_mode = 2; defData->no_num = 2; } T_STRING T_STRING ')' + { + if (defData->callbacks->IOTimingCbk) + defData->IOTiming.setName($4, $5); + } + +iotiming_members: + | iotiming_members iotiming_member + ; + +iotiming_member: + '+' risefall K_VARIABLE NUMBER NUMBER + { + if (defData->callbacks->IOTimingCbk) + defData->IOTiming.setVariable($2, $4, $5); + } + | '+' risefall K_SLEWRATE NUMBER NUMBER + { + if (defData->callbacks->IOTimingCbk) + defData->IOTiming.setSlewRate($2, $4, $5); + } + | '+' K_CAPACITANCE NUMBER + { + if (defData->callbacks->IOTimingCbk) + defData->IOTiming.setCapacitance($3); + } + | '+' K_DRIVECELL {defData->dumb_mode = 1; defData->no_num = 1; } T_STRING + { + if (defData->callbacks->IOTimingCbk) + defData->IOTiming.setDriveCell($4); + } iotiming_drivecell_opt + // | '+' K_FROMPIN {defData->dumb_mode = 1; defData->no_num = 1; } T_STRING + + // | '+' K_PARALLEL NUMBER + + | extension_stmt + { + if (defData->VersionNum < 5.4 && defData->callbacks->IoTimingsExtCbk) + CALLBACK(defData->callbacks->IoTimingsExtCbk, defrIoTimingsExtCbkType, &defData->History_text[0]); + } + +iotiming_drivecell_opt: iotiming_frompin + K_TOPIN {defData->dumb_mode = 1; defData->no_num = 1; } T_STRING + { + if (defData->callbacks->IOTimingCbk) + defData->IOTiming.setTo($4); + } + iotiming_parallel + +iotiming_frompin: // empty + | K_FROMPIN {defData->dumb_mode = 1; defData->no_num = 1; } T_STRING + { + if (defData->callbacks->IOTimingCbk) + defData->IOTiming.setFrom($3); + } + +iotiming_parallel: // empty + | K_PARALLEL NUMBER + { + if (defData->callbacks->IOTimingCbk) + defData->IOTiming.setParallel($2); + } + +risefall: K_RISE { $$ = (char*)"RISE"; } | K_FALL { $$ = (char*)"FALL"; } + +iotiming_end: K_END K_IOTIMINGS + { + if (defData->VersionNum < 5.4 && defData->callbacks->IOTimingsEndCbk) + CALLBACK(defData->callbacks->IOTimingsEndCbk, defrIOTimingsEndCbkType, 0); + } + +floorplan_contraints_section: fp_start fp_stmts K_END K_FPC + { + if (defData->callbacks->FPCEndCbk) + CALLBACK(defData->callbacks->FPCEndCbk, defrFPCEndCbkType, 0); + } + +fp_start: K_FPC NUMBER ';' + { + if (defData->callbacks->FPCStartCbk) + CALLBACK(defData->callbacks->FPCStartCbk, defrFPCStartCbkType, ROUND($2)); + } + +fp_stmts: // empty + | fp_stmts fp_stmt + {} + +fp_stmt: '-' { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING h_or_v + { if (defData->callbacks->FPCCbk) defData->FPC.setName($3, $4); } + constraint_type constrain_what_list ';' + { if (defData->callbacks->FPCCbk) CALLBACK(defData->callbacks->FPCCbk, defrFPCCbkType, &defData->FPC); } + +h_or_v: K_HORIZONTAL + { $$ = (char*)"HORIZONTAL"; } + | K_VERTICAL + { $$ = (char*)"VERTICAL"; } + +constraint_type: K_ALIGN + { if (defData->callbacks->FPCCbk) defData->FPC.setAlign(); } + | K_MAX NUMBER + { if (defData->callbacks->FPCCbk) defData->FPC.setMax($2); } + | K_MIN NUMBER + { if (defData->callbacks->FPCCbk) defData->FPC.setMin($2); } + | K_EQUAL NUMBER + { if (defData->callbacks->FPCCbk) defData->FPC.setEqual($2); } + +constrain_what_list: // empty + | constrain_what_list constrain_what + ; + +constrain_what: '+' K_BOTTOMLEFT + { if (defData->callbacks->FPCCbk) defData->FPC.setDoingBottomLeft(); } + row_or_comp_list + | '+' K_TOPRIGHT + { if (defData->callbacks->FPCCbk) defData->FPC.setDoingTopRight(); } + row_or_comp_list + ; + +row_or_comp_list: // empty + | row_or_comp_list row_or_comp + +row_or_comp: '(' K_ROWS {defData->dumb_mode = 1; defData->no_num = 1; } T_STRING ')' + { if (defData->callbacks->FPCCbk) defData->FPC.addRow($4); } + | '(' K_COMPS {defData->dumb_mode = 1; defData->no_num = 1; } T_STRING ')' + { if (defData->callbacks->FPCCbk) defData->FPC.addComps($4); } + +timingdisables_section: timingdisables_start timingdisables_rules + timingdisables_end + ; + +timingdisables_start: K_TIMINGDISABLES NUMBER ';' + { + if (defData->callbacks->TimingDisablesStartCbk) + CALLBACK(defData->callbacks->TimingDisablesStartCbk, defrTimingDisablesStartCbkType, + ROUND($2)); + } + +timingdisables_rules: // empty + | timingdisables_rules timingdisables_rule + {} + +timingdisables_rule: '-' K_FROMPIN { defData->dumb_mode = 2; defData->no_num = 2; } T_STRING + T_STRING K_TOPIN { defData->dumb_mode = 2; defData->no_num = 2; } T_STRING T_STRING ';' + { + if (defData->callbacks->TimingDisableCbk) { + defData->TimingDisable.setFromTo($4, $5, $8, $9); + CALLBACK(defData->callbacks->TimingDisableCbk, defrTimingDisableCbkType, + &defData->TimingDisable); + } + } + | '-' K_THRUPIN {defData->dumb_mode = 2; defData->no_num = 2; } T_STRING T_STRING ';' + { + if (defData->callbacks->TimingDisableCbk) { + defData->TimingDisable.setThru($4, $5); + CALLBACK(defData->callbacks->TimingDisableCbk, defrTimingDisableCbkType, + &defData->TimingDisable); + } + } + | '-' K_MACRO {defData->dumb_mode = 1; defData->no_num = 1;} T_STRING td_macro_option ';' + { + if (defData->callbacks->TimingDisableCbk) { + defData->TimingDisable.setMacro($4); + CALLBACK(defData->callbacks->TimingDisableCbk, defrTimingDisableCbkType, + &defData->TimingDisable); + } + } + | '-' K_REENTRANTPATHS ';' + { if (defData->callbacks->TimingDisableCbk) + defData->TimingDisable.setReentrantPathsFlag(); + } + + +td_macro_option: K_FROMPIN {defData->dumb_mode = 1; defData->no_num = 1;} T_STRING K_TOPIN + {defData->dumb_mode=1; defData->no_num = 1;} T_STRING + { + if (defData->callbacks->TimingDisableCbk) + defData->TimingDisable.setMacroFromTo($3,$6); + } + | K_THRUPIN {defData->dumb_mode=1; defData->no_num = 1;} T_STRING + { + if (defData->callbacks->TimingDisableCbk) + defData->TimingDisable.setMacroThru($3); + } + +timingdisables_end: K_END K_TIMINGDISABLES + { + if (defData->callbacks->TimingDisablesEndCbk) + CALLBACK(defData->callbacks->TimingDisablesEndCbk, defrTimingDisablesEndCbkType, 0); + } + + +partitions_section: partitions_start partition_rules partitions_end + ; + +partitions_start: K_PARTITIONS NUMBER ';' + { + if (defData->callbacks->PartitionsStartCbk) + CALLBACK(defData->callbacks->PartitionsStartCbk, defrPartitionsStartCbkType, + ROUND($2)); + } + +partition_rules: // empty + | partition_rules partition_rule + { } + +partition_rule: start_partition partition_members ';' + { + if (defData->callbacks->PartitionCbk) + CALLBACK(defData->callbacks->PartitionCbk, defrPartitionCbkType, &defData->Partition); + } + +start_partition: '-' { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING turnoff + { + if (defData->callbacks->PartitionCbk) + defData->Partition.setName($3); + } + +turnoff: // empty + | K_TURNOFF turnoff_setup turnoff_hold + { + if (defData->callbacks->PartitionCbk) + defData->Partition.addTurnOff($2, $3); + } + +turnoff_setup: // empty + { $$ = (char*)" "; } + | K_SETUPRISE + { $$ = (char*)"R"; } + | K_SETUPFALL + { $$ = (char*)"F"; } + +turnoff_hold: // empty + { $$ = (char*)" "; } + | K_HOLDRISE + { $$ = (char*)"R"; } + | K_HOLDFALL + { $$ = (char*)"F"; } + +partition_members: // empty + | partition_members partition_member + ; + +partition_member: '+' K_FROMCLOCKPIN {defData->dumb_mode=2; defData->no_num = 2;} + T_STRING T_STRING risefall minmaxpins + { + if (defData->callbacks->PartitionCbk) + defData->Partition.setFromClockPin($4, $5); + } + | '+' K_FROMCOMPPIN {defData->dumb_mode=2; defData->no_num = 2; } + T_STRING T_STRING risefallminmax2_list + { + if (defData->callbacks->PartitionCbk) + defData->Partition.setFromCompPin($4, $5); + } + | '+' K_FROMIOPIN {defData->dumb_mode=1; defData->no_num = 1; } T_STRING + risefallminmax1_list + { + if (defData->callbacks->PartitionCbk) + defData->Partition.setFromIOPin($4); + } + | '+' K_TOCLOCKPIN {defData->dumb_mode=2; defData->no_num = 2; } + T_STRING T_STRING risefall minmaxpins + { + if (defData->callbacks->PartitionCbk) + defData->Partition.setToClockPin($4, $5); + } + | '+' K_TOCOMPPIN {defData->dumb_mode=2; defData->no_num = 2; } + T_STRING T_STRING risefallminmax2_list + { + if (defData->callbacks->PartitionCbk) + defData->Partition.setToCompPin($4, $5); + } + | '+' K_TOIOPIN {defData->dumb_mode=1; defData->no_num = 2; } T_STRING risefallminmax1_list + { + if (defData->callbacks->PartitionCbk) + defData->Partition.setToIOPin($4); + } + | extension_stmt + { + if (defData->callbacks->PartitionsExtCbk) + CALLBACK(defData->callbacks->PartitionsExtCbk, defrPartitionsExtCbkType, + &defData->History_text[0]); + } + +minmaxpins: min_or_max_list K_PINS + { defData->dumb_mode = DEF_MAX_INT; defData->no_num = DEF_MAX_INT; } pin_list + { defData->dumb_mode = 0; defData->no_num = 0; } + +min_or_max_list: // empty + | min_or_max_list min_or_max_member + { } + +min_or_max_member: K_MIN NUMBER NUMBER + { + if (defData->callbacks->PartitionCbk) + defData->Partition.setMin($2, $3); + } + | K_MAX NUMBER NUMBER + { + if (defData->callbacks->PartitionCbk) + defData->Partition.setMax($2, $3); + } + +pin_list: // empty + | pin_list T_STRING + { if (defData->callbacks->PartitionCbk) defData->Partition.addPin($2); } + +risefallminmax1_list: // empty + | risefallminmax1_list risefallminmax1 + +risefallminmax1: K_RISEMIN NUMBER + { if (defData->callbacks->PartitionCbk) defData->Partition.addRiseMin($2); } + | K_FALLMIN NUMBER + { if (defData->callbacks->PartitionCbk) defData->Partition.addFallMin($2); } + | K_RISEMAX NUMBER + { if (defData->callbacks->PartitionCbk) defData->Partition.addRiseMax($2); } + | K_FALLMAX NUMBER + { if (defData->callbacks->PartitionCbk) defData->Partition.addFallMax($2); } + +risefallminmax2_list: + risefallminmax2 + | risefallminmax2_list risefallminmax2 + ; + +risefallminmax2: K_RISEMIN NUMBER NUMBER + { if (defData->callbacks->PartitionCbk) + defData->Partition.addRiseMinRange($2, $3); } + | K_FALLMIN NUMBER NUMBER + { if (defData->callbacks->PartitionCbk) + defData->Partition.addFallMinRange($2, $3); } + | K_RISEMAX NUMBER NUMBER + { if (defData->callbacks->PartitionCbk) + defData->Partition.addRiseMaxRange($2, $3); } + | K_FALLMAX NUMBER NUMBER + { if (defData->callbacks->PartitionCbk) + defData->Partition.addFallMaxRange($2, $3); } + +partitions_end: K_END K_PARTITIONS + { if (defData->callbacks->PartitionsEndCbk) + CALLBACK(defData->callbacks->PartitionsEndCbk, defrPartitionsEndCbkType, 0); } + +comp_names: // empty + | comp_names comp_name + { } + +comp_name: '(' {defData->dumb_mode=2; defData->no_num = 2; } T_STRING + T_STRING subnet_opt_syn ')' + { + // note that the defData->first T_STRING could be the keyword VPIN + if (defData->callbacks->NetCbk) + defData->Subnet->addPin($3, $4, $5); + } + +subnet_opt_syn: // empty + { $$ = 0; } + | '+' K_SYNTHESIZED + { $$ = 1; } + +subnet_options: // empty + | subnet_options subnet_option + +subnet_option: subnet_type + { + if (defData->callbacks->NetCbk) defData->Subnet->addWire($1); + } + paths + { + defData->by_is_keyword = FALSE; + defData->do_is_keyword = FALSE; + defData->new_is_keyword = FALSE; + defData->step_is_keyword = FALSE; + defData->orient_is_keyword = FALSE; + defData->needNPCbk = 0; + } + | K_NONDEFAULTRULE { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING + { if (defData->callbacks->NetCbk) defData->Subnet->setNonDefault($3); } + +subnet_type: K_FIXED + { $$ = (char*)"FIXED"; defData->dumb_mode = 1; } + | K_COVER + { $$ = (char*)"COVER"; defData->dumb_mode = 1; } + | K_ROUTED + { $$ = (char*)"ROUTED"; defData->dumb_mode = 1; } + | K_NOSHIELD + { $$ = (char*)"NOSHIELD"; defData->dumb_mode = 1; } + +pin_props_section: begin_pin_props pin_prop_list end_pin_props ; + +begin_pin_props: K_PINPROPERTIES NUMBER opt_semi + { if (defData->callbacks->PinPropStartCbk) + CALLBACK(defData->callbacks->PinPropStartCbk, defrPinPropStartCbkType, ROUND($2)); } + +opt_semi: + // empty + { } + | ';' + { } + +end_pin_props: K_END K_PINPROPERTIES + { if (defData->callbacks->PinPropEndCbk) + CALLBACK(defData->callbacks->PinPropEndCbk, defrPinPropEndCbkType, 0); } + +pin_prop_list: // empty + | pin_prop_list pin_prop_terminal + ; + +pin_prop_terminal: '-' { defData->dumb_mode = 2; defData->no_num = 2; } T_STRING T_STRING + { if (defData->callbacks->PinPropCbk) defData->PinProp.setName($3, $4); } + pin_prop_options ';' + { if (defData->callbacks->PinPropCbk) { + CALLBACK(defData->callbacks->PinPropCbk, defrPinPropCbkType, &defData->PinProp); + // reset the property number + defData->PinProp.clear(); + } + } + +pin_prop_options : // empty + | pin_prop_options pin_prop ; + +pin_prop: '+' K_PROPERTY { defData->dumb_mode = DEF_MAX_INT; } + pin_prop_name_value_list + { defData->dumb_mode = 0; } + +pin_prop_name_value_list : // empty + | pin_prop_name_value_list pin_prop_name_value + ; + +pin_prop_name_value : T_STRING NUMBER + { + if (defData->callbacks->PinPropCbk) { + char propTp; + char* str = defData->ringCopy(" "); + propTp = defData->session->CompPinProp.propType($1); + CHKPROPTYPE(propTp, $1, "PINPROPERTIES"); + sprintf(str, "%g", $2); + defData->PinProp.addNumProperty($1, $2, str, propTp); + } + } + | T_STRING QSTRING + { + if (defData->callbacks->PinPropCbk) { + char propTp; + propTp = defData->session->CompPinProp.propType($1); + CHKPROPTYPE(propTp, $1, "PINPROPERTIES"); + defData->PinProp.addProperty($1, $2, propTp); + } + } + | T_STRING T_STRING + { + if (defData->callbacks->PinPropCbk) { + char propTp; + propTp = defData->session->CompPinProp.propType($1); + CHKPROPTYPE(propTp, $1, "PINPROPERTIES"); + defData->PinProp.addProperty($1, $2, propTp); + } + } + +blockage_section: blockage_start blockage_defs blockage_end ; + +blockage_start: K_BLOCKAGES NUMBER ';' + { if (defData->callbacks->BlockageStartCbk) + CALLBACK(defData->callbacks->BlockageStartCbk, defrBlockageStartCbkType, ROUND($2)); } + +blockage_end: K_END K_BLOCKAGES + { if (defData->callbacks->BlockageEndCbk) + CALLBACK(defData->callbacks->BlockageEndCbk, defrBlockageEndCbkType, 0); } + +blockage_defs: // empty + | blockage_defs blockage_def + ; + +blockage_def: blockage_rule rectPoly_blockage rectPoly_blockage_rules + ';' + { + if (defData->callbacks->BlockageCbk) { + CALLBACK(defData->callbacks->BlockageCbk, defrBlockageCbkType, &defData->Blockage); + defData->Blockage.clear(); + } + } + +blockage_rule: '-' K_LAYER { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING + { + if (defData->callbacks->BlockageCbk) { + if (defData->Blockage.hasPlacement() != 0) { + if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) { + defData->defError(6539, "Invalid BLOCKAGE statement defined in the DEF file. The BLOCKAGE statment has both the LAYER and the PLACEMENT statements defined.\nUpdate your DEF file to have either BLOCKAGE or PLACEMENT statement only."); + CHKERR(); + } + } + defData->Blockage.setLayer($4); + defData->Blockage.clearPoly(); // free poly, if any + } + defData->hasBlkLayerComp = 0; + defData->hasBlkLayerSpac = 0; + defData->hasBlkLayerTypeComp = 0; + } + + layer_blockage_rules + // 10/29/2001 - enhancement + | '-' K_PLACEMENT + { + if (defData->callbacks->BlockageCbk) { + if (defData->Blockage.hasLayer() != 0) { + if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) { + defData->defError(6539, "Invalid BLOCKAGE statement defined in the DEF file. The BLOCKAGE statment has both the LAYER and the PLACEMENT statements defined.\nUpdate your DEF file to have either BLOCKAGE or PLACEMENT statement only."); + CHKERR(); + } + } + defData->Blockage.setPlacement(); + defData->Blockage.clearPoly(); // free poly, if any + } + defData->hasBlkPlaceComp = 0; + defData->hasBlkPlaceTypeComp = 0; + } + placement_comp_rules + +layer_blockage_rules: // empty + | layer_blockage_rules layer_blockage_rule + ; + +layer_blockage_rule: '+' K_SPACING NUMBER + { + if (defData->VersionNum < 5.6) { + if (defData->callbacks->BlockageCbk) { + if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The SPACING statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); + defData->defError(6540, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } else if (defData->hasBlkLayerSpac) { + if (defData->callbacks->BlockageCbk) { + if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) { + defData->defError(6541, "The SPACING statement is defined in the LAYER statement,\nbut there is already either a SPACING statement or DESIGNRULEWIDTH statement has defined in the LAYER statement.\nUpdate your DEF file to have either SPACING statement or a DESIGNRULEWIDTH statement."); + CHKERR(); + } + } + } else { + if (defData->callbacks->BlockageCbk) + defData->Blockage.setSpacing((int)$3); + defData->hasBlkLayerSpac = 1; + } + } + | '+' K_DESIGNRULEWIDTH NUMBER + { + if (defData->VersionNum < 5.6) { + if (defData->callbacks->BlockageCbk) { + if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) { + defData->defError(6541, "The SPACING statement is defined in the LAYER statement,\nbut there is already either a SPACING statement or DESIGNRULEWIDTH statement has defined in the LAYER statement.\nUpdate your DEF file to have either SPACING statement or a DESIGNRULEWIDTH statement."); + CHKERR(); + } + } + } else if (defData->hasBlkLayerSpac) { + if (defData->callbacks->BlockageCbk) { + if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) { + defData->defError(6541, "The SPACING statement is defined in the LAYER statement,\nbut there is already either a SPACING statement or DESIGNRULEWIDTH statement has defined in the LAYER statement.\nUpdate your DEF file to have either SPACING statement or a DESIGNRULEWIDTH statement."); + CHKERR(); + } + } + } else { + if (defData->callbacks->BlockageCbk) + defData->Blockage.setDesignRuleWidth((int)$3); + defData->hasBlkLayerSpac = 1; + } + } + | mask_blockage_rule + | comp_blockage_rule + +mask_blockage_rule: + '+' K_MASK NUMBER + { + if (defData->validateMaskInput((int)$3, defData->blockageWarnings, defData->settings->BlockageWarnings)) { + defData->Blockage.setMask((int)$3); + } + } + +comp_blockage_rule: + // 06/20/2001 - pcr 383204 = pcr 378102 + '+' K_COMPONENT { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING + { + if (defData->hasBlkLayerComp) { + if (defData->callbacks->BlockageCbk) { + if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) { + defData->defError(6542, "The defined BLOCKAGES COMPONENT statement has either COMPONENT, SLOTS, FILLS, PUSHDOWN or EXCEPTPGNET defined.\nOnly one of these statements is allowed per LAYER. Updated the DEF file to define a valid BLOCKAGES COMPONENT statement per layer."); + CHKERR(); + } + } + } else { + if (defData->callbacks->BlockageCbk) { + defData->Blockage.setComponent($4); + } + if (defData->VersionNum < 5.8) { + defData->hasBlkLayerComp = 1; + } + } + } + // 8/30/2001 - pcr 394394 + | '+' K_SLOTS + { + if (defData->hasBlkLayerComp || defData->hasBlkLayerTypeComp) { + if (defData->callbacks->BlockageCbk) { + if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) { + defData->defError(6542, "The defined BLOCKAGES COMPONENT statement has either COMPONENT, SLOTS, FILLS, PUSHDOWN or EXCEPTPGNET defined.\nOnly one of these statements is allowed per LAYER. Updated the DEF file to define a valid BLOCKAGES COMPONENT statement per layer."); + CHKERR(); + } + } + } else { + if (defData->callbacks->BlockageCbk) { + defData->Blockage.setSlots(); + } + if (defData->VersionNum < 5.8) { + defData->hasBlkLayerComp = 1; + } + if (defData->VersionNum == 5.8) { + defData->hasBlkLayerTypeComp = 1; + } + } + } + | '+' K_FILLS + { + if (defData->hasBlkLayerComp || defData->hasBlkLayerTypeComp) { + if (defData->callbacks->BlockageCbk) { + if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) { + defData->defError(6542, "The defined BLOCKAGES COMPONENT statement has either COMPONENT, SLOTS, FILLS, PUSHDOWN or EXCEPTPGNET defined.\nOnly one of these statements is allowed per LAYER. Updated the DEF file to define a valid BLOCKAGES COMPONENT statement per layer."); + CHKERR(); + } + } + } else { + if (defData->callbacks->BlockageCbk){ + defData->Blockage.setFills(); + } + if (defData->VersionNum < 5.8) { + defData->hasBlkLayerComp = 1; + } + if (defData->VersionNum == 5.8) { + defData->hasBlkLayerTypeComp = 1; + } + } + } + | '+' K_PUSHDOWN + { + if (defData->hasBlkLayerComp) { + if (defData->callbacks->BlockageCbk) { + if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) { + defData->defError(6542, "The defined BLOCKAGES COMPONENT statement has either COMPONENT, SLOTS, FILLS, PUSHDOWN or EXCEPTPGNET defined.\nOnly one of these statements is allowed per LAYER. Updated the DEF file to define a valid BLOCKAGES COMPONENT statement per layer."); + CHKERR(); + } + } + } else { + if (defData->callbacks->BlockageCbk){ + defData->Blockage.setPushdown(); + } + if (defData->VersionNum < 5.8) { + defData->hasBlkLayerComp = 1; + } + } + } + | '+' K_EXCEPTPGNET // 5.7 + { + if (defData->VersionNum < 5.7) { + if (defData->callbacks->BlockageCbk) { + if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) { + defData->defMsg = (char*)malloc(10000); + sprintf (defData->defMsg, + "The EXCEPTPGNET is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6549, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } else { + if (defData->hasBlkLayerComp) { + if (defData->callbacks->BlockageCbk) { + if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) { + defData->defError(6542, "The defined BLOCKAGES COMPONENT statement has either COMPONENT, SLOTS, FILLS, PUSHDOWN or EXCEPTPGNET defined.\nOnly one of these statements is allowed per LAYER. Updated the DEF file to define a valid BLOCKAGES COMPONENT statement per layer."); + CHKERR(); + } + } + } else { + if (defData->callbacks->BlockageCbk){ + defData->Blockage.setExceptpgnet(); + } + if (defData->VersionNum < 5.8){ + defData->hasBlkLayerComp = 1; + } + } + } + } + +placement_comp_rules: // empty + | placement_comp_rules placement_comp_rule + ; + +placement_comp_rule: // empty + // 10/29/2001 - enhancement + '+' K_COMPONENT { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING + { + if (defData->hasBlkPlaceComp) { + if (defData->callbacks->BlockageCbk) { + if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) { + defData->defError(6543, "The defined BLOCKAGES PLACEMENT statement has either COMPONENT, PUSHDOWN, SOFT or PARTIAL defined.\nOnly one of these statements is allowed per LAYER. Updated the DEF file to define a valid BLOCKAGES PLACEMENT statement."); + CHKERR(); + } + } + } else { + if (defData->callbacks->BlockageCbk){ + defData->Blockage.setComponent($4); + } + if (defData->VersionNum < 5.8) { + defData->hasBlkPlaceComp = 1; + } + } + } + | '+' K_PUSHDOWN + { + if (defData->hasBlkPlaceComp) { + if (defData->callbacks->BlockageCbk) { + if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) { + defData->defError(6543, "The defined BLOCKAGES PLACEMENT statement has either COMPONENT, PUSHDOWN, SOFT or PARTIAL defined.\nOnly one of these statements is allowed per LAYER. Updated the DEF file to define a valid BLOCKAGES PLACEMENT statement."); + CHKERR(); + } + } + } else { + if (defData->callbacks->BlockageCbk){ + defData->Blockage.setPushdown(); + } + if (defData->VersionNum < 5.8) { + defData->hasBlkPlaceComp = 1; + } + } + } + | '+' K_SOFT // 5.7 + { + if (defData->VersionNum < 5.7) { + if (defData->callbacks->BlockageCbk) { + if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) { + defData->defMsg = (char*)malloc(10000); + sprintf (defData->defMsg, + "The PLACEMENT SOFT is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6547, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } else { + if (defData->hasBlkPlaceComp || defData->hasBlkPlaceTypeComp) { + if (defData->callbacks->BlockageCbk) { + if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) { + defData->defError(6543, "The defined BLOCKAGES PLACEMENT statement has either COMPONENT, PUSHDOWN, SOFT or PARTIAL defined.\nOnly one of these statements is allowed per LAYER. Updated the DEF file to define a valid BLOCKAGES PLACEMENT statement."); + CHKERR(); + } + } + } else { + if (defData->callbacks->BlockageCbk){ + defData->Blockage.setSoft(); + } + if (defData->VersionNum < 5.8) { + defData->hasBlkPlaceComp = 1; + } + if (defData->VersionNum == 5.8) { + defData->hasBlkPlaceTypeComp = 1; + } + } + } + } + | '+' K_PARTIAL NUMBER // 5.7 + { + if (defData->VersionNum < 5.7) { + if (defData->callbacks->BlockageCbk) { + if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) { + defData->defMsg = (char*)malloc(10000); + sprintf (defData->defMsg, + "The PARTIAL is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6548, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } else { + if (defData->hasBlkPlaceComp || defData->hasBlkPlaceTypeComp) { + if (defData->callbacks->BlockageCbk) { + if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) { + defData->defError(6543, "The defined BLOCKAGES PLACEMENT statement has either COMPONENT, PUSHDOWN, SOFT or PARTIAL defined.\nOnly one of these statements is allowed per LAYER. Updated the DEF file to define a valid BLOCKAGES PLACEMENT statement."); + CHKERR(); + } + } + } else { + if (defData->callbacks->BlockageCbk){ + defData->Blockage.setPartial($3); + } + if (defData->VersionNum < 5.8) { + defData->hasBlkPlaceComp = 1; + } + if (defData->VersionNum == 5.8) { + defData->hasBlkPlaceTypeComp = 1; + } + } + } + } + + +rectPoly_blockage_rules: // empty + | rectPoly_blockage_rules rectPoly_blockage + ; + +rectPoly_blockage: K_RECT pt pt + { + if (defData->callbacks->BlockageCbk) + defData->Blockage.addRect($2.x, $2.y, $3.x, $3.y); + } + | K_POLYGON + { + if (defData->callbacks->BlockageCbk) { + defData->Geometries.Reset(); + } + } + firstPt nextPt nextPt otherPts + { + if (defData->callbacks->BlockageCbk) { + if (defData->VersionNum >= 5.6) { // only 5.6 and beyond + if (defData->Blockage.hasLayer()) { // only in layer + if (defData->callbacks->BlockageCbk) + defData->Blockage.addPolygon(&defData->Geometries); + } else { + if (defData->callbacks->BlockageCbk) { + if (defData->blockageWarnings++ < defData->settings->BlockageWarnings) { + defData->defError(6544, "A POLYGON statement is defined in the BLOCKAGE statement,\nbut it is not defined in the BLOCKAGE LAYER statement.\nUpdate your DEF file to either remove the POLYGON statement from the BLOCKAGE statement or\ndefine the POLYGON statement in a BLOCKAGE LAYER statement."); + CHKERR(); + } + } + } + } + } + } + +// 8/31/2001 - 5.4 enhancement +slot_section: slot_start slot_defs slot_end ; + +slot_start: K_SLOTS NUMBER ';' + { if (defData->callbacks->SlotStartCbk) + CALLBACK(defData->callbacks->SlotStartCbk, defrSlotStartCbkType, ROUND($2)); } + +slot_end: K_END K_SLOTS + { if (defData->callbacks->SlotEndCbk) + CALLBACK(defData->callbacks->SlotEndCbk, defrSlotEndCbkType, 0); } + +slot_defs: // empty + | slot_defs slot_def + ; + +slot_def: slot_rule geom_slot_rules ';' + { + if (defData->callbacks->SlotCbk) { + CALLBACK(defData->callbacks->SlotCbk, defrSlotCbkType, &defData->Slot); + defData->Slot.clear(); + } + } + +slot_rule: '-' K_LAYER { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING + { + if (defData->callbacks->SlotCbk) { + defData->Slot.setLayer($4); + defData->Slot.clearPoly(); // free poly, if any + } + } geom_slot + +geom_slot_rules: // empty + | geom_slot_rules geom_slot + ; + +geom_slot: K_RECT pt pt + { + if (defData->callbacks->SlotCbk) + defData->Slot.addRect($2.x, $2.y, $3.x, $3.y); + } + | K_POLYGON + { + defData->Geometries.Reset(); + } + firstPt nextPt nextPt otherPts + { + if (defData->VersionNum >= 5.6) { // only 5.6 and beyond + if (defData->callbacks->SlotCbk) + defData->Slot.addPolygon(&defData->Geometries); + } + } + +// 8/31/2001 - 5.4 enhancement +fill_section: fill_start fill_defs fill_end ; + +fill_start: K_FILLS NUMBER ';' + { if (defData->callbacks->FillStartCbk) + CALLBACK(defData->callbacks->FillStartCbk, defrFillStartCbkType, ROUND($2)); } + +fill_end: K_END K_FILLS + { if (defData->callbacks->FillEndCbk) + CALLBACK(defData->callbacks->FillEndCbk, defrFillEndCbkType, 0); } + +fill_defs: // empty + | fill_defs fill_def + ; + +fill_def: fill_rule geom_fill_rules ';' + { + if (defData->callbacks->FillCbk) { + CALLBACK(defData->callbacks->FillCbk, defrFillCbkType, &defData->Fill); + defData->Fill.clear(); + } + } + | '-' K_VIA { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING // 5.7 + { + if (defData->callbacks->FillCbk) { + defData->Fill.setVia($4); + defData->Fill.clearPts(); + defData->Geometries.Reset(); + } + } + fill_via_mask_opc_opt fill_via_pt ';' + +fill_rule: '-' K_LAYER { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING + { + if (defData->callbacks->FillCbk) { + defData->Fill.setLayer($4); + defData->Fill.clearPoly(); // free poly, if any + } + } + fill_layer_mask_opc_opt geom_fill // 5.7 + +geom_fill_rules: // empty + | geom_fill_rules geom_fill + ; + +geom_fill: K_RECT pt pt + { + if (defData->callbacks->FillCbk) + defData->Fill.addRect($2.x, $2.y, $3.x, $3.y); + } + | K_POLYGON + { + defData->Geometries.Reset(); + } + firstPt nextPt nextPt otherPts + { + if (defData->VersionNum >= 5.6) { // only 5.6 and beyond + if (defData->callbacks->FillCbk) + defData->Fill.addPolygon(&defData->Geometries); + } else { + defData->defMsg = (char*)malloc(10000); + sprintf (defData->defMsg, + "POLYGON statement in FILLS LAYER is a version 5.6 and later syntax.\nYour def file is defined with version %g.", defData->VersionNum); + defData->defError(6564, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + +fill_layer_mask_opc_opt: // empty + | fill_layer_mask_opc_opt opt_mask_opc_l + ; +opt_mask_opc_l: fill_layer_opc + | fill_mask + ; + +// 5.7 +fill_layer_opc: + '+' K_OPC + { + if (defData->VersionNum < 5.7) { + if (defData->callbacks->FillCbk) { + if (defData->fillWarnings++ < defData->settings->FillWarnings) { + defData->defMsg = (char*)malloc(10000); + sprintf (defData->defMsg, + "The LAYER OPC is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6553, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } else { + if (defData->callbacks->FillCbk) + defData->Fill.setLayerOpc(); + } + } + +fill_via_pt: firstPt otherPts + { + if (defData->callbacks->FillCbk) { + defData->Fill.addPts(&defData->Geometries); + CALLBACK(defData->callbacks->FillCbk, defrFillCbkType, &defData->Fill); + defData->Fill.clear(); + } + } + + +fill_via_mask_opc_opt: // empty + | fill_via_mask_opc_opt opt_mask_opc + ; +opt_mask_opc: fill_via_opc + | fill_viaMask + ; + +// 5.7 +fill_via_opc: + '+' K_OPC + { + if (defData->VersionNum < 5.7) { + if (defData->callbacks->FillCbk) { + if (defData->fillWarnings++ < defData->settings->FillWarnings) { + defData->defMsg = (char*)malloc(10000); + sprintf (defData->defMsg, + "The VIA OPC is available in version 5.7 or later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6554, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } else { + if (defData->callbacks->FillCbk) + defData->Fill.setViaOpc(); + } + } + +fill_mask: + '+' K_MASK NUMBER + { + if (defData->validateMaskInput((int)$3, defData->fillWarnings, defData->settings->FillWarnings)) { + if (defData->callbacks->FillCbk) { + defData->Fill.setMask((int)$3); + } + } + } + +fill_viaMask: + '+' K_MASK NUMBER + { + if (defData->validateMaskInput((int)$3, defData->fillWarnings, defData->settings->FillWarnings)) { + if (defData->callbacks->FillCbk) { + defData->Fill.setMask((int)$3); + } + } + } + +// 11/17/2003 - 5.6 enhancement +nondefaultrule_section: nondefault_start nondefault_def nondefault_defs + nondefault_end ; + +nondefault_start: K_NONDEFAULTRULES NUMBER ';' + { + if (defData->VersionNum < 5.6) { + if (defData->callbacks->NonDefaultStartCbk) { + if (defData->nonDefaultWarnings++ < defData->settings->NonDefaultWarnings) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The NONDEFAULTRULE statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g.", defData->VersionNum); + defData->defError(6545, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } else if (defData->callbacks->NonDefaultStartCbk) + CALLBACK(defData->callbacks->NonDefaultStartCbk, defrNonDefaultStartCbkType, + ROUND($2)); + } + +nondefault_end: K_END K_NONDEFAULTRULES + { if (defData->callbacks->NonDefaultEndCbk) + CALLBACK(defData->callbacks->NonDefaultEndCbk, defrNonDefaultEndCbkType, 0); } + +nondefault_defs: // empty + | nondefault_defs nondefault_def + ; + +nondefault_def: '-' { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING + { + if (defData->callbacks->NonDefaultCbk) { + defData->NonDefault.clear(); + defData->NonDefault.setName($3); + } + } + nondefault_options ';' + { if (defData->callbacks->NonDefaultCbk) + CALLBACK(defData->callbacks->NonDefaultCbk, defrNonDefaultCbkType, &defData->NonDefault); } + +nondefault_options: // empty + | nondefault_options nondefault_option + ; + +nondefault_option: '+' K_HARDSPACING + { + if (defData->callbacks->NonDefaultCbk) + defData->NonDefault.setHardspacing(); + } + | '+' K_LAYER { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING + K_WIDTH NUMBER + { + if (defData->callbacks->NonDefaultCbk) { + defData->NonDefault.addLayer($4); + defData->NonDefault.addWidth($6); + } + } + nondefault_layer_options + | '+' K_VIA { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING + { + if (defData->callbacks->NonDefaultCbk) { + defData->NonDefault.addVia($4); + } + } + | '+' K_VIARULE { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING + { + if (defData->callbacks->NonDefaultCbk) { + defData->NonDefault.addViaRule($4); + } + } + | '+' K_MINCUTS { defData->dumb_mode = 1; defData->no_num = 1; } T_STRING NUMBER + { + if (defData->callbacks->NonDefaultCbk) { + defData->NonDefault.addMinCuts($4, (int)$5); + } + } + | nondefault_prop_opt + ; + +nondefault_layer_options: // empty + | nondefault_layer_options nondefault_layer_option + +nondefault_layer_option: + K_DIAGWIDTH NUMBER + { + if (defData->callbacks->NonDefaultCbk) { + defData->NonDefault.addDiagWidth($2); + } + } + | K_SPACING NUMBER + { + if (defData->callbacks->NonDefaultCbk) { + defData->NonDefault.addSpacing($2); + } + } + | K_WIREEXT NUMBER + { + if (defData->callbacks->NonDefaultCbk) { + defData->NonDefault.addWireExt($2); + } + } + ; + +nondefault_prop_opt: '+' K_PROPERTY { defData->dumb_mode = DEF_MAX_INT; } + nondefault_prop_list + { defData->dumb_mode = 0; } + +nondefault_prop_list: // empty + | nondefault_prop_list nondefault_prop + ; + +nondefault_prop: T_STRING NUMBER + { + if (defData->callbacks->NonDefaultCbk) { + char propTp; + char* str = defData->ringCopy(" "); + propTp = defData->session->NDefProp.propType($1); + CHKPROPTYPE(propTp, $1, "NONDEFAULTRULE"); + sprintf(str, "%g", $2); + defData->NonDefault.addNumProperty($1, $2, str, propTp); + } + } + | T_STRING QSTRING + { + if (defData->callbacks->NonDefaultCbk) { + char propTp; + propTp = defData->session->NDefProp.propType($1); + CHKPROPTYPE(propTp, $1, "NONDEFAULTRULE"); + defData->NonDefault.addProperty($1, $2, propTp); + } + } + | T_STRING T_STRING + { + if (defData->callbacks->NonDefaultCbk) { + char propTp; + propTp = defData->session->NDefProp.propType($1); + CHKPROPTYPE(propTp, $1, "NONDEFAULTRULE"); + defData->NonDefault.addProperty($1, $2, propTp); + } + } + +// 12/2/2003 - 5.6 enhancement +styles_section: styles_start styles_rules styles_end ; + +styles_start: K_STYLES NUMBER ';' + { + if (defData->VersionNum < 5.6) { + if (defData->callbacks->StylesStartCbk) { + if (defData->stylesWarnings++ < defData->settings->StylesWarnings) { + defData->defMsg = (char*)malloc(1000); + sprintf (defData->defMsg, + "The STYLES statement is available in version 5.6 and later.\nHowever, your DEF file is defined with version %g", defData->VersionNum); + defData->defError(6546, defData->defMsg); + free(defData->defMsg); + CHKERR(); + } + } + } else if (defData->callbacks->StylesStartCbk) + CALLBACK(defData->callbacks->StylesStartCbk, defrStylesStartCbkType, ROUND($2)); + } + +styles_end: K_END K_STYLES + { if (defData->callbacks->StylesEndCbk) + CALLBACK(defData->callbacks->StylesEndCbk, defrStylesEndCbkType, 0); } + +styles_rules: // empty + | styles_rules styles_rule + ; + +styles_rule: '-' K_STYLE NUMBER + { + if (defData->callbacks->StylesCbk) defData->Styles.setStyle((int)$3); + defData->Geometries.Reset(); + } + firstPt nextPt otherPts ';' + { + if (defData->VersionNum >= 5.6) { // only 5.6 and beyond will call the callback + if (defData->callbacks->StylesCbk) { + defData->Styles.setPolygon(&defData->Geometries); + CALLBACK(defData->callbacks->StylesCbk, defrStylesCbkType, &defData->Styles); + } + } + } + + +%% + +END_LEFDEF_PARSER_NAMESPACE diff --git a/src/def/def/def_keywords.cpp b/src/def/def/def_keywords.cpp new file mode 100644 index 00000000..8e665fc9 --- /dev/null +++ b/src/def/def/def_keywords.cpp @@ -0,0 +1,1363 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2016, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: icftcm $ +// $Revision: #2 $ +// $Date: 2017/08/28 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +/* */ +/* Revision: */ +/* 03-15-2000 Wanda da Rosa - Add code to support 5.4, add keywords */ +/* for PINS + USE, SPECIALNETS + SHAPE */ +/* and other keywords */ + +#include +#include +#include +#include "lex.h" +#include "defiDefs.hpp" +#include "defiDebug.hpp" +#include "defrCallBacks.hpp" +#include "defrData.hpp" +#include "defrSettings.hpp" + +#ifdef WIN32 +# include +#else /* not WIN32 */ +# include +#endif /* WIN32 */ + + +using namespace std; + +BEGIN_LEFDEF_PARSER_NAMESPACE + +#include "def.tab.h" + + +int defrData::defGetKeyword(const char* name, int *result) +{ + map::const_iterator search = settings->Keyword_set.find(name); + + if ( search != settings->Keyword_set.end()) { + *result = search->second; + return TRUE; + } + + return FALSE; +} + +int +defrData::defGetAlias(const string &name, string &result) +{ + map::iterator search = def_alias_set.find(name); + + if ( search != def_alias_set.end()) { + result = search->second; + return TRUE; + } + + return FALSE; +} + +int defrData::defGetDefine(const string &name, string &result) +{ + map::iterator search = def_defines_set.find(name); + + if ( search != def_defines_set.end()) { + result = search->second; + return TRUE; + } + + return FALSE; +} + +// lex.cpph starts here +/* User defined if log file should be in append from the previous run */ +/* User defined if property string value should be process */ +/* Varible from lex.cpph to keep track of invalid nonEnglish character */ +/* in def file */ + +/************Some simple file reading routines since ungetc() proves ****/ +/************to be quite slow, and we don't need multiple chars of pushback */ +#ifndef WIN32 +# include +#endif + +void +defrData::reload_buffer() { + int nb = 0; + + if (first_buffer) { + first_buffer = 0; + if (settings->ReadFunction) { + if ((nb = (*settings->ReadFunction)(File, buffer, 4)) != 4) { + next = NULL; + return; + } + } else { + if ((nb = fread(buffer, 1, 4, File)) != 4) { + next = NULL; + return; + } + } + } + + if (nb == 0) { + if (settings->ReadFunction) + nb = (*settings->ReadFunction)(File, buffer, IN_BUF_SIZE); + else + /* This is a normal file so just read some bytes. */ + nb = fread(buffer, 1, IN_BUF_SIZE, File); + } + + if (nb <= 0) { + next = NULL; + } else { + next = buffer; + last = buffer + nb - 1; + } +} + +int + defrData::GETC() { + // Remove '\r' symbols from Windows streams. + for(;;) { + if (next > last) + reload_buffer(); + if(next == NULL) + return EOF; + + int ch = *next++; + + if (ch != '\r') + return ch; + } +} + +void +defrData::UNGETC(char ch) { + if (next <= buffer) { + defError(6111, "UNGETC: buffer access violation."); + } else { + *(--next) = ch; + } +} + +/* Return a copy of the string allocated from the ring buffer. + * We will keep several strings in the buffer and just reuse them. + * This could cause problems if we need to use more strings than we + * have in the buffer. + */ +char* +defrData::ringCopy(const char* string) +{ + int len = strlen(string) + 1; + if (++(ringPlace) >= RING_SIZE) + ringPlace = 0; + if (len > ringSizes[ringPlace]) { + free(ring[ringPlace]); + ring[ringPlace] = (char*)malloc(len); + ringSizes[ringPlace] = len; + } + strcpy(ring[ringPlace], string); + return ring[ringPlace]; +} + + +int +defrData::DefGetTokenFromStack(char *s) { + const char *ch; /* utility variable */ + char *prS = NULL; /* pointing to the previous char or s */ + + while(input_level >= 0) { + for(ch=stack[input_level].c_str(); *ch != 0; ch++) /* skip white space */ + if (*ch != ' ' && *ch != '\t' && (nl_token || *ch != '\n')) + break; + /* did we find anything? If not, decrement level and try again */ + if (*ch == 0) + input_level--; + else if (*ch == '\n') { + *s++ = *ch; + *s = 0; + return TRUE; + } + else { /* we found something */ + for(; ; ch++) { + if (*ch == ' ' || *ch == '\t' || *ch == '\n' || *ch == 0) { + /* 10/10/2000 - Wanda da Rosa, pcr 341032 + ** Take out the last '"', the 1st will be skip later + */ + if (*prS == '"') { + *prS = '\0'; + } else + *s++ = '\0'; + stack[input_level] = ch; + + return TRUE; + } + /* 10/10/2000 - Wanda da Rosa, pcr 341032 + ** Save the location of the previous s + */ + prS = s; + *s++ = *ch; + } + } + } + return FALSE; /* if we get here, we ran out of input levels */ +} + + void +defrData::print_lines(long long lines) +{ + if (lines % settings->defiDeltaNumberLines) { + return; + } + + if (settings->ContextLineNumberFunction) { + settings->ContextLineNumberFunction(session->UserData, (int)lines); + } else if (settings->ContextLongLineNumberFunction ) { + settings->ContextLongLineNumberFunction(session->UserData, lines); + } + if (settings->LineNumberFunction) { + settings->LineNumberFunction((int)lines); + } else if (settings->LongLineNumberFunction ) { + settings->LongLineNumberFunction(lines); + } +} + +const char * +defrData::lines2str(long long lines) +{ + +#ifdef _WIN32 + sprintf(lineBuffer, "%I64d", lines); +#else + sprintf(lineBuffer, "%lld", lines); +#endif + + return lineBuffer; +} + + +// Increment current position of buffer pointer. +// Double buffer size if curPos is out of boundary. +void +defrData::IncCurPos(char **curPos, char **buffer, int *bufferSize) +{ + (*curPos)++; + if (*curPos - *buffer < *bufferSize) { + return; + } + + long offset = *curPos - *buffer; + + *bufferSize *= 2; + *buffer = (char*) realloc(*buffer, *bufferSize); + *curPos = *buffer + offset; +} + + +int +defrData::DefGetToken(char **buf, int *bufferSize) +{ + char *s = *buf; + int ch; + + ntokens++; + defInvalidChar = 0; + + if (input_level >= 0){ /* if we are expanding an alias */ + if(DefGetTokenFromStack(s)) /* try to get a token from it */ + return TRUE; /* if we get one, return it */ + } /* but if not, continue */ + + /* skip blanks and count lines */ + while ((ch = GETC()) != EOF) { + if (ch == '\n') { + print_lines(++nlines); + } + if (ch != ' ' && ch != '\t' && (nl_token || ch != '\n')) + break; + } + + if (ch == EOF) + return FALSE; + + + if (ch == '\n') { + *s = ch; + IncCurPos(&s, buf, bufferSize); + + *s = '\0'; + return TRUE; + } + + /* now get the token */ + if (ch == '"') { + do { + /* 5/5/2008 - CCR 556818 + ** Check if the ch is a valid ascii character 0 =< ch < 128 + ** If not write out an error + */ + /* 8/7/2008 - CCR 586175 + ** Some files may not end with \n or \0 or EOF as the last character + ** The parser allows this char instead of error out + */ + if ((ch < -1) || (ch > 127)) { + defInvalidChar = 1; + } + + /* 8/22/2000 - Wanda da Rosa, pcr 333334 + ** save the previous char to allow backslash quote within quote + */ + if (!settings->DisPropStrProcess) { + /* 3/4/2008 - CCR 523879 - convert \\ to \, \" to ", \x to x */ + if (ch == '\\') { /* got a \, save the next char only */ + ch = GETC(); + if ((ch == '\n') || (ch == EOF)) { /* senaty check */ + *s = '\0'; + return FALSE; + } + } + } + + *s = ch; + IncCurPos(&s, buf, bufferSize); + + ch = GETC(); + + if (ch == EOF) { + *s = '\0'; + return FALSE; + } + } while (ch != '"'); + + *s = '\0'; + return TRUE; + } + + if (names_case_sensitive) { + for(; ; ch = GETC()) { + + /* 5/5/2008 - CCR 556818 + ** Check if the ch is a valid ascii character 0 =< ch < 128 + ** If not write out an error + */ + if ((ch < -1) || (ch > 127)) { + defInvalidChar = 1; + } + + if (ch == ' ' || ch == '\t' || ch == '\n' || ch == EOF) + break; + + *s = ch; + IncCurPos(&s, buf, bufferSize); + } + } + else { /* we are case insensitive, use a different loop */ + for(; ; ch = GETC()) { + + /* 5/5/2008 - CCR 556818 + ** Check if the ch is a valid ascii character 0 =< ch < 128 + ** If not write out an error + */ + if ((ch < -1) || (ch > 127)) { + defInvalidChar = 1; + } + + if (ch == ' ' || ch == '\t' || ch == '\n' || ch == EOF) + break; + + *s = (ch >= 'a' && ch <= 'z')? (ch -'a' + 'A') : ch; + IncCurPos(&s, buf, bufferSize); + } + } + + /* If we got this far, the last char was whitespace */ + *s = '\0'; + if (ch != EOF) /* shouldn't ungetc an EOF */ + UNGETC((char)ch); + return TRUE; +} + +/* creates an upper case copy of an array */ +void +defrData::uc_array(char *source, char *dest) +{ + for(; *source != 0; ) + *dest++ = toupper(*source++); + *dest = 0; +} + + +void +defrData::StoreAlias() +{ + int tokenSize = TOKEN_SIZE; + char *aname = (char*)malloc(tokenSize); + + DefGetToken(&aname, &tokenSize); + + char *line = (char*)malloc(tokenSize); + + DefGetToken(&line, &tokenSize); + + char *uc_line = (char*)malloc(tokenSize); + + string so_far; /* contains alias contents as we build it */ + + if (strcmp(line,"=") != 0) { + defError(6000, "Expecting '='"); + return; + } + + /* now keep getting lines till we get one that contains &ENDALIAS */ + for(char *p = NULL ;p == NULL;){ + int i; + char *s = line; + for(i=0;i 0, it reads the next token in "dumb mode". + * In this case, it does not do keyword lookup, or attempt to read a token + * as a number; if the token is not punctuation, it's a T_STRING. Each token + * read decrements dumb_mode, so you can instruct the the lexer to read the + * next N tokens in dumb mode by setting "dumb_mode" to that value. + * + * Newlines are in general silently ignored. If the global nl_token is + * true, however, they are returned as the token K_NL. + */ + +int +defrData::defyylex(YYSTYPE *pYylval) { + + int v = sublex(pYylval); + if (defPrintTokens) { + if (v == 0) { + printf("yylex NIL\n"); + } else if (v < 256) { + printf("yylex char %c\n", v); + } else if (v == QSTRING) { + printf("yylex quoted string '%s'\n", pYylval->string); + } else if (v == T_STRING) { + printf("yylex string '%s'\n", pYylval->string); + } else if (v == NUMBER) { + printf("yylex number %f\n", pYylval->dval); + } else { + printf("yylex keyword %s\n", defrData::defkywd(v)); + } + } + + if ((v == 0) && (!doneDesign)) { + defError(6002, "Incomplete def file."); + // Stop printing error messages after the EOF. + hasFatalError = 1; + return (-1); + } + + return v; +} + +int +defrData::sublex(YYSTYPE *pYylval) +{ + char fc; + double numVal; + char* outMsg; + + pv_deftoken = (char*)realloc(pv_deftoken, deftokenLength); + strcpy(pv_deftoken, deftoken); + + /* First, we eat all the things the parser should be unaware of. + * This includes: + * a) Comments + * b) &alias definitions + * c) &alias expansions + */ + for(;;) { + if(!DefGetToken(&deftoken, &deftokenLength)) { /* get a raw token */ + return 0; + } + fc = deftoken[0]; + uc_token = (char*)realloc(uc_token, deftokenLength); + + /* first, check for # comments or &alias statements. # comments + we ignore, and &alias statements are eaten and recorded by the + lexer. */ + if (fc == settings->CommentChar) { + // The code isn't work in correct way, no way to fix it exits + // but keep it for compatibility reasons. + int magic_count = -1; + for(fc = GETC();; fc = GETC()) {/* so skip to the end of line */ + magic_count++; + if ((magic_count < (int)strlen(magic)) && (fc == magic[magic_count])) { + if ((int)strlen(magic) == (magic_count + 1)) { + if (settings->MagicCommentFoundFunction) { + settings->MagicCommentFoundFunction(); + } + } + } + if (fc == EOF) return 0; + if (fc == '\n') { + print_lines(++nlines); + break; + } + } + } + else if (fc == '&') { + /* begins with &. If &alias, read contents and */ + /* store them. Otherwise it's a define, or a macro use. */ + string alias; + uc_array(deftoken, uc_token); + + if (strcmp(uc_token,"&ALIAS") == 0) + StoreAlias(); /* read and store the alias */ + else if (defGetAlias(deftoken, alias)) + stack[++input_level] = alias; + else + break; /* begins with &, but not an &alias defn. or use. */ + } else + break; /* does not begin with commentChar or '&' */ + } + + if (defInvalidChar) { + outMsg = (char*)malloc(500 + strlen(deftoken)); + sprintf(outMsg, "Invalid characters found in \'%s\'.\nThese characters might be using the character types other than English.\nCreate characters by specifying valid characters types.", + deftoken); + defError(6008, outMsg); + free(outMsg); + hasFatalError = 1; + return 0; + } + + if (doneDesign) { + fc = EOF; + defInfo(8000, "There are still data after the END DESIGN statement"); + return 0; + } + + if(fc == '\"') { + pYylval->string = ringCopy(&(deftoken[1])); + + return QSTRING; + } + + /* at this point we've read a token */ + /* printf("Token is %s\n", deftoken); */ + + // Protect the token counting variables form the decrement overflow. + if (dumb_mode >= 0) { + dumb_mode--; + } + + if (no_num >= 0) { + no_num--; + } + + if (isdigit(fc) || fc == '.' || (fc == '-' && deftoken[1] != '\0') ) { + char *ch; + /* 6/12/2003 - The following switching to use strtol first is a fix */ + /* for FE for performance improvement. */ + /* Adding the flag "parsing_property" is for pcr 594214, need to call */ + /* strtod first to handle double number inside PROPERTY. Only */ + /* property has real number (large number) */ + if (!real_num) { + pYylval->dval = strtol(deftoken, &ch, 10); /* try string to long first */ + if (no_num < 0 && *ch == '\0') { /* did we use the whole string? */ + return NUMBER; + } else { /* failed strtol, try double */ + numVal = pYylval->dval = strtod(deftoken, &ch); + if (no_num < 0 && *ch == '\0') { /* did we use the whole string? */ + /* check if the integer has exceed the limit */ + if ((numVal >= lVal) && (numVal <= rVal)) + return NUMBER; /* YES, it's really a number */ + else { + char* str = (char*)malloc(strlen(deftoken) + +strlen(session->FileName)+350); + sprintf(str, + " in %s at line %s\n", + session->FileName, lines2str(nlines)); + fflush(stdout); + defiError(1, 0, str); + free(str); + errors++; + return NUMBER; + } + } else { + pYylval->string = ringCopy(deftoken); /* NO, it's a string */ + return T_STRING; + } + } + } else { /* handling PROPERTY, do strtod first instead of strtol */ + numVal = pYylval->dval = strtod(deftoken, &ch); + if (no_num < 0 && *ch == '\0') { /* did we use the whole string? */ + /* check if the integer has exceed the limit */ + if (real_num) /* this is for PROPERTYDEF with REAL */ + return NUMBER; + if ((numVal >= lVal) && (numVal <= rVal)) + return NUMBER; /* YES, it's really a number */ + else { + char* str = (char*)malloc(strlen(deftoken) + +strlen(session->FileName)+350); + sprintf(str, + " in %s at line %s\n", + session->FileName, lines2str(nlines)); + fflush(stdout); + defiError(1, 0, str); + free(str); + errors++; + return NUMBER; + } + } else { /* failed integer conversion, try floating point */ + pYylval->dval = strtol(deftoken, &ch, 10); + if (no_num < 0 && *ch == '\0') /* did we use the whole string? */ + return NUMBER; + else { + pYylval->string = ringCopy(deftoken); /* NO, it's a string */ + return T_STRING; + } + } + } + } + + /* if we are dumb mode, all we return is punctuation and strings & numbers*/ + /* until we see the next '+' or ';' deftoken */ + if (dumb_mode >= 0) { + if (deftoken[1]=='\0' && (fc=='('||fc==')'||fc=='+'||fc==';'||fc=='*')){ + + if (fc == ';' || fc == '+') { + dumb_mode = 0; + no_num = 0; + } + return (int)fc; + } + if (by_is_keyword && ((strcmp(deftoken,"BY") == 0) || + (strcmp(deftoken, "by") == 0))) { + return K_BY; /* even in dumb mode, we must see the BY deftoken */ + } + if (do_is_keyword && ((strcmp(deftoken,"DO") == 0) || + (strcmp(deftoken, "do") == 0))) { + return K_DO; /* even in dumb mode, we must see the DO deftoken */ + } + if (new_is_keyword && ((strcmp(deftoken,"NEW") == 0) || + (strcmp(deftoken, "new") == 0))) { + return K_NEW; /* even in dumb mode, we must see the NEW deftoken */ + } + if (nondef_is_keyword && ((strcmp(deftoken, "NONDEFAULTRULE") == 0) || + (strcmp(deftoken, "nondefaultrule") == 0))){ + return K_NONDEFAULTRULE; /* even in dumb mode, we must see the */ + /* NONDEFAULTRULE deftoken */ + } + if (mustjoin_is_keyword && ((strcmp(deftoken, "MUSTJOIN") == 0) || + (strcmp(deftoken, "mustjoin") == 0))) { + return K_MUSTJOIN; /* even in dumb mode, we must see the */ + /* MUSTJOIN deftoken */ + } + if (step_is_keyword && ((strcmp(deftoken,"STEP") == 0) || + (strcmp(deftoken, "step") == 0))) { + return K_STEP;/* even in dumb mode, we must see the STEP deftoken */ + } + if (fixed_is_keyword && ((strcmp(deftoken,"FIXED") == 0) || + (strcmp(deftoken, "fixed") == 0))) { + return K_FIXED; /* even in dumb mode, we must see the FIXED deftoken */ + } + if (cover_is_keyword && ((strcmp(deftoken,"COVER") == 0) || + (strcmp(deftoken, "cover") == 0))) { + return K_COVER; /* even in dumb mode, we must see the COVER deftoken */ + } + if (routed_is_keyword && ((strcmp(deftoken,"ROUTED") == 0) || + (strcmp(deftoken, "rounted") == 0))) { + return K_ROUTED; /* even in dumb mode, we must see the */ + /* ROUTED deftoken */ + } + + if (virtual_is_keyword && ((strcmp(deftoken, "VIRTUAL") == 0 ) + || (strcmp(deftoken, "virtual") == 0 ))) { + return K_VIRTUAL; + } + + if (rect_is_keyword && ((strcmp(deftoken, "RECT") == 0 ) + || (strcmp(deftoken, "rect") == 0 ))) { + return K_RECT; + } + + if (virtual_is_keyword && ((strcmp(deftoken, "MASK") == 0 ) + || (strcmp(deftoken, "mask") == 0 ))) { + return K_MASK; + } + + if (orient_is_keyword) { + int result; + uc_array(deftoken, uc_token); + + if (defGetKeyword(uc_token, &result)) { + if (K_N == result) + return K_N; + if (K_W == result) + return K_W; + if (K_S == result) + return K_S; + if (K_E == result) + return K_E; + if (K_FN == result) + return K_FN; + if (K_FW == result) + return K_FW; + if (K_FS == result) + return K_FS; + if (K_FE == result) + if (strcmp(deftoken, "FE") == 0) + return K_FE; + } + } + pYylval->string = ringCopy(deftoken); + return T_STRING; + } + + /* if we get here we are in smart mode. Parse deftoken */ + /* 2/19/2004 - add _ since name can starts with '_' */ + /* 2/23/2004 - add the following characters which a name can starts with */ + /* ! $ | : , @ ~ = < . ? { ' ^ " */ + if (isalpha(fc) || fc == '&' || fc == '_') { + int result; + + History_text.resize(0); + uc_array(deftoken, uc_token); + + if (defGetKeyword(uc_token, &result)) { + if (K_HISTORY == result) { /* history - get up to ';' */ + int c; + int prev; + prev = ' '; + while (1) { + c = GETC(); + + if (c == EOF) { + defError(6015, "Unexpected end of the DEF file."); + break; + } + + if (c == ';' && (prev == ' ' || prev == '\t' || prev == '\n')) + break; + if (c == '\n') { + print_lines(++nlines); + } + prev = c; + History_text.push_back(c); + } + History_text.push_back('\0'); + } else if (K_BEGINEXT == result) { /* extension, get up to end */ + int cc; + int foundTag = 0; + int notEmpTag = 0; + int begQuote = 0; + /* First make sure there is a name after BEGINEXT within quote */ + /* BEGINEXT "name" */ + while (1) { + cc = GETC(); + + if (cc == EOF) { + defError(6015, "Unexpected end of the DEF file."); + break; + } + + if (cc == '\n') { + if (!foundTag) { + defError(6003, "tag is missing for BEGINEXT"); + break; + } + } else { + + History_text.push_back(cc); + if (cc != ' ') { + if (cc == '\"') { /* found a quote */ + if (!begQuote) + begQuote = 1; + else if (notEmpTag) { + foundTag = 1; + break; /* Found the quoted tag */ + } else { + defError(6004, "The BEGINEXT tag is empty. Specify a value for the tag and try again."); + break; + } + } else if (!begQuote) { /* anything but a quote */ + defError(6005, "The '\"' is missing within the tag. Specify the '\"' in the tag and then try again."); + break; + } else /* anything but a quote and there */ + notEmpTag = 1; /* is already a quote */ + } + } + } + if (foundTag) { + /* We have handle with the tag, just read the rest until */ + /* ENDEXT */ + begQuote = 0; + while (1) { + cc = GETC(); + + if (cc == EOF) { + defError(6015, "Unexpected end of the DEF file."); + break; + } + + if (cc == '\n') { + print_lines(++nlines); + } else if (cc == '\"') { + if (!begQuote) + begQuote = 1; + else + begQuote = 0; + } + + History_text.push_back(cc); + + int histTextSize = History_text.size(); + + if (histTextSize >= 6 && memcmp(&History_text[histTextSize - 6 ], "ENDEXT", 6) == 0) { + if (begQuote) + defError(6006, "The ending '\"' is missing in the tag. Specify the ending '\"' in the tag and then try again."); + break; + } else if (histTextSize >= 10 && memcmp(&History_text[histTextSize - 10 ], "END DESIGN", 10) == 0) { + defError(6007, "The ENDEXT statement is missing in the DEF file. Include the statement and then try again."); + nlines--; + break; + } + } + } + History_text.push_back('\0'); + } + return result; /* YES, return its value */ + } else { /* we don't have a keyword. */ + if (fc == '&') + return amper_lookup(pYylval, deftoken); + pYylval->string = ringCopy(deftoken); /* NO, it's a string */ + return T_STRING; + } + } else { /* it should be a punctuation character */ + if (deftoken[1] != '\0') { + if (strcmp(deftoken, ">=") == 0) return K_GE; + if (strcmp(deftoken, "<=") == 0) return K_LE; + if (strcmp(deftoken, "<>") == 0) return K_NE; + + defError(6017, "Odd punctuation found."); + hasFatalError = 1; + } else if (strlen(deftoken) > 2 + || strlen(deftoken) == 0) { + defError(6017, "Odd punctuation found."); + hasFatalError = 1; + } + return (int)deftoken[0]; + } +} + +/* We have found a deftoken beginning with '&'. If it has been previously + defined, substitute the definition. Otherwise return it. */ +int +defrData::amper_lookup(YYSTYPE *pYylval, char *tkn) +{ + string defValue; + + /* printf("Amper_lookup: %s\n", tkn); */ + + /* &defines returns a T_STRING */ + if (defGetDefine(tkn, defValue)) { + int value; + if (defGetKeyword(defValue.c_str(), &value)) + return value; + if (defValue.c_str()[0] == '"') + pYylval->string = ringCopy(defValue.c_str()+1); + else + pYylval->string = ringCopy(defValue.c_str()); + return (defValue.c_str()[0] == '\"' ? QSTRING : T_STRING); + } + /* if none of the above, just return the deftoken. */ + pYylval->string = ringCopy(tkn); + return T_STRING; +} + +void +defrData::defError(int msgNum, const char *s) { + char* str; + const char *curToken = isgraph(deftoken[0]) ? deftoken + : ""; + const char *pvToken = isgraph(pv_deftoken[0]) ? pv_deftoken + : ""; + int len = strlen(curToken)-1; + int pvLen = strlen(pvToken)-1; + + if (hasFatalError) + return; + if ((settings->totalDefMsgLimit > 0) && (defMsgPrinted >= settings->totalDefMsgLimit)) + return; + if (settings->MsgLimit[msgNum-5000] > 0) { + if (msgLimit[msgNum-5000] >= settings->MsgLimit[msgNum-5000]) + return; /* over the limit */ + msgLimit[msgNum-5000] = msgLimit[msgNum-5000] + 1; + } + + /* PCR 690679, probably missing space before a ';' */ + if (strcmp(s, "parse error") == 0) { + if ((len > 1) && (deftoken[len] == ';')) { + str = (char*)malloc(len + strlen(s) + strlen(session->FileName) + 350); + sprintf(str, "ERROR (DEFPARS-%d): %s, file %s at line %s\nLast token was <%s>, space is missing before <;>\n", + msgNum, s, session->FileName, lines2str(nlines), curToken); + } else if ((pvLen > 1) && (pv_deftoken[pvLen] == ';')) { + str = (char*)malloc(pvLen + strlen(s) + strlen(session->FileName) + 350); + sprintf(str, "ERROR (DEFPARS-%d): %s, file %s at line %s\nLast token was <%s>, space is missing before <;>\n", + msgNum, s, session->FileName, lines2str(nlines-1), pvToken); + } else { + str = (char*)malloc(len + strlen(session->FileName) + 350); + sprintf(str, "ERROR (DEFPARS-%d): Def parser has encountered an error in file %s at line %s, on token %s.\nProblem can be syntax error on the def file or an invalid parameter name.\nDouble check the syntax on the def file with the LEFDEF Reference Manual.\n", + msgNum, session->FileName, lines2str(nlines), curToken); + } + } else if (strcmp(s, "syntax error") == 0) { + if ((len > 1) && (deftoken[len] == ';')) { + str = (char*)malloc(len + strlen(s) + strlen(session->FileName) + 350); + sprintf(str, "ERROR (DEFPARS-%d): %s, file %s at line %s\nLast token was <%s>, space is missing before <;>\n", + msgNum, s, session->FileName, lines2str(nlines), curToken); + } else if ((pvLen > 1) && (pv_deftoken[pvLen] == ';')) { + str = (char*)malloc(pvLen + strlen(s) + strlen(session->FileName) + 350); + sprintf(str, "ERROR (DEFPARS-%d): %s, file %s at line %s\nLast token was <%s>, space is missing before <;>\n", + msgNum, s, session->FileName, lines2str(nlines-1), pvToken); + } else { + str = (char*)malloc(len + strlen(session->FileName) + 350); + sprintf(str, "ERROR (DEFPARS-%d): Def parser has encountered an error in file %s at line %s, on token %s.\nProblem can be syntax error on the def file or an invalid parameter name.\nDouble check the syntax on the def file with the LEFDEF Reference Manual.\n", + msgNum, session->FileName, lines2str(nlines), curToken); + } + } else { + str = (char*)malloc(len + strlen(s) + strlen(session->FileName) + 350); + sprintf(str, "ERROR (DEFPARS-%d): %s Error in file %s at line %s, on token %s.\nUpdate the def file before parsing the file again.\n", + msgNum, s, session->FileName, lines2str(nlines), curToken); + } + + fflush(stdout); + defiError(1, msgNum, str); + free(str); + errors++; +} + +/* yydeferror is called by bison.simple */ +void +defrData::defyyerror(const char *s) { + defError(defMsgCnt++, s); +} + +/* All info starts with 8000 */ +/* All info within defInfo starts with 8500 */ +void +defrData::defInfo(int msgNum, const char *s) { + int i; + + for (i = 0; i < settings->nDDMsgs; i++) { /* check if info has been disable */ + if (settings->disableDMsgs[i] == msgNum) + return; /* don't print out any info since msg has been disabled */ + } + + if (settings->ContextWarningLogFunction) { + char* str = (char*)malloc(strlen(deftoken)+strlen(s) + +strlen(session->FileName)+350); + sprintf(str, "INFO (DEFPARS-%d): %s See file %s at line %s.\n", + msgNum, s, session->FileName, lines2str(nlines)); + (*settings->ContextWarningLogFunction)(session->UserData, str); + free(str); + } else if (settings->WarningLogFunction) { + char* str = (char*)malloc(strlen(deftoken)+strlen(s) + +strlen(session->FileName)+350); + sprintf(str, "INFO (DEFPARS-%d): %s See file %s at line %s.\n", + msgNum, s, session->FileName, lines2str(nlines)); + (*settings->WarningLogFunction)(str); + free(str); + } else if (defrLog) { + fprintf(defrLog, "INFO (DEFPARS-%d): %s See file %s at line %s\n", + msgNum, s, session->FileName, lines2str(nlines)); + } else { + if (!hasOpenedDefLogFile) { + if ((defrLog = fopen("defRWarning.log", "w")) == 0) { + printf("WARNING(DEFPARS-8500): Unable to open the file defRWarning.log in %s.\n", + getcwd(NULL, 64)); + printf("Info messages will not be printed.\n"); + } else { + hasOpenedDefLogFile = 1; + fprintf(defrLog, "Info from file: %s\n\n", session->FileName); + fprintf(defrLog, "INFO (DEFPARS-%d): %s See file %s at line %s\n", + msgNum, s, session->FileName, lines2str(nlines)); + } + } else { + if ((defrLog = fopen("defRWarning.log", "a")) == 0) { + printf("WARNING (DEFPARS-8500): Unable to open the file defRWarning.log in %s.\n", + getcwd(NULL, 64)); + printf("Info messages will not be printed.\n"); + } else { + hasOpenedDefLogFile = 1; + fprintf(defrLog, "\nInfo from file: %s\n\n", session->FileName); + fprintf(defrLog, "INFO (DEFPARS-%d): %s See file %s at line %s\n", + msgNum, s, session->FileName, lines2str(nlines)); + } + } + } +} + +/* All warning starts with 7000 */ +/* All warning within defWarning starts with 7500 */ +void +defrData::defWarning(int msgNum, const char *s) { + int i; + + for (i = 0; i nDDMsgs; i++) { /* check if warning has been disable */ + if (settings->disableDMsgs[i] == msgNum) + return; /* don't print out any warning since msg has been disabled */ + } + + if (settings->ContextWarningLogFunction) { + char* str = (char*)malloc(strlen(deftoken)+strlen(s) + +strlen(session->FileName)+350); + sprintf(str, "WARNING (DEFPARS-%d): %s See file %s at line %s.\n", + msgNum, s, session->FileName, lines2str(nlines)); + (*settings->ContextWarningLogFunction)(session->UserData, str); + free(str); + } else if (settings->WarningLogFunction) { + char* str = (char*)malloc(strlen(deftoken)+strlen(s) + +strlen(session->FileName)+350); + sprintf(str, "WARNING (DEFPARS-%d): %s See file %s at line %s.\n", + msgNum, s, session->FileName, lines2str(nlines)); + (*settings->WarningLogFunction)(str); + free(str); + } else if (defrLog) { + fprintf(defrLog, "WARNING (DEFPARS-%d): %s See file %s at line %s\n", + msgNum, s, session->FileName, lines2str(nlines)); + } else { + if (!hasOpenedDefLogFile) { + if ((defrLog = fopen("defRWarning.log", "w")) == 0) { + printf("WARNING (DEFPARS-7500): Unable to open the file defRWarning.log in %s.\n", + getcwd(NULL, 64)); + printf("Warning messages will not be printed.\n"); + } else { + hasOpenedDefLogFile = 1; + fprintf(defrLog, "Warnings from file: %s\n\n", session->FileName); + fprintf(defrLog, "WARNING (DEFPARS-%d): %s See file %s at line %s\n", + msgNum, s, session->FileName, lines2str(nlines)); + } + } else { + if ((defrLog = fopen("defRWarning.log", "a")) == 0) { + printf("WARNING (DEFAPRS-7501): Unable to open the file defRWarning.log in %s.\n", + getcwd(NULL, 64)); + printf("Warning messages will not be printed.\n"); + } else { + hasOpenedDefLogFile = 1; + fprintf(defrLog, "\nWarnings from file: %s\n\n", session->FileName); + fprintf(defrLog, "WARNING (DEFPARS-%d): %s See file %s at line %s\n", + msgNum, s, session->FileName, lines2str(nlines)); + } + } + } + def_warnings++; +} + +const char* +defrData::defkywd(int num) +{ + switch (num) { + case QSTRING: return "QSTRING"; + case T_STRING: return "T_STRING"; + case SITE_PATTERN: return "SITE_PATTERN"; + case NUMBER: return "NUMBER"; + case K_ALIGN: return "ALIGN"; + case K_AND: return "AND"; + case K_ARRAY: return "ARRAY"; + case K_ASSERTIONS: return "ASSERTIONS"; + case K_BEGINEXT: return "BEGINEXT"; + case K_BOTTOMLEFT: return "BOTTOMLEFT"; + case K_BUSBITCHARS: return "BUSBITCHARS"; + case K_BY: return "BY"; + case K_CANNOTOCCUPY: return "CANNOTOCCUPY"; + case K_CANPLACE: return "CANPLACE"; + case K_CAPACITANCE: return "CAPACITANCE"; + case K_COMMONSCANPINS: return "COMMONSCANPINS"; + case K_COMPONENT: return "COMPONENT"; + case K_COMPONENTPIN: return "COMPONENTPIN"; + case K_COMPS: return "COMPS"; + case K_COMP_GEN: return "COMP_GEN"; + case K_CONSTRAINTS: return "CONSTRAINTS"; + case K_COVER: return "COVER"; + case K_CUTSIZE: return "CUTSIZE"; + case K_CUTSPACING: return "CUTSPACING"; + case K_DEFAULTCAP: return "DEFAULTCAP"; + case K_DEFINE: return "DEFINE"; + case K_DEFINES: return "DEFINES"; + case K_DEFINEB: return "DEFINEB"; + case K_DESIGN: return "DESIGN"; + case K_DESIGNRULEWIDTH: return "DESIGNRULEWIDTH"; + case K_DIAGWIDTH: return "DIAGWIDTH"; + case K_DIEAREA: return "DIEAREA"; + case K_DIFF: return "DIFF"; + case K_DIRECTION: return "DIRECTION"; + case K_DIST: return "DIST"; + case K_DISTANCE: return "DISTANCE"; + case K_DIVIDERCHAR: return "DIVIDERCHAR"; + case K_DO: return "DO"; + case K_DRIVECELL: return "DRIVECELL"; + case K_E: return "E"; + case K_EEQMASTER: return "EEQMASTER"; + case K_ELSE: return "ELSE"; + case K_ENCLOSURE: return "ENCLOSURE"; + case K_END: return "END"; + case K_ENDEXT: return "ENDEXT"; + case K_EQ: return "EQ"; + case K_EQUAL: return "EQUAL"; + case K_ESTCAP: return "ESTCAP"; + case K_FE: return "FE"; + case K_FALL: return "FALL"; + case K_FALLMAX: return "FALLMAX"; + case K_FALLMIN: return "FALLMIN"; + case K_FALSE: return "FALSE"; + case K_FIXED: return "FIXED"; + case K_FLOATING: return "FLOATING"; + case K_FLOORPLAN: return "FLOORPLAN"; + case K_FN: return "FN"; + case K_FOREIGN: return "FOREIGN"; + case K_FPC: return "FPC"; + case K_FROMCLOCKPIN: return "FROMCLOCKPIN"; + case K_FROMCOMPPIN: return "FROMCOMPPIN"; + case K_FROMPIN: return "FROMPIN"; + case K_FROMIOPIN: return "FROMIOPIN"; + case K_FS: return "FS"; + case K_FW: return "FW"; + case K_GCELLGRID: return "GCELLGRID"; + case K_GE: return "GE"; + case K_GT: return "GT"; + case K_GROUND: return "GROUND"; + case K_GROUNDSENSITIVITY: return "GROUNDSENSITIVITY"; + case K_GROUP: return "GROUP"; + case K_GROUPS: return "GROUPS"; + case K_HALO: return "HALO"; + case K_HARDSPACING: return "HARDSPACING"; + case K_HISTORY: return "HISTORY"; + case K_HOLDRISE: return "HOLDRISE"; + case K_HOLDFALL: return "HOLDFALL"; + case K_HORIZONTAL: return "HORIZONTAL"; + case K_IF: return "IF"; + case K_IN: return "IN"; + case K_INTEGER: return "INTEGER"; + case K_IOTIMINGS: return "IOTIMINGS"; + case K_LAYER: return "LAYER"; + case K_LAYERS: return "LAYERS"; + case K_LE: return "LE"; + case K_LT: return "LT"; + case K_MACRO: return "MACRO"; + case K_MASK: return "MASK"; + case K_MAX: return "MAX"; + case K_MAXDIST: return "MAXDIST"; + case K_MAXHALFPERIMETER: return "MAXHALFPERIMETER"; + case K_MAXX: return "MAXX"; + case K_MAXY: return "MAXY"; + case K_MICRONS: return "MICRONS"; + case K_MIN: return "MIN"; + case K_MINCUTS: return "MINCUTS"; + case K_MINPINS: return "MINPINS"; + case K_MUSTJOIN: return "MUSTJOIN"; + case K_N: return "N"; + case K_NAMESCASESENSITIVE: return "NAMESCASESENSITIVE"; + case K_NAMEMAPSTRING: return "NAMEMAPSTRING"; + case K_NE: return "NE"; + case K_NET: return "NET"; + case K_NETEXPR: return "NETEXPR"; + case K_NETLIST: return "NETLIST"; + case K_NETS: return "NETS"; + case K_NEW: return "NEW"; + case K_NONDEFAULTRULE: return "NONDEFAULTRULE"; + case K_NOSHIELD: return "NOSHIELD"; + case K_NOT: return "NOT"; + case K_OFF: return "OFF"; + case K_OFFSET: return "OFFSET"; + case K_ON: return "ON"; + case K_OR: return "OR"; + case K_ORDERED: return "ORDERED"; + case K_ORIGIN: return "ORIGIN"; + case K_ORIGINAL: return "ORIGINAL"; + case K_OUT: return "OUT"; + case K_PARALLEL: return "PARALLEL"; + case K_PARTITIONS: return "PARTITIONS"; + case K_PATH: return "PATH"; + case K_PATTERN: return "PATTERN"; + case K_PATTERNNAME: return "PATTERNNAME"; + case K_PINPROPERTIES: return "PINPROPERTIES"; + case K_PINS: return "PINS"; + case K_PLACED: return "PLACED"; + case K_PIN: return "PIN"; + case K_POLYGON: return "POLYGON"; + case K_PROPERTY: return "PROPERTY"; + case K_PROPERTYDEFINITIONS: return "PROPERTYDEFINITIONS"; + case K_RANGE: return "RANGE"; + case K_REAL: return "REAL"; + case K_RECT: return "RECT"; + case K_REENTRANTPATHS: return "REREENTRANTPATHS"; + case K_REGION: return "REGION"; + case K_REGIONS: return "REGIONS"; + case K_RISE: return "RISE"; + case K_RISEMAX: return "RISEMAX"; + case K_RISEMIN: return "RISEMIN"; + case K_ROUTED: return "ROUTED"; + case K_ROW: return "ROW"; + case K_ROWCOL: return "ROWCOL"; + case K_ROWS: return "ROWS"; + case K_S: return "S"; + case K_SCANCHAINS: return "SCANCHAINS"; + case K_SETUPRISE: return "SETUPRISE"; + case K_SETUPFALL: return "SETUPFALL"; + case K_SHAPE: return "SHAPE"; + case K_SITE: return "SITE"; + case K_SLEWRATE: return "SLEWRATE"; + case K_SNET: return "SNET"; + case K_SNETS: return "SNETS"; + case K_SOURCE: return "SOURCE"; + case K_SOFT: return "SOFT"; + case K_SPACING: return "SPACING"; + case K_SPECIAL: return "SPECIAL"; + case K_START: return "START"; + case K_START_NET: return "START_NET"; + case K_STEP: return "STEP"; + case K_STRING: return "STRING"; + case K_STOP: return "STOP"; + case K_SUBNET: return "SUBNET"; + case K_SUM: return "SUM"; + case K_SUPPLYSENSITIVITY: return "SUPPLYSENSITIVITY"; + case K_STYLE: return "STYLE"; + case K_STYLES: return "STYLES"; + case K_SYNTHESIZED: return "SYNTHESIZED"; + case K_TAPER: return "TAPER"; + case K_TAPERRULE: return "TAPERRULE"; + case K_THEN: return "THEN"; + case K_THRUPIN: return "THRUPIN"; + case K_TIMING: return "TIMING"; + case K_TIMINGDISABLES: return "TIMINGDISABLES"; + case K_TOCLOCKPIN: return "TOCLOCKPIN"; + case K_TOCOMPPIN: return "TOCOMPPIN"; + case K_TOIOPIN: return "TOIOPIN"; + case K_TOPIN: return "TOPIN"; + case K_TOPRIGHT: return "TOPRIGHT"; + case K_TRACKS: return "TRACKS"; + case K_TRUE: return "TRUE"; + case K_TURNOFF: return "TURNOFF"; + case K_VARIABLE: return "VARIABLE"; + case K_VIA: return "VIA"; + case K_VIARULE: return "VIARULE"; + case K_VIAS: return "VIAS"; + case K_VOLTAGE: return "VOLTAGE"; + case K_TECH: return "TECH"; + case K_UNITS: return "UNITS"; + case K_UNPLACED: return "UNPLACED"; + case K_USE: return "USE"; + case K_USER: return "USER"; + case K_VERSION: return "VERSION"; + case K_VIRTUAL: return "VIRTUAL"; + case K_VERTICAL: return "VERTICAL"; + case K_VPIN: return "VPIN"; + case K_W: return "W"; + case K_WIRECAP: return "WIRECAP"; + case K_WEIGHT: return "WEIGHT"; + case K_WIDTH: return "WIDTH"; + case K_WIREDLOGIC: return "WIREDLOGIC"; + case K_WIREEXT: return "WIREEXT"; + case K_XTALK: return "XTALK"; + case K_X: return "X"; + case K_Y: return "Y"; + default: return "bogus"; + } +} + +const char* +defrData::DEFCASE(const char* ch) +{ + return names_case_sensitive ? ch : upperCase(ch); +} + +void +defrData::pathIsDone(int sh, int reset, int osNet, int *needCbk) +{ + if ((callbacks->NetCbk || callbacks->SNetCbk) && settings->AddPathToNet) { + //PathObj.reverseOrder(); + if (Subnet) { + // if (sh) + // defrSubnet->addShieldPath(defrPath); + // else + Subnet->addWirePath(&PathObj, reset, osNet, + needCbk); + } else { + if (sh) + Net.addShieldPath(&PathObj, reset, osNet, needCbk); + else + Net.addWirePath(&PathObj, reset, osNet, needCbk); + } + } else if (callbacks->PathCbk) { + //defrPath->reverseOrder(); + (*callbacks->PathCbk)(defrPathCbkType, &PathObj, session->UserData); + PathObj.Destroy(); + free((char*) &PathObj); + } + + PathObj.Init(); +} + +END_LEFDEF_PARSER_NAMESPACE + + + + diff --git a/src/def/def/def_objs.defs b/src/def/def/def_objs.defs new file mode 100755 index 00000000..09c57533 --- /dev/null +++ b/src/def/def/def_objs.defs @@ -0,0 +1,44 @@ +############################################################################## +# +# def_objs.defs +# + +DEF_SRCS = \ + $(DEF_SRC_DIR)/DFEF_malloc.cpp \ + $(DEF_SRC_DIR)/DFEF_stringhash.cpp \ + $(DEF_SRC_DIR)/def.tab.cpp \ + $(DEF_SRC_DIR)/def_keywords.cpp \ + $(DEF_SRC_DIR)/defiAlias.cpp \ + $(DEF_SRC_DIR)/defiAssertion.cpp \ + $(DEF_SRC_DIR)/defiBlockage.cpp \ + $(DEF_SRC_DIR)/defiComponent.cpp \ + $(DEF_SRC_DIR)/defiDebug.cpp \ + $(DEF_SRC_DIR)/defiFill.cpp \ + $(DEF_SRC_DIR)/defiFPC.cpp \ + $(DEF_SRC_DIR)/defiGroup.cpp \ + $(DEF_SRC_DIR)/defiIOTiming.cpp \ + $(DEF_SRC_DIR)/defiMisc.cpp \ + $(DEF_SRC_DIR)/defiNet.cpp \ + $(DEF_SRC_DIR)/defiNonDefault.cpp \ + $(DEF_SRC_DIR)/defiPartition.cpp \ + $(DEF_SRC_DIR)/defiPath.cpp \ + $(DEF_SRC_DIR)/defiPinCap.cpp \ + $(DEF_SRC_DIR)/defiPinProp.cpp \ + $(DEF_SRC_DIR)/defiProp.cpp \ + $(DEF_SRC_DIR)/defiPropType.cpp \ + $(DEF_SRC_DIR)/defiRegion.cpp \ + $(DEF_SRC_DIR)/defiRowTrack.cpp \ + $(DEF_SRC_DIR)/defiScanchain.cpp \ + $(DEF_SRC_DIR)/defiSite.cpp \ + $(DEF_SRC_DIR)/defiSlot.cpp \ + $(DEF_SRC_DIR)/defiTimingDisable.cpp \ + $(DEF_SRC_DIR)/defiUtil.cpp \ + $(DEF_SRC_DIR)/defiVia.cpp \ + $(DEF_SRC_DIR)/defrReader.cpp \ + $(DEF_SRC_DIR)/defwWriter.cpp \ + $(DEF_SRC_DIR)/defwWriterCalls.cpp + +DEF_BISON_SRCS = $(DEF_SRC_DIR)/def.y + +DEF_OBJS = $(DEF_SRCS:.cpp=.o) + diff --git a/src/def/def/defiAlias.cpp b/src/def/def/defiAlias.cpp new file mode 100644 index 00000000..636428fb --- /dev/null +++ b/src/def/def/defiAlias.cpp @@ -0,0 +1,114 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2014, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include "defiAlias.hpp" +#include "defrData.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +extern defrContext defContext; + +class defAliasIterator { +public: + std::map::iterator me; +}; + +defiAlias_itr::defiAlias_itr(defrData *data) +: iterator(NULL), + first(1), + defData(data ? data : defContext.data) +{ + defiAlias_itr::Init(); +} + + +void defiAlias_itr::Init() { + first = 1; + iterator = new defAliasIterator(); +} + + +void defiAlias_itr::Destroy() { + delete iterator; + iterator = NULL; +} + + +defiAlias_itr::~defiAlias_itr() { + defiAlias_itr::Destroy(); +} + + +int defiAlias_itr::Next() { + if (first) { + first = 0; + iterator->me = defData->def_alias_set.begin(); + } else { + iterator->me++; + } + + if (iterator->me == defData->def_alias_set.end()) { + return 0; + } + + return 1; +} + + +const char* defiAlias_itr::Key() { + if (iterator->me == defData->def_alias_set.end()) { + return NULL; + } + + return iterator->me->first.c_str(); +} + + +const char* defiAlias_itr::Data() { + if (iterator->me == defData->def_alias_set.end()) { + return NULL; + } + + // First char is reserved for 'marked' symbol ('0' or '1') + return iterator->me->second.c_str() + 1; +} + + +int defiAlias_itr::Marked() { + const char *value = iterator->me->second.c_str(); + + if ((value == NULL) || (value[0] == '0')) { + return 0; + }else { + return 1; + } +} + +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defiAlias.hpp b/src/def/def/defiAlias.hpp new file mode 100644 index 00000000..72a0e68c --- /dev/null +++ b/src/def/def/defiAlias.hpp @@ -0,0 +1,63 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2014, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiALIAS_h +#define defiALIAS_h + +#include "defiKRDefs.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +class defAliasIterator; +class defrData; + +class defiAlias_itr { +public: + defiAlias_itr(defrData *defData = 0); + void Init(); + + void Destroy(); + ~defiAlias_itr(); + + int Next(); + const char* Key(); + const char* Data(); + int Marked(); + +protected: + defAliasIterator *iterator; + int first; + defrData *defData; +}; + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiAssertion.cpp b/src/def/def/defiAssertion.cpp new file mode 100644 index 00000000..65fc79cd --- /dev/null +++ b/src/def/def/defiAssertion.cpp @@ -0,0 +1,425 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2015, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include "lex.h" +#include "defiAssertion.hpp" +#include "defiDebug.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +struct defiAssertPath { + char* fromPin_; + char* toPin_; + char* fromInst_; + char* toInst_; +}; + + + +defiAssertion::defiAssertion(defrData *data) + : defData(data) +{ + Init(); +} + + +defiAssertion::~defiAssertion() { + Destroy(); +} + + +void defiAssertion::Init() { + netName_ = (char*)malloc(32); + netNameLength_ = 32; + numItems_ = 0; + clear(); + numItemsAllocated_ = 16; + items_ = (int**)malloc(sizeof(char*)*16); + itemTypes_ = (char*)malloc(16); +} + + +void defiAssertion::Destroy() { + free(netName_); + free((char*)(itemTypes_)); + free((char*)(items_)); +} + + +void defiAssertion::clear() { + int i; + struct defiAssertPath* s; + + if (netName_) + *(netName_) = '\0'; + isSum_ = 0; + isDiff_ = 0; + isAssertion_ = 0; + hasRiseMin_ = 0; + hasRiseMax_ = 0; + hasFallMin_ = 0; + hasFallMax_ = 0; + isDelay_ = 0; + isWiredlogic_ = 0; + + for (i = 0; i < numItems_; i++) { + if (itemTypes_[i] == 'p') { + s = (struct defiAssertPath*)(items_[i]); + free(s->fromPin_); + free(s->toPin_); + free(s->fromInst_); + free(s->toInst_); + free((char*)s); + } else if (itemTypes_[i] == 'n') { + free((char*)(items_[i])); + } else { + defiError(0, 6009, "ERROR (DEFPARSE-6009): An invalid attribute type has encounter while cleanning the memory.", defData); + } + itemTypes_[i] = 'B'; // bogus + items_[i] = 0; + } + + numItems_ = 0; +} + + +void defiAssertion::setConstraintMode() { + isAssertion_ = 0; +} + + +void defiAssertion::setAssertionMode() { + isAssertion_ = 1; +} + + +void defiAssertion::setWiredlogicMode() { + isWiredlogic_ = 1; +} + + +void defiAssertion::setWiredlogic(const char* name, double dist) { + int len = strlen(name) + 1; + if (isDelay_) + defiError(0, 6201, "ERROR (DEFPARS-6201): Unable to process the DEF file. Both WIREDLOGIC and DELAY statements are defined in constraint/assertion.\nUpdate the DEF file to define either a WIREDLOGIC or DELAY statement only.", defData); + isWiredlogic_ = 1; + if (netNameLength_ < len) { + free(netName_); + netName_ = (char*)malloc(len); + netNameLength_ = len; + } + strcpy(netName_, defData->DEFCASE(name)); + fallMax_ = dist; +} + + +void defiAssertion::setDelay() { + if (isWiredlogic_) + defiError(0, 6201, "ERROR (DEFPARS-6201): Unable to process the DEF file. Both WIREDLOGIC and DELAY statements are defined in constraint/assertion.\nUpdate the DEF file to define either a WIREDLOGIC or DELAY statement only.", defData); + isDelay_ = 1; +} + + +void defiAssertion::setSum() { + if (isDiff_) + defiError(0, 6202, "ERROR (DEPPARS-6202): Unable to process the DEF file. Both SUM and DIFF statements are defined in constraint/assertion.\nUpdate the DEF file to define either a SUM or DIFF statement only.", defData); + isSum_ = 1; +} + + +void defiAssertion::unsetSum() { + isSum_ = 0; +} + + +void defiAssertion::setDiff() { + if (isSum_) + defiError(0, 6202, "ERROR (DEPPARS-6202): Unable to process the DEF file. Both SUM and DIFF statements are defined in constraint/assertion.\nUpdate the DEF file to define either a SUM or DIFF statement only.", defData); + isDiff_ = 1; +} + + +const char* defiAssertion::netName() const { + return netName_; +} + + +void defiAssertion::setNetName(const char* name) { + int len = strlen(name) + 1; + clear(); + if (len > netNameLength_) { + free(netName_); + netName_ = (char*)malloc(len); + netNameLength_ = len; + } + strcpy(netName_, defData->DEFCASE(name)); +} + + + +int defiAssertion::isDelay() const { + return isDelay_ ? 1 : 0; +} + + +int defiAssertion::isAssertion() const { + return isAssertion_ ? 1 : 0; +} + + +int defiAssertion::isConstraint() const { + return isAssertion_ ? 0 : 1; +} + + +int defiAssertion::isSum() const { + return isSum_; +} + + +int defiAssertion::isDiff() const { + return isDiff_; +} + + +int defiAssertion::isWiredlogic() const { + return isWiredlogic_; +} + + +int defiAssertion::hasRiseMin() const { + return hasRiseMin_; +} + + +int defiAssertion::hasRiseMax() const { + return hasRiseMax_; +} + + +int defiAssertion::hasFallMin() const { + return hasFallMin_; +} + + +int defiAssertion::hasFallMax() const { + return hasFallMax_; +} + + +double defiAssertion::distance() const { + return fallMax_; // distance is stored here +} + + +double defiAssertion::riseMin() const { + return riseMin_; +} + + +double defiAssertion::riseMax() const { + return riseMax_; +} + + +double defiAssertion::fallMin() const { + return fallMin_; +} + + +double defiAssertion::fallMax() const { + return fallMax_; +} + + +void defiAssertion::setRiseMin(double d) { + riseMin_ = d; + hasRiseMin_ = 1; +} + + +void defiAssertion::setRiseMax(double d) { + riseMax_ = d; + hasRiseMax_ = 1; +} + + +void defiAssertion::setFallMin(double d) { + fallMin_ = d; + hasFallMin_ = 1; +} + + +void defiAssertion::setFallMax(double d) { + fallMax_ = d; + hasFallMax_ = 1; +} + + +int defiAssertion::numItems() const { + return numItems_; +} + + +int defiAssertion::isPath(int index) const { + if (index >= 0 && index < numItems_) { + return (itemTypes_[index] == 'p') ? 1 : 0; + } + return 0; +} + + +int defiAssertion::isNet(int index) const { + if (index >= 0 && index < numItems_) { + return (itemTypes_[index] == 'n') ? 1 : 0; + } + return 0; +} + + +void defiAssertion::path(int index, char** fromInst, char** fromPin, + char** toInst, char** toPin) const { + struct defiAssertPath* ap; + + if (index >= 0 && index < numItems_ && + itemTypes_[index] == 'p') { + ap = (struct defiAssertPath*)(items_[index]); + if (fromInst) *fromInst = ap->fromInst_; + if (fromPin) *fromPin = ap->fromPin_; + if (toInst) *toInst = ap->toInst_; + if (toPin) *toPin = ap->toPin_; + } +} + + +void defiAssertion::net(int index, char** netName) const { + if (index >= 0 && index < numItems_ && + itemTypes_[index] == 'n') { + if (netName) *netName = (char*)(items_[index]); + } +} + + +void defiAssertion::bumpItems() { + int i; + char* newTypes; + int** newItems; + (numItemsAllocated_) *= 2; + newTypes = (char*)malloc(numItemsAllocated_ * sizeof(char)); + newItems = (int**)malloc(numItemsAllocated_ * sizeof(int*)); + for (i = 0; i < numItems_; i++) { + newItems[i] = items_[i]; + newTypes[i] = itemTypes_[i]; + } + free((char*)items_); + free((char*)itemTypes_); + items_ = newItems; + itemTypes_ = newTypes; +} + + +void defiAssertion::addNet(const char* name) { + int i; + char* s, *s1; + + // set wiredlogic to false + isWiredlogic_ = 0; + + // make our own copy + i = strlen(name) + 1; + if (name[i-2] == ',') { + s = (char*)malloc(i-1); + s1 = (char*)malloc(i-1); + memcpy(s1, name, i-2); + s1[i-2] = '\0'; + strcpy(s, defData->DEFCASE(s1)); + free(s1); + } else { + s = (char*)malloc(i); + strcpy(s, defData->DEFCASE(name)); + } + + // make sure there is space in the array + if (numItems_ >= numItemsAllocated_) + bumpItems(); + + // place it + i = numItems_; + items_[i] = (int*)s; + itemTypes_[i] = 'n'; + numItems_ = i + 1; + //strcpy(itemTypes_, "n"); +} + + +void defiAssertion::addPath(const char* fromInst, const char* fromPin, + const char* toInst, const char* toPin) { + int i; + struct defiAssertPath* s; + + // set wiredlogic to false + isWiredlogic_ = 0; + + // make our own copy + s = (struct defiAssertPath*)malloc(sizeof(struct defiAssertPath)); + i = strlen(fromInst) + 1; + s->fromInst_ = (char*)malloc(i); + strcpy(s->fromInst_, defData->DEFCASE(fromInst)); + i = strlen(toInst) + 1; + s->toInst_ = (char*)malloc(i); + strcpy(s->toInst_, defData->DEFCASE(toInst)); + i = strlen(fromPin) + 1; + s->fromPin_ = (char*)malloc(i); + strcpy(s->fromPin_, defData->DEFCASE(fromPin)); + i = strlen(toPin) + 1; + s->toPin_ = (char*)malloc(i); + strcpy(s->toPin_, defData->DEFCASE(toPin)); + + // make sure there is space in the array + if (numItems_ >= numItemsAllocated_) + bumpItems(); + + // place it + i = numItems_; + items_[i] = (int*)s; + itemTypes_[i] = 'p'; + numItems_ = i + 1; + //strcpy(itemTypes_, "p"); +} + + +void defiAssertion::print(FILE* f) const { + fprintf(f, "Assertion %s\n", netName()); +} + + +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defiAssertion.hpp b/src/def/def/defiAssertion.hpp new file mode 100644 index 00000000..6a48d2b2 --- /dev/null +++ b/src/def/def/defiAssertion.hpp @@ -0,0 +1,138 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiAssertion_h +#define defiAssertion_h + +#include "defiKRDefs.hpp" +#include + +BEGIN_LEFDEF_PARSER_NAMESPACE + +// Struct holds the data for one assertion/constraint. +// An assertion or constraint is either a net/path rule or a +// wired logic rule. +// +// A net/path rule is an item or list of items plus specifications. +// The specifications are: rise/fall min/max. +// The items are a list of (one or more) net names or paths or a +// combination of both. +// +// A wired logic rule is a netname and a distance. +// +// We will NOT allow the mixing of wired logic rules and net/path delays +// in the same assertion/constraint. +// +// We will allow the rule to be a sum of sums (which will be interpreted +// as just one list). +// +class defrData; + +class defiAssertion { +public: + defiAssertion(defrData *data); + void Init(); + + void Destroy(); + ~defiAssertion(); + + void setConstraintMode(); + void setAssertionMode(); + void setSum(); + void setDiff(); + void setNetName(const char* name); + void setRiseMin(double num); + void setRiseMax(double num); + void setFallMin(double num); + void setFallMax(double num); + void setDelay(); + void setWiredlogicMode(); + void setWiredlogic(const char* net, double dist); + void addNet(const char* name); + void addPath(const char* fromInst, const char* fromPin, + const char* toInst, const char* toPin); + void bumpItems(); + void unsetSum(); + + int isAssertion() const; // Either isAssertion or isConstraint is true + int isConstraint() const; + int isWiredlogic() const; // Either isWiredlogic or isDelay is true + int isDelay() const; + int isSum() const; + int isDiff() const; + int hasRiseMin() const; + int hasRiseMax() const; + int hasFallMin() const; + int hasFallMax() const; + double riseMin() const; + double riseMax() const; + double fallMin() const; + double fallMax() const; + const char* netName() const; // Wired logic net name + double distance() const; // Wired logic distance + int numItems() const; // number of paths or nets + int isPath(int index) const; // is item #index a path? + int isNet(int index) const; // is item #index a net? + void path(int index, char** fromInst, char** fromPin, + char** toInst, char** toPin) const; // Get path data for item #index + void net(int index, char** netName) const; // Get net data for item #index + + void clear(); + void print(FILE* f) const; + + +protected: + char isAssertion_; + char isSum_; + char isDiff_; + char hasRiseMin_; + char hasRiseMax_; + char hasFallMin_; + char hasFallMax_; + char isWiredlogic_; + char isDelay_; + char* netName_; // wired logic net name + int netNameLength_; + double riseMin_; + double riseMax_; + double fallMin_; + double fallMax_; // also used to store the wired logic dist + int numItems_; + int numItemsAllocated_; + char* itemTypes_; + int** items_; // not really integers. + + defrData *defData; +}; + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiBlockage.cpp b/src/def/def/defiBlockage.cpp new file mode 100644 index 00000000..a2a54288 --- /dev/null +++ b/src/def/def/defiBlockage.cpp @@ -0,0 +1,530 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2015, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include +#include "lex.h" +#include "defiBlockage.hpp" +#include "defiDebug.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +//////////////////////////////////////////////////// +//////////////////////////////////////////////////// +// +// defiBlockages +// +//////////////////////////////////////////////////// +//////////////////////////////////////////////////// + +defiBlockage::defiBlockage(defrData *data) + : defData(data) +{ + Init(); +} + + +void defiBlockage::Init() { + numPolys_ = 0; + clear(); + layerName_ = 0; + componentName_ = 0; + layerNameLength_ = 0; + componentNameLength_ = 0; + xl_ = 0; + yl_ = 0; + xh_ = 0; + yh_ = 0; + rectsAllocated_ = 0; + polysAllocated_ = 0; + polygons_ = 0; +} + +DEF_COPY_CONSTRUCTOR_C( defiBlockage ) { + this->Init(); + DEF_COPY_FUNC( hasLayer_ ); + DEF_MALLOC_FUNC( layerName_, char, sizeof(char) * + (strlen(prev.layerName_) +1)); + + DEF_COPY_FUNC( layerNameLength_ ); + DEF_COPY_FUNC( hasPlacement_ ); + DEF_COPY_FUNC( hasComponent_ ); + DEF_MALLOC_FUNC( componentName_, char, sizeof(char) * + (strlen(prev.componentName_) +1)); + + DEF_COPY_FUNC( componentNameLength_ ); + DEF_COPY_FUNC( hasSlots_ ); + DEF_COPY_FUNC( hasFills_ ); + DEF_COPY_FUNC( hasPushdown_ ); + DEF_COPY_FUNC( hasExceptpgnet_ ); + DEF_COPY_FUNC( hasSoft_ ); + DEF_COPY_FUNC( maxDensity_ ); + DEF_COPY_FUNC( minSpacing_ ); + DEF_COPY_FUNC( width_ ); + DEF_COPY_FUNC( numRectangles_ ); + DEF_COPY_FUNC( rectsAllocated_ ); + DEF_COPY_FUNC( mask_ ); + + DEF_MALLOC_FUNC( xl_, int, sizeof(int) * numRectangles_ ); + DEF_MALLOC_FUNC( yl_, int, sizeof(int) * numRectangles_ ); + DEF_MALLOC_FUNC( xh_, int, sizeof(int) * numRectangles_ ); + DEF_MALLOC_FUNC( yh_, int, sizeof(int) * numRectangles_ ); + + DEF_COPY_FUNC( numPolys_ ); + DEF_COPY_FUNC( polysAllocated_ ); + DEF_MALLOC_FUNC_FOR_2D_POINT ( polygons_, numPolys_ ); +} + +DEF_ASSIGN_OPERATOR_C( defiBlockage ) { + CHECK_SELF_ASSIGN + this->Init(); + DEF_COPY_FUNC( hasLayer_ ); + DEF_MALLOC_FUNC( layerName_, char, sizeof(char) * + (strlen(prev.layerName_) +1)); + + DEF_COPY_FUNC( layerNameLength_ ); + DEF_COPY_FUNC( hasPlacement_ ); + DEF_COPY_FUNC( hasComponent_ ); + DEF_MALLOC_FUNC( componentName_, char, sizeof(char) * + (strlen(prev.componentName_) +1)); + + DEF_COPY_FUNC( componentNameLength_ ); + DEF_COPY_FUNC( hasSlots_ ); + DEF_COPY_FUNC( hasFills_ ); + DEF_COPY_FUNC( hasPushdown_ ); + DEF_COPY_FUNC( hasExceptpgnet_ ); + DEF_COPY_FUNC( hasSoft_ ); + DEF_COPY_FUNC( maxDensity_ ); + DEF_COPY_FUNC( minSpacing_ ); + DEF_COPY_FUNC( width_ ); + DEF_COPY_FUNC( numRectangles_ ); + DEF_COPY_FUNC( rectsAllocated_ ); + DEF_COPY_FUNC( mask_ ); + + DEF_MALLOC_FUNC( xl_, int, sizeof(int) * numRectangles_ ); + DEF_MALLOC_FUNC( yl_, int, sizeof(int) * numRectangles_ ); + DEF_MALLOC_FUNC( xh_, int, sizeof(int) * numRectangles_ ); + DEF_MALLOC_FUNC( yh_, int, sizeof(int) * numRectangles_ ); + + DEF_COPY_FUNC( numPolys_ ); + DEF_COPY_FUNC( polysAllocated_ ); + DEF_MALLOC_FUNC_FOR_2D_POINT ( polygons_, numPolys_ ); + return *this; +} + +defiBlockage::~defiBlockage() { + Destroy(); +} + + +void defiBlockage::clear() { + hasLayer_ = 0; + hasPlacement_ = 0; + hasComponent_ = 0; + hasSlots_ = 0; + hasFills_ = 0; + hasPushdown_ = 0; + hasExceptpgnet_ = 0; + hasSoft_ = 0; + maxDensity_ = -1; + minSpacing_ = -1; + width_ = -1; + numRectangles_ = 0; + mask_ = 0; +} + + +void defiBlockage::clearPoly() { + struct defiPoints* p; + int i; + + for (i = 0; i < numPolys_; i++) { + p = polygons_[i]; + free((char*)(p->x)); + free((char*)(p->y)); + free((char*)(polygons_[i])); + } + numPolys_ = 0; +} + +void defiBlockage::Destroy() { + if (layerName_) free(layerName_); + if (componentName_) free(componentName_); + layerName_ = 0; + componentName_ = 0; + if (rectsAllocated_) { + free((char*)(xl_)); + free((char*)(yl_)); + free((char*)(xh_)); + free((char*)(yh_)); + rectsAllocated_ = 0; + xl_ = 0; + yl_ = 0; + xh_ = 0; + yh_ = 0; + } + clearPoly(); + free((char*)(polygons_)); + polygons_ = 0; + clear(); +} + + +void defiBlockage::setLayer(const char* name) { + int len = strlen(name) + 1; + if (layerNameLength_ < len) { + if (layerName_) free(layerName_); + layerName_ = (char*)malloc(len); + layerNameLength_ = len; + } + strcpy(layerName_, defData->DEFCASE(name)); + hasLayer_ = 1; +} + + +void defiBlockage::setPlacement() { + + /* 10/29/2001 - Wanda da Rosa, new enhancement */ + hasPlacement_ = 1; + return; +} + +void defiBlockage::setComponent(const char* name) { + int len; + + /* 10/29/2001 - Wanda da Rosa, component name is required */ + len = strlen(name) + 1; + if (componentNameLength_ < len) { + if (componentName_) free(componentName_); + componentName_ = (char*)malloc(len); + componentNameLength_ = len; + } + strcpy(componentName_, defData->DEFCASE(name)); + hasComponent_ = 1; +} + +void defiBlockage::setSlots() { + hasSlots_ = 1; +} + +void defiBlockage::setFills() { + hasFills_ = 1; +} + +void defiBlockage::setPushdown() { + hasPushdown_ = 1; +} + +// 5.7 +void defiBlockage::setExceptpgnet() { + hasExceptpgnet_ = 1; +} + +// 5.7 +void defiBlockage::setSoft() { + hasSoft_ = 1; +} + +// 5.7 +void defiBlockage::setPartial(double maxDensity) { + maxDensity_ = maxDensity; +} + +void defiBlockage::setSpacing(int minSpacing) { + minSpacing_ = minSpacing; +} + +void defiBlockage::setDesignRuleWidth(int width) { + width_ = width; +} + +void defiBlockage::setMask(int colorMask) { + mask_ = colorMask; +} + +void defiBlockage::addRect(int xl, int yl, int xh, int yh) { + if (numRectangles_ == rectsAllocated_) { + int i; + int max = rectsAllocated_ = (rectsAllocated_ == 0) ? + 2 : rectsAllocated_ * 2; + int* newxl = (int*)malloc(sizeof(int)*max); + int* newyl = (int*)malloc(sizeof(int)*max); + int* newxh = (int*)malloc(sizeof(int)*max); + int* newyh = (int*)malloc(sizeof(int)*max); + for (i = 0; i < numRectangles_; i++) { + newxl[i] = xl_[i]; + newyl[i] = yl_[i]; + newxh[i] = xh_[i]; + newyh[i] = yh_[i]; + } + free((char*)(xl_)); + free((char*)(yl_)); + free((char*)(xh_)); + free((char*)(yh_)); + xl_ = newxl; + yl_ = newyl; + xh_ = newxh; + yh_ = newyh; + } + xl_[numRectangles_] = xl; + yl_[numRectangles_] = yl; + xh_[numRectangles_] = xh; + yh_[numRectangles_] = yh; + numRectangles_ += 1; +} + + +// 5.6 +void defiBlockage::addPolygon(defiGeometries* geom) { + struct defiPoints* p; + int x, y; + int i; + + if (numPolys_ == polysAllocated_) { + struct defiPoints** poly; + polysAllocated_ = (polysAllocated_ == 0) ? + 2 : polysAllocated_ * 2; + poly = (struct defiPoints**)malloc(sizeof(struct defiPoints*) * + polysAllocated_); + for (i = 0; i < numPolys_; i++) + poly[i] = polygons_[i]; + if (polygons_) + free((char*)(polygons_)); + polygons_ = poly; + } + p = (struct defiPoints*)malloc(sizeof(struct defiPoints)); + p->numPoints = geom->numPoints(); + p->x = (int*)malloc(sizeof(int)*p->numPoints); + p->y = (int*)malloc(sizeof(int)*p->numPoints); + for (i = 0; i < p->numPoints; i++) { + geom->points(i, &x, &y); + p->x[i] = x; + p->y[i] = y; + } + polygons_[numPolys_] = p; + numPolys_ += 1; +} + + +int defiBlockage::hasLayer() const { + return hasLayer_; +} + + +int defiBlockage::hasPlacement() const { + return hasPlacement_; +} + + +int defiBlockage::hasComponent() const { + return hasComponent_; +} + + +int defiBlockage::hasSlots() const { + return hasSlots_; +} + + +int defiBlockage::hasFills() const { + return hasFills_; +} + + +int defiBlockage::hasPushdown() const { + return hasPushdown_; +} + +// 5.7 +int defiBlockage::hasExceptpgnet() const { + return hasExceptpgnet_; +} + +// 5.7 +int defiBlockage::hasSoft() const { + return hasSoft_; +} + +// 5.7 +int defiBlockage::hasPartial() const { + if (maxDensity_ == -1) + return 0; + return 1; +} + +// 5.7 +double defiBlockage::placementMaxDensity() const { + return maxDensity_; +} + +int defiBlockage::hasSpacing() const { + if (minSpacing_ == -1) + return 0; + return 1; +} + + +int defiBlockage::hasDesignRuleWidth() const { + if (width_ == -1) + return 0; + return 1; +} + +int defiBlockage::hasMask() const { + return mask_; +} + +int defiBlockage::minSpacing() const { + return minSpacing_; +} + + +int defiBlockage::designRuleWidth() const { + return width_; +} + +int defiBlockage::mask() const { + return mask_; +} + +const char* defiBlockage::layerName() const { + return layerName_; +} + + +const char* defiBlockage::layerComponentName() const { + return componentName_; +} + + +const char* defiBlockage::placementComponentName() const { + return componentName_; +} + + +int defiBlockage::numRectangles() const { + return numRectangles_; +} + + +int defiBlockage::xl(int index) const { + if (index < 0 || index >= numRectangles_) { + defiError(1, 0, "bad index for blockage xl", defData); + return 0; + } + return xl_[index]; +} + + +int defiBlockage::yl(int index) const { + if (index < 0 || index >= numRectangles_) { + defiError(1, 0, "bad index for blockage yl", defData); + return 0; + } + return yl_[index]; +} + + +int defiBlockage::xh(int index) const { + if (index < 0 || index >= numRectangles_) { + defiError(1, 0, "bad index for blockage xh", defData); + return 0; + } + return xh_[index]; +} + + +int defiBlockage::yh(int index) const { + if (index < 0 || index >= numRectangles_) { + defiError(1, 0, "bad index for blockage yh", defData); + return 0; + } + return yh_[index]; +} + + +// 5.6 +int defiBlockage::numPolygons() const { + return numPolys_; +} + + +// 5.6 +struct defiPoints defiBlockage::getPolygon(int index) const { + return *(polygons_[index]); +} + + +void defiBlockage::print(FILE* f) const { + int i, j; + struct defiPoints points; + + if (hasLayer()) { + fprintf(f, "- LAYER %s", layerName()); + if (hasComponent()) + fprintf(f, " + COMPONENT %s", layerComponentName()); + if (hasSlots()) + fprintf(f, " + SLOTS"); + if (hasFills()) + fprintf(f, " + FILLS"); + if (hasPushdown()) + fprintf(f, " + PUSHDOWN"); + if (hasExceptpgnet()) + fprintf(f, " + EXCEPTPGNET"); + fprintf(f, "\n"); + } + if (hasPlacement()) { + fprintf(f, "- PLACEMENT"); + if (hasComponent()) + fprintf(f, " + COMPONENT %s", layerComponentName()); + if (hasPushdown()) + fprintf(f, " + PUSHDOWN"); + if (hasSoft()) + fprintf(f, " + SOFT"); + if (hasPartial()) + fprintf(f, " + PARTIAL %f", placementMaxDensity()); + fprintf(f, "\n"); + } + + for (i = 0; i < numRectangles(); i++) { + fprintf(f, " RECT %d %d %d %d\n", xl(i), yl(i), xh(i), yh(i)); + } + + for (i = 0; i < numPolygons(); i++) { + fprintf(f, " POLYGON "); + points = getPolygon(i); + for (j = 0; j < points.numPoints; j++) + fprintf(f, "%d %d ", points.x[j], points.y[j]); + fprintf(f,"\n"); + } + fprintf(f,"\n"); +} +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defiBlockage.hpp b/src/def/def/defiBlockage.hpp new file mode 100644 index 00000000..c7292b0b --- /dev/null +++ b/src/def/def/defiBlockage.hpp @@ -0,0 +1,135 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiBLOCKAGES_h +#define defiBLOCKAGES_h + +#include +#include "defiKRDefs.hpp" +#include "defiMisc.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE +class defrData; + +class defiBlockage { +public: + defiBlockage(defrData *data); + void Init(); + + void Destroy(); + ~defiBlockage(); + + DEF_COPY_CONSTRUCTOR_H( defiBlockage ); + DEF_ASSIGN_OPERATOR_H( defiBlockage ); + + void clear(); + void clearPoly(); + + void setLayer(const char* name); + void setPlacement(); + void setComponent(const char* name); + void setSlots(); + void setFills(); + void setPushdown(); + void setExceptpgnet(); // 5.7 + void setSoft(); // 5.7 + void setPartial(double maxDensity); // 5.7 + void setSpacing(int minSpacing); + void setDesignRuleWidth(int width); + void setMask(int maskColor); // 5.8 + void addRect(int xl, int yl, int xh, int yh); + void addPolygon(defiGeometries* geom); + + int hasLayer() const; + int hasPlacement() const; + int hasComponent() const; + int hasSlots() const; + int hasFills() const; + int hasPushdown() const; + int hasExceptpgnet() const; // 5.7 + int hasSoft() const; // 5.7 + int hasPartial() const; // 5.7 + int hasSpacing() const; // 5.6 + int hasDesignRuleWidth() const; // 5.6 + int hasMask() const; // 5.8 + int mask() const; // 5.8 + int minSpacing() const; // 5.6 + int designRuleWidth() const; // 5.6 + double placementMaxDensity() const; // 5.7 + const char* layerName() const; + const char* layerComponentName() const; + const char* placementComponentName() const; + + int numRectangles() const; + int xl(int index) const; + int yl(int index) const; + int xh(int index) const; + int yh(int index) const; + + int numPolygons() const; // 5.6 + struct defiPoints getPolygon(int index) const; // 5.6 + + void print(FILE* f) const; + +protected: + int hasLayer_; + char* layerName_; + int layerNameLength_; + int hasPlacement_; + int hasComponent_; + char* componentName_; + int componentNameLength_; + int hasSlots_; + int hasFills_; + int hasPushdown_; // 5.7 + int hasExceptpgnet_ ; // 5.7 + int hasSoft_; // 5.7 + double maxDensity_; // 5.7 + int minSpacing_; + int width_; + int numRectangles_; + int rectsAllocated_; + int mask_; // 5.8 + int* xl_; + int* yl_; + int* xh_; + int* yh_; + int numPolys_; // 5.6 + int polysAllocated_; // 5.6 + struct defiPoints** polygons_; // 5.6 + + defrData *defData; +}; + + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiComponent.cpp b/src/def/def/defiComponent.cpp new file mode 100644 index 00000000..a9c7de03 --- /dev/null +++ b/src/def/def/defiComponent.cpp @@ -0,0 +1,1090 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2016, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include "defiComponent.hpp" +#include "defiDebug.hpp" +#include "lex.h" +#include "defiUtil.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +/********************************************************* +* class defiComponentMaskShiftLayer +**********************************************************/ +defiComponentMaskShiftLayer::defiComponentMaskShiftLayer(defrData *data) + : defData(data) +{ + Init(); +} + +defiComponentMaskShiftLayer::defiComponentMaskShiftLayer() { + defData = NULL; + layersAllocated_ = 0; + numLayers_ = 0; + layers_ = 0; +} + +DEF_COPY_CONSTRUCTOR_C( defiComponentMaskShiftLayer ) { + layersAllocated_ = 0; + numLayers_ = 0; + layers_ = 0; + DEF_COPY_FUNC( layersAllocated_ ); + DEF_COPY_FUNC( numLayers_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( layers_ , numLayers_ ); + +} + +DEF_ASSIGN_OPERATOR_C( defiComponentMaskShiftLayer ) { + CHECK_SELF_ASSIGN + layersAllocated_ = 0; + numLayers_ = 0; + layers_ = 0; + DEF_COPY_FUNC( layersAllocated_ ); + DEF_COPY_FUNC( numLayers_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( layers_ , numLayers_ ); + return *this; +} + +defiComponentMaskShiftLayer::~defiComponentMaskShiftLayer() { + Destroy(); +} + +void defiComponentMaskShiftLayer::Init() { + layersAllocated_ = 0; + numLayers_ = 0; + layers_ = 0; + + bumpLayers(16); +} + +void defiComponentMaskShiftLayer::Destroy() { + if (numLayers_) { + for (int i = 0; i < numLayers_; i++) { + if (layers_[i]) { + free(layers_[i]); + } + } + free((char*)(layers_)); + } else { + if (layersAllocated_) { + free((char*)(layers_)); + } + } + layersAllocated_ = 0; + numLayers_ = 0; + layers_ = 0; +} + +void defiComponentMaskShiftLayer::addMaskShiftLayer(const char* layer) { + int len = strlen(layer) + 1; + if (numLayers_ == layersAllocated_) + bumpLayers(numLayers_ * 2); + layers_[numLayers_] = (char*)malloc(len); + strcpy(layers_[numLayers_], defData->DEFCASE(layer)); + (numLayers_)++; +} + +void defiComponentMaskShiftLayer::bumpLayers(int size) { + int i; + char** newLayers = (char**)malloc(sizeof(char*)* size); + for (i = 0; i < numLayers_; i++) { + newLayers[i] = layers_[i]; + } + if (layers_) { + free((char*)(layers_)); + } + layers_ = newLayers; + layersAllocated_ = size; +} + +void defiComponentMaskShiftLayer::clear() { + for (int i = 0; i < numLayers_; i++) { + free(layers_[i]); + } + numLayers_ = 0; +} + +int defiComponentMaskShiftLayer::numMaskShiftLayers() const { + return numLayers_; +} + +const char* defiComponentMaskShiftLayer::maskShiftLayer(int index) const { + if (index >= 0 && index < numLayers_) { + return layers_[index]; + } + + return 0; +} + + +/********************************************************* +* class defiComponent +**********************************************************/ +defiComponent::defiComponent(defrData *data) + : defData(data) +{ + Init(); +} + + +void defiComponent::Init() { + id_ = 0; + name_ = 0; + regionName_ = 0; + foreignName_ = 0; + Fori_ = 0; + EEQ_ = 0; + generateName_ = 0; + macroName_ = 0; + generateNameSize_ = 0; + maskShiftSize_ = 0; + maskShift_ = 0; + macroNameSize_ = 0; + minLayerSize_ = 0; + maxLayerSize_ = 0; + minLayer_ = 0; + maxLayer_ = 0; + nets_ = 0; + source_ = 0; + numNets_ = 0; + bumpName(16); + bumpId(16); + bumpRegionName(16); + bumpEEQ(16); + bumpNets(16); + bumpForeignName(16); + bumpMinLayer(16); + bumpMaxLayer(16); + numProps_ = 0; + propsAllocated_ = 2; + orient_ = 0; + names_ = (char**)malloc(sizeof(char*)* 2); + values_ = (char**)malloc(sizeof(char*)* 2); + dvalues_ = (double*)malloc(sizeof(double)* 2); + types_ = (char*)malloc(sizeof(char)* 2); + clear(); + + numRects_ = 0; + rectsAllocated_ = 1; + rectXl_ = (int*)malloc(sizeof(int)*1); + rectYl_ = (int*)malloc(sizeof(int)*1); + rectXh_ = (int*)malloc(sizeof(int)*1); + rectYh_ = (int*)malloc(sizeof(int)*1); +} + +DEF_COPY_CONSTRUCTOR_C( defiComponent ) +{ + defData = NULL; + this->Init(); + + DEF_COPY_FUNC( idSize_ ); + DEF_COPY_FUNC( nameSize_ ); +// printf("nameSize_: %d\n", nameSize_); +// fflush(stdout); + DEF_MALLOC_FUNC( id_, char, sizeof(char) * (strlen(prev.id_)+1)); + DEF_MALLOC_FUNC( name_, char, sizeof(char) * (strlen(prev.name_)+1)); + DEF_COPY_FUNC( ForiSize_ ); + DEF_COPY_FUNC( status_ ); + DEF_COPY_FUNC( hasRegionName_ ); + DEF_COPY_FUNC( hasEEQ_ ); + DEF_COPY_FUNC( hasGenerate_ ); + DEF_COPY_FUNC( hasWeight_ ); + DEF_COPY_FUNC( hasFori_ ); + DEF_COPY_FUNC( orient_ ); + DEF_COPY_FUNC( x_ ); + DEF_COPY_FUNC( y_ ); + DEF_COPY_FUNC( numRects_ ); + DEF_COPY_FUNC( rectsAllocated_ ); + DEF_MALLOC_FUNC( rectXl_, int, sizeof(int) * numRects_); + DEF_MALLOC_FUNC( rectYl_, int, sizeof(int) * numRects_); + DEF_MALLOC_FUNC( rectXh_, int, sizeof(int) * numRects_); + DEF_MALLOC_FUNC( rectYh_, int, sizeof(int) * numRects_); + + DEF_COPY_FUNC( regionNameSize_ ); + DEF_MALLOC_FUNC( regionName_, char, sizeof(char) * (regionNameSize_)); + DEF_COPY_FUNC( EEQSize_ ); + DEF_MALLOC_FUNC( EEQ_, char, sizeof(char) * (EEQSize_)); + DEF_COPY_FUNC( numNets_ ); + DEF_COPY_FUNC( netsAllocated_ ); + + DEF_MALLOC_FUNC_FOR_2D_STR( nets_, numNets_ ); + + DEF_COPY_FUNC( weight_ ); + DEF_COPY_FUNC( maskShiftSize_ ); + DEF_MALLOC_FUNC( maskShift_, int, sizeof(int) * maskShiftSize_); + + DEF_MALLOC_FUNC( source_, char, sizeof(char) * (strlen(prev.source_) +1)); + DEF_COPY_FUNC( hasForeignName_ ); + DEF_COPY_FUNC( foreignNameSize_ ); + DEF_MALLOC_FUNC( foreignName_, char, sizeof(char) * foreignNameSize_); + DEF_COPY_FUNC( Fx_ ); + DEF_COPY_FUNC( Fy_ ); + DEF_COPY_FUNC( Fori_ ); + DEF_COPY_FUNC( generateNameSize_ ); + DEF_MALLOC_FUNC( generateName_, char, sizeof(char) * (generateNameSize_)); + DEF_COPY_FUNC( macroNameSize_ ); + DEF_MALLOC_FUNC( macroName_, char, sizeof(char) * (macroNameSize_)); + DEF_COPY_FUNC( hasHalo_ ); + DEF_COPY_FUNC( hasHaloSoft_ ); + DEF_COPY_FUNC( leftHalo_ ); + DEF_COPY_FUNC( bottomHalo_ ); + DEF_COPY_FUNC( rightHalo_ ); + DEF_COPY_FUNC( topHalo_ ); + DEF_COPY_FUNC( haloDist_ ); + DEF_COPY_FUNC( minLayerSize_ ); + DEF_MALLOC_FUNC( minLayer_, char, sizeof(char) * (minLayerSize_)); + DEF_COPY_FUNC( maxLayerSize_ ); + DEF_MALLOC_FUNC( maxLayer_, char, sizeof(char) * (maxLayerSize_)); + DEF_COPY_FUNC( numProps_ ); + DEF_COPY_FUNC( propsAllocated_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( names_, numProps_); + DEF_MALLOC_FUNC_FOR_2D_STR( values_, numProps_); + DEF_MALLOC_FUNC( dvalues_, double, sizeof(double) * numProps_); + DEF_MALLOC_FUNC( types_, char, sizeof(char) * numProps_); +} + +void defiComponent::Destroy() { + free(name_); + free(regionName_); + free(id_); + free(EEQ_); + free(minLayer_); + free(maxLayer_); + free((char*)(nets_)); + netsAllocated_ = 0; // avoid freeing again later + if (source_) free(source_); + if (foreignName_) free(foreignName_); + if (generateName_) free(generateName_); + if (macroName_) free(macroName_); + if (netsAllocated_) free((char*)(nets_)); + free((char*)(maskShift_)); + free((char*)(names_)); + free((char*)(values_)); + free((char*)(dvalues_)); + free((char*)(types_)); + free((char*)(rectXl_)); + free((char*)(rectYl_)); + free((char*)(rectXh_)); + free((char*)(rectYh_)); +} + + +defiComponent::~defiComponent() { + Destroy(); +} + + +void defiComponent::IdAndName(const char* id, const char* name) { + int len; + + clear(); + + if ((len = strlen(id)+1) > idSize_) + bumpId(len); + strcpy(id_, defData->DEFCASE(id)); + + if ((len = strlen(name)+1) > nameSize_) + bumpName(len); + strcpy(name_, defData->DEFCASE(name)); +} + + +const char* defiComponent::source() const { + return source_; +} + + +int defiComponent::weight() const { + return weight_; +} + + +void defiComponent::setWeight(int w) { + weight_ = w; + hasWeight_ = 1; +} + +int defiComponent::maskShift(int index) const { + if (index < 0 || index >= maskShiftSize_) { + defiError(1, 0, "bad index for component maskShift", defData); + return 0; + } + + return maskShift_[index]; +} + +void defiComponent::setMaskShift(const char *shiftMask) { + int shiftMaskLength = strlen(shiftMask); + + maskShift_ = (int*)malloc(sizeof(int)* shiftMaskLength); + maskShiftSize_ = shiftMaskLength; + + for (int i = 0; i < shiftMaskLength; i++) { + int curShift = shiftMask[i] - '0'; + + // Strip possible error data. + if (curShift > 9 || curShift < 0) { + curShift = 0; + } + + maskShift_[shiftMaskLength - i - 1] = curShift; + } +} + +void defiComponent::setGenerate(const char* newName, const char* macroName) { + int len = strlen(newName) + 1; + + if (generateNameSize_ < len) { + if (generateName_) free(generateName_); + generateName_ = (char*)malloc(len); + generateNameSize_ = len; + } + strcpy(generateName_, defData->DEFCASE(newName)); + + len = strlen(macroName) + 1; + if (macroNameSize_ < len) { + if (macroName_) free(macroName_); + macroName_ = (char*)malloc(len); + macroNameSize_ = len; + } + strcpy(macroName_, defData->DEFCASE(macroName)); + + hasGenerate_ = 1; // Ying Tan fix at 20010918 +} + + +void defiComponent::setSource(const char* name) { + int len = strlen(name) + 1; + source_ = (char*)malloc(len); + strcpy(source_, defData->DEFCASE(name)); +} + + +void defiComponent::setRegionName(const char* name) { + int len; + + if ((len = strlen(name)+1) > regionNameSize_) + bumpRegionName(len); + strcpy(regionName_, defData->DEFCASE(name)); + hasRegionName_ = 1; +} + + +void defiComponent::setEEQ(const char* name) { + int len; + + if ((len = strlen(name)+1) > EEQSize_) + bumpEEQ(len); + strcpy(EEQ_, defData->DEFCASE(name)); + hasEEQ_ = 1; +} + + +void defiComponent::setPlacementStatus(int n) { + status_= n; +} + + +void defiComponent::setPlacementLocation(int x, int y, int orient) { + x_ = x; + y_ = y; + + if( orient != -1 ) { // mgwoo + orient_ = orient; + } +} + + +void defiComponent::setRegionBounds(int xl, int yl, int xh, int yh) { + int i; + i = numRects_; + if (i == rectsAllocated_) { + int max = rectsAllocated_ * 2; + int* nxl = (int*)malloc(sizeof(int)*max); + int* nyl = (int*)malloc(sizeof(int)*max); + int* nxh = (int*)malloc(sizeof(int)*max); + int* nyh = (int*)malloc(sizeof(int)*max); + for (i = 0; i < numRects_; i++) { + nxl[i] = rectXl_[i]; + nyl[i] = rectYl_[i]; + nxh[i] = rectXh_[i]; + nyh[i] = rectYh_[i]; + } + free((char*)(rectXl_)); + free((char*)(rectYl_)); + free((char*)(rectXh_)); + free((char*)(rectYh_)); + rectXl_ = nxl; + rectYl_ = nyl; + rectXh_ = nxh; + rectYh_ = nyh; + rectsAllocated_ = max; + } + rectXl_[i] = xl; + rectYl_[i] = yl; + rectXh_[i] = xh; + rectYh_[i] = yh; + numRects_ += 1; +} + + +// 5.6 +void defiComponent::setHalo(int left, int bottom, int right, int top) { + hasHalo_ = 1; + leftHalo_ = left; + bottomHalo_ = bottom; + rightHalo_ = right; + topHalo_ = top; +} + +// 5.7 +void defiComponent::setHaloSoft() { + hasHaloSoft_ = 1; +} + +// 5.7 +void defiComponent::setRouteHalo(int haloDist, const char* minLayer, + const char* maxLayer) { + int len; + + haloDist_ = haloDist; + if ((len = strlen(minLayer)+1) > minLayerSize_) + bumpMinLayer(len); + strcpy(minLayer_, defData->DEFCASE(minLayer)); + if ((len = strlen(maxLayer)+1) > maxLayerSize_) + bumpMaxLayer(len); + strcpy(maxLayer_, defData->DEFCASE(maxLayer)); +} + +void defiComponent::changeIdAndName(const char* id, const char* name) { + int len; + + if ((len = strlen(id)+1) > idSize_) + bumpId(len); + strcpy(id_, defData->DEFCASE(id)); + + if ((len = strlen(name)+1) > nameSize_) + bumpName(len); + strcpy(name_, defData->DEFCASE(name)); +} + + +const char* defiComponent::id() const { + return id_; +} + + +const char* defiComponent::name() const { + return name_; +} + + +int defiComponent::placementStatus() const { + return status_; +} + + +int defiComponent::placementX() const { + return x_; +} + + +int defiComponent::placementY() const { + return y_; +} + + +int defiComponent::placementOrient() const { + return orient_; +} + + +const char* defiComponent::placementOrientStr() const { + return (defiOrientStr(orient_)); +} + + +const char* defiComponent::regionName() const { + return regionName_; +} + + +const char* defiComponent::EEQ() const { + return EEQ_; +} + + +const char* defiComponent::generateName() const { + return generateName_; +} + + +const char* defiComponent::macroName() const { + return macroName_; +} + + +void defiComponent::regionBounds(int* size, + int** xl, int** yl, int** xh, int** yh) const { + *size = numRects_; + *xl = rectXl_; + *yl = rectYl_; + *xh = rectXh_; + *yh = rectYh_; +} + + +void defiComponent::bumpId(int size) { + if (id_) free(id_); + id_ = (char*)malloc(size); + idSize_ = size; + *(id_) = '\0'; +} + + +void defiComponent::bumpName(int size) { + if (name_) free(name_); + name_ = (char*)malloc(size); + nameSize_ = size; + *(name_) = '\0'; +} + + +void defiComponent::bumpRegionName(int size) { + if (regionName_) free(regionName_); + regionName_ = (char*)malloc(size); + regionNameSize_ = size; + *(regionName_) = '\0'; +} + + +void defiComponent::bumpEEQ(int size) { + if (EEQ_) free(EEQ_); + EEQ_ = (char*)malloc(size); + EEQSize_ = size; + *(EEQ_) = '\0'; +} + + +void defiComponent::bumpMinLayer(int size) { + if (minLayer_) free(minLayer_); + minLayer_ = (char*)malloc(size); + minLayerSize_ = size; + *(minLayer_) = '\0'; +} + + +void defiComponent::bumpMaxLayer(int size) { + if (maxLayer_) free(maxLayer_); + maxLayer_ = (char*)malloc(size); + maxLayerSize_ = size; + *(maxLayer_) = '\0'; +} + +void defiComponent::clear() { + int i; + + if (id_) + *(id_) = '\0'; + if (name_) + *(name_) = '\0'; + if (regionName_) + *(regionName_) = '\0'; + if (foreignName_) + *(foreignName_) = '\0'; + if (EEQ_) + *(EEQ_) = '\0'; + if (minLayer_) + *(minLayer_) = '\0'; + if (maxLayer_) + *(maxLayer_) = '\0'; + Fori_ = 0; + status_ = 0; + hasRegionName_ = 0; + hasForeignName_ = 0; + hasFori_ = 0; + hasEEQ_ = 0; + hasWeight_ = 0; + hasGenerate_ = 0; + if (maskShiftSize_) { + free((int*)(maskShift_)); + } + maskShift_ = 0; + maskShiftSize_ = 0; + weight_ = 0; + if (source_) free(source_); + for (i = 0; i < numNets_; i++) { + free(nets_[i]); + } + numNets_ = 0; + source_ = 0; + hasHalo_ = 0; + hasHaloSoft_ = 0; + haloDist_ = 0; + leftHalo_ = 0; + bottomHalo_ = 0; + rightHalo_ = 0; + topHalo_ = 0; + for (i = 0; i < numProps_; i++) { + free(names_[i]); + free(values_[i]); + dvalues_[i] = 0; + } + numProps_ = 0; + numRects_ = 0; +} + + +int defiComponent::isUnplaced() const { + return status_ == DEFI_COMPONENT_UNPLACED ? 1 : 0 ; +} + + +int defiComponent::isPlaced() const { + return status_ == DEFI_COMPONENT_PLACED ? 1 : 0 ; +} + + +int defiComponent::isFixed() const { + return status_ == DEFI_COMPONENT_FIXED ? 1 : 0 ; +} + + +int defiComponent::isCover() const { + return status_ == DEFI_COMPONENT_COVER ? 1 : 0 ; +} + + +void defiComponent::print(FILE* fout) const { + fprintf(fout, "Component id '%s' name '%s'", + id(), + name()); + if (isPlaced()) { + fprintf(fout, " Placed at %d,%d orient %s", + placementX(), + placementY(), + placementOrientStr()); + } + if (isFixed()) { + fprintf(fout, " Fixed at %d,%d orient %s", + placementX(), + placementY(), + placementOrientStr()); + } + if (isCover()) { + fprintf(fout, " Cover at %d,%d orient %s", + placementX(), + placementY(), + placementOrientStr()); + } + fprintf(fout, "\n"); + + if (hasGenerate()) { + fprintf(fout, " generate %s %s\n", generateName(), + macroName()); + } + if (hasWeight()) { + fprintf(fout, " weight %d\n", weight()); + } + if (maskShiftSize()) { + fprintf(fout, " maskShift "); + + for (int i = 0; i < maskShiftSize(); i++) { + fprintf(fout, " %d", maskShift(i)); + } + fprintf(fout, "\n"); + } + if (hasSource()) { + fprintf(fout, " source '%s'\n", source()); + } + if (hasEEQ()) { + fprintf(fout, " EEQ '%s'\n", EEQ()); + } + + if (hasRegionName()) { + fprintf(fout, " Region '%s'\n", regionName()); + } + if (hasRegionBounds()) { + int size; + int *xl, *yl, *xh, *yh; + int j; + regionBounds(&size, &xl, &yl, &xh, &yh); + for (j = 0; j < size; j++) + fprintf(fout, " Region bounds %d,%d %d,%d\n", xl[j], yl[j], xh[j], yh[j]); + } + if (hasNets()) { + int i; + fprintf(fout, " Net connections:\n"); + for (i = 0; i < numNets(); i++) { + fprintf(fout, " '%s'\n", net(i)); + } + } +} + + +int defiComponent::hasRegionName() const { + return (int)(hasRegionName_); +} + + +int defiComponent::hasGenerate() const { + return (int)(hasGenerate_); +} + + +int defiComponent::hasWeight() const { + return (int)(hasWeight_); +} + +int defiComponent::maskShiftSize() const { + return maskShiftSize_; +} + +int defiComponent::hasSource() const { + return source_ ? 1 : 0; +} + + +int defiComponent::hasRegionBounds() const { + return numRects_ ? 1 : 0 ; +} + + +int defiComponent::hasEEQ() const { + return (int)(hasEEQ_); +} + + +int defiComponent::hasNets() const { + return numNets_ ? 1 : 0; +} + + +int defiComponent::numNets() const { + return numNets_; +} + + +// 5.6 +int defiComponent::hasHalo() const { + return hasHalo_; +} + + +// 5.7 +int defiComponent::hasHaloSoft() const { + return hasHaloSoft_; +} + + +// 5.7 +int defiComponent::hasRouteHalo() const { + return haloDist_; +} + +// 5.7 +int defiComponent::haloDist() const { + return haloDist_; +} + +// 5.7 +const char* defiComponent::minLayer() const { + return minLayer_; +} + +// 5.7 +const char* defiComponent::maxLayer() const { + return maxLayer_; +} + +void defiComponent::haloEdges(int* left, int* bottom, int* right, int* top) { + *left = leftHalo_; + *bottom = bottomHalo_; + *right = rightHalo_; + *top = topHalo_; +} + +void defiComponent::reverseNetOrder() { + // Reverse the order of the items in the nets array. + int one = 0; + int two = numNets_ - 1; + char* t; + while (one < two) { + t = nets_[one]; + nets_[one] = nets_[two]; + nets_[two] = t; + one++; + two--; + } +} + + +char* defiComponent::propName(int index) const { + if (index < 0 || index >= numProps_) { + defiError(1, 0, "bad index for component property", defData); + return 0; + } + return names_[index]; +} + + +char* defiComponent::propValue(int index) const { + if (index < 0 || index >= numProps_) { + defiError(1, 0, "bad index for component property", defData); + return 0; + } + return values_[index]; +} + + +double defiComponent::propNumber(int index) const { + if (index < 0 || index >= numProps_) { + defiError(1, 0, "bad index for component property", defData); + return 0; + } + return dvalues_[index]; +} + + +char defiComponent::propType(int index) const { + if (index < 0 || index >= numProps_) { + defiError(1, 0, "bad index for component property", defData); + return 0; + } + return types_[index]; +} + + +int defiComponent::propIsNumber(int index) const { + if (index < 0 || index >= numProps_) { + defiError(1, 0, "bad index for component property", defData); + return 0; + } + return dvalues_[index] ? 1 : 0; +} + +int defiComponent::propIsString(int index) const { + if (index < 0 || index >= numProps_) { + defiError(1, 0, "bad index for component property", defData); + return 0; + } + return dvalues_[index] ? 0 : 1; +} + +int defiComponent::numProps() const { + return numProps_; +} + + +void defiComponent::addProperty(const char* name, const char* value, + const char type) { + int len = strlen(name) + 1; + if (numProps_ == propsAllocated_) { + int i; + char** nn; + char** nv; + double* nd; + char* nt; + + propsAllocated_ *= 2; + nn = (char**)malloc(sizeof(char*)*propsAllocated_); + nv = (char**)malloc(sizeof(char*)*propsAllocated_); + nd = (double*)malloc(sizeof(double)*propsAllocated_); + nt = (char*)malloc(sizeof(char)*propsAllocated_); + for (i = 0; i < numProps_; i++) { + nn[i] = names_[i]; + nv[i] = values_[i]; + nd[i] = dvalues_[i]; + nt[i] = types_[i]; + } + free((char*)(names_)); + free((char*)(values_)); + free((char*)(dvalues_)); + free((char*)(types_)); + names_ = nn; + values_ = nv; + dvalues_ = nd; + types_ = nt; + } + names_[numProps_] = (char*)malloc(len); + strcpy(names_[numProps_], defData->DEFCASE(name)); + len = strlen(value) + 1; + values_[numProps_] = (char*)malloc(len); + strcpy(values_[numProps_], defData->DEFCASE(value)); + dvalues_[numProps_] = 0; + types_[numProps_] = type; + numProps_ += 1; +} + + +void defiComponent::addNumProperty(const char* name, const double d, + const char* value, const char type) { + int len = strlen(name) + 1; + if (numProps_ == propsAllocated_) { + int i; + char** nn; + char** nv; + double* nd; + char* nt; + + propsAllocated_ *= 2; + nn = (char**)malloc(sizeof(char*)*propsAllocated_); + nv = (char**)malloc(sizeof(char*)*propsAllocated_); + nd = (double*)malloc(sizeof(double)*propsAllocated_); + nt = (char*)malloc(sizeof(char)*propsAllocated_); + for (i = 0; i < numProps_; i++) { + nn[i] = names_[i]; + nv[i] = values_[i]; + nd[i] = dvalues_[i]; + nt[i] = types_[i]; + } + free((char*)(names_)); + free((char*)(values_)); + free((char*)(dvalues_)); + free((char*)(types_)); + names_ = nn; + values_ = nv; + dvalues_ = nd; + types_ = nt; + } + names_[numProps_] = (char*)malloc(len); + strcpy(names_[numProps_], defData->DEFCASE(name)); + len = strlen(value) + 1; + values_[numProps_] = (char*)malloc(len); + strcpy(values_[numProps_], defData->DEFCASE(value)); + dvalues_[numProps_] = d; + types_[numProps_] = type; + numProps_ += 1; +} + + +void defiComponent::addNet(const char* net) { + int len = strlen(net) + 1; + if (numNets_ == netsAllocated_) + bumpNets(numNets_ * 2); + nets_[numNets_] = (char*)malloc(len); + strcpy(nets_[numNets_], defData->DEFCASE(net)); + (numNets_)++; +} + + +void defiComponent::bumpNets(int size) { + int i; + char** newNets = (char**)malloc(sizeof(char*)* size); + for (i = 0; i < numNets_; i++) { + newNets[i] = nets_[i]; + } + free((char*)(nets_)); + nets_ = newNets; + netsAllocated_ = size; +} + + +const char* defiComponent::net(int index) const { + if (index >= 0 && index < numNets_) { + return nets_[index]; + } + return 0; +} + + +void defiComponent::bumpForeignName(int size) { + if (foreignName_) free(foreignName_); + foreignName_ = (char*)malloc(sizeof(char) * size); + foreignNameSize_ = size; + *(foreignName_) = '\0'; +} + + +void defiComponent::setForeignName(const char* name) { + int len; + + if (hasForeignName()) + defiError(1, 0, + "Multiple define of '+ FOREIGN' in COMPONENT is not supported.\n", defData); + if ((len = strlen(name)+1) > foreignNameSize_) + bumpForeignName(len); + strcpy(foreignName_, defData->DEFCASE(name)); + hasForeignName_ = 1; +} + + +void defiComponent::setForeignLocation(int x, int y, int orient) { + Fx_ = x; + Fy_ = y; + Fori_ = orient; + hasFori_ = 1; +} + + +int defiComponent::hasForeignName() const { + return (int)(hasForeignName_); +} + + +const char* defiComponent::foreignName() const { + return foreignName_; +} + + +int defiComponent::foreignX() const { + return Fx_; +} + + +int defiComponent::foreignY() const { + return Fy_; +} + + +int defiComponent::hasFori() const { + return (int)(hasFori_); +} + +const char* defiComponent::foreignOri() const { + switch (Fori_) { + case 0: return ("N"); + case 1: return ("W"); + case 2: return ("S"); + case 3: return ("E"); + case 4: return ("FN"); + case 5: return ("FW"); + case 6: return ("FS"); + case 7: return ("FE"); + } + return 0; +} + +int defiComponent::foreignOrient() const { + return Fori_; +} +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defiComponent.hpp b/src/def/def/defiComponent.hpp new file mode 100644 index 00000000..96188953 --- /dev/null +++ b/src/def/def/defiComponent.hpp @@ -0,0 +1,252 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiComponent_h +#define defiComponent_h + +#include +#include "defiKRDefs.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +class defrData; + +// Placement status for the component. +// Default is 0 +#define DEFI_COMPONENT_UNPLACED 1 +#define DEFI_COMPONENT_PLACED 2 +#define DEFI_COMPONENT_FIXED 3 +#define DEFI_COMPONENT_COVER 4 + + +// Struct holds the data for componentMaskShiftLayers. +class defiComponentMaskShiftLayer { +public: + defiComponentMaskShiftLayer(); + defiComponentMaskShiftLayer(defrData *data); + ~defiComponentMaskShiftLayer(); + DEF_COPY_CONSTRUCTOR_H( defiComponentMaskShiftLayer ); + DEF_ASSIGN_OPERATOR_H( defiComponentMaskShiftLayer ); + void Init(); + void Destroy(); + void addMaskShiftLayer(const char* layer); + int numMaskShiftLayers() const; + void bumpLayers(int size); + void clear(); + const char* maskShiftLayer(int index) const; + +protected: + int layersAllocated_; // allocated size of layers_ + int numLayers_; // number of places used in layers_ + char** layers_; + + defrData *defData; +}; + + +// Struct holds the data for one component. +class defiComponent { +public: + defiComponent(defrData *defData); + void Init(); + + DEF_COPY_CONSTRUCTOR_H( defiComponent ); + void Destroy(); + ~defiComponent(); + + void IdAndName(const char* id, const char* name); + void setGenerate(const char* genName, const char* macroName); + void setPlacementStatus(int n); + void setPlacementLocation(int x, int y, int orient = -1); // changed by Mgwoo + void setRegionName(const char* name); + void setRegionBounds(int xl, int yl, int xh, int yh); + void setEEQ(const char* name); + void addNet(const char* netName); + void addProperty(const char* name, const char* value, const char type); + void addNumProperty(const char* name, const double d, + const char* value, const char type); + void reverseNetOrder(); + void setWeight(int w); + void setMaskShift(const char* color); + void setSource(const char* name); + void setForeignName(const char* name); + void setFori(const char* name); + void setForeignLocation(int x, int y, int orient); + void setHalo(int left, int bottom, int right, int top); // 5.6 + void setHaloSoft(); // 5.7 + void setRouteHalo(int haloDist, const char* minLayer, const char* maxLayer); + // 5.7 + void clear(); + + // For OA to modify the Id & Name + void changeIdAndName(const char* id, const char* name); + + const char* id() const; + const char* name() const; + int placementStatus() const; + int isUnplaced() const; + int isPlaced() const; + int isFixed() const; + int isCover() const; + int placementX() const; + int placementY() const; + int placementOrient() const; + const char* placementOrientStr() const; + int hasRegionName() const; + int hasRegionBounds() const; + int hasEEQ() const; + int hasGenerate() const; + int hasSource() const; + int hasWeight() const; + int weight() const; + int maskShiftSize() const; + int maskShift(int index) const; + int hasNets() const; + int numNets() const; + const char* net(int index) const; + const char* regionName() const; + const char* source() const; + const char* EEQ() const; + const char* generateName() const; + const char* macroName() const; + int hasHalo() const; // 5.6 + int hasHaloSoft() const; // 5.7 + void haloEdges(int* left, int* bottom, int* right, int* top); // 5.6 + int hasRouteHalo() const; // 5.7 + int haloDist() const; // 5.7 + const char* minLayer() const; // 5.7 + const char* maxLayer() const; // 5.7 + + // Returns arrays for the ll and ur of the rectangles in the region. + // The number of items in the arrays is given in size. + void regionBounds(int*size, int** xl, int** yl, int** xh, int** yh) const; + + int hasForeignName() const; + const char* foreignName() const; + int foreignX() const; + int foreignY() const; + const char* foreignOri() const; // return the string value of the orient + int foreignOrient() const; // return the enum value of the orient + int hasFori() const; + + int numProps() const; + char* propName(int index) const; + char* propValue(int index) const; + double propNumber(int index) const; + char propType(int index) const; + int propIsNumber(int index) const; + int propIsString(int index) const; + + + // Debug printing + void print(FILE* fout) const; + + void bumpId(int size); + void bumpName(int size); + void bumpRegionName(int size); + void bumpEEQ(int size); + void bumpNets(int size); + void bumpForeignName(int size); + void bumpMinLayer(int size); + void bumpMaxLayer(int size); + void bumpFori(int size); + +protected: + char* id_; // instance id + char* name_; // name. + int nameSize_; // allocated size of name. + int idSize_; // allocated size of id. + int ForiSize_; // allocate size of foreign ori + int status_; // placement status + char hasRegionName_; // the file supplied a region name for this comp + char hasEEQ_; // the file supplied an eeq + char hasGenerate_; // the file supplied an generate name and macro name + char hasWeight_; // the file supplied a weight + char hasFori_; // the file supplied a foreign orig name + int orient_; // orientation + int x_, y_; // placement loc + + int numRects_; + int rectsAllocated_; + int* rectXl_; // region points + int* rectYl_; + int* rectXh_; + int* rectYh_; + + char* regionName_; // name. + int regionNameSize_; // allocated size of region name + + char* EEQ_; + int EEQSize_; // allocated size of eeq + + int numNets_; // number of net connections + int netsAllocated_; // allocated size of nets array + char** nets_; // net connections + + int weight_; + int* maskShift_; + int maskShiftSize_; + char* source_; + char hasForeignName_; // the file supplied a foreign name + char* foreignName_; // name + int foreignNameSize_; // allocate size of foreign name + int Fx_, Fy_; // foreign loc + int Fori_; // foreign ori + int generateNameSize_; + char* generateName_; + int macroNameSize_; + char* macroName_; + + int hasHalo_; + int hasHaloSoft_; // 5.7 + int leftHalo_; + int bottomHalo_; + int rightHalo_; + int topHalo_; + int haloDist_; // 5.7 + int minLayerSize_; // 5.7 + char* minLayer_; // 5.7 + int maxLayerSize_; // 5.7 + char* maxLayer_; // 5.7 + + int numProps_; + int propsAllocated_; + char** names_; + char** values_; + double* dvalues_; + char* types_; + + defrData *defData; +}; + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiDebug.cpp b/src/def/def/defiDebug.cpp new file mode 100644 index 00000000..f229e786 --- /dev/null +++ b/src/def/def/defiDebug.cpp @@ -0,0 +1,96 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2015, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include +#include "lex.h" +#include "defiDebug.hpp" + + +#include "defrData.hpp" +#include "defrSettings.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +extern defrContext defContext; + + /******************* + * Debug flags: + * 0 - + * 1 - malloc debug + * 2 - print each history size bump up. + * 3 - print each call to CatchAll + * 4 - + * 5 - + * 6 - + * 7 - + * 8 - + * 9 - + * 10 - + * 11 - lexer debug + * + ******************************/ + +/* Set flag */ +void defiSetDebug(int, int) { +} + +/* Read flag */ +int defiDebug(int) { + return 0; +} + +void defiError(int check, int msgNum, const char* mess, defrData *defData) { + /* check is 1 if the caller function has checked totalMsgLimit, etc. */ + if (!defData) { + defData = defContext.data; + } + + return defData->defiError(check, msgNum, mess); +} + +const char* upperCase(const char* str, defrData *defData) { + if (!defData) { + defData = defContext.data; + } + + return defData->upperCase(str); +} + +const char* DEFCASE(const char* ch, defrData *defData) { + if (!defData) { + defData = defContext.data; + } + + return defData->DEFCASE(ch); +} + +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defiDebug.hpp b/src/def/def/defiDebug.hpp new file mode 100644 index 00000000..97e5789d --- /dev/null +++ b/src/def/def/defiDebug.hpp @@ -0,0 +1,56 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiDebug_h +#define defiDebug_h + +#include "defiKRDefs.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +class defrData; + +/* Set flag */ +extern void defiSetDebug (int num, int value) ; + +/* Read flag */ +extern int defiDebug (int num) ; + +/* Error loggin function */ +extern void defiError(int check, int msgNum, const char* message, defrData *defData = NULL); + +/* for auto upshifting names in case insensitive files */ +extern const char* upperCase(const char* c, defrData *defData = NULL); +extern const char* DEFCASE(const char* ch, defrData *defData = NULL); + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiDefs.hpp b/src/def/def/defiDefs.hpp new file mode 100644 index 00000000..17b7b89c --- /dev/null +++ b/src/def/def/defiDefs.hpp @@ -0,0 +1,182 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +/* Definitions header file for the DEF Interface */ + +#ifndef DEFI_DEFS_H +#define DEFI_DEFS_H + +#include +#include + +#include "defiKRDefs.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +/*=================== General Types and Definitions =================*/ + +#ifndef TRUE +#define TRUE (1) +#endif + +#ifndef FALSE +#define FALSE (0) +#endif + +#ifndef NULL +#define NULL (0) +#endif + +typedef struct defpoint defPOINT; + +struct defpoint { + int x; + int y; + }; + +typedef struct defrect defRECT; + +struct defrect { + defPOINT ll,ur; + }; + +typedef struct deftoken defTOKEN; + +struct deftoken { + defTOKEN *next; + int what; + int data; + defPOINT pt; + }; + +#define START_LIST 10001 +#define POINT_SPEC 10002 +#define VIA_SPEC 10003 +#define WIDTH_SPEC 10004 +#define LAYER_SPEC 10005 +#define SHAPE_SPEC 10006 + +#ifndef MIN +#define MIN(x,y) ((x) < (y)? (x) : (y)) +#endif + +#ifndef MIN +#define MAX(x,y) ((x) > (y)? (x) : (y)) +#endif + +#define ROUND(x) ((x) >= 0 ? (int)((x)+0.5) : (int)((x)-0.5)) + +//defTOKEN *TokenFromRect(); + +/*=================== Enumerated Types ============================*/ +typedef int defiBoolean; + +/* Every type of object has a unique identifier, and each object + * which is created knows its type, by storing the defiObjectType_e + * as the first member in the structure. + * + */ +typedef enum +{ + /* decrease likelihood of accidentally correct values by starting + at an unusual number */ + defiInvalidObject = 41713, + defiUnknownObject /* void * */ +} defiObjectType_e; + + +/* The memory policy controls how an object which refers to or is composed of + * other objects manages those sub-objects, particularly when the parent + * object is copied or deleted. The policy is specified as an argument to the + * constructor or initializer, and it is stored with the parent object. + * + * The memory policy is a generalization of the common distinction between + * deep and shallow copies. When a shallow copy of a parent object is made, + * the copy maintains pointers to the original sub-objects, and the original + * parent remains responsible for deleting those sub-objects. When a deep + * copy of a parent object is made, the copy maintains pointers to new copies + * of each of the sub-objects, and the copy is responsible for deleting the + * new sub-objects. + * + * The defiPrivateSubObjects policy corresponds to a deep copy, while the the + * defiReferencedSubObjects policy corresponds to a shallow copy. Usually an + * initial parent object will be created using defiPrivateSubObjects. When a + * copy is made of that parent object, the copy may either maintain its own + * private versions of each sub-object, or it may refer to the original + * sub-objects. + * + * In certain cases, it is useful to create a deep copy of a parent object, + * even though the new parent object shouldn't be responsible for the new + * sub-objects. In this case, the defiOrphanSubObjects and + * defiAdoptedSubObjects policies may be used. defiOrphanSubObjects is + * specified while creating the deep copy, and then defiAdoptedSubObjects is + * specified while creating another parent which will take on the + * responsibility for the orphans. + * + * An object's memory policy affects only the sub-objects which it directly + * controls. Those sub-objects themselves may have the same memory policy as + * their parents, or they may have a different memory policy. When a copy is + * made of a child sub-object, the memory policy of the child controls + * whether deep or shallow copies are made of the grandchildren. + */ +typedef enum +{ + /* decrease likelihood of accidentally correct values by starting + at an unusual number */ + defiInvalidMemoryPolicy = 23950, + defiPrivateSubObjects, // deep copy + delete + defiReferencedSubObjects, // shallow copy, no delete + defiOrphanSubObjects, // deep copy, no delete + defiAdoptedSubObjects // shallow copy + delete +} defiMemoryPolicy_e; + +/* An opaque pointer for passing user data through from one API + * function to another. + * A handle which a user can set to point to their own data + * on a per-callback basis. (See the comment in defwWriter.h) + */ +#define defiUserData void * +#define defiUserDataHandle void ** + +/* On SunOs 4.1.3 with acc, this is in libansi.a, but isn't properly + * declared anywhere in the header files supplied with the compiler. + */ +#ifdef __SunOS_4_1_3 +extern int strcasecmp(const char*, const char*); +#endif + +#ifdef WIN32 +#define strdup _strdup +#endif + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiFPC.cpp b/src/def/def/defiFPC.cpp new file mode 100644 index 00000000..f1088a6f --- /dev/null +++ b/src/def/def/defiFPC.cpp @@ -0,0 +1,269 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2015, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include "lex.h" +#include "defiFPC.hpp" +#include "defiDebug.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +////////////////////////////////////////////// +////////////////////////////////////////////// +// +// defiFPC +// +////////////////////////////////////////////// +////////////////////////////////////////////// + + +defiFPC::defiFPC(defrData *data) + : defData(data) +{ + Init(); +} + + +void defiFPC::Init() { + name_ = 0; + nameLength_ = 0; + namesAllocated_ = 0; + namesUsed_ = 0; + names_ = 0; + rowOrComp_ = 0; + clear(); +} + + +defiFPC::~defiFPC() { + Destroy(); +} + + +void defiFPC::Destroy() { + + clear(); + + if (name_) free(name_); + name_ = 0; + nameLength_ = 0; + + free((char*)(names_)); + free((char*)(rowOrComp_)); + namesAllocated_ = 0; +} + + +void defiFPC::clear() { + int i; + + direction_ = 0; + hasAlign_ = 0; + hasMin_ = 0; + hasMax_ = 0; + hasEqual_ = 0; + corner_ = 0; + + for (i = 0; i < namesUsed_; i++) { + if (names_[i]) free (names_[i]) ; + } + namesUsed_ = 0; +} + + +void defiFPC::setName(const char* name, const char* direction) { + int len = strlen(name) + 1; + + clear(); + + if (len > nameLength_) { + if (name_) free(name_); + nameLength_ = len; + name_ = (char*)malloc(len); + } + strcpy(name_, defData->DEFCASE(name)); + + if (*direction == 'H') + direction_ = 'H'; + else if (*direction == 'V') + direction_ = 'V'; + else + defiError(0, 6030, "ERROR (DEFPARS-6030): Invalid direction specified with FPC name. The valid direction is either 'H' or 'V'. Specify a valid value and then try again.", defData); + +} + + +void defiFPC::print(FILE* f) const { + fprintf(f, "FPC '%s'\n", name_); +} + + +const char* defiFPC::name() const { + return name_; +} + + +int defiFPC::isVertical() const { + return direction_ == 'V' ? 1 : 0 ; +} + + +int defiFPC::isHorizontal() const { + return direction_ == 'H' ? 1 : 0 ; +} + + +int defiFPC::hasAlign() const { + return (int)(hasAlign_); +} + + +int defiFPC::hasMax() const { + return (int)(hasMax_); +} + + +int defiFPC::hasMin() const { + return (int)(hasMin_); +} + + +int defiFPC::hasEqual() const { + return (int)(hasEqual_); +} + + +double defiFPC::alignMin() const { + return minMaxEqual_; +} + + +double defiFPC::alignMax() const { + return minMaxEqual_; +} + + +double defiFPC::equal() const { + return minMaxEqual_; +} + + +int defiFPC::numParts() const { + return namesUsed_; +} + + +void defiFPC::setAlign() { + hasAlign_ = 0; +} + + +void defiFPC::setMin(double num) { + minMaxEqual_ = num; +} + + +void defiFPC::setMax(double num) { + minMaxEqual_ = num; +} + + +void defiFPC::setEqual(double num) { + minMaxEqual_ = num; +} + + +void defiFPC::setDoingBottomLeft() { + corner_ = 'B'; +} + + +void defiFPC::setDoingTopRight() { + corner_ = 'T'; +} + + +void defiFPC::getPart(int index, int* corner, int* typ, char** name) const { + if (index >= 0 && index <= namesUsed_) { + // 4 for bottom left 0 for topright + // 2 for row 0 for comps + if (corner) *corner = (int)((rowOrComp_[index] & 4) ? 'B' : 'T') ; + if (typ) *typ = (int)((rowOrComp_[index] & 2) ? 'R' : 'C') ; + if (name) *name = names_[index]; + } +} + + +void defiFPC::addRow(const char* name) { + addItem('R', defData->DEFCASE(name)); +} + + +void defiFPC::addComps(const char* name) { + addItem('C', defData->DEFCASE(name)); +} + + +void defiFPC::addItem(char item, const char* name) { + int len = strlen(name) + 1; + + if (namesUsed_ >= namesAllocated_) { + char* newR; + char** newN; + int i; + namesAllocated_ = + namesAllocated_ ? namesAllocated_ * 2 : 8 ; + newN = (char**) malloc(sizeof(char*) * namesAllocated_); + newR = (char*) malloc(sizeof(char) * namesAllocated_); + for (i = 0; i < namesUsed_; i++) { + newN[i] = names_[i]; + newR[i] = rowOrComp_[i]; + } + if (names_) free((char*)(names_)); + if (rowOrComp_) free(rowOrComp_); + names_ = newN; + rowOrComp_ = newR; + } + + names_[namesUsed_] = (char*)malloc(len); + strcpy(names_[namesUsed_], name); + + // 4 for bottomleft + // 2 for row + rowOrComp_[namesUsed_] = + (char)(((corner_ == 'B') ? 4 : 0) | + (item == 'R' ? 2 : 0)); + + namesUsed_ += 1; +} + + +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defiFPC.hpp b/src/def/def/defiFPC.hpp new file mode 100644 index 00000000..712d8632 --- /dev/null +++ b/src/def/def/defiFPC.hpp @@ -0,0 +1,107 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiFPC_h +#define defiFPC_h + +#include +#include "defiKRDefs.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +class defrData; + +class defiFPC { +public: + defiFPC(defrData *data); + void Init(); + + void Destroy(); + ~defiFPC(); + + void clear(); + + void setName(const char* name, const char* direction); + void setAlign(); + void setMax(double num); + void setMin(double num); + void setEqual(double num); + void setDoingBottomLeft(); + void setDoingTopRight(); + void addRow(const char* name); + void addComps(const char* name); + void addItem(char typ, const char* name); + + const char* name() const; + int isVertical() const; + int isHorizontal() const; + int hasAlign() const; + int hasMax() const; + int hasMin() const; + int hasEqual() const; + double alignMax() const; + double alignMin() const; + double equal() const; + + int numParts() const; + + // Return the constraint number "index" where index is + // from 0 to numParts() + // The returned corner is 'B' for bottom left 'T' for topright + // The returned typ is 'R' for rows 'C' for comps + // The returned char* points to name of the item. + void getPart(int index, int* corner, int* typ, char** name) const; + + // debug print + void print(FILE* f) const; + +protected: + char* name_; + int nameLength_; + char direction_; // H or V + char hasAlign_; + char hasMin_; + char hasMax_; + char hasEqual_; + char corner_; // Bottomleft or Topright + double minMaxEqual_; + int namesAllocated_; // allocated size of names_ and rowOrComp_ + int namesUsed_; // number of entries used in the arrays + char* rowOrComp_; + char** names_; + + defrData *defData; +}; + + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiFill.cpp b/src/def/def/defiFill.cpp new file mode 100644 index 00000000..ef7909bc --- /dev/null +++ b/src/def/def/defiFill.cpp @@ -0,0 +1,428 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2015, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include +#include "lex.h" +#include "defiFill.hpp" +#include "defiDebug.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +//////////////////////////////////////////////////// +//////////////////////////////////////////////////// +// +// defiFill +// +//////////////////////////////////////////////////// +//////////////////////////////////////////////////// + +defiFill::defiFill(defrData *data) +: defData(data) +{ + Init(); +} + + +void defiFill::Init() { + numPolys_ = 0; + numPts_ = 0; + clear(); + layerNameLength_ = 0; + xl_ = (int*)malloc(sizeof(int)*1); + yl_ = (int*)malloc(sizeof(int)*1); + xh_ = (int*)malloc(sizeof(int)*1); + yh_ = (int*)malloc(sizeof(int)*1); + rectsAllocated_ = 1; // At least 1 rectangle will define + polysAllocated_ = 0; + polygons_ = 0; + layerName_ = 0; + viaName_ = 0; + viaNameLength_ = 0; + viaPts_ = 0; + ptsAllocated_ = 0; + viaPts_ = 0; + +} + +defiFill::~defiFill() { + Destroy(); +} + +void defiFill::clear() { + hasLayer_ = 0; + layerOpc_ = 0; + numRectangles_ = 0; + hasVia_ = 0; + viaOpc_ = 0; + mask_ = 0; +} + +void defiFill::clearPoly() { + struct defiPoints* p; + int i; + + for (i = 0; i < numPolys_; i++) { + p = polygons_[i]; + free((char*)(p->x)); + free((char*)(p->y)); + free((char*)(polygons_[i])); + } + numPolys_ = 0; +} + +void defiFill::clearPts() { + struct defiPoints* p; + int i; + + for (i = 0; i < numPts_; i++) { + p = viaPts_[i]; + free((char*)(p->x)); + free((char*)(p->y)); + free((char*)(viaPts_[i])); + } + numPts_ = 0; +} + +void defiFill::Destroy() { + if (layerName_) free(layerName_); + if (viaName_) free(viaName_); + free((char*)(xl_)); + free((char*)(yl_)); + free((char*)(xh_)); + free((char*)(yh_)); + rectsAllocated_ = 0; + xl_ = 0; + yl_ = 0; + xh_ = 0; + yh_ = 0; + clearPoly(); + if (polygons_) free((char*)(polygons_)); + polygons_ = 0; + clearPts(); + if (viaPts_) free((char*)(viaPts_)); + viaPts_ = 0; + clear(); +} + + +void defiFill::setLayer(const char* name) { + int len = strlen(name) + 1; + if (layerNameLength_ < len) { + if (layerName_) free(layerName_); + layerName_ = (char*)malloc(len); + layerNameLength_ = len; + } + strcpy(layerName_, defData->DEFCASE(name)); + hasLayer_ = 1; +} + +// 5.7 +void defiFill::setLayerOpc() { + layerOpc_ = 1; +} + +void defiFill::addRect(int xl, int yl, int xh, int yh) { + if (numRectangles_ == rectsAllocated_) { + int i; + int max = rectsAllocated_ = rectsAllocated_ * 2; + int* newxl = (int*)malloc(sizeof(int)*max); + int* newyl = (int*)malloc(sizeof(int)*max); + int* newxh = (int*)malloc(sizeof(int)*max); + int* newyh = (int*)malloc(sizeof(int)*max); + for (i = 0; i < numRectangles_; i++) { + newxl[i] = xl_[i]; + newyl[i] = yl_[i]; + newxh[i] = xh_[i]; + newyh[i] = yh_[i]; + } + free((char*)(xl_)); + free((char*)(yl_)); + free((char*)(xh_)); + free((char*)(yh_)); + xl_ = newxl; + yl_ = newyl; + xh_ = newxh; + yh_ = newyh; + } + xl_[numRectangles_] = xl; + yl_[numRectangles_] = yl; + xh_[numRectangles_] = xh; + yh_[numRectangles_] = yh; + numRectangles_ += 1; +} + +// 5.6 +void defiFill::addPolygon(defiGeometries* geom) { + struct defiPoints* p; + int x, y; + int i; + + if (numPolys_ == polysAllocated_) { + struct defiPoints** poly; + polysAllocated_ = (polysAllocated_ == 0) ? + 2 : polysAllocated_ * 2; + poly = (struct defiPoints**)malloc(sizeof(struct defiPoints*) * + polysAllocated_); + for (i = 0; i < numPolys_; i++) + poly[i] = polygons_[i]; + if (polygons_) + free((char*)(polygons_)); + polygons_ = poly; + } + p = (struct defiPoints*)malloc(sizeof(struct defiPoints)); + p->numPoints = geom->numPoints(); + p->x = (int*)malloc(sizeof(int)*p->numPoints); + p->y = (int*)malloc(sizeof(int)*p->numPoints); + for (i = 0; i < p->numPoints; i++) { + geom->points(i, &x, &y); + p->x[i] = x; + p->y[i] = y; + } + polygons_[numPolys_] = p; + numPolys_ += 1; +} + +int defiFill::hasLayer() const { + return hasLayer_; +} + +const char* defiFill::layerName() const { + return layerName_; +} + +// 5.7 +int defiFill::hasLayerOpc() const { + return layerOpc_; +} + +int defiFill::numRectangles() const { + return numRectangles_; +} + + +int defiFill::xl(int index) const { + if (index < 0 || index >= numRectangles_) { + defiError(1, 0, "bad index for Fill xl", defData); + return 0; + } + return xl_[index]; +} + + +int defiFill::yl(int index) const { + if (index < 0 || index >= numRectangles_) { + defiError(1, 0, "bad index for Fill yl", defData); + return 0; + } + return yl_[index]; +} + + +int defiFill::xh(int index) const { + if (index < 0 || index >= numRectangles_) { + defiError(1, 0, "bad index for Fill xh", defData); + return 0; + } + return xh_[index]; +} + + +int defiFill::yh(int index) const { + if (index < 0 || index >= numRectangles_) { + defiError(1, 0, "bad index for Fill yh", defData); + return 0; + } + return yh_[index]; +} + +// 5.6 +int defiFill::numPolygons() const { + return numPolys_; +} + + +// 5.6 +struct defiPoints defiFill::getPolygon(int index) const { + return *(polygons_[index]); +} + +// 5.7 +void defiFill::setVia(const char* name) { + int len = strlen(name) + 1; + if (viaNameLength_ < len) { + if (viaName_) free(viaName_); + viaName_ = (char*)malloc(len); + viaNameLength_ = len; + } + strcpy(viaName_, defData->DEFCASE(name)); + hasVia_ = 1; +} + +// 5.7 +void defiFill::setViaOpc() { + viaOpc_ = 1; +} + +// 5.8 +void defiFill::setMask(int colorMask) { + mask_ = colorMask; +} + + +// 5.7 +void defiFill::addPts(defiGeometries* geom) { + struct defiPoints* p; + int x, y; + int i; + + if (numPts_ == ptsAllocated_) { + struct defiPoints** pts; + ptsAllocated_ = (ptsAllocated_ == 0) ? + 2 : ptsAllocated_ * 2; + pts= (struct defiPoints**)malloc(sizeof(struct defiPoints*) * + ptsAllocated_); + for (i = 0; i < numPts_; i++) + pts[i] = viaPts_[i]; + if (viaPts_) + free((char*)(viaPts_)); + viaPts_ = pts; + } + p = (struct defiPoints*)malloc(sizeof(struct defiPoints)); + p->numPoints = geom->numPoints(); + p->x = (int*)malloc(sizeof(int)*p->numPoints); + p->y = (int*)malloc(sizeof(int)*p->numPoints); + for (i = 0; i < p->numPoints; i++) { + geom->points(i, &x, &y); + p->x[i] = x; + p->y[i] = y; + } + viaPts_[numPts_] = p; + numPts_ += 1; +} + +// 5.7 +int defiFill::hasVia() const { + return hasVia_; +} + +// 5.7 +const char* defiFill::viaName() const { + return viaName_; +} + +// 5.7 +int defiFill::hasViaOpc() const { + return viaOpc_; +} + +// 5.7 +int defiFill::numViaPts() const { + return numPts_; +} + +// 5.8 +int defiFill::layerMask() const { + return mask_; +} + +// 5.8 +int defiFill::viaTopMask() const { + return mask_ / 100; +} + +// 5.8 +int defiFill::viaCutMask() const { + return mask_ / 10 % 10; +} + +// 5.8 +int defiFill::viaBottomMask() const { + return mask_ % 10; +} + +// 5.7 +struct defiPoints defiFill::getViaPts(int index) const { + return *(viaPts_[index]); +} + +void defiFill::print(FILE* f) const { + int i, j; + struct defiPoints points; + + if (hasLayer()) + fprintf(f, "- LAYER %s", layerName()); + + if (layerMask()) + fprintf(f, " + Mask %d", layerMask()); + + if (hasLayerOpc()) + fprintf(f, " + OPC"); + fprintf(f, "\n"); + + for (i = 0; i < numRectangles(); i++) { + fprintf(f, " RECT %d %d %d %d\n", xl(i), + yl(i), xh(i), + yh(i)); + } + + for (i = 0; i < numPolygons(); i++) { + fprintf(f, " POLYGON "); + points = getPolygon(i); + for (j = 0; j < points.numPoints; j++) + fprintf(f, "%d %d ", points.x[j], points.y[j]); + fprintf(f, "\n"); + } + fprintf(f,"\n"); + + if (hasVia()) + fprintf(f, "- VIA %s", viaName()); + + if (mask_) { + fprintf(f, " + MASK %d%d%d", viaTopMask(), + viaCutMask(), + viaBottomMask()); + } + + if (hasViaOpc()) + fprintf(f, " + OPC"); + fprintf(f, "\n"); + + for (i = 0; i < numViaPts(); i++) { + fprintf(f, " "); + points = getViaPts(i); + for (j = 0; j < points.numPoints; j++) + fprintf(f, "%d %d ", points.x[j], points.y[j]); + fprintf(f, "\n"); + } + fprintf(f,"\n"); +} +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defiFill.hpp b/src/def/def/defiFill.hpp new file mode 100644 index 00000000..53c9a23c --- /dev/null +++ b/src/def/def/defiFill.hpp @@ -0,0 +1,120 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiFILL_h +#define defiFILL_h + +#include +#include "defiKRDefs.hpp" +#include "defiMisc.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +class defrData; + +class defiFill { +public: + defiFill(defrData *data); + void Init(); + + void Destroy(); + ~defiFill(); + + void clear(); + void clearPoly(); + void clearPts(); + + void setLayer(const char* name); + void setLayerOpc(); // 5.7 + void addRect(int xl, int yl, int xh, int yh); + void addPolygon(defiGeometries* geom); + void setVia(const char* name); // 5.7 + void setViaOpc(); // 5.7 + void addPts(defiGeometries* geom); // 5.7 + + int hasLayer() const; + const char* layerName() const; + int hasLayerOpc() const; // 5.7 + + void setMask(int colorMask); // 5.8 + int layerMask() const; // 5.8 + int viaTopMask() const; // 5.8 + int viaCutMask() const; // 5.8 + int viaBottomMask() const; // 5.8 + + int numRectangles() const; + int xl(int index) const; + int yl(int index) const; + int xh(int index) const; + int yh(int index) const; + + int numPolygons() const; // 5.6 + struct defiPoints getPolygon(int index) const; // 5.6 + + int hasVia() const; // 5.7 + const char* viaName() const; // 5.7 + int hasViaOpc() const; // 5.7 + + int numViaPts() const; // 5.7 + struct defiPoints getViaPts(int index) const; // 5.7 + + void print(FILE* f) const; + +protected: + int hasLayer_; + char* layerName_; + int layerNameLength_; + int layerOpc_; // 5.7 + int numRectangles_; + int rectsAllocated_; + int* xl_; + int* yl_; + int* xh_; + int* yh_; + int numPolys_; // 5.6 + int polysAllocated_; // 5.6 + struct defiPoints** polygons_; // 5.6 + int hasVia_; // 5.7 + char* viaName_; // 5.7 + int viaNameLength_; // 5.7 + int viaOpc_; // 5.7 + int numPts_; // 5.7 + int ptsAllocated_; // 5.7 + int mask_; // 5.8 + struct defiPoints** viaPts_; // 5.7 + + defrData *defData; +}; + + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiGroup.cpp b/src/def/def/defiGroup.cpp new file mode 100644 index 00000000..e86ecfdb --- /dev/null +++ b/src/def/def/defiGroup.cpp @@ -0,0 +1,447 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2015, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include "lex.h" +#include "defiGroup.hpp" +#include "defiDebug.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +////////////////////////////////////////////// +////////////////////////////////////////////// +// +// defiGroup +// +////////////////////////////////////////////// +////////////////////////////////////////////// + + +defiGroup::defiGroup(defrData *data) +: defData(data) +{ + Init(); +} + + +void defiGroup::Init() { + name_ = 0; + nameLength_ = 0; + region_ = 0; + regionLength_ = 0; + + numRects_ = 0; + rectsAllocated_ = 2; + xl_ = (int*)malloc(sizeof(int)*2); + yl_ = (int*)malloc(sizeof(int)*2); + xh_ = (int*)malloc(sizeof(int)*2); + yh_ = (int*)malloc(sizeof(int)*2); + + numProps_ = 0; + propsAllocated_ = 2; + propNames_ = (char**)malloc(sizeof(char*)*2); + propValues_ = (char**)malloc(sizeof(char*)*2); + propDValues_ = (double*)malloc(sizeof(double)*2); + propTypes_ = (char*)malloc(sizeof(char)*2); +} + + +defiGroup::~defiGroup() { + Destroy(); +} + + +void defiGroup::Destroy() { + + if (name_) free(name_); + if (region_) free(region_); + name_ = 0; + nameLength_ = 0; + region_ = 0; + regionLength_ = 0; + + clear(); + free((char*)(propNames_)); + free((char*)(propValues_)); + free((char*)(propDValues_)); + free((char*)(propTypes_)); + free((char*)(xl_)); + free((char*)(yl_)); + free((char*)(xh_)); + free((char*)(yh_)); +} + + +void defiGroup::clear() { + int i; + hasRegionName_ = 0; + hasPerim_ = 0; + hasMaxX_ = 0; + hasMaxY_ = 0; + for (i = 0; i < numProps_; i++) { + free(propNames_[i]); + free(propValues_[i]); + propDValues_[i] = 0; + } + numProps_ = 0; + numRects_ = 0; +} + + +void defiGroup::setup(const char* name) { + int len = strlen(name) + 1; + if (len > nameLength_) { + if (name_) free(name_); + nameLength_ = len; + name_ = (char*)malloc(len); + } + strcpy(name_, defData->DEFCASE(name)); + clear(); + +} + + +void defiGroup::addRegionRect(int xl, int yl, int xh, int yh) { + int i; + if (numRects_ == rectsAllocated_) { + int max = numRects_ * 2; + int* nxl = (int*)malloc(sizeof(int)*max); + int* nyl = (int*)malloc(sizeof(int)*max); + int* nxh = (int*)malloc(sizeof(int)*max); + int* nyh = (int*)malloc(sizeof(int)*max); + max = numRects_; + for (i = 0; i < max; i++) { + nxl[i] = xl_[i]; + nyl[i] = yl_[i]; + nxh[i] = xh_[i]; + nyh[i] = yh_[i]; + } + free((char*)(xl_)); + free((char*)(yl_)); + free((char*)(xh_)); + free((char*)(yh_)); + xl_ = nxl; + yl_ = nyl; + xh_ = nxh; + yh_ = nyh; + rectsAllocated_ *= 2; + } + + i = numRects_; + xl_[i] = xl; + yl_[i] = yl; + xh_[i] = xh; + yh_[i] = yh; + numRects_ += 1; +} + + +void defiGroup::regionRects(int* size, int** xl, + int**yl, int** xh, int** yh) const { + *size = numRects_; + *xl = xl_; + *yl = yl_; + *xh = xh_; + *yh = yh_; +} + + +void defiGroup::setRegionName(const char* region) { + int len = strlen(region) + 1; + if (len > regionLength_) { + if (region_) free(region_); + regionLength_ = len; + region_ = (char*)malloc(len); + } + strcpy(region_, defData->DEFCASE(region)); + hasRegionName_ = 1; + +} + + +void defiGroup::setMaxX(int x) { + hasMaxX_ = 1; + maxX_ = x; +} + + +void defiGroup::setMaxY(int y) { + hasMaxY_ = 1; + maxY_ = y; +} + + +void defiGroup::setPerim(int p) { + hasPerim_ = 1; + perim_ = p; +} + + +void defiGroup::addProperty(const char* name, const char* value, + const char type) { + int len; + if (numProps_ == propsAllocated_) { + int i; + char** nn; + char** nv; + double* nd; + char* nt; + + propsAllocated_ *= 2; + nn = (char**)malloc(sizeof(char*)*propsAllocated_); + nv = (char**)malloc(sizeof(char*)*propsAllocated_); + nd = (double*)malloc(sizeof(double)*propsAllocated_); + nt = (char*)malloc(sizeof(char)*propsAllocated_); + for (i = 0; i < numProps_; i++) { + nn[i] = propNames_[i]; + nv[i] = propValues_[i]; + nd[i] = propDValues_[i]; + nt[i] = propTypes_[i]; + } + free((char*)(propNames_)); + free((char*)(propValues_)); + free((char*)(propDValues_)); + free((char*)(propTypes_)); + propNames_ = nn; + propValues_ = nv; + propDValues_ = nd; + propTypes_ = nt; + } + len = strlen(name) + 1; + propNames_[numProps_] = (char*)malloc(len); + strcpy(propNames_[numProps_], defData->DEFCASE(name)); + len = strlen(value) + 1; + propValues_[numProps_] = (char*)malloc(len); + strcpy(propValues_[numProps_], defData->DEFCASE(value)); + propDValues_[numProps_] = 0; + propTypes_[numProps_] = type; + numProps_ += 1; +} + + +void defiGroup::addNumProperty(const char* name, const double d, + const char* value, const char type) { + int len; + if (numProps_ == propsAllocated_) { + int i; + char** nn; + char** nv; + double* nd; + char* nt; + + propsAllocated_ *= 2; + nn = (char**)malloc(sizeof(char*)*propsAllocated_); + nv = (char**)malloc(sizeof(char*)*propsAllocated_); + nd = (double*)malloc(sizeof(double)*propsAllocated_); + nt = (char*)malloc(sizeof(char)*propsAllocated_); + for (i = 0; i < numProps_; i++) { + nn[i] = propNames_[i]; + nv[i] = propValues_[i]; + nd[i] = propDValues_[i]; + nt[i] = propTypes_[i]; + } + free((char*)(propNames_)); + free((char*)(propValues_)); + free((char*)(propDValues_)); + free((char*)(propTypes_)); + propNames_ = nn; + propValues_ = nv; + propDValues_ = nd; + propTypes_ = nt; + } + len = strlen(name) + 1; + propNames_[numProps_] = (char*)malloc(len); + strcpy(propNames_[numProps_], defData->DEFCASE(name)); + len = strlen(value) + 1; + propValues_[numProps_] = (char*)malloc(len); + strcpy(propValues_[numProps_], defData->DEFCASE(value)); + propDValues_[numProps_] = d; + propTypes_[numProps_] = type; + numProps_ += 1; +} + + +int defiGroup::numProps() const { + return numProps_; +} + + +const char* defiGroup::propName(int index) const { + char msg[160]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (LEFPARS-6050): The index number %d given for the GROUP PROPERTY is invalid.\nValid index is from 0 to %d", index, numProps_); + defiError(0, 6050, msg, defData); + return 0; + } + return propNames_[index]; +} + + +const char* defiGroup::propValue(int index) const { + char msg[160]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (LEFPARS-6050): The index number %d given for the GROUP PROPERTY is invalid.\nValid index is from 0 to %d", index, numProps_); + defiError(0, 6050, msg, defData); + return 0; + } + return propValues_[index]; +} + + +double defiGroup::propNumber(int index) const { + char msg[160]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (LEFPARS-6050): The index number %d given for the GROUP PROPERTY is invalid.\nValid index is from 0 to %d", index, numProps_); + defiError(0, 6050, msg, defData); + return 0; + } + return propDValues_[index]; +} + + +char defiGroup::propType(int index) const { + char msg[160]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (LEFPARS-6050): The index number %d given for the GROUP PROPERTY is invalid.\nValid index is from 0 to %d", index, numProps_); + defiError(0, 6050, msg, defData); + return 0; + } + return propTypes_[index]; +} + + +int defiGroup::propIsNumber(int index) const { + char msg[160]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (LEFPARS-6050): The index number %d given for the GROUP PROPERTY is invalid.\nValid index is from 0 to %d", index, numProps_); + defiError(0, 6050, msg, defData); + return 0; + } + return propDValues_[index] ? 1 : 0; +} + + +int defiGroup::propIsString(int index) const { + char msg[160]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (LEFPARS-6050): The index number %d given for the GROUP PROPERTY is invalid.\nValid index is from 0 to %d", index, numProps_); + defiError(0, 6050, msg, defData); + return 0; + } + return propDValues_[index] ? 0 : 1; +} + + +const char* defiGroup::regionName() const { + return region_; +} + + +const char* defiGroup::name() const { + return name_; +} + + +int defiGroup::perim() const { + return perim_; +} + + +int defiGroup::maxX() const { + return maxX_; +} + + +int defiGroup::maxY() const { + return maxY_; +} + + +int defiGroup::hasMaxX() const { + return hasMaxX_; +} + + +int defiGroup::hasMaxY() const { + return hasMaxY_; +} + + +int defiGroup::hasPerim() const { + return hasPerim_; +} + + +int defiGroup::hasRegionBox() const { + return numRects_ ? 1 : 0 ; +} + + +int defiGroup::hasRegionName() const { + return hasRegionName_; +} + + +void defiGroup::print(FILE* f) const { + int i; + + fprintf(f, "Group '%s'\n", name()); + + if (hasRegionName()) { + fprintf(f, " region name '%s'\n", regionName()); + } + + if (hasRegionBox()) { + int size = numRects_; + int* xl = xl_; + int* yl = yl_; + int* xh = xh_; + int* yh = yh_; + for (i = 0; i < size; i++) + fprintf(f, " region box %d,%d %d,%d\n", xl[i], yl[i], xh[i], yh[i]); + } + + if (hasMaxX()) { + fprintf(f, " max x %d\n", maxX()); + } + + if (hasMaxY()) { + fprintf(f, " max y %d\n", maxY()); + } + + if (hasPerim()) { + fprintf(f, " perim %d\n", perim()); + } + +} + + +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defiGroup.hpp b/src/def/def/defiGroup.hpp new file mode 100644 index 00000000..65cd0551 --- /dev/null +++ b/src/def/def/defiGroup.hpp @@ -0,0 +1,122 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiGroup_h +#define defiGroup_h + +#include +#include "defiKRDefs.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +class defrData; + +// Struct holds the data for one property. + +class defiGroup { +public: + defiGroup(defrData *data); + void Init(); + + void Destroy(); + ~defiGroup(); + + void clear(); + + void setup(const char* name); + void addProperty(const char* name, const char* value, const char type); + void addNumProperty(const char* name, const double d, + const char* value, const char type); + void addRegionRect(int xl, int yl, int xh, int yh); + void setRegionName(const char* name); + void setMaxX(int x); + void setMaxY(int y); + void setPerim(int p); + + const char* name() const; + const char* regionName() const; + int hasRegionBox() const; + int hasRegionName() const; + int hasMaxX() const; + int hasMaxY() const; + int hasPerim() const; + void regionRects(int* size, int** xl, int**yl, int** xh, int** yh) const; + int maxX() const; + int maxY() const; + int perim() const; + + int numProps() const; + const char* propName(int index) const; + const char* propValue(int index) const; + double propNumber(int index) const; + char propType(int index) const; + int propIsNumber(int index) const; + int propIsString(int index) const; + + // debug print + void print(FILE* f) const; + +protected: + char* name_; + int nameLength_; + char* region_; + int regionLength_; + + int rectsAllocated_; + int numRects_; + int* xl_; + int* yl_; + int* xh_; + int* yh_; + + int maxX_; + int maxY_; + int perim_; + char hasRegionBox_; + char hasRegionName_; + char hasPerim_; + char hasMaxX_; + char hasMaxY_; + + int numProps_; + int propsAllocated_; + char** propNames_; + char** propValues_; + double* propDValues_; + char* propTypes_; + + defrData *defData; +}; + + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiIOTiming.cpp b/src/def/def/defiIOTiming.cpp new file mode 100644 index 00000000..fc3b03f6 --- /dev/null +++ b/src/def/def/defiIOTiming.cpp @@ -0,0 +1,424 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2015, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include "lex.h" +#include "defiIOTiming.hpp" +#include "defiDebug.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +////////////////////////////////////////////// +////////////////////////////////////////////// +// +// defiIOTiming +// +////////////////////////////////////////////// +////////////////////////////////////////////// + + +defiIOTiming::defiIOTiming(defrData *data) + : defData(data) +{ + Init(); +} + + +void defiIOTiming::Init() { + inst_ = 0; + instLength_ = 0; + pin_ = 0; + pinLength_ = 0; + from_ = 0; + fromLength_ = 0; + to_ = 0; + toLength_ = 0; + driveCell_ = 0; + driveCellLength_ = 0; + hasVariableRise_ = 0; + hasVariableFall_ = 0; + hasSlewRise_ = 0; + hasSlewFall_ = 0; + hasCapacitance_ = 0; + hasDriveCell_ = 0; + hasFrom_ = 0; + if (pin_) free(pin_); + pin_ = 0; + pinLength_ = 0; + + hasTo_ = 0; + hasParallel_ = 0; + variableFallMin_ = 0.0; + variableRiseMin_ = 0.0; + variableFallMax_ = 0.0; + variableRiseMax_ = 0.0; + slewFallMin_ = 0.0; + slewRiseMin_ = 0.0; + slewFallMax_ = 0.0; + slewRiseMax_ = 0.0; + capacitance_ = 0.0; + parallel_ = 0.0; +} + + +defiIOTiming::~defiIOTiming() { + Destroy(); +} + + +void defiIOTiming::Destroy() { + + if (inst_) free(inst_); + inst_ = 0; + instLength_ = 0; + + if (pin_) free(pin_); + pin_ = 0; + pinLength_ = 0; + + if (from_) free(from_); + from_ = 0; + fromLength_ = 0; + + if (to_) free(to_); + to_ = 0; + toLength_ = 0; + + if (driveCell_) free(driveCell_); + driveCell_ = 0; + driveCellLength_ = 0; + + clear(); +} + + +void defiIOTiming::clear() { + hasVariableRise_ = 0; + hasVariableFall_ = 0; + hasSlewRise_ = 0; + hasSlewFall_ = 0; + hasCapacitance_ = 0; + hasDriveCell_ = 0; + hasFrom_ = 0; + hasTo_ = 0; + hasParallel_ = 0; + variableFallMin_ = 0.0; + variableRiseMin_ = 0.0; + variableFallMax_ = 0.0; + variableRiseMax_ = 0.0; + slewFallMin_ = 0.0; + slewRiseMin_ = 0.0; + slewFallMax_ = 0.0; + slewRiseMax_ = 0.0; + capacitance_ = 0.0; + parallel_ = 0.0; +} + + +void defiIOTiming::setName(const char* inst, const char* pin) { + int len; + + clear(); + + len = strlen(inst) + 1; + if (len > instLength_) { + if (inst_) free(inst_); + instLength_ = len; + inst_ = (char*)malloc(len); + } + strcpy(inst_, defData->DEFCASE(inst)); + + len = strlen(pin) + 1; + if (len > pinLength_) { + if (pin_) free(pin_); + pinLength_ = len; + pin_ = (char*)malloc(len); + } + strcpy(pin_, defData->DEFCASE(pin)); + +} + + +void defiIOTiming::print(FILE* f) const { + fprintf(f, "IOTiming '%s' '%s'\n", inst_, pin_); + + if (hasSlewRise()) + fprintf(f, " Slew rise %5.2f %5.2f\n", + slewRiseMin(), + slewRiseMax()); + + if (hasSlewFall()) + fprintf(f, " Slew fall %5.2f %5.2f\n", + slewFallMin(), + slewFallMax()); + + if (hasVariableRise()) + fprintf(f, " variable rise %5.2f %5.2f\n", + variableRiseMin(), + variableRiseMax()); + + if (hasVariableFall()) + fprintf(f, " variable fall %5.2f %5.2f\n", + variableFallMin(), + variableFallMax()); + + if (hasCapacitance()) + fprintf(f, " capacitance %5.2f\n", + capacitance()); + + if (hasDriveCell()) + fprintf(f, " drive cell '%s'\n", + driveCell()); + + if (hasFrom()) + fprintf(f, " from pin '%s'\n", + from()); + + if (hasTo()) + fprintf(f, " to pin '%s'\n", + to()); + + if (hasParallel()) + fprintf(f, " parallel %5.2f\n", + parallel()); +} + + + +void defiIOTiming::setVariable(const char* riseFall, double min, double max) { + if (*riseFall == 'R') { + hasVariableRise_ = 1; + variableRiseMin_ = min; + variableRiseMax_ = max; + + } else if (*riseFall == 'F') { + hasVariableFall_ = 1; + variableFallMin_ = min; + variableFallMax_ = max; + + } else { + defiError(0, 6060, "ERROR (DEFPARS-6060): Invalid value specified for IOTIMING rise/fall. The valid value for rise is 'R' and for fall is 'F'. Specify a valid value and then try again.", defData); + } +} + + +void defiIOTiming::setSlewRate(const char* riseFall, double min, double max) { + if (*riseFall == 'R') { + hasSlewRise_ = 1; + slewRiseMin_ = min; + slewRiseMax_ = max; + + } else if (*riseFall == 'F') { + hasSlewFall_ = 1; + slewFallMin_ = min; + slewFallMax_ = max; + + } else { + defiError(0, 6060, "ERROR (DEFPARS-6060): Invalid value specified for IOTIMING rise/fall. The valid value for rise is 'R' and for fall is 'F'. Specify a valid value and then try again.", defData); + } +} + + +void defiIOTiming::setCapacitance(double num) { + hasCapacitance_ = 1; + capacitance_ = num; +} + + +void defiIOTiming::setDriveCell(const char* name) { + int len = strlen(name) + 1; + + if (driveCellLength_ < len) { + if (driveCell_) free(driveCell_); + driveCell_ = (char*) malloc(len); + driveCellLength_ = len; + } + + strcpy(driveCell_, defData->DEFCASE(name)); + hasDriveCell_ = 1; +} + + +void defiIOTiming::setFrom(const char* name) { + int len = strlen(name) + 1; + + if (fromLength_ < len) { + if (from_) free(from_); + from_ = (char*) malloc(len); + fromLength_ = len; + } + + strcpy(from_, defData->DEFCASE(name)); + hasFrom_ = 1; +} + + +void defiIOTiming::setTo(const char* name) { + int len = strlen(name) + 1; + + if (toLength_ < len) { + if (to_) free(to_); + to_ = (char*) malloc(len); + toLength_ = len; + } + + strcpy(to_, defData->DEFCASE(name)); + hasTo_ = 1; +} + + +void defiIOTiming::setParallel(double num) { + hasParallel_ = 1; + parallel_ = num; +} + + +int defiIOTiming::hasVariableRise() const { + return hasVariableRise_; +} + + +int defiIOTiming::hasVariableFall() const { + return hasVariableFall_; +} + + +int defiIOTiming::hasSlewRise() const { + return hasSlewRise_; +} + + +int defiIOTiming::hasSlewFall() const { + return hasSlewFall_; +} + + +int defiIOTiming::hasCapacitance() const { + return hasCapacitance_; +} + + +int defiIOTiming::hasDriveCell() const { + return hasDriveCell_; +} + + +int defiIOTiming::hasFrom() const { + return hasFrom_; +} + + +int defiIOTiming::hasTo() const { + return hasTo_; +} + + +int defiIOTiming::hasParallel() const { + return hasParallel_; +} + + +const char* defiIOTiming::inst() const { + return inst_; +} + + +const char* defiIOTiming::pin() const { + return pin_; +} + + +double defiIOTiming::variableFallMin() const { + return variableFallMin_; +} + + +double defiIOTiming::variableRiseMin() const { + return variableRiseMin_; +} + + +double defiIOTiming::variableFallMax() const { + return variableFallMax_; +} + + +double defiIOTiming::variableRiseMax() const { + return variableRiseMax_; +} + + +double defiIOTiming::slewFallMin() const { + return slewFallMin_; +} + + +double defiIOTiming::slewRiseMin() const { + return slewRiseMin_; +} + + +double defiIOTiming::slewFallMax() const { + return slewFallMax_; +} + + +double defiIOTiming::slewRiseMax() const { + return slewRiseMax_; +} + + +double defiIOTiming::capacitance() const { + return capacitance_; +} + + +const char* defiIOTiming::driveCell() const { + return driveCell_; +} + + +const char* defiIOTiming::from() const { + return from_; +} + + +const char* defiIOTiming::to() const { + return to_; +} + + +double defiIOTiming::parallel() const { + return parallel_; +} + + +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defiIOTiming.hpp b/src/def/def/defiIOTiming.hpp new file mode 100644 index 00000000..81ac6e21 --- /dev/null +++ b/src/def/def/defiIOTiming.hpp @@ -0,0 +1,128 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiIOTiming_h +#define defiIOTiming_h + +#include +#include "defiKRDefs.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +class defrData; + +class defiIOTiming { +public: + defiIOTiming(defrData *data); + void Init(); + + void Destroy(); + ~defiIOTiming(); + + void clear(); + + void setName(const char* inst, const char* pin); + void setVariable(const char* riseFall, double min, double max); + void setSlewRate(const char* riseFall, double min, double max); + void setCapacitance(double num); + void setDriveCell(const char* name); + void setFrom(const char* name); + void setTo(const char* name); + void setParallel(double num); + + + int hasVariableRise() const; + int hasVariableFall() const; + int hasSlewRise() const; + int hasSlewFall() const; + int hasCapacitance() const; + int hasDriveCell() const; + int hasFrom() const; + int hasTo() const; + int hasParallel() const; + + const char* inst() const; + const char* pin() const; + double variableFallMin() const; + double variableRiseMin() const; + double variableFallMax() const; + double variableRiseMax() const; + double slewFallMin() const; + double slewRiseMin() const; + double slewFallMax() const; + double slewRiseMax() const; + double capacitance() const; + const char* driveCell() const; + const char* from() const; + const char* to() const; + double parallel() const; + + // debug print + void print(FILE* f) const; + +protected: + char* inst_; + int instLength_; + char* pin_; + int pinLength_; + char* from_; + int fromLength_; + char* to_; + int toLength_; + char* driveCell_; + char driveCellLength_; + char hasVariableRise_; + char hasVariableFall_; + char hasSlewRise_; + char hasSlewFall_; + char hasCapacitance_; + char hasDriveCell_; + char hasFrom_; + char hasTo_; + char hasParallel_; + double variableFallMin_; + double variableRiseMin_; + double variableFallMax_; + double variableRiseMax_; + double slewFallMin_; + double slewRiseMin_; + double slewFallMax_; + double slewRiseMax_; + double capacitance_; + double parallel_; + + defrData *defData; +}; + + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiKRDefs.hpp b/src/def/def/defiKRDefs.hpp new file mode 100644 index 00000000..237dca3b --- /dev/null +++ b/src/def/def/defiKRDefs.hpp @@ -0,0 +1,166 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiKRDEFS_h +#define defiKRDEFS_h + +#define BEGIN_LEFDEF_PARSER_NAMESPACE namespace LefDefParser { +#define END_LEFDEF_PARSER_NAMESPACE } +#define USE_LEFDEF_PARSER_NAMESPACE using namespace LefDefParser; + +// +// Below is to implement COPY_CONSTRUCTOR / ASSIGN_OPERATOR +// +// Author : mgwoo +// Date : 2017/01/31 +// Mail : mgwoo@unist.ac.kr +// + +#include +#include +#define DEF_COPY_CONSTRUCTOR_H(cname) cname(const cname & prev) +#define DEF_COPY_CONSTRUCTOR_C(cname) cname::cname(const cname & prev) + +#define DEF_ASSIGN_OPERATOR_H(cname) cname& operator=(const cname & prev) +#define DEF_ASSIGN_OPERATOR_C(cname) cname& cname::operator=(const cname & prev) +#define CHECK_SELF_ASSIGN \ +{ \ + if (this == &prev) { \ + return *this; \ + } \ +} + +#define DEF_COPY_FUNC(varname) {(varname) = prev.varname;} +#define DEF_MALLOC_FUNC(varname, vartype, length) \ +{ \ + if( prev.varname ) { \ + varname = (vartype*) malloc(length); \ + memcpy(varname, prev.varname, length); \ + } \ +} + +#define DEF_MALLOC_FUNC_WITH_OPERATOR(varname, vartype, length) \ +{ \ + if( prev.varname ) { \ + varname = (vartype*) malloc(length); \ + *(varname) = *(prev.varname); \ + } \ +} + + +// MALLOC/FREE version +#define DEF_MALLOC_FUNC_FOR_2D(varname, vartype, length1, length2 ) \ +{ \ + if(prev.varname) { \ + varname = (vartype**) malloc( sizeof(vartype*) * length1 ); \ + \ + for(int i=0; inumPoints = prev.varname[i]->numPoints; \ + varname[i]->x = (int*) malloc( sizeof(int) ); \ + *(varname[i]->x) = *(prev.varname[i]->x); \ + varname[i]->y = (int*) malloc( sizeof(int) ); \ + *(varname[i]->y) = *(prev.varname[i]->y); \ + } \ + else { \ + varname[i] = 0; \ + } \ + } \ + } \ + else { \ + varname = 0; \ + } \ +} + + +#define DEF_MALLOC_FUNC_FOR_2D_STR(varname, length ) \ +{ \ + if(prev.varname) { \ + varname = (char**) malloc( sizeof(char*) * length ); \ + \ + for(int i=0; i +#include +#include +#include "lex.h" +#include "defiDebug.hpp" +#include "defiMisc.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +//////////////////////////////////////////////////// +// +// defiPoints +// Below does not working in some examples... +// +//////////////////////////////////////////////////// + +defiPoints::defiPoints() +: numPoints(0), + x(0), + y(0) +{ +} + +DEF_COPY_CONSTRUCTOR_C( defiPoints ) +: numPoints(0), + x(0), + y(0) +{ + DEF_COPY_FUNC( numPoints ); + DEF_MALLOC_FUNC( x, int, sizeof(int) * numPoints ); + DEF_MALLOC_FUNC( y, int, sizeof(int) * numPoints ); +} + +DEF_ASSIGN_OPERATOR_C( defiPoints ) { + CHECK_SELF_ASSIGN + DEF_COPY_FUNC( numPoints ); + DEF_MALLOC_FUNC( x, int, sizeof(int) * numPoints ); + DEF_MALLOC_FUNC( y, int, sizeof(int) * numPoints ); + return *this; +} + + + + +//////////////////////////////////////////////////// +// +// Handle points for a polygon +// +//////////////////////////////////////////////////// +defiGeometries::defiGeometries(defrData *data) + : defData(data) +{ + pointsAllocated_ = 0; + numPoints_ = 0; +} + +void defiGeometries::Init() { + Destroy(); +} + +void defiGeometries::Destroy() { + if (pointsAllocated_) { + free((char*)(x_)); + free((char*)(y_)); + } + pointsAllocated_ = 0; + numPoints_ = 0; +} + +defiGeometries::~defiGeometries() { + Destroy(); +} + +void defiGeometries::Reset() { + numPoints_ = 0; +} + +void defiGeometries::startList(int x, int y) { + if (pointsAllocated_ == 0) { + pointsAllocated_ = 16; + x_ = (int*)malloc(sizeof(int)*16); + y_ = (int*)malloc(sizeof(int)*16); + numPoints_ = 0; + } else // reset the numPoints to 0 + numPoints_ = 0; + addToList(x, y); +} + +void defiGeometries::addToList(int x, int y) { + if (numPoints_ == pointsAllocated_) { + int i; + int* nx; + int* ny; + pointsAllocated_ *= 2; + nx = (int*)malloc(sizeof(int)*pointsAllocated_); + ny = (int*)malloc(sizeof(int)*pointsAllocated_); + for (i = 0; i < numPoints_; i++) { + nx[i] = x_[i]; + ny[i] = y_[i]; + } + free((char*)(x_)); + free((char*)(y_)); + x_ = nx; + y_ = ny; + } + x_[numPoints_] = x; + y_[numPoints_] = y; + numPoints_ += 1; +} + +int defiGeometries::numPoints() const { + return numPoints_; +} + +void defiGeometries::points(int index, int* x, int* y) const { + char msg[160]; + if ((index < 0) || (index >= numPoints_)) { + sprintf (msg, "ERROR (LEFPARS-6070): The index number %d given for GEOMETRY POINTS is invalid.\nValid index is from 0 to %d", index, numPoints_); + defiError(0, 6070, msg, defData); + return; + } + *x = x_[index]; + *y = y_[index]; + return; +} + +//////////////////////////////////////////////////// +// +// defiStyles +// +//////////////////////////////////////////////////// + +defiStyles::defiStyles() { + Init(); +} + +void defiStyles::Init() { + styleNum_ = 0; + polygon_ = 0; +} + +defiStyles::~defiStyles() { + Destroy(); +} + +void defiStyles::Destroy() { + clear(); +} + +void defiStyles::clear() { + struct defiPoints* p; + + p = polygon_; + if (p) { + free((char*)(p->x)); + free((char*)(p->y)); + free((char*)(polygon_)); + } + styleNum_ = 0; + polygon_ = 0; +} + +void defiStyles::setStyle(int styleNum) { + styleNum_ = styleNum; +} + +void defiStyles::setPolygon(defiGeometries* geom) { + struct defiPoints* p; + int i, x, y; + + if (polygon_ == 0) { + p = (struct defiPoints*)malloc(sizeof(struct defiPoints)); + p->numPoints = geom->numPoints(); + p->x = (int*)malloc(sizeof(int)*p->numPoints); + p->y = (int*)malloc(sizeof(int)*p->numPoints); + numPointAlloc_ = p->numPoints; // keep track the max number pts + } else if (numPointAlloc_ < geom->numPoints()) { + // the incoming polygon has more number then has been allocated, + // need to reallocate more memory + p = polygon_; + free((char*)(p->x)); + free((char*)(p->y)); + p->numPoints = geom->numPoints(); + p->x = (int*)malloc(sizeof(int)*p->numPoints); + p->y = (int*)malloc(sizeof(int)*p->numPoints); + numPointAlloc_ = p->numPoints; // keep track the max number pts + } else { + p = polygon_; + p->numPoints = geom->numPoints(); + } + for (i = 0; i < p->numPoints; i++) { + geom->points(i, &x, &y); + p->x[i] = x; + p->y[i] = y; + } + polygon_ = p; +} + +int defiStyles::style() const { + return styleNum_; +} + +struct defiPoints defiStyles::getPolygon() const { + return *(polygon_); +} +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defiMisc.hpp b/src/def/def/defiMisc.hpp new file mode 100644 index 00000000..e6486ba1 --- /dev/null +++ b/src/def/def/defiMisc.hpp @@ -0,0 +1,100 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiMisc_h +#define defiMisc_h + +#include +#include "defiKRDefs.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +class defrData; + +struct defiPoints { + int numPoints; + int* x; + int* y; + + defiPoints(); + DEF_COPY_CONSTRUCTOR_H( defiPoints ); + DEF_ASSIGN_OPERATOR_H( defiPoints ); +}; + +class defiGeometries { +public: + defiGeometries(defrData *data); + void Init(); + void Reset(); + + void Destroy(); + ~defiGeometries(); + + void startList(int x, int y); + void addToList(int x, int y); + + int numPoints() const; + void points(int index, int* x, int* y) const; + +protected: + int numPoints_; + int pointsAllocated_; + int* x_; + int* y_; + + defrData *defData; +}; + +class defiStyles { +public: + defiStyles(); + void Init(); + + void Destroy(); + ~defiStyles(); + + void clear(); + + void setStyle(int styleNum); + void setPolygon(defiGeometries* geom); + + int style() const; + struct defiPoints getPolygon() const; + + protected: + int styleNum_; + struct defiPoints* polygon_; + int numPointAlloc_; +}; + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiNet.cpp b/src/def/def/defiNet.cpp new file mode 100644 index 00000000..3a5509ab --- /dev/null +++ b/src/def/def/defiNet.cpp @@ -0,0 +1,3490 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013-2017, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: icftcm $ +// $Revision: #2 $ +// $Date: 2017/06/19 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include "defiNet.hpp" +#include "defiPath.hpp" +#include "defiDebug.hpp" +#include "lex.h" +#include "defiUtil.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +#define maxLimit 65536 + +//////////////////////////////////////////////////// +//////////////////////////////////////////////////// +// +// defiWire +// +//////////////////////////////////////////////////// +//////////////////////////////////////////////////// + + +defiWire::defiWire(defrData *data) + : defData(data) +{ + wireShieldName_ = 0; + type_ = 0; + numPaths_ = 0; + pathsAllocated_ = 0; + paths_ = 0; +} + + +void defiWire::Init(const char* type, const char* wireShieldName) { + int len = strlen(type) + 1; + type_ = (char*)malloc(len); + strcpy(type_, defData->DEFCASE(type)); + if (wireShieldName) { + wireShieldName_ = (char*)malloc(strlen(wireShieldName)+1); + strcpy(wireShieldName_, wireShieldName); + } else + wireShieldName_ = 0; + numPaths_ = 0; + pathsAllocated_ = 0; + paths_ = 0; +} + + +void defiWire::Destroy() { + clear(); +} + +defiWire::~defiWire() { + Destroy(); +} + +DEF_COPY_CONSTRUCTOR_C( defiWire ) { + type_ = 0; + wireShieldName_ = 0; + +// defData = NULL; + DEF_COPY_FUNC ( defData ); + DEF_MALLOC_FUNC( type_, char, sizeof(char) * (strlen(prev.type_) +1)); + DEF_MALLOC_FUNC( wireShieldName_, char, sizeof(char) * (strlen(prev.wireShieldName_) +1)); + DEF_COPY_FUNC( numPaths_ ); + DEF_COPY_FUNC( pathsAllocated_ ); + +// DEF_MALLOC_FUNC_FOR_2D( paths_, defiPath, numPaths_, 1 ); + if( prev.paths_ ) { + paths_ = new defiPath*[numPaths_]; + + for(int i=0; i= pathsAllocated_) { + // 6/17/2003 - don't want to allocate too large memory just in case + // a net has many wires with only 1 or 2 paths + + if (pathsAllocated_ <= maxLimit) { + incNumber = pathsAllocated_*2; + if (incNumber > maxLimit) { + incNumber = pathsAllocated_ + maxLimit; + } + } else { + incNumber = pathsAllocated_ + maxLimit; + } + + switch (netOsnet) { + case 2: + bumpPaths( + pathsAllocated_ ? incNumber : 1000); + break; + default: + bumpPaths( + pathsAllocated_ ? incNumber : 8); + break; + } + } + + paths_[numPaths_++] = new defiPath(p); + + if (numPaths_ == pathsAllocated_) + *needCbk = 1; // pre-warn the parser it needs to realloc next time +} + + +void defiWire::clear() { + int i; + + if (type_) { + free(type_); + type_ = 0; + } + + if (wireShieldName_) { + free(wireShieldName_); + wireShieldName_ = 0; + } + + if (paths_) { + for (i = 0; i < numPaths_; i++) { + delete paths_[i]; + } + + delete [] paths_; + paths_ = 0; + numPaths_ = 0; + pathsAllocated_ = 0; + } +} + + +void defiWire::bumpPaths(long long size) { + long long i; + defiPath** newPaths = new defiPath*[size]; + + for (i = 0; i < numPaths_; i++) + newPaths[i] = paths_[i]; + + pathsAllocated_ = size; + delete [] paths_; + paths_ = newPaths; +} + + +int defiWire::numPaths() const { + return numPaths_; +} + + +const char* defiWire::wireType() const { + return type_; +} + +const char* defiWire::wireShieldNetName() const { + return wireShieldName_; +} + +defiPath* defiWire::path(int index) { + if (index >= 0 && index < numPaths_) + return paths_[index]; + return 0; +} + + +const defiPath* defiWire::path(int index) const { + if (index >= 0 && index < numPaths_) + return paths_[index]; + return 0; +} + +//////////////////////////////////////////////////// +//////////////////////////////////////////////////// +// +// defiSubnet +// +//////////////////////////////////////////////////// +//////////////////////////////////////////////////// + + +defiSubnet::defiSubnet(defrData *data) + : defData(data) +{ + Init(); +} + + +void defiSubnet::Init() { + name_ = 0; + bumpName(16); + + instances_ = 0; + pins_ = 0; + musts_ = 0; + synthesized_ = 0; + numPins_ = 0; + bumpPins(16); + + // WMD -- this will be removed by the next release + paths_ = 0; + numPaths_ = 0; + pathsAllocated_ = 0; + + numWires_ = 0; + wiresAllocated_ = 0; + wires_ = 0; + nonDefaultRule_ = 0; + + clear(); +} + + +DEF_COPY_CONSTRUCTOR_C( defiSubnet ) { + defData = NULL; + this->Init(); + + DEF_COPY_FUNC( nameSize_ ); + DEF_MALLOC_FUNC( name_, char, sizeof(char) * (strlen(prev.name_) +1)); + DEF_COPY_FUNC( pinsAllocated_ ); + DEF_COPY_FUNC( numPins_ ); + + DEF_MALLOC_FUNC_FOR_2D_STR( instances_, numPins_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( pins_, numPins_ ); + + DEF_MALLOC_FUNC( synthesized_, char, sizeof(char) * numPins_ ); + DEF_MALLOC_FUNC( musts_, char, sizeof(char) * numPins_ ); + DEF_COPY_FUNC( isFixed_ ); + DEF_COPY_FUNC( isRouted_ ); + DEF_COPY_FUNC( isCover_ ); + DEF_COPY_FUNC( numPaths_ ); + DEF_COPY_FUNC( pathsAllocated_ ); + DEF_MALLOC_FUNC_FOR_2D( paths_, defiPath, numPaths_, 1 ); + + DEF_COPY_FUNC( numWires_ ); + DEF_COPY_FUNC( wiresAllocated_ ); + DEF_MALLOC_FUNC_FOR_2D( wires_, defiWire, numWires_, 1 ); + DEF_MALLOC_FUNC( nonDefaultRule_, char, sizeof(char) * (strlen(prev.nonDefaultRule_) +1)); + +} + + +DEF_ASSIGN_OPERATOR_C( defiSubnet ) { + CHECK_SELF_ASSIGN + defData = NULL; + this->Init(); + + DEF_COPY_FUNC( nameSize_ ); + DEF_MALLOC_FUNC( name_, char, sizeof(char) * (strlen(prev.name_) +1)); + DEF_COPY_FUNC( pinsAllocated_ ); + DEF_COPY_FUNC( numPins_ ); + + DEF_MALLOC_FUNC_FOR_2D_STR( instances_, numPins_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( pins_, numPins_ ); + + DEF_MALLOC_FUNC( synthesized_, char, sizeof(char) * (strlen(prev.synthesized_) +1)); + DEF_MALLOC_FUNC( musts_, char, sizeof(char) * (strlen(prev.musts_) +1)); + DEF_COPY_FUNC( isFixed_ ); + DEF_COPY_FUNC( isRouted_ ); + DEF_COPY_FUNC( isCover_ ); + DEF_COPY_FUNC( numPaths_ ); + DEF_COPY_FUNC( pathsAllocated_ ); + DEF_MALLOC_FUNC_FOR_2D( paths_, defiPath, numPaths_, 1 ); + + DEF_COPY_FUNC( numWires_ ); + DEF_COPY_FUNC( wiresAllocated_ ); + DEF_MALLOC_FUNC_FOR_2D( wires_, defiWire, numWires_, 1 ); + DEF_MALLOC_FUNC( nonDefaultRule_, char, sizeof(char) * (strlen(prev.nonDefaultRule_) +1)); + return *this; +} + +void defiSubnet::Destroy() { + clear(); + free(name_); + free((char*)(instances_)); + free((char*)(pins_)); + free(musts_); + free(synthesized_); + +} + + +defiSubnet::~defiSubnet() { + Destroy(); +} + + +void defiSubnet::setName(const char* name) { + int len = strlen(name) + 1; + if (len > nameSize_) bumpName(len); + strcpy(name_, defData->DEFCASE(name)); +} + + +void defiSubnet::setNonDefault(const char* name) { + int len = strlen(name) + 1; + nonDefaultRule_ = (char*)malloc(len); + strcpy(nonDefaultRule_, defData->DEFCASE(name)); +} + + +void defiSubnet::addMustPin(const char* instance, const char* pin, int syn) { + addPin(instance, pin, syn); + musts_[numPins_ - 1] = 1; +} + + +void defiSubnet::addPin(const char* instance, const char* pin, int syn) { + int len; + + if (numPins_ == pinsAllocated_) + bumpPins(pinsAllocated_ * 2); + + len = strlen(instance)+ 1; + instances_[numPins_] = (char*)malloc(len); + strcpy(instances_[numPins_], defData->DEFCASE(instance)); + + len = strlen(pin)+ 1; + pins_[numPins_] = (char*)malloc(len); + strcpy(pins_[numPins_], defData->DEFCASE(pin)); + + musts_[numPins_] = 0; +// fflush(stdout); +// printf("numPin : %d, innerSynCont : %d\n", numPins_, syn); + synthesized_[numPins_] = syn; + + (numPins_)++; +} + +// WMD -- this will be removed by the next release +void defiSubnet::setType(const char* typ) { + if (*typ == 'F') { + isFixed_ = 1; + } else if (*typ == 'C') { + isCover_ = 1; + } else if (*typ == 'R') { + isRouted_ = 1; + } else { + // Silently do nothing with bad input. + } + +} + +// WMD -- this will be removed by the next release +void defiSubnet::addPath(defiPath* p, int reset, int netOsnet, int *needCbk) { + int i; + size_t incNumber; + + if (reset) { + for (i = 0; i < numPaths_; i++) { + delete paths_[i]; + } + numPaths_ = 0; + } + + if (numPaths_ >= pathsAllocated_) { + // 6/17/2003 - don't want to allocate too large memory just in case + // a net has many wires with only 1 or 2 paths + if (pathsAllocated_ <= maxLimit) { + incNumber = pathsAllocated_*2; + if (incNumber > maxLimit) { + incNumber = pathsAllocated_ + maxLimit; + } + } else { + incNumber = pathsAllocated_ + maxLimit; + } + + switch (netOsnet) { + case 2: + bumpPaths( + pathsAllocated_ ? incNumber : 1000); + break; + default: + bumpPaths( + pathsAllocated_ ? incNumber : 8); + break; + } + } + + paths_[numPaths_++] = new defiPath(p); + + if (numPaths_ == pathsAllocated_) + *needCbk = 1; // pre-warn the parser it needs to realloc next time +} + + +void defiSubnet::addWire(const char* type) { + defiWire* wire; + if (numWires_ == wiresAllocated_) { + defiWire** array; + int i; + wiresAllocated_ = wiresAllocated_ ? + wiresAllocated_ * 2 : 2 ; + array = (defiWire**)malloc(sizeof(defiWire*)*wiresAllocated_); + for (i = 0; i < numWires_; i++) { + array[i] = wires_[i]; + } + if (wires_) + free((char*)(wires_)); + wires_ = array; + } + wire = wires_[numWires_] = new defiWire(defData); +// wire = wires_[numWires_] = (defiWire*)malloc(sizeof(defiWire)); +// wire->defData = defData; + numWires_ += 1; + wire->Init(type, NULL); +} + + +void defiSubnet::addWirePath(defiPath* p, int reset, int netOsnet, int *needCbk) { + if (numWires_ > 0) + wires_[numWires_-1]->addPath(p, reset, netOsnet, + needCbk); + else + // Something screw up, can't be both be zero. + defiError(0, 6080, "ERROR (DEFPARS-6080): An internal error has occurred. The index number for the SUBNET wires array is less then or equal to 0.\nContact Cadence Customer Support with this error information.", defData); +} + +const char* defiSubnet::name() const { + return name_; +} + + +int defiSubnet::hasNonDefaultRule() const { + return nonDefaultRule_ ? 1 : 0; +} + + +const char* defiSubnet::nonDefaultRule() const { + return nonDefaultRule_; +} + + +int defiSubnet::numConnections() const { + return numPins_; +} + + +const char* defiSubnet::instance(int index) const { + if (index >= 0 && index < numPins_) + return instances_[index]; + return 0; +} + + +const char* defiSubnet::pin(int index) const { + if (index >= 0 && index < numPins_) + return pins_[index]; + return 0; +} + + +int defiSubnet::pinIsMustJoin(int index) const { + if (index >= 0 && index < numPins_) + return (int)(musts_[index]); + return 0; +} + + +int defiSubnet::pinIsSynthesized(int index) const { + if (index >= 0 && index < numPins_) + return (int)(synthesized_[index]); + return 0; +} + +// WMD -- this will be removed by the next release +int defiSubnet::isFixed() const { + return (int)(isFixed_); +} + + +// WMD -- this will be removed by the next release +int defiSubnet::isRouted() const { + return (int)(isRouted_); +} + + +// WMD -- this will be removed by the next release +int defiSubnet::isCover() const { + return (int)(isCover_); +} + + +void defiSubnet::bumpName(long long size) { + if (name_) free(name_); + name_ = (char*)malloc(size); + nameSize_ = size; + name_[0] = '\0'; +} + + +void defiSubnet::bumpPins(long long size) { + char** newInstances = (char**)malloc(sizeof(char*)*size); + char** newPins = (char**)malloc(sizeof(char*)*size); + char* newMusts = (char*)malloc(size); + char* newSyn = (char*)malloc(size); + long long i; + + if (instances_) { + for (i = 0; i < pinsAllocated_; i++) { + newInstances[i] = instances_[i]; + newPins[i] = pins_[i]; + newMusts[i] = musts_[i]; + newSyn[i] = synthesized_[i]; + } + free((char*)(instances_)); + free((char*)(pins_)); + free(musts_); + free(synthesized_); + } + + instances_ = newInstances; + pins_ = newPins; + musts_ = newMusts; + synthesized_ = newSyn; + pinsAllocated_ = size; +} + + +void defiSubnet::clear() { + int i; + + // WMD -- this will be removed by the next release + isFixed_ = 0; + isRouted_ = 0; + isCover_ = 0; + name_[0] = '\0'; + + for (i = 0; i < numPins_; i++) { + free(instances_[i]); + free(pins_[i]); + instances_[i] = 0; + pins_[i] = 0; + musts_[i] = 0; + synthesized_[i] = 0; + } + numPins_ = 0; + + // WMD -- this will be removed by the next release + if (paths_) { + for (i = 0; i < numPaths_; i++) { + delete paths_[i]; + } + delete [] paths_; + paths_ = 0; + numPaths_ = 0; + pathsAllocated_ = 0; + } + + if (nonDefaultRule_) { + free(nonDefaultRule_); + nonDefaultRule_ = 0; + } + + if (numWires_) { + for (i = 0; i < numWires_; i++) { + delete wires_[i]; + wires_[i] = 0; + } + free((char*)(wires_)); + wires_ = 0; + numWires_ = 0; + wiresAllocated_ = 0; + } +} + + +void defiSubnet::print(FILE* f) const { + int i, j; + const defiPath* p; + const defiWire* w; + + fprintf(f, " subnet '%s'", name_); + fprintf(f, "\n"); + + if (hasNonDefaultRule()) + fprintf(f, " nondefault rule %s\n", + nonDefaultRule()); + + if (numConnections()) { + fprintf(f, " Pins:\n"); + for (i = 0; i < numConnections(); i++) { + fprintf(f, " '%s' '%s'%s%s\n", + instance(i), + pin(i), + pinIsMustJoin(i) ? " MUSTJOIN" : "", + pinIsSynthesized(i) ? " SYNTHESIZED" : ""); + } + } + + if (numWires()) { + fprintf(f, " Paths:\n"); + for (i = 0; i < numWires(); i++) { + w = wire(i); + for (j = 0; j < w->numPaths(); j++) { + p = w->path(j); + p->print(f); + } + } + } +} + +int defiSubnet::numWires() const { + return numWires_; +} + + +defiWire* defiSubnet::wire(int index) { + if (index >= 0 && index < numWires_) + return wires_[index]; + return 0; +} + + +const defiWire* defiSubnet::wire(int index) const { + if (index >= 0 && index < numWires_) + return wires_[index]; + return 0; +} + + +// WMD -- this will be removed after the next release +defiPath* defiSubnet::path(int index) { + if (index >= 0 && index < numPaths_) + return paths_[index]; + return 0; +} + +// WMD -- this will be removed after the next release +const defiPath* defiSubnet::path(int index) const { + if (index >= 0 && index < numPaths_) + return paths_[index]; + return 0; +} + +// WMD -- this will be removed after the next release +int defiSubnet::numPaths() const { + return numPaths_; +} + +// WMD -- this will be removed after the next release +void defiSubnet::bumpPaths(long long size) { + long long i; + defiPath** newPaths = new defiPath*[size]; + + for (i = 0; i < numPaths_; i++) + newPaths[i] = paths_[i]; + + pathsAllocated_ = size; + + delete [] paths_; + paths_ = newPaths; +} + + +//////////////////////////////////////////////////// +//////////////////////////////////////////////////// +// +// defiVpin +// +//////////////////////////////////////////////////// +//////////////////////////////////////////////////// + + +defiVpin::defiVpin(defrData *data) + : defData(data) +{ +} + + +void defiVpin::Init(const char* name) { + int len = strlen(name) + 1; + name_ = (char*)malloc(len); + strcpy(name_, defData->DEFCASE(name)); + orient_ = -1; + status_ = ' '; + layer_ = 0; +} + + +defiVpin::~defiVpin() { + Destroy(); +} + +DEF_COPY_CONSTRUCTOR_C( defiVpin ) { + defData = NULL; + + DEF_COPY_FUNC( xl_ ); + DEF_COPY_FUNC( yl_ ); + DEF_COPY_FUNC( xh_ ); + DEF_COPY_FUNC( yh_ ); + DEF_COPY_FUNC( orient_ ); + DEF_COPY_FUNC( status_ ); + DEF_COPY_FUNC( xLoc_ ); + DEF_COPY_FUNC( yLoc_ ); + DEF_MALLOC_FUNC( name_, char, sizeof(char) * (strlen(prev.name_) +1)); + DEF_MALLOC_FUNC( layer_, char, sizeof(char) * (strlen(prev.layer_) +1)); +} + +DEF_ASSIGN_OPERATOR_C( defiVpin ) { + CHECK_SELF_ASSIGN + defData = NULL; + + DEF_COPY_FUNC( xl_ ); + DEF_COPY_FUNC( yl_ ); + DEF_COPY_FUNC( xh_ ); + DEF_COPY_FUNC( yh_ ); + DEF_COPY_FUNC( orient_ ); + DEF_COPY_FUNC( status_ ); + DEF_COPY_FUNC( xLoc_ ); + DEF_COPY_FUNC( yLoc_ ); + DEF_MALLOC_FUNC( name_, char, sizeof(char) * (strlen(prev.name_) +1)); + DEF_MALLOC_FUNC( layer_, char, sizeof(char) * (strlen(prev.layer_) +1)); + return *this; +} + +void defiVpin::Destroy() { + free(name_); + if (layer_) free(layer_); +} + + +void defiVpin::setBounds(int xl, int yl, int xh, int yh) { + xl_ = xl; + yl_ = yl; + xh_ = xh; + yh_ = yh; +} + + +void defiVpin::setLayer(const char* lay) { + int len = strlen(lay)+1; + layer_ = (char*)malloc(len); + strcpy(layer_, lay); +} + + +void defiVpin::setOrient(int orient) { + orient_ = orient; +} + + +void defiVpin::setLoc(int x, int y) { + xLoc_ = x; + yLoc_ = y; +} + + +void defiVpin::setStatus(char st) { + status_ = st; +} + + +int defiVpin::xl() const { + return xl_; +} + + +int defiVpin::yl() const { + return yl_; +} + + +int defiVpin::xh() const { + return xh_; +} + + +int defiVpin::yh() const { + return yh_; +} + + +char defiVpin::status() const { + return status_; +} + + +int defiVpin::orient() const { + return orient_; +} + + +const char* defiVpin::orientStr() const { + return (defiOrientStr(orient_)); +} + + +int defiVpin::xLoc() const { + return xLoc_; +} + + +int defiVpin::yLoc() const { + return yLoc_; +} + + +const char* defiVpin::name() const { + return name_; +} + + +const char* defiVpin::layer() const { + return layer_; +} + + + +//////////////////////////////////////////////////// +//////////////////////////////////////////////////// +// +// defiShield +// +//////////////////////////////////////////////////// +//////////////////////////////////////////////////// + + +defiShield::defiShield(defrData *data) + : defData(data) +{ +} + + +void defiShield::Init(const char* name) { + int len = strlen(name) + 1; + name_ = (char*)malloc(len); + strcpy(name_, defData->DEFCASE(name)); + numPaths_ = 0; + pathsAllocated_ = 0; + paths_ = NULL; +} + +DEF_COPY_CONSTRUCTOR_C( defiShield ) { + defData = NULL; + + DEF_MALLOC_FUNC( name_, char, sizeof(char) * (strlen(prev.name_) +1)); + DEF_COPY_FUNC( numPaths_ ); + DEF_COPY_FUNC( pathsAllocated_ ); + DEF_MALLOC_FUNC_FOR_2D( paths_, defiPath, numPaths_, 1 ); + +} + +DEF_ASSIGN_OPERATOR_C( defiShield ) { + CHECK_SELF_ASSIGN + defData = NULL; + + DEF_MALLOC_FUNC( name_, char, sizeof(char) * (strlen(prev.name_) +1)); + DEF_COPY_FUNC( numPaths_ ); + DEF_COPY_FUNC( pathsAllocated_ ); + DEF_MALLOC_FUNC_FOR_2D( paths_, defiPath, numPaths_, 1 ); + return *this; +} + +void defiShield::Destroy() { + clear(); +} + + +defiShield::~defiShield() { + Destroy(); +} + + +void defiShield::addPath(defiPath* p, int reset, int netOsnet, int *needCbk) { + int i; + size_t incNumber; + + if (reset) { + for (i = 0; i < numPaths_; i++) { + delete paths_[i]; + } + numPaths_ = 0; + } + if (numPaths_ >= pathsAllocated_) { + // 6/17/2003 - don't want to allocate too large memory just in case + // a net has many wires with only 1 or 2 paths + + if (pathsAllocated_ <= maxLimit) { + incNumber = pathsAllocated_*2; + if (incNumber > maxLimit) { + incNumber = pathsAllocated_ + maxLimit; + } + } else { + incNumber = pathsAllocated_ + maxLimit; + } + + switch (netOsnet) { + case 2: + bumpPaths( + pathsAllocated_ ? incNumber : 1000); + break; + default: + bumpPaths( + pathsAllocated_ ? incNumber : 8); + break; + } + } + paths_[numPaths_++] = new defiPath(p); + if (numPaths_ == pathsAllocated_) + *needCbk = 1; // pre-warn the parser it needs to realloc next time +} + + +void defiShield::clear() { + int i; + + if (name_) { + free(name_); + name_ = 0; + } + + if (paths_) { + for (i = 0; i < numPaths_; i++) { + delete paths_[i]; + } + + delete [] paths_; + + paths_ = 0; + numPaths_ = 0; + pathsAllocated_ = 0; + } +} + + +void defiShield::bumpPaths(long long size) { + long long i; + + defiPath** newPaths = new defiPath*[size]; + + for (i = 0; i < numPaths_; i++) + newPaths[i] = paths_[i]; + + pathsAllocated_ = size; + + delete [] paths_; + + paths_ = newPaths; +} + + +int defiShield::numPaths() const { + return numPaths_; +} + + +const char* defiShield::shieldName() const { + return name_; +} + +defiPath* defiShield::path(int index) { + if (index >= 0 && index < numPaths_) + return paths_[index]; + return 0; +} + +const defiPath* defiShield::path(int index) const { + if (index >= 0 && index < numPaths_) + return paths_[index]; + return 0; +} + + + + +//////////////////////////////////////////////////// +//////////////////////////////////////////////////// +// +// defiNet +// +//////////////////////////////////////////////////// +//////////////////////////////////////////////////// + + +defiNet::defiNet(defrData *data) + : defData(data) +{ + Init(); +} + + +void defiNet::Init() { + name_ = 0; + instances_ = 0; + numPins_ = 0; + numProps_ = 0; + propNames_ = 0; + subnets_ = 0; + source_ = 0; + pattern_ = 0; + style_ = 0; + shieldNet_ = 0; + original_ = 0; + use_ = 0; + nonDefaultRule_ = 0; + numWires_ = 0; + wiresAllocated_ = 0; + wires_= 0; + + numWidths_ = 0; + widthsAllocated_ = 0; + wlayers_ = 0; + wdist_ = 0; + + numSpacing_ = 0; + spacingAllocated_ = 0; + slayers_ = 0; + sdist_ = 0; + sleft_ = 0; + sright_ = 0; + + vpins_ = 0; + numVpins_ = 0; + vpinsAllocated_ = 0; + + shields_ = 0; + numShields_ = 0; + numNoShields_ = 0; + shieldsAllocated_ = 0; + numShieldNet_ = 0; + shieldNetsAllocated_ = 0; + + bumpProps(2); + bumpName(16); + bumpPins(16); + bumpSubnets(2); + + rectNames_ = 0; + rectRouteStatus_ = 0; + rectRouteStatusShieldNames_=0; + rectShapeTypes_ = 0; + rectMasks_ = 0; + polygonNames_ = 0; + polyRouteStatus_ = 0; + polyShapeTypes_ = 0; + polyRouteStatusShieldNames_ = 0; + numPolys_ = 0; + polysAllocated_ = 0; + polygons_ = 0; + polyMasks_ = 0; + + numSubnets_ = 0; + paths_ = 0; + numPaths_ = 0; + + numPts_ = 0; + viaNames_ = 0; + viaPts_ = 0; + ptsAllocated_=0; + viaMasks_ = 0; + viaOrients_ = 0; + viaRouteStatus_ = 0; + viaShapeTypes_ = 0; + viaRouteStatusShieldNames_ = 0; + +// propTypes_ = 0; + +// synthesized_ = 0; +// musts_ = 0; + +// pins_ = 0; + clear(); +} + +DEF_COPY_CONSTRUCTOR_C( defiNet ){ + DEF_COPY_FUNC(defData) ; + this->Init(); + + DEF_MALLOC_FUNC( name_, char, sizeof(char) * (strlen(prev.name_) +1)); + DEF_COPY_FUNC( nameSize_ ); + + DEF_COPY_FUNC( numPins_ ); + DEF_COPY_FUNC( pinsAllocated_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( instances_, numPins_); + DEF_MALLOC_FUNC_FOR_2D_STR( pins_, numPins_); + + DEF_MALLOC_FUNC( musts_, char, sizeof(char) * numPins_); + DEF_MALLOC_FUNC( synthesized_, char, sizeof(char) * numPins_); + DEF_COPY_FUNC( weight_ ); + DEF_COPY_FUNC( hasWeight_ ); + DEF_COPY_FUNC( isFixed_ ); + DEF_COPY_FUNC( isRouted_ ); + DEF_COPY_FUNC( isCover_ ); + DEF_COPY_FUNC( hasCap_ ); + DEF_COPY_FUNC( hasFrequency_ ); + DEF_COPY_FUNC( hasVoltage_ ); + DEF_COPY_FUNC( numProps_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( propNames_, numProps_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( propValues_, numProps_ ); + + DEF_MALLOC_FUNC( propDValues_, double, sizeof(double) * numProps_); + DEF_MALLOC_FUNC( propTypes_, char, sizeof(char) * numProps_ ); + DEF_COPY_FUNC( propsAllocated_ ); + DEF_COPY_FUNC( numSubnets_ ); + DEF_MALLOC_FUNC_FOR_2D( subnets_, defiSubnet, numSubnets_, 1); + + DEF_COPY_FUNC( subnetsAllocated_ ); + DEF_COPY_FUNC( cap_ ); + DEF_MALLOC_FUNC( source_, char, sizeof(char) * (strlen(prev.source_) +1)); + DEF_COPY_FUNC( fixedbump_ ); + DEF_COPY_FUNC( frequency_ ); + DEF_MALLOC_FUNC( pattern_, char, sizeof(char) * (strlen(prev.pattern_) +1)); + DEF_MALLOC_FUNC( original_, char, sizeof(char) * (strlen(prev.original_) +1)); + DEF_MALLOC_FUNC( use_, char, sizeof(char) * (strlen(prev.use_) +1)); + DEF_MALLOC_FUNC( nonDefaultRule_, char, sizeof(char) * (strlen(prev.nonDefaultRule_) +1)); + DEF_COPY_FUNC( style_ ); + + DEF_COPY_FUNC( numPaths_ ); + DEF_COPY_FUNC( pathsAllocated_ ); + DEF_MALLOC_FUNC_FOR_2D( paths_, defiPath, numPaths_, 1); + + DEF_COPY_FUNC( voltage_ ); + DEF_COPY_FUNC( numWires_ ); + DEF_COPY_FUNC( wiresAllocated_ ); +// DEF_MALLOC_FUNC_FOR_2D( wires_, defiWire, numWires_, 1 ); + + // wire_ : outer array : malloc/free + // inner array : new/delete + if( prev.wires_) { + wires_ = (defiWire**) malloc( sizeof(defiWire*)*numWires_ ); + + for(int i=0; iInit(); + + DEF_MALLOC_FUNC( name_, char, sizeof(char) * (strlen(prev.name_) +1)); + DEF_COPY_FUNC( nameSize_ ); + + DEF_COPY_FUNC( numPins_ ); + DEF_COPY_FUNC( pinsAllocated_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( instances_, numPins_); + DEF_MALLOC_FUNC_FOR_2D_STR( pins_, numPins_); + + DEF_MALLOC_FUNC( musts_, char, sizeof(char) * numPins_); + DEF_MALLOC_FUNC( synthesized_, char, sizeof(char) * numPins_); + DEF_COPY_FUNC( weight_ ); + DEF_COPY_FUNC( hasWeight_ ); + DEF_COPY_FUNC( isFixed_ ); + DEF_COPY_FUNC( isRouted_ ); + DEF_COPY_FUNC( isCover_ ); + DEF_COPY_FUNC( hasCap_ ); + DEF_COPY_FUNC( hasFrequency_ ); + DEF_COPY_FUNC( hasVoltage_ ); + DEF_COPY_FUNC( numProps_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( propNames_, numProps_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( propValues_, numProps_ ); + + DEF_MALLOC_FUNC( propDValues_, double, sizeof(double) * numProps_); + DEF_MALLOC_FUNC( propTypes_, char, sizeof(char) * numProps_ ); + DEF_COPY_FUNC( propsAllocated_ ); + DEF_COPY_FUNC( numSubnets_ ); + DEF_MALLOC_FUNC_FOR_2D( subnets_, defiSubnet, numSubnets_, 1); + + DEF_COPY_FUNC( subnetsAllocated_ ); + DEF_COPY_FUNC( cap_ ); + DEF_MALLOC_FUNC( source_, char, sizeof(char) * (strlen(prev.source_) +1)); + DEF_COPY_FUNC( fixedbump_ ); + DEF_COPY_FUNC( frequency_ ); + DEF_MALLOC_FUNC( pattern_, char, sizeof(char) * (strlen(prev.pattern_) +1)); + DEF_MALLOC_FUNC( original_, char, sizeof(char) * (strlen(prev.original_) +1)); + DEF_MALLOC_FUNC( use_, char, sizeof(char) * (strlen(prev.use_) +1)); + DEF_MALLOC_FUNC( nonDefaultRule_, char, sizeof(char) * (strlen(prev.nonDefaultRule_) +1)); + DEF_COPY_FUNC( style_ ); + + DEF_COPY_FUNC( numPaths_ ); + DEF_COPY_FUNC( pathsAllocated_ ); + DEF_MALLOC_FUNC_FOR_2D( paths_, defiPath, numPaths_, 1); + + DEF_COPY_FUNC( voltage_ ); + DEF_COPY_FUNC( numWires_ ); + DEF_COPY_FUNC( wiresAllocated_ ); +// DEF_MALLOC_FUNC_FOR_2D( wires_, defiWire, numWires_, 1 ); + + // wire_ : outer array : malloc/free + // inner array : new/delete + if( prev.wires_) { + wires_ = (defiWire**) malloc( sizeof(defiWire*)*numWires_ ); + + for(int i=0; i nameSize_) bumpName(len); + strcpy(name_, defData->DEFCASE(name)); +} + + +void defiNet::addMustPin(const char* instance, const char* pin, int syn) { + clear(); + addPin(instance, pin, syn); + musts_[numPins_ - 1] = 1; +} + + +void defiNet::addPin(const char* instance, const char* pin, int syn) { + int len; + + if (numPins_ == pinsAllocated_) + bumpPins(pinsAllocated_ * 2); + + len = strlen(instance)+ 1; + instances_[numPins_] = (char*)malloc(len); + strcpy(instances_[numPins_], defData->DEFCASE(instance)); + + len = strlen(pin)+ 1; +// printf("len: %d\n", len); +// printf("numPins_: %d\n", numPins_); +// printf("pins_ address: %x\n", pins_); +// fflush(stdout); + pins_[numPins_] = (char*)malloc(len); + strcpy(pins_[numPins_], defData->DEFCASE(pin)); + + musts_[numPins_] = 0; + synthesized_[numPins_] = syn; + + (numPins_)++; +} + + +void defiNet::setWeight(int w) { + hasWeight_ = 1; + weight_ = w; +} + + +void defiNet::addProp(const char* name, const char* value, const char type) { + int len; + + if (numProps_ == propsAllocated_) + bumpProps(propsAllocated_ * 2); + + len = strlen(name)+ 1; + propNames_[numProps_] = (char*)malloc(len); + strcpy(propNames_[numProps_], defData->DEFCASE(name)); + + len = strlen(value)+ 1; + propValues_[numProps_] = (char*)malloc(len); + strcpy(propValues_[numProps_], defData->DEFCASE(value)); + + propDValues_[numProps_] = 0; + propTypes_[numProps_] = type; + + (numProps_)++; +} + + +void defiNet::addNumProp(const char* name, const double d, + const char* value, const char type) { + int len; + + if (numProps_ == propsAllocated_) + bumpProps(propsAllocated_ * 2); + + len = strlen(name)+ 1; + propNames_[numProps_] = (char*)malloc(len); + strcpy(propNames_[numProps_], defData->DEFCASE(name)); + + len = strlen(value)+ 1; + propValues_[numProps_] = (char*)malloc(len); + strcpy(propValues_[numProps_], defData->DEFCASE(value)); + + propDValues_[numProps_] = d; + propTypes_[numProps_] = type; + + (numProps_)++; +} + + +void defiNet::addSubnet(defiSubnet* subnet) { + + if (numSubnets_ >= subnetsAllocated_) + bumpSubnets(subnetsAllocated_ * 2); + + subnets_[numSubnets_++] = subnet; +} + +// WMD -- will be removed after the next release +void defiNet::setType(const char* typ) { + if (*typ == 'F') { + isFixed_ = 1; + } else if (*typ == 'C') { + isCover_ = 1; + } else if (*typ == 'R') { + isRouted_ = 1; + } else { + // Silently do nothing with bad input. + } +} + +void defiNet::addWire(const char* type, const char* wireShieldName) { + defiWire* wire; + if (numWires_ == wiresAllocated_) { + defiWire** array; + int i; + wiresAllocated_ = wiresAllocated_ ? + wiresAllocated_ * 2 : 2 ; + array = (defiWire**)malloc(sizeof(defiWire*)*wiresAllocated_); + for (i = 0; i < numWires_; i++) + array[i] = wires_[i]; + if (wires_) free((char*)(wires_)); + wires_ = array; + } + wire = wires_[numWires_] = new defiWire(defData); + numWires_ += 1; + wire->Init(type, wireShieldName); +} + + +void defiNet::addWirePath(defiPath* p, int reset, int netOsnet, int *needCbk) { + if (numWires_ > 0) + wires_[numWires_-1]->addPath(p, reset, netOsnet, + needCbk); + else + // Something screw up, can't be both be zero. + defiError(0, 6081, "ERROR (DEFPARS-6081): An internal error has occurred. The index number for the NET PATH wires array is less then or equal to 0.\nContact Cadence Customer Support with this error information.", defData); +} + + +void defiNet::addShield(const char* name) { + defiShield* shield; + if (numShields_ == shieldsAllocated_) { + defiShield** array; + int i; + shieldsAllocated_ = shieldsAllocated_ ? + shieldsAllocated_ * 2 : 2 ; + array = (defiShield**)malloc(sizeof(defiShield*)*shieldsAllocated_); + for (i = 0; i < numShields_; i++) + array[i] = shields_[i]; + if (shields_) free((char*)(shields_)); + shields_ = array; + } + shield = shields_[numShields_] = new defiShield(defData); + numShields_ += 1; + shield->Init(name); +} + + +void defiNet::addShieldPath(defiPath* p, int reset, int netOsnet, int *needCbk) { + // Since shield and noshield share the list shields_, the + // only way to tell whether the list is currently contained + // data for shields_ or noshields_ is from the variables + // numShields_ and numNoShields_. + // Since shield and noshield are mutual exclusive, only one + // numShields_ or numNoShields will be non-zero + // in this method. Whichever is non-zero will be the current + // working list + if (numShields_ > 0) + shields_[numShields_-1]->addPath(p, reset, + netOsnet, needCbk); + else if (numNoShields_ > 0) + shields_[numNoShields_-1]->addPath(p, reset, + netOsnet, needCbk); + else + // Something screw up, can't be both be zero. + defiError(0, 6082, "ERROR (DEFPARS-6082): An internal error has occurred. The index number for the NET SHIELDPATH wires array is less then or equal to 0.\nContact Cadence Customer Support with this error information.", defData); +} + + +void defiNet::addNoShield(const char* name) { + defiShield* shield; + if (numNoShields_ == shieldsAllocated_) { + defiShield** array; + int i; + shieldsAllocated_ = shieldsAllocated_ ? + shieldsAllocated_ * 2 : 2 ; + array = (defiShield**)malloc(sizeof(defiShield*)*shieldsAllocated_); + for (i = 0; i < numNoShields_; i++) + array[i] = shields_[i]; + if (shields_) free((char*)(shields_)); + shields_ = array; + } + shield = shields_[numNoShields_] = new defiShield(defData); + numNoShields_ += 1; + shield->Init(name); +} + + +void defiNet::addShieldNet(const char* name) { + int len; + + if (numShieldNet_ == shieldNetsAllocated_) { + if (shieldNetsAllocated_ == 0) + bumpShieldNets(2); + else + bumpShieldNets(shieldNetsAllocated_ * 2); + + } + + len = strlen(name) + 1; + shieldNet_[numShieldNet_] = (char*)malloc(len); + strcpy(shieldNet_[numShieldNet_], defData->DEFCASE(name)); + (numShieldNet_)++; +} + + +void defiNet::changeNetName(const char* name) { + int len = strlen(name) + 1; + if (len > nameSize_) bumpName(len); + strcpy(name_, defData->DEFCASE(name)); +} + +void defiNet::changeInstance(const char* instance, int index) { + int len; + char errMsg[256]; + + if ((index < 0) || (index > numPins_)) { + sprintf (errMsg, "ERROR (DEFPARS-6083): The index number %d specified for the NET INSTANCE is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numPins_); + defiError(0, 6083, errMsg, defData); + } + + len = strlen(instance)+ 1; + if (instances_[index]) + free((char*)(instances_[index])); + instances_[index] = (char*)malloc(len); + strcpy(instances_[index], defData->DEFCASE(instance)); + return; +} + +void defiNet::changePin(const char* pin, int index) { + int len; + char errMsg[256]; + + if ((index < 0) || (index > numPins_)) { + sprintf (errMsg, "ERROR (DEFPARS-6084): The index number %d specified for the NET PIN is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numPins_); + defiError(0, 6084, errMsg, defData); + } + + len = strlen(pin)+ 1; + if (pins_[index]) + free((char*)(pins_[index])); + pins_[index] = (char*)malloc(len); + strcpy(pins_[index], defData->DEFCASE(pin)); + return; +} + +const char* defiNet::name() const { + return name_; +} + + +int defiNet::weight() const { + return weight_; +} + + +int defiNet::numProps() const { + return numProps_; +} + + +int defiNet::hasProps() const { + return numProps_ ? 1 : 0 ; +} + + +int defiNet::hasWeight() const { + return (int)(hasWeight_); +} + + +const char* defiNet::propName(int index) const { + if (index >= 0 && index < numProps_) + return propNames_[index]; + return 0; +} + + +const char* defiNet::propValue(int index) const { + if (index >= 0 && index < numProps_) + return propValues_[index]; + return 0; +} + + +double defiNet::propNumber(int index) const { + if (index >= 0 && index < numProps_) + return propDValues_[index]; + return 0; +} + + +char defiNet::propType(int index) const { + if (index >= 0 && index < numProps_) + return propTypes_[index]; + return 0; +} + + +int defiNet::propIsNumber(int index) const { + if (index >= 0 && index < numProps_) + return propDValues_[index] ? 1 : 0; + return 0; +} + + +int defiNet::propIsString(int index) const { + if (index >= 0 && index < numProps_) + return propDValues_[index] ? 0 : 1; + return 0; +} + + +int defiNet::numConnections() const { + return numPins_; +} + + +int defiNet::numShieldNets() const { + return numShieldNet_; +} + + +const char* defiNet::instance(int index) const { + if (index >= 0 && index < numPins_) + return instances_[index]; + return 0; +} + + +const char* defiNet::pin(int index) const { + if (index >= 0 && index < numPins_) + return pins_[index]; + return 0; +} + + +int defiNet::pinIsMustJoin(int index) const { + if (index >= 0 && index < numPins_) + return (int)(musts_[index]); + return 0; +} + + +int defiNet::pinIsSynthesized(int index) const { + if (index >= 0 && index < numPins_){ +// printf("curidx: %d\n", index); +// printf("numPins_ : %d\n", numPins_); +// printf("synthesized_ addr: %x\n", synthesized_); +// fflush(stdout); + return (int)(synthesized_[index]); + } + return 0; +} + + +int defiNet::hasSubnets() const { + return numSubnets_ ? 1 : 0 ; +} + + +int defiNet::numSubnets() const { + return numSubnets_; +} + + +defiSubnet* defiNet::subnet(int index) { + if (index >= 0 && index < numSubnets_) + return subnets_[index]; + return 0; +} + + +const defiSubnet* defiNet::subnet(int index) const { + if (index >= 0 && index < numSubnets_) + return subnets_[index]; + return 0; +} + + +int defiNet::isFixed() const { + return (int)(isFixed_); +} + + +int defiNet::isRouted() const { + return (int)(isRouted_); +} + + +int defiNet::isCover() const { + return (int)(isCover_); +} + + +// this method will only call if the callback defrSNetWireCbk is set +// which will callback every wire. Therefore, only one wire should be here +void defiNet::freeWire() { + int i; + + if (numWires_) { + for (i = 0; i < numWires_; i++) { + wires_[i]->Destroy(); + free((char*)(wires_[i])); + wires_[i] = 0; + } + free((char*)(wires_)); + wires_ = 0; + numWires_ = 0; + wiresAllocated_ = 0; + } + + clearRectPoly(); + clearVia(); +} + + +void defiNet::freeShield() { + int i; + + if (numShields_) { + for (i = 0; i < numShields_; i++) { + shields_[i]->Destroy(); + free((char*)(shields_[i])); + shields_[i] = 0; + } + numShields_ = 0; + shieldsAllocated_ = 0; + } +} + + +void defiNet::print(FILE* f) const { + int i, j, x, y, newLayer; + int numX, numY, stepX, stepY; + const defiPath* p; + const defiSubnet* s; + const defiVpin* vp; + const defiWire* w; + int path; + + fprintf(f, "Net '%s'", name_); + fprintf(f, "\n"); + + if (hasWeight()) + fprintf(f, " weight=%d\n", weight()); + + if (hasFixedbump()) + fprintf(f, " fixedbump\n"); + + if (hasFrequency()) + fprintf(f, " frequency=%f\n", frequency()); + + if (hasCap()) + fprintf(f, " cap=%f\n", cap()); + + if (hasSource()) + fprintf(f, " source='%s'\n", source()); + + if (hasPattern()) + fprintf(f, " pattern='%s'\n", pattern()); + + if (hasOriginal()) + fprintf(f, " original='%s'\n", original()); + + if (hasUse()) + fprintf(f, " use='%s'\n", use()); + + if (hasNonDefaultRule()) + fprintf(f, " nonDefaultRule='%s'\n", nonDefaultRule()); + + if (hasXTalk()) + fprintf(f, " xtalk=%d\n", XTalk()); + + if (hasStyle()) + fprintf(f, " style='%d'\n", style()); + + if (hasProps()) { + fprintf(f, " Props:\n"); + for (i = 0; i < numProps(); i++) { + fprintf(f, " '%s' '%s'\n", propName(i), + propValue(i)); + } + } + + if (numConnections()) { + fprintf(f, " Pins:\n"); + for (i = 0; i < numConnections(); i++) { + fprintf(f, " '%s' '%s'%s%s\n", + instance(i), + pin(i), + pinIsMustJoin(i) ? " MUSTJOIN" : "", + pinIsSynthesized(i) ? " SYNTHESIZED" : ""); + } + } + + for (i = 0; i < numVpins_; i++) { + vp = vpin(i); + fprintf(f, + " VPIN %s status '%c' layer %s %d,%d orient %s bounds %d,%d to %d,%d\n", + vp->name(), + vp->status(), + vp->layer() ? vp->layer() : "", + vp->xLoc(), + vp->yLoc(), + vp->orientStr(), + vp->xl(), + vp->yl(), + vp->xh(), + vp->yh()); + } + + for (i = 0; i < numWires_; i++) { + newLayer = 0; + w = wire(i); + fprintf(f, "+ %s ", w->wireType()); + for (j = 0; j < w->numPaths(); j++) { + p = w->path(j); + p->initTraverse(); + while ((path = (int)(p->next())) != DEFIPATH_DONE) { + switch (path) { + case DEFIPATH_LAYER: + if (newLayer == 0) { + fprintf(f, "%s ", p->getLayer()); + newLayer = 1; + } else + fprintf(f, "NEW %s ", p->getLayer()); + break; + case DEFIPATH_VIA: + fprintf(f, "%s\n", p->getVia()); + break; + case DEFIPATH_VIAROTATION: + fprintf(f, "%d\n", p->getViaRotation()); + break; + case DEFIPATH_VIADATA: + p->getViaData(&numX, &numY, &stepX, &stepY); + fprintf(f, "%d %d %d %d\n", numX, numY, stepX, stepY); + break; + case DEFIPATH_WIDTH: + fprintf(f, "%d\n", p->getWidth()); + break; + case DEFIPATH_POINT: + p->getPoint(&x, &y); + fprintf(f, "( %d %d )\n", x, y); + break; + case DEFIPATH_TAPER: + fprintf(f, "TAPER\n"); + break; + } + } + } + } + + if (hasSubnets()) { + fprintf(f, " Subnets:\n"); + for (i = 0; i < numSubnets(); i++) { + s = subnet(i); + s->print(f); + } + } + +} + + +void defiNet::bumpName(long long size) { + if (name_) free(name_); + name_ = (char*)malloc(size); + nameSize_ = size; + name_[0] = '\0'; +} + + +void defiNet::bumpPins(long long size) { + char** newInstances = (char**)malloc(sizeof(char*)*size); + char** newPins = (char**)malloc(sizeof(char*)*size); + char* newMusts = (char*)malloc(size); + char* newSyn = (char*)malloc(size); + long long i; + + if (instances_) { + for (i = 0; i < pinsAllocated_; i++) { + newInstances[i] = instances_[i]; + newPins[i] = pins_[i]; + newMusts[i] = musts_[i]; + newSyn[i] = synthesized_[i]; + } + free((char*)(instances_)); + free((char*)(pins_)); + free(musts_); + free(synthesized_); + } + + instances_ = newInstances; + pins_ = newPins; + musts_ = newMusts; + synthesized_ = newSyn; + pinsAllocated_ = size; +} + + +void defiNet::bumpProps(long long size) { + char** newNames = (char**)malloc(sizeof(char*)*size); + char** newValues = (char**)malloc(sizeof(char*)*size); + double* newDValues = (double*)malloc(sizeof(double)*size); + char* newTypes = (char*)malloc(sizeof(char)*size); + long long i; + + if (propNames_) { + for (i = 0; i < numProps_; i++) { + newNames[i] = propNames_[i]; + newValues[i] = propValues_[i]; + newDValues[i] = propDValues_[i]; + newTypes[i] = propTypes_[i]; + } + free((char*)(propNames_)); + free((char*)(propValues_)); + free((char*)(propDValues_)); + free((char*)(propTypes_)); + } + + propNames_ = newNames; + propValues_ = newValues; + propDValues_ = newDValues; + propTypes_ = newTypes; + propsAllocated_ = size; +} + + +void defiNet::bumpSubnets(long long size) { + defiSubnet** newSubnets = (defiSubnet**)malloc(sizeof(defiSubnet*)*size); + int i; + if (subnets_) { + for (i = 0; i < numSubnets_; i++) { + newSubnets[i] = subnets_[i]; + } + free((char*)(subnets_)); + } + + subnets_ = newSubnets; + subnetsAllocated_ = size; +} + + +void defiNet::clear() { + int i; + + // WMD -- this will be removed by the next release + isFixed_ = 0; + isRouted_ = 0; + isCover_ = 0; + + hasWeight_ = 0; + hasCap_ = 0; + hasFrequency_ = 0; + hasVoltage_ = 0; + xTalk_ = -1; + + if (vpins_) { + for (i = 0; i < numVpins_; i++) { + delete vpins_[i]; + } + free((char*)vpins_); + vpins_ = 0; + numVpins_ = 0; + vpinsAllocated_ = 0; + } + + for (i = 0; i < numProps_; i++) { + free(propNames_[i]); + free(propValues_[i]); + propNames_[i] = 0; + propValues_[i] = 0; + propDValues_[i] = 0; + } + numProps_ = 0; + + for (i = 0; i < numPins_; i++) { + free(instances_[i]); + free(pins_[i]); + instances_[i] = 0; + pins_[i] = 0; + musts_[i] = 0; + synthesized_[i] = 0; + } + numPins_ = 0; + + for (i = 0; i < numSubnets_; i++) { + delete subnets_[i]; + subnets_[i] = 0; + } + numSubnets_ = 0; + + if (name_) + name_[0] = '\0'; + + // WMD -- this will be removed by the next release + if (paths_) { + for (i = 0; i < numPaths_; i++) { + delete paths_[i]; + } + + delete [] paths_; + paths_ = 0; + numPaths_ = 0; + pathsAllocated_ = 0; + } + + // 5.4.1 + fixedbump_ = 0; + + if (source_) { free(source_); source_ = 0; } + if (pattern_) { free(pattern_); pattern_ = 0; } + if (original_) { free(original_); original_ = 0; } + if (use_) { free(use_); use_ = 0; } + if (nonDefaultRule_) { free(nonDefaultRule_); + nonDefaultRule_ = 0; } + style_ = 0; + + if (numWires_) { + for (i = 0; i < numWires_; i++) { + delete wires_[i]; + wires_[i] = 0; + } + free((char*)(wires_)); + wires_ = 0; + numWires_ = 0; + wiresAllocated_ = 0; + } + + if (numShields_) { + for (i = 0; i < numShields_; i++) { + delete shields_[i]; + shields_[i] = 0; + } + numShields_ = 0; + shieldsAllocated_ = 0; + } + + if (numNoShields_) { + for (i = 0; i < numNoShields_; i++) { + delete shields_[i]; + shields_[i] = 0; + } + numNoShields_ = 0; + shieldsAllocated_ = 0; + } + if (shields_) + free((char*)(shields_)); + + shields_ = 0; + + if (numWidths_) { + for (i = 0; i < numWidths_; i++) + free(wlayers_[i]); + numWidths_ = 0; + } + + if (numSpacing_) { + for (i = 0; i < numSpacing_; i++) + free(slayers_[i]); + numSpacing_ = 0; + } + + if (numShieldNet_) { + for (i = 0; i < numShieldNet_; i++) + free(shieldNet_[i]); + numShieldNet_ = 0; + } + + if (polygonNames_) { + struct defiPoints* p; + for (i = 0; i < numPolys_; i++) { + if (polygonNames_[i]){ + free((char*)(polygonNames_[i])); + } + if (polyRouteStatus_[i]) { + free((char*)(polyRouteStatus_[i])); + } + if (polyShapeTypes_[i]) { + free((char*)(polyShapeTypes_[i])); + } + if (polyRouteStatusShieldNames_[i]) { + free((char*)(polyRouteStatusShieldNames_[i])); + } + p = polygons_[i]; + free((char*)(p->x)); + free((char*)(p->y)); + free((char*)(polygons_[i])); + } + free((char*)(polygonNames_)); + free((char*)(polygons_)); + free((char*)(polyMasks_)); + free((char*)(polyRouteStatus_)); + free((char*)(polyShapeTypes_)); + free((char*)(polyRouteStatusShieldNames_)); + polygonNames_ = 0; + polygons_ = 0; + polyMasks_ = 0; + polyRouteStatus_ = 0; + polyShapeTypes_ = 0; + polyRouteStatusShieldNames_ = 0; + } + numPolys_ = 0; + polysAllocated_ = 0; + + if (rectNames_) { + for (i = 0; i < numRects_; i++) { + if (rectNames_[i]) { + free ((char*)(rectNames_[i])); + } + if (rectRouteStatus_[i]) { + free ((char*)(rectRouteStatus_[i])); + } + if (rectRouteStatusShieldNames_[i]) { + free ((char*)(rectRouteStatusShieldNames_[i])); + } + if (rectShapeTypes_[i]) { + free ((char*)(rectShapeTypes_[i])); + } + } + free((char*)(rectNames_)); + free((char*)(xl_)); + free((char*)(yl_)); + free((char*)(xh_)); + free((char*)(yh_)); + free((char*)(rectMasks_)); + free((char*)(rectRouteStatus_)); + free((char*)(rectRouteStatusShieldNames_)); + free((char*)(rectShapeTypes_)); + } + rectNames_ = 0; + rectRouteStatus_ = 0; + rectShapeTypes_ = 0; + rectRouteStatusShieldNames_ = 0; + numRects_ = 0; + rectsAllocated_ = 0; + xl_ = 0; + yl_ = 0; + xh_ = 0; + yh_ = 0; + rectMasks_ = 0; + + if (viaNames_) { + struct defiPoints* p; + + for (i = 0; i < numPts_; i++) { + p = viaPts_[i]; + free((char*)(p->x)); + free((char*)(p->y)); + free((char*)(viaPts_[i])); + if (viaNames_[i]) { + free ((char*)(viaNames_[i])); + } + if (viaRouteStatus_[i]) { + free ((char*)(viaRouteStatus_[i])); + } + if (viaShapeTypes_[i]) { + free ((char*)(viaShapeTypes_[i])); + } + if (viaRouteStatusShieldNames_[i]) { + free ((char*)(viaRouteStatusShieldNames_[i])); + } + } + free((char*)(viaNames_)); + free((char*)(viaPts_)); + free((char*)(viaMasks_)); + free((char*)(viaOrients_)); + free((char*)(viaRouteStatus_)); + free((char*)(viaShapeTypes_)); + free((char*)(viaRouteStatusShieldNames_)); + viaNames_ = 0; + viaPts_ = 0; + viaRouteStatus_ = 0; + viaShapeTypes_ = 0; + viaRouteStatusShieldNames_ = 0 ; + } + numPts_ = 0; + ptsAllocated_ = 0; + viaOrients_ = 0; + viaMasks_ = 0; +} + +void defiNet::clearRectPolyNPath() { + int i; + + if (paths_) { + for (i = 0; i < numPaths_; i++) { + delete paths_[i]; + } + numPaths_ = 0; + } + + clearRectPoly(); + +} + +void defiNet::clearRectPoly() { + int i; + + if (polygonNames_) { + struct defiPoints* p; + for (i = 0; i < numPolys_; i++) { + if (polygonNames_[i]){ + free((char*)(polygonNames_[i])); + } + if (polyRouteStatus_[i]) { + free((char*)(polyRouteStatus_[i])); + } + if (polyShapeTypes_[i]) { + free((char*)(polyShapeTypes_[i])); + } + if (polyRouteStatusShieldNames_[i]) { + free((char*)(polyRouteStatusShieldNames_[i])); + } + p = polygons_[i]; + free((char*)(p->x)); + free((char*)(p->y)); + free((char*)(polygons_[i])); + } + free((char*)(polyMasks_)); + free((char*)(polygonNames_)); + free((char*)(polygons_)); + free((char*)(polyRouteStatus_)); + free((char*)(polyShapeTypes_)); + free((char*)(polyRouteStatusShieldNames_)); + } + numPolys_ = 0; + polysAllocated_ = 0; + polyMasks_ = 0; + polygonNames_ = 0; + polyRouteStatus_= 0; + polyShapeTypes_= 0; + polyRouteStatusShieldNames_ = 0; + polygons_ = 0; + + if (rectNames_) { + for (i = 0; i < numRects_; i++) { + if (rectNames_[i]){ + free((char*)(rectNames_[i])); + } + if (rectRouteStatus_[i]){ + free((char*)(rectRouteStatus_[i])); + } + if (rectShapeTypes_[i]) { + free((char*)(rectShapeTypes_[i])); + } + if (rectRouteStatusShieldNames_[i]) { + free((char*)(rectRouteStatusShieldNames_[i])); + } + } + free((char*)(rectMasks_)); + free((char*)(rectNames_)); + free((char*)(xl_)); + free((char*)(yl_)); + free((char*)(xh_)); + free((char*)(yh_)); + free((char*)(rectShapeTypes_)); + free((char*)(rectRouteStatus_)); + free((char*)(rectRouteStatusShieldNames_)); + } + rectNames_ = 0; + rectsAllocated_ = 0; + xl_ = 0; + yl_ = 0; + xh_ = 0; + yh_ = 0; + numRects_ = 0; + rectMasks_ = 0; + rectRouteStatus_ = 0; + rectShapeTypes_ = 0; + rectRouteStatusShieldNames_=0; +} + +int defiNet::hasSource() const { + return source_ ? 1 : 0; +} + + +int defiNet::hasFixedbump() const { + return fixedbump_ ? 1 : 0; +} + + +int defiNet::hasFrequency() const { + return (int)(hasFrequency_); +} + + +int defiNet::hasPattern() const { + return pattern_ ? 1 : 0; +} + + +int defiNet::hasOriginal() const { + return original_ ? 1 : 0; +} + + +int defiNet::hasCap() const { + return (int)(hasCap_); +} + + +int defiNet::hasUse() const { + return use_ ? 1 : 0; +} + + +int defiNet::hasStyle() const { + return style_ ? 1 : 0; +} + + +int defiNet::hasXTalk() const { + return (xTalk_ != -1) ? 1 : 0; +} + + +int defiNet::hasNonDefaultRule() const { + return nonDefaultRule_ ? 1 : 0; +} + + +void defiNet::setSource(const char* typ) { + int len; + if (source_) free(source_); + len = strlen(typ) + 1; + source_ = (char*)malloc(len); + strcpy(source_, defData->DEFCASE(typ)); +} + + +void defiNet::setFixedbump() { + fixedbump_ = 1; +} + + +void defiNet::setFrequency(double frequency) { + frequency_ = frequency; + hasFrequency_ = 1; +} + + +void defiNet::setOriginal(const char* typ) { + int len; + if (original_) free(original_); + len = strlen(typ) + 1; + original_ = (char*)malloc(len); + strcpy(original_, defData->DEFCASE(typ)); +} + + +void defiNet::setPattern(const char* typ) { + int len; + if (pattern_) free(pattern_); + len = strlen(typ) + 1; + pattern_ = (char*)malloc(len); + strcpy(pattern_, defData->DEFCASE(typ)); +} + + +void defiNet::setCap(double w) { + cap_ = w; + hasCap_ = 1; +} + + +void defiNet::setUse(const char* typ) { + int len; + if (use_) free(use_); + len = strlen(typ) + 1; + use_ = (char*)malloc(len); + strcpy(use_, defData->DEFCASE(typ)); +} + + +void defiNet::setStyle(int style) { + style_ = style; +} + + +void defiNet::setNonDefaultRule(const char* typ) { + int len; + if (nonDefaultRule_) free(nonDefaultRule_); + len = strlen(typ) + 1; + nonDefaultRule_ = (char*)malloc(len); + strcpy(nonDefaultRule_, defData->DEFCASE(typ)); +} + + +const char* defiNet::source() const { + return source_; +} + + +const char* defiNet::original() const { + return original_; +} + + +const char* defiNet::pattern() const { + return pattern_; +} + + +double defiNet::cap() const { + return (hasCap_ ? cap_ : 0.0); +} + + +double defiNet::frequency() const { + return (hasFrequency_ ? frequency_ : 0.0); +} + + +const char* defiNet::use() const { + return use_; +} + + +int defiNet::style() const { + return style_; +} + + +const char* defiNet::shieldNet(int index) const { + return shieldNet_[index]; +} + + +const char* defiNet::nonDefaultRule() const { + return nonDefaultRule_; +} + +// WMD -- this will be removed by the next release +void defiNet::bumpPaths(long long size) { + long long i; + + defiPath** newPaths = new defiPath*[size]; + + for (i = 0; i < numPaths_; i++) + newPaths[i] = paths_[i]; + + delete [] paths_; + pathsAllocated_ = size; + paths_ = newPaths; +} + +// WMD -- this will be removed by the next release +int defiNet::numPaths() const { + return numPaths_; +} + + +// WMD -- this will be removed by the next release +defiPath* defiNet::path(int index) { + if (index >= 0 && index < numPaths_) + return paths_[index]; + return 0; +} + + +const defiPath* defiNet::path(int index) const { + if (index >= 0 && index < numPaths_) + return paths_[index]; + return 0; +} + + +int defiNet::numWires() const { + return numWires_; +} + + +defiWire* defiNet::wire(int index) { + if (index >= 0 && index < numWires_) + return wires_[index]; + return 0; +} + + +const defiWire* defiNet::wire(int index) const { + if (index >= 0 && index < numWires_) + return wires_[index]; + return 0; +} + + +void defiNet::bumpShieldNets(long long size) { + char** newShieldNets = (char**)malloc(sizeof(char*)*size); + long long i; + + if (shieldNet_) { + for (i = 0; i < shieldNetsAllocated_; i++) { + newShieldNets[i] = shieldNet_[i]; + } + free((char*)(shieldNet_)); + } + + shieldNet_ = newShieldNets; + shieldNetsAllocated_ = size; +} + + +int defiNet::numShields() const { + return numShields_; +} + + +defiShield* defiNet::shield(int index) { + if (index >= 0 && index < numShields_) + return shields_[index]; + return 0; +} + + +const defiShield* defiNet::shield(int index) const { + if (index >= 0 && index < numShields_) + return shields_[index]; + return 0; +} + +int defiNet::numNoShields() const { + return numNoShields_; +} + + +defiShield* defiNet::noShield(int index) { + if (index >= 0 && index < numNoShields_) + return shields_[index]; + return 0; +} + +const defiShield* defiNet::noShield(int index) const { + if (index >= 0 && index < numNoShields_) + return shields_[index]; + return 0; +} + +int defiNet::hasVoltage() const { + return (int)(hasVoltage_); +} + + +double defiNet::voltage() const { + return voltage_; +} + + +int defiNet::numWidthRules() const { + return numWidths_; +} + + +int defiNet::numSpacingRules() const { + return numSpacing_; +} + + +int defiNet::hasWidthRules() const { + return numWidths_; +} + + +int defiNet::hasSpacingRules() const { + return numSpacing_; +} + + +void defiNet::setXTalk(int i) { + xTalk_ = i; +} + + +int defiNet::XTalk() const { + return xTalk_; +} + + +void defiNet::addVpin(const char* name) { + defiVpin* vp; + if (numVpins_ == vpinsAllocated_) { + defiVpin** array; + int i; + vpinsAllocated_ = vpinsAllocated_ ? + vpinsAllocated_ * 2 : 2 ; + array = (defiVpin**)malloc(sizeof(defiVpin*)*vpinsAllocated_); + for (i = 0; i < numVpins_; i++) + array[i] = vpins_[i]; + if (vpins_) free((char*)(vpins_)); + vpins_ = array; + } + vp = vpins_[numVpins_] = new defiVpin(defData); + numVpins_ += 1; + vp->Init(name); +} + + +void defiNet::addVpinLayer(const char* name) { + defiVpin* vp = vpins_[numVpins_-1]; + vp->setLayer(name); +} + + +void defiNet::addVpinLoc(const char* status, int x, int y, int orient) { + defiVpin* vp = vpins_[numVpins_-1]; + vp->setStatus(*status); + vp->setLoc(x,y); + vp->setOrient(orient); +} + + +void defiNet::addVpinBounds(int xl, int yl, int xh, int yh) { + defiVpin* vp = vpins_[numVpins_-1]; + vp->setBounds(xl, yl, xh, yh); +} + + +int defiNet::numVpins() const { + return numVpins_; +} + + +defiVpin* defiNet::vpin(int index) { + if (index < 0 || index >= numVpins_) return 0; + return vpins_[index]; +} + + +const defiVpin* defiNet::vpin(int index) const { + if (index < 0 || index >= numVpins_) return 0; + return vpins_[index]; +} + +void defiNet::spacingRule(int index, char** layer, double* dist, + double* left, double* right) const { + if (index >= 0 && index < numSpacing_) { + if (layer) *layer = slayers_[index]; + if (dist) *dist = sdist_[index]; + if (left) *left = sleft_[index]; + if (right) *right = sright_[index]; + } +} + + +void defiNet::widthRule(int index, char** layer, double* dist) const { + if (index >= 0 && index < numWidths_) { + if (layer) *layer = wlayers_[index]; + if (dist) *dist = wdist_[index]; + } +} + + +void defiNet::setVoltage(double v) { + voltage_ = v; + hasVoltage_ = 1; +} + + +void defiNet::setWidth(const char* layer, double d) { + int len = strlen(layer) + 1; + char* l = (char*)malloc(len); + strcpy(l, defData->DEFCASE(layer)); + + if (numWidths_ >= widthsAllocated_) { + int i; + char** nl; + double* nd; + widthsAllocated_ = widthsAllocated_ ? + widthsAllocated_ * 2 : 4 ; + nl = (char**)malloc(sizeof(char*) * widthsAllocated_); + nd = (double*)malloc(sizeof(double) * widthsAllocated_); + for (i = 0; i < numWidths_; i++) { + nl[i] = wlayers_[i]; + nd[i] = wdist_[i]; + } + free((char*)(wlayers_)); + free((char*)(wdist_)); + wlayers_ = nl; + wdist_ = nd; + } + + wlayers_[numWidths_] = l; + wdist_[numWidths_] = d; + (numWidths_)++; +} + + +void defiNet::setSpacing(const char* layer, double d) { + int len = strlen(layer) + 1; + char* l = (char*)malloc(len); + strcpy(l, defData->DEFCASE(layer)); + + if (numSpacing_ >= spacingAllocated_) { + int i; + char** nl; + double* nd; + double* n1; + double* n2; + spacingAllocated_ = spacingAllocated_ ? + spacingAllocated_ * 2 : 4 ; + nl = (char**)malloc(sizeof(char*) * spacingAllocated_); + nd = (double*)malloc(sizeof(double) * spacingAllocated_); + n1 = (double*)malloc(sizeof(double) * spacingAllocated_); + n2 = (double*)malloc(sizeof(double) * spacingAllocated_); + for (i = 0; i < numSpacing_; i++) { + nl[i] = slayers_[i]; + nd[i] = sdist_[i]; + n1[i] = sleft_[i]; + n2[i] = sright_[i]; + } + free((char*)(slayers_)); + free((char*)(sdist_)); + free((char*)(sleft_)); + free((char*)(sright_)); + slayers_ = nl; + sdist_ = nd; + sleft_ = n1; + sright_ = n2; + } + + slayers_[numSpacing_] = l; + sdist_[numSpacing_] = d; + sleft_[numSpacing_] = d; + sright_[numSpacing_] = d; + (numSpacing_)++; +} + + +void defiNet::setRange(double left, double right) { + // This is always called right after setSpacing. + sleft_[numSpacing_-1] = left; + sright_[numSpacing_-1] = right; +} + +// 5.6 +void defiNet::addPolygon(const char* layerName, defiGeometries* geom, + int *needCbk, int colorMask, + const char* routeStatus, + const char* shapeType, + const char* routeStatusShieldName) { + struct defiPoints* p; + int x, y; + int i; + + // This method will only call by specialnet, need to change if net also + // calls it. + *needCbk = 0; + if (numPolys_ == polysAllocated_) { + char** newn; + char** newRS; + char** newST; + char** newRSN; + int* maskn; + struct defiPoints** poly; + polysAllocated_ = (polysAllocated_ == 0) ? + 1000 : polysAllocated_ * 2; + newn = (char**)malloc(sizeof(char*) * polysAllocated_); + newRS = (char**)malloc(sizeof(char*) * polysAllocated_); + newST = (char**)malloc(sizeof(char*) * polysAllocated_); + newRSN = (char**)malloc(sizeof(char*) * polysAllocated_); + maskn = (int*)malloc(sizeof(int) * polysAllocated_); + poly = (struct defiPoints**)malloc(sizeof(struct defiPoints*) * + polysAllocated_); + for (i = 0; i < numPolys_; i++) { + newn[i] = polygonNames_[i]; + poly[i] = polygons_[i]; + maskn[i] = polyMasks_[i]; + newRS[i] = polyRouteStatus_[i]; + newST[i] = polyShapeTypes_[i]; + newRSN[i] = polyRouteStatusShieldNames_[i]; + + } + if (polygons_) + free((char*)(polygons_)); + if (polygonNames_) + free((char*)(polygonNames_)); + if (polyMasks_) + free((char*)(polyMasks_)); + if (polyRouteStatus_) + free((char*)(polyRouteStatus_)); + if (polyShapeTypes_) + free((char*)(polyShapeTypes_)); + if (polyRouteStatusShieldNames_) + free((char*)(polyRouteStatusShieldNames_)); + polygonNames_ = newn; + polygons_ = poly; + polyMasks_ = maskn; + polyShapeTypes_ = newST; + polyRouteStatus_= newRS; + polyRouteStatusShieldNames_ = newRSN; + } + polygonNames_[numPolys_] = strdup(layerName); + polyRouteStatus_[numPolys_] = strdup(routeStatus); + polyShapeTypes_[numPolys_] = strdup(shapeType); + polyRouteStatusShieldNames_[numPolys_] = strdup(routeStatusShieldName); + p = (struct defiPoints*)malloc(sizeof(struct defiPoints)); + p->numPoints = geom->numPoints(); + p->x = (int*)malloc(sizeof(int)*p->numPoints); + p->y = (int*)malloc(sizeof(int)*p->numPoints); + for (i = 0; i < p->numPoints; i++) { + geom->points(i, &x, &y); + p->x[i] = x; + p->y[i] = y; + } + polyMasks_[numPolys_] = colorMask; + polygons_[numPolys_] = p; + numPolys_ += 1; + if (numPolys_ == 1000) // Want to invoke the partial callback if set + *needCbk = 1; +} + + +// 5.6 +int defiNet::numPolygons() const { + return numPolys_; +} + + +// 5.6 +const char* defiNet::polygonName(int index) const { + char errMsg[256]; + if (index < 0 || index > numPolys_) { + sprintf (errMsg, "ERROR (DEFPARS-6085): The index number %d specified for the NET POLYGON is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numPolys_); + defiError(0, 6085, errMsg, defData); + return 0; + } + return polygonNames_[index]; +} + +const char* defiNet::polyRouteStatus(int index) const { + char errMsg[256]; + if (index < 0 || index > numPolys_) { + sprintf (errMsg, "ERROR (DEFPARS-6085): The index number %d specified for the NET POLYGON is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numPolys_); + defiError(0, 6085, errMsg, defData); + return 0; + } + return polyRouteStatus_[index]; +} + +const char* defiNet::polyRouteStatusShieldName(int index) const { + char errMsg[256]; + if (index < 0 || index > numPolys_) { + sprintf (errMsg, "ERROR (DEFPARS-6085): The index number %d specified for the NET POLYGON is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numPolys_); + defiError(0, 6085, errMsg, defData); + return 0; + } + return polyRouteStatusShieldNames_[index]; +} + +const char* defiNet::polyShapeType(int index) const { + char errMsg[256]; + if (index < 0 || index > numPolys_) { + sprintf (errMsg, "ERROR (DEFPARS-6085): The index number %d specified for the NET POLYGON is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numPolys_); + defiError(0, 6085, errMsg, defData); + return 0; + } + return polyShapeTypes_[index]; +} + +int defiNet::polyMask(int index) const { + char errMsg[256]; + if (index < 0 || index > numPolys_) { + sprintf (errMsg, "ERROR (DEFPARS-6085): The index number %d specified for the NET POLYGON is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numPolys_); + defiError(0, 6085, errMsg, defData); + return 0; + } + return polyMasks_[index]; +} + +// 5.6 +struct defiPoints defiNet::getPolygon(int index) const { + return *(polygons_[index]); +} + +// 5.6 +void defiNet::addRect(const char* layerName, int xl, int yl, int xh, int yh, + int *needCbk, + int colorMask, + const char* routeStatus, + const char* shapeType, + const char* routeStatusName) { + // This method will only call by specialnet, need to change if net also + // calls it. + *needCbk = 0; + if (numRects_ == rectsAllocated_) { + int i; + int max; + char** newn; + int* newxl; + int* newyl; + int* newxh; + int* newyh; + int* newMask; + char** newRS; + char** newST; + char** newRSN; + + max = rectsAllocated_ = (rectsAllocated_ == 0) ? 1000 : + rectsAllocated_ * 2; + newn = (char**)malloc(sizeof(char*)*max); + newRS = (char**)malloc(sizeof(char*)*max); + newST = (char**)malloc(sizeof(char*)*max); + newRSN = (char**)malloc(sizeof(char*)*max); + newxl = (int*)malloc(sizeof(int)*max); + newyl = (int*)malloc(sizeof(int)*max); + newxh = (int*)malloc(sizeof(int)*max); + newyh = (int*)malloc(sizeof(int)*max); + newMask = (int*)malloc(sizeof(int)*max); + for (i = 0; i < numRects_; i++) { + newn[i] = rectNames_[i]; + newxl[i] = xl_[i]; + newyl[i] = yl_[i]; + newxh[i] = xh_[i]; + newyh[i] = yh_[i]; + newMask[i] = rectMasks_[i]; + newRS[i] = rectRouteStatus_[i]; + newST[i] = rectShapeTypes_[i]; + newRSN[i] = rectRouteStatusShieldNames_[i]; + } + if (rectNames_) + free((char*)(rectNames_)); + if (rectRouteStatus_) + free((char*)(rectRouteStatus_)); + if (rectShapeTypes_) + free((char*)(rectShapeTypes_)); + if (rectRouteStatusShieldNames_) + free((char*)(rectRouteStatusShieldNames_)); + if (xl_) { + free((char*)(xl_)); + free((char*)(yl_)); + free((char*)(xh_)); + free((char*)(yh_)); + free((char*)(rectMasks_)); + } + rectNames_ = newn; + xl_ = newxl; + yl_ = newyl; + xh_ = newxh; + yh_ = newyh; + rectMasks_ = newMask; + rectRouteStatus_ = newRS; + rectShapeTypes_ = newST; + rectRouteStatusShieldNames_ = newRSN; + } + rectNames_[numRects_] = strdup(layerName); + xl_[numRects_] = xl; + yl_[numRects_] = yl; + xh_[numRects_] = xh; + yh_[numRects_] = yh; + rectMasks_[numRects_] = colorMask; + rectRouteStatus_[numRects_] = strdup(routeStatus); + rectShapeTypes_[numRects_] = strdup(shapeType); + rectRouteStatusShieldNames_[numRects_] = strdup(routeStatusName); + numRects_ += 1; + if (numRects_ == 1000) // Want to invoke the partial callback if set + *needCbk = 1; +} + +// 5.6 +int defiNet::numRectangles() const { + return numRects_; +} + +// 5.6 +const char* defiNet::rectName(int index) const { + char errMsg[256]; + if (index < 0 || index > numRects_) { + sprintf (errMsg, "ERROR (DEFPARS-6086): The index number %d specified for the NET RECTANGLE is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numRects_); + defiError(0, 6086, errMsg, defData); + return 0; + } + return rectNames_[index]; +} + +const char* defiNet::rectRouteStatus(int index) const { + char errMsg[256]; + if (index < 0 || index > numRects_) { + sprintf (errMsg, "ERROR (DEFPARS-6086): The index number %d specified for the NET RECTANGLE is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numRects_); + defiError(0, 6086, errMsg, defData); + return 0; + } + return rectRouteStatus_[index]; +} + +const char* defiNet::rectRouteStatusShieldName(int index) const { + char errMsg[256]; + if (index < 0 || index > numRects_) { + sprintf (errMsg, "ERROR (DEFPARS-6086): The index number %d specified for the NET RECTANGLE is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numRects_); + defiError(0, 6086, errMsg, defData); + return 0; + } + return rectRouteStatusShieldNames_[index]; +} + +const char* defiNet::rectShapeType(int index) const { + char errMsg[256]; + if (index < 0 || index > numRects_) { + sprintf (errMsg, "ERROR (DEFPARS-6086): The index number %d specified for the NET RECTANGLE is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numRects_); + defiError(0, 6086, errMsg, defData); + return 0; + } + return rectShapeTypes_[index]; +} + +// 5.6 +int defiNet::xl(int index) const { + char errMsg[256]; + if (index < 0 || index >= numRects_) { + sprintf (errMsg, "ERROR (DEFPARS-6086): The index number %d specified for the NET RECTANGLE is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numRects_); + defiError(0, 6086, errMsg, defData); + return 0; + } + return xl_[index]; +} + +// 5.6 +int defiNet::yl(int index) const { + char errMsg[256]; + if (index < 0 || index >= numRects_) { + sprintf (errMsg, "ERROR (DEFPARS-6086): The index number %d specified for the NET RECTANGLE is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numRects_); + defiError(0, 6086, errMsg, defData); + return 0; + } + return yl_[index]; +} + +// 5.6 +int defiNet::xh(int index) const { + char errMsg[256]; + if (index < 0 || index >= numRects_) { + sprintf (errMsg, "ERROR (DEFPARS-6086): The index number %d specified for the NET RECTANGLE is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numRects_); + defiError(0, 6086, errMsg, defData); + return 0; + } + return xh_[index]; +} + +// 5.6 +int defiNet::yh(int index) const { + char errMsg[256]; + if (index < 0 || index >= numRects_) { + sprintf (errMsg, "ERROR (DEFPARS-6086): The index number %d specified for the NET RECTANGLE is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numRects_); + defiError(0, 6086, errMsg, defData); + return 0; + } + return yh_[index]; +} + +int defiNet::rectMask(int index) const { + char errMsg[256]; + if (index < 0 || index >= numRects_) { + sprintf (errMsg, "ERROR (DEFPARS-6086): The index number %d specified for the NET RECTANGLE is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numRects_); + defiError(0, 6086, errMsg, defData); + return 0; + } + return rectMasks_[index]; +} + + +void defiNet::addPts(const char* viaName, int o, defiGeometries* geom, + int *needCbk, int colorMask, + const char* routeStatus, + const char* shapeType, + const char* routeStatusShieldName) { + struct defiPoints* p; + int x, y; + int i; + + *needCbk = 0; + if (numPts_ == ptsAllocated_) { + struct defiPoints** pts; + char** newn; + char** newRS; + char** newST; + char** newRSN; + int* orientn; + int* maskn; + + ptsAllocated_ = (ptsAllocated_ == 0) ? + 1000 : ptsAllocated_ * 2; + newn = (char**)malloc(sizeof(char*) *ptsAllocated_); + newRS = (char**)malloc(sizeof(char*) *ptsAllocated_); + newST = (char**)malloc(sizeof(char*) *ptsAllocated_); + newRSN = (char**)malloc(sizeof(char*) *ptsAllocated_); + orientn = (int*)malloc(sizeof(int) *ptsAllocated_); + pts= (struct defiPoints**)malloc(sizeof(struct defiPoints*) * + ptsAllocated_); + maskn = (int*)malloc(sizeof(int) *ptsAllocated_); + for (i = 0; i < numPts_; i++) { + pts[i] = viaPts_[i]; + newn[i] = viaNames_[i]; + newRS[i] = viaRouteStatus_[i]; + newST[i] = viaShapeTypes_[i]; + newRSN[i] = viaRouteStatusShieldNames_[i]; + orientn[i] = viaOrients_[i]; + maskn[i] = viaMasks_[i]; + } + if (viaPts_) + free((char*)(viaPts_)); + if (viaNames_) + free((char*)(viaNames_)); + if (viaOrients_) + free((char*)(viaOrients_)); + if (viaMasks_) + free((char*)(viaMasks_)); + if (viaRouteStatus_) + free((char*)(viaRouteStatus_)); + if (viaShapeTypes_) + free((char*)(viaShapeTypes_)); + if (viaRouteStatusShieldNames_) + free((char*)(viaRouteStatusShieldNames_)); + + viaPts_ = pts; + viaNames_ = newn; + viaOrients_ = orientn; + viaMasks_ = maskn; + viaShapeTypes_= newST; + viaRouteStatus_ = newRS; + viaRouteStatusShieldNames_ = newRSN; + } + viaNames_[numPts_] = strdup(viaName); + viaShapeTypes_[numPts_] = strdup(shapeType); + viaRouteStatus_[numPts_] = strdup(routeStatus); + viaRouteStatusShieldNames_[numPts_] = strdup(routeStatusShieldName); + viaOrients_[numPts_] = o; + viaMasks_[numPts_] = colorMask; + p = (struct defiPoints*)malloc(sizeof(struct defiPoints)); + p->numPoints = geom->numPoints(); + p->x = (int*)malloc(sizeof(int)*p->numPoints); + p->y = (int*)malloc(sizeof(int)*p->numPoints); + for (i = 0; i < p->numPoints; i++) { + geom->points(i, &x, &y); + p->x[i] = x; + p->y[i] = y; + } + viaPts_[numPts_] = p; + numPts_ += 1; + if (numPts_ == 1000) // Want to invoke the partial callback if set + *needCbk = 1; +} + +int defiNet::numViaSpecs() const { + return numPts_; +} + +const char* defiNet::viaName(int index) const { + char errMsg[256]; + if (index < 0 || index > numPts_) { + sprintf (errMsg, "ERROR (DEFPARS-6085): The index number %d specified for the NET POLYGON is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numPts_); + defiError(0, 6085, errMsg, defData); + return 0; + } + return viaNames_[index]; +} + +const char* defiNet::viaRouteStatus(int index) const { + char errMsg[256]; + if (index < 0 || index > numPts_) { + sprintf (errMsg, "ERROR (DEFPARS-6085): The index number %d specified for the NET POLYGON is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numPts_); + defiError(0, 6085, errMsg, defData); + return 0; + } + return viaRouteStatus_[index]; +} + +const char* defiNet::viaRouteStatusShieldName(int index) const { + char errMsg[256]; + if (index < 0 || index > numPts_) { + sprintf (errMsg, "ERROR (DEFPARS-6085): The index number %d specified for the NET POLYGON is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numPts_); + defiError(0, 6085, errMsg, defData); + return 0; + } + return viaRouteStatusShieldNames_[index]; +} + +const char* defiNet::viaShapeType(int index) const { + char errMsg[256]; + if (index < 0 || index > numPts_) { + sprintf (errMsg, "ERROR (DEFPARS-6085): The index number %d specified for the NET POLYGON is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numPts_); + defiError(0, 6085, errMsg, defData); + return 0; + } + return viaShapeTypes_[index]; +} + +int defiNet::viaOrient(int index) const { + char errMsg[256]; + if (index < 0 || index > numPts_) { + sprintf (errMsg, "ERROR (DEFPARS-6085): The index number %d specified for the NET POLYGON is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numPts_); + defiError(0, 6085, errMsg, defData); + return 0; + } + return viaOrients_[index]; +} + +const char* defiNet::viaOrientStr(int index) const { + char errMsg[256]; + + if (index < 0 || index > numPts_) { + sprintf (errMsg, "ERROR (DEFPARS-6085): The index number %d specified for the NET POLYGON is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numPts_); + defiError(0, 6085, errMsg, defData); + return 0; + } + return (defiOrientStr(viaOrients_[index])); +} + +int defiNet::topMaskNum(int index) const { + char errMsg[256]; + if (index < 0 || index > numPts_) { + sprintf (errMsg, "ERROR (DEFPARS-6085): The index number %d specified for the NET POLYGON is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numPts_); + defiError(0, 6085, errMsg, defData); + return 0; + } + + return viaMasks_[index] / 100; +} + +int defiNet::cutMaskNum(int index) const { + char errMsg[256]; + if (index < 0 || index > numPts_) { + sprintf (errMsg, "ERROR (DEFPARS-6085): The index number %d specified for the NET POLYGON is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numPts_); + defiError(0, 6085, errMsg, defData); + return 0; + } + + return viaMasks_[index] / 10 % 10; +} + +int defiNet::bottomMaskNum(int index) const { + char errMsg[256]; + if (index < 0 || index > numPts_) { + sprintf (errMsg, "ERROR (DEFPARS-6085): The index number %d specified for the NET POLYGON is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numPts_); + defiError(0, 6085, errMsg, defData); + return 0; + } + + return viaMasks_[index] % 10; +} + +struct defiPoints defiNet::getViaPts(int index)const { + return *(viaPts_[index]); +} + +void defiNet::clearVia() { + if (viaNames_) { + struct defiPoints* p; + for (int i = 0; i < numPts_; i++) { + if (viaNames_[i]) { + free((char*)(viaNames_[i])); + } + if (viaRouteStatus_[i]) { + free ((char*)(viaRouteStatus_[i])); + } + if (viaShapeTypes_[i]) { + free ((char*)(viaShapeTypes_[i])); + } + if (viaRouteStatusShieldNames_[i]) { + free ((char*)(viaRouteStatusShieldNames_[i])); + } + p = viaPts_[i]; + free((char*)(p->x)); + free((char*)(p->y)); + free((char*)(viaPts_[i])); + } + if (viaMasks_) { + free((char*)(viaMasks_)); + } + if (viaOrients_) { + free((char*)(viaOrients_)); + } + if (viaNames_) { + free((char*)(viaNames_)); + } + if (viaRouteStatus_) { + free((char*)(viaRouteStatus_)); + } + if (viaShapeTypes_) { + free((char*)(viaShapeTypes_)); + } + if (viaRouteStatusShieldNames_) { + free((char*)(viaRouteStatusShieldNames_)); + } + if (viaPts_) { + free((char*)(viaPts_)); + } + } + + viaMasks_ = 0; + viaOrients_ = 0; + numPts_ = 0; + ptsAllocated_ = 0; + viaPts_ = 0; + viaRouteStatus_ = 0; + viaShapeTypes_ = 0; + viaRouteStatusShieldNames_ = 0; + viaNames_ = 0; +} + +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defiNet.hpp b/src/def/def/defiNet.hpp new file mode 100644 index 00000000..eee49046 --- /dev/null +++ b/src/def/def/defiNet.hpp @@ -0,0 +1,583 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2017, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: icftcm $ +// $Revision: #2 $ +// $Date: 2017/06/19 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiNet_h +#define defiNet_h + +#include +#include "defiKRDefs.hpp" +#include "defiPath.hpp" +#include "defiMisc.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +class defrData; + +/* Return codes for defiNet::viaOrient + DEF_ORIENT_N 0 + DEF_ORIENT_W 1 + DEF_ORIENT_S 2 + DEF_ORIENT_E 3 + DEF_ORIENT_FN 4 + DEF_ORIENT_FW 5 + DEF_ORIENT_FS 6 + DEF_ORIENT_FE 7 +*/ + +class defiWire { +public: + defiWire(defrData *data); + ~defiWire(); + DEF_COPY_CONSTRUCTOR_H( defiWire ); + DEF_ASSIGN_OPERATOR_H( defiWire ); + + void Init(const char* type, const char* wireShieldName); + void Destroy(); + void clear(); + void addPath(defiPath *p, int reset, int netOsnet, int *needCbk); + + const char* wireType() const; + const char* wireShieldNetName() const; + int numPaths() const; + + defiPath* path(int index); + const defiPath* path(int index) const; + + void bumpPaths(long long size); + +protected: + char* type_; + char* wireShieldName_; // It only set from specialnet SHIELD, 5.4 + int numPaths_; + long long pathsAllocated_; + defiPath** paths_; + + defrData *defData; +}; + + + +class defiSubnet { +public: + defiSubnet(defrData *data); + void Init(); + + DEF_COPY_CONSTRUCTOR_H( defiSubnet ); + DEF_ASSIGN_OPERATOR_H( defiSubnet ); + + void Destroy(); + ~defiSubnet(); + + void setName(const char* name); + void setNonDefault(const char* name); + void addPin(const char* instance, const char* pin, int syn); + void addMustPin(const char* instance, const char* pin, int syn); + + // WMD -- the following will be removed by the next release + void setType(const char* typ); // Either FIXED COVER ROUTED + void addPath(defiPath* p, int reset, int netOsnet, int *needCbk); + + // NEW: a net can have more than 1 wire + void addWire(const char *typ); + void addWirePath(defiPath *p, int reset, int netOsnet, int *needCbk); + + // Debug printing + void print(FILE* f) const; + + const char* name() const; + int numConnections() const; + const char* instance(int index) const; + const char* pin(int index) const; + int pinIsSynthesized(int index) const; + int pinIsMustJoin(int index) const; + + // WMD -- the following will be removed by the next release + int isFixed() const; + int isRouted() const; + int isCover() const; + + int hasNonDefaultRule() const; + + // WMD -- the following will be removed by the next release + int numPaths() const; + defiPath* path(int index); + const defiPath* path(int index) const; + + const char* nonDefaultRule() const; + + int numWires() const; + defiWire* wire(int index); + const defiWire* wire(int index) const; + + void bumpName(long long size); + void bumpPins(long long size); + void bumpPaths(long long size); + void clear(); + +protected: + char* name_; // name. + int nameSize_; // allocated size of name. + int numPins_; // number of pins used in array. + long long pinsAllocated_; // number of pins allocated in array. + char** instances_; // instance names for connections + char** pins_; // pin names for connections + char* synthesized_; // synthesized flags for pins + char* musts_; // must-join flags + + // WMD -- the following will be removed by the next release + char isFixed_; // net type + char isRouted_; + char isCover_; + defiPath** paths_; // paths for this subnet + int numPaths_; // number of paths used + long long pathsAllocated_; // allocated size of paths array + + int numWires_; // number of wires defined in the subnet + long long wiresAllocated_; // number of wires allocated in the subnet + defiWire** wires_; // this replace the paths + char* nonDefaultRule_; + + defrData *defData; +}; + + + +class defiVpin { +public: + defiVpin(defrData *data); + ~defiVpin(); + + DEF_COPY_CONSTRUCTOR_H( defiVpin ); + DEF_ASSIGN_OPERATOR_H( defiVpin ); + + void Init(const char* name); + void Destroy(); + void setLayer(const char* name); + void setBounds(int xl, int yl, int xh, int yh); + void setOrient(int orient); + void setLoc(int x, int y); + void setStatus(char st); + + int xl() const ; + int yl() const ; + int xh() const ; + int yh() const ; + char status() const; /* P-placed, F-fixed, C-cover, ' ' - not set */ + int orient() const ; + const char* orientStr() const ; + int xLoc() const; + int yLoc() const; + const char* name() const; + const char* layer() const; + +protected: + int xl_; + int yl_; + int xh_; + int yh_; + int orient_; /* 0-7 -1 is no orient */ + char status_; /* P-placed F-fixed C-cover ' '- none */ + int xLoc_; + int yLoc_; + char* name_; + char* layer_; + + defrData *defData; +}; + + + +// Pre 5.4 +class defiShield { +public: + defiShield(defrData *data); + ~defiShield(); + + DEF_COPY_CONSTRUCTOR_H( defiShield ); + DEF_ASSIGN_OPERATOR_H( defiShield ); + + void Init(const char* name); + void Destroy(); + void clear(); + void addPath(defiPath *p, int reset, int netOsnet, int *needCbk); + + const char* shieldName() const; + int numPaths() const; + + defiPath* path(int index); + const defiPath* path(int index) const; + + void bumpPaths(long long size); + +protected: + char* name_; + int numPaths_; + long long pathsAllocated_; + defiPath** paths_; + + defrData *defData; +}; + + + + +// Struct holds the data for one component. +class defiNet { +public: + defiNet(defrData *data); + void Init(); + + DEF_COPY_CONSTRUCTOR_H( defiNet ); + DEF_ASSIGN_OPERATOR_H( defiNet ); + + void Destroy(); + ~defiNet(); + + // Routines used by YACC to set the fields in the net. + void setName(const char* name); + void addPin(const char* instance, const char* pin, int syn); + void addMustPin(const char* instance, const char* pin, int syn); + void setWeight(int w); + + // WMD -- the following will be removed by the next release + void setType(const char* typ); // Either FIXED COVER ROUTED + + void addProp(const char* name, const char* value, const char type); + void addNumProp(const char* name, const double d, + const char* value, const char type); + void addSubnet(defiSubnet* subnet); + // NEW: a net can have more than 1 wire + void addWire(const char *typ, const char* wireShieldName); + void addWirePath(defiPath* p, int reset, int netOsnet, int *needCbk); + void addShape(const char *shapeType); // 5.8 + void setSource(const char* typ); + void setFixedbump(); // 5.4.1 + void setFrequency(double frequency); // 5.4.1 + void setOriginal(const char* typ); + void setPattern(const char* typ); + void setCap(double w); + void setUse(const char* typ); + void setNonDefaultRule(const char* typ); + void setStyle(int style); + void addShield(const char* shieldNetName); // pre 5.4 + void addNoShield(const char* shieldNetName); // pre 5.4 + void addShieldNet(const char* shieldNetName); + + void addShieldPath(defiPath* p, int reset, int netOsnet, int *needCbk); + void clear(); + void setWidth(const char* layer, double dist); + void setSpacing(const char* layer, double dist); + void setVoltage(double num); + void setRange(double left, double right); + void setXTalk(int num); + void addVpin(const char* name); + void addVpinLayer(const char* name); + void addVpinLoc(const char* status, int x, int y, int orient); + void addVpinBounds(int xl, int yl, int xh, int yh); + // 5.6 + void addPolygon(const char* layerName, defiGeometries* geom, int *needCbk, + int mask, const char* routeStatus, + const char* shapeType, + const char* shieldNetName); + void addRect(const char* layerName, int xl, int yl, int xh, int yh, + int *needCbk, int mask, const char* routeStatus, + const char* shapeType, + const char* shieldNetName); // 5.6 + void addPts(const char* viaName, int o, defiGeometries* geom, + int *needCbk, int mask, const char* routeStatus, + const char* shapeType, + const char* shieldNetName); //VIA 5.8 + + // For OA to modify the netName, id & pinName + void changeNetName(const char* name); + void changeInstance(const char* name, int index); + void changePin(const char* name, int index); + + // Routines to return the value of net data. + const char* name() const; + int weight() const; + int numProps() const; + const char* propName(int index) const; + const char* propValue(int index) const; + double propNumber(int index) const; + char propType(int index) const; + int propIsNumber(int index) const; + int propIsString(int index) const; + int numConnections() const; + const char* instance(int index) const; + const char* pin(int index) const; + int pinIsMustJoin(int index) const; + int pinIsSynthesized(int index) const; + int numSubnets() const; + + defiSubnet* subnet(int index); + const defiSubnet* subnet(int index) const; + + // WMD -- the following will be removed by the next release + int isFixed() const; + int isRouted() const; + int isCover() const; + + /* The following routines are for wiring */ + int numWires() const; + + defiWire* wire(int index); + const defiWire* wire(int index) const; + + /* Routines to get the information about Virtual Pins. */ + int numVpins() const; + + defiVpin* vpin(int index); + const defiVpin* vpin(int index) const; + + int hasProps() const; + int hasWeight() const; + int hasSubnets() const; + int hasSource() const; + int hasFixedbump() const; // 5.4.1 + int hasFrequency() const; // 5.4.1 + int hasPattern() const; + int hasOriginal() const; + int hasCap() const; + int hasUse() const; + int hasStyle() const; + int hasNonDefaultRule() const; + int hasVoltage() const; + int hasSpacingRules() const; + int hasWidthRules() const; + int hasXTalk() const; + + int numSpacingRules() const; + void spacingRule(int index, char** layer, double* dist, double* left, + double* right) const; + int numWidthRules() const; + void widthRule(int index, char** layer, double* dist) const; + double voltage() const; + + int XTalk() const; + const char* source() const; + double frequency() const; + const char* original() const; + const char* pattern() const; + double cap() const; + const char* use() const; + int style() const; + const char* nonDefaultRule() const; + + // WMD -- the following will be removed by the next release + int numPaths() const; + + defiPath* path(int index); + const defiPath* path(int index) const; + + int numShields() const; // pre 5.4 + + defiShield* shield(int index); // pre 5.4 + const defiShield* shield(int index) const ; // pre 5.4 + + int numShieldNets() const; + const char* shieldNet(int index) const; + int numNoShields() const; // pre 5.4 + + defiShield* noShield(int index); // pre 5.4 + const defiShield* noShield(int index) const; // pre 5.4 + + // 5.6 + int numPolygons() const; // 5.6 + const char* polygonName(int index) const; // 5.6 + struct defiPoints getPolygon(int index) const; // 5.6 + int polyMask(int index) const; + const char* polyRouteStatus(int index) const; + const char* polyRouteStatusShieldName(int index) const; + const char* polyShapeType(int index) const; + + + int numRectangles() const; // 5.6 + const char* rectName(int index) const; // 5.6 + int xl(int index)const; // 5.6 + int yl(int index)const; // 5.6 + int xh(int index)const; // 5.6 + int yh(int index)const; // 5.6 + int rectMask(int index)const; + const char* rectRouteStatus(int index) const; + const char* rectRouteStatusShieldName(int index) const; + const char* rectShapeType(int index) const; + + + // 5.8 + int numViaSpecs() const; + struct defiPoints getViaPts(int index) const; + const char* viaName(int index) const; + int viaOrient(int index) const; + const char* viaOrientStr(int index) const; + int topMaskNum(int index) const; + int cutMaskNum(int index) const; + int bottomMaskNum(int index) const; + const char* viaRouteStatus(int index) const; + const char* viaRouteStatusShieldName(int index) const; + const char* viaShapeType(int index) const; + + // Debug printing + void print(FILE* f) const; + + + void bumpName(long long size); + void bumpPins(long long size); + void bumpProps(long long size); + void bumpSubnets(long long size); + void bumpPaths(long long size); + void bumpShieldNets(long long size); + + // The method freeWire() is added is user select to have a callback + // per wire within a net This is an internal method and is not public + void freeWire(); + void freeShield(); + + // Clear the rectangles & polygons data if partial path callback is set + void clearRectPolyNPath(); + void clearRectPoly(); + void clearVia(); + +protected: + char* name_; // name. + int nameSize_; // allocated size of name. + int numPins_; // number of pins used in array. + long long pinsAllocated_; // number of pins allocated in array. + char** instances_; // instance names for connections + char** pins_; // pin names for connections + char* musts_; // must-join flags for pins + char* synthesized_; // synthesized flags for pins + int weight_; // net weight + char hasWeight_; // flag for optional weight + + // WMD -- the following will be removed by the nex release + char isFixed_; // net type + char isRouted_; + char isCover_; + + char hasCap_; // file supplied a capacitance value + char hasFrequency_; // file supplied a frequency value + char hasVoltage_; + int numProps_; // num of props in array + char** propNames_; // Prop names + char** propValues_; // Prop values All in strings! + double* propDValues_; // Prop values in numbers! + char* propTypes_; // Prop types, 'I' - Integer, 'R' - Real, 'S' - String + + long long propsAllocated_; // allocated size of props array + int numSubnets_; // num of subnets in array + defiSubnet** subnets_; // Prop names + long long subnetsAllocated_; // allocated size of props array + double cap_; // cap value + char* source_; + int fixedbump_; // 5.4.1 + double frequency_; // 5.4.1 + char* pattern_; + char* original_; + char* use_; + char* nonDefaultRule_; + int style_; + + // WMD -- the following will be removed by the nex release + defiPath** paths_; // paths for this subnet + int numPaths_; // number of paths used + long long pathsAllocated_; // allocated size of paths array + + double voltage_; + + int numWires_; // number of wires defined in the net + long long wiresAllocated_; // allocated size of wire paths array + defiWire** wires_; // this replace the paths + + long long widthsAllocated_; + int numWidths_; + char** wlayers_; + double* wdist_; + + long long spacingAllocated_; + int numSpacing_; + char** slayers_; + double* sdist_; + double* sleft_; + double* sright_; + int xTalk_; + + int numVpins_; + long long vpinsAllocated_; + defiVpin** vpins_; + + int numShields_; // number of SHIELD paths used + long long shieldsAllocated_; // allocated size of SHIELD paths array + defiShield** shields_; // SHIELD data + int numNoShields_; // number of NOSHIELD paths used + + int numShieldNet_; // number of SHIELDNETS used in array. + long long shieldNetsAllocated_; // number of SHIELDNETS allocated in array. + char** shieldNet_; // name of the SHIELDNET + + int numPolys_; // 5.6 + char** polygonNames_; // 5.6 layerName for POLYGON + long long polysAllocated_; // 5.6 + struct defiPoints** polygons_; // 5.6 + int* polyMasks_; + char** polyRouteStatus_; + char** polyShapeTypes_; + char** polyRouteStatusShieldNames_; + + int numRects_; // 5.6 + long long rectsAllocated_; // 5.6 + char** rectNames_; // 5.6 + int* xl_; + int* yl_; + int* xh_; + int* yh_; + int* rectMasks_; + char** rectRouteStatus_; + char** rectRouteStatusShieldNames_; + char** rectShapeTypes_; + + + struct defiPoints** viaPts_; // 5.8 + char** viaNames_; + int numPts_; + long long ptsAllocated_; + int* viaOrients_; + int* viaMasks_; + char** viaRouteStatus_; + char** viaRouteStatusShieldNames_; + char** viaShapeTypes_; + + defrData *defData; +}; + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiNonDefault.cpp b/src/def/def/defiNonDefault.cpp new file mode 100644 index 00000000..da696fee --- /dev/null +++ b/src/def/def/defiNonDefault.cpp @@ -0,0 +1,707 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2015, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include "lex.h" +#include "defiNonDefault.hpp" +#include "defiDebug.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +///////////////////////////////////////// +///////////////////////////////////////// +// +// defiNonDefault +// +///////////////////////////////////////// +///////////////////////////////////////// + +defiNonDefault::defiNonDefault(defrData *data) +: defData(data) { + Init(); +} + +void defiNonDefault::Init() { + name_ = 0; + hardSpacing_ = 0; + numLayers_ = 0; + width_ = 0; + hasDiagWidth_ = 0; + hasSpacing_ = 0; + hasWireExt_ = 0; + numVias_ = 0; + viasAllocated_ = 0; + viaNames_ = 0; + numViaRules_ = 0; + viaRulesAllocated_ = 0; + viaRuleNames_ = 0; + numMinCuts_ = 0; + minCutsAllocated_ = 0; + cutLayerName_ = 0; + numCuts_ = 0; + numProps_ = 0; + propsAllocated_ = 0; + names_ = 0; + values_ = 0; + dvalues_ = 0; + types_ = 0; + layersAllocated_ = 0; + layerName_ = 0; + width_ = 0; + hasDiagWidth_ = 0; + diagWidth_ = 0; + hasSpacing_ = 0; + spacing_ = 0; + hasWireExt_ = 0; + wireExt_ = 0; +} + +defiNonDefault::~defiNonDefault() { + Destroy(); +} + +void defiNonDefault::Destroy() { + clear(); + if (propsAllocated_) { + free((char*)(names_)); + free((char*)(values_)); + free((char*)(dvalues_)); + free((char*)(types_)); + } + if (layersAllocated_) { + free((char*)(layerName_)); + free((char*)(width_)); + free((char*)(hasDiagWidth_)); + free((char*)(diagWidth_)); + free((char*)(hasSpacing_)); + free((char*)(spacing_)); + free((char*)(hasWireExt_)); + free((char*)(wireExt_)); + } + if (viasAllocated_) + free((char*)(viaNames_)); + if (viaRulesAllocated_) + free((char*)(viaRuleNames_)); + if (minCutsAllocated_) { + free((char*)(cutLayerName_)); + free((char*)(numCuts_)); + } +} + +void defiNonDefault::clear() { + int i; + + if (name_) + free(name_); + hardSpacing_ = 0; + for (i = 0; i < numProps_; i++) { + free(names_[i]); + free(values_[i]); + dvalues_[i] = 0; + } + numProps_ = 0; + for (i = 0; i < numLayers_; i++) + free(layerName_[i]); + numLayers_ = 0; + for (i = 0; i < numVias_; i++) + free((char*)(viaNames_[i])); + numVias_ = 0; + for (i = 0; i < numViaRules_; i++) + free((char*)(viaRuleNames_[i])); + numViaRules_ = 0; + for (i = 0; i < numMinCuts_; i++) + free((char*)(cutLayerName_[i])); + numMinCuts_ = 0; +} + +void defiNonDefault::setName(const char* name) { + name_ = (char*)malloc(strlen(name)+1); + strcpy(name_, defData->DEFCASE(name)); +} + +void defiNonDefault::setHardspacing() { + hardSpacing_ = 1; +} + +void defiNonDefault::addLayer(const char* name) { + int len = strlen(name) + 1; + if (numLayers_ == layersAllocated_) { + int i; + char** newl; + double* neww; + double* newd; + double* news; + double* newe; + char* newhd; + char* newhs; + char* newhe; + + if (layersAllocated_ == 0) + layersAllocated_ = 2; + else + layersAllocated_ *= 2; + newl = (char**)malloc(sizeof(char*) * layersAllocated_); + newe = (double*)malloc(sizeof(double) * layersAllocated_); + neww = (double*)malloc(sizeof(double) * layersAllocated_); + newd = (double*)malloc(sizeof(double) * layersAllocated_); + news = (double*)malloc(sizeof(double) * layersAllocated_); + newhe = (char*)malloc(sizeof(char) * layersAllocated_); + newhd = (char*)malloc(sizeof(char) * layersAllocated_); + newhs = (char*)malloc(sizeof(char) * layersAllocated_); + for (i = 0; i < numLayers_; i++) { + newl[i] = layerName_[i]; + neww[i] = width_[i]; + newd[i] = diagWidth_[i]; + news[i] = spacing_[i]; + newe[i] = wireExt_[i]; + newhe[i] = hasWireExt_[i]; + newhd[i] = hasDiagWidth_[i]; + newhs[i] = hasSpacing_[i]; + } + if (layersAllocated_ > 2) { + free((char*)(layerName_)); + free((char*)(width_)); + free((char*)(diagWidth_)); + free((char*)(spacing_)); + free((char*)(wireExt_)); + free((char*)(hasWireExt_)); + free((char*)(hasDiagWidth_)); + free((char*)(hasSpacing_)); + } + layerName_ = newl; + width_ = neww; + diagWidth_ = newd; + spacing_ = news; + wireExt_ = newe; + hasDiagWidth_ = newhd; + hasSpacing_ = newhs; + hasWireExt_ = newhe; + } + layerName_[numLayers_] = (char*)malloc(len); + strcpy(layerName_[numLayers_], defData->DEFCASE(name)); + width_[numLayers_] = 0.0; + diagWidth_[numLayers_] = 0.0; + spacing_[numLayers_] = 0.0; + wireExt_[numLayers_] = 0.0; + hasDiagWidth_[numLayers_] = '\0'; + hasSpacing_[numLayers_] = '\0'; + hasWireExt_[numLayers_] = '\0'; + numLayers_ += 1; +} + +void defiNonDefault::addWidth(double num) { + width_[numLayers_-1] = num; +} + +void defiNonDefault::addDiagWidth(double num) { + diagWidth_[numLayers_-1] = num; + hasDiagWidth_[numLayers_-1] = 1; +} + +void defiNonDefault::addSpacing(double num) { + spacing_[numLayers_-1] = num; + hasSpacing_[numLayers_-1] = 1; +} + +void defiNonDefault::addWireExt(double num) { + wireExt_[numLayers_-1] = num; + hasWireExt_[numLayers_-1] = 1; +} + +void defiNonDefault::addVia(const char* name) { + if (numVias_ == viasAllocated_) { + int i; + char** vn; + + if (viasAllocated_ == 0) + viasAllocated_ = 2; + else + viasAllocated_ *= 2; + vn = (char**)malloc(sizeof(char*)* viasAllocated_); + for (i = 0; i < numVias_; i++) { + vn[i] = viaNames_[i]; + } + free((char*)(viaNames_)); + viaNames_ = vn; + } + viaNames_[numVias_] = (char*)malloc(strlen(name)+1); + strcpy(viaNames_[numVias_], defData->DEFCASE(name)); + numVias_ += 1; +} + +void defiNonDefault::addViaRule(const char* name) { + if (numViaRules_ == viaRulesAllocated_) { + int i; + char** vn; + + if (viaRulesAllocated_ == 0) + viaRulesAllocated_ = 2; + else + viaRulesAllocated_ *= 2; + vn = (char**)malloc(sizeof(char*)* viaRulesAllocated_); + for (i = 0; i < numViaRules_; i++) { + vn[i] = viaRuleNames_[i]; + } + free((char*)(viaRuleNames_)); + viaRuleNames_ = vn; + } + viaRuleNames_[numViaRules_] = (char*)malloc(strlen(name)+1); + strcpy(viaRuleNames_[numViaRules_], defData->DEFCASE(name)); + numViaRules_ += 1; +} + +void defiNonDefault::addMinCuts(const char* name, int numCuts) { + if (numMinCuts_ == minCutsAllocated_) { + int i; + char** cln; + int* nc; + + if (minCutsAllocated_ == 0) + minCutsAllocated_ = 2; + else + minCutsAllocated_ *= 2; + cln = (char**)malloc(sizeof(char*)* minCutsAllocated_); + nc = (int*)malloc(sizeof(int)* minCutsAllocated_); + for (i = 0; i < numMinCuts_; i++) { + cln[i] = cutLayerName_[i]; + nc[i] = numCuts_[i]; + } + if (minCutsAllocated_ > 2) { + free((char*)(cutLayerName_)); + free((char*)(numCuts_)); + } + cutLayerName_ = cln; + numCuts_ = nc; + } + cutLayerName_[numMinCuts_] = (char*)malloc(strlen(name)+1); + strcpy(cutLayerName_[numMinCuts_], defData->DEFCASE(name)); + numCuts_[numMinCuts_] = numCuts; + numMinCuts_ += 1; +} + +const char* defiNonDefault::name() const { + return name_; +} + +int defiNonDefault::hasHardspacing() const { + return hardSpacing_; +} + +int defiNonDefault::numLayers() const { + return numLayers_; +} + +const char* defiNonDefault::layerName(int index) const { + char msg[256]; + if (index < 0 || index >= numLayers_) { + sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numLayers_); + defiError(0, 6090, msg, defData); + return 0; + } + return layerName_[index]; +} + +// Will be obsoleted in 5.7 +double defiNonDefault::layerWidth(int index) const { + char msg[256]; + if (index < 0 || index >= numLayers_) { + sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numLayers_); + defiError(0, 6090, msg, defData); + return 0; + } + return width_[index]; +} + +int defiNonDefault::layerWidthVal(int index) const { + char msg[256]; + if (index < 0 || index >= numLayers_) { + sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numLayers_); + defiError(0, 6090, msg, defData); + return 0; + } + return (int)width_[index]; +} + +int defiNonDefault::hasLayerDiagWidth(int index) const { + char msg[256]; + if (index < 0 || index >= numLayers_) { + sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numLayers_); + defiError(0, 6090, msg, defData); + return 0; + } + return hasDiagWidth_[index]; +} + +// Will be obsoleted in 5.7 +double defiNonDefault::layerDiagWidth(int index) const { + char msg[256]; + if (index < 0 || index >= numLayers_) { + sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numLayers_); + defiError(0, 6090, msg, defData); + return 0; + } + return diagWidth_[index]; +} + +int defiNonDefault::layerDiagWidthVal(int index) const { + char msg[256]; + if (index < 0 || index >= numLayers_) { + sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numLayers_); + defiError(0, 6090, msg, defData); + return 0; + } + return (int)diagWidth_[index]; +} + +int defiNonDefault::hasLayerWireExt(int index) const { + char msg[256]; + if (index < 0 || index >= numLayers_) { + sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numLayers_); + defiError(0, 6090, msg, defData); + return 0; + } + return hasWireExt_[index]; +} + +int defiNonDefault::hasLayerSpacing(int index) const { + char msg[256]; + if (index < 0 || index >= numLayers_) { + sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numLayers_); + defiError(0, 6090, msg, defData); + return 0; + } + return hasSpacing_[index]; +} + +// Will be obsoleted in 5.7 +double defiNonDefault::layerWireExt(int index) const { + char msg[256]; + if (index < 0 || index >= numLayers_) { + sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numLayers_); + defiError(0, 6090, msg, defData); + return 0; + } + return wireExt_[index]; +} + +int defiNonDefault::layerWireExtVal(int index) const { + char msg[256]; + if (index < 0 || index >= numLayers_) { + sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numLayers_); + defiError(0, 6090, msg, defData); + return 0; + } + return (int)wireExt_[index]; +} + +// Will be obsoleted in 5.7 +double defiNonDefault::layerSpacing(int index) const { + char msg[256]; + if (index < 0 || index >= numLayers_) { + sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numLayers_); + defiError(0, 6090, msg, defData); + return 0; + } + return spacing_[index]; +} + +int defiNonDefault::layerSpacingVal(int index) const { + char msg[256]; + if (index < 0 || index >= numLayers_) { + sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numLayers_); + defiError(0, 6090, msg, defData); + return 0; + } + return (int)spacing_[index]; +} + +int defiNonDefault::numVias() const { + return numVias_; +} + +const char* defiNonDefault::viaName(int index) const { + char msg[256]; + if (index < 0 || index >= numVias_) { + sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numLayers_); + defiError(0, 6090, msg, defData); + return 0; + } + return viaNames_[index]; +} + +int defiNonDefault::numViaRules() const { + return numViaRules_; +} + +const char* defiNonDefault::viaRuleName(int index) const { + char msg[256]; + if (index < 0 || index >= numViaRules_) { + sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numLayers_); + defiError(0, 6090, msg, defData); + return 0; + } + return viaRuleNames_[index]; +} + +int defiNonDefault::numMinCuts() const { + return numMinCuts_; +} + +const char* defiNonDefault::cutLayerName(int index) const { + char msg[256]; + if (index < 0 || index >= numMinCuts_) { + sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numLayers_); + defiError(0, 6090, msg, defData); + return 0; + } + return cutLayerName_[index]; +} + +int defiNonDefault::numCuts(int index) const { + char msg[256]; + if (index < 0 || index >= numMinCuts_) { + sprintf (msg, "ERROR (DEFPARS-6090): The index number %d specified for the NONDEFAULT LAYER is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numLayers_); + defiError(0, 6090, msg, defData); + return 0; + } + return numCuts_[index]; +} + +void defiNonDefault::print(FILE* f) const { + int i; + + fprintf(f, "nondefaultrule %s\n", name()); + + fprintf(f, "%d layers %d vias %d viarules %d mincuts\n", + numLayers(), + numVias(), + numViaRules(), + numMinCuts()); + + for (i = 0; i < numLayers(); i++) { + fprintf(f, " Layer %s\n", layerName(i)); + fprintf(f, " WIDTH %g\n", layerWidth(i)); + if (hasLayerDiagWidth(i)) + fprintf(f, " DIAGWIDTH %g\n", layerDiagWidth(i)); + if (hasLayerSpacing(i)) + fprintf(f, " SPACING %g\n", layerSpacing(i)); + if (hasLayerWireExt(i)) + fprintf(f, " WIREEXT %g\n", + layerWireExt(i)); + } + for (i = 0; i < numVias(); i++) { + fprintf(f, " VIA %s\n", viaName(i)); + } + for (i = 0; i < numViaRules(); i++) { + fprintf(f, " VIARULE %s\n", viaRuleName(i)); + } + for (i = 0; i < numMinCuts(); i++) { + fprintf(f, " MINCUTS %s %d\n", cutLayerName(i), + numCuts(i)); + } +} + +int defiNonDefault::numProps() const { + return numProps_; +} + +void defiNonDefault::addProperty(const char* name, const char* value, + const char type) { + int len = strlen(name) + 1; + if (numProps_ == propsAllocated_) { + int i; + int max; + int lim = numProps_; + char** nn; + char** nv; + double* nd; + char* nt; + + if (propsAllocated_ == 0) + max = propsAllocated_ = 2; + else + max = propsAllocated_ *= 2; + nn = (char**)malloc(sizeof(char*) * max); + nv = (char**)malloc(sizeof(char*) * max); + nd = (double*)malloc(sizeof(double) * max); + nt = (char*)malloc(sizeof(char) * max); + for (i = 0; i < lim; i++) { + nn[i] = names_[i]; + nv[i] = values_[i]; + nd[i] = dvalues_[i]; + nt[i] = types_[i]; + } + free((char*)(names_)); + free((char*)(values_)); + free((char*)(dvalues_)); + free((char*)(types_)); + names_ = nn; + values_ = nv; + dvalues_ = nd; + types_ = nt; + } + names_[numProps_] = (char*)malloc(sizeof(char)*len); + strcpy(names_[numProps_],name); + len = strlen(value) + 1; + values_[numProps_] = (char*)malloc(sizeof(char) * len); + strcpy(values_[numProps_],value); + dvalues_[numProps_] = 0; + types_[numProps_] = type; + numProps_ += 1; +} + +void defiNonDefault::addNumProperty(const char* name, const double d, + const char* value, const char type) { + int len = strlen(name) + 1; + if (numProps_ == propsAllocated_) { + int i; + int max; + int lim = numProps_; + char** nn; + char** nv; + double* nd; + char* nt; + + if (propsAllocated_ == 0) + max = propsAllocated_ = 2; + else + max = propsAllocated_ *= 2; + nn = (char**)malloc(sizeof(char*) * max); + nv = (char**)malloc(sizeof(char*) * max); + nd = (double*)malloc(sizeof(double) * max); + nt = (char*)malloc(sizeof(char) * max); + for (i = 0; i < lim; i++) { + nn[i] = names_[i]; + nv[i] = values_[i]; + nd[i] = dvalues_[i]; + nt[i] = types_[i]; + } + free((char*)(names_)); + free((char*)(values_)); + free((char*)(dvalues_)); + free((char*)(types_)); + names_ = nn; + values_ = nv; + dvalues_ = nd; + types_ = nt; + } + names_[numProps_] = (char*)malloc(sizeof(char) * len); + strcpy(names_[numProps_],name); + len = strlen(value) + 1; + values_[numProps_] = (char*)malloc(sizeof(char) * len); + strcpy(values_[numProps_],value); + dvalues_[numProps_] = d; + types_[numProps_] = type; + numProps_ += 1; +} + +const char* defiNonDefault::propName(int index) const { + char msg[256]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (DEFPARS-6091): The index number %d specified for the NONDEFAULT PROPERTY is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numProps_); + defiError(0, 6091, msg, defData); + return 0; + } + return names_[index]; +} + +const char* defiNonDefault::propValue(int index) const { + char msg[256]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (DEFPARS-6091): The index number %d specified for the NONDEFAULT PROPERTY is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numProps_); + defiError(0, 6091, msg, defData); + return 0; + } + return values_[index]; +} + +double defiNonDefault::propNumber(int index) const { + char msg[256]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (DEFPARS-6091): The index number %d specified for the NONDEFAULT PROPERTY is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numProps_); + defiError(0, 6091, msg, defData); + return 0; + } + return dvalues_[index]; +} + +char defiNonDefault::propType(int index) const { + char msg[256]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (DEFPARS-6091): The index number %d specified for the NONDEFAULT PROPERTY is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numProps_); + defiError(0, 6091, msg, defData); + return 0; + } + return types_[index]; +} + +int defiNonDefault::propIsNumber(int index) const { + char msg[256]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (DEFPARS-6091): The index number %d specified for the NONDEFAULT PROPERTY is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numProps_); + defiError(0, 6091, msg, defData); + return 0; + } + return dvalues_[index] ? 1 : 0; +} + +int defiNonDefault::propIsString(int index) const { + char msg[256]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (DEFPARS-6091): The index number %d specified for the NONDEFAULT PROPERTY is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again.", + index, numProps_); + defiError(0, 6091, msg, defData); + return 0; + } + return dvalues_[index] ? 0 : 1; +} +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defiNonDefault.hpp b/src/def/def/defiNonDefault.hpp new file mode 100644 index 00000000..01f4f8a7 --- /dev/null +++ b/src/def/def/defiNonDefault.hpp @@ -0,0 +1,141 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiNonDefault_h +#define defiNonDefault_h + +#include +#include "defiKRDefs.hpp" +#include "defiMisc.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +class defiNonDefault { +public: + defiNonDefault(defrData *data); + void Init(); + + void Destroy(); + ~defiNonDefault(); + + void clear(); + void setName(const char* name); + void setHardspacing(); + void addLayer(const char* name); + void addWidth(double num); + void addDiagWidth(double num); + void addSpacing(double num); + void addWireExt(double num); + void addVia(const char* name); + void addViaRule(const char* name); + void addMinCuts(const char* name, int numCuts); + void addProperty(const char* name, const char* value, const char type); + void addNumProperty(const char* name, const double d, + const char* value, const char type); + void end(); + + const char* name() const; + int hasHardspacing() const; + + int numProps() const; + const char* propName(int index) const; + const char* propValue(int index) const; + double propNumber(int index) const; + char propType(int index) const; + int propIsNumber(int index) const; + int propIsString(int index) const; + + // A non default rule can have one or more layers. + // The layer information is kept in an array. + int numLayers() const ; + const char* layerName(int index) const ; + double layerWidth(int index) const ; // Will be obsoleted in 5.7 + int layerWidthVal(int index) const ; + int hasLayerDiagWidth(int index) const; + double layerDiagWidth(int index) const; // Will be obsoleted in 5.7 + int layerDiagWidthVal(int index) const; + int hasLayerSpacing(int index) const ; + double layerSpacing(int index) const ; // Will be obsoleted in 5.7 + int layerSpacingVal(int index) const ; + int hasLayerWireExt(int index) const ; + double layerWireExt(int index) const ; // Will be obsoleted in 5.7 + int layerWireExtVal(int index) const ; + int numVias() const ; + const char* viaName(int index) const ; + int numViaRules() const ; + const char* viaRuleName(int index) const ; + int numMinCuts() const; + const char* cutLayerName(int index) const; + int numCuts(int index) const; + + // Debug print + void print(FILE* f) const; + +protected: + char* name_; + char hardSpacing_; + + // Layer information + int numLayers_; + int layersAllocated_; + char** layerName_; + double* width_; + char* hasDiagWidth_; + double* diagWidth_; + char* hasSpacing_; + double* spacing_; + char* hasWireExt_; + double* wireExt_; + + int numVias_; + int viasAllocated_; + char** viaNames_; + int numViaRules_; + int viaRulesAllocated_; + char** viaRuleNames_; + int numMinCuts_; + int minCutsAllocated_; + char** cutLayerName_; + int* numCuts_; + + int numProps_; + int propsAllocated_; + char** names_; + char** values_; + double* dvalues_; + char* types_; + + defrData *defData; +}; + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiPartition.cpp b/src/def/def/defiPartition.cpp new file mode 100644 index 00000000..ce1b1afc --- /dev/null +++ b/src/def/def/defiPartition.cpp @@ -0,0 +1,551 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2015, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include "lex.h" +#include "defiPartition.hpp" +#include "defiDebug.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +////////////////////////////////////////////// +////////////////////////////////////////////// +// +// defiPartition +// +////////////////////////////////////////////// +////////////////////////////////////////////// + + +defiPartition::defiPartition(defrData *data) +: defData(data) +{ + Init(); +} + + +void defiPartition::Init() { + name_ = 0; + nameLength_ = 0; + pin_ = 0; + pinLength_ = 0; + inst_ = 0; + instLength_ = 0; + + pinsAllocated_ = 0; + numPins_ = 0; + pins_ = 0; + + clear(); +} + + +defiPartition::~defiPartition() { + Destroy(); +} + + +void defiPartition::Destroy() { + + if (name_) free(name_); + name_ = 0; + nameLength_ = 0; + if (pin_) free(pin_); + pin_ = 0; + pinLength_ = 0; + if (inst_) free(inst_); + inst_ = 0; + instLength_ = 0; + + clear(); + + if (pins_) free((char*)(pins_)); + pins_ = 0; + pinsAllocated_ = 0; +} + + +void defiPartition::clear() { + int i; + + setup_ = ' '; + hold_ = ' '; + direction_ = ' '; + type_ = ' '; + if (name_) *(name_) = '\0'; + if (pin_) *(pin_) = '\0'; + if (inst_) *(inst_) = '\0'; + hasMin_ = 0; + hasMax_ = 0; + + if (numPins_) { + for (i = 0; i < numPins_; i++) { + free(pins_[i]); + pins_[i] = 0; + } + numPins_ = 0; + } + hasRiseMin_ = 0; + hasFallMin_ = 0; + hasRiseMax_ = 0; + hasFallMax_ = 0; + hasRiseMinRange_ = 0; + hasFallMinRange_ = 0; + hasRiseMaxRange_ = 0; + hasFallMaxRange_ = 0; +} + + +void defiPartition::setName(const char* name) { + int len = strlen(name) + 1; + + clear(); + + if (len > nameLength_) { + if (name_) free(name_); + nameLength_ = len; + name_ = (char*)malloc(len); + } + strcpy(name_, defData->DEFCASE(name)); + +} + + +void defiPartition::print(FILE* f) const { + int i; + + fprintf(f, "Partition '%s' %c\n", + name(), direction()); + fprintf(f, " inst %s pin %s type %s\n", + instName(), pinName(), + itemType()); + + for (i = 0; i < numPins(); i++) + fprintf(f, " %s\n", pin(i)); + + if (isSetupRise()) + fprintf(f, " SETUP RISE\n"); + + if (isSetupFall()) + fprintf(f, " SETUP FALL\n"); + + if (isHoldRise()) + fprintf(f, " HOLD RISE\n"); + + if (isHoldFall()) + fprintf(f, " HOLD FALL\n"); + + if (hasMin()) + fprintf(f, " MIN %g\n", partitionMin()); + + if (hasMax()) + fprintf(f, " MAX %g\n", partitionMax()); + + if (hasRiseMin()) + fprintf(f, " RISE MIN %g\n", riseMin()); + + if (hasFallMin()) + fprintf(f, " FALL MIN %g\n", fallMin()); + + if (hasRiseMax()) + fprintf(f, " RISE MAX %g\n", riseMax()); + + if (hasFallMax()) + fprintf(f, " FALL MAX %g\n", fallMax()); + + if (hasFallMinRange()) + fprintf(f, " FALL MIN %g %g\n", fallMinLeft(), + fallMinRight()); + + if (hasRiseMinRange()) + fprintf(f, " RISE MIN %g %g\n", riseMinLeft(), + riseMinRight()); + + if (hasFallMaxRange()) + fprintf(f, " FALL MAX %g %g\n", fallMaxLeft(), + fallMaxRight()); + + if (hasRiseMaxRange()) + fprintf(f, " RISE MAX %g %g\n", riseMaxLeft(), + riseMaxRight()); +} + + +const char* defiPartition::name() const { + return name_; +} + + +void defiPartition::setFromIOPin(const char* pin) { + set('F', 'I', "", pin); +} + + +char defiPartition::direction() const { + return direction_; +} + + +const char* defiPartition::instName() const { + return inst_; +} + + +const char* defiPartition::pinName() const { + return pin_; +} + + +static char* ad(const char* in) { + return (char*)in; +} + + +const char* defiPartition::itemType() const { + char* c; + if (type_ == 'L') c = ad("CLOCK"); + else if (type_ == 'I') c = ad("IO"); + else if (type_ == 'C') c = ad("COMP"); + else c = ad("BOGUS"); + return c; +} + + +const char* defiPartition::pin(int index) const { + return pins_[index]; +} + + +int defiPartition::numPins() const { + return numPins_; +} + + +int defiPartition::isSetupRise() const { + return setup_ == 'R' ? 1 : 0 ; +} + + +int defiPartition::isSetupFall() const { + return setup_ == 'F' ? 1 : 0 ; +} + + +int defiPartition::isHoldRise() const { + return hold_ == 'R' ? 1 : 0 ; +} + + +int defiPartition::isHoldFall() const { + return hold_ == 'F' ? 1 : 0 ; +} + + +void defiPartition::addTurnOff(const char* setup, const char* hold) { + if (*setup == ' ') { + setup_ = *setup; + } else if (*setup == 'R') { + setup_ = *setup; + } else if (*setup == 'F') { + setup_ = *setup; + } else { + defiError(0, 6100, "ERROR (DEFPARS-6100): The value spefified for PARTITION SETUP is invalid. The valid value for SETUP is 'R' or 'F'. Specify a valid value for SETUP and then try again.", defData); + } + + if (*hold == ' ') { + hold_ = *hold; + } else if (*hold == 'R') { + hold_ = *hold; + } else if (*hold == 'F') { + hold_ = *hold; + } else { + defiError(0, 6101, "ERROR (DEFPARS-6101): The value spefified for PARTITION HOLD is invalid. The valid value for HOLD is 'R' or 'F'. Specify a valid value for HOLD and then try again.", defData); + } + +} + + +void defiPartition::setFromClockPin(const char* inst, const char* pin) { + set('F', 'L', inst, pin); +} + + +void defiPartition::setToClockPin(const char* inst, const char* pin) { + set('T', 'L', inst, pin); +} + + +void defiPartition::set(char dir, char typ, const char* inst, const char* pin) { + int len = strlen(pin) + 1; + direction_ = dir; + type_ = typ; + + if (pinLength_ <= len) { + if (pin_) free(pin_); + pin_ = (char*)malloc(len); + pinLength_ = len; + } + + strcpy(pin_, defData->DEFCASE(pin)); + + len = strlen(inst) + 1; + if (instLength_ <= len) { + if (inst_) free(inst_); + inst_ = (char*)malloc(len); + instLength_ = len; + } + + strcpy(inst_, defData->DEFCASE(inst)); +} + + +void defiPartition::setMin(double min, double max) { + min_ = min; + max_ = max; + hasMin_ = 1; +} + + +void defiPartition::setFromCompPin(const char* inst, const char* pin) { + set('F', 'C', inst, pin); +} + + +void defiPartition::setMax(double min, double max) { + min_ = min; + max_ = max; + hasMax_ = 1; +} + + +void defiPartition::setToIOPin(const char* pin) { + set('T', 'I', "", pin); +} + + +void defiPartition::setToCompPin(const char* inst, const char* pin) { + set('T', 'C', inst, pin); +} + + +void defiPartition::addPin(const char* name) { + int len; + int i; + char** newp; + + if (numPins_ >= pinsAllocated_) { + pinsAllocated_ = pinsAllocated_ ? 2 * pinsAllocated_ : 8; + newp = (char**) malloc(sizeof(char*) * pinsAllocated_); + for (i = 0; i < numPins_; i++) + newp[i] = pins_[i]; + if (pins_) free((char*)(pins_)); + pins_ = newp; + } + + len = strlen(name) + 1; + pins_[numPins_] = (char*)malloc(len); + strcpy(pins_[numPins_], defData->DEFCASE(name)); + numPins_ += 1; +} + + +int defiPartition::hasMin() const { + return(int)(hasMin_); +} + + +int defiPartition::hasMax() const { + return(int)(hasMax_); +} + + +double defiPartition::partitionMin() const { + return(min_); +} + + +double defiPartition::partitionMax() const { + return(max_); +} + +int defiPartition::hasRiseMin() const { + return (int)(hasRiseMin_); +} + + +int defiPartition::hasFallMin() const { + return (int)(hasFallMin_); +} + + +int defiPartition::hasRiseMax() const { + return (int)(hasRiseMax_); +} + + +int defiPartition::hasFallMax() const { + return (int)(hasFallMax_); +} + + +int defiPartition::hasRiseMinRange() const { + return (int)(hasRiseMinRange_); +} + + +int defiPartition::hasFallMinRange() const { + return (int)(hasFallMinRange_); +} + + +int defiPartition::hasRiseMaxRange() const { + return (int)(hasRiseMaxRange_); +} + + +int defiPartition::hasFallMaxRange() const { + return (int)(hasFallMaxRange_); +} + + +double defiPartition::riseMin() const { + return riseMin_; +} + + +double defiPartition::fallMin() const { + return fallMin_; +} + + +double defiPartition::riseMax() const { + return riseMax_; +} + + +double defiPartition::fallMax() const { + return fallMax_; +} + + +double defiPartition::riseMinLeft() const { + return riseMinLeft_; +} + + +double defiPartition::fallMinLeft() const { + return fallMinLeft_; +} + + +double defiPartition::riseMaxLeft() const { + return riseMaxLeft_; +} + + +double defiPartition::fallMaxLeft() const { + return fallMaxLeft_; +} + + +double defiPartition::riseMinRight() const { + return riseMinRight_; +} + + +double defiPartition::fallMinRight() const { + return fallMinRight_; +} + + +double defiPartition::riseMaxRight() const { + return riseMaxRight_; +} + + +double defiPartition::fallMaxRight() const { + return fallMaxRight_; +} + + +void defiPartition::addRiseMin(double d) { + hasRiseMin_ = 1; + riseMin_ = d; +} + + +void defiPartition::addRiseMax(double d) { + hasRiseMax_ = 1; + riseMax_ = d; +} + + +void defiPartition::addFallMin(double d) { + hasFallMin_ = 1; + fallMin_ = d; +} + + +void defiPartition::addFallMax(double d) { + hasFallMax_ = 1; + fallMax_ = d; +} + + +void defiPartition::addRiseMinRange(double l, double h) { + hasRiseMinRange_ = 1; + riseMinLeft_ = l; + riseMinRight_ = h; +} + + +void defiPartition::addRiseMaxRange(double l, double h) { + hasRiseMaxRange_ = 1; + riseMaxLeft_ = l; + riseMaxRight_ = h; +} + + +void defiPartition::addFallMinRange(double l, double h) { + hasFallMinRange_ = 1; + fallMinLeft_ = l; + fallMinRight_ = h; +} + + +void defiPartition::addFallMaxRange(double l, double h) { + hasFallMaxRange_ = 1; + fallMaxLeft_ = l; + fallMaxRight_ = h; +} + + +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defiPartition.hpp b/src/def/def/defiPartition.hpp new file mode 100644 index 00000000..cab976e6 --- /dev/null +++ b/src/def/def/defiPartition.hpp @@ -0,0 +1,163 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiPartition_h +#define defiPartition_h + +#include +#include "defiKRDefs.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +class defrData; + +class defiPartition { +public: + defiPartition(defrData *data); + void Init(); + + void Destroy(); + ~defiPartition(); + + void clear(); + + void setName(const char* name); + void addTurnOff(const char* setup, const char* hold); + void setFromClockPin(const char* inst, const char* pin); + void setFromCompPin(const char* inst, const char* pin); + void setFromIOPin(const char* inst); + void setToClockPin(const char* inst, const char* pin); + void setToCompPin(const char* inst, const char* pin); + void set(char dir, char typ, const char* inst, const char* pin); + void setToIOPin(const char* inst); + void setMin(double min, double max); + void setMax(double min, double max); + void addPin(const char* name); + void addRiseMin(double d); + void addRiseMax(double d); + void addFallMin(double d); + void addFallMax(double d); + void addRiseMinRange(double l, double h); + void addRiseMaxRange(double l, double h); + void addFallMinRange(double l, double h); + void addFallMaxRange(double l, double h); + + const char* name() const; + char direction() const; + const char* itemType() const; // "CLOCK" or "IO" or "COMP" + const char* pinName() const; + const char* instName() const; + + int numPins() const; + const char* pin(int index) const; + + int isSetupRise() const; + int isSetupFall() const; + int isHoldRise() const; + int isHoldFall() const; + int hasMin() const; + int hasMax() const; + int hasRiseMin() const; + int hasFallMin() const; + int hasRiseMax() const; + int hasFallMax() const; + int hasRiseMinRange() const; + int hasFallMinRange() const; + int hasRiseMaxRange() const; + int hasFallMaxRange() const; + + double partitionMin() const; + double partitionMax() const; + + double riseMin() const; + double fallMin() const; + double riseMax() const; + double fallMax() const; + + double riseMinLeft() const; + double fallMinLeft() const; + double riseMaxLeft() const; + double fallMaxLeft() const; + double riseMinRight() const; + double fallMinRight() const; + double riseMaxRight() const; + double fallMaxRight() const; + + // debug print + void print(FILE* f) const; + +protected: + char* name_; + int nameLength_; + char setup_; + char hold_; + char hasMin_; + char hasMax_; + char direction_; // 'F' or 'T' + char type_; // 'L'-clock 'I'-IO 'C'-comp + char* inst_; + int instLength_; + char* pin_; + int pinLength_; + double min_, max_; + + int numPins_; + int pinsAllocated_; + char** pins_; + + char hasRiseMin_; + char hasFallMin_; + char hasRiseMax_; + char hasFallMax_; + char hasRiseMinRange_; + char hasFallMinRange_; + char hasRiseMaxRange_; + char hasFallMaxRange_; + double riseMin_; + double fallMin_; + double riseMax_; + double fallMax_; + double riseMinLeft_; + double fallMinLeft_; + double riseMaxLeft_; + double fallMaxLeft_; + double riseMinRight_; + double fallMinRight_; + double riseMaxRight_; + double fallMaxRight_; + + defrData *defData; +}; + + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiPath.cpp b/src/def/def/defiPath.cpp new file mode 100644 index 00000000..a78f89ca --- /dev/null +++ b/src/def/def/defiPath.cpp @@ -0,0 +1,780 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2016, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include "defiPath.hpp" +#include "defiDebug.hpp" +#include "lex.h" +#include "defiUtil.hpp" +#include + +BEGIN_LEFDEF_PARSER_NAMESPACE + +defiPath::defiPath(defrData *data) +: keys_(NULL), +data_(NULL), +numUsed_(0), +numAllocated_(0), +pointer_(NULL), +numX_(0), +numY_(0), +stepX_(0), +stepY_(0), +deltaX_(0), +deltaY_(0), +mask_(0), +defData(data) +{} + + +defiPath::defiPath(defiPath *defiPathRef) +{ + *this = *defiPathRef; + + defiPathRef->pointer_ = NULL; + defiPathRef->keys_ = NULL; + defiPathRef->data_ = NULL; +} + +DEF_COPY_CONSTRUCTOR_C( defiPath ) +: keys_(NULL), +data_(NULL), +numUsed_(0), +numAllocated_(0), +pointer_(NULL), +numX_(0), +numY_(0), +stepX_(0), +stepY_(0), +deltaX_(0), +deltaY_(0), +mask_(0), +defData(prev.defData) { + this->Init(); + +// DEF_COPY_FUNC( numUsed_ ); +// DEF_COPY_FUNC( numAllocated_ ); + DEF_MALLOC_FUNC( keys_, int, sizeof(int) * prev.numUsed_ ); + + // numUsed_ and numAllocated_ is automatically increasing + // by using below functions. + for (int i = 0; i < prev.numUsed_; i++) { + if (prev.keys_[i] == 'L') { + addLayer( (char*) prev.data_[i] ); +// fprintf(fout, " layer %s\n", (char*)(prev.data_[i])); + } else if (prev.keys_[i] == 'R') { + addTaperRule( prev.data_[i]? (char*)(prev.data_[i]) : "" ); +// fprintf(fout, " taperrule %s\n", prev.data_[i] ? (char*)(prev.data_[i]) : "" ); + } else if (prev.keys_[i] == 'T') { + setTaper(); +// fprintf(fout, " taper %s\n", prev.data_[i] ? (char*)(prev.data_[i]) : "" ); + } else if (prev.keys_[i] == 'S') { + addShape( prev.data_[i] ? (char*)(prev.data_[i]) : "" ); +// fprintf(fout, " shape %s\n", prev.data_[i] ? (char*)(prev.data_[i]) : "" ); + } else if (prev.keys_[i] == 'V') { + addVia( prev.data_[i] ? (char*)(prev.data_[i]) : "" ); +// fprintf(fout, " via %s\n", prev.data_[i] ? (char*)(prev.data_[i]) : "" ); + } else if (prev.keys_[i] == 'O') { + addViaRotation( prev.data_[i] ? *(int*)(prev.data_[i]) : -1 ) ; +// fprintf(fout, " via rotation %s\n", +// prev.data_[i] ? (char*)(prev.data_[i]) : "" ); + } else if (prev.keys_[i] == 'M') { + addViaMask( prev.data_[i] ? *(int*)(prev.data_[i]) : 0 ); +// fprintf(fout, " mask %d\n", getMask() ); + } else if (prev.keys_[i] == 'E') { + addViaRect( + ((struct defiViaRect*)(prev.data_[i]))->deltaX1, + ((struct defiViaRect*)(prev.data_[i]))->deltaY1, + ((struct defiViaRect*)(prev.data_[i]))->deltaX2, + ((struct defiViaRect*)(prev.data_[i]))->deltaY2); +// fprintf(fout, " rect %d,%d,%d,%d\n", +// ((struct defiViaRect*)(prev.data_[i]))->deltaX1, +// ((struct defiViaRect*)(prev.data_[i]))->deltaY1, +// ((struct defiViaRect*)(prev.data_[i]))->deltaX2, +// ((struct defiViaRect*)(prev.data_[i]))->deltaY2); + } else if (prev.keys_[i] == 'W') { + addWidth( *((int*)(prev.data_[i])) ); +// wptr = (int*)(prev.data_[i]); +// fprintf(fout, " width %d\n", *wptr); + } else if (prev.keys_[i] == 'P') { + addPoint( + ((struct defiPnt*)(prev.data_[i]))->x, + ((struct defiPnt*)(prev.data_[i]))->y); +// fprintf(fout, " point %d,%d\n", +// ((struct defiPnt*)(prev.data_[i]))->x, +// ((struct defiPnt*)(prev.data_[i]))->y); + } else if (prev.keys_[i] == 'F') { + addFlushPoint( + ((struct defiPnt*)(prev.data_[i]))->x, + ((struct defiPnt*)(prev.data_[i]))->y, + ((struct defiPnt*)(prev.data_[i]))->ext); +// fprintf(fout, " flushpoint %d,%d,%d\n", +// ((struct defiPnt*)(prev.data_[i]))->x, +// ((struct defiPnt*)(prev.data_[i]))->y, +// ((struct defiPnt*)(prev.data_[i]))->ext); + } else if (prev.keys_[i] == 'U') { + addVirtualPoint( + ((struct defiPnt*)(prev.data_[i]))->x, + ((struct defiPnt*)(prev.data_[i]))->y); +// fprintf(fout, " virtualpoint %d,%d\n", +// ((struct defiPnt*)(prev.data_[i]))->x, +// ((struct defiPnt*)(prev.data_[i]))->y); + } else if (prev.keys_[i] == 'D') { + addViaData( + ((struct defiViaData*)(prev.data_[i]))->numX, + ((struct defiViaData*)(prev.data_[i]))->numY, + ((struct defiViaData*)(prev.data_[i]))->stepX, + ((struct defiViaData*)(prev.data_[i]))->stepY); +// fprintf(fout, " DO %d BY %d STEP %d %d\n", +// ((struct defiViaData*)(prev.data_[i]))->numX, +// ((struct defiViaData*)(prev.data_[i]))->numY, +// ((struct defiViaData*)(prev.data_[i]))->stepX, +// ((struct defiViaData*)(prev.data_[i]))->stepY); + } + } + + DEF_COPY_FUNC( numX_ ); + DEF_COPY_FUNC( numY_ ); + DEF_COPY_FUNC( stepX_ ); + DEF_COPY_FUNC( stepY_ ); + DEF_COPY_FUNC( deltaX_ ); + DEF_COPY_FUNC( deltaY_ ); + DEF_COPY_FUNC( mask_ ); +} + +DEF_ASSIGN_OPERATOR_C( defiPath ) { + CHECK_SELF_ASSIGN + this->defData = prev.defData; + this->keys_ = NULL; + this->data_ = NULL; + this->pointer_ = NULL; + this->numUsed_ = 0; + this->numAllocated_ = 0; + this->numX_ = 0; + this->numY_ = 0; + this->stepX_ = 0; + this->stepY_ = 0; + this->deltaX_ = 0; + this->deltaY_ = 0; + this->mask_= 0; + + this->Init(); + +// DEF_COPY_FUNC( numUsed_ ); +// DEF_COPY_FUNC( numAllocated_ ); + + DEF_MALLOC_FUNC( keys_, int, sizeof(int) * prev.numUsed_ ); + + // numUsed_ and numAllocated_ is automatically increasing + // by using below functions. + for (int i = 0; i < prev.numUsed_; i++) { + if (prev.keys_[i] == 'L') { + addLayer( (char*) prev.data_[i] ); +// fprintf(fout, " layer %s\n", (char*)(prev.data_[i])); + } else if (prev.keys_[i] == 'R') { + addTaperRule( prev.data_[i]? (char*)(prev.data_[i]) : "" ); +// fprintf(fout, " taperrule %s\n", prev.data_[i] ? (char*)(prev.data_[i]) : "" ); + } else if (prev.keys_[i] == 'T') { + setTaper(); +// fprintf(fout, " taper %s\n", prev.data_[i] ? (char*)(prev.data_[i]) : "" ); + } else if (prev.keys_[i] == 'S') { + addShape( prev.data_[i] ? (char*)(prev.data_[i]) : "" ); +// fprintf(fout, " shape %s\n", prev.data_[i] ? (char*)(prev.data_[i]) : "" ); + } else if (prev.keys_[i] == 'V') { + addVia( prev.data_[i] ? (char*)(prev.data_[i]) : "" ); +// fprintf(fout, " via %s\n", prev.data_[i] ? (char*)(prev.data_[i]) : "" ); + } else if (prev.keys_[i] == 'O') { + addViaRotation( prev.data_[i] ? *(int*)(prev.data_[i]) : -1 ) ; +// fprintf(fout, " via rotation %s\n", +// prev.data_[i] ? (char*)(prev.data_[i]) : "" ); + } else if (prev.keys_[i] == 'M') { + addViaMask( prev.data_[i] ? *(int*)(prev.data_[i]) : 0 ); +// fprintf(fout, " mask %d\n", getMask() ); + } else if (prev.keys_[i] == 'E') { + addViaRect( + ((struct defiViaRect*)(prev.data_[i]))->deltaX1, + ((struct defiViaRect*)(prev.data_[i]))->deltaY1, + ((struct defiViaRect*)(prev.data_[i]))->deltaX2, + ((struct defiViaRect*)(prev.data_[i]))->deltaY2); +// fprintf(fout, " rect %d,%d,%d,%d\n", +// ((struct defiViaRect*)(prev.data_[i]))->deltaX1, +// ((struct defiViaRect*)(prev.data_[i]))->deltaY1, +// ((struct defiViaRect*)(prev.data_[i]))->deltaX2, +// ((struct defiViaRect*)(prev.data_[i]))->deltaY2); + } else if (prev.keys_[i] == 'W') { + addWidth( *((int*)(prev.data_[i])) ); +// wptr = (int*)(prev.data_[i]); +// fprintf(fout, " width %d\n", *wptr); + } else if (prev.keys_[i] == 'P') { + addPoint( + ((struct defiPnt*)(prev.data_[i]))->x, + ((struct defiPnt*)(prev.data_[i]))->y); +// fprintf(fout, " point %d,%d\n", +// ((struct defiPnt*)(prev.data_[i]))->x, +// ((struct defiPnt*)(prev.data_[i]))->y); + } else if (prev.keys_[i] == 'F') { + addFlushPoint( + ((struct defiPnt*)(prev.data_[i]))->x, + ((struct defiPnt*)(prev.data_[i]))->y, + ((struct defiPnt*)(prev.data_[i]))->ext); +// fprintf(fout, " flushpoint %d,%d,%d\n", +// ((struct defiPnt*)(prev.data_[i]))->x, +// ((struct defiPnt*)(prev.data_[i]))->y, +// ((struct defiPnt*)(prev.data_[i]))->ext); + } else if (prev.keys_[i] == 'U') { + addVirtualPoint( + ((struct defiPnt*)(prev.data_[i]))->x, + ((struct defiPnt*)(prev.data_[i]))->y); +// fprintf(fout, " virtualpoint %d,%d\n", +// ((struct defiPnt*)(prev.data_[i]))->x, +// ((struct defiPnt*)(prev.data_[i]))->y); + } else if (prev.keys_[i] == 'D') { + addViaData( + ((struct defiViaData*)(prev.data_[i]))->numX, + ((struct defiViaData*)(prev.data_[i]))->numY, + ((struct defiViaData*)(prev.data_[i]))->stepX, + ((struct defiViaData*)(prev.data_[i]))->stepY); +// fprintf(fout, " DO %d BY %d STEP %d %d\n", +// ((struct defiViaData*)(prev.data_[i]))->numX, +// ((struct defiViaData*)(prev.data_[i]))->numY, +// ((struct defiViaData*)(prev.data_[i]))->stepX, +// ((struct defiViaData*)(prev.data_[i]))->stepY); + } + } + + DEF_COPY_FUNC( numX_ ); + DEF_COPY_FUNC( numY_ ); + DEF_COPY_FUNC( stepX_ ); + DEF_COPY_FUNC( stepY_ ); + DEF_COPY_FUNC( deltaX_ ); + DEF_COPY_FUNC( deltaY_ ); + DEF_COPY_FUNC( mask_ ); + return *this; +} + +defiPath::~defiPath() { + Destroy(); +} + + +void defiPath::Init() { + // Should do nothing in constructor case. + Destroy(); + + numUsed_ = 0; + numAllocated_ = 0; + pointer_ = new int; + *pointer_ = -1; + + numX_ = 0; + numY_ = 0; + stepX_ = 0; + stepY_ = 0; + deltaX_ = 0; + deltaY_ = 0; + mask_ = 0; + + bumpSize(16); +} + + +void defiPath::clear() { + int i; + + for (i = 0; i < numUsed_; i++) { + free(data_[i]); + data_[i] = NULL; + } + + numUsed_ = 0; + + delete pointer_; + pointer_ = NULL; +} + + +void defiPath::Destroy() { + + if (keys_) { + free((char*)(keys_)); + keys_ = NULL; + } + if (data_) { + clear(); + free((char*)(data_)); + data_ = NULL; + } +} + + +void defiPath::reverseOrder() { + int one = 0; + int two = numUsed_ - 1; + int t; + void *tptr; + while (one < two) { + t = keys_[one]; + keys_[one] = keys_[two]; + keys_[two] = t; + tptr = data_[one]; + data_[one] = data_[two]; + data_[two] = tptr; + one++; + two--; + } +} + + +void defiPath::initTraverse() const { + *(pointer_) = -1; +} + + +void defiPath::initTraverseBackwards() const { + *(pointer_) = numUsed_; +} + + +int +defiPath::currentType() const +{ + if (*(pointer_) >= 0 && *(pointer_) < numUsed_) { + switch (keys_[*(pointer_)]) { + case 'L': return DEFIPATH_LAYER; + case 'V': return DEFIPATH_VIA; + case 'W': return DEFIPATH_WIDTH; + case 'P': return DEFIPATH_POINT; + case 'F': return DEFIPATH_FLUSHPOINT; + case 'T': return DEFIPATH_TAPER; + case 'R': return DEFIPATH_TAPERRULE; + case 'S': return DEFIPATH_SHAPE; + case 'Y': return DEFIPATH_STYLE; + case 'O': return DEFIPATH_VIAROTATION; + case 'E': return DEFIPATH_RECT; + case 'D': return DEFIPATH_VIADATA; + case 'U': return DEFIPATH_VIRTUALPOINT; + case 'M': return DEFIPATH_MASK; + case 'C': return DEFIPATH_VIAMASK; + default : return DEFIPATH_DONE; + } + } + + return DEFIPATH_DONE; +} + +int defiPath::next() const +{ + (*(pointer_))++; + + return currentType(); +} + + +int defiPath::prev() const{ + (*(pointer_))--; + + return currentType(); +} + +int defiPath::getTaper() const { + if (keys_[*(pointer_)] != 'T') return 0; + return 1; +} + +const char* defiPath::getTaperRule() const { + if (keys_[*(pointer_)] != 'R') return 0; + return (char*)(data_[*(pointer_)]); +} + +const char* defiPath::getLayer() const { + if (keys_[*(pointer_)] != 'L') return 0; + return (char*)(data_[*(pointer_)]); +} + + +const char* defiPath::getVia() const { + if (keys_[*(pointer_)] != 'V') return 0; + return (char*)(data_[*(pointer_)]); +} + + +const char* defiPath::getShape() const { + if (keys_[*(pointer_)] != 'S') return 0; + return (char*)(data_[*(pointer_)]); +} + + +int defiPath::getStyle() const { + int *style; + if (keys_[*(pointer_)] != 'Y') return 0; + style = (int*)(data_[*(pointer_)]); + return *style; +} + + +int defiPath::getWidth() const { + int *wptr; + if (keys_[*(pointer_)] != 'W') return 0; + wptr = (int*)(data_[*(pointer_)]); + return *wptr; +} + +int defiPath::getViaRotation() const { + int *wptr; + if (keys_[*(pointer_)] != 'O') return 0; + wptr = (int*)(data_[*(pointer_)]); + return *wptr; +} + +int defiPath::getMask() const { + int *wptr; + if (keys_[*(pointer_)] != 'M') return 0; + wptr = (int*)(data_[*(pointer_)]); + return *wptr; +} + +int defiPath::getViaBottomMask() const { + int *wptr; + if (keys_[*(pointer_)] != 'C') return 0; + wptr = (int*)(data_[*(pointer_)]); + + int viaMask = *wptr; + + return viaMask % 10; +} + +int defiPath::getViaCutMask() const { + int *wptr; + if (keys_[*(pointer_)] != 'C') return 0; + wptr = (int*)(data_[*(pointer_)]); + + int viaMask = *wptr; + + return viaMask / 10 % 10; +} + +int defiPath::getViaTopMask() const { + int *wptr; + if (keys_[*(pointer_)] != 'C') return 0; + wptr = (int*)(data_[*(pointer_)]); + + int viaMask = *wptr; + + return viaMask / 100; +} + +const char* defiPath::getViaRotationStr() const { + int *wptr; + if (keys_[*(pointer_)] != 'O') return 0; + wptr = (int*)(data_[*(pointer_)]); + return defiOrientStr(*wptr); +} + +void defiPath::getViaRect(int* deltaX1, int* deltaY1, int* deltaX2, int* deltaY2) const { + if (keys_[*(pointer_)] != 'E') return ; + *deltaX1 = ((struct defiViaRect*)(data_[*(pointer_)]))->deltaX1; + *deltaY1 = ((struct defiViaRect*)(data_[*(pointer_)]))->deltaY1; + *deltaX2 = ((struct defiViaRect*)(data_[*(pointer_)]))->deltaX2; + *deltaY2 = ((struct defiViaRect*)(data_[*(pointer_)]))->deltaY2; +} + +void defiPath::getViaData(int* numX, int* numY, int* stepX, int* stepY) const { + if (keys_[*(pointer_)] != 'D') return ; + *numX = ((struct defiViaData*)(data_[*(pointer_)]))->numX; + *numY = ((struct defiViaData*)(data_[*(pointer_)]))->numY; + *stepX = ((struct defiViaData*)(data_[*(pointer_)]))->stepX; + *stepY = ((struct defiViaData*)(data_[*(pointer_)]))->stepY; +} + + +void defiPath::getFlushPoint(int* x, int* y, int* ext) const { + if (keys_[*(pointer_)] != 'F') return ; + *x = ((struct defiPnt*)(data_[*(pointer_)]))->x; + *y = ((struct defiPnt*)(data_[*(pointer_)]))->y; + *ext = ((struct defiPnt*)(data_[*(pointer_)]))->ext; +} + +void defiPath::getVirtualPoint(int* x, int* y) const { + if (keys_[*(pointer_)] != 'U') return ; + *x = ((struct defiPnt*)(data_[*(pointer_)]))->x; + *y = ((struct defiPnt*)(data_[*(pointer_)]))->y; +} + +void defiPath::getPoint(int* x, int* y) const { + if (keys_[*(pointer_)] != 'P') return ; + *x = ((struct defiPnt*)(data_[*(pointer_)]))->x; + *y = ((struct defiPnt*)(data_[*(pointer_)]))->y; +} + + +void defiPath::addWidth(int w) { + int * wValue; + if (numUsed_ == numAllocated_) + bumpSize(numAllocated_ * 2); + wValue = (int*)malloc(sizeof(int)); + *wValue = w; + keys_[numUsed_] = 'W'; + data_[numUsed_] = wValue; + (numUsed_)++; +} + + +void defiPath::addVia(const char* l) { + int len = strlen(l)+1; + if (numUsed_ == numAllocated_) + bumpSize(numAllocated_ * 2); + keys_[numUsed_] = 'V'; + data_[numUsed_] = malloc(len); + strcpy((char*)(data_[numUsed_]), defData->DEFCASE(l)); + (numUsed_)++; +} + + +void defiPath::addViaRotation(int o) { + int * orient; + if (numUsed_ == numAllocated_) + bumpSize(numAllocated_ * 2); + orient = (int*)malloc(sizeof(int)); + *orient = o; + keys_[numUsed_] = 'O'; + data_[numUsed_] = orient; + (numUsed_)++; +} + + +void defiPath::addViaRect(int deltaX1, int deltaY1, int deltaX2, int deltaY2) { + if (numUsed_ == numAllocated_) + bumpSize(numAllocated_ * 2); + keys_[numUsed_] = 'E'; // RECT + data_[numUsed_] = malloc(sizeof(struct defiViaRect)); + ((struct defiViaRect*)(data_[numUsed_]))->deltaX1 = deltaX1; + ((struct defiViaRect*)(data_[numUsed_]))->deltaY1 = deltaY1; + ((struct defiViaRect*)(data_[numUsed_]))->deltaX2 = deltaX2; + ((struct defiViaRect*)(data_[numUsed_]))->deltaY2 = deltaY2; + (numUsed_)++; +} + + +void defiPath::addViaData(int numX, int numY, int stepX, int stepY) { + if (numUsed_ == numAllocated_) + bumpSize(numAllocated_ * 2); + keys_[numUsed_] = 'D'; + data_[numUsed_] = malloc(sizeof(struct defiViaData)); + ((struct defiViaData*)(data_[numUsed_]))->numX = numX; + ((struct defiViaData*)(data_[numUsed_]))->numY = numY; + ((struct defiViaData*)(data_[numUsed_]))->stepX = stepX; + ((struct defiViaData*)(data_[numUsed_]))->stepY = stepY; + (numUsed_)++; +} + + +void defiPath::addLayer(const char* l) { + int len = strlen(l)+1; + if (numUsed_ == numAllocated_) + bumpSize(numAllocated_ * 2); + keys_[numUsed_] = 'L' ; + data_[numUsed_] = malloc(len); + strcpy((char*)(data_[numUsed_]), defData->DEFCASE(l)); + (numUsed_)++; +} + + +void defiPath::addTaperRule(const char* l) { + int len = strlen(l)+1; + if (numUsed_ == numAllocated_) + bumpSize(numAllocated_ * 2); + keys_[numUsed_] = 'R' ; + data_[numUsed_] = malloc(len); + strcpy((char*)(data_[numUsed_]), defData->DEFCASE(l)); + (numUsed_)++; +} + + +void defiPath::addPoint(int x, int y) { + if (numUsed_ == numAllocated_) + bumpSize(numAllocated_ * 2); + keys_[numUsed_] = 'P'; + data_[numUsed_] = malloc(sizeof(struct defiPnt)); + ((struct defiPnt*)(data_[numUsed_])) -> x = x; + ((struct defiPnt*)(data_[numUsed_])) -> y = y; + (numUsed_)++; +} + +void defiPath::addMask(int colorMask) { + int* mask; + if (numUsed_ == numAllocated_) + bumpSize(numAllocated_ * 2); + mask = (int*)malloc(sizeof(int)); + *mask = colorMask; + keys_[numUsed_] = 'M'; //Mask for points + data_[numUsed_] = mask; + (numUsed_)++; +} + +void defiPath::addViaMask(int colorMask) { + int* mask; + if (numUsed_ == numAllocated_) + bumpSize(numAllocated_ * 2); + mask = (int*)malloc(sizeof(int)); + *mask = colorMask; + keys_[numUsed_] = 'C'; //viaMask + data_[numUsed_] = mask; + (numUsed_)++; +} + +void defiPath::addFlushPoint(int x, int y, int ext) { + if (numUsed_ == numAllocated_) + bumpSize(numAllocated_ * 2); + keys_[numUsed_] = 'F'; + data_[numUsed_] = malloc(sizeof(struct defiPnt)); + ((struct defiPnt*)(data_[numUsed_])) -> x = x; + ((struct defiPnt*)(data_[numUsed_])) -> y = y; + ((struct defiPnt*)(data_[numUsed_])) -> ext = ext; + (numUsed_)++; +} + +void defiPath::addVirtualPoint(int x, int y) { + if (numUsed_ == numAllocated_) + bumpSize(numAllocated_ * 2); + keys_[numUsed_] = 'U'; + data_[numUsed_] = malloc(sizeof(struct defiPnt)); + ((struct defiPnt*)(data_[numUsed_])) -> x = x; + ((struct defiPnt*)(data_[numUsed_])) -> y = y; + (numUsed_)++; +} + +void defiPath::setTaper() { + if (numUsed_ == numAllocated_) + bumpSize(numAllocated_ * 2); + keys_[numUsed_] = 'T'; + data_[numUsed_] = 0; + (numUsed_)++; +} + + +void defiPath::addShape(const char* l) { + int len = strlen(l)+1; + if (numUsed_ == numAllocated_) + bumpSize(numAllocated_ * 2); + keys_[numUsed_] = 'S' ; + data_[numUsed_] = malloc(len); + strcpy((char*)(data_[numUsed_]), defData->DEFCASE(l)); + (numUsed_)++; +} + +void defiPath::addStyle(int s) { + int *style; + if (numUsed_ == numAllocated_) + bumpSize(numAllocated_ * 2); + style = (int*)malloc(sizeof(int)); + *style = s; + keys_[numUsed_] = 'Y' ; + data_[numUsed_] = style; + (numUsed_)++; +} + + +void defiPath::print(FILE* fout) const { + int i; + int *wptr; + if (fout == 0) fout = stdout; + fprintf(fout, "Path:\n"); + for (i = 0; i < numUsed_; i++) { + if (keys_[i] == 'L') { + fprintf(fout, " layer %s\n", (char*)(data_[i])); + } else if (keys_[i] == 'R') { + fprintf(fout, " taperrule %s\n", data_[i] ? (char*)(data_[i]) : "" ); + } else if (keys_[i] == 'T') { + fprintf(fout, " taper %s\n", data_[i] ? (char*)(data_[i]) : "" ); + } else if (keys_[i] == 'S') { + fprintf(fout, " shape %s\n", data_[i] ? (char*)(data_[i]) : "" ); + } else if (keys_[i] == 'V') { + fprintf(fout, " via %s\n", data_[i] ? (char*)(data_[i]) : "" ); + } else if (keys_[i] == 'O') { + fprintf(fout, " via rotation %s\n", + data_[i] ? (char*)(data_[i]) : "" ); + } else if (keys_[i] == 'M') { + fprintf(fout, " mask %d\n", getMask() ); + } else if (keys_[i] == 'E') { + fprintf(fout, " rect %d,%d,%d,%d\n", + ((struct defiViaRect*)(data_[i]))->deltaX1, + ((struct defiViaRect*)(data_[i]))->deltaY1, + ((struct defiViaRect*)(data_[i]))->deltaX2, + ((struct defiViaRect*)(data_[i]))->deltaY2); + } else if (keys_[i] == 'W') { + wptr = (int*)(data_[i]); + fprintf(fout, " width %d\n", *wptr); + } else if (keys_[i] == 'P') { + fprintf(fout, " point %d,%d\n", + ((struct defiPnt*)(data_[i]))->x, + ((struct defiPnt*)(data_[i]))->y); + } else if (keys_[i] == 'F') { + fprintf(fout, " flushpoint %d,%d,%d\n", + ((struct defiPnt*)(data_[i]))->x, + ((struct defiPnt*)(data_[i]))->y, + ((struct defiPnt*)(data_[i]))->ext); + } else if (keys_[i] == 'U') { + fprintf(fout, " virtualpoint %d,%d\n", + ((struct defiPnt*)(data_[i]))->x, + ((struct defiPnt*)(data_[i]))->y); + } else if (keys_[i] == 'D') { + fprintf(fout, " DO %d BY %d STEP %d %d\n", + ((struct defiViaData*)(data_[i]))->numX, + ((struct defiViaData*)(data_[i]))->numY, + ((struct defiViaData*)(data_[i]))->stepX, + ((struct defiViaData*)(data_[i]))->stepY); + } else { + fprintf(fout, " ERROR\n"); + } + } +} + + +void defiPath::bumpSize(int size) { + int i; + int* newKeys = (int*)malloc(size * sizeof(int*)); + void** newData = (void**)malloc(size * sizeof(void*)); + + for (i = 0; i < numUsed_; i++) { + newKeys[i] = keys_[i]; + newData[i] = data_[i]; + } + + if (keys_) free((char*)(keys_)); + if (data_) free((char*)(data_)); + + keys_ = newKeys; + data_ = newData; + numAllocated_ = size; +} + + +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defiPath.hpp b/src/def/def/defiPath.hpp new file mode 100644 index 00000000..ac46e635 --- /dev/null +++ b/src/def/def/defiPath.hpp @@ -0,0 +1,173 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013-2014, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiPath_h +#define defiPath_h + +#include +#include "defiKRDefs.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +// TX_DIR:TRANSLATION ON + +class defrData; + +struct defiPnt { + int x; + int y; + int ext; +}; + +// 5.4.1 1-D & 2-D Arrays of Vias in SPECIALNET Section +struct defiViaData { + int numX; + int numY; + int stepX; + int stepY; +}; + +struct defiViaRect { + int deltaX1; + int deltaY1; + int deltaX2; + int deltaY2; +}; + +// value returned by the next() routine. +enum defiPath_e { + DEFIPATH_DONE = 0, + DEFIPATH_LAYER, + DEFIPATH_VIA, + DEFIPATH_VIAROTATION, + DEFIPATH_WIDTH, + DEFIPATH_POINT, + DEFIPATH_FLUSHPOINT, + DEFIPATH_TAPER, + DEFIPATH_SHAPE, + DEFIPATH_STYLE, + DEFIPATH_TAPERRULE, + DEFIPATH_VIADATA, + DEFIPATH_RECT, + DEFIPATH_VIRTUALPOINT, + DEFIPATH_MASK, + DEFIPATH_VIAMASK + } ; + + +class defiPath { +public: + defiPath(defrData *data); + // This is 'data ownership transfer' constructor. + defiPath(defiPath *defiPathRef); + + DEF_COPY_CONSTRUCTOR_H( defiPath ); + DEF_ASSIGN_OPERATOR_H( defiPath ); + + void Init(); + + void Destroy(); + ~defiPath(); + + void clear(); + void reverseOrder(); + + // To traverse the path and get the parts. + void initTraverse() const; // Initialize the traverse. + void initTraverseBackwards() const; // Initialize the traverse in reverse. + int next() const; // Get the next element. + int prev() const; // Get the next element in reverse. + const char* getLayer() const;// Get the layer. + const char* getTaperRule() const;// Get the rule. + const char* getVia() const; // Get the via. + const char* getShape() const;// Get the shape. + int getTaper() const;// Get the taper. + int getStyle() const;// Get the style. + int getViaRotation() const; // Get the via rotation. + void getViaRect(int* deltaX1, int* deltaY1, int* deltaX2, int* deltaY2) const; + const char* getViaRotationStr() const; // Return via rotation in string format + void getViaData(int* numX, int* numY, int* stepX, int* stepY) const; // 5.4.1 + int getWidth() const; // Get the width. + void getPoint(int* x, int* y) const;// Get the point. + void getFlushPoint(int* x, int* y, int* ext) const;// Get the point. + void getVirtualPoint(int* x, int* y) const; + int getMask() const; + int getViaTopMask() const; + int getViaCutMask() const; + int getViaBottomMask() const; + int getRectMask() const; + + + // These routines are called by the parser to fill the path. + void addWidth(int w); + void addPoint(int x, int y); + void addFlushPoint(int x, int y, int ext); + void addVirtualPoint(int x, int y); + void addLayer(const char* layer); + void addVia(const char* name); + void addViaRotation(int orient); + void addViaRect(int deltaX1, int deltaY1, int deltaX2, int deltaY2); + void addMask(int colorMask); + void addViaMask(int colorMask); + void addViaData(int numX, int numY, int stepX, int stepY); // 5.4.1 + void setTaper(); + void addTaperRule(const char* rule); + void addShape(const char* shape); + void addStyle(int style); + + // debug printing + void print(FILE* fout) const; + + void bumpSize(int size); + +protected: + int currentType() const; + + int* keys_; // type of item in path + void** data_; // extra data + int numUsed_; // number of items used in array + int numAllocated_; // allocated size of keys and data + int* pointer_; // traversal pointer, allocated because used + // as iterator in const traversal functions. + int numX_; + int numY_; + int stepX_; + int stepY_; + int deltaX_; + int deltaY_; + int mask_; + + defrData *defData; +}; + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiPinCap.cpp b/src/def/def/defiPinCap.cpp new file mode 100644 index 00000000..5d287f49 --- /dev/null +++ b/src/def/def/defiPinCap.cpp @@ -0,0 +1,2468 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2015, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include "defiPinCap.hpp" +#include "defiComponent.hpp" +#include "defiDebug.hpp" +#include "lex.h" +#include "defiUtil.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +/////////////////////////////////////////////// +/////////////////////////////////////////////// +// +// defiPinCap +// +/////////////////////////////////////////////// +/////////////////////////////////////////////// + + +void defiPinCap::setPin(int p) { + pin_ = p; +} + + +void defiPinCap::setCap(double d) { + cap_ = d; +} + + +int defiPinCap::pin() const { + return pin_; +} + + +double defiPinCap::cap() const { + return cap_; +} + + +void defiPinCap::print(FILE* f) const { + fprintf(f, "PinCap %d %5.2f\n", pin_, cap_); +} + + +/////////////////////////////////////////////// +/////////////////////////////////////////////// +// +// defiPinAntennaModel +// +/////////////////////////////////////////////// +/////////////////////////////////////////////// + +defiPinAntennaModel::defiPinAntennaModel(defrData *data) + : oxide_(0), + defData(data) +{ + Init(); +} + + +void defiPinAntennaModel::Init() { + numAPinGateArea_ = 0; // 5.4 + APinGateAreaAllocated_ = 0; // 5.4 + APinGateArea_ = 0; + APinGateAreaLayer_ = 0; + numAPinMaxAreaCar_ = 0; // 5.4 + APinMaxAreaCarAllocated_ = 0; // 5.4 + APinMaxAreaCar_ = 0; + APinMaxAreaCarLayer_ = 0; + numAPinMaxSideAreaCar_ = 0; // 5.4 + APinMaxSideAreaCarAllocated_ = 0; // 5.4 + APinMaxSideAreaCar_ = 0; + APinMaxSideAreaCarLayer_ = 0; + numAPinMaxCutCar_ = 0; // 5.4 + APinMaxCutCarAllocated_ = 0; // 5.4 + APinMaxCutCar_ = 0; + APinMaxCutCarLayer_ = 0; + oxide_ = 0; +} + +DEF_COPY_CONSTRUCTOR_C( defiPinAntennaModel ) { + this->Init(); + + DEF_MALLOC_FUNC( oxide_, char, sizeof(char) * (strlen(prev.oxide_) +1)); + DEF_COPY_FUNC( numAPinGateArea_ ); + DEF_COPY_FUNC( APinGateAreaAllocated_ ); + DEF_MALLOC_FUNC( APinGateArea_, int, sizeof(int) * numAPinGateArea_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( APinGateAreaLayer_, numAPinGateArea_ ); + + DEF_COPY_FUNC( numAPinMaxAreaCar_ ); + DEF_COPY_FUNC( APinMaxAreaCarAllocated_ ); + DEF_MALLOC_FUNC( APinMaxAreaCar_, int, sizeof(int) * numAPinMaxAreaCar_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( APinMaxAreaCarLayer_, numAPinMaxAreaCar_ ); + + DEF_COPY_FUNC( numAPinMaxSideAreaCar_ ); + DEF_COPY_FUNC( APinMaxSideAreaCarAllocated_ ); + DEF_MALLOC_FUNC( APinMaxSideAreaCar_, int, sizeof(int) * numAPinMaxSideAreaCar_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( APinMaxSideAreaCarLayer_, numAPinMaxSideAreaCar_ ); + + DEF_COPY_FUNC( numAPinMaxCutCar_ ); + DEF_COPY_FUNC( APinMaxCutCarAllocated_ ); + DEF_MALLOC_FUNC( APinMaxCutCar_, int, sizeof(int) * numAPinMaxCutCar_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( APinMaxCutCarLayer_, numAPinMaxCutCar_ ); + +} + +DEF_ASSIGN_OPERATOR_C( defiPinAntennaModel ) { + CHECK_SELF_ASSIGN + this->Init(); + + DEF_MALLOC_FUNC( oxide_, char, sizeof(char) * (strlen(prev.oxide_) +1)); + DEF_COPY_FUNC( numAPinGateArea_ ); + DEF_COPY_FUNC( APinGateAreaAllocated_ ); + DEF_MALLOC_FUNC( APinGateArea_, int, sizeof(int) * numAPinGateArea_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( APinGateAreaLayer_, numAPinGateArea_ ); + + DEF_COPY_FUNC( numAPinMaxAreaCar_ ); + DEF_COPY_FUNC( APinMaxAreaCarAllocated_ ); + DEF_MALLOC_FUNC( APinMaxAreaCar_, int, sizeof(int) * numAPinMaxAreaCar_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( APinMaxAreaCarLayer_, numAPinMaxAreaCar_ ); + + DEF_COPY_FUNC( numAPinMaxSideAreaCar_ ); + DEF_COPY_FUNC( APinMaxSideAreaCarAllocated_ ); + DEF_MALLOC_FUNC( APinMaxSideAreaCar_, int, sizeof(int) * numAPinMaxSideAreaCar_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( APinMaxSideAreaCarLayer_, numAPinMaxSideAreaCar_ ); + + DEF_COPY_FUNC( numAPinMaxCutCar_ ); + DEF_COPY_FUNC( APinMaxCutCarAllocated_ ); + DEF_MALLOC_FUNC( APinMaxCutCar_, int, sizeof(int) * numAPinMaxCutCar_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( APinMaxCutCarLayer_, numAPinMaxCutCar_ ); + return *this; +} + +defiPinAntennaModel::~defiPinAntennaModel() { + Destroy(); +} + + +void defiPinAntennaModel::clear() { + int i; + + if (oxide_) + free((char*)(oxide_)); + oxide_ = 0; + + for (i = 0; i < numAPinGateArea_; i++) { + if (APinGateAreaLayer_[i]) + free(APinGateAreaLayer_[i]); + } + numAPinGateArea_ = 0; + + for (i = 0; i < numAPinMaxAreaCar_; i++) { + if (APinMaxAreaCarLayer_[i]) + free(APinMaxAreaCarLayer_[i]); + } + numAPinMaxAreaCar_ = 0; + + for (i = 0; i < numAPinMaxSideAreaCar_; i++) { + if (APinMaxSideAreaCarLayer_[i]) + free(APinMaxSideAreaCarLayer_[i]); + } + numAPinMaxSideAreaCar_ = 0; + + for (i = 0; i < numAPinMaxCutCar_; i++) { + if (APinMaxCutCarLayer_[i]) + free(APinMaxCutCarLayer_[i]); + } + numAPinMaxCutCar_ = 0; +} + +void defiPinAntennaModel::Destroy() { + clear(); + if (APinGateArea_) + free((char*)(APinGateArea_)); + if (APinGateAreaLayer_) + free((char*)(APinGateAreaLayer_)); + if (APinMaxAreaCar_) + free((char*)(APinMaxAreaCar_)); + if (APinMaxAreaCarLayer_) + free((char*)(APinMaxAreaCarLayer_)); + if (APinMaxSideAreaCar_) + free((char*)(APinMaxSideAreaCar_)); + if (APinMaxSideAreaCarLayer_) + free((char*)(APinMaxSideAreaCarLayer_)); + if (APinMaxCutCar_) + free((char*)(APinMaxCutCar_)); + if (APinMaxCutCarLayer_) + free((char*)(APinMaxCutCarLayer_)); +} + +// 5.5 +void defiPinAntennaModel::setAntennaModel(int aOxide) { + switch (aOxide) { + case 2: + oxide_ = strdup("OXIDE2"); + break; + case 3: + oxide_ = strdup("OXIDE3"); + break; + case 4: + oxide_ = strdup("OXIDE4"); + break; + default: + oxide_ = strdup("OXIDE1"); + break; + } +} + +void defiPinAntennaModel::addAPinGateArea(int value, const char* layer) { + if (numAPinGateArea_ == APinGateAreaAllocated_) { + int i; + int max; + int lim = numAPinGateArea_; + int* nd; + char** nl; + + if (APinGateAreaAllocated_ == 0) + max = APinGateAreaAllocated_ = 2; + else + max = APinGateAreaAllocated_ *= 2; + nd = (int*)malloc(sizeof(int)*max); + nl = (char**)malloc(sizeof(char*)*max); + for (i = 0; i < lim; i++) { + nd[i] = APinGateArea_[i]; + nl[i] = APinGateAreaLayer_[i]; + } + free((char*)(APinGateArea_)); + free((char*)(APinGateAreaLayer_)); + APinGateArea_ = nd; + APinGateAreaLayer_ = nl; + + } + APinGateArea_[numAPinGateArea_] = value; + if (layer) { + APinGateAreaLayer_[numAPinGateArea_] = + (char*)malloc(strlen(layer)+1); + strcpy(APinGateAreaLayer_[numAPinGateArea_], + defData->DEFCASE(layer)); + } else + APinGateAreaLayer_[numAPinGateArea_] = NULL; + numAPinGateArea_ += 1; +} + +void defiPinAntennaModel::addAPinMaxAreaCar(int value, const char* layer) { + if (numAPinMaxAreaCar_ == APinMaxAreaCarAllocated_) { + int i; + int max; + int lim = numAPinMaxAreaCar_; + int* nd; + char** nl; + + if (APinMaxAreaCarAllocated_ == 0) + max = APinMaxAreaCarAllocated_ = 2; + else + max = APinMaxAreaCarAllocated_ *= 2; + nd = (int*)malloc(sizeof(int)*max); + nl = (char**)malloc(sizeof(char*)*max); + for (i = 0; i < lim; i++) { + nd[i] = APinMaxAreaCar_[i]; + nl[i] = APinMaxAreaCarLayer_[i]; + } + free((char*)(APinMaxAreaCar_)); + free((char*)(APinMaxAreaCarLayer_)); + APinMaxAreaCar_ = nd; + APinMaxAreaCarLayer_ = nl; + + } + APinMaxAreaCar_[numAPinMaxAreaCar_] = value; + if (layer) { + APinMaxAreaCarLayer_[numAPinMaxAreaCar_] = + (char*)malloc(strlen(layer)+1); + strcpy(APinMaxAreaCarLayer_[numAPinMaxAreaCar_], + defData->DEFCASE(layer)); + } else + APinMaxAreaCarLayer_[numAPinMaxAreaCar_] = NULL; + numAPinMaxAreaCar_ += 1; +} + +void defiPinAntennaModel::addAPinMaxSideAreaCar(int value, const char* layer) { + if (numAPinMaxSideAreaCar_ == APinMaxSideAreaCarAllocated_) { + int i; + int max; + int lim = numAPinMaxSideAreaCar_; + int* nd; + char** nl; + + if (APinMaxSideAreaCarAllocated_ == 0) + max = APinMaxSideAreaCarAllocated_ = 2; + else + max = APinMaxSideAreaCarAllocated_ *= 2; + nd = (int*)malloc(sizeof(int)*max); + nl = (char**)malloc(sizeof(char*)*max); + for (i = 0; i < lim; i++) { + nd[i] = APinMaxSideAreaCar_[i]; + nl[i] = APinMaxSideAreaCarLayer_[i]; + } + free((char*)(APinMaxSideAreaCar_)); + free((char*)(APinMaxSideAreaCarLayer_)); + APinMaxSideAreaCar_ = nd; + APinMaxSideAreaCarLayer_ = nl; + + } + APinMaxSideAreaCar_[numAPinMaxSideAreaCar_] = value; + if (layer) { + APinMaxSideAreaCarLayer_[numAPinMaxSideAreaCar_] = + (char*)malloc(strlen(layer)+1); + strcpy(APinMaxSideAreaCarLayer_[numAPinMaxSideAreaCar_], + defData->DEFCASE(layer)); + } else + APinMaxSideAreaCarLayer_[numAPinMaxSideAreaCar_] = NULL; + numAPinMaxSideAreaCar_ += 1; +} + +void defiPinAntennaModel::addAPinMaxCutCar(int value, const char* layer) { + if (numAPinMaxCutCar_ == APinMaxCutCarAllocated_) { + int i; + int max; + int lim = numAPinMaxCutCar_; + int* nd; + char** nl; + + if (APinMaxCutCarAllocated_ == 0) + max = APinMaxCutCarAllocated_ = 2; + else + max = APinMaxCutCarAllocated_ *= 2; + nd = (int*)malloc(sizeof(int)*max); + nl = (char**)malloc(sizeof(char*)*max); + for (i = 0; i < lim; i++) { + nd[i] = APinMaxCutCar_[i]; + nl[i] = APinMaxCutCarLayer_[i]; + } + free((char*)(APinMaxCutCar_)); + free((char*)(APinMaxCutCarLayer_)); + APinMaxCutCar_ = nd; + APinMaxCutCarLayer_ = nl; + + } + APinMaxCutCar_[numAPinMaxCutCar_] = value; + if (layer) { + APinMaxCutCarLayer_[numAPinMaxCutCar_] = + (char*)malloc(strlen(layer)+1); + strcpy(APinMaxCutCarLayer_[numAPinMaxCutCar_], + defData->DEFCASE(layer)); + } else + APinMaxCutCarLayer_[numAPinMaxCutCar_] = NULL; + numAPinMaxCutCar_ += 1; +} + +// 5.5 +char* defiPinAntennaModel::antennaOxide() const { + return oxide_; +} + +int defiPinAntennaModel::hasAPinGateArea() const { + return numAPinGateArea_ ? 1 : 0 ; +} + +int defiPinAntennaModel::hasAPinMaxAreaCar() const { + return numAPinMaxAreaCar_ ? 1 : 0 ; +} + +int defiPinAntennaModel::hasAPinMaxSideAreaCar() const { + return numAPinMaxSideAreaCar_ ? 1 : 0 ; +} + +int defiPinAntennaModel::hasAPinMaxCutCar() const { + return numAPinMaxCutCar_ ? 1 : 0 ; +} + +int defiPinAntennaModel::numAPinGateArea() const { + return numAPinGateArea_; +} + +int defiPinAntennaModel::numAPinMaxAreaCar() const { + return numAPinMaxAreaCar_; +} + +int defiPinAntennaModel::numAPinMaxSideAreaCar() const { + return numAPinMaxSideAreaCar_; +} + +int defiPinAntennaModel::numAPinMaxCutCar() const { + return numAPinMaxCutCar_; +} + +int defiPinAntennaModel::APinGateArea(int i) const { + return APinGateArea_[i]; +} + +int defiPinAntennaModel::hasAPinGateAreaLayer(int i) const { + return (APinGateAreaLayer_[i] && *(APinGateAreaLayer_[i])) ? + 1 : 0; +} + +const char* defiPinAntennaModel::APinGateAreaLayer(int i) const { + return APinGateAreaLayer_[i]; +} + +int defiPinAntennaModel::APinMaxAreaCar(int i) const { + return APinMaxAreaCar_[i]; +} + +int defiPinAntennaModel::hasAPinMaxAreaCarLayer(int i) const { + return (APinMaxAreaCarLayer_[i] && *(APinMaxAreaCarLayer_[i])) ? + 1 : 0; +} + +const char* defiPinAntennaModel::APinMaxAreaCarLayer(int i) const { + return APinMaxAreaCarLayer_[i]; +} + +int defiPinAntennaModel::APinMaxSideAreaCar(int i) const { + return APinMaxSideAreaCar_[i]; +} + +int defiPinAntennaModel::hasAPinMaxSideAreaCarLayer(int i) const { + return (APinMaxSideAreaCarLayer_[i] && + *(APinMaxSideAreaCarLayer_[i])) ? 1 : 0; +} + +const char* defiPinAntennaModel::APinMaxSideAreaCarLayer(int i) const { + return APinMaxSideAreaCarLayer_[i]; +} + +int defiPinAntennaModel::APinMaxCutCar(int i) const { + return APinMaxCutCar_[i]; +} + +int defiPinAntennaModel::hasAPinMaxCutCarLayer(int i) const { + return (APinMaxCutCarLayer_[i] && + *(APinMaxCutCarLayer_[i])) ? 1 : 0; +} + +const char* defiPinAntennaModel::APinMaxCutCarLayer(int i) const { + return APinMaxCutCarLayer_[i]; +} + + +/////////////////////////////////////////////// +/////////////////////////////////////////////// +// +// defiPinPort +// +/////////////////////////////////////////////// +/////////////////////////////////////////////// + +defiPinPort::defiPinPort(defrData *data) +: defData(data) +{ + Init(); +} + +void defiPinPort::Init() { + layersAllocated_ = 0; + numLayers_ = 0; + layers_ = 0; + layerMinSpacing_ = 0; + layerMask_ = 0; + layerEffectiveWidth_ = 0; + xl_ = 0; + yl_ = 0; + xh_ = 0; + yh_ = 0; + polysAllocated_ = 0; + numPolys_ = 0; + polygonNames_ = 0; + polyMinSpacing_ = 0; + polyMask_ = 0; + polyEffectiveWidth_ = 0; + polygons_ = 0; + viasAllocated_ = 0; + numVias_ = 0; + viaNames_ = 0; + viaX_ = 0; + viaY_ = 0; + viaMask_ = 0; + placeType_ = 0; + x_ = 0; + y_ = 0; + orient_ = 0; +} + +DEF_COPY_CONSTRUCTOR_C( defiPinPort ) { + this->Init(); + + DEF_COPY_FUNC( layersAllocated_ ); + DEF_COPY_FUNC( numLayers_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( layers_, numLayers_); + + DEF_MALLOC_FUNC( layerMinSpacing_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( layerEffectiveWidth_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( xl_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( yl_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( xh_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( yh_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( layerMask_, int, sizeof(int) * numLayers_); + + DEF_COPY_FUNC( polysAllocated_ ); + DEF_COPY_FUNC( numPolys_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( polygonNames_, numPolys_); + + DEF_MALLOC_FUNC( polyMinSpacing_, int, sizeof(int) * numPolys_); + DEF_MALLOC_FUNC( polyMask_, int, sizeof(int) * numPolys_); + DEF_MALLOC_FUNC( polyEffectiveWidth_, int, sizeof(int) * numPolys_ ); + DEF_MALLOC_FUNC_FOR_2D_POINT( polygons_, numPolys_ ); + + DEF_COPY_FUNC( viasAllocated_ ); + DEF_COPY_FUNC( numVias_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( viaNames_, numVias_); + + DEF_MALLOC_FUNC( viaX_, int, sizeof(int) * numVias_ ); + DEF_MALLOC_FUNC( viaY_, int, sizeof(int) * numVias_ ); + DEF_MALLOC_FUNC( viaMask_, int, sizeof(int) * numVias_ ); + DEF_COPY_FUNC( placeType_ ); + DEF_COPY_FUNC( x_ ); + DEF_COPY_FUNC( y_ ); + DEF_COPY_FUNC( orient_ ); +} + +DEF_ASSIGN_OPERATOR_C( defiPinPort ) { + CHECK_SELF_ASSIGN + this->Init(); + + DEF_COPY_FUNC( layersAllocated_ ); + DEF_COPY_FUNC( numLayers_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( layers_, numLayers_); + + DEF_MALLOC_FUNC( layerMinSpacing_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( layerEffectiveWidth_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( xl_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( yl_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( xh_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( yh_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( layerMask_, int, sizeof(int) * numLayers_); + + DEF_COPY_FUNC( polysAllocated_ ); + DEF_COPY_FUNC( numPolys_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( polygonNames_, numPolys_); + + DEF_MALLOC_FUNC( polyMinSpacing_, int, sizeof(int) * numPolys_); + DEF_MALLOC_FUNC( polyMask_, int, sizeof(int) * numPolys_); + DEF_MALLOC_FUNC( polyEffectiveWidth_, int, sizeof(int) * numPolys_ ); + DEF_MALLOC_FUNC_FOR_2D_POINT( polygons_, numPolys_ ); + + DEF_COPY_FUNC( viasAllocated_ ); + DEF_COPY_FUNC( numVias_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( viaNames_, numVias_); + + DEF_MALLOC_FUNC( viaX_, int, sizeof(int) * numVias_ ); + DEF_MALLOC_FUNC( viaY_, int, sizeof(int) * numVias_ ); + DEF_MALLOC_FUNC( viaMask_, int, sizeof(int) * numVias_ ); + DEF_COPY_FUNC( placeType_ ); + DEF_COPY_FUNC( x_ ); + DEF_COPY_FUNC( y_ ); + DEF_COPY_FUNC( orient_ ); + return *this; +} + +defiPinPort::~defiPinPort() { + clear(); +} + +void defiPinPort::clear() { + int i; + + placeType_ = 0; + orient_ = 0; + x_ = 0; + y_ = 0; + + if (layers_) { + for (i = 0; i < numLayers_; i++) + if (layers_[i]) free(layers_[i]); + free((char*)(layers_)); + free((char*)(xl_)); + free((char*)(yl_)); + free((char*)(xh_)); + free((char*)(yh_)); + free((char*)(layerMinSpacing_)); + free((char*)(layerMask_)); + free((char*)(layerEffectiveWidth_)); + } + layers_ = 0; + layerMinSpacing_ = 0; + layerEffectiveWidth_ = 0; + layerMask_ = 0; + numLayers_ = 0; + layersAllocated_ = 0; + if (polygonNames_) { + struct defiPoints* p; + for (i = 0; i < numPolys_; i++) { + if (polygonNames_[i]) free((char*)(polygonNames_[i])); + p = polygons_[i]; + free((char*)(p->x)); + free((char*)(p->y)); + free((char*)(polygons_[i])); + } + free((char*)(polygonNames_)); + free((char*)(polygons_)); + free((char*)(polyMinSpacing_)); + free((char*)(polyMask_)); + free((char*)(polyEffectiveWidth_)); + polygonNames_ = 0; + polygons_ = 0; + polyMinSpacing_ = 0; + polyEffectiveWidth_ = 0; + polyMask_ = 0; + } + numPolys_ = 0; + polysAllocated_ = 0; + if (viaNames_) { + for (i = 0; i < numVias_; i++) + if (viaNames_[i]) free(viaNames_[i]); + free((char*)(viaNames_)); + free((char*)(viaX_)); + free((char*)(viaY_)); + free((char*)(viaMask_)); + } + viaNames_ = 0; + numVias_ = 0; + viasAllocated_ = 0; + viaMask_ = 0; +} + +void defiPinPort::addLayer(const char* layer) { + if (numLayers_ >= layersAllocated_) { + int i; + char** newl; + int *nxl, *nyl, *nxh, *nyh; + int *lms, *lew, *lm; + + layersAllocated_ = layersAllocated_ ? + layersAllocated_ * 2 : 8; + newl = (char**)malloc(layersAllocated_ * sizeof(char*)); + nxl = (int*)malloc(layersAllocated_ * sizeof(int)); + nyl = (int*)malloc(layersAllocated_ * sizeof(int)); + nxh = (int*)malloc(layersAllocated_ * sizeof(int)); + nyh = (int*)malloc(layersAllocated_ * sizeof(int)); + lms = (int*)malloc(layersAllocated_ * sizeof(int)); + lew = (int*)malloc(layersAllocated_ * sizeof(int)); + lm = (int*)malloc(layersAllocated_ * sizeof(int)); + + for (i = 0; i < numLayers_; i++) { + newl[i] = layers_[i]; + nxl[i] = xl_[i]; + nyl[i] = yl_[i]; + nxh[i] = xh_[i]; + nyh[i] = yh_[i]; + lms[i] = layerMinSpacing_[i]; + lew[i] = layerEffectiveWidth_[i]; + lm[i] = layerMask_[i]; + } + if (numLayers_ > 0) { + free((char*)layers_); + free((char*)xl_); + free((char*)yl_); + free((char*)xh_); + free((char*)yh_); + free((char*)layerMinSpacing_); + free((char*)layerEffectiveWidth_); + free((char*)layerMask_); + } + layers_ = newl; + xl_ = nxl; + yl_ = nyl; + xh_ = nxh; + yh_ = nyh; + layerMinSpacing_ = lms; + layerEffectiveWidth_ = lew; + layerMask_ = lm; + } + layers_[numLayers_] = (char*)malloc(strlen(layer)+1); + strcpy(layers_[numLayers_], defData->DEFCASE(layer)); + xl_[numLayers_] = 0; + yl_[numLayers_] = 0; + xh_[numLayers_] = 0; + yh_[numLayers_] = 0; + layerMinSpacing_[numLayers_] = -1; + layerEffectiveWidth_[numLayers_] = -1; + layerMask_[numLayers_] = 0; + numLayers_ += 1; +} + +void defiPinPort::addLayerSpacing(int minSpacing) { + layerMinSpacing_[numLayers_-1] = minSpacing; +} + +void defiPinPort::addLayerMask(int mask) { + layerMask_[numLayers_-1] = mask; +} + +void defiPinPort::addLayerDesignRuleWidth(int effectiveWidth) { + layerEffectiveWidth_[numLayers_-1] = effectiveWidth; +} + +void defiPinPort::addLayerPts(int xl, int yl, int xh, int yh) { + xl_[numLayers_-1] = xl; + yl_[numLayers_-1] = yl; + xh_[numLayers_-1] = xh; + yh_[numLayers_-1] = yh; +} + +void defiPinPort::addPolygon(const char* layerName) { + int *pms, *pdw, *pm; + int i; + + if (numPolys_ == polysAllocated_) { + char** newn; + struct defiPoints** poly; + polysAllocated_ = (polysAllocated_ == 0) ? + 2 : polysAllocated_ * 2; + newn = (char**)malloc(sizeof(char*) * polysAllocated_); + poly = (struct defiPoints**)malloc(sizeof(struct defiPoints*) * + polysAllocated_); + pms = (int*)malloc(polysAllocated_ * sizeof(int)); + pdw = (int*)malloc(polysAllocated_ * sizeof(int)); + pm = (int*)malloc(polysAllocated_ * sizeof(int)); + + for (i = 0; i < numPolys_; i++) { + newn[i] = polygonNames_[i]; + poly[i] = polygons_[i]; + pms[i] = polyMinSpacing_[i]; + pdw[i] = polyEffectiveWidth_[i]; + pm[i] = polyMask_[i]; + } + if (numPolys_ > 0) { + free((char*)(polygons_)); + free((char*)(polygonNames_)); + free((char*)(polyMinSpacing_)); + free((char*)(polyEffectiveWidth_)); + free((char*)(polyMask_)); + } + polygonNames_ = newn; + polygons_ = poly; + polyMinSpacing_ = pms; + polyEffectiveWidth_ = pdw; + polyMask_ = pm; + } + polygonNames_[numPolys_] = strdup(layerName); + polygons_[numPolys_] = 0; + polyMinSpacing_[numPolys_] = -1; + polyEffectiveWidth_[numPolys_] = -1; + polyMask_[numPolys_] = 0; + numPolys_ += 1; +} + +void defiPinPort::addPolySpacing(int minSpacing) { + polyMinSpacing_[numPolys_-1] = minSpacing; +} + +void defiPinPort::addPolyMask(int color) { + polyMask_[numPolys_-1] = color; +} + +void defiPinPort::addPolyDesignRuleWidth(int effectiveWidth) { + polyEffectiveWidth_[numPolys_-1] = effectiveWidth; +} + +void defiPinPort::addPolygonPts(defiGeometries* geom) { + struct defiPoints* p; + int x, y; + int i; + + p = (struct defiPoints*)malloc(sizeof(struct defiPoints)); + p->numPoints = geom->numPoints(); + p->x = (int*)malloc(sizeof(int)*p->numPoints); + p->y = (int*)malloc(sizeof(int)*p->numPoints); + for (i = 0; i < p->numPoints; i++) { + geom->points(i, &x, &y); + p->x[i] = x; + p->y[i] = y; + } + polygons_[numPolys_-1] = p; +} + + +void defiPinPort::addVia(const char* viaName, int ptX, int ptY, int color) { + if (numVias_ >= viasAllocated_) { + int i; + char** newl; + int *nx, *ny, *nm; + + viasAllocated_ = viasAllocated_ ? + viasAllocated_ * 2 : 8; + newl = (char**)malloc(viasAllocated_ * sizeof(char*)); + nx = (int*)malloc(viasAllocated_ * sizeof(int)); + ny = (int*)malloc(viasAllocated_ * sizeof(int)); + nm = (int*)malloc(viasAllocated_ * sizeof(int)); + for (i = 0; i < numVias_; i++) { + newl[i] = viaNames_[i]; + nx[i] = viaX_[i]; + ny[i] = viaY_[i]; + nm[i] = viaMask_[i]; + } + if (numVias_ > 0) { + free((char*)viaNames_); + free((char*)viaX_); + free((char*)viaY_); + free((char*)viaMask_); + } + viaNames_ = newl; + viaX_ = nx; + viaY_ = ny; + viaMask_ = nm; + } + viaNames_[numVias_] = (char*)malloc(strlen(viaName)+1); + strcpy(viaNames_[numVias_], defData->DEFCASE(viaName)); + viaX_[numVias_] = ptX; + viaY_[numVias_] = ptY; + viaMask_[numVias_] = color; + numVias_ += 1; +} + +void defiPinPort::setPlacement(int typ, int x, int y, int orient) { + x_ = x; + y_ = y; + orient_ = orient; + placeType_ = typ; +} + +int defiPinPort::numLayer() const { + return numLayers_; +} + +const char* defiPinPort::layer(int index) const { + return layers_[index]; +} + +void defiPinPort::bounds(int index, int* xl, int* yl, int* xh, int* yh) const { + if (xl) *xl = xl_[index]; + if (yl) *yl = yl_[index]; + if (xh) *xh = xh_[index]; + if (yh) *yh = yh_[index]; +} + +int defiPinPort::hasLayerSpacing(int index) const{ + if (layerMinSpacing_[index] == -1) + return 0; + return 1; +} + +int defiPinPort::hasLayerDesignRuleWidth(int index) const{ + if (layerEffectiveWidth_[index] == -1) + return 0; + return 1; +} + +int defiPinPort::layerSpacing(int index) const { + return layerMinSpacing_[index]; +} + +int defiPinPort::layerMask(int index) const { + return layerMask_[index]; +} + +int defiPinPort::layerDesignRuleWidth(int index) const { + return layerEffectiveWidth_[index]; +} + +int defiPinPort::numPolygons() const { + return numPolys_; +} + +const char* defiPinPort::polygonName(int index) const { + if (index < 0 || index > numPolys_) { + defiError(1, 0, "index out of bounds", defData); + return 0; + } + return polygonNames_[index]; +} + +struct defiPoints defiPinPort::getPolygon(int index) const { + return *(polygons_[index]); +} + +int defiPinPort::hasPolygonSpacing(int index) const{ + if (polyMinSpacing_[index] == -1) + return 0; + return 1; +} + +int defiPinPort::hasPolygonDesignRuleWidth(int index) const{ + if (polyEffectiveWidth_[index] == -1) + return 0; + return 1; +} + +int defiPinPort::polygonSpacing(int index) const { + return polyMinSpacing_[index]; +} + +int defiPinPort::polygonMask(int index) const { + return polyMask_[index]; +} + +int defiPinPort::polygonDesignRuleWidth(int index) const { + return polyEffectiveWidth_[index]; +} + +int defiPinPort::numVias() const { + return numVias_; +} + +const char* defiPinPort::viaName(int index) const { + if (index < 0 || index > numVias_) { + defiError(1, 0, "index out of bounds", defData); + return 0; + } + return viaNames_[index]; +} + +int defiPinPort::viaPtX(int index) const { + return viaX_[index]; +} + +int defiPinPort::viaPtY(int index) const { + return viaY_[index]; +} + +int defiPinPort::viaBottomMask(int index) const { + return viaMask_[index] % 10; +} + +int defiPinPort::viaTopMask(int index) const { + return viaMask_[index] / 100; +} + +int defiPinPort::viaCutMask(int index) const { + return viaMask_[index] / 10 % 10; +} + +int defiPinPort::hasPlacement() const { + return placeType_ == 0 ? 0 : 1 ; +} + +int defiPinPort::isPlaced() const { + return placeType_ == DEFI_COMPONENT_PLACED ? 1 : 0 ; +} + +int defiPinPort::isCover() const { + return placeType_ == DEFI_COMPONENT_COVER ? 1 : 0 ; +} + +int defiPinPort::isFixed() const { + return placeType_ == DEFI_COMPONENT_FIXED ? 1 : 0 ; +} + +int defiPinPort::placementX() const { + return x_; +} + +int defiPinPort::placementY() const { + return y_; +} + +int defiPinPort::orient() const { + return orient_; +} + +const char* defiPinPort::orientStr() const { + return (defiOrientStr(orient_)); +} + +/////////////////////////////////////////////// +/////////////////////////////////////////////// +// +// defiPin +// +/////////////////////////////////////////////// +/////////////////////////////////////////////// + +defiPin::defiPin(defrData *data) +: defData(data) +{ + Init(); +} + + +void defiPin::Init() { + pinNameLength_ = 0; + pinName_ = 0; + netNameLength_ = 0; + netName_ = 0; + useLength_ = 0; + use_ = 0; + directionLength_ = 0; + direction_ = 0; + hasDirection_ = 0; + hasUse_ = 0; + placeType_ = 0; + orient_ = 0; + xl_ = 0; + yl_ = 0; + xh_ = 0; + yh_ = 0; + x_ = 0; + y_ = 0; + netExprLength_ = 0; // 5.6 + netExpr_ = 0; // 5.6 + hasNetExpr_ = 0; // 5.6 + supplySensLength_ = 0; // 5.6 + supplySens_ = 0; // 5.6 + hasSupplySens_ = 0; // 5.6 + groundSensLength_ = 0; // 5.6 + groundSens_ = 0; // 5.6 + hasGroundSens_ = 0; // 5.6 + layers_ = 0; // 5.6 + layersAllocated_ = 0; // 5.6 + numLayers_ = 0; // 5.6 + polygonNames_ = 0; // 5.6 + numPolys_ = 0; // 5.6 + polysAllocated_ = 0; // 5.6 + polygons_ = 0; // 5.6 + numAPinPartialMetalArea_ = 0; // 5.4 + APinPartialMetalAreaAllocated_ = 0; // 5.4 + APinPartialMetalArea_ = 0; + APinPartialMetalAreaLayer_ = 0; + numAPinPartialMetalSideArea_ = 0; // 5.4 + APinPartialMetalSideAreaAllocated_ = 0; // 5.4 + APinPartialMetalSideArea_ = 0; + APinPartialMetalSideAreaLayer_ = 0; + numAPinDiffArea_ = 0; // 5.4 + APinDiffAreaAllocated_ = 0; // 5.4 + APinDiffArea_ = 0; + APinDiffAreaLayer_ = 0; + numAPinPartialCutArea_ = 0; // 5.4 + APinPartialCutAreaAllocated_ = 0; // 5.4 + APinPartialCutArea_ = 0; + APinPartialCutAreaLayer_ = 0; + antennaModel_ = 0; + viaNames_ = 0; // 5.7 + viasAllocated_ = 0; // 5.7 + numVias_ = 0; // 5.7 + viaX_ = 0; // 5.7 + viaY_ = 0; // 5.7 + numPorts_ = 0; // 5.7 + pinPort_ = 0; // 5.7 + numAntennaModel_ = 0; + antennaModelAllocated_ = 0; + polyMinSpacing_ = 0; + polyEffectiveWidth_ = 0; + polyMask_ = 0; + layerMinSpacing_ = 0; + layerEffectiveWidth_ = 0; + layerMask_ =0; + viaMask_ = 0; +} + + +DEF_COPY_CONSTRUCTOR_C( defiPin ) { + this->Init(); + + DEF_COPY_FUNC( pinNameLength_ ); + DEF_MALLOC_FUNC( pinName_, char, sizeof(char) * (strlen(prev.pinName_) +1)); + DEF_COPY_FUNC( netNameLength_ ); + DEF_MALLOC_FUNC( netName_, char, sizeof(char) * (strlen(prev.netName_) +1)); + DEF_COPY_FUNC( hasDirection_ ); + DEF_COPY_FUNC( hasUse_ ); + DEF_COPY_FUNC( placeType_ ); + DEF_COPY_FUNC( orient_ ); + DEF_COPY_FUNC( useLength_ ); + DEF_MALLOC_FUNC( use_, char, sizeof(char) * (strlen(prev.use_) +1)); + DEF_COPY_FUNC( directionLength_ ); + DEF_MALLOC_FUNC( direction_, char, sizeof(char) * (strlen(prev.direction_) +1)); + + DEF_COPY_FUNC( layersAllocated_ ); + DEF_COPY_FUNC( numLayers_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( layers_, numLayers_); + DEF_MALLOC_FUNC( xl_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( yl_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( xh_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( yh_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( layerMinSpacing_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( layerEffectiveWidth_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( layerMask_, int, sizeof(int) * numLayers_); + + + DEF_COPY_FUNC( numPolys_ ); + DEF_COPY_FUNC( polysAllocated_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( polygonNames_, numPolys_); + DEF_MALLOC_FUNC( polyMinSpacing_, int, sizeof(int) * numPolys_); + DEF_MALLOC_FUNC( polyEffectiveWidth_, int, sizeof(int) * numPolys_); + DEF_MALLOC_FUNC( polyMask_, int, sizeof(int) * numPolys_); + DEF_MALLOC_FUNC_FOR_2D_POINT( polygons_, numPolys_); + + DEF_COPY_FUNC( x_ ); + DEF_COPY_FUNC( y_ ); + DEF_COPY_FUNC( hasSpecial_ ); + + DEF_COPY_FUNC( numVias_ ); + DEF_COPY_FUNC( viasAllocated_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( viaNames_, numVias_); + DEF_MALLOC_FUNC( viaX_, int, sizeof(int) * numVias_); + DEF_MALLOC_FUNC( viaY_, int, sizeof(int) * numVias_); + DEF_MALLOC_FUNC( viaMask_, int, sizeof(int) * numVias_); + + DEF_COPY_FUNC( numPorts_ ); + DEF_COPY_FUNC( portsAllocated_ ); + DEF_MALLOC_FUNC_FOR_2D_MALLOC_NEW( pinPort_, defiPinPort, numPorts_, 1 ); + + DEF_COPY_FUNC( numAntennaModel_ ); + DEF_COPY_FUNC( antennaModelAllocated_ ); + DEF_MALLOC_FUNC_FOR_2D( antennaModel_, defiPinAntennaModel, numAntennaModel_, 1); + + DEF_COPY_FUNC( numAPinPartialMetalArea_ ); + DEF_COPY_FUNC( APinPartialMetalAreaAllocated_ ); + DEF_MALLOC_FUNC( APinPartialMetalArea_, int, sizeof(int) * numAPinPartialMetalArea_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( APinPartialMetalAreaLayer_, numAPinPartialMetalArea_ ); + + DEF_COPY_FUNC( numAPinPartialMetalSideArea_ ); + DEF_COPY_FUNC( APinPartialMetalSideAreaAllocated_ ); + DEF_MALLOC_FUNC( APinPartialMetalSideArea_, int, sizeof(int) * numAPinPartialMetalSideArea_); + DEF_MALLOC_FUNC_FOR_2D_STR( APinPartialMetalSideAreaLayer_, numAPinPartialMetalSideArea_ ); + + DEF_COPY_FUNC( numAPinDiffArea_ ); + DEF_COPY_FUNC( APinDiffAreaAllocated_ ); + DEF_MALLOC_FUNC( APinDiffArea_, int, sizeof(int) * numAPinDiffArea_); + DEF_MALLOC_FUNC_FOR_2D_STR( APinDiffAreaLayer_, numAPinDiffArea_ ); + + DEF_COPY_FUNC( numAPinPartialCutArea_ ); + DEF_COPY_FUNC( APinPartialCutAreaAllocated_ ); + DEF_MALLOC_FUNC( APinPartialCutArea_, int, sizeof(int) * numAPinPartialCutArea_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( APinPartialCutAreaLayer_, numAPinPartialCutArea_ ); + + DEF_COPY_FUNC( netExprLength_ ); + DEF_COPY_FUNC( hasNetExpr_ ); + DEF_MALLOC_FUNC( netExpr_, char, sizeof(char) * (strlen(prev.netExpr_) +1)); + + DEF_COPY_FUNC( supplySensLength_ ); + DEF_COPY_FUNC( hasSupplySens_ ); + DEF_MALLOC_FUNC( supplySens_, char, sizeof(char) * (strlen(prev.supplySens_) +1)); + + DEF_COPY_FUNC( groundSensLength_ ); + DEF_COPY_FUNC( hasGroundSens_ ); + DEF_MALLOC_FUNC( groundSens_, char, sizeof(char) * (strlen(prev.groundSens_) +1)); + +} + +DEF_ASSIGN_OPERATOR_C( defiPin ) { + CHECK_SELF_ASSIGN + this->Init(); + DEF_COPY_FUNC( pinNameLength_ ); + DEF_MALLOC_FUNC( pinName_, char, sizeof(char) * (strlen(prev.pinName_) +1)); + DEF_COPY_FUNC( netNameLength_ ); + DEF_MALLOC_FUNC( netName_, char, sizeof(char) * (strlen(prev.netName_) +1)); + DEF_COPY_FUNC( hasDirection_ ); + DEF_COPY_FUNC( hasUse_ ); + DEF_COPY_FUNC( placeType_ ); + DEF_COPY_FUNC( orient_ ); + DEF_COPY_FUNC( useLength_ ); + DEF_MALLOC_FUNC( use_, char, sizeof(char) * (strlen(prev.use_) +1)); + DEF_COPY_FUNC( directionLength_ ); + DEF_MALLOC_FUNC( direction_, char, sizeof(char) * (strlen(prev.direction_) +1)); + + DEF_COPY_FUNC( layersAllocated_ ); + DEF_COPY_FUNC( numLayers_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( layers_, numLayers_); + DEF_MALLOC_FUNC( xl_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( yl_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( xh_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( yh_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( layerMinSpacing_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( layerEffectiveWidth_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( layerMask_, int, sizeof(int) * numLayers_); + + + DEF_COPY_FUNC( numPolys_ ); + DEF_COPY_FUNC( polysAllocated_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( polygonNames_, numPolys_); + DEF_MALLOC_FUNC( polyMinSpacing_, int, sizeof(int) * numPolys_); + DEF_MALLOC_FUNC( polyEffectiveWidth_, int, sizeof(int) * numPolys_); + DEF_MALLOC_FUNC( polyMask_, int, sizeof(int) * numPolys_); + DEF_MALLOC_FUNC_FOR_2D_POINT( polygons_, numPolys_); + + DEF_COPY_FUNC( x_ ); + DEF_COPY_FUNC( y_ ); + DEF_COPY_FUNC( hasSpecial_ ); + + DEF_COPY_FUNC( numVias_ ); + DEF_COPY_FUNC( viasAllocated_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( viaNames_, numVias_); + DEF_MALLOC_FUNC( viaX_, int, sizeof(int) * numVias_); + DEF_MALLOC_FUNC( viaY_, int, sizeof(int) * numVias_); + DEF_MALLOC_FUNC( viaMask_, int, sizeof(int) * numVias_); + + DEF_COPY_FUNC( numPorts_ ); + DEF_COPY_FUNC( portsAllocated_ ); + DEF_MALLOC_FUNC_FOR_2D_MALLOC_NEW( pinPort_, defiPinPort, numPorts_, 1 ); + + DEF_COPY_FUNC( numAntennaModel_ ); + DEF_COPY_FUNC( antennaModelAllocated_ ); + DEF_MALLOC_FUNC_FOR_2D( antennaModel_, defiPinAntennaModel, numAntennaModel_, 1); + + DEF_COPY_FUNC( numAPinPartialMetalArea_ ); + DEF_COPY_FUNC( APinPartialMetalAreaAllocated_ ); + DEF_MALLOC_FUNC( APinPartialMetalArea_, int, sizeof(int) * numAPinPartialMetalArea_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( APinPartialMetalAreaLayer_, numAPinPartialMetalArea_ ); + + DEF_COPY_FUNC( numAPinPartialMetalSideArea_ ); + DEF_COPY_FUNC( APinPartialMetalSideAreaAllocated_ ); + DEF_MALLOC_FUNC( APinPartialMetalSideArea_, int, sizeof(int) * numAPinPartialMetalSideArea_); + DEF_MALLOC_FUNC_FOR_2D_STR( APinPartialMetalSideAreaLayer_, numAPinPartialMetalSideArea_ ); + + DEF_COPY_FUNC( numAPinDiffArea_ ); + DEF_COPY_FUNC( APinDiffAreaAllocated_ ); + DEF_MALLOC_FUNC( APinDiffArea_, int, sizeof(int) * numAPinDiffArea_); + DEF_MALLOC_FUNC_FOR_2D_STR( APinDiffAreaLayer_, numAPinDiffArea_ ); + + DEF_COPY_FUNC( numAPinPartialCutArea_ ); + DEF_COPY_FUNC( APinPartialCutAreaAllocated_ ); + DEF_MALLOC_FUNC( APinPartialCutArea_, int, sizeof(int) * numAPinPartialCutArea_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( APinPartialCutAreaLayer_, numAPinPartialCutArea_ ); + + DEF_COPY_FUNC( netExprLength_ ); + DEF_COPY_FUNC( hasNetExpr_ ); + DEF_MALLOC_FUNC( netExpr_, char, sizeof(char) * (strlen(prev.netExpr_) +1)); + + DEF_COPY_FUNC( supplySensLength_ ); + DEF_COPY_FUNC( hasSupplySens_ ); + DEF_MALLOC_FUNC( supplySens_, char, sizeof(char) * (strlen(prev.supplySens_) +1)); + + DEF_COPY_FUNC( groundSensLength_ ); + DEF_COPY_FUNC( hasGroundSens_ ); + DEF_MALLOC_FUNC( groundSens_, char, sizeof(char) * (strlen(prev.groundSens_) +1)); + return *this; +} + +defiPin::~defiPin() { + Destroy(); +} + + +void defiPin::clear() { + int i; + + hasDirection_ = 0; + hasNetExpr_ = 0; + hasSupplySens_ = 0; + hasGroundSens_ = 0; + hasUse_ = 0; + hasSpecial_ = 0; + placeType_ = 0; + orient_ = 0; + x_ = 0; + y_ = 0; + + if (layers_) { + for (i = 0; i < numLayers_; i++) + if (layers_[i]) free(layers_[i]); + free((char*)(layers_)); + free((char*)(xl_)); + free((char*)(yl_)); + free((char*)(xh_)); + free((char*)(yh_)); + free((char*)(layerMinSpacing_)); + free((char*)(layerMask_)); + free((char*)(layerEffectiveWidth_)); + } + layers_ = 0; + layerMinSpacing_ = 0; + layerMask_ = 0; + layerEffectiveWidth_ = 0; + numLayers_ = 0; + layersAllocated_ = 0; + // 5.6 + if (polygonNames_) { + struct defiPoints* p; + for (i = 0; i < numPolys_; i++) { + if (polygonNames_[i]) free((char*)(polygonNames_[i])); + p = polygons_[i]; + free((char*)(p->x)); + free((char*)(p->y)); + free((char*)(polygons_[i])); + } + free((char*)(polygonNames_)); + free((char*)(polygons_)); + free((char*)(polyMinSpacing_)); + free((char*)(polyMask_)); + free((char*)(polyEffectiveWidth_)); + polygonNames_ = 0; + polygons_ = 0; + polyMinSpacing_ = 0; + polyMask_ = 0; + polyEffectiveWidth_ = 0; + } + numPolys_ = 0; + polysAllocated_ = 0; + // 5.7 + if (viaNames_) { + for (i = 0; i < numVias_; i++) + if (viaNames_[i]) free(viaNames_[i]); + free((char*)(viaNames_)); + free((char*)(viaX_)); + free((char*)(viaY_)); + free((char*)(viaMask_)); + } + viaNames_ = 0; + numVias_ = 0; + viaMask_ = 0; + viasAllocated_ = 0; + // 5.7 + if (pinPort_) { + for (i = 0; i < numPorts_; i++) { + if (pinPort_[i]) { + pinPort_[i]->clear(); + delete pinPort_[i]; +// free(pinPort_[i]); + } + } + free(pinPort_); + } + pinPort_ = 0; + numPorts_ = 0; + portsAllocated_ = 0; + + for (i = 0; i < numAPinPartialMetalArea_; i++) { + if (APinPartialMetalAreaLayer_[i]) + free(APinPartialMetalAreaLayer_[i]); + } + numAPinPartialMetalArea_ = 0; + + for (i = 0; i < numAPinPartialMetalSideArea_; i++) { + if (APinPartialMetalSideAreaLayer_[i]) + free(APinPartialMetalSideAreaLayer_[i]); + } + numAPinPartialMetalSideArea_ = 0; + + for (i = 0; i < numAPinDiffArea_; i++) { + if (APinDiffAreaLayer_[i]) + free(APinDiffAreaLayer_[i]); + } + numAPinDiffArea_ = 0; + + for (i = 0; i < numAPinPartialCutArea_; i++) { + if (APinPartialCutAreaLayer_[i]) + free(APinPartialCutAreaLayer_[i]); + } + numAPinPartialCutArea_ = 0; + + for (i = 0; i < antennaModelAllocated_; i++) { // 5.5 + delete antennaModel_[i]; + } + + numAntennaModel_ = 0; + antennaModelAllocated_ = 0; +} + + +void defiPin::Destroy() { + if (pinName_) free(pinName_); + if (netName_) free(netName_); + if (use_) free(use_); + if (direction_) free(direction_); + if (netExpr_) free(netExpr_); + if (supplySens_) free(supplySens_); + if (groundSens_) free(groundSens_); + pinName_ = 0; + netName_ = 0; + use_ = 0; + direction_ = 0; + netExpr_ = 0; + supplySens_ = 0; + groundSens_ = 0; + pinNameLength_ = 0; + netNameLength_ = 0; + useLength_ = 0; + directionLength_ = 0; + netExprLength_ = 0; + supplySensLength_ = 0; + groundSensLength_ = 0; + layersAllocated_ = 0; + clear(); + + // 5.4 + if (APinPartialMetalArea_) + free((char*)(APinPartialMetalArea_)); + if (APinPartialMetalAreaLayer_) + free((char*)(APinPartialMetalAreaLayer_)); + if (APinPartialMetalSideArea_) + free((char*)(APinPartialMetalSideArea_)); + if (APinPartialMetalSideAreaLayer_) + free((char*)(APinPartialMetalSideAreaLayer_)); + if (APinDiffArea_) + free((char*)(APinDiffArea_)); + if (APinDiffAreaLayer_) + free((char*)(APinDiffAreaLayer_)); + if (APinPartialCutArea_) + free((char*)(APinPartialCutArea_)); + if (APinPartialCutAreaLayer_) + free((char*)(APinPartialCutAreaLayer_)); + if (antennaModel_) + free((char*)(antennaModel_)); +} + + +void defiPin::Setup(const char* pinName, const char* netName) { + int len = strlen(pinName) + 1; + if (pinNameLength_ < len) { + if (pinName_) free(pinName_); + pinName_ = (char*)malloc(len); + pinNameLength_ = len; + } + strcpy(pinName_, defData->DEFCASE(pinName)); + + len = strlen(netName) + 1; + if (netNameLength_ < len) { + if (netName_) free(netName_); + netName_ = (char*)malloc(len); + netNameLength_ = len; + } + strcpy(netName_, defData->DEFCASE(netName)); + + clear(); + +} + + +void defiPin::setDirection(const char* dir) { + int len = strlen(dir) + 1; + if (directionLength_ < len) { + if (direction_) free(direction_); + direction_ = (char*)malloc(len); + directionLength_ = len; + } + strcpy(direction_, defData->DEFCASE(dir)); + hasDirection_ = 1; +} + + +void defiPin::setNetExpr(const char* name) { + int len = strlen(name) + 1; + if (netExprLength_ < len) { + if (netExpr_) free(netExpr_); + netExpr_ = (char*)malloc(len); + netExprLength_ = len; + } + strcpy(netExpr_, defData->DEFCASE(name)); + hasNetExpr_ = 1; +} + + +void defiPin::setSupplySens(const char* name) { + int len = strlen(name) + 1; + if (supplySensLength_ < len) { + if (supplySens_) free(supplySens_); + supplySens_ = (char*)malloc(len); + supplySensLength_ = len; + } + strcpy(supplySens_, defData->DEFCASE(name)); + hasSupplySens_ = 1; +} + + +void defiPin::setGroundSens(const char* name) { + int len = strlen(name) + 1; + if (groundSensLength_ < len) { + if (groundSens_) free(groundSens_); + groundSens_ = (char*)malloc(len); + groundSensLength_ = len; + } + strcpy(groundSens_, defData->DEFCASE(name)); + hasGroundSens_ = 1; +} + + +void defiPin::setUse(const char* use) { + int len = strlen(use) + 1; + if (useLength_ < len) { + if (use_) free(use_); + use_ = (char*)malloc(len); + useLength_ = len; + } + strcpy(use_, defData->DEFCASE(use)); + hasUse_ = 1; +} + + +// 5.6, renamed from setLayer to addLayer for multiple layers allowed +void defiPin::addLayer(const char* layer) { + + if (numLayers_ >= layersAllocated_) { + int i; + char** newl; + int *nxl, *nyl, *nxh, *nyh; + int *lms, *lew, *lm; + + layersAllocated_ = layersAllocated_ ? + layersAllocated_ * 2 : 8; + newl = (char**)malloc(layersAllocated_ * sizeof(char*)); + nxl = (int*)malloc(layersAllocated_ * sizeof(int)); + nyl = (int*)malloc(layersAllocated_ * sizeof(int)); + nxh = (int*)malloc(layersAllocated_ * sizeof(int)); + nyh = (int*)malloc(layersAllocated_ * sizeof(int)); + lms = (int*)malloc(layersAllocated_ * sizeof(int)); + lew = (int*)malloc(layersAllocated_ * sizeof(int)); + lm = (int*)malloc(layersAllocated_ * sizeof(int)); + + for (i = 0; i < numLayers_; i++) { + newl[i] = layers_[i]; + nxl[i] = xl_[i]; + nyl[i] = yl_[i]; + nxh[i] = xh_[i]; + nyh[i] = yh_[i]; + lms[i] = layerMinSpacing_[i]; + lew[i] = layerEffectiveWidth_[i]; + lm[i] = layerMask_[i]; + } + if (numLayers_ > 0) { + free((char*)layers_); + free((char*)xl_); + free((char*)yl_); + free((char*)xh_); + free((char*)yh_); + free((char*)layerMinSpacing_); + free((char*)layerMask_); + free((char*)layerEffectiveWidth_); + } + layers_ = newl; + xl_ = nxl; + yl_ = nyl; + xh_ = nxh; + yh_ = nyh; + layerMinSpacing_ = lms; + layerEffectiveWidth_ = lew; + layerMask_ = lm; + } + layers_[numLayers_] = (char*)malloc(strlen(layer)+1); + strcpy(layers_[numLayers_], defData->DEFCASE(layer)); + xl_[numLayers_] = 0; + yl_[numLayers_] = 0; + xh_[numLayers_] = 0; + yh_[numLayers_] = 0; + layerMinSpacing_[numLayers_] = -1; + layerMask_[numLayers_] = 0; + layerEffectiveWidth_[numLayers_] = -1; + numLayers_ += 1; +} + +// 5.6 +void defiPin::addLayerPts(int xl, int yl, int xh, int yh) { + xl_[numLayers_-1] = xl; + yl_[numLayers_-1] = yl; + xh_[numLayers_-1] = xh; + yh_[numLayers_-1] = yh; +} + +// 5.6 +void defiPin::addLayerSpacing(int minSpacing) { + layerMinSpacing_[numLayers_-1] = minSpacing; +} + +void defiPin::addLayerMask(int mask) { + layerMask_[numLayers_-1] = mask; +} + +// 5.6 +void defiPin::addLayerDesignRuleWidth(int effectiveWidth) { + layerEffectiveWidth_[numLayers_-1] = effectiveWidth; +} + + +void defiPin::setPlacement(int typ, int x, int y, int orient) { + x_ = x; + y_ = y; + orient_ = orient; + placeType_ = typ; +} + + +const char* defiPin::pinName() const { + return pinName_; +} + + +const char* defiPin::netName() const { + return netName_; +} + + +void defiPin::changePinName(const char* pinName) { + int len = strlen(pinName) + 1; + if (pinNameLength_ < len) { + if (pinName_) free(pinName_); + pinName_ = (char*)malloc(len); + pinNameLength_ = len; + } + strcpy(pinName_, defData->DEFCASE(pinName)); +} + + +int defiPin::hasDirection() const { + return (int)(hasDirection_); +} + + +int defiPin::hasUse() const { + return (int)(hasUse_); +} + + +int defiPin::hasLayer() const { + if (numLayers_ || numPolys_) // 5.6, either layer or polygon is + return 1; // non-zero + else + return 0; +} + + +int defiPin::hasPlacement() const { + return placeType_ == 0 ? 0 : 1 ; +} + + +int defiPin::isUnplaced() const { + return placeType_ == DEFI_COMPONENT_UNPLACED ? 1 : 0 ; +} + + +int defiPin::isPlaced() const { + return placeType_ == DEFI_COMPONENT_PLACED ? 1 : 0 ; +} + + +int defiPin::isCover() const { + return placeType_ == DEFI_COMPONENT_COVER ? 1 : 0 ; +} + + +int defiPin::isFixed() const { + return placeType_ == DEFI_COMPONENT_FIXED ? 1 : 0 ; +} + + +int defiPin::placementX() const { + return x_; +} + + +int defiPin::placementY() const { + return y_; +} + + +const char* defiPin::direction() const { + return direction_; +} + + +const char* defiPin::use() const { + return use_; +} + + +int defiPin::numLayer() const { + return numLayers_; +} + +const char* defiPin::layer(int index) const { + return layers_[index]; +} + + +void defiPin::bounds(int index, int* xl, int* yl, int* xh, int* yh) const { + if (xl) *xl = xl_[index]; + if (yl) *yl = yl_[index]; + if (xh) *xh = xh_[index]; + if (yh) *yh = yh_[index]; +} + +// 5.6 +int defiPin::hasLayerSpacing(int index) const{ + if (layerMinSpacing_[index] == -1) + return 0; + return 1; +} + +// 5.6 +int defiPin::hasLayerDesignRuleWidth(int index) const{ + if (layerEffectiveWidth_[index] == -1) + return 0; + return 1; +} + +// 5.6 +int defiPin::layerSpacing(int index) const { + return layerMinSpacing_[index]; +} + +int defiPin::layerMask(int index) const { + return layerMask_[index]; +} + +// 5.6 +int defiPin::layerDesignRuleWidth(int index) const { + return layerEffectiveWidth_[index]; +} + +int defiPin::orient() const { + return orient_; +} + +const char* defiPin::orientStr() const { + return (defiOrientStr(orient_)); +} + + +void defiPin::setSpecial() { + hasSpecial_ = 1; +} + +// 5.5 +void defiPin::addAntennaModel(int oxide) { + // For version 5.5 only OXIDE1, OXIDE2, OXIDE3, & OXIDE4 + // are defined within a pin + defiPinAntennaModel* amo; + int i; + + if (numAntennaModel_ == 0) { // does not have antennaModel + if (!antennaModel_) // only need to malloc if it is nill + antennaModel_ = (defiPinAntennaModel**) + malloc(sizeof(defiPinAntennaModel*)*4); + antennaModelAllocated_ = 4; + for (i = 0; i < 4; i++) { + antennaModel_[i] = new defiPinAntennaModel(defData); + } + numAntennaModel_++; + antennaModelAllocated_ = 4; + amo = antennaModel_[0]; + } else { + amo = antennaModel_[numAntennaModel_]; + numAntennaModel_++; + } + amo->Init(); + amo->setAntennaModel(oxide); + return; +} + +// 5.5 +int defiPin::numAntennaModel() const { + return numAntennaModel_; +} + +// 5.5 +defiPinAntennaModel* defiPin::antennaModel(int index) const { + return antennaModel_[index]; +} + +void defiPin::addAPinPartialMetalArea(int value, const char* layer) { + if (numAPinPartialMetalArea_ == APinPartialMetalAreaAllocated_) { + int i; + int max; + int lim = numAPinPartialMetalArea_; + int* nd; + char** nl; + + if (APinPartialMetalAreaAllocated_ == 0) + max = APinPartialMetalAreaAllocated_ = 2; + else + max = APinPartialMetalAreaAllocated_ *= 2; + nd = (int*)malloc(sizeof(int)*max); + nl = (char**)malloc(sizeof(char*)*max); + for (i = 0; i < lim; i++) { + nd[i] = APinPartialMetalArea_[i]; + nl[i] = APinPartialMetalAreaLayer_[i]; + } + free((char*)(APinPartialMetalArea_)); + free((char*)(APinPartialMetalAreaLayer_)); + APinPartialMetalArea_ = nd; + APinPartialMetalAreaLayer_ = nl; + + } + APinPartialMetalArea_[numAPinPartialMetalArea_] = value; + if (layer) { + APinPartialMetalAreaLayer_[numAPinPartialMetalArea_] = + (char*)malloc(strlen(layer)+1); + strcpy(APinPartialMetalAreaLayer_[numAPinPartialMetalArea_], + defData->DEFCASE(layer)); + } else + APinPartialMetalAreaLayer_[numAPinPartialMetalArea_] = NULL; + numAPinPartialMetalArea_ += 1; +} + + +void defiPin::addAPinPartialMetalSideArea(int value, const char* layer) { + if (numAPinPartialMetalSideArea_ == APinPartialMetalSideAreaAllocated_) { + int i; + int max; + int lim = numAPinPartialMetalSideArea_; + int* nd; + char** nl; + + if (APinPartialMetalSideAreaAllocated_ == 0) + max = APinPartialMetalSideAreaAllocated_ = 2; + else + max = APinPartialMetalSideAreaAllocated_ *= 2; + nd = (int*)malloc(sizeof(int)*max); + nl = (char**)malloc(sizeof(char*)*max); + for (i = 0; i < lim; i++) { + nd[i] = APinPartialMetalSideArea_[i]; + nl[i] = APinPartialMetalSideAreaLayer_[i]; + } + free((char*)(APinPartialMetalSideArea_)); + free((char*)(APinPartialMetalSideAreaLayer_)); + APinPartialMetalSideArea_ = nd; + APinPartialMetalSideAreaLayer_ = nl; + + } + APinPartialMetalSideArea_[numAPinPartialMetalSideArea_] = value; + if (layer) { + APinPartialMetalSideAreaLayer_[numAPinPartialMetalSideArea_] = + (char*)malloc(strlen(layer)+1); + strcpy(APinPartialMetalSideAreaLayer_[numAPinPartialMetalSideArea_], + defData->DEFCASE(layer)); + } else + APinPartialMetalSideAreaLayer_[numAPinPartialMetalSideArea_] = NULL; + numAPinPartialMetalSideArea_ += 1; +} + + +void defiPin::addAPinGateArea(int value, const char* layer) { + if (numAntennaModel_ == 0) // haven't created any antennaModel yet + addAntennaModel(1); + antennaModel_[numAntennaModel_-1]->addAPinGateArea(value, layer); +} + + +void defiPin::addAPinDiffArea(int value, const char* layer) { + if (numAPinDiffArea_ == APinDiffAreaAllocated_) { + int i; + int max; + int lim = numAPinDiffArea_; + int* nd; + char** nl; + + if (APinDiffAreaAllocated_ == 0) + max = APinDiffAreaAllocated_ = 2; + else + max = APinDiffAreaAllocated_ *= 2; + nd = (int*)malloc(sizeof(int)*max); + nl = (char**)malloc(sizeof(char*)*max); + for (i = 0; i < lim; i++) { + nd[i] = APinDiffArea_[i]; + nl[i] = APinDiffAreaLayer_[i]; + } + free((char*)(APinDiffArea_)); + free((char*)(APinDiffAreaLayer_)); + APinDiffArea_ = nd; + APinDiffAreaLayer_ = nl; + + } + APinDiffArea_[numAPinDiffArea_] = value; + if (layer) { + APinDiffAreaLayer_[numAPinDiffArea_] = + (char*)malloc(strlen(layer)+1); + strcpy(APinDiffAreaLayer_[numAPinDiffArea_], + defData->DEFCASE(layer)); + } else + APinDiffAreaLayer_[numAPinDiffArea_] = NULL; + numAPinDiffArea_ += 1; +} + + +void defiPin::addAPinMaxAreaCar(int value, const char* layer) { + if (numAntennaModel_ == 0) // haven't created any antennaModel yet + addAntennaModel(1); + antennaModel_[numAntennaModel_-1]->addAPinMaxAreaCar(value, layer); +} + + +void defiPin::addAPinMaxSideAreaCar(int value, const char* layer) { + if (numAntennaModel_ == 0) // haven't created any antennaModel yet + addAntennaModel(1); + antennaModel_[numAntennaModel_-1]->addAPinMaxSideAreaCar(value, layer); +} + + +void defiPin::addAPinPartialCutArea(int value, const char* layer) { + if (numAPinPartialCutArea_ == APinPartialCutAreaAllocated_) { + int i; + int max; + int lim = numAPinPartialCutArea_; + int* nd; + char** nl; + + if (APinPartialCutAreaAllocated_ == 0) + max = APinPartialCutAreaAllocated_ = 2; + else + max = APinPartialCutAreaAllocated_ *= 2; + nd = (int*)malloc(sizeof(int)*max); + nl = (char**)malloc(sizeof(char*)*max); + for (i = 0; i < lim; i++) { + nd[i] = APinPartialCutArea_[i]; + nl[i] = APinPartialCutAreaLayer_[i]; + } + free((char*)(APinPartialCutArea_)); + free((char*)(APinPartialCutAreaLayer_)); + APinPartialCutArea_ = nd; + APinPartialCutAreaLayer_ = nl; + + } + APinPartialCutArea_[numAPinPartialCutArea_] = value; + if (layer) { + APinPartialCutAreaLayer_[numAPinPartialCutArea_] = + (char*)malloc(strlen(layer)+1); + strcpy(APinPartialCutAreaLayer_[numAPinPartialCutArea_], + defData->DEFCASE(layer)); + } else + APinPartialCutAreaLayer_[numAPinPartialCutArea_] = NULL; + numAPinPartialCutArea_ += 1; +} + + +void defiPin::addAPinMaxCutCar(int value, const char* layer) { + if (numAntennaModel_ == 0) // haven't created any antennaModel yet + addAntennaModel(1); + antennaModel_[numAntennaModel_-1]->addAPinMaxCutCar(value, layer); +} + + +int defiPin::hasSpecial() const { + return (int)hasSpecial_; +} + + +int defiPin::hasAPinPartialMetalArea() const { + return numAPinPartialMetalArea_ ? 1 : 0 ; +} + + +int defiPin::hasAPinPartialMetalSideArea() const { + return numAPinPartialMetalSideArea_ ? 1 : 0 ; +} + + +int defiPin::hasAPinDiffArea() const { + return numAPinDiffArea_ ? 1 : 0 ; +} + + +int defiPin::hasAPinPartialCutArea() const { + return numAPinPartialCutArea_ ? 1 : 0 ; +} + + +int defiPin::numAPinPartialMetalArea() const { + return numAPinPartialMetalArea_; +} + + +int defiPin::numAPinPartialMetalSideArea() const { + return numAPinPartialMetalSideArea_; +} + + +int defiPin::numAPinDiffArea() const { + return numAPinDiffArea_; +} + + +int defiPin::numAPinPartialCutArea() const { + return numAPinPartialCutArea_; +} + + +int defiPin::APinPartialMetalArea(int i) const { + return APinPartialMetalArea_[i]; +} + + +int defiPin::hasAPinPartialMetalAreaLayer(int i) const { + return (APinPartialMetalAreaLayer_[i] && + *(APinPartialMetalAreaLayer_[i])) ? 1 : 0 ; +} + + +const char* defiPin::APinPartialMetalAreaLayer(int i) const { + return APinPartialMetalAreaLayer_[i]; +} + + +int defiPin::APinPartialMetalSideArea(int i) const { + return APinPartialMetalSideArea_[i]; +} + + +int defiPin::hasAPinPartialMetalSideAreaLayer(int i) const { + return (APinPartialMetalSideAreaLayer_[i] && + *(APinPartialMetalSideAreaLayer_[i])) ? 1 : 0 ; +} + + +const char* defiPin::APinPartialMetalSideAreaLayer(int i) const { + return APinPartialMetalSideAreaLayer_[i]; +} + + +int defiPin::APinDiffArea(int i) const { + return APinDiffArea_[i]; +} + + +int defiPin::hasAPinDiffAreaLayer(int i) const { + return (APinDiffAreaLayer_[i] && *(APinDiffAreaLayer_[i])) ? + 1 : 0 ; +} + + +const char* defiPin::APinDiffAreaLayer(int i) const { + return APinDiffAreaLayer_[i]; +} + + +int defiPin::APinPartialCutArea(int i) const { + return APinPartialCutArea_[i]; +} + + +int defiPin::hasAPinPartialCutAreaLayer(int i) const { + return (APinPartialCutAreaLayer_[i] && + *(APinPartialCutAreaLayer_[i])) ? 1 : 0 ; +} + + +const char* defiPin::APinPartialCutAreaLayer(int i) const { + return APinPartialCutAreaLayer_[i]; +} + + +// 5.6 +void defiPin::addPolygon(const char* layerName) { + int *pms, *pdw, *pm; + int i; + + if (numPolys_ == polysAllocated_) { + char** newn; + struct defiPoints** poly; + polysAllocated_ = (polysAllocated_ == 0) ? + 2 : polysAllocated_ * 2; + newn = (char**)malloc(sizeof(char*) * polysAllocated_); + poly = (struct defiPoints**)malloc(sizeof(struct defiPoints*) * + polysAllocated_); + pms = (int*)malloc(polysAllocated_ * sizeof(int)); + pdw = (int*)malloc(polysAllocated_ * sizeof(int)); + pm = (int*)malloc(polysAllocated_ * sizeof(int)); + + for (i = 0; i < numPolys_; i++) { + newn[i] = polygonNames_[i]; + poly[i] = polygons_[i]; + pms[i] = polyMinSpacing_[i]; + pdw[i] = polyEffectiveWidth_[i]; + pm[i] = polyMask_[i]; + } + if (numPolys_ > 0) { + free((char*)(polygons_)); + free((char*)(polygonNames_)); + free((char*)(polyMinSpacing_)); + free((char*)(polyEffectiveWidth_)); + free((char*)(polyMask_)); + } + polygonNames_ = newn; + polygons_ = poly; + polyMinSpacing_ = pms; + polyEffectiveWidth_ = pdw; + polyMask_= pm; + } + polygonNames_[numPolys_] = strdup(layerName); + polygons_[numPolys_] = 0; + polyMinSpacing_[numPolys_] = -1; + polyEffectiveWidth_[numPolys_] = -1; + polyMask_[numPolys_] = 0; + numPolys_ += 1; +} + + +// 5.6 +void defiPin::addPolygonPts(defiGeometries* geom) { + struct defiPoints* p; + int x, y; + int i; + + p = (struct defiPoints*)malloc(sizeof(struct defiPoints)); + p->numPoints = geom->numPoints(); + p->x = (int*)malloc(sizeof(int)*p->numPoints); + p->y = (int*)malloc(sizeof(int)*p->numPoints); + for (i = 0; i < p->numPoints; i++) { + geom->points(i, &x, &y); + p->x[i] = x; + p->y[i] = y; + } + polygons_[numPolys_-1] = p; +} + + +// 5.6 +void defiPin::addPolySpacing(int minSpacing) { + polyMinSpacing_[numPolys_-1] = minSpacing; +} + +void defiPin::addPolyMask(int color) { + polyMask_[numPolys_-1] = color; +} + +// 5.6 +void defiPin::addPolyDesignRuleWidth(int effectiveWidth) { + polyEffectiveWidth_[numPolys_-1] = effectiveWidth; +} + + +// 5.6 +int defiPin::numPolygons() const { + return numPolys_; +} + + +// 5.6 +const char* defiPin::polygonName(int index) const { + if (index < 0 || index > numPolys_) { + defiError(1, 0, "index out of bounds", defData); + return 0; + } + return polygonNames_[index]; +} + +// 5.6 +struct defiPoints defiPin::getPolygon(int index) const { + return *(polygons_[index]); +} + +// 5.6 +int defiPin::hasPolygonSpacing(int index) const{ + if (polyMinSpacing_[index] == -1) + return 0; + return 1; +} + +// 5.6 +int defiPin::hasPolygonDesignRuleWidth(int index) const{ + if (polyEffectiveWidth_[index] == -1) + return 0; + return 1; +} + +// 5.6 +int defiPin::polygonSpacing(int index) const { + return polyMinSpacing_[index]; +} + +int defiPin::polygonMask(int index) const { + return polyMask_[index]; +} + +// 5.6 +int defiPin::polygonDesignRuleWidth(int index) const { + return polyEffectiveWidth_[index]; +} + +// 5.6 +int defiPin::hasNetExpr() const { + return (int)(hasNetExpr_); +} + +// 5.6 +const char* defiPin::netExpr() const { + return netExpr_; +} + +// 5.6 +int defiPin::hasSupplySensitivity() const { + return (int)(hasSupplySens_); +} + +// 5.6 +const char* defiPin::supplySensitivity() const { + return supplySens_; +} + +// 5.6 +int defiPin::hasGroundSensitivity() const { + return (int)(hasGroundSens_); +} + +// 5.6 +const char* defiPin::groundSensitivity() const { + return groundSens_; +} + +// 5.7 +void defiPin::addVia(const char* viaName, int ptX, int ptY, int color) { + + if (numVias_ >= viasAllocated_) { + int i; + char** newl; + int *nx, *ny, *nm; + + viasAllocated_ = viasAllocated_ ? + viasAllocated_ * 2 : 8; + newl = (char**)malloc(viasAllocated_ * sizeof(char*)); + nx = (int*)malloc(viasAllocated_ * sizeof(int)); + ny = (int*)malloc(viasAllocated_ * sizeof(int)); + nm = (int*)malloc(viasAllocated_ * sizeof(int)); + + for (i = 0; i < numVias_; i++) { + newl[i] = viaNames_[i]; + nx[i] = viaX_[i]; + ny[i] = viaY_[i]; + nm[i] = viaMask_[i]; + } + if (numVias_ > 0) { + free((char*)viaNames_); + free((char*)viaX_); + free((char*)viaY_); + free((char*)viaMask_); + } + viaNames_ = newl; + viaX_ = nx; + viaY_ = ny; + viaMask_ = nm; + } + viaNames_[numVias_] = (char*)malloc(strlen(viaName)+1); + strcpy(viaNames_[numVias_], defData->DEFCASE(viaName)); + viaX_[numVias_] = ptX; + viaY_[numVias_] = ptY; + viaMask_[numVias_] = color; + numVias_ += 1; +} + +// 5.7 +int defiPin::numVias() const { + return numVias_; +} + +// 5.7 +const char* defiPin::viaName(int index) const { + if (index < 0 || index > numVias_) { + defiError(1, 0, "index out of bounds", defData); + return 0; + } + return viaNames_[index]; +} + +// 5.7 +int defiPin::viaPtX(int index) const { + return viaX_[index]; +} + +// 5.7 +int defiPin::viaPtY(int index) const { + return viaY_[index]; +} + +int defiPin::viaTopMask(int index) const { + int cutMaskNum = viaMask_[index] / 10; + + if (cutMaskNum) { + return cutMaskNum /= 10; + } else { + return 0; + } +} + +int defiPin::viaCutMask(int index) const { + int cutMaskNum = viaMask_[index] / 10; + + if (cutMaskNum) { + return cutMaskNum % 10; + } else { + return 0; + } +} + +int defiPin::viaBottomMask(int index) const { + return viaMask_[index] % 10; +} +// 5.7 +void defiPin::addPort() { + defiPinPort** pp; + defiPinPort* pv; + int i; + + if (numPorts_ >= portsAllocated_) { + if (portsAllocated_ == 0) { + pinPort_ = (defiPinPort**) malloc(sizeof(defiPinPort*)*4); + portsAllocated_ = 4; + } else { + portsAllocated_ = portsAllocated_ * 2; + pp = (defiPinPort**) malloc(sizeof(defiPinPort*) * + portsAllocated_); + for (i = 0; i < numPorts_; i++) + pp[i] = pinPort_[i]; + free((char*)(pinPort_)); + pinPort_ = pp; + } + } + pv = new defiPinPort(defData); + pv->Init(); + pinPort_[numPorts_] = pv; + numPorts_ += 1; +} + +// 5.7 +void defiPin::addPortLayer(const char* layer) { + int i = numPorts_ - 1; + pinPort_[i]->addLayer(layer); +} + +// 5.7 +void defiPin::addPortLayerSpacing(int minSpacing) { + int i = numPorts_ - 1; + pinPort_[i]->addLayerSpacing(minSpacing); +} + +void defiPin::addPortLayerMask(int color) { + int i = numPorts_ - 1; + pinPort_[i]->addLayerMask(color); +} + +// 5.7 +void defiPin::addPortLayerDesignRuleWidth(int effectiveWidth) { + int i = numPorts_ - 1; + pinPort_[i]->addLayerDesignRuleWidth(effectiveWidth); +} + +// 5.7 +void defiPin::addPortLayerPts(int xl, int yl, int xh, int yh) { + int i = numPorts_ - 1; + pinPort_[i]->addLayerPts(xl, yl, xh, yh); +} + +// 5.7 +void defiPin::addPortPolygon(const char* layerName) { + int i = numPorts_ - 1; + pinPort_[i]->addPolygon(layerName); +} + +// 5.7 +void defiPin::addPortPolySpacing(int minSpacing) { + int i = numPorts_ - 1; + pinPort_[i]->addPolySpacing(minSpacing); +} + +void defiPin::addPortPolyMask(int color) { + int i = numPorts_ - 1; + pinPort_[i]->addPolyMask(color); +} + +// 5.7 +void defiPin::addPortPolyDesignRuleWidth(int effectiveWidth) { + int i = numPorts_ - 1; + pinPort_[i]->addPolyDesignRuleWidth( effectiveWidth); +} + +// 5.7 +void defiPin::addPortPolygonPts(defiGeometries* geom) { + int i = numPorts_ - 1; + pinPort_[i]->addPolygonPts(geom); +} + +// 5.7 +void defiPin::addPortVia(const char* via, int viaX, int viaY, int color) { + int i = numPorts_ - 1; + pinPort_[i]->addVia(via, viaX, viaY, color); +} + +// 5.7 +void defiPin::setPortPlacement(int typ, int x, int y, int orient) { + int i = numPorts_ - 1; + pinPort_[i]->setPlacement(typ, x, y, orient); +} + +// 5.7 +int defiPin::hasPort() const { + return numPorts_; +} + +// 5.7 +int defiPin::numPorts() const { + return numPorts_; +} + +// 5.7 +defiPinPort* defiPin::pinPort(int index) const { + if (index < 0 || index > numPorts_) { + defiError(1, 0, "index out of bounds", defData); + return 0; + } + return pinPort_[index]; +} + +void defiPin::print(FILE* f) const { + int xl, yl, xh,yh; + int i; + + fprintf(f, "PINS '%s' on net '%s'\n", pinName(), + netName()); + if (hasDirection()) + fprintf(f, "+ DIRECTION '%s'\n", direction()); + if (hasNetExpr()) + fprintf(f, "+ NETEXPR '%s'\n", netExpr()); + if (hasSupplySensitivity()) + fprintf(f, "+ SUPPLYSENSITIVITY '%s'\n", + supplySensitivity()); + if (hasGroundSensitivity()) + fprintf(f, "+ GROUNDSENSITIVITY '%s'\n", + groundSensitivity()); + if (hasUse()) + fprintf(f, "+ USE '%s'\n", use()); + if (hasLayer()) { + for (i = 0; i < numLayer(); i++) { + bounds(i, &xl, &yl, &xh, &yh); + fprintf(f, "+ LAYER '%s' %d %d %d %d\n", + layer(i), xl, yl, xh, yh); + } + } + for (i = 0; i < numPolygons(); i++) { + fprintf(f, "+ POLYGON %s", polygonName(i)); + if (hasPolygonSpacing(i)) { + fprintf(f, " SPACING %d", polygonSpacing(i)); + } + if (hasPolygonDesignRuleWidth(i)) { + fprintf(f, " DESIGNRULEWIDTH %d", + polygonDesignRuleWidth(i)); + } + fprintf(f, "\n"); + } + for (i = 0; i < numVias(); i++) { + fprintf(f, "+ VIA %s %d %d\n", viaName(i), + viaPtX(i), viaPtY(i)); + } + if (hasPlacement()) + fprintf(f, " PLACED %s%s%d %d\n", + isFixed() ? " FIXED" : "", + isCover() ? " COVER" : "", + placementX(), + placementY()); + if (hasSpecial()) + fprintf(f, "+ SPECIAL\n"); +} +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defiPinCap.hpp b/src/def/def/defiPinCap.hpp new file mode 100644 index 00000000..6c5ff628 --- /dev/null +++ b/src/def/def/defiPinCap.hpp @@ -0,0 +1,438 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiPinCap_h +#define defiPinCap_h + + +#include "defiKRDefs.hpp" +#include "defiMisc.hpp" +#include + +BEGIN_LEFDEF_PARSER_NAMESPACE + +class defrData; + +class defiPinCap { +public: + + void setPin(int p); + void setCap(double d); + + int pin() const; + double cap() const; + + void print(FILE* f) const; + +protected: + int pin_; // pin num + double cap_; // capacitance +}; + + +// 5.5 +class defiPinAntennaModel { +public: + defiPinAntennaModel(defrData *data); + void Init(); + + DEF_COPY_CONSTRUCTOR_H(defiPinAntennaModel); + DEF_ASSIGN_OPERATOR_H(defiPinAntennaModel); + + ~defiPinAntennaModel(); + void clear(); + void Destroy(); + + void setAntennaModel(int oxide); + void addAPinGateArea(int value, const char* layer); + void addAPinMaxAreaCar(int value, const char* layer); + void addAPinMaxSideAreaCar(int value, const char* layer); + void addAPinMaxCutCar(int value, const char* layer); + + char* antennaOxide() const; + + int hasAPinGateArea() const; // ANTENNAPINGATEAREA + int numAPinGateArea() const; + int APinGateArea(int index) const; + int hasAPinGateAreaLayer(int index) const; + const char* APinGateAreaLayer(int index) const; + + int hasAPinMaxAreaCar() const; // ANTENNAPINMAXAREACAR + int numAPinMaxAreaCar() const; + int APinMaxAreaCar(int index) const; + int hasAPinMaxAreaCarLayer(int index) const; + const char* APinMaxAreaCarLayer(int index) const; + + int hasAPinMaxSideAreaCar() const; // ANTENNAPINMAXSIDEAREACAR + int numAPinMaxSideAreaCar() const; + int APinMaxSideAreaCar(int index) const; + int hasAPinMaxSideAreaCarLayer(int index) const; + const char* APinMaxSideAreaCarLayer(int index) const; + + int hasAPinMaxCutCar() const; // ANTENNAPINMAXCUTCAR + int numAPinMaxCutCar() const; + int APinMaxCutCar(int index) const; + int hasAPinMaxCutCarLayer(int index) const; + const char* APinMaxCutCarLayer(int index) const; + +protected: + char* oxide_; + + int numAPinGateArea_; // 5.4 + int APinGateAreaAllocated_; + int* APinGateArea_; // 5.4 AntennaPinGateArea + char** APinGateAreaLayer_; // 5.4 Layer + + int numAPinMaxAreaCar_; // 5.4 + int APinMaxAreaCarAllocated_; + int* APinMaxAreaCar_; // 5.4 AntennaPinMaxAreaCar + char** APinMaxAreaCarLayer_; // 5.4 Layer + + int numAPinMaxSideAreaCar_; // 5.4 + int APinMaxSideAreaCarAllocated_; + int* APinMaxSideAreaCar_; // 5.4 AntennaPinMaxSideAreaCar + char** APinMaxSideAreaCarLayer_; // 5.4 Layer + + int numAPinMaxCutCar_; // 5.4 + int APinMaxCutCarAllocated_; + int* APinMaxCutCar_; // 5.4 AntennaPinMaxCutCar + char** APinMaxCutCarLayer_; // 5.4 Layer + + defrData *defData; +}; + +class defiPinPort { // 5.7 +public: + defiPinPort(defrData *data); + void Init(); + + DEF_COPY_CONSTRUCTOR_H(defiPinPort); + DEF_ASSIGN_OPERATOR_H(defiPinPort); + ~defiPinPort(); + + void clear(); + + void addLayer(const char* layer); + void addLayerSpacing(int minSpacing); + void addLayerMask(int mask); + void addLayerDesignRuleWidth(int effectiveWidth); + void addLayerPts(int xl, int yl, int xh, int yh); + void addPolygon(const char* layerName); + void addPolySpacing(int minSpacing); + void addPolyMask(int mask); + void addPolyDesignRuleWidth(int effectiveWidth); + void addPolygonPts(defiGeometries* geom); + void addVia(const char* via, int viaX, int viaY, int color = 0); + void setPlacement(int typ, int x, int y, int orient); + + int numLayer() const; + const char* layer(int index) const; + void bounds(int index, int* xl, int* yl, int* xh, int* yh) const; + int hasLayerSpacing(int index) const; + int hasLayerDesignRuleWidth(int index) const; + int layerSpacing(int index) const; + int layerMask(int index) const; + int layerDesignRuleWidth(int index) const; + int numPolygons() const; + const char* polygonName(int index) const; + defiPoints getPolygon(int index) const; + int hasPolygonSpacing(int index) const; + int hasPolygonDesignRuleWidth(int index) const; + int polygonSpacing(int index) const; + int polygonDesignRuleWidth(int index) const; + int polygonMask(int index) const; + int numVias() const; + const char* viaName(int index) const; + int viaPtX (int index) const; + int viaPtY (int index) const; + int viaTopMask (int index) const; + int viaCutMask (int index) const; + int viaBottomMask (int index) const; + int hasPlacement() const; + int isPlaced() const; + int isCover() const; + int isFixed() const; + int placementX() const; + int placementY() const; + int orient() const; + const char* orientStr() const; + +protected: + int layersAllocated_; + int numLayers_; + char** layers_; + int *layerMinSpacing_; + int *layerEffectiveWidth_; + int *xl_, *yl_, *xh_, *yh_; + int *layerMask_; + int polysAllocated_; + int numPolys_; + char** polygonNames_; + int *polyMinSpacing_; + int *polyMask_; + int *polyEffectiveWidth_; + defiPoints** polygons_; + int viasAllocated_; + int numVias_; + char** viaNames_; + int *viaX_; + int *viaY_; + int *viaMask_; + char placeType_; + int x_, y_; + char orient_; + + defrData *defData; +}; + +class defiPin { +public: + defiPin(defrData *data); + void Init(); + + DEF_COPY_CONSTRUCTOR_H( defiPin ); + DEF_ASSIGN_OPERATOR_H( defiPin ); + + ~defiPin(); + void Destroy(); + + void Setup(const char* pinName, const char* netName); + void setDirection(const char* dir); + void setUse(const char* use); + // 5.6 setLayer is changed to addLayer due to multiple LAYER are allowed + // in 5.6 + void addLayer(const char* layer); + void addLayerMask(int mask); // 5.8 + void addLayerSpacing(int minSpacing); // 5.6 + void addLayerDesignRuleWidth(int effectiveWidth); // 5.6 + void addLayerPts(int xl, int yl, int xh, int yh); + void addPolygon(const char* layerName); // 5.6 + void addPolyMask(int mask); // 5.8 + void addPolySpacing(int minSpacing); // 5.6 + void addPolyDesignRuleWidth(int effectiveWidth); // 5.6 + void addPolygonPts(defiGeometries* geom); // 5.6 + void setNetExpr(const char* netExpr); // 5.6 + void setSupplySens(const char* pinName); // 5.6 + void setGroundSens(const char* pinName); // 5.6 + void setPlacement(int typ, int x, int y, int orient); + void setSpecial(); + void addAntennaModel(int oxide); // 5.5 + void addAPinPartialMetalArea(int value, const char* layer); + void addAPinPartialMetalSideArea(int value, const char* layer); + void addAPinGateArea(int value, const char* layer); + void addAPinDiffArea(int value, const char* layer); + void addAPinMaxAreaCar(int value, const char* layer); + void addAPinMaxSideAreaCar(int value, const char* layer); + void addAPinPartialCutArea(int value, const char* layer); + void addAPinMaxCutCar(int value, const char* layer); + void addVia(const char* via, int viaX, int viaY, int color = 0); // 5.7 + // 5.7 port statements, which may have LAYER, POLYGON, &| VIA + void addPort(); // 5.7 + void addPortLayer(const char* layer); // 5.7 + void addPortLayerSpacing(int minSpacing); // 5.7 + void addPortLayerDesignRuleWidth(int effectiveWidth); // 5.7 + void addPortLayerPts(int xl, int yl, int xh, int yh); // 5.7 + void addPortLayerMask(int color); // 5.8 + void addPortPolygon(const char* layerName); // 5.7 + void addPortPolySpacing(int minSpacing); // 5.7 + void addPortPolyDesignRuleWidth(int effectiveWidth); // 5.7 + void addPortPolygonPts(defiGeometries* geom); // 5.7 + void addPortPolyMask(int color); // 5.8 + void addPortVia(const char* via, int viaX, int viaY, int color = 0); // 5.7 + void setPortPlacement(int typ, int x, int y, int orient); // 5.7 - 5.8 + + void clear(); + + void changePinName(const char* pinName); // For OA to modify the pinName + + const char* pinName() const; + const char* netName() const; + // optional parts + int hasDirection() const; + int hasUse() const; + int hasLayer() const; + int hasPlacement() const; + int isUnplaced() const; + int isPlaced() const; + int isCover() const; + int isFixed() const; + int placementX() const; + int placementY() const; + const char* direction() const; + const char* use() const; + int numLayer() const; + const char* layer(int index) const; + void bounds(int index, int* xl, int* yl, int* xh, int* yh) const; + int layerMask(int index) const; // 5.8 + int hasLayerSpacing(int index) const; // 5.6 + int hasLayerDesignRuleWidth(int index) const; // 5.6 + int layerSpacing(int index) const; // 5.6 + int layerDesignRuleWidth(int index) const; // 5.6 + int numPolygons() const; // 5.6 + const char* polygonName(int index) const; // 5.6 + defiPoints getPolygon(int index) const; // 5.6 + int polygonMask(int index) const; // 5.8 + int hasPolygonSpacing(int index) const; // 5.6 + int hasPolygonDesignRuleWidth(int index) const; // 5.6 + int polygonSpacing(int index) const; // 5.6 + int polygonDesignRuleWidth(int index) const; // 5.6 + int hasNetExpr() const; // 5.6 + int hasSupplySensitivity() const; // 5.6 + int hasGroundSensitivity() const; // 5.6 + const char* netExpr() const; // 5.6 + const char* supplySensitivity() const; // 5.6 + const char* groundSensitivity() const; // 5.6 + int orient() const; + const char* orientStr() const; + int hasSpecial() const; + int numVias() const; // 5.7 + const char* viaName(int index) const; // 5.7 + int viaTopMask(int index) const; // 5.8 + int viaCutMask(int index) const; // 5.8 + int viaBottomMask(int index) const; // 5.8 + int viaPtX (int index) const; // 5.7 + int viaPtY (int index) const; // 5.7 + + // 5.4 + int hasAPinPartialMetalArea() const; // ANTENNAPINPARTIALMETALAREA + int numAPinPartialMetalArea() const; + int APinPartialMetalArea(int index) const; + int hasAPinPartialMetalAreaLayer(int index) const; + const char* APinPartialMetalAreaLayer(int index) const; + + int hasAPinPartialMetalSideArea() const; // ANTENNAPINPARTIALMETALSIDEAREA + int numAPinPartialMetalSideArea() const; + int APinPartialMetalSideArea(int index) const; + int hasAPinPartialMetalSideAreaLayer(int index) const; + const char* APinPartialMetalSideAreaLayer(int index) const; + + int hasAPinDiffArea() const; // ANTENNAPINDIFFAREA + int numAPinDiffArea() const; + int APinDiffArea(int index) const; + int hasAPinDiffAreaLayer(int index) const; + const char* APinDiffAreaLayer(int index) const; + + int hasAPinPartialCutArea() const; // ANTENNAPINPARTIALCUTAREA + int numAPinPartialCutArea() const; + int APinPartialCutArea(int index) const; + int hasAPinPartialCutAreaLayer(int index) const; + const char* APinPartialCutAreaLayer(int index) const; + + // 5.5 + int numAntennaModel() const; + defiPinAntennaModel* antennaModel(int index) const; + + // 5.7 + int hasPort() const; + int numPorts() const; + defiPinPort* pinPort(int index) const; + void print(FILE* f) const; + +protected: + int pinNameLength_; // allocated size of pin name + char* pinName_; + int netNameLength_; // allocated size of net name + char* netName_; + char hasDirection_; + char hasUse_; + char placeType_; + char orient_; // orient 0-7 + int useLength_; // allocated size of length + char* use_; + int directionLength_; // allocated size of direction + char* direction_; + char** layers_; // 5.6, changed to array + int *xl_, *yl_, *xh_, *yh_; // 5.6, changed to arrays + int *layerMinSpacing_; // 5.6, SPACING in LAYER + int *layerEffectiveWidth_; // 5.6, DESIGNRULEWIDTH in LAYER + int layersAllocated_; // 5.6 + int numLayers_; // 5.6 + int *layerMask_; // 5.8 + char** polygonNames_; // 5.6 layerName for POLYGON + int *polyMinSpacing_; // 5.6, SPACING in POLYGON + int *polyEffectiveWidth_; // 5.6, DESIGNRULEWIDTH in POLYGON + int *polyMask_; // 5.8 + int numPolys_; // 5.6 + int polysAllocated_; // 5.6 + defiPoints** polygons_; // 5.6 + int x_, y_; // placement + int hasSpecial_; + int numVias_; // 5.7 + int viasAllocated_; // 5.7 + char** viaNames_; // 5.7 + int *viaX_; // 5.7 + int *viaY_; // 5.7 + int *viaMask_; // 5.8 + int numPorts_; // 5.7 + int portsAllocated_; // 5.7 + defiPinPort ** pinPort_; // 5.7 + + // 5.5 AntennaModel + int numAntennaModel_; + int antennaModelAllocated_; + defiPinAntennaModel** antennaModel_; + + int numAPinPartialMetalArea_; // 5.4 + int APinPartialMetalAreaAllocated_; + int* APinPartialMetalArea_; // 5.4 AntennaPinPartialMetalArea + char** APinPartialMetalAreaLayer_; // 5.4 Layer + + int numAPinPartialMetalSideArea_; // 5.4 + int APinPartialMetalSideAreaAllocated_; + int* APinPartialMetalSideArea_; // 5.4 AntennaPinPartialMetalSideArea + char** APinPartialMetalSideAreaLayer_; // 5.4 Layer + + int numAPinDiffArea_; // 5.4 + int APinDiffAreaAllocated_; + int* APinDiffArea_; // 5.4 AntennaPinDiffArea + char** APinDiffAreaLayer_; // 5.4 Layer + + int numAPinPartialCutArea_; // 5.4 + int APinPartialCutAreaAllocated_; + int* APinPartialCutArea_; // 5.4 AntennaPinPartialCutArea + char** APinPartialCutAreaLayer_; // 5.4 Layer + + int netExprLength_; // 5.6 + char hasNetExpr_; // 5.6 + char* netExpr_; // 5.6 + int supplySensLength_; // 5.6 + char hasSupplySens_; // 5.6 + char* supplySens_; // 5.6 + int groundSensLength_; // 5.6 + char hasGroundSens_; // 5.6 + char* groundSens_; // 5.6 + + defrData *defData; +}; + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiPinProp.cpp b/src/def/def/defiPinProp.cpp new file mode 100644 index 00000000..29b160a8 --- /dev/null +++ b/src/def/def/defiPinProp.cpp @@ -0,0 +1,314 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2015, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include "lex.h" +#include "defiDebug.hpp" +#include "defiPinProp.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + + +//////////////////////////////////////////////////// +//////////////////////////////////////////////////// +// +// defiPinProp +// +//////////////////////////////////////////////////// +//////////////////////////////////////////////////// + + + +defiPinProp::defiPinProp(defrData *data) +: defData(data) +{ + Init(); +} + + +void defiPinProp::Init() { + instName_ = (char*)malloc(16); + pinName_ = (char*)malloc(16); + pinNameSize_ = 16; + instNameSize_ = 16; + isPin_ = 0; + numProps_ = 0; + propsAllocated_ = 2; + propNames_ = (char**)malloc(sizeof(char*)*2); + propValues_ = (char**)malloc(sizeof(char*)*2); + propDValues_ = (double*)malloc(sizeof(double)*2); + propTypes_ = (char*)malloc(sizeof(char)*2); +} + + +defiPinProp::~defiPinProp() { + Destroy(); +} + + +void defiPinProp::Destroy() { + clear(); + free(instName_); + free(pinName_); + free((char*)(propNames_)); + free((char*)(propValues_)); + free((char*)(propDValues_)); + free((char*)(propTypes_)); +} + + +void defiPinProp::clear() { + int i; + for (i = 0; i < numProps_; i++) { + free(propNames_[i]); + free(propValues_[i]); + propDValues_[i] = 0; + } + numProps_ = 0; + isPin_ = 0; +} + + +void defiPinProp::setName(const char* inst, const char* pin) { + int len = strlen(inst) + 1; + + if ((strcmp(inst, "PIN") == 0) || (strcmp(inst,"pin") == 0)) { + isPin_ = 1; + instName_[0] = '\0'; /* make sure to clear any prev inst */ + } else { + if (instNameSize_ < len) { + instNameSize_ = len; + free(instName_); + instName_ = (char*)malloc(len); + } + strcpy(instName_, defData->DEFCASE(inst)); + } + + len = strlen(pin) + 1; + if (pinNameSize_ < len) { + pinNameSize_ = len; + free(pinName_); + pinName_ = (char*)malloc(len); + } + strcpy(pinName_, defData->DEFCASE(pin)); +} + + +int defiPinProp::isPin() const { + return isPin_ ? 1 : 0; +} + + +const char* defiPinProp::instName() const { + return instName_; +} + + +const char* defiPinProp::pinName() const { + return pinName_; +} + + +void defiPinProp::addProperty(const char* name, const char* value, + const char type) { + int len; + if (numProps_ == propsAllocated_) { + int i; + char** nn; + char** nv; + double* nd; + char* nt; + + propsAllocated_ *= 2; + nn = (char**)malloc(sizeof(char*)*propsAllocated_); + nv = (char**)malloc(sizeof(char*)*propsAllocated_); + nd = (double*)malloc(sizeof(double)*propsAllocated_); + nt = (char*)malloc(sizeof(char)*propsAllocated_); + for (i = 0; i < numProps_; i++) { + nn[i] = propNames_[i]; + nv[i] = propValues_[i]; + nd[i] = propDValues_[i]; + nt[i] = propTypes_[i]; + } + free((char*)(propNames_)); + free((char*)(propValues_)); + free((char*)(propDValues_)); + free((char*)(propTypes_)); + propNames_ = nn; + propValues_ = nv; + propDValues_ = nd; + propTypes_ = nt; + } + len = strlen(name) + 1; + propNames_[numProps_] = (char*)malloc(len); + strcpy(propNames_[numProps_], defData->DEFCASE(name)); + len = strlen(value) + 1; + propValues_[numProps_] = (char*)malloc(len); + strcpy(propValues_[numProps_], defData->DEFCASE(value)); + propDValues_[numProps_] = 0; + propTypes_[numProps_] = type; + numProps_ += 1; +} + + +void defiPinProp::addNumProperty(const char* name, const double d, + const char* value, const char type) { + int len; + if (numProps_ == propsAllocated_) { + int i; + char** nn; + char** nv; + double* nd; + char* nt; + + propsAllocated_ *= 2; + nn = (char**)malloc(sizeof(char*)*propsAllocated_); + nv = (char**)malloc(sizeof(char*)*propsAllocated_); + nd = (double*)malloc(sizeof(double)*propsAllocated_); + nt = (char*)malloc(sizeof(char)*propsAllocated_); + for (i = 0; i < numProps_; i++) { + nn[i] = propNames_[i]; + nv[i] = propValues_[i]; + nd[i] = propDValues_[i]; + nt[i] = propTypes_[i]; + } + free((char*)(propNames_)); + free((char*)(propValues_)); + free((char*)(propDValues_)); + free((char*)(propTypes_)); + propNames_ = nn; + propValues_ = nv; + propDValues_ = nd; + propTypes_ = nt; + } + len = strlen(name) + 1; + propNames_[numProps_] = (char*)malloc(len); + strcpy(propNames_[numProps_], defData->DEFCASE(name)); + len = strlen(value) + 1; + propValues_[numProps_] = (char*)malloc(len); + strcpy(propValues_[numProps_], defData->DEFCASE(value)); + propDValues_[numProps_] = d; + propTypes_[numProps_] = type; + numProps_ += 1; +} + + +int defiPinProp::numProps() const { + return numProps_; +} + + +const char* defiPinProp::propName(int index) const { + char msg[256]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (DEFPARS-6120): The index number %d specified for the PIN PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numProps_); + defiError(0, 6120, msg, defData); + return 0; + } + return propNames_[index]; +} + + +const char* defiPinProp::propValue(int index) const { + char msg[256]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (DEFPARS-6120): The index number %d specified for the PIN PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numProps_); + defiError(0, 6120, msg, defData); + return 0; + } + return propValues_[index]; +} + + +double defiPinProp::propNumber(int index) const { + char msg[256]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (DEFPARS-6120): The index number %d specified for the PIN PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numProps_); + defiError(0, 6120, msg, defData); + return 0; + } + return propDValues_[index]; +} + + +char defiPinProp::propType(int index) const { + char msg[256]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (DEFPARS-6120): The index number %d specified for the PIN PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numProps_); + defiError(0, 6120, msg, defData); + return 0; + } + return propTypes_[index]; +} + + +int defiPinProp::propIsNumber(int index) const { + char msg[256]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (DEFPARS-6120): The index number %d specified for the PIN PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numProps_); + defiError(0, 6120, msg, defData); + return 0; + } + return propDValues_[index] ? 1 : 0; +} + + +int defiPinProp::propIsString(int index) const { + char msg[256]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (DEFPARS-6120): The index number %d specified for the PIN PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numProps_); + defiError(0, 6120, msg, defData); + return 0; + } + return propDValues_[index] ? 0 : 1; +} + + +void defiPinProp::print(FILE* f) const { + int i; + + fprintf(f, "PinProp %s %s\n", instName(), + pinName()); + + for (i = 0; i < numProps(); i++) { + fprintf(f, " %s %s\n", propName(i), + propValue(i)); + } +} + + +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defiPinProp.hpp b/src/def/def/defiPinProp.hpp new file mode 100644 index 00000000..e199e637 --- /dev/null +++ b/src/def/def/defiPinProp.hpp @@ -0,0 +1,91 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiPinProp_h +#define defiPinProp_h + +#include "defiKRDefs.hpp" +#include + +BEGIN_LEFDEF_PARSER_NAMESPACE + +class defrData; + +class defiPinProp { +public: + defiPinProp(defrData *data); + void Init(); + + ~defiPinProp(); + void Destroy(); + + void clear(); + + void setName(const char* inst, const char* pin); + void addProperty(const char* name, const char* value, const char type); + void addNumProperty(const char* name, const double d, + const char* value, const char type); + + int isPin() const; + const char* instName() const; + const char* pinName() const; + + int numProps() const; + const char* propName(int index) const; + const char* propValue(int index) const; + double propNumber(int index) const; + char propType(int index) const; + int propIsNumber(int index) const; + int propIsString(int index) const; + + void print(FILE* f) const; + +protected: + char isPin_; + int instNameSize_; + char* instName_; + int pinNameSize_; + char* pinName_; + + int numProps_; + int propsAllocated_; + char** propNames_; + char** propValues_; + double* propDValues_; + char* propTypes_; + + defrData *defData; +}; + + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiProp.cpp b/src/def/def/defiProp.cpp new file mode 100644 index 00000000..ff418ee4 --- /dev/null +++ b/src/def/def/defiProp.cpp @@ -0,0 +1,256 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2015, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include "lex.h" +#include "defiProp.hpp" +#include "defiDebug.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +defiProp::defiProp(defrData *data) +: propType_(0), propName_(0), stringData_(0), defData(data) +{ + Init(); +} + + +void defiProp::Init() { + stringLength_ = 16; + stringData_ = (char*)malloc(16); + nameSize_ = 16; + propName_ = (char*)malloc(16); + clear(); +} + + +DEF_COPY_CONSTRUCTOR_C( defiProp ) { + DEF_MALLOC_FUNC( propType_, char, sizeof(char) * (strlen(prev.propType_) +1)); + DEF_MALLOC_FUNC( propName_, char, sizeof(char) * (strlen(prev.propName_) +1)); + DEF_COPY_FUNC( nameSize_ ); + DEF_COPY_FUNC( hasRange_ ); + DEF_COPY_FUNC( hasNumber_ ); + DEF_COPY_FUNC( hasNameMapString_ ); + DEF_COPY_FUNC( dataType_ ); + DEF_MALLOC_FUNC( stringData_, char, sizeof(char) * (strlen(prev.stringData_) +1)); + DEF_COPY_FUNC( stringLength_ ); + DEF_COPY_FUNC( left_ ); + DEF_COPY_FUNC( right_ ); + DEF_COPY_FUNC( d_ ); +} + +DEF_ASSIGN_OPERATOR_C( defiProp ) { + CHECK_SELF_ASSIGN + DEF_MALLOC_FUNC( propType_, char, sizeof(char) * (strlen(prev.propType_) +1)); + DEF_MALLOC_FUNC( propName_, char, sizeof(char) * (strlen(prev.propName_) +1)); + DEF_COPY_FUNC( nameSize_ ); + DEF_COPY_FUNC( hasRange_ ); + DEF_COPY_FUNC( hasNumber_ ); + DEF_COPY_FUNC( hasNameMapString_ ); + DEF_COPY_FUNC( dataType_ ); + DEF_MALLOC_FUNC( stringData_, char, sizeof(char) * (strlen(prev.stringData_) +1)); + DEF_COPY_FUNC( stringLength_ ); + DEF_COPY_FUNC( left_ ); + DEF_COPY_FUNC( right_ ); + DEF_COPY_FUNC( d_ ); + return *this; +} + + +void defiProp::Destroy() { + free(stringData_); + free(propName_); +} + + +defiProp::~defiProp() { + Destroy(); +} + + +void defiProp::setPropType(const char* typ, const char* string) { + int len; + propType_ = (char*)typ; + if ((len = strlen(string)+1) > nameSize_) + bumpName(len); + strcpy(propName_, defData->DEFCASE(string)); +} + + +void defiProp::setRange(double left, double right) { + hasRange_ = 1; + left_ = left; + right_ = right; +} + + +void defiProp::setNumber(double d) { + hasNumber_ = 1; + d_ = d; +} + + +void defiProp::setPropInteger() { + dataType_ = 'I'; +} + + +void defiProp::setPropReal() { + dataType_ = 'R'; +} + + +void defiProp::setPropString() { + dataType_ = 'S'; +} + + +void defiProp::setPropNameMapString(const char* string) { + int len; + dataType_ = 'N'; + hasNameMapString_ = 1; + if ((len = strlen(string)+1) > stringLength_) + bumpSize(len); + strcpy(stringData_, defData->DEFCASE(string)); +} + + +void defiProp::setPropQString(const char* string) { + int len; + dataType_ = 'Q'; + if ((len = strlen(string)+1) > stringLength_) + bumpSize(len); + strcpy(stringData_, defData->DEFCASE(string)); +} + + +const char* defiProp::string() const { + return stringData_; +} + + +const char* defiProp::propType() const { + return propType_; +} + + +int defiProp::hasNameMapString() const { + return (int)(hasNameMapString_); +} + + +int defiProp::hasNumber() const { + return (int)(hasNumber_); +} + + +int defiProp::hasRange() const { + return (int)(hasRange_); +} + + +double defiProp::number() const { + return d_; +} + + +double defiProp::left() const { + return left_; +} + + +double defiProp::right() const { + return right_; +} + + +void defiProp::bumpSize(int size) { + free(stringData_); + stringData_ = (char*)malloc(size); + stringLength_ = size; + *(stringData_) = '\0'; +} + + +void defiProp::bumpName(int size) { + free(propName_); + propName_ = (char*)malloc(size); + nameSize_ = size; + *(propName_) = '\0'; +} + + + +void defiProp::clear() { + if (stringData_) + *(stringData_) = '\0'; + if (propName_) + *(propName_) = '\0'; + propType_ = 0; + hasRange_ = 0; + hasNumber_ = 0; + hasNameMapString_ = 0; + dataType_ = 'B'; /* bogus */ + d_ = left_ = right_ = 0.0; +} + + +int defiProp::hasString() const { + return *(stringData_) ? 1 : 0 ; +} + + +const char* defiProp::propName() const { + return (propName_); +} + + +char defiProp::dataType() const { + return (dataType_); +} + + +void defiProp::print(FILE* f) const { + fprintf(f, "Prop type '%s'\n", propType()); + if (hasString()) { + fprintf(f, " string '%s'\n", string()); + } + if (hasNumber()) { + fprintf(f, " number %5.2f\n", number()); + } + if (hasRange()) { + fprintf(f, " range %5.2f - %5.2f\n", + left(), right()); + } +} + + +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defiProp.hpp b/src/def/def/defiProp.hpp new file mode 100644 index 00000000..fa423558 --- /dev/null +++ b/src/def/def/defiProp.hpp @@ -0,0 +1,102 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiProp_h +#define defiProp_h + +#include "defiKRDefs.hpp" +#include + +BEGIN_LEFDEF_PARSER_NAMESPACE + +class defrData; + +// Struct holds the data for one property. +class defiProp { +public: + defiProp(defrData *data = NULL); + void Init(); + + DEF_COPY_CONSTRUCTOR_H( defiProp ); + DEF_ASSIGN_OPERATOR_H( defiProp ); + + void Destroy(); + ~defiProp(); + + void setPropType(const char* typ, const char* string); + void setRange(double left, double right); + void setNumber(double num); + void setPropInteger(); + void setPropReal(); + void setPropString(); + void setPropQString(const char* string); + void setPropNameMapString(const char* string); + void clear(); + + const char* string() const; + const char* propType() const; + const char* propName() const; + char dataType() const; + // either I:integer R:real S:string Q:quotedstring N:nameMapString + int hasNumber() const; + int hasRange() const; + int hasString() const; + int hasNameMapString() const; + double number() const; + double left() const; + double right() const; + + void bumpSize(int size); + void bumpName(int size); + + void print(FILE* f) const; + +protected: + char* propType_; // "design" ... + char* propName_; // name. + int nameSize_; // allocated size of name. + char hasRange_; // either 0:NO or 1:YES. + char hasNumber_; // either 0:NO or 1:YES. + char hasNameMapString_; + char dataType_; // either I:integer R:real S:string Q:quotedstring. + // N:nameMapString + char* stringData_; // if it is a string the data is here. + int stringLength_; // allocated size of stringData. + double left_, right_; // if it has a range the numbers are here. + double d_; // if it is a real or int the number is here. + + defrData *defData; +}; + + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiPropType.cpp b/src/def/def/defiPropType.cpp new file mode 100644 index 00000000..c8e61287 --- /dev/null +++ b/src/def/def/defiPropType.cpp @@ -0,0 +1,131 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2015, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include "lex.h" +#include "defiPropType.hpp" +#include "defiDebug.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + + +defiPropType::defiPropType() { + Init(); +} + + +void defiPropType::Init() { + numProperties_ = 0; + propertiesAllocated_ = 0; + propNames_ = 0; + propTypes_ = 0; +} + + +void defiPropType::Clear() { + int i; + + for (i = 0; i < numProperties_; i++) { + free(propNames_[i]); + } + numProperties_ = 0; + propertiesAllocated_ = 0; +} + + +void defiPropType::Destroy() { + Clear(); + if (propNames_) + free(propNames_); + if (propTypes_) + free(propTypes_); +} + + +defiPropType::~defiPropType() { + Destroy(); +} + + +void defiPropType::setPropType(const char* name, const char type) { + int len; + + if (numProperties_ == propertiesAllocated_) + bumpProps(); + len = strlen(name) + 1; + propNames_[numProperties_] = (char*)malloc(len); + strcpy(propNames_[numProperties_], name); + propTypes_[numProperties_] = type; + numProperties_ += 1; +} + + +void defiPropType::bumpProps() { + int lim = propertiesAllocated_; + int news ; + char** newpn; + char* newt; + + news = lim ? lim + lim : 2; + + newpn = (char**)malloc(sizeof(char*)*news); + newt = (char*)malloc(sizeof(char)*news); + + lim = propertiesAllocated_ = news; + + if (lim > 2) { + int i; + for (i = 0; i < numProperties_; i++) { + newpn[i] = propNames_[i]; + newt[i] = propTypes_[i]; + } + free((char*)(propNames_)); + free((char*)(propTypes_)); + } + propNames_ = newpn; + propTypes_ = newt; +} + + +char defiPropType::propType(char* name) const { + int i; + + // Name is NULL, error + if (!name) + return('N'); + + for (i = 0; i < numProperties_; i++) { + if (strcmp(name, propNames_[i]) == 0) + return(propTypes_[i]); // found the prop name + } + return('N'); // Can't found the name +} +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defiPropType.hpp b/src/def/def/defiPropType.hpp new file mode 100644 index 00000000..427b2457 --- /dev/null +++ b/src/def/def/defiPropType.hpp @@ -0,0 +1,66 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiPropType_h +#define defiPropType_h + +#include "defiKRDefs.hpp" +#include + +BEGIN_LEFDEF_PARSER_NAMESPACE + +// Struct holds the data type for one property, if the property is +// either REAL or INTEGER. +class defiPropType { +public: + defiPropType(); + void Init(); + + void Destroy(); + ~defiPropType(); + + void setPropType(const char* name, const char type); + void Clear(); + + char propType(char* name) const; + void bumpProps(); + +protected: + int numProperties_; + int propertiesAllocated_; + char** propNames_; // name. + char* propTypes_; // 'R' == "REAL", 'I' == "INTEGER" +}; + + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiRegion.cpp b/src/def/def/defiRegion.cpp new file mode 100644 index 00000000..5736d958 --- /dev/null +++ b/src/def/def/defiRegion.cpp @@ -0,0 +1,409 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2015, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include "lex.h" +#include "defiRegion.hpp" +#include "defiDebug.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + + +////////////////////////////////////////////// +////////////////////////////////////////////// +// +// defiRegion +// +////////////////////////////////////////////// +////////////////////////////////////////////// + + +defiRegion::defiRegion(defrData *data) +: defData(data) +{ + Init(); +} + + +void defiRegion::Init() { + name_ = 0; + nameLength_ = 0; + type_ = 0; + xl_ = 0; + yl_ = 0; + xh_ = 0; + yh_ = 0; + numProps_ = 0; + propsAllocated_ = 2; + propNames_ = (char**)malloc(sizeof(char*)*2); + propValues_ = (char**)malloc(sizeof(char*)*2); + propDValues_ = (double*)malloc(sizeof(double)*2); + propTypes_ = (char*)malloc(sizeof(char)*2); + clear(); + numRectangles_ = 0; + rectanglesAllocated_ = 1; + xl_ = (int*)malloc(sizeof(int)*1); + yl_ = (int*)malloc(sizeof(int)*1); + xh_ = (int*)malloc(sizeof(int)*1); + yh_ = (int*)malloc(sizeof(int)*1); +} + + +defiRegion::~defiRegion() { + Destroy(); +} + + +void defiRegion::clear() { + int i; + for (i = 0; i < numProps_; i++) { + free(propNames_[i]); + free(propValues_[i]); + propDValues_[i] = 0; + } + numProps_ = 0; + numRectangles_ = 0; + if (type_) free(type_); + type_ = 0; +} + + +void defiRegion::Destroy() { + if (name_) free(name_); + clear(); + name_ = 0; + nameLength_ = 0; + free((char*)(xl_)); + free((char*)(yl_)); + free((char*)(xh_)); + free((char*)(yh_)); + free((char*)(propNames_)); + free((char*)(propValues_)); + free((char*)(propDValues_)); + free((char*)(propTypes_)); +} + + +void defiRegion::addRect(int xl, int yl, int xh, int yh) { + if (numRectangles_ == rectanglesAllocated_) { + int i; + int max = rectanglesAllocated_ = rectanglesAllocated_ * 2; + int* newxl = (int*)malloc(sizeof(int)*max); + int* newyl = (int*)malloc(sizeof(int)*max); + int* newxh = (int*)malloc(sizeof(int)*max); + int* newyh = (int*)malloc(sizeof(int)*max); + for (i = 0; i < numRectangles_; i++) { + newxl[i] = xl_[i]; + newyl[i] = yl_[i]; + newxh[i] = xh_[i]; + newyh[i] = yh_[i]; + } + free((char*)(xl_)); + free((char*)(yl_)); + free((char*)(xh_)); + free((char*)(yh_)); + xl_ = newxl; + yl_ = newyl; + xh_ = newxh; + yh_ = newyh; + } + xl_[numRectangles_] = xl; + yl_[numRectangles_] = yl; + xh_[numRectangles_] = xh; + yh_[numRectangles_] = yh; + numRectangles_ += 1; +} + + +void defiRegion::setup(const char* name) { + int len = strlen(name) + 1; + + clear(); + + if (len > nameLength_) { + if (name_) free(name_); + nameLength_ = len; + name_ = (char*)malloc(len); + } + + strcpy(name_, defData->DEFCASE(name)); + +} + +void defiRegion::addProperty(const char* name, const char* value, + const char type) { + int len; + if (numProps_ == propsAllocated_) { + int i; + char** nn; + char** nv; + double* nd; + char* nt; + + propsAllocated_ *= 2; + nn = (char**)malloc(sizeof(char*)*propsAllocated_); + nv = (char**)malloc(sizeof(char*)*propsAllocated_); + nd = (double*)malloc(sizeof(double)*propsAllocated_); + nt = (char*)malloc(sizeof(char)*propsAllocated_); + for (i = 0; i < numProps_; i++) { + nn[i] = propNames_[i]; + nv[i] = propValues_[i]; + nd[i] = propDValues_[i]; + nt[i] = propTypes_[i]; + } + free((char*)(propNames_)); + free((char*)(propValues_)); + free((char*)(propDValues_)); + free((char*)(propTypes_)); + propNames_ = nn; + propValues_ = nv; + propDValues_ = nd; + propTypes_ = nt; + } + len = strlen(name) + 1; + propNames_[numProps_] = (char*)malloc(len); + strcpy(propNames_[numProps_], defData->DEFCASE(name)); + len = strlen(value) + 1; + propValues_[numProps_] = (char*)malloc(len); + strcpy(propValues_[numProps_], defData->DEFCASE(value)); + propDValues_[numProps_] = 0; + propTypes_[numProps_] = type; + numProps_ += 1; +} + +void defiRegion::addNumProperty(const char* name, const double d, + const char* value, const char type) { + int len; + if (numProps_ == propsAllocated_) { + int i; + char** nn; + char** nv; + double* nd; + char* nt; + + propsAllocated_ *= 2; + nn = (char**)malloc(sizeof(char*)*propsAllocated_); + nv = (char**)malloc(sizeof(char*)*propsAllocated_); + nd = (double*)malloc(sizeof(double)*propsAllocated_); + nt = (char*)malloc(sizeof(char)*propsAllocated_); + for (i = 0; i < numProps_; i++) { + nn[i] = propNames_[i]; + nv[i] = propValues_[i]; + nd[i] = propDValues_[i]; + nt[i] = propTypes_[i]; + } + free((char*)(propNames_)); + free((char*)(propValues_)); + free((char*)(propDValues_)); + free((char*)(propTypes_)); + propNames_ = nn; + propValues_ = nv; + propDValues_ = nd; + propTypes_ = nt; + } + len = strlen(name) + 1; + propNames_[numProps_] = (char*)malloc(len); + strcpy(propNames_[numProps_], defData->DEFCASE(name)); + len = strlen(value) + 1; + propValues_[numProps_] = (char*)malloc(len); + strcpy(propValues_[numProps_], defData->DEFCASE(value)); + propDValues_[numProps_] = d; + propTypes_[numProps_] = type; + numProps_ += 1; +} + + +void defiRegion::setType(const char* type) { + int len; + if (type_) free(type_); + len = strlen(type) + 1; + type_ = (char*)malloc(len); + strcpy(type_, defData->DEFCASE(type)); +} + + +int defiRegion::hasType() const { + return type_ ? 1 : 0; +} + + +const char* defiRegion::type() const { + return type_; +} + + +int defiRegion::numRectangles() const { + return numRectangles_; +} + + +int defiRegion::numProps() const { + return numProps_; +} + + +const char* defiRegion::propName(int index) const { + char msg[256]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (DEFPARS-6130): The index number %d specified for the REGION PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numProps_); + defiError(0, 6130, msg, defData); + return 0; + } + return propNames_[index]; +} + + +const char* defiRegion::propValue(int index) const { + char msg[256]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (DEFPARS-6130): The index number %d specified for the REGION PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numProps_); + defiError(0, 6130, msg, defData); + return 0; + } + return propValues_[index]; +} + + +double defiRegion::propNumber(int index) const { + char msg[256]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (DEFPARS-6130): The index number %d specified for the REGION PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numProps_); + defiError(0, 6130, msg, defData); + return 0; + } + return propDValues_[index]; +} + + +char defiRegion::propType(int index) const { + char msg[256]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (DEFPARS-6130): The index number %d specified for the REGION PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numProps_); + defiError(0, 6130, msg, defData); + return 0; + } + return propTypes_[index]; +} + +int defiRegion::propIsNumber(int index) const { + char msg[256]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (DEFPARS-6130): The index number %d specified for the REGION PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numProps_); + defiError(0, 6130, msg, defData); + return 0; + } + return propDValues_[index] ? 1 : 0; +} + +int defiRegion::propIsString(int index) const { + char msg[256]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (DEFPARS-6130): The index number %d specified for the REGION PROPERTY is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numProps_); + defiError(0, 6130, msg, defData); + return 0; + } + return propDValues_[index] ? 0 : 1; +} + +const char* defiRegion::name() const { + return name_; +} + + +int defiRegion::xl(int index) const { + char msg[256]; + if (index < 0 || index >= numRectangles_) { + sprintf (msg, "ERROR (DEFPARS-6131): The index number %d specified for the REGION RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numRectangles_); + defiError(0, 6131, msg, defData); + return 0; + } + return xl_[index]; +} + + +int defiRegion::yl(int index) const { + char msg[256]; + if (index < 0 || index >= numRectangles_) { + sprintf (msg, "ERROR (DEFPARS-6131): The index number %d specified for the REGION RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numRectangles_); + defiError(0, 6131, msg, defData); + return 0; + } + return yl_[index]; +} + + +int defiRegion::xh(int index) const { + char msg[256]; + if (index < 0 || index >= numRectangles_) { + sprintf (msg, "ERROR (DEFPARS-6131): The index number %d specified for the REGION RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numRectangles_); + defiError(0, 6131, msg, defData); + return 0; + } + return xh_[index]; +} + + +int defiRegion::yh(int index) const { + char msg[256]; + if (index < 0 || index >= numRectangles_) { + sprintf (msg, "ERROR (DEFPARS-6131): The index number %d specified for the REGION RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numRectangles_); + defiError(0, 6131, msg, defData); + return 0; + } + return yh_[index]; +} + + +void defiRegion::print(FILE* f) const { + int i; + fprintf(f, "Region '%s'", name()); + for (i = 0; i < numRectangles(); i++) { + fprintf(f, " %d %d %d %d", + xl(i), + yl(i), + xh(i), + yh(i)); + } + fprintf(f, "\n"); +} + + +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defiRegion.hpp b/src/def/def/defiRegion.hpp new file mode 100644 index 00000000..0a7c6455 --- /dev/null +++ b/src/def/def/defiRegion.hpp @@ -0,0 +1,107 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiRegion_h +#define defiRegion_h + +#include "defiKRDefs.hpp" +#include + +BEGIN_LEFDEF_PARSER_NAMESPACE + +class defrData; + +// Struct holds the data for one property. +class defiRegion { +public: + defiRegion(defrData *data); + void Init(); + + void Destroy(); + ~defiRegion(); + + void clear(); + void setup(const char* name); + void addRect(int xl, int yl, int xh, int yh); + void addProperty(const char* name, const char* value, const char type); + void addNumProperty(const char* name, const double d, + const char* value, const char type); + void setType(const char* type); // 5.4.1 + + const char* name() const; + + int numProps() const; + const char* propName(int index) const; + const char* propValue(int index) const; + double propNumber(int index) const; + char propType(int index) const; + int propIsNumber(int index) const; + int propIsString(int index) const; + + int hasType() const; // 5.4.1 + const char* type() const; // 5.4.1 + + int numRectangles() const; + int xl(int index) const; + int yl(int index) const; + int xh(int index) const; + int yh(int index) const; + + void print(FILE* f) const; + +protected: + char* name_; + int nameLength_; + + int numRectangles_; + int rectanglesAllocated_; + int* xl_; + int* yl_; + int* xh_; + int* yh_; + + int numProps_; + int propsAllocated_; + char** propNames_; + char** propValues_; + double* propDValues_; + char* propTypes_; + + char* type_; + + defrData *defData; +}; + + + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiRowTrack.cpp b/src/def/def/defiRowTrack.cpp new file mode 100644 index 00000000..5c5a0bc9 --- /dev/null +++ b/src/def/def/defiRowTrack.cpp @@ -0,0 +1,727 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2015, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include "defiRowTrack.hpp" +#include "defiDebug.hpp" +#include "lex.h" +#include "defiUtil.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +////////////////////////////////////////////// +////////////////////////////////////////////// +// +// defiRow +// +////////////////////////////////////////////// +////////////////////////////////////////////// + + +defiRow::defiRow(defrData *data) + : defData(data) +{ + Init(); +} + + +void defiRow::Init() { + nameLength_ = 0; + name_ = 0; + macroLength_ = 0; + macro_ = 0; + orient_ = 0; + x_ = 0.0; + y_ = 0.0; + xStep_ = 0.0; + yStep_ = 0.0; + xNum_ = 0.0; + yNum_ = 0.0; + hasDo_ = 0; + hasDoStep_ = 0; + numProps_ = 0; + propsAllocated_ = 2; + propNames_ = (char**)malloc(sizeof(char*)*2); + propValues_ = (char**)malloc(sizeof(char*)*2); + propDValues_ = (double*)malloc(sizeof(double)*2); + propTypes_ = (char*)malloc(sizeof(char)*2); +} + + +DEF_COPY_CONSTRUCTOR_C( defiRow ) { + + this->Init(); + DEF_COPY_FUNC( nameLength_ ); + DEF_MALLOC_FUNC( name_, char, sizeof(char) * (strlen(prev.name_) +1)); + DEF_COPY_FUNC( macroLength_ ); + DEF_MALLOC_FUNC( macro_, char, sizeof(char) * (strlen(prev.macro_) +1)); + DEF_COPY_FUNC( x_ ); + DEF_COPY_FUNC( y_ ); + DEF_COPY_FUNC( xNum_ ); + DEF_COPY_FUNC( yNum_ ); + DEF_COPY_FUNC( orient_ ); + DEF_COPY_FUNC( xStep_ ); + DEF_COPY_FUNC( yStep_ ); + DEF_COPY_FUNC( hasDo_ ); + DEF_COPY_FUNC( hasDoStep_ ); + DEF_COPY_FUNC( numProps_ ); + DEF_COPY_FUNC( propsAllocated_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( propNames_, numProps_); + DEF_MALLOC_FUNC_FOR_2D_STR( propValues_, numProps_); + DEF_MALLOC_FUNC( propDValues_, double, sizeof(double) * numProps_); + DEF_MALLOC_FUNC( propTypes_, char, sizeof(char) * numProps_ ); + +} + +DEF_ASSIGN_OPERATOR_C( defiRow ) { + CHECK_SELF_ASSIGN + this->Init(); + DEF_COPY_FUNC( nameLength_ ); + DEF_MALLOC_FUNC( name_, char, sizeof(char) * (strlen(prev.name_) +1)); + DEF_COPY_FUNC( macroLength_ ); + DEF_MALLOC_FUNC( macro_, char, sizeof(char) * (strlen(prev.macro_) +1)); + DEF_COPY_FUNC( x_ ); + DEF_COPY_FUNC( y_ ); + DEF_COPY_FUNC( xNum_ ); + DEF_COPY_FUNC( yNum_ ); + DEF_COPY_FUNC( orient_ ); + DEF_COPY_FUNC( xStep_ ); + DEF_COPY_FUNC( yStep_ ); + DEF_COPY_FUNC( hasDo_ ); + DEF_COPY_FUNC( hasDoStep_ ); + DEF_COPY_FUNC( numProps_ ); + DEF_COPY_FUNC( propsAllocated_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( propNames_, numProps_); + DEF_MALLOC_FUNC_FOR_2D_STR( propValues_, numProps_); + DEF_MALLOC_FUNC( propDValues_, double, sizeof(double) * numProps_); + DEF_MALLOC_FUNC( propTypes_, char, sizeof(char) * numProps_ ); + return *this; +} + +defiRow::~defiRow() { + Destroy(); +} + + +void defiRow::Destroy() { + clear(); + if (name_) free(name_); + if (macro_) free(macro_); + free((char*)(propNames_)); + free((char*)(propValues_)); + free((char*)(propDValues_)); + free((char*)(propTypes_)); +} + + +void defiRow::clear() { + int i; + for (i = 0; i < numProps_; i++) { + free(propNames_[i]); + free(propValues_[i]); + propDValues_[i] = 0; + } + hasDo_ = 0; + hasDoStep_ = 0; + numProps_ = 0; +} + + +void defiRow::setup(const char* name, const char* macro, double x, double y, + int orient) { + int len = strlen(name) + 1; + + clear(); + + if (len > nameLength_) { + if (name_) free(name_); + nameLength_ = len; + name_ = (char*)malloc(len); + } + strcpy(name_, defData->DEFCASE(name)); + + len = strlen(macro) + 1; + if (len > macroLength_) { + if (macro_) free(macro_); + macroLength_ = len; + macro_ = (char*)malloc(len); + } + strcpy(macro_, defData->DEFCASE(macro)); + + x_ = x; + y_ = y; + xStep_ = 0.0; + yStep_ = 0.0; + xNum_ = 0.0; + yNum_ = 0.0; + orient_ = orient; + +} + + +void defiRow::setDo(double x_num, double y_num, + double x_step, double y_step) { + xStep_ = x_step; + yStep_ = y_step; + xNum_ = x_num; + yNum_ = y_num; + hasDo_ = 1; +} + + +void defiRow::setHasDoStep() { + hasDoStep_ = 1; +} + + +void defiRow::addProperty(const char* name, const char* value, const char type) +{ + int len; + if (numProps_ == propsAllocated_) { + int i; + char** nn; + char** nv; + double* nd; + char* nt; + propsAllocated_ *= 2; + nn = (char**)malloc(sizeof(char*)*propsAllocated_); + nv = (char**)malloc(sizeof(char*)*propsAllocated_); + nd = (double*)malloc(sizeof(double)*propsAllocated_); + nt = (char*)malloc(sizeof(char)*propsAllocated_); + for (i = 0; i < numProps_; i++) { + nn[i] = propNames_[i]; + nv[i] = propValues_[i]; + nd[i] = propDValues_[i]; + nt[i] = propTypes_[i]; + } + free((char*)(propNames_)); + free((char*)(propValues_)); + free((char*)(propDValues_)); + free((char*)(propTypes_)); + propNames_ = nn; + propValues_ = nv; + propDValues_ = nd; + propTypes_ = nt; + } + len = strlen(name) + 1; + propNames_[numProps_] = (char*)malloc(len); + strcpy(propNames_[numProps_], defData->DEFCASE(name)); + len = strlen(value) + 1; + propValues_[numProps_] = (char*)malloc(len); + strcpy(propValues_[numProps_], defData->DEFCASE(value)); + propDValues_[numProps_] = 0; + propTypes_[numProps_] = type; + numProps_ += 1; +} + + +void defiRow::addNumProperty(const char* name, const double d, + const char* value, const char type) +{ + int len; + if (numProps_ == propsAllocated_) { + int i; + char** nn; + char** nv; + double* nd; + char* nt; + propsAllocated_ *= 2; + nn = (char**)malloc(sizeof(char*)*propsAllocated_); + nv = (char**)malloc(sizeof(char*)*propsAllocated_); + nd = (double*)malloc(sizeof(double)*propsAllocated_); + nt = (char*)malloc(sizeof(char)*propsAllocated_); + for (i = 0; i < numProps_; i++) { + nn[i] = propNames_[i]; + nv[i] = propValues_[i]; + nd[i] = propDValues_[i]; + nt[i] = propTypes_[i]; + } + free((char*)(propNames_)); + free((char*)(propValues_)); + free((char*)(propDValues_)); + free((char*)(propTypes_)); + propNames_ = nn; + propValues_ = nv; + propDValues_ = nd; + propTypes_ = nt; + } + len = strlen(name) + 1; + propNames_[numProps_] = (char*)malloc(len); + strcpy(propNames_[numProps_], defData->DEFCASE(name)); + len = strlen(value) + 1; + propValues_[numProps_] = (char*)malloc(len); + strcpy(propValues_[numProps_], defData->DEFCASE(value)); + propDValues_[numProps_] = d; + propTypes_[numProps_] = type; + numProps_ += 1; +} + + +int defiRow::numProps() const { + return numProps_; +} + + +const char* defiRow::propName(int index) const { + char msg[256]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (DEFPARS-6140): The index number %d specified for the VIA LAYER RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numProps_); + defiError(0, 6140, msg, defData); + return 0; + } + return propNames_[index]; +} + + +const char* defiRow::propValue(int index) const { + char msg[256]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (DEFPARS-6140): The index number %d specified for the VIA LAYER RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numProps_); + defiError(0, 6140, msg, defData); + return 0; + } + return propValues_[index]; +} + +double defiRow::propNumber(int index) const { + char msg[256]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (DEFPARS-6140): The index number %d specified for the VIA LAYER RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numProps_); + defiError(0, 6140, msg, defData); + return 0; + } + return propDValues_[index]; +} + +char defiRow::propType(int index) const { + char msg[256]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (DEFPARS-6140): The index number %d specified for the VIA LAYER RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numProps_); + defiError(0, 6140, msg, defData); + return 0; + } + return propTypes_[index]; +} + +int defiRow::propIsNumber(int index) const { + char msg[256]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (DEFPARS-6140): The index number %d specified for the VIA LAYER RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numProps_); + defiError(0, 6140, msg, defData); + return 0; + } + return propDValues_[index] ? 1 : 0; +} + +int defiRow::propIsString(int index) const { + char msg[256]; + if (index < 0 || index >= numProps_) { + sprintf (msg, "ERROR (DEFPARS-6140): The index number %d specified for the VIA LAYER RECTANGLE is invalide.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numProps_); + defiError(0, 6140, msg, defData); + return 0; + } + return propDValues_[index] ? 0 : 1; +} + +const char* defiRow::name() const { + return name_; +} + + +const char* defiRow::macro() const { + return macro_; +} + + +double defiRow::x() const { + return x_; +} + + +double defiRow::y() const { + return y_; +} + + +double defiRow::xNum() const { + return xNum_; +} + + +double defiRow::yNum() const { + return yNum_; +} + + +int defiRow::orient() const { + return orient_; +} + + +const char* defiRow::orientStr() const { + return (defiOrientStr(orient_)); +} + + +int defiRow::hasDo() const { + return hasDo_; +} + + +int defiRow::hasDoStep() const { + return hasDoStep_; +} + + +double defiRow::xStep() const { + return xStep_; +} + + +double defiRow::yStep() const { + return yStep_; +} + + +void defiRow::print(FILE* f) const { + fprintf(f, "Row '%s' '%s' %g,%g orient %s\n", + name(), macro(), + x(), y(), orientStr()); + fprintf(f, " DO X %g STEP %g\n", xNum(), + xStep()); + fprintf(f, " DO Y %g STEP %g\n", yNum(), + yStep()); +} + + +////////////////////////////////////////////// +////////////////////////////////////////////// +// +// defiTrack +// +////////////////////////////////////////////// +////////////////////////////////////////////// + + +defiTrack::defiTrack(defrData *data) + : defData(data) +{ + Init(); +} + + +void defiTrack::Init() { + macro_ = 0; + macroLength_ = 0; + x_ = 0.0; + xNum_ = 0.0; + xStep_ = 0.0; + layersLength_ = 0; + numLayers_ = 0; + layers_ = 0; + firstTrackMask_=0; + samemask_ = 0; +} + + +DEF_COPY_CONSTRUCTOR_C( defiTrack ) { + this->Init(); + DEF_COPY_FUNC( macroLength_ ); + DEF_MALLOC_FUNC( macro_, char, sizeof(char) * (strlen(prev.macro_) +1)); + DEF_COPY_FUNC( x_ ); + DEF_COPY_FUNC( xNum_ ); + DEF_COPY_FUNC( xStep_ ); + DEF_COPY_FUNC( layersLength_ ); + DEF_COPY_FUNC( numLayers_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( layers_, numLayers_ ); + DEF_COPY_FUNC( firstTrackMask_ ); + DEF_COPY_FUNC( samemask_ ); + +} + +DEF_ASSIGN_OPERATOR_C( defiTrack ) { + CHECK_SELF_ASSIGN + this->Init(); + DEF_COPY_FUNC( macroLength_ ); + DEF_MALLOC_FUNC( macro_, char, sizeof(char) * (strlen(prev.macro_) +1)); + DEF_COPY_FUNC( x_ ); + DEF_COPY_FUNC( xNum_ ); + DEF_COPY_FUNC( xStep_ ); + DEF_COPY_FUNC( layersLength_ ); + DEF_COPY_FUNC( numLayers_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( layers_, numLayers_ ); + DEF_COPY_FUNC( firstTrackMask_ ); + DEF_COPY_FUNC( samemask_ ); + return *this; +} + +defiTrack::~defiTrack() { + Destroy(); +} + + +void defiTrack::Destroy() { + int i; + + if (macro_) free(macro_); + + if (layers_) { + for (i = 0; i < numLayers_; i++) + if (layers_[i]) free(layers_[i]); + free((char*)(layers_)); + } +} + + +void defiTrack::setup(const char* macro) { + int i; + int len = strlen(macro) + 1; + + if (len > macroLength_) { + if (macro_) free(macro_); + macroLength_ = len; + macro_ = (char*)malloc(len); + } + strcpy(macro_, defData->DEFCASE(macro)); + + if (layers_) { + for (i = 0; i < numLayers_; i++) + if (layers_[i]) { + free(layers_[i]); + layers_[i] = 0; + } + } + numLayers_ = 0; + x_ = 0.0; + xStep_ = 0.0; + xNum_ = 0.0; + + firstTrackMask_=0; + samemask_=0; +} + + +void defiTrack::setDo(double x, double x_num, double x_step) { + x_ = x; + xStep_ = x_step; + xNum_ = x_num; +} + + +void defiTrack::addLayer(const char* layer) { + char* l; + int len; + + if (numLayers_ >= layersLength_) { + int i; + char** newl; + layersLength_ = layersLength_ ? 2 * layersLength_ : 8; + newl = (char**)malloc(layersLength_* sizeof(char*)); + for (i = 0; i < numLayers_; i++) + newl[i] = layers_[i]; + if (layers_) free((char*)(layers_)); + layers_ = newl; + } + + len = strlen(layer) + 1; + l = (char*)malloc(len); + strcpy(l, defData->DEFCASE(layer)); + layers_[numLayers_++] = l; +} + +void defiTrack::addMask(int colorMask, int sameMask) { + samemask_=sameMask; + firstTrackMask_= colorMask; +} + + +const char* defiTrack::macro() const { + return macro_; +} + + +double defiTrack::x() const { + return x_; +} + + +double defiTrack::xNum() const { + return xNum_; +} + + +double defiTrack::xStep() const { + return xStep_; +} + + +int defiTrack::numLayers() const { + return numLayers_; +} + + +const char* defiTrack::layer(int index) const { + if (index >= 0 && index < numLayers_) { + return layers_[index]; + } + + return 0; +} + +int defiTrack::firstTrackMask() const { + return firstTrackMask_; +} + +int defiTrack::sameMask() const { + return samemask_; +} + +void defiTrack::print(FILE* f) const { + int i; + + fprintf(f, "Track '%s'\n", macro()); + fprintf(f, " DO %g %g STEP %g\n", + x(), + xNum(), + xStep()); + fprintf(f, " %d layers ", numLayers()); + for (i = 0; i < numLayers(); i++) { + fprintf(f, " '%s'", layer(i)); + } + fprintf(f, "\n"); +} + + +////////////////////////////////////////////// +////////////////////////////////////////////// +// +// defiGcellGrid +// +////////////////////////////////////////////// +////////////////////////////////////////////// + + +defiGcellGrid::defiGcellGrid(defrData *data) + : defData(data) +{ + Init(); +} + + +void defiGcellGrid::Init() { + macro_ = 0; + macroLength_ = 0; + x_ = 0; + xNum_ = 0; + xStep_ = 0; +} + +DEF_COPY_CONSTRUCTOR_C( defiGcellGrid ) { + this->Init(); + DEF_COPY_FUNC( macroLength_ ); + DEF_MALLOC_FUNC( macro_, char, sizeof(char) * (strlen(prev.macro_) +1)); + DEF_COPY_FUNC( x_ ); + DEF_COPY_FUNC( xNum_ ); + DEF_COPY_FUNC( xStep_ ); +} + +DEF_ASSIGN_OPERATOR_C( defiGcellGrid ) { + CHECK_SELF_ASSIGN + this->Init(); + DEF_COPY_FUNC( macroLength_ ); + DEF_MALLOC_FUNC( macro_, char, sizeof(char) * (strlen(prev.macro_) +1)); + DEF_COPY_FUNC( x_ ); + DEF_COPY_FUNC( xNum_ ); + DEF_COPY_FUNC( xStep_ ); + return *this; +} + +defiGcellGrid::~defiGcellGrid() { + Destroy(); +} + + +void defiGcellGrid::Destroy() { + if (macro_) free(macro_); +} + + +void defiGcellGrid::setup(const char* macro, int x, int xNum, double xStep) { + int len = strlen(macro) + 1; + if (len > macroLength_) { + if (macro_) free(macro_); + macroLength_ = len; + macro_ = (char*)malloc(len); + } + strcpy(macro_, defData->DEFCASE(macro)); + + x_ = x; + xNum_ = xNum; + xStep_ = xStep; +} + + +int defiGcellGrid::x() const { + return x_; +} + + +int defiGcellGrid::xNum() const { + return xNum_; +} + + +double defiGcellGrid::xStep() const { + return xStep_; +} + + +const char* defiGcellGrid::macro() const { + return macro_; +} + + +void defiGcellGrid::print(FILE* f) const { + fprintf(f, "GcellGrid '%s'\n", macro()); + fprintf(f, " DO %d %d STEP %5.1f\n", + x(), + xNum(), + xStep()); +} + + +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defiRowTrack.hpp b/src/def/def/defiRowTrack.hpp new file mode 100644 index 00000000..69788dfb --- /dev/null +++ b/src/def/def/defiRowTrack.hpp @@ -0,0 +1,193 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiRowTrack_h +#define defiRowTrack_h + +#include "defiKRDefs.hpp" +#include + +BEGIN_LEFDEF_PARSER_NAMESPACE + +class defrData; + +class defiRow{ +public: + + defiRow(defrData *data); + void Init(); + + DEF_COPY_CONSTRUCTOR_H( defiRow ); + DEF_ASSIGN_OPERATOR_H( defiRow ); + + ~defiRow(); + void Destroy(); + void clear(); + + void setup(const char* name, const char* macro, + double x, double y, int orient); + void setDo(double x_num, double y_num, + double x_step, double y_step); + void setHasDoStep(); + void addProperty(const char* name, const char* value, const char type); + void addNumProperty(const char* name, const double d, + const char* value, const char type); + + const char* name() const; + const char* macro() const; + double x() const; + double y() const; + int orient() const; + const char* orientStr() const; + int hasDo() const; // 5.6, DO is optional + double xNum() const; + double yNum() const; + int hasDoStep() const; // 5.6, STEP is optional in DO + double xStep() const; + double yStep() const; + + int numProps() const; + const char* propName(int index) const; + const char* propValue(int index) const; + double propNumber(int index) const; + char propType(int index) const; + int propIsNumber(int index) const; + int propIsString(int index) const; + + void print(FILE* f) const; + +protected: + int nameLength_; + char* name_; + int macroLength_; + char* macro_; + double x_; + double y_; + double xNum_; + double yNum_; + int orient_; + double xStep_; + double yStep_; + int hasDo_; + int hasDoStep_; + + int numProps_; + int propsAllocated_; + char** propNames_; + char** propValues_; + double* propDValues_; + char* propTypes_; + + defrData *defData; +}; + + + +class defiTrack{ +public: + + defiTrack(defrData *data); + void Init(); + + DEF_COPY_CONSTRUCTOR_H( defiTrack ); + DEF_ASSIGN_OPERATOR_H( defiTrack ); + + ~defiTrack(); + void Destroy(); + + void setup(const char* macro); + void setDo(double x, double x_num, double x_step); + void addLayer(const char* layer); + void addMask(int colorMask, int sameMask); + + const char* macro() const; + double x() const; + double xNum() const; + double xStep() const; + int numLayers() const; + const char* layer(int index) const; + int firstTrackMask() const; + int sameMask() const; + + void print(FILE* f) const; + +protected: + int macroLength_; // allocated size of macro_; + char* macro_; + double x_; + double xNum_; + double xStep_; + int layersLength_; // allocated size of layers_ + int numLayers_; // number of places used in layers_ + char** layers_; + int firstTrackMask_; + int samemask_; + + defrData *defData; +}; + + + +class defiGcellGrid { +public: + + defiGcellGrid(defrData *data); + void Init(); + + DEF_COPY_CONSTRUCTOR_H( defiGcellGrid ); + DEF_ASSIGN_OPERATOR_H( defiGcellGrid ); + + ~defiGcellGrid(); + void Destroy(); + + void setup(const char* macro, int x, int xNum, double xStep); + + const char* macro() const; + int x() const; + int xNum() const; + double xStep() const; + + void print(FILE* f) const; + +protected: + int macroLength_; + char* macro_; + int x_; + int xNum_; + double xStep_; + + defrData *defData; +}; + + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiScanchain.cpp b/src/def/def/defiScanchain.cpp new file mode 100644 index 00000000..2f089e70 --- /dev/null +++ b/src/def/def/defiScanchain.cpp @@ -0,0 +1,590 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2015, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include +#include "lex.h" +#include "defiScanchain.hpp" +#include "defiDebug.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +defiOrdered::defiOrdered(defrData *data) +: defData(data) +{} + +defiOrdered::~defiOrdered() +{ + Destroy(); +} + +void defiOrdered::clear() { + int i; + for (i = 0; i < num_; i++) { + free((char*)(inst_[i])); + if (in_[i]) free((char*)(in_[i])); + if (out_[i]) free((char*)(out_[i])); + } + num_ = 0; +} + + +void defiOrdered::Destroy() { + int i; + for (i = 0; i < num_; i++) { + free((char*)(inst_[i])); + free((char*)(in_[i])); + free((char*)(out_[i])); + } + free((char*)(inst_)); + free((char*)(in_)); + free((char*)(out_)); + free((char*)(bits_)); +} + + +void defiOrdered::Init() { + num_ = 0; + allocated_ = 32; + inst_ = (char**)malloc(sizeof(char*)*32); + in_ = (char**)malloc(sizeof(char*)*32); + out_ = (char**)malloc(sizeof(char*)*32); + bits_ = (int*)malloc(sizeof(int)*32); +} + + +void defiOrdered::bump() { + int max = allocated_ * 2; + int i; + char** nin = (char**)malloc(sizeof(char*)*max); + char** nout = (char**)malloc(sizeof(char*)*max); + char** ninst = (char**)malloc(sizeof(char*)*max); + int* nbits = (int*)malloc(sizeof(int)*max); + + for (i = 0; i < num_; i++) { + nin[i] = in_[i]; + nout[i] = out_[i]; + ninst[i] = inst_[i]; + nbits[i] = bits_[i]; + } + free((char*)(inst_)); + free((char*)(in_)); + free((char*)(out_)); + free((char*)(bits_)); + allocated_ = max; + inst_ = ninst; + in_ = nin; + out_ = nout; + bits_ = nbits; +} + + +void defiOrdered::addOrdered(const char* inst) { + if (num_ == allocated_) bump(); + inst_[num_] = (char*)malloc(strlen(inst)+1); + strcpy(inst_[num_], defData->DEFCASE(inst)); + in_[num_] = 0; + out_[num_] = 0; + bits_[num_] = -1; + num_ += 1; +} + + +void defiOrdered::addIn(const char* pin) { + in_[num_-1] = (char*)malloc(strlen(pin)+1); + strcpy(in_[num_-1], defData->DEFCASE(pin)); +} + + +void defiOrdered::addOut(const char* pin) { + out_[num_-1] = (char*)malloc(strlen(pin)+1); + strcpy(out_[num_-1], defData->DEFCASE(pin)); +} + + +void defiOrdered::setOrderedBits(int bits) { + bits_[num_-1] = bits; +} + + +int defiOrdered::num() const { + return num_; +} + + +char** defiOrdered::inst() const { + return inst_; +} + + +char** defiOrdered::in() const { + return in_; +} + + +char** defiOrdered::out() const { + return out_; +} + + +int* defiOrdered::bits() const { + return bits_; +} + + +defiScanchain::defiScanchain(defrData *data) + : defData(data) +{ + Init(); +} + + +void defiScanchain::Init() { + name_ = (char*)malloc(32); + nameLength_ = 32; + + numOrdered_ = 0; + numOrderedAllocated_ = 4; + ordered_ = (defiOrdered**)malloc(sizeof(defiOrdered*)*4); + + numFloating_ = 0; + numFloatingAllocated_ = 4; + floatInst_ = (char**)malloc(sizeof(char*)*4); + floatIn_ = (char**)malloc(sizeof(char*)*4); + floatOut_ = (char**)malloc(sizeof(char*)*4); + floatBits_ = (int*)malloc(sizeof(int)*4); + + stopInst_ = 0; + stopPin_ = 0; + startInst_ = 0; + startPin_ = 0; + hasStart_ = 0; + hasStop_ = 0; + commonInPin_ = 0; + commonOutPin_ = 0; + hasPartition_ = 0; + partName_ = 0; + maxBits_ = -1; +} + + +void defiScanchain::clear() { + int i; + + for (i = 0; i < numOrdered_; i++) { + delete ordered_[i]; + ordered_[i] = 0; + } + + numOrdered_ = 0; + + for (i = 0; i < numFloating_; i++) { + if (floatIn_[i]) free(floatIn_[i]); + if (floatOut_[i]) free(floatOut_[i]); + free(floatInst_[i]); + floatInst_[i] = 0; + floatBits_[i] = -1; + } + numFloating_ = 0; + + if (stopInst_) free(stopInst_); + if (stopPin_) free(stopPin_); + if (startInst_) free(startInst_); + if (startPin_) free(startPin_); + if (commonInPin_) free(commonInPin_); + if (commonOutPin_) free(commonOutPin_); + + stopInst_ = 0; + stopPin_ = 0; + startInst_ = 0; + startPin_ = 0; + hasStart_ = 0; + hasStop_ = 0; + commonInPin_ = 0; + commonOutPin_ = 0; + hasPartition_ = 0; + if (partName_) + free((char*)(partName_)); + partName_ = 0; + maxBits_ = -1; +} + + +void defiScanchain::Destroy() { + clear(); + free(name_); + free((char*)(ordered_)); + free((char*)(floatInst_)); + free((char*)(floatIn_)); + free((char*)(floatOut_)); + free((char*)(floatBits_)); +} + + +defiScanchain::~defiScanchain() { + Destroy(); +} + + +void defiScanchain::setName(const char* name) { + int len = strlen(name) + 1; + + clear(); + + if (len > nameLength_) { + free(name_); + name_ = (char*)malloc(len); + nameLength_ = len; + } + strcpy(name_, defData->DEFCASE(name)); +} + + +const char* defiScanchain::name() const { + return name_; +} + + +void defiScanchain::addFloatingInst(const char* name) { + + if (numFloating_ >= numFloatingAllocated_) { + int max = 2 * numFloatingAllocated_; + int i; + char** ninst = (char**)malloc(sizeof(char*)*max); + char** nin = (char**)malloc(sizeof(char*)*max); + char** nout = (char**)malloc(sizeof(char*)*max); + int* nbits = (int*)malloc(sizeof(int)*max); + for (i = 0; i < numFloating_; i++) { + ninst[i] = floatInst_[i]; + nin[i] = floatIn_[i]; + nout[i] = floatOut_[i]; + nbits[i] = floatBits_[i]; + } + free((char*)(floatInst_)); + free((char*)(floatIn_)); + free((char*)(floatOut_)); + free((char*)(floatBits_)); + floatInst_ = ninst; + floatOut_ = nout; + floatIn_ = nin; + floatBits_ = nbits; + numFloatingAllocated_ = max; + } + + floatInst_[numFloating_] = + (char*)malloc(strlen(name) + 1); + strcpy(floatInst_[numFloating_], defData->DEFCASE(name)); + floatIn_[numFloating_] = 0; + floatOut_[numFloating_] = 0; + floatBits_[numFloating_] = -1; + numFloating_ += 1; +} + + +void defiScanchain::addFloatingIn(const char* name) { + int len = strlen(name) + 1; + floatIn_[numFloating_-1] = (char*)malloc(len); + strcpy(floatIn_[numFloating_-1], defData->DEFCASE(name)); +} + + +void defiScanchain::addFloatingOut(const char* name) { + int len = strlen(name) + 1; + floatOut_[numFloating_-1] = (char*)malloc(len); + strcpy(floatOut_[numFloating_-1], defData->DEFCASE(name)); +} + + +void defiScanchain::setFloatingBits(int bits) { + floatBits_[numFloating_-1] = bits; +} + + +void defiScanchain::addOrderedIn(const char* name) { + defiOrdered* o = ordered_[numOrdered_-1]; + o->addIn(name); +} + + +void defiScanchain::addOrderedOut(const char* name) { + defiOrdered* o = ordered_[numOrdered_-1]; + o->addOut(name); +} + + +void defiScanchain::addOrderedInst(const char* name) { + defiOrdered* o = ordered_[numOrdered_-1]; + o->addOrdered(name); +} + + +void defiScanchain::setOrderedBits(int bits) { + defiOrdered* o = ordered_[numOrdered_-1]; + o->setOrderedBits(bits); +} + + +void defiScanchain::addOrderedList() { + defiOrdered* o; + + if (numOrdered_ == numOrderedAllocated_) { + int max = 2 * numOrderedAllocated_; + int i; + defiOrdered** no = (defiOrdered**)malloc(sizeof(defiOrdered*)*max); + for (i = 0; i < numOrdered_; i++) { + no[i] = ordered_[i]; + } + free((char*)(ordered_)); + ordered_ = no; + numOrderedAllocated_ = max; + } + + o = new defiOrdered(defData); + ordered_[numOrdered_] = o; + o->Init(); + numOrdered_ += 1; +} + + +void defiScanchain::setStart(const char* inst, const char* pin) { + int len; + if (startInst_) + defiError(0, 6150, "ERROR (DEFPARS-6150): The START statement in the SCANCHAINS has defined more than one time in the SCANCHAINS statement.\nUpdate the DEF file to only one START statement and then try again.", defData); + len = strlen(inst) + 1; + startInst_ = (char*)malloc(len); + strcpy(startInst_, defData->DEFCASE(inst)); + len = strlen(pin) + 1; + startPin_ = (char*)malloc(len); + strcpy(startPin_, defData->DEFCASE(pin)); + hasStart_ = 1; +} + + +void defiScanchain::setStop(const char* inst, const char* pin) { + int len; + if (stopInst_) + defiError(0, 6151, "ERROR (DEFPARS-6151): The STOP statment in the SCANCHAINS has defined more than one time in the SCANCHAINS statement.\nUpdate the DEF file to only one STOP statement and then try again.", defData); + len = strlen(inst) + 1; + stopInst_ = (char*)malloc(len); + strcpy(stopInst_, defData->DEFCASE(inst)); + len = strlen(pin) + 1; + stopPin_ = (char*)malloc(len); + strcpy(stopPin_, defData->DEFCASE(pin)); + hasStop_ = 1; +} + + +// 5.4.1 +void defiScanchain::setPartition(const char* partName, int maxBits) { + if (partName_) + free(partName_); + partName_ = (char*)malloc(strlen(partName) + 1); + strcpy(partName_, defData->DEFCASE(partName)); + maxBits_ = maxBits; + hasPartition_ = 1; +} + + +int defiScanchain::hasStart() const { + return (int)(hasStart_); +} + + +int defiScanchain::hasStop() const { + return (int)(hasStop_); +} + + +int defiScanchain::hasFloating() const { + return numFloating_ ? 1 : 0 ; +} + + +int defiScanchain::hasOrdered() const { + return numOrdered_ ? 1 : 0 ; +} + + +// 5.4.1 +int defiScanchain::hasPartition() const { + return hasPartition_; +} + + +// 5.4.1 +int defiScanchain::hasPartitionMaxBits() const { + return (maxBits_ != -1) ? 1 : 0; +} + + +// 5.4.1 +const char* defiScanchain::partitionName() const { + return partName_; +} + + +// 5.4.1 +int defiScanchain::partitionMaxBits() const { + return maxBits_; +} + + +void defiScanchain::start(char** inst, char** pin) const { + if (inst) *inst = startInst_; + if (pin) *pin = startPin_; +} + + +void defiScanchain::stop(char** inst, char** pin) const { + if (inst) *inst = stopInst_; + if (pin) *pin = stopPin_; +} + + +int defiScanchain::numOrderedLists() const { + return numOrdered_; +} + + +void defiScanchain::ordered(int index, int* size, char*** inst, + char*** inPin, char*** outPin, int** bits) const { + defiOrdered* o; + if (index >= 0 && index <= numOrdered_) { + o = ordered_[index]; + *size = o->num(); + *inst = o->inst(); + *inPin = o->in(); + *outPin = o->out(); + *bits = o->bits(); + } else { + *size = 10; + *inst = 0; + } +} + + +void defiScanchain::floating(int* size, char*** inst, + char*** inPin, char*** outPin, int** bits) const { + *size = numFloating_; + *inst = floatInst_; + *inPin = floatIn_; + *outPin = floatOut_; + *bits = floatBits_; +} + + +void defiScanchain::setCommonOut(const char* pin) { + int len = strlen(pin) + 1; + commonOutPin_ = (char*)malloc(len); + strcpy(commonOutPin_, defData->DEFCASE(pin)); +} + + +void defiScanchain::setCommonIn(const char* pin) { + int len = strlen(pin) + 1; + commonInPin_ = (char*)malloc(len); + strcpy(commonInPin_, defData->DEFCASE(pin)); +} + + +int defiScanchain::hasCommonInPin() const { + return commonInPin_ ? 1 : 0; +} + + +int defiScanchain::hasCommonOutPin() const { + return commonOutPin_ ? 1 : 0; +} + + +const char* defiScanchain::commonInPin() const { + return commonInPin_; +} + + +const char* defiScanchain::commonOutPin() const { + return commonOutPin_; +} + + +void defiScanchain::print(FILE* f) const { + char* a; + char* b; + + char** inst; + char** in; + char** out; + int* bits; + int num; + int i; + int h; + + fprintf(f, "Scan chain '%s' %d things\n", + name(), + hasStart() + + hasStop() + + numFloating_ + + numOrderedLists()); + + if (hasStart()) { + start(&a, &b); + fprintf(f, " start inst '%s' pin '%s'\n", a, b); + } + + if (hasStop()) { + stop(&a, &b); + fprintf(f, " stop inst '%s' pin '%s'\n", a, b); + } + + floating(&num, &inst, &in, &out, &bits); + for (i = 0; i < num; i++) { + fprintf(f, " floating '%s' IN=%s OUT=%s BITS=%d\n", inst[i], + in[i]?in[i]:"NIL", out[i]?out[i]:"NIL", bits[i]?bits[i]:0); + } + + for (i = 0; i < numOrderedLists(); i++) { + ordered(i, &num, &inst, &in, &out, &bits); + fprintf(f, " %d ordered\n", i); + for (h = 0; h < num; h++) { + fprintf(f, " '%s' IN=%s OUT=%s BITS=%d\n", inst[h], + in[h]?in[h]:"NIL", out[h]?out[h]:"NIL", bits[h]?bits[h]:0); + } + } + + if (hasCommonInPin()) + fprintf(f, " common in pin %s\n", commonInPin()); + + if (hasCommonOutPin()) + fprintf(f, " common out pin %s\n", commonOutPin()); +} + + +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defiScanchain.hpp b/src/def/def/defiScanchain.hpp new file mode 100644 index 00000000..e46e4765 --- /dev/null +++ b/src/def/def/defiScanchain.hpp @@ -0,0 +1,186 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiScanchain_h +#define defiScanchain_h + +#include "defiKRDefs.hpp" +#include + +BEGIN_LEFDEF_PARSER_NAMESPACE + +class defrData; + +class defiOrdered { +public: + defiOrdered(defrData *data); + ~defiOrdered(); + + void addOrdered(const char* inst); + void addIn(const char* pin); + void addOut(const char* pin); + void setOrderedBits(int bits); // 5.4.1 + void bump(); + void Init(); + void Destroy(); + void clear(); + + int num() const; + char** inst() const; + char** in() const; + char** out() const; + int* bits() const; // 5.4.1 + +protected: + int num_; + int allocated_; + char** inst_; + char** in_; + char** out_; + int* bits_; // 5.4.1 + + defrData *defData; +}; + + +// Struct holds the data for one Scan chain. +// +class defiScanchain { +public: + defiScanchain(defrData *data); + void Init(); + + void Destroy(); + ~defiScanchain(); + + void setName(const char* name); + void clear(); + + void addOrderedList(); + void addOrderedInst(const char* inst); + void addOrderedIn(const char* inPin); + void addOrderedOut(const char* outPin); + void setOrderedBits(int bits); // 5.4.1 + + void addFloatingInst(const char* inst); + void addFloatingIn(const char* inPin); + void addFloatingOut(const char* outPin); + void setFloatingBits(int bits); // 5.4.1 + + void setStart(const char* inst, const char* pin); + void setStop(const char* inst, const char* pin); + void setCommonIn(const char* pin); + void setCommonOut(const char* pin); + void setPartition(const char* partName, int maxBits); // 5.4.1 + + const char* name() const; + int hasStart() const; + int hasStop() const; + int hasFloating() const; + int hasOrdered() const; + int hasCommonInPin() const; + int hasCommonOutPin() const; + int hasPartition() const; // 5.4.1 + int hasPartitionMaxBits() const; // 5.4.1 + + // If the pin part of these routines were not supplied in the DEF + // then a NULL pointer will be returned. + void start(char** inst, char** pin) const; + void stop(char** inst, char** pin) const; + + // There could be many ORDERED constructs in the DEF. The data in + // each ORDERED construct is stored in its own array. The numOrderedLists() + // routine tells how many lists there are. + int numOrderedLists() const; + + // This routine will return an array of instances and + // an array of in and out pins. + // The number if things in the arrays is returned in size. + // The inPin and outPin entry is optional for each instance. + // If an entry is not given, then that char* is NULL. + // For example if the second instance has + // instnam= "FOO" and IN="A", but no OUT given, then inst[1] points + // to "FOO" inPin[1] points to "A" and outPin[1] is a NULL pointer. + void ordered(int index, int* size, char*** inst, char*** inPin, + char*** outPin, int** bits) const; + + // All of the floating constructs in the scan chain are + // stored in this one array. + // If the IN or OUT of an entry is not supplied then the array will have + // a NULL pointer in that place. + void floating(int* size, char*** inst, char*** inPin, char*** outPin, + int** bits) const; + + const char* commonInPin() const; + const char* commonOutPin() const; + + const char* partitionName() const; // 5.4.1 + int partitionMaxBits() const; // 5.4.1 + + void print(FILE* f) const; + +protected: + char* name_; + char hasStart_; + char hasStop_; + int nameLength_; + + int numOrderedAllocated_; + int numOrdered_; + defiOrdered** ordered_; + + int numFloatingAllocated_; + int numFloating_; + char** floatInst_; // Array of floating names + char** floatIn_; + char** floatOut_; + int* floatBits_; // 5.4.1 + + char* stopInst_; + char* stopPin_; + + char* startInst_; + char* startPin_; + + char* commonInPin_; + char* commonOutPin_; + + char hasPartition_; // 5.4.1 + char* partName_; // 5.4.1 + int maxBits_; // 5.4.1 + + defrData *defData; +}; + + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiSite.cpp b/src/def/def/defiSite.cpp new file mode 100644 index 00000000..f9766d1c --- /dev/null +++ b/src/def/def/defiSite.cpp @@ -0,0 +1,305 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2015, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include "defiSite.hpp" +#include "defiDebug.hpp" +#include "lex.h" +#include "defiUtil.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +////////////////////////////////////////////// +////////////////////////////////////////////// +// +// defiSite +// +////////////////////////////////////////////// +////////////////////////////////////////////// + + +defiSite::defiSite(defrData *data) + : defData(data) +{ + Init(); +} + + +defiSite::~defiSite() { + Destroy(); +} + + +void defiSite::Init() { + siteName_ = (char*)malloc(32); + nameSize_ = 32; + clear(); +} + + +void defiSite::Destroy() { + free(siteName_); +} + + +void defiSite::clear() { + if (siteName_) + *siteName_ = '\0'; + x_num_ = 0.0; + y_num_ = 0.0; + x_step_ = 0.0; + y_step_ = 0.0; + orient_ = 0; +} + + +void defiSite::setName(const char* name) { + int len = 1; + char* from = (char*)name; + clear(); + while (*from++) len++; + if (nameSize_ < len) bumpName(len); + strcpy(siteName_, defData->DEFCASE(name)); +} + + +void defiSite::setLocation(double xorg, double yorg) { + x_orig_ = xorg; + y_orig_ = yorg; +} + + +void defiSite::setOrient(int orient) { + orient_ = orient; +} + + +void defiSite::setDo(double x_num, double y_num, double x_step, double y_step) { + x_num_ = x_num; + y_num_ = y_num; + x_step_ = x_step; + y_step_ = y_step; +} + + +double defiSite::x_num() const { + return x_num_; +} + + +double defiSite::y_num() const { + return y_num_; +} + + +double defiSite::x_step() const { + return x_step_; +} + + +double defiSite::y_step() const { + return y_step_; +} + + +double defiSite::x_orig() const { + return x_orig_; +} + + +double defiSite::y_orig() const { + return y_orig_; +} + + +int defiSite::orient() const { + return orient_; +} + + +const char* defiSite::orientStr() const { + return (defiOrientStr(orient_)); +} + + +const char* defiSite::name() const { + return siteName_; +} + + +void defiSite::bumpName(int size) { + free(siteName_); + siteName_ = (char*)malloc(size); + nameSize_ = size; + *siteName_ = '\0'; +} + + +void defiSite::print(FILE* f) const { + fprintf(f, "Site '%p' %s\n", name(), + orientStr()); + fprintf(f, " DO X %g %g BY %g\n", + x_orig(), + x_num(), + x_step()); + fprintf(f, " DO Y %g %g BY %g\n", + y_orig(), + y_num(), + y_step()); + +} + + +////////////////////////////////////////////// +////////////////////////////////////////////// +// +// defiBox +// +////////////////////////////////////////////// +////////////////////////////////////////////// + +defiBox::defiBox() { + Init(); +} + +void defiBox::Init() { + xl_ = 0; + yl_ = 0; + xh_ = 0; + yh_ = 0; + points_ = 0; +} + +DEF_COPY_CONSTRUCTOR_C( defiBox ) { + this->Init(); + + DEF_COPY_FUNC( xl_ ); + DEF_COPY_FUNC( yl_ ); + DEF_COPY_FUNC( xh_ ); + DEF_COPY_FUNC( yh_ ); + + DEF_MALLOC_FUNC_WITH_OPERATOR( points_, defiPoints, sizeof(defiPoints)*1 ); +} + +DEF_ASSIGN_OPERATOR_C( defiBox ) { + CHECK_SELF_ASSIGN + this->Init(); + + DEF_COPY_FUNC( xl_ ); + DEF_COPY_FUNC( yl_ ); + DEF_COPY_FUNC( xh_ ); + DEF_COPY_FUNC( yh_ ); + + DEF_MALLOC_FUNC_WITH_OPERATOR( points_, defiPoints, sizeof(defiPoints)*1 ); + return *this; +} + +defiBox::~defiBox() { + Destroy(); +} + +void defiBox::Destroy() { + struct defiPoints* p; + + p = points_; + if (p) { + free((char*)(p->x)); + free((char*)(p->y)); + free((char*)(points_)); + } +} + +void defiBox::addPoint(defiGeometries* geom) { + struct defiPoints* p; + struct defiPoints* tp; + int x, y; + int i; + + p = (struct defiPoints*)malloc(sizeof(struct defiPoints)); + p->numPoints = geom->numPoints(); + p->x = (int*)malloc(sizeof(int)*p->numPoints); + p->y = (int*)malloc(sizeof(int)*p->numPoints); + for (i = 0; i < p->numPoints; i++) { + geom->points(i, &x, &y); + p->x[i] = x; + p->y[i] = y; + // for backward compatibility assign the first 2 points to xl, yl, xh & yh + if (i == 0) { + xl_ = x; + yl_ = y; + } else if (i == 1) { + xh_ = x; + yh_ = y; + } + } + if (points_) { + tp = points_; + free((char*)(tp->x)); + free((char*)(tp->y)); + free((char*)(tp)); + } + points_ = p; +} + +int defiBox::xl() const { + return xl_; +} + + +int defiBox::yl() const { + return yl_; +} + + +int defiBox::xh() const { + return xh_; +} + + +int defiBox::yh() const { + return yh_; +} + + +struct defiPoints defiBox::getPoint() const { + return *(points_); +} + +void defiBox::print(FILE* f) const { + fprintf(f, "Box %d,%d %d %d\n", + xl(), + yl(), + xh(), + yh()); +} + + +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defiSite.hpp b/src/def/def/defiSite.hpp new file mode 100644 index 00000000..50be5dc5 --- /dev/null +++ b/src/def/def/defiSite.hpp @@ -0,0 +1,127 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiSite_h +#define defiSite_h + +#include "defiKRDefs.hpp" +#include "defiMisc.hpp" +#include + +BEGIN_LEFDEF_PARSER_NAMESPACE + +class defrData; + +/* + * Struct holds the data for one site. + * It is also used for a canplace and cannotoccupy. + */ +class defiSite { +public: + defiSite(defrData *data); + void Init(); + + ~defiSite(); + void Destroy(); + + void clear(); + + void setName(const char* name); + void setLocation(double xorg, double yorg); + void setOrient(int orient); + void setDo(double x_num, double y_num, double x_step, double y_step); + + double x_num() const; + double y_num() const; + double x_step() const; + double y_step() const; + double x_orig() const; + double y_orig() const; + int orient() const; + const char* orientStr() const; + const char* name() const; + + void print(FILE* f) const; + + void bumpName(int size); + +protected: + char* siteName_; // Name of this. + int nameSize_; // allocated size of siteName_ + double x_orig_, y_orig_; // Origin + double x_step_, y_step_; // Array step size. + double x_num_, y_num_; + int orient_; // orientation + + defrData *defData; +}; + + + +/* Struct holds the data for a Box */ +class defiBox { +public: + // Use the default destructor and constructor. + // 5.6 changed to use it own constructor & destructor + + defiBox(); + void Init(); + + DEF_COPY_CONSTRUCTOR_H( defiBox ); + DEF_ASSIGN_OPERATOR_H( defiBox ); + + void Destroy(); + ~defiBox(); + + // NOTE: 5.6 + // The following methods are still here for backward compatibility + // For new reader they should use numPoints & getPoint to get the + // data. + int xl() const; + int yl() const; + int xh() const; + int yh() const; + + void addPoint(defiGeometries* geom); + defiPoints getPoint() const; + + void print(FILE* f) const; + +protected: + int xl_, yl_; + int xh_, yh_; + defiPoints* points_; // 5.6 +}; + + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiSlot.cpp b/src/def/def/defiSlot.cpp new file mode 100644 index 00000000..80b4db85 --- /dev/null +++ b/src/def/def/defiSlot.cpp @@ -0,0 +1,276 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2015, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include +#include "lex.h" +#include "defiSlot.hpp" +#include "defiDebug.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +//////////////////////////////////////////////////// +//////////////////////////////////////////////////// +// +// defiSlot +// +//////////////////////////////////////////////////// +//////////////////////////////////////////////////// + +defiSlot::defiSlot(defrData *data) + : defData(data) +{ + Init(); +} + + +void defiSlot::Init() { + numPolys_ = 0; + clear(); + layerNameLength_ = 0; + xl_ = (int*)malloc(sizeof(int)*1); + yl_ = (int*)malloc(sizeof(int)*1); + xh_ = (int*)malloc(sizeof(int)*1); + yh_ = (int*)malloc(sizeof(int)*1); + rectsAllocated_ = 1; // At least 1 rectangle will define + polysAllocated_ = 0; + polygons_ = 0; + layerName_ = 0; +} + +defiSlot::~defiSlot() { + Destroy(); +} + +void defiSlot::clear() { + hasLayer_ = 0; + numRectangles_ = 0; +} + +void defiSlot::clearPoly() { + struct defiPoints* p; + int i; + + for (i = 0; i < numPolys_; i++) { + p = polygons_[i]; + free((char*)(p->x)); + free((char*)(p->y)); + free((char*)(polygons_[i])); + } + numPolys_ = 0; +} + +void defiSlot::Destroy() { + if (layerName_) free(layerName_); + free((char*)(xl_)); + free((char*)(yl_)); + free((char*)(xh_)); + free((char*)(yh_)); + rectsAllocated_ = 0; + xl_ = 0; + yl_ = 0; + xh_ = 0; + yh_ = 0; + clearPoly(); + if (polygons_) free((char*)(polygons_)); + polygons_ = 0; + clear(); +} + + +void defiSlot::setLayer(const char* name) { + int len = strlen(name) + 1; + if (layerNameLength_ < len) { + if (layerName_) free(layerName_); + layerName_ = (char*)malloc(len); + layerNameLength_ = len; + } + strcpy(layerName_, defData->DEFCASE(name)); + hasLayer_ = 1; +} + + +void defiSlot::addRect(int xl, int yl, int xh, int yh) { + if (numRectangles_ == rectsAllocated_) { + int i; + int max = rectsAllocated_ = rectsAllocated_ * 2; + int* newxl = (int*)malloc(sizeof(int)*max); + int* newyl = (int*)malloc(sizeof(int)*max); + int* newxh = (int*)malloc(sizeof(int)*max); + int* newyh = (int*)malloc(sizeof(int)*max); + for (i = 0; i < numRectangles_; i++) { + newxl[i] = xl_[i]; + newyl[i] = yl_[i]; + newxh[i] = xh_[i]; + newyh[i] = yh_[i]; + } + free((char*)(xl_)); + free((char*)(yl_)); + free((char*)(xh_)); + free((char*)(yh_)); + xl_ = newxl; + yl_ = newyl; + xh_ = newxh; + yh_ = newyh; + } + xl_[numRectangles_] = xl; + yl_[numRectangles_] = yl; + xh_[numRectangles_] = xh; + yh_[numRectangles_] = yh; + numRectangles_ += 1; +} + +// 5.6 +void defiSlot::addPolygon(defiGeometries* geom) { + struct defiPoints* p; + int x, y; + int i; + + if (numPolys_ == polysAllocated_) { + struct defiPoints** poly; + polysAllocated_ = (polysAllocated_ == 0) ? + 2 : polysAllocated_ * 2; + poly = (struct defiPoints**)malloc(sizeof(struct defiPoints*) * + polysAllocated_); + for (i = 0; i < numPolys_; i++) + poly[i] = polygons_[i]; + if (polygons_) + free((char*)(polygons_)); + polygons_ = poly; + } + p = (struct defiPoints*)malloc(sizeof(struct defiPoints)); + p->numPoints = geom->numPoints(); + p->x = (int*)malloc(sizeof(int)*p->numPoints); + p->y = (int*)malloc(sizeof(int)*p->numPoints); + for (i = 0; i < p->numPoints; i++) { + geom->points(i, &x, &y); + p->x[i] = x; + p->y[i] = y; + } + polygons_[numPolys_] = p; + numPolys_ += 1; +} + +int defiSlot::hasLayer() const { + return hasLayer_; +} + + +const char* defiSlot::layerName() const { + return layerName_; +} + + +int defiSlot::numRectangles() const { + return numRectangles_; +} + + +int defiSlot::xl(int index) const { + char msg[256]; + if (index < 0 || index >= numRectangles_) { + sprintf (msg, "ERROR (DEFPARS-6160): The index number %d specified for the SLOT RECTANGLE is invalid.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numRectangles_); + defiError(0, 6160, msg, defData); + return 0; + } + return xl_[index]; +} + + +int defiSlot::yl(int index) const { + char msg[256]; + if (index < 0 || index >= numRectangles_) { + sprintf (msg, "ERROR (DEFPARS-6160): The index number %d specified for the SLOT RECTANGLE is invalid.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numRectangles_); + defiError(0, 6160, msg, defData); + return 0; + } + return yl_[index]; +} + + +int defiSlot::xh(int index) const { + char msg[256]; + if (index < 0 || index >= numRectangles_) { + sprintf (msg, "ERROR (DEFPARS-6160): The index number %d specified for the SLOT RECTANGLE is invalid.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numRectangles_); + defiError(0, 6160, msg, defData); + return 0; + } + return xh_[index]; +} + + +int defiSlot::yh(int index) const { + char msg[256]; + if (index < 0 || index >= numRectangles_) { + sprintf (msg, "ERROR (DEFPARS-6160): The index number %d specified for the SLOT RECTANGLE is invalid.\nValid index number is from 0 to %d. Specify a valid index number and then try again.", + index, numRectangles_); + defiError(0, 6160, msg, defData); + return 0; + } + return yh_[index]; +} + +// 5.6 +int defiSlot::numPolygons() const { + return numPolys_; +} + +// 5.6 +struct defiPoints defiSlot::getPolygon(int index) const { + return *(polygons_[index]); +} + +void defiSlot::print(FILE* f) const { + int i, j; + struct defiPoints points; + + if (hasLayer()) + fprintf(f, "- LAYER %s\n", layerName()); + + for (i = 0; i < numRectangles(); i++) { + fprintf(f, " RECT %d %d %d %d\n", xl(i), + yl(i), xh(i), + yh(i)); + } + + for (i = 0; i < numPolygons(); i++) { + fprintf(f, " POLYGON "); + points = getPolygon(i); + for (j = 0; j < points.numPoints; j++) + fprintf(f, "%d %d ", points.x[j], points.y[j]); + fprintf(f, "\n"); + } + fprintf(f,"\n"); +} +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defiSlot.hpp b/src/def/def/defiSlot.hpp new file mode 100644 index 00000000..783ab0f6 --- /dev/null +++ b/src/def/def/defiSlot.hpp @@ -0,0 +1,92 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiSLOT_h +#define defiSLOT_h + +#include +#include "defiKRDefs.hpp" +#include "defiMisc.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +class defrData; + +class defiSlot { +public: + defiSlot(defrData *data); + void Init(); + + void Destroy(); + ~defiSlot(); + + void clear(); + void clearPoly(); + + void setLayer(const char* name); + void addRect(int xl, int yl, int xh, int yh); + void addPolygon(defiGeometries* geom); + + int hasLayer() const; + const char* layerName() const; + + int numRectangles() const; + int xl(int index) const; + int yl(int index) const; + int xh(int index) const; + int yh(int index) const; + + int numPolygons() const; // 5.6 + defiPoints getPolygon(int index) const; // 5.6 + + void print(FILE* f) const; + +protected: + int hasLayer_; + char* layerName_; + int layerNameLength_; + int numRectangles_; + int rectsAllocated_; + int* xl_; + int* yl_; + int* xh_; + int* yh_; + int numPolys_; // 5.6 + int polysAllocated_; // 5.6 + defiPoints** polygons_; // 5.6 + + defrData *defData; +}; + + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiTimingDisable.cpp b/src/def/def/defiTimingDisable.cpp new file mode 100644 index 00000000..cc3ee82e --- /dev/null +++ b/src/def/def/defiTimingDisable.cpp @@ -0,0 +1,320 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2015, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include "lex.h" +#include "defiTimingDisable.hpp" +#include "defiDebug.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + + +////////////////////////////////////////////// +////////////////////////////////////////////// +// +// defiTimingDisable +// +////////////////////////////////////////////// +////////////////////////////////////////////// + + +defiTimingDisable::defiTimingDisable(defrData *data) + : defData(data) +{ + Init(); +} + + +void defiTimingDisable::Init() { + fromInst_ = 0; + fromInstLength_ = 0; + toInst_ = 0; + toInstLength_ = 0; + toPin_ = 0; + toPinLength_ = 0; + fromPin_ = 0; + fromPinLength_ = 0; +} + + +defiTimingDisable::~defiTimingDisable() { + Destroy(); +} + + +void defiTimingDisable::Destroy() { + + clear(); + + if (fromInst_) free(fromInst_); + fromInst_ = 0; + fromInstLength_ = 0; + + if (toInst_) free(toInst_); + toInst_ = 0; + toInstLength_ = 0; + + if (toPin_) free(toPin_); + toPin_ = 0; + toPinLength_ = 0; + + if (fromPin_) free(fromPin_); + fromPin_ = 0; + fromPinLength_ = 0; + +} + + +void defiTimingDisable::clear() { + hasFromTo_ = 0; + hasThru_ = 0; + hasMacro_ = 0; + hasReentrantPathsFlag_ = 0; +} + + +void defiTimingDisable::setReentrantPathsFlag() { + hasReentrantPathsFlag_ = 1; +} + + +void defiTimingDisable::setFromTo(const char* fromInst, const char* fromPin, + const char* toInst, const char* toPin) { + int len; + + clear(); + hasFromTo_ = 1; + + len = strlen(fromInst) + 1; + if (len > fromInstLength_) { + if (fromInst_) free(fromInst_); + fromInstLength_ = len; + fromInst_ = (char*)malloc(len); + } + strcpy(fromInst_,defData->DEFCASE(fromInst)); + + len = strlen(fromPin) + 1; + if (len > fromPinLength_) { + if (fromPin_) free(fromPin_); + fromPinLength_ = len; + fromPin_ = (char*)malloc(len); + } + strcpy(fromPin_,defData->DEFCASE(fromPin)); + + len = strlen(toInst) + 1; + if (len > toInstLength_) { + if (toInst_) free(toInst_); + toInstLength_ = len; + toInst_ = (char*)malloc(len); + } + strcpy(toInst_, toInst); + + len = strlen(toPin) + 1; + if (len > toPinLength_) { + if (toPin_) free(toPin_); + toPinLength_ = len; + toPin_ = (char*)malloc(len); + } + strcpy(toPin_, toPin); + +} + + +void defiTimingDisable::setThru(const char* fromInst, const char* fromPin) { + int len; + + clear(); + hasThru_ = 1; + + len = strlen(fromInst) + 1; + if (len > fromInstLength_) { + if (fromInst_) free(fromInst_); + fromInstLength_ = len; + fromInst_ = (char*)malloc(len); + } + strcpy(fromInst_,defData->DEFCASE(fromInst)); + + len = strlen(fromPin) + 1; + if (len > fromPinLength_) { + if (fromPin_) free(fromPin_); + fromPinLength_ = len; + fromPin_ = (char*)malloc(len); + } + strcpy(fromPin_,defData->DEFCASE(fromPin)); + +} + + +void defiTimingDisable::setMacroFromTo(const char* fromPin, const char* toPin) { + int len; + + clear(); + hasFromTo_ = 1; + + len = strlen(fromPin) + 1; + if (len > fromPinLength_) { + if (fromPin_) free(fromPin_); + fromPinLength_ = len; + fromPin_ = (char*)malloc(len); + } + strcpy(fromPin_,defData->DEFCASE(fromPin)); + + len = strlen(toPin) + 1; + if (len > toPinLength_) { + if (toPin_) free(toPin_); + toPinLength_ = len; + toPin_ = (char*)malloc(len); + } + strcpy(toPin_,defData->DEFCASE(toPin)); + +} + + +void defiTimingDisable::setMacroThru(const char* thru) { + int len; + + clear(); + + hasThru_ = 1; + + len = strlen(thru) + 1; + if (len > fromPinLength_) { + if (fromPin_) free(fromPin_); + fromPinLength_ = len; + fromPin_ = (char*)malloc(len); + } + strcpy(fromPin_,defData->DEFCASE(thru)); + +} + + +void defiTimingDisable::setMacro(const char* name) { + int len; + + // hasThru_ or hasFromTo_ was already set. + // clear() was already called. + hasMacro_ = 1; + + len = strlen(name) + 1; + if (len > fromInstLength_) { + if (fromInst_) free(fromInst_); + fromInstLength_ = len; + fromInst_ = (char*)malloc(len); + } + strcpy(fromInst_,defData->DEFCASE(name)); +} + + +void defiTimingDisable::print(FILE* f) const { + + if (hasMacroFromTo()) { + fprintf(f, "TimingDisable macro '%s' thru '%s'\n", + fromInst_, fromPin_); + + } else if (hasMacroThru()) { + fprintf(f, "TimingDisable macro '%s' from '%s' to '%s'\n", + fromInst_, fromPin_, toPin_); + + } else if (hasFromTo()) { + fprintf(f, "TimingDisable from '%s' '%s' to '%s' '%s'\n", + fromInst_, fromPin_, toInst_, toPin_); + + } else if (hasThru()) { + fprintf(f, "TimingDisable thru '%s' '%s'\n", + fromInst_, fromPin_); + + } else { + defiError(0, 6170, "ERROR (DEFPARS-6170): The TimingDisable type is invalid. The valid types are FROMPIN, & THRUPIN. Specify the valid type and then try again.", defData); + } +} + + +int defiTimingDisable::hasReentrantPathsFlag() const { + return hasReentrantPathsFlag_; +} + + +int defiTimingDisable::hasMacroFromTo() const { + return (hasMacro_ && hasFromTo_) ? 1 : 0; +} + + +int defiTimingDisable::hasMacroThru() const { + return (hasMacro_ && hasThru_) ? 1 : 0; +} + + +int defiTimingDisable::hasThru() const { + return (hasMacro_ == 0 && hasThru_) ? 1 : 0; +} + + +int defiTimingDisable::hasFromTo() const { + return (hasMacro_ == 0 && hasFromTo_) ? 1 : 0; +} + + +const char* defiTimingDisable::toPin() const { + return toPin_; +} + + +const char* defiTimingDisable::fromPin() const { + return fromPin_; +} + + +const char* defiTimingDisable::toInst() const { + return toInst_; +} + + +const char* defiTimingDisable::fromInst() const { + return fromInst_; +} + + +const char* defiTimingDisable::macroName() const { + return fromInst_; +} + + +const char* defiTimingDisable::thruPin() const { + return fromPin_; +} + + +const char* defiTimingDisable::thruInst() const { + return fromInst_; +} + + +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defiTimingDisable.hpp b/src/def/def/defiTimingDisable.hpp new file mode 100644 index 00000000..c3a1a57c --- /dev/null +++ b/src/def/def/defiTimingDisable.hpp @@ -0,0 +1,101 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiTimingDisable_h +#define defiTimingDisable_h + +#include +#include "defiKRDefs.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +// A Timing disable can be a from-to or a thru or a macro. +// A macro is either a fromto macro or a thru macro. +class defrData; + + +class defiTimingDisable { +public: + defiTimingDisable(defrData *data); + void Init(); + + void Destroy(); + ~defiTimingDisable(); + + void clear(); + + void setFromTo(const char* fromInst, const char* fromPin, + const char* toInst, const char* toPin); + void setThru(const char* fromInst, const char* fromPin); + void setMacro(const char* name); + void setMacroThru(const char* thru); + void setMacroFromTo(const char* fromPin, const char* toPin); + void setReentrantPathsFlag(); + + int hasMacroThru() const; + int hasMacroFromTo() const; + int hasThru() const; + int hasFromTo() const; + int hasReentrantPathsFlag() const; + + const char* fromPin() const; + const char* toPin() const; + const char* fromInst() const; + const char* toInst() const; + const char* macroName() const; + const char* thruPin() const; // Also macro thru + const char* thruInst() const; + + // debug print + void print(FILE* f) const; + +protected: + char* fromInst_; // also macro name and thru inst + int fromInstLength_; + char* toInst_; + int toInstLength_; + char* fromPin_; // also macro thru and thru pin + int fromPinLength_; + char* toPin_; + int toPinLength_; + + int hasFromTo_; + int hasThru_; + int hasMacro_; + int hasReentrantPathsFlag_; + + defrData *defData; +}; + + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiUser.hpp b/src/def/def/defiUser.hpp new file mode 100644 index 00000000..218635e1 --- /dev/null +++ b/src/def/def/defiUser.hpp @@ -0,0 +1,87 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +/* + * User header file for the DEF Interface. This includes + * all of the header files which are relevant to both the + * reader and the writer. + * + * defrReader.h and defwWriter.h include this file, so that + * an application only needs to include either defwReader.h + * or defwWriter.h. + */ + +#ifndef DEFI_USER_H +#define DEFI_USER_H + +/* General utilities. */ +/* #include "defiMalloc.hpp" */ +/* #include "defiUtils.hpp" */ + +/* + * API objects + */ +#include "defiDebug.hpp" +#include "defiProp.hpp" +#include "defiSite.hpp" +#include "defiComponent.hpp" +#include "defiNet.hpp" +#include "defiPath.hpp" +#include "defiPinCap.hpp" +#include "defiRowTrack.hpp" +#include "defiVia.hpp" +#include "defiRegion.hpp" +#include "defiGroup.hpp" +#include "defiAssertion.hpp" +#include "defiScanchain.hpp" +#include "defiIOTiming.hpp" +#include "defiFPC.hpp" +#include "defiTimingDisable.hpp" +#include "defiPartition.hpp" +#include "defiPinProp.hpp" +#include "defiBlockage.hpp" +#include "defiSlot.hpp" +#include "defiFill.hpp" +#include "defiNonDefault.hpp" +#include "defiPropType.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +/* NEW CALLBACK - If you are creating a new .cpp and .hpp file to + * describe a new class of object in the parser, then add a reference + * to the .hpp here. + * + * You must also add an entry for the .h and the .hpp in the package_list + * file of the ../../../release directory. */ + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defiUtil.cpp b/src/def/def/defiUtil.cpp new file mode 100644 index 00000000..1d5ef642 --- /dev/null +++ b/src/def/def/defiUtil.cpp @@ -0,0 +1,121 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include +#ifdef WIN32 +# include +#else /* not WIN32 */ +# include +#endif +#if ibmrs +#include +#endif + + +#include "defiKRDefs.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +/* Not needed +time_t defiCalcTime() { + * Calculate the number for the given date + * The date is 5/1/99 + + * Used to calculate the UTC for a time bomb date in libcai.a + * see caiInitWork() function + * + struct tm ts; + + ts.tm_sec = 0; + ts.tm_min = 0; + ts.tm_hour = 0; + ts.tm_mday = 1; + ts.tm_mon = 5; + ts.tm_year = 1999 - 1900; + ts.tm_wday = 0; + ts.tm_yday = 0; + ts.tm_isdst = 0; + +* + printf("May 1, 1999 in UTC is %d\n", mktime(&ts)); + ts.tm_mday = 2; + printf("May 2, 1999 in UTC is %d\n", mktime(&ts)); + + printf("Right now is %d\n", time(0)); +* + return(mktime(&ts)); +} +*/ + +//////////////////////////////////////////////////// +// +// defiTimeBomb +// +//////////////////////////////////////////////////// + +// Check the current date against the date given +/* +int defiValidTime() { + time_t bombTime = defiCalcTime(); + time_t curTime; + + curTime = time((time_t *)NULL); + if (curTime == -1 || curTime > bombTime) + { + (void)printf("The demonstration version of this code is no longer\n" + "available. Please contact your Lef/Def Parser\n" + "software provider for up to date code.\n"); + return(0); + } + return (1); +} +*/ + +//////////////////////////////////////////////////// +// +// Convert the orient from integer to string +// +//////////////////////////////////////////////////// +const char* defiOrientStr(int orient) { + switch (orient) { + case 0: return ((char*)"N"); + case 1: return ((char*)"W"); + case 2: return ((char*)"S"); + case 3: return ((char*)"E"); + case 4: return ((char*)"FN"); + case 5: return ((char*)"FW"); + case 6: return ((char*)"FS"); + case 7: return ((char*)"FE"); + }; + return ((char*)""); +} + +END_LEFDEF_PARSER_NAMESPACE diff --git a/src/def/def/defiUtil.hpp b/src/def/def/defiUtil.hpp new file mode 100644 index 00000000..b99b858a --- /dev/null +++ b/src/def/def/defiUtil.hpp @@ -0,0 +1,52 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiUtil_h +#define defiUtil_h + +#include "defiKRDefs.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +/* Return codes Orient and Rotation */ +#define DEF_ORIENT_N 0 +#define DEF_ORIENT_W 1 +#define DEF_ORIENT_S 2 +#define DEF_ORIENT_E 3 +#define DEF_ORIENT_FN 4 +#define DEF_ORIENT_FW 5 +#define DEF_ORIENT_FS 6 +#define DEF_ORIENT_FE 7 + +const char* defiOrientStr(int orient); + +END_LEFDEF_PARSER_NAMESPACE + +#endif + diff --git a/src/def/def/defiVia.cpp b/src/def/def/defiVia.cpp new file mode 100644 index 00000000..1cef7695 --- /dev/null +++ b/src/def/def/defiVia.cpp @@ -0,0 +1,728 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2016, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include "lex.h" +#include "defiVia.hpp" +#include "defiDebug.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + + +////////////////////////////////////////////// +////////////////////////////////////////////// +// +// defiVia +// +////////////////////////////////////////////// +////////////////////////////////////////////// + + +defiVia::defiVia(defrData *data) + : defData(data) +{ + Init(); +} + + +DEF_COPY_CONSTRUCTOR_C( defiVia ) { + + DEF_COPY_FUNC( defData ); + Init(); + + DEF_COPY_FUNC( nameLength_ ); + DEF_MALLOC_FUNC( name_, char, sizeof(char) * (strlen(prev.name_)+1) ); + DEF_MALLOC_FUNC( pattern_, char, sizeof(char) * (strlen(prev.pattern_) +1)); + DEF_COPY_FUNC( patternLength_ ); + + DEF_COPY_FUNC( numLayers_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( layers_, numLayers_ ); + + DEF_COPY_FUNC( hasPattern_ ); + DEF_MALLOC_FUNC( xl_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( yl_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( xh_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( yh_, int, sizeof(int) * numLayers_); + DEF_COPY_FUNC( layersLength_ ); + DEF_COPY_FUNC( numPolys_ ); + + DEF_MALLOC_FUNC_FOR_2D_STR( polygonNames_, numPolys_ ); + DEF_COPY_FUNC( polysAllocated_ ); + + DEF_MALLOC_FUNC_FOR_2D_POINT( polygons_, numPolys_ ); + + DEF_MALLOC_FUNC( viaRule_, char, sizeof(char) * (strlen(prev.viaRule_) +1)); + DEF_COPY_FUNC( viaRuleLength_ ); + DEF_COPY_FUNC( hasViaRule_ ); + DEF_COPY_FUNC( xSize_ ); + DEF_COPY_FUNC( ySize_ ); + DEF_MALLOC_FUNC( botLayer_, char, sizeof(char) * (strlen(prev.botLayer_) +1)); + DEF_MALLOC_FUNC( cutLayer_, char, sizeof(char) * (strlen(prev.cutLayer_) +1)); + DEF_MALLOC_FUNC( topLayer_, char, sizeof(char) * (strlen(prev.topLayer_) +1)); + DEF_COPY_FUNC( botLayerLength_ ); + DEF_COPY_FUNC( cutLayerLength_ ); + DEF_COPY_FUNC( topLayerLength_ ); + DEF_COPY_FUNC( xCutSpacing_ ); + DEF_COPY_FUNC( yCutSpacing_ ); + DEF_COPY_FUNC( xBotEnc_ ); + DEF_COPY_FUNC( yBotEnc_ ); + DEF_COPY_FUNC( xTopEnc_ ); + DEF_COPY_FUNC( yTopEnc_ ); + DEF_COPY_FUNC( rows_ ); + DEF_COPY_FUNC( cols_ ); + DEF_COPY_FUNC( xOffset_ ); + DEF_COPY_FUNC( yOffset_ ); + DEF_COPY_FUNC( xBotOffset_ ); + DEF_COPY_FUNC( yBotOffset_ ); + DEF_COPY_FUNC( xTopOffset_ ); + DEF_COPY_FUNC( yTopOffset_ ); + DEF_MALLOC_FUNC( cutPattern_, char, sizeof(char) * (strlen(prev.cutPattern_) +1)); + DEF_COPY_FUNC( cutPatternLength_ ); + DEF_COPY_FUNC( hasCutPattern_ ); + DEF_MALLOC_FUNC( rectMask_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( polyMask_, int, sizeof(int) * numLayers_); + +} + +DEF_ASSIGN_OPERATOR_C( defiVia ) { + CHECK_SELF_ASSIGN + DEF_COPY_FUNC( defData ); + Init(); + + DEF_COPY_FUNC( nameLength_ ); + DEF_MALLOC_FUNC( name_, char, sizeof(char) * (strlen(prev.name_)+1) ); + DEF_MALLOC_FUNC( pattern_, char, sizeof(char) * (strlen(prev.pattern_) +1)); + DEF_COPY_FUNC( patternLength_ ); + + DEF_COPY_FUNC( numLayers_ ); + DEF_MALLOC_FUNC_FOR_2D_STR( layers_, numLayers_ ); + + DEF_COPY_FUNC( hasPattern_ ); + DEF_MALLOC_FUNC( xl_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( yl_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( xh_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( yh_, int, sizeof(int) * numLayers_); + DEF_COPY_FUNC( layersLength_ ); + DEF_COPY_FUNC( numPolys_ ); + + DEF_MALLOC_FUNC_FOR_2D_STR( polygonNames_, numPolys_ ); + DEF_COPY_FUNC( polysAllocated_ ); + + DEF_MALLOC_FUNC_FOR_2D_POINT( polygons_, numPolys_ ); + + DEF_MALLOC_FUNC( viaRule_, char, sizeof(char) * (strlen(prev.viaRule_) +1)); + DEF_COPY_FUNC( viaRuleLength_ ); + DEF_COPY_FUNC( hasViaRule_ ); + DEF_COPY_FUNC( xSize_ ); + DEF_COPY_FUNC( ySize_ ); + DEF_MALLOC_FUNC( botLayer_, char, sizeof(char) * (strlen(prev.botLayer_) +1)); + DEF_MALLOC_FUNC( cutLayer_, char, sizeof(char) * (strlen(prev.cutLayer_) +1)); + DEF_MALLOC_FUNC( topLayer_, char, sizeof(char) * (strlen(prev.topLayer_) +1)); + DEF_COPY_FUNC( botLayerLength_ ); + DEF_COPY_FUNC( cutLayerLength_ ); + DEF_COPY_FUNC( topLayerLength_ ); + DEF_COPY_FUNC( xCutSpacing_ ); + DEF_COPY_FUNC( yCutSpacing_ ); + DEF_COPY_FUNC( xBotEnc_ ); + DEF_COPY_FUNC( yBotEnc_ ); + DEF_COPY_FUNC( xTopEnc_ ); + DEF_COPY_FUNC( yTopEnc_ ); + DEF_COPY_FUNC( rows_ ); + DEF_COPY_FUNC( cols_ ); + DEF_COPY_FUNC( xOffset_ ); + DEF_COPY_FUNC( yOffset_ ); + DEF_COPY_FUNC( xBotOffset_ ); + DEF_COPY_FUNC( yBotOffset_ ); + DEF_COPY_FUNC( xTopOffset_ ); + DEF_COPY_FUNC( yTopOffset_ ); + DEF_MALLOC_FUNC( cutPattern_, char, sizeof(char) * (strlen(prev.cutPattern_) +1)); + DEF_COPY_FUNC( cutPatternLength_ ); + DEF_COPY_FUNC( hasCutPattern_ ); + DEF_MALLOC_FUNC( rectMask_, int, sizeof(int) * numLayers_); + DEF_MALLOC_FUNC( polyMask_, int, sizeof(int) * numLayers_); + return *this; +} + + + +void defiVia::Init() { + name_ = 0; + nameLength_ = 0; + pattern_ = 0; + patternLength_ = 0; + xl_ = 0; + yl_ = 0; + xh_ = 0; + yh_ = 0; + layersLength_ = 0; + layers_ = 0; + viaRule_ = 0; + viaRuleLength_ = 0; + xSize_ = 0; + ySize_ = 0; + botLayer_ = 0; + cutLayer_ = 0; + topLayer_ = 0; + botLayerLength_ = 0; + cutLayerLength_ = 0; + topLayerLength_ = 0; + xCutSpacing_ = 0; + yCutSpacing_ = 0; + xBotEnc_ = 0; + yBotEnc_ = 0; + xTopEnc_ = 0; + yTopEnc_ = 0; + cutPattern_ = 0; + cutPatternLength_ = 0; + numLayers_ = 0; + numPolys_ = 0; + polygons_ = 0; + polysAllocated_ = 0; + polygonNames_ = 0; + rectMask_ = 0; + polyMask_ = 0; + clear(); +} + +void defiVia::clear() { + int i; + + hasPattern_ = 0; + hasViaRule_ = 0; + rows_ = 0; + cols_ = 0; + xOffset_ = 0; + yOffset_ = 0; + xBotOffset_ = 0; + yBotOffset_ = 0; + xTopOffset_ = 0; + yTopOffset_ = 0; + hasCutPattern_ = 0; + + if (polygonNames_) { + struct defiPoints* p; + for (i = 0; i < numPolys_; i++) { + free(polygonNames_[i]); + + p = polygons_[i]; + free(p->x); + free(p->y); + free(p); + } + + free(polygonNames_); + free(polygons_); + free(polyMask_); + + polygonNames_ = NULL; + polygons_ = NULL; + polyMask_ = NULL; + } + + numPolys_ = 0; + polysAllocated_ = 0; +} + +defiVia::~defiVia() { + Destroy(); +} + + +void defiVia::Destroy() { + int i; + + free(name_); + name_ = NULL; + + free(pattern_); + pattern_ = NULL; + + if (layers_) { + for (i = 0; i < numLayers_; i++) { + free(layers_[i]); + } + + free(layers_); + layers_ = NULL; + + free(xl_); + xl_ = NULL; + + free(yl_); + yl_ = NULL; + + free(xh_); + xh_ = NULL; + + free(yh_); + yh_ = NULL; + + free(rectMask_); + rectMask_ = NULL; + + free(polyMask_); + polyMask_ = NULL; + } + + free(viaRule_); + viaRule_ = NULL; + + free(botLayer_); + botLayer_ = NULL; + + free(cutLayer_); + cutLayer_ = NULL; + + free(topLayer_); + topLayer_ = NULL; + + free(cutPattern_); + cutPattern_ = NULL; + + clear(); +} + + +void defiVia::setup(const char* name) { + int i; + int len = strlen(name) + 1; + if (len > nameLength_) { + nameLength_ = len; + name_ = (char*)realloc(name_, len); + } + strcpy(name_, defData->DEFCASE(name)); + if (pattern_) *(pattern_) = 0; + if (layers_) { + for (i = 0; i < numLayers_; i++) { + free(layers_[i]); + layers_[i] = 0; + } + } + + numLayers_ = 0; +} + + +void defiVia::addPattern(const char* pattern) { + int len = strlen(pattern) + 1; + if (len > patternLength_) { + patternLength_ = len; + pattern_ = (char*)realloc(pattern_, len); + } + strcpy(pattern_, defData->DEFCASE(pattern)); + hasPattern_ = 1; +} + + +void defiVia::addLayer(const char* layer, int xl, int yl, int xh, int yh, int colorMask) { + char* l; + int len; + + if (numLayers_ >= layersLength_) { + int i; + char** newl; + int* ints; + layersLength_ = layersLength_ ? 2 * layersLength_ : 8; + + newl = (char**)malloc(layersLength_ * sizeof(char*)); + for (i = 0; i < numLayers_; i++) + newl[i] = layers_[i]; + if (layers_) free((char*)(layers_)); + layers_ = newl; + + ints = (int*)malloc(layersLength_ * sizeof(int)); + for (i = 0; i < numLayers_; i++) + ints[i] = xl_[i]; + if (xl_) free((char*)(xl_)); + xl_ = ints; + + ints = (int*)malloc(layersLength_ * sizeof(int)); + for (i = 0; i < numLayers_; i++) + ints[i] = yl_[i]; + if (yl_) free((char*)(yl_)); + yl_ = ints; + + ints = (int*)malloc(layersLength_ * sizeof(int)); + for (i = 0; i < numLayers_; i++) + ints[i] = xh_[i]; + if (xh_) free((char*)(xh_)); + xh_ = ints; + + ints = (int*)malloc(layersLength_ * sizeof(int)); + for (i = 0; i < numLayers_; i++) + ints[i] = yh_[i]; + if (yh_) free((char*)(yh_)); + yh_ = ints; + + ints = (int*)malloc(layersLength_ * sizeof(int)); + for (i = 0; i < numLayers_; i++) + ints[i] = rectMask_[i]; + if (rectMask_) free((char*)(rectMask_)); + rectMask_ = ints; + } + + len = strlen(layer) + 1; + l = (char*)malloc(len); + strcpy(l, defData->DEFCASE(layer)); + layers_[numLayers_] = l; + xl_[numLayers_] = xl; + yl_[numLayers_] = yl; + xh_[numLayers_] = xh; + yh_[numLayers_] = yh; + rectMask_[numLayers_] = colorMask; + numLayers_++; +} + +// 5.6 +void defiVia::addPolygon(const char* layer, defiGeometries* geom, int colorMask) { + struct defiPoints* p; + int x, y; + int i; + + if (numPolys_ == polysAllocated_) { + char** newn; + int* masks; + struct defiPoints** poly; + polysAllocated_ = (polysAllocated_ == 0) ? + 2 : polysAllocated_ * 2; + newn = (char**)malloc(sizeof(char*) * polysAllocated_); + poly = (struct defiPoints**)malloc(sizeof(struct defiPoints*) * + polysAllocated_); + masks = (int*)malloc(polysAllocated_ * sizeof(int)); + for (i = 0; i < numPolys_; i++) { + newn[i] = polygonNames_[i]; + poly[i] = polygons_[i]; + masks[i] = polyMask_[i]; + } + if (polygons_) + free((char*)(polygons_)); + if (polygonNames_) + free((char*)(polygonNames_)); + if (polyMask_) + free((char*)(polyMask_)); + polygonNames_ = newn; + polygons_ = poly; + polyMask_ = masks; + } + polygonNames_[numPolys_] = strdup(layer); + p = (struct defiPoints*)malloc(sizeof(struct defiPoints)); + p->numPoints = geom->numPoints(); + p->x = (int*)malloc(sizeof(int)*p->numPoints); + p->y = (int*)malloc(sizeof(int)*p->numPoints); + for (i = 0; i < p->numPoints; i++) { + geom->points(i, &x, &y); + p->x[i] = x; + p->y[i] = y; + } + polygons_[numPolys_] = p; + polyMask_[numPolys_] = colorMask; + numPolys_ += 1; +} + +void defiVia::addViaRule(char* viaRuleName, int xSize, int ySize, + char* botLayer, char* cutLayer, char* topLayer, + int xSpacing, int ySpacing, int xBotEnc, int yBotEnc, + int xTopEnc, int yTopEnc) { + int len; + + len = strlen(viaRuleName) + 1; + if (len > viaRuleLength_) { + if (viaRule_) + free(viaRule_); + viaRule_ = (char*)malloc(strlen(viaRuleName)+1); + } + strcpy(viaRule_, defData->DEFCASE(viaRuleName)); + xSize_ = xSize; + ySize_ = ySize; + len = strlen(botLayer) + 1; + if (len > botLayerLength_) { + if (botLayer_) + free(botLayer_); + botLayer_ = (char*)malloc(strlen(botLayer)+1); + botLayerLength_ = len; + } + strcpy(botLayer_, defData->DEFCASE(botLayer)); + len = strlen(cutLayer) + 1; + if (len > cutLayerLength_) { + if (cutLayer_) + free(cutLayer_); + cutLayer_ = (char*)malloc(strlen(cutLayer)+1); + cutLayerLength_ = len; + } + strcpy(cutLayer_, defData->DEFCASE(cutLayer)); + len = strlen(topLayer) + 1; + if (len > topLayerLength_) { + if (topLayer_) + free(topLayer_); + topLayer_ = (char*)malloc(strlen(topLayer)+1); + topLayerLength_ = len; + } + strcpy(topLayer_, defData->DEFCASE(topLayer)); + xCutSpacing_ = xSpacing; + yCutSpacing_ = ySpacing; + xBotEnc_ = xBotEnc; + yBotEnc_ = yBotEnc; + xTopEnc_ = xTopEnc; + yTopEnc_ = yTopEnc; + hasViaRule_ = 1; +} + +void defiVia::addRowCol(int numCutRows, int numCutCols) { + rows_ = numCutRows; + cols_ = numCutCols; +} + +void defiVia::addOrigin(int xOffset, int yOffset) { + xOffset_ = xOffset; + yOffset_ = yOffset; +} + +void defiVia::addOffset(int xBotOs, int yBotOs, int xTopOs, int yTopOs) { + xBotOffset_ = xBotOs; + yBotOffset_ = yBotOs; + xTopOffset_ = xTopOs; + yTopOffset_ = yTopOs; +} + +void defiVia::addCutPattern(char* cutPattern) { + int len; + + len = strlen(cutPattern) + 1; + if (len > cutPatternLength_) { + if (cutPattern_) + free(cutPattern_); + cutPattern_ = (char*)malloc(strlen(cutPattern)+1); + cutPatternLength_ = len; + } + strcpy(cutPattern_, defData->DEFCASE(cutPattern)); + hasCutPattern_ = 1; +} + +int defiVia::hasPattern() const { + return hasPattern_; +} + + +const char* defiVia::pattern() const { + return pattern_; +} + + +const char* defiVia::name() const { + return name_; +} + + +int defiVia::numLayers() const { + return numLayers_; +} + +int defiVia::rectMask(int index) const { + if (index >= 0 && index < numLayers_) { + return rectMask_[index]; + } + + return 0; +} + +int defiVia::polyMask(int index) const { + if (index >= 0 && index < numPolys_) { + return polyMask_[index]; + } + + return 0; +} + +void defiVia::layer(int index, char** layer, int* xl, int* yl, + int* xh, int* yh) const { + if (index >= 0 && index < numLayers_) { + if (layer) *layer = layers_[index]; + if (xl) *xl = xl_[index]; + if (yl) *yl = yl_[index]; + if (xh) *xh = xh_[index]; + if (yh) *yh = yh_[index]; + } +} + +// The following code is for 5.6 + +int defiVia::numPolygons() const { + return numPolys_; +} + +const char* defiVia::polygonName(int index) const { + char msg[160]; + if (index < 0 || index > numPolys_) { + sprintf (msg, "ERROR (DEFPARS-6180): The index number %d specified for the VIA POLYGON is invalid.\nValid index is from 0 to %d. Specify a valid index number and then try again", + index, numPolys_); + defiError(0, 6180, msg, defData); + return 0; + } + return polygonNames_[index]; +} + +struct defiPoints defiVia::getPolygon(int index) const { + return *(polygons_[index]); +} + +int defiVia::hasViaRule() const { + return hasViaRule_; +} + +void defiVia::viaRule(char** viaRuleName, int* xSize, int* ySize, + char** botLayer, char** cutLayer, char** topLayer, + int* xCutSpacing, int* yCutSpacing, int* xBotEnc, + int* yBotEnc, int* xTopEnc, int* yTopEnc) const { + *viaRuleName = viaRule_; + *xSize = xSize_; + *ySize = ySize_; + *botLayer = botLayer_; + *cutLayer = cutLayer_; + *topLayer = topLayer_; + *xCutSpacing = xCutSpacing_; + *yCutSpacing = yCutSpacing_; + *xBotEnc = xBotEnc_; + *yBotEnc = yBotEnc_; + *xTopEnc = xTopEnc_; + *yTopEnc = yTopEnc_; +} + +int defiVia::hasRowCol() const { + if (rows_) + return rows_; + else + return cols_; +} + +void defiVia::rowCol(int* numCutRows, int* numCutCols) const { + *numCutRows = rows_; + *numCutCols = cols_; +} + +int defiVia::hasOrigin() const { + if (xOffset_) + return xOffset_; + else + return yOffset_; +} + +void defiVia::origin(int* xOffset, int* yOffset) const { + *xOffset = xOffset_; + *yOffset = yOffset_; +} + +int defiVia::hasOffset() const { + if (xBotOffset_) + return xBotOffset_; + else if (yBotOffset_) + return yBotOffset_; + else if (xTopOffset_) + return xTopOffset_; + else + return yTopOffset_; +} + +void defiVia::offset(int* xBotOffset, int* yBotOffset, int* xTopOffset, + int* yTopOffset) const { + *xBotOffset = xBotOffset_; + *yBotOffset = yBotOffset_; + *xTopOffset = xTopOffset_; + *yTopOffset = yTopOffset_; +} + +int defiVia::hasCutPattern() const { + return hasCutPattern_; +} + +int defiVia::hasRectMask(int index) const { + if (index > 0 || index < numLayers_) { + return rectMask_[index]; + } + + return 0; +} + +int defiVia::hasPolyMask(int index) const { + if (index > 0 || index < numPolys_) { + return polyMask_[index]; + } + + return 0; +} + +const char* defiVia::cutPattern() const { + return cutPattern_; +} + +void defiVia::print(FILE* f) const { + int i; + int xl, yl, xh, yh; + char* c; + char* vrn; + char *bl, *cl, *tl; + int xs, ys, xcs, ycs, xbe, ybe, xte, yte; + int cr, cc, xo, yo, xbo, ybo, xto, yto; + + fprintf(f, "via '%s'\n", name()); + + if (hasPattern()) + fprintf(f, " pattern '%s'\n", pattern()); + + for (i = 0; i < numLayers(); i++) { + layer(i, &c, &xl, &yl, &xh, &yh); + fprintf(f, " layer '%s' %d,%d %d,%d\n", c, xl, yl, xh, yh); + } + + if (hasViaRule()) { + viaRule(&vrn, &xs, &ys, &bl, &cl, &tl, &xcs, &ycs, + &xbe, &ybe, &xte, &yte); + fprintf(f, " viarule '%s'\n", vrn); + fprintf(f, " cutsize %d %d\n", xs, ys); + fprintf(f, " layers %s %s %s\n", bl, cl, tl); + fprintf(f, " cutspacing %d %d\n", xcs, ycs); + fprintf(f, " enclosure %d %d %d %d\n", xbe, ybe, xte, yte); + if (hasRowCol()) { + rowCol(&cr, &cc); + fprintf(f, " rowcol %d %d\n", cr, cc); + } + if (hasOrigin()) { + origin(&xo, &yo); + fprintf(f, " origin %d %d\n", xo, yo); + } + if (hasOffset()) { + offset(&xbo, &ybo, &xto, &yto); + fprintf(f, " offset %d %d %d %d\n", xbo, ybo, xto, yto); + } + if (hasCutPattern()) + fprintf(f, " pattern '%s'\n", cutPattern()); + } +} +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defiVia.hpp b/src/def/def/defiVia.hpp new file mode 100644 index 00000000..b8a8acee --- /dev/null +++ b/src/def/def/defiVia.hpp @@ -0,0 +1,153 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defiVia_h +#define defiVia_h + +#include "defiKRDefs.hpp" +#include +#include "defiMisc.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +class defrData; + +// Struct holds the data for one property. +class defiVia { +public: + defiVia(defrData *data); + + DEF_COPY_CONSTRUCTOR_H( defiVia ); + DEF_ASSIGN_OPERATOR_H( defiVia ); + + void Init(); + + void clear(); + void Destroy(); + ~defiVia(); + + void setup(const char* name); + void addPattern(const char* patt); + void addLayer(const char* layer, int xl, int yl, int xh, int yh, int colorMask = 0); + // 5.6 + void addPolygon(const char* layer, defiGeometries* geom, int colorMask = 0); + void addViaRule(char* viaRuleName, int xSize, int ySize, char* botLayer, + char* cutLayer, char* topLayer, int xSpacing, int ySpacing, + int xBotEnc, int yBotEnc, int xTopEnc, int yTopEnc); + void addRowCol(int numCutRows, int numCutCols); + void addOrigin(int xOffset, int yOffset); + void addOffset(int xBotOs, int yBotOs, int xTopOs, int yTopOs); + void addCutPattern(char* cutPattern); + + const char* name() const; + const char* pattern() const; + int hasPattern() const; + int numLayers() const; + void layer(int index, char** layer, int* xl, int* yl, int* xh, int* yh) const; + int numPolygons() const; // 5.6 + const char* polygonName(int index) const; // 5.6 + defiPoints getPolygon(int index) const; // 5.6 + int hasViaRule() const; + void viaRule(char** viaRuleName, int* xSize, int* ySize, char** botLayer, + char** cutLayer, char** topLayer, int* xCutSpacing, + int* yCutSpacing, int* xBotEnc, int* yBotEnc, int* xTopEnc, + int* yTopEnc) const; + int hasRowCol() const; + void rowCol(int* numCutRows, int* numCutCols) const; + int hasOrigin() const; + void origin(int* xOffset, int* yOffset) const; + int hasOffset() const; + void offset(int* xBotOffset, int* yBotOffset, int* xTopOffset, + int* yTopOffset) const; + int hasCutPattern() const; + const char* cutPattern() const; + int hasRectMask(int index) const; + int rectMask(int index) const; + int hasPolyMask(int index) const; + int polyMask(int index) const; + + void print(FILE* f) const; + +protected: + char* name_; + int nameLength_; + char* pattern_; + int patternLength_; + char** layers_; + int hasPattern_; + int* xl_; + int* yl_; + int* xh_; + int* yh_; + int layersLength_; + int numLayers_; + int numPolys_; // 5.6 + char** polygonNames_; // 5.6 layerName for POLYGON + int polysAllocated_; // 5.6 + defiPoints** polygons_; // 5.6 + char* viaRule_; // 5.6 + int viaRuleLength_; // 5.6 + int hasViaRule_; // 5.6 + int xSize_; // 5.6 + int ySize_; // 5.6 + char* botLayer_; // 5.6 + char* cutLayer_; // 5.6 + char* topLayer_; // 5.6 + int botLayerLength_; // 5.6 + int cutLayerLength_; // 5.6 + int topLayerLength_; // 5.6 + int xCutSpacing_; // 5.6 + int yCutSpacing_; // 5.6 + int xBotEnc_; // 5.6 + int yBotEnc_; // 5.6 + int xTopEnc_; // 5.6 + int yTopEnc_; // 5.6 + int rows_; // 5.6 + int cols_; // 5.6 + int xOffset_; // 5.6 + int yOffset_; // 5.6 + int xBotOffset_; // 5.6 + int yBotOffset_; // 5.6 + int xTopOffset_; // 5.6 + int yTopOffset_; // 5.6 + char* cutPattern_; // 5.6 + int cutPatternLength_; // 5.6 + int hasCutPattern_; // 5.6 + int* rectMask_; // 5.8 + int* polyMask_; // 5.8 + + defrData *defData; +}; + + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defrCallBacks.hpp b/src/def/def/defrCallBacks.hpp new file mode 100644 index 00000000..355aa996 --- /dev/null +++ b/src/def/def/defrCallBacks.hpp @@ -0,0 +1,159 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef DEFRCALLBACKS_H +#define DEFRCALLBACKS_H 1 + +#include "defiKRDefs.hpp" + +#include "defrReader.hpp" + +#include "defrReader.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +class defrCallbacks { +public: + defrCallbacks(); + + void SetUnusedCallbacks(defrVoidCbkFnType f); + + defrStringCbkFnType DesignCbk; + defrStringCbkFnType TechnologyCbk; + defrVoidCbkFnType DesignEndCbk; + defrPropCbkFnType PropCbk; + defrVoidCbkFnType PropDefEndCbk; + defrVoidCbkFnType PropDefStartCbk; + defrStringCbkFnType ArrayNameCbk; + defrStringCbkFnType FloorPlanNameCbk; + defrDoubleCbkFnType UnitsCbk; + defrStringCbkFnType DividerCbk; + defrStringCbkFnType BusBitCbk; + defrSiteCbkFnType SiteCbk; + defrSiteCbkFnType CanplaceCbk; + defrSiteCbkFnType CannotOccupyCbk; + defrIntegerCbkFnType ComponentStartCbk; + defrVoidCbkFnType ComponentEndCbk; + defrComponentCbkFnType ComponentCbk; + defrComponentMaskShiftLayerCbkFnType ComponentMaskShiftLayerCbk; + defrIntegerCbkFnType NetStartCbk; + defrVoidCbkFnType NetEndCbk; + defrNetCbkFnType NetCbk; + defrStringCbkFnType NetNameCbk; + defrStringCbkFnType NetSubnetNameCbk; + defrStringCbkFnType NetNonDefaultRuleCbk; + defrNetCbkFnType NetPartialPathCbk; + defrPathCbkFnType PathCbk; + defrDoubleCbkFnType VersionCbk; + defrStringCbkFnType VersionStrCbk; + defrStringCbkFnType PinExtCbk; + defrStringCbkFnType ComponentExtCbk; + defrStringCbkFnType ViaExtCbk; + defrStringCbkFnType NetConnectionExtCbk; + defrStringCbkFnType NetExtCbk; + defrStringCbkFnType GroupExtCbk; + defrStringCbkFnType ScanChainExtCbk; + defrStringCbkFnType IoTimingsExtCbk; + defrStringCbkFnType PartitionsExtCbk; + defrStringCbkFnType HistoryCbk; + defrBoxCbkFnType DieAreaCbk; + defrPinCapCbkFnType PinCapCbk; + defrPinCbkFnType PinCbk; + defrIntegerCbkFnType StartPinsCbk; + defrVoidCbkFnType PinEndCbk; + defrIntegerCbkFnType DefaultCapCbk; + defrRowCbkFnType RowCbk; + defrTrackCbkFnType TrackCbk; + defrGcellGridCbkFnType GcellGridCbk; + defrIntegerCbkFnType ViaStartCbk; + defrVoidCbkFnType ViaEndCbk; + defrViaCbkFnType ViaCbk; + defrIntegerCbkFnType RegionStartCbk; + defrVoidCbkFnType RegionEndCbk; + defrRegionCbkFnType RegionCbk; + defrIntegerCbkFnType SNetStartCbk; + defrVoidCbkFnType SNetEndCbk; + defrNetCbkFnType SNetCbk; + defrNetCbkFnType SNetPartialPathCbk; + defrNetCbkFnType SNetWireCbk; + defrIntegerCbkFnType GroupsStartCbk; + defrVoidCbkFnType GroupsEndCbk; + defrStringCbkFnType GroupNameCbk; + defrStringCbkFnType GroupMemberCbk; + defrGroupCbkFnType GroupCbk; + defrIntegerCbkFnType AssertionsStartCbk; + defrVoidCbkFnType AssertionsEndCbk; + defrAssertionCbkFnType AssertionCbk; + defrIntegerCbkFnType ConstraintsStartCbk; + defrVoidCbkFnType ConstraintsEndCbk; + defrAssertionCbkFnType ConstraintCbk; + defrIntegerCbkFnType ScanchainsStartCbk; + defrVoidCbkFnType ScanchainsEndCbk; + defrScanchainCbkFnType ScanchainCbk; + defrIntegerCbkFnType IOTimingsStartCbk; + defrVoidCbkFnType IOTimingsEndCbk; + defrIOTimingCbkFnType IOTimingCbk; + defrIntegerCbkFnType FPCStartCbk; + defrVoidCbkFnType FPCEndCbk; + defrFPCCbkFnType FPCCbk; + defrIntegerCbkFnType TimingDisablesStartCbk; + defrVoidCbkFnType TimingDisablesEndCbk; + defrTimingDisableCbkFnType TimingDisableCbk; + defrIntegerCbkFnType PartitionsStartCbk; + defrVoidCbkFnType PartitionsEndCbk; + defrPartitionCbkFnType PartitionCbk; + defrIntegerCbkFnType PinPropStartCbk; + defrVoidCbkFnType PinPropEndCbk; + defrPinPropCbkFnType PinPropCbk; + defrIntegerCbkFnType CaseSensitiveCbk; + defrIntegerCbkFnType BlockageStartCbk; + defrVoidCbkFnType BlockageEndCbk; + defrBlockageCbkFnType BlockageCbk; + defrIntegerCbkFnType SlotStartCbk; + defrVoidCbkFnType SlotEndCbk; + defrSlotCbkFnType SlotCbk; + defrIntegerCbkFnType FillStartCbk; + defrVoidCbkFnType FillEndCbk; + defrFillCbkFnType FillCbk; + defrIntegerCbkFnType NonDefaultStartCbk; + defrVoidCbkFnType NonDefaultEndCbk; + defrNonDefaultCbkFnType NonDefaultCbk; + defrIntegerCbkFnType StylesStartCbk; + defrVoidCbkFnType StylesEndCbk; + defrStylesCbkFnType StylesCbk; + defrStringCbkFnType ExtensionCbk; + + +}; + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defrCallbacks.cpp b/src/def/def/defrCallbacks.cpp new file mode 100644 index 00000000..090c0874 --- /dev/null +++ b/src/def/def/defrCallbacks.cpp @@ -0,0 +1,351 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: arakhman $ +// $Revision: #5 $ +// $Date: 2013/03/13 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include "defrCallBacks.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +defrCallbacks::defrCallbacks() +: DesignCbk(NULL), + TechnologyCbk(NULL), + DesignEndCbk(NULL), + PropCbk(NULL), + PropDefEndCbk(NULL), + PropDefStartCbk(NULL), + ArrayNameCbk(NULL), + FloorPlanNameCbk(NULL), + UnitsCbk(NULL), + DividerCbk(NULL), + BusBitCbk(NULL), + SiteCbk(NULL), + CanplaceCbk(NULL), + CannotOccupyCbk(NULL), + ComponentStartCbk(NULL), + ComponentEndCbk(NULL), + ComponentCbk(NULL), + ComponentMaskShiftLayerCbk(NULL), + NetStartCbk(NULL), + NetEndCbk(NULL), + NetCbk(NULL), + NetNameCbk(NULL), + NetSubnetNameCbk(NULL), + NetNonDefaultRuleCbk(NULL), + NetPartialPathCbk(NULL), + PathCbk(NULL), + VersionCbk(NULL), + VersionStrCbk(NULL), + PinExtCbk(NULL), + ComponentExtCbk(NULL), + ViaExtCbk(NULL), + NetConnectionExtCbk(NULL), + NetExtCbk(NULL), + GroupExtCbk(NULL), + ScanChainExtCbk(NULL), + IoTimingsExtCbk(NULL), + PartitionsExtCbk(NULL), + HistoryCbk(NULL), + DieAreaCbk(NULL), + PinCapCbk(NULL), + PinCbk(NULL), + StartPinsCbk(NULL), + PinEndCbk(NULL), + DefaultCapCbk(NULL), + RowCbk(NULL), + TrackCbk(NULL), + GcellGridCbk(NULL), + ViaStartCbk(NULL), + ViaEndCbk(NULL), + ViaCbk(NULL), + RegionStartCbk(NULL), + RegionEndCbk(NULL), + RegionCbk(NULL), + SNetStartCbk(NULL), + SNetEndCbk(NULL), + SNetCbk(NULL), + SNetPartialPathCbk(NULL), + SNetWireCbk(NULL), + GroupsStartCbk(NULL), + GroupsEndCbk(NULL), + GroupNameCbk(NULL), + GroupMemberCbk(NULL), + GroupCbk(NULL), + AssertionsStartCbk(NULL), + AssertionsEndCbk(NULL), + AssertionCbk(NULL), + ConstraintsStartCbk(NULL), + ConstraintsEndCbk(NULL), + ConstraintCbk(NULL), + ScanchainsStartCbk(NULL), + ScanchainsEndCbk(NULL), + ScanchainCbk(NULL), + IOTimingsStartCbk(NULL), + IOTimingsEndCbk(NULL), + IOTimingCbk(NULL), + FPCStartCbk(NULL), + FPCEndCbk(NULL), + FPCCbk(NULL), + TimingDisablesStartCbk(NULL), + TimingDisablesEndCbk(NULL), + TimingDisableCbk(NULL), + PartitionsStartCbk(NULL), + PartitionsEndCbk(NULL), + PartitionCbk(NULL), + PinPropStartCbk(NULL), + PinPropEndCbk(NULL), + PinPropCbk(NULL), + CaseSensitiveCbk(NULL), + BlockageStartCbk(NULL), + BlockageEndCbk(NULL), + BlockageCbk(NULL), + SlotStartCbk(NULL), + SlotEndCbk(NULL), + SlotCbk(NULL), + FillStartCbk(NULL), + FillEndCbk(NULL), + FillCbk(NULL), + NonDefaultStartCbk(NULL), + NonDefaultEndCbk(NULL), + NonDefaultCbk(NULL), + StylesStartCbk(NULL), + StylesEndCbk(NULL), + StylesCbk(NULL), + ExtensionCbk(NULL) +{ +} + + +void +defrCallbacks::SetUnusedCallbacks(defrVoidCbkFnType f) +{ + if (!DesignCbk) + DesignCbk = (defrStringCbkFnType) f; + if (!TechnologyCbk) + TechnologyCbk = (defrStringCbkFnType) f; + if (!DesignEndCbk) + DesignEndCbk = (defrVoidCbkFnType) f; + if (!PropCbk) + PropCbk = (defrPropCbkFnType) f; + if (!PropDefEndCbk) + PropDefEndCbk = (defrVoidCbkFnType) f; + if (!PropDefStartCbk) + PropDefStartCbk = (defrVoidCbkFnType) f; + if (!ArrayNameCbk) + ArrayNameCbk = (defrStringCbkFnType) f; + if (!FloorPlanNameCbk) + FloorPlanNameCbk = (defrStringCbkFnType) f; + if (!UnitsCbk) + UnitsCbk = (defrDoubleCbkFnType) f; + if (!DividerCbk) + DividerCbk = (defrStringCbkFnType) f; + if (!BusBitCbk) + BusBitCbk = (defrStringCbkFnType) f; + if (!SiteCbk) + SiteCbk = (defrSiteCbkFnType) f; + if (!CanplaceCbk) + CanplaceCbk = (defrSiteCbkFnType) f; + if (!CannotOccupyCbk) + CannotOccupyCbk = (defrSiteCbkFnType) f; + if (!ComponentStartCbk) + ComponentStartCbk = (defrIntegerCbkFnType) f; + if (!ComponentEndCbk) + ComponentEndCbk = (defrVoidCbkFnType) f; + if (!ComponentCbk) + ComponentCbk = (defrComponentCbkFnType) f; + if (!NetStartCbk) + NetStartCbk = (defrIntegerCbkFnType) f; + if (!NetEndCbk) + NetEndCbk = (defrVoidCbkFnType) f; + if (!NetCbk) + NetCbk = (defrNetCbkFnType) f; + // if (! defrNetPartialPathCbk) defrNetPartialPathCbk = (defrNetCbkFnType)f; + if (!PathCbk) + PathCbk = (defrPathCbkFnType) f; + if ((!VersionCbk) && (!VersionStrCbk)) { + // both version callbacks weren't set, if either one is set, it is ok + VersionCbk = (defrDoubleCbkFnType) f; + VersionStrCbk = (defrStringCbkFnType) f; + } + if (!PinExtCbk) + PinExtCbk = (defrStringCbkFnType) f; + if (!ComponentExtCbk) + ComponentExtCbk = (defrStringCbkFnType) f; + if (!ViaExtCbk) + ViaExtCbk = (defrStringCbkFnType) f; + if (!NetConnectionExtCbk) + NetConnectionExtCbk = (defrStringCbkFnType) f; + if (!NetExtCbk) + NetExtCbk = (defrStringCbkFnType) f; + if (!GroupExtCbk) + GroupExtCbk = (defrStringCbkFnType) f; + if (!ScanChainExtCbk) + ScanChainExtCbk = (defrStringCbkFnType) f; + if (!IoTimingsExtCbk) + IoTimingsExtCbk = (defrStringCbkFnType) f; + if (!PartitionsExtCbk) + PartitionsExtCbk = (defrStringCbkFnType) f; + if (!HistoryCbk) + HistoryCbk = (defrStringCbkFnType) f; + if (!DieAreaCbk) + DieAreaCbk = (defrBoxCbkFnType) f; + if (!PinCapCbk) + PinCapCbk = (defrPinCapCbkFnType) f; + if (!PinCbk) + PinCbk = (defrPinCbkFnType) f; + if (!StartPinsCbk) + StartPinsCbk = (defrIntegerCbkFnType) f; + if (!PinEndCbk) + PinEndCbk = (defrVoidCbkFnType) f; + if (!DefaultCapCbk) + DefaultCapCbk = (defrIntegerCbkFnType) f; + if (!RowCbk) + RowCbk = (defrRowCbkFnType) f; + if (!TrackCbk) + TrackCbk = (defrTrackCbkFnType) f; + if (!GcellGridCbk) + GcellGridCbk = (defrGcellGridCbkFnType) f; + if (!ViaStartCbk) + ViaStartCbk = (defrIntegerCbkFnType) f; + if (!ViaEndCbk) + ViaEndCbk = (defrVoidCbkFnType) f; + if (!ViaCbk) + ViaCbk = (defrViaCbkFnType) f; + if (!RegionStartCbk) + RegionStartCbk = (defrIntegerCbkFnType) f; + if (!RegionEndCbk) + RegionEndCbk = (defrVoidCbkFnType) f; + if (!RegionCbk) + RegionCbk = (defrRegionCbkFnType) f; + if (!SNetStartCbk) + SNetStartCbk = (defrIntegerCbkFnType) f; + if (!SNetEndCbk) + SNetEndCbk = (defrVoidCbkFnType) f; + if (!SNetCbk) + SNetCbk = (defrNetCbkFnType) f; + // if(! defrSNetPartialPathCbk) defrSNetPartialPathCbk = (defrNetCbkFnType)f; + // if(! defrSNetWireCbk) defrSNetWireCbk = (defrNetCbkFnType)f; + if (!GroupsStartCbk) + GroupsStartCbk = (defrIntegerCbkFnType) f; + if (!GroupsEndCbk) + GroupsEndCbk = (defrVoidCbkFnType) f; + if (!GroupNameCbk) + GroupNameCbk = (defrStringCbkFnType) f; + if (!GroupMemberCbk) + GroupMemberCbk = (defrStringCbkFnType) f; + if (!ComponentMaskShiftLayerCbk) + ComponentMaskShiftLayerCbk = (defrComponentMaskShiftLayerCbkFnType) f; + if (!GroupCbk) + GroupCbk = (defrGroupCbkFnType) f; + if (!AssertionsStartCbk) + AssertionsStartCbk = (defrIntegerCbkFnType) f; + if (!AssertionsEndCbk) + AssertionsEndCbk = (defrVoidCbkFnType) f; + if (!AssertionCbk) + AssertionCbk = (defrAssertionCbkFnType) f; + if (!ConstraintsStartCbk) + ConstraintsStartCbk = (defrIntegerCbkFnType) f; + if (!ConstraintsEndCbk) + ConstraintsEndCbk = (defrVoidCbkFnType) f; + if (!ConstraintCbk) + ConstraintCbk = (defrAssertionCbkFnType) f; + if (!ScanchainsStartCbk) + ScanchainsStartCbk = (defrIntegerCbkFnType) f; + if (!ScanchainsEndCbk) + ScanchainsEndCbk = (defrVoidCbkFnType) f; + if (!ScanchainCbk) + ScanchainCbk = (defrScanchainCbkFnType) f; + if (!IOTimingsStartCbk) + IOTimingsStartCbk = (defrIntegerCbkFnType) f; + if (!IOTimingsEndCbk) + IOTimingsEndCbk = (defrVoidCbkFnType) f; + if (!IOTimingCbk) + IOTimingCbk = (defrIOTimingCbkFnType) f; + if (!FPCStartCbk) + FPCStartCbk = (defrIntegerCbkFnType) f; + if (!FPCEndCbk) + FPCEndCbk = (defrVoidCbkFnType) f; + if (!FPCCbk) + FPCCbk = (defrFPCCbkFnType) f; + if (!TimingDisablesStartCbk) + TimingDisablesStartCbk = (defrIntegerCbkFnType) f; + if (!TimingDisablesEndCbk) + TimingDisablesEndCbk = (defrVoidCbkFnType) f; + if (!TimingDisableCbk) + TimingDisableCbk = (defrTimingDisableCbkFnType) f; + if (!PartitionsStartCbk) + PartitionsStartCbk = (defrIntegerCbkFnType) f; + if (!PartitionsEndCbk) + PartitionsEndCbk = (defrVoidCbkFnType) f; + if (!PartitionCbk) + PartitionCbk = (defrPartitionCbkFnType) f; + if (!PinPropStartCbk) + PinPropStartCbk = (defrIntegerCbkFnType) f; + if (!PinPropEndCbk) + PinPropEndCbk = (defrVoidCbkFnType) f; + if (!PinPropCbk) + PinPropCbk = (defrPinPropCbkFnType) f; + if (!CaseSensitiveCbk) + CaseSensitiveCbk = (defrIntegerCbkFnType) f; + if (!BlockageStartCbk) + BlockageStartCbk = (defrIntegerCbkFnType) f; + if (!BlockageEndCbk) + BlockageEndCbk = (defrVoidCbkFnType) f; + if (!BlockageCbk) + BlockageCbk = (defrBlockageCbkFnType) f; + if (!SlotStartCbk) + SlotStartCbk = (defrIntegerCbkFnType) f; + if (!SlotEndCbk) + SlotEndCbk = (defrVoidCbkFnType) f; + if (!SlotCbk) + SlotCbk = (defrSlotCbkFnType) f; + if (!FillStartCbk) + FillStartCbk = (defrIntegerCbkFnType) f; + if (!FillEndCbk) + FillEndCbk = (defrVoidCbkFnType) f; + if (!FillCbk) + FillCbk = (defrFillCbkFnType) f; + if (!NonDefaultStartCbk) + NonDefaultStartCbk = (defrIntegerCbkFnType) f; + if (!NonDefaultEndCbk) + NonDefaultEndCbk = (defrVoidCbkFnType) f; + if (!NonDefaultCbk) + NonDefaultCbk = (defrNonDefaultCbkFnType) f; + if (!StylesStartCbk) + StylesStartCbk = (defrIntegerCbkFnType) f; + if (!StylesEndCbk) + StylesEndCbk = (defrVoidCbkFnType) f; + if (!StylesCbk) + StylesCbk = (defrStylesCbkFnType) f; + if (!ExtensionCbk) + ExtensionCbk = (defrStringCbkFnType) f; + + /* NEW CALLBACK - Each new callback must have an entry here. */ +} + + +END_LEFDEF_PARSER_NAMESPACE diff --git a/src/def/def/defrData.cpp b/src/def/def/defrData.cpp new file mode 100644 index 00000000..b73137cc --- /dev/null +++ b/src/def/def/defrData.cpp @@ -0,0 +1,506 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013-2014, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: arakhman $ +// $Revision: #6 $ +// $Date: 2013/08/09 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include + +#include "defrData.hpp" +#include "defrSettings.hpp" + +using namespace std; + +BEGIN_LEFDEF_PARSER_NAMESPACE + +defrData::defrData(const defrCallbacks *pCallbacks, + const defrSettings *pSettings, + defrSession *pSession) +: defrLog(0), + defPropDefType('\0'), + ch(NULL), + defMsg(NULL), + deftoken((char*)malloc(TOKEN_SIZE)), + uc_token((char*)malloc(TOKEN_SIZE)), + last(NULL), + magic((char*)malloc(1)), + next(NULL), + pv_deftoken((char*)malloc(TOKEN_SIZE)), + rowName(NULL), + shieldName(NULL), + shiftBuf(0), + warningMsg(NULL), + save_x(0.0), + save_y(0.0), + lVal(0.0), + rVal(0.0), + aOxide(0), + assertionWarnings(0), + bit_is_keyword(0), + bitsNum(0), + blockageWarnings(0), + by_is_keyword(0), + caseSensitiveWarnings(0), + componentWarnings(0), + constraintWarnings(0), + cover_is_keyword(0), + defIgnoreVersion(0), + defInvalidChar(0), + defMsgCnt(5500), + defMsgPrinted(0), + defPrintTokens(0), + defRetVal(0), + def_warnings(0), + defaultCapWarnings(0), + do_is_keyword(0), + dumb_mode(0), + errors(0), + fillWarnings(0), + first_buffer(0), + fixed_is_keyword(0), + gcellGridWarnings(0), + hasBlkLayerComp(0), + hasBlkLayerSpac(0), + hasBlkLayerTypeComp(0), + hasBlkPlaceComp(0), + hasBlkPlaceTypeComp(0), + hasBusBit(0), + hasDes(0), + hasDivChar(0), + hasDoStep(0), + hasNameCase(0), + hasOpenedDefLogFile(0), + hasPort(0), + hasVer(0), + hasFatalError(0), + iOTimingWarnings(0), + input_level(-1), + mask_is_keyword(0), + mustjoin_is_keyword(0), + names_case_sensitive(1), + needNPCbk(0), + needSNPCbk(0), + netOsnet(0), + netWarnings(0), + new_is_keyword(0), + nl_token(FALSE), + no_num(0), + nonDefaultWarnings(0), + nondef_is_keyword(0), + ntokens(0), + orient_is_keyword(0), + pinExtWarnings(0), + pinWarnings(0), + real_num(0), + rect_is_keyword(0), + regTypeDef(0), + regionWarnings(0), + ringPlace(0), + routed_is_keyword(0), + rowWarnings(0), + sNetWarnings(0), + scanchainWarnings(0), + shield(FALSE), + shiftBufLength(0), + specialWire_mask(0), + step_is_keyword(0), + stylesWarnings(0), + trackWarnings(0), + unitsWarnings(0), + versionWarnings(0), + viaRule(0), + viaWarnings(0), + virtual_is_keyword(0), + deftokenLength(TOKEN_SIZE), + nlines(1), + specialWire_routeStatus((char*) "ROUTED"), + specialWire_routeStatusName((char *)""), + specialWire_shapeType((char*)""), + VersionNum(5.7), + xStep(0), + yStep(0), + // defrReader vars + PathObj(this), + Prop(this), + Site(this), + Component(this), + ComponentMaskShiftLayer(this), + Net(this), + PinCap(), + CannotOccupy(this), + Canplace(this), + DieArea(), + Pin(this), + Row(this), + Track(this), + GcellGrid(this), + Via(this), + Region(this), + Group(this), + Assertion(this), + Scanchain(this), + IOTiming(this), + FPC(this), + TimingDisable(this), + Partition(this), + PinProp(this), + Blockage(this), + Slot(this), + Fill(this), + NonDefault(this), + Styles(), + Geometries(this), + doneDesign(0), + NeedPathData(0), + Subnet(0), + callbacks(pCallbacks), + settings(pSettings), + session(pSession), + File(0) +{ + magic[0] = '\0'; + deftoken[0] = '\0'; + History_text.push_back('\0'); + + memset(msgLimit, 0, DEF_MSGS * sizeof(int)); + memset(buffer, 0, IN_BUF_SIZE * sizeof(char)); + memset(ring, 0, RING_SIZE * sizeof(char*)); + memset(ringSizes, 0, RING_SIZE * sizeof(int)); + memset(lineBuffer, 0, MSG_SIZE * sizeof(char)); + + // initRingBuffer + int i; + ringPlace = 0; + for (i = 0; i < RING_SIZE; i++) { + ring[i] = (char*)malloc(TOKEN_SIZE); + ringSizes[i] = TOKEN_SIZE; + } + + nlines = 1; + last = buffer-1; + next = buffer; + first_buffer = 1; + + lVal = strtod("-2147483648", &ch); + rVal = strtod("2147483647", &ch); +} + + +defrData::~defrData() +{ + // lex_un_init. + /* Close the file */ + if (defrLog) { + fclose(defrLog); + defrLog = 0; + } + + free(deftoken); + free(uc_token); + free(pv_deftoken); + free(magic); + + // freeRingBuffer. + int i; + + ringPlace = 0; + for (i = 0; i < RING_SIZE; i++) { + free(ring[i]); + } +} + +void +defrData::defiError(int check, int msgNum, const char* mess) +{ + /* check is 1 if the caller function has checked totalMsgLimit, etc. */ + + if (!check) { + if ((settings->totalDefMsgLimit > 0) && (defMsgPrinted >= settings->totalDefMsgLimit)) + return; + if (settings->MsgLimit[msgNum-5000] > 0) { + if (msgLimit[msgNum-5000] >= settings->MsgLimit[msgNum-5000]) + return; /*over the limit*/ + msgLimit[msgNum-5000] = msgLimit[msgNum-5000] + 1; + } + defMsgPrinted++; + } + + + if (settings->ContextErrorLogFunction) { + (*(settings->ContextErrorLogFunction))(session->UserData, mess); + } else if (settings->ErrorLogFunction) { + (*(settings->ErrorLogFunction))(mess); + } else { + fprintf(stderr, "%s", mess); + } +} + +const char* +defrData::upperCase(const char* str) +{ + const static char defiShift [] = { + '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', + ' ', '!', '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', '.', '/', + '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', + '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'l', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '{', '|', '}', '~', '\0', + '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0' + }; + + char* place = (char*)str; + char* to; + int len = strlen(str) + 1; + + if (len > shiftBufLength) { + if (shiftBuf == 0) { + len = len < 64 ? 64 : len; + shiftBuf = (char*)malloc(len); + shiftBufLength = len; + } else { + free(shiftBuf); + shiftBuf = (char*)malloc(len); + shiftBufLength = len; + } + } + + to = shiftBuf; + while (*place) { + int i = (int)*place; + place++; + *to++ = defiShift[i]; + } + *to = '\0'; + + return shiftBuf; +} + +int +defrData::validateMaskInput(int input, int warningIndex, int getWarningsIndex) +{ + if (VersionNum < 5.8 && input > 0) { + if (warningIndex++ < getWarningsIndex) { + defMsg = (char*)malloc(1000); + sprintf (defMsg, + "The MASK statement is available in version 5.8 and later.\nHowever, your DEF file is defined with version %g", VersionNum); + defError(7415, defMsg); + free(defMsg); + if (checkErrors()) { + return 1; + } + return 0; + } + } + + return 1; +} + +int +defrData::validateMaskShiftInput(const char* shiftMask, int warningIndex, int getWarningsIndex) +{ + int shiftMaskLength = strlen(shiftMask); + int hasShiftData = 0; + int hasError = 0; + + // Verification of the mask string + for (int i = 0; i < shiftMaskLength; i++) { + int curShift = shiftMask[i]; + + if (curShift < '0' || curShift > '9') { + hasError = 1; + } + + if (curShift > '0') { + hasShiftData = 1; + } + } + + if (hasError) { + char *msg = (char*)malloc(1000); + + sprintf(msg, + "The MASKSHIFT value '%s' is not valid. The value should be a string consisting of decimal digits ('0' - '9').", + shiftMask); + defError(7416, msg); + free(msg); + + if (checkErrors()) { + return 1; + } + + return 0; + } + + if (VersionNum < 5.8 && hasShiftData) { + if (warningIndex++ < getWarningsIndex) { + char *msg = (char*)malloc(1000); + + sprintf (msg, + "The MASKSHIFT statement can be used only in DEF version 5.8 and later. This DEF file version is '%g'.", + VersionNum); + defError(7417, msg); + free(msg); + if (checkErrors()) { + return 1; + } + } + + return 0; + } + + return 1; +} + +double +defrData::convert_defname2num(char *versionName) +{ + char majorNm[80]; + char minorNm[80]; + char *subMinorNm = NULL; + char *versionNm = strdup(versionName); + + double major = 0, minor = 0, subMinor = 0; + double version; + + sscanf(versionNm, "%[^.].%s", majorNm, minorNm); + + char *p1 = strchr(minorNm, '.'); + if (p1) { + subMinorNm = p1+1; + *p1 = '\0'; + } + major = atof(majorNm); + minor = atof(minorNm); + if (subMinorNm) + subMinor = atof(subMinorNm); + + version = major; + + if (minor > 0) + version = major + minor/10; + + if (subMinor > 0) + version = version + subMinor/1000; + + free(versionNm); + return version; +} + +int +defrData::numIsInt (char* volt) { + if (strchr(volt, '.')) // a floating point + return 0; + else + return 1; +} + +int +defrData::defValidNum(int values) { + char *outMsg; + switch (values) { + case 100: + case 200: + case 1000: + case 2000: + return 1; + case 400: + case 800: + case 4000: + case 8000: + case 10000: + case 20000: + if (VersionNum < 5.6) { + if (callbacks->UnitsCbk) { + if (unitsWarnings++ < settings->UnitsWarnings) { + outMsg = (char*)malloc(1000); + sprintf (outMsg, + "An error has been found while processing the DEF file '%s'\nUnit %d is a 5.6 or later syntax. Define the DEF file as 5.6 and then try again.", + session->FileName, values); + defError(6501, outMsg); + free(outMsg); + } + } + + return 0; + } else { + return 1; + } + } + if (callbacks->UnitsCbk) { + if (unitsWarnings++ < settings->UnitsWarnings) { + outMsg = (char*)malloc(10000); + sprintf (outMsg, + "The value %d defined for DEF UNITS DISTANCE MICRON is invalid\n. The valid values are 100, 200, 400, 800, 1000, 2000, 4000, 8000, 10000, or 20000. Specify a valid value and then try again.", values); + defError(6502, outMsg); + free(outMsg); + if (checkErrors()) { + return 1; + } + } + } + return 0; +} + +defrContext::defrContext(int ownConf) +: settings(0), +callbacks(0), +session(0), +data(0), +ownConfig(ownConf), +init_call_func(0) +{ +} + +defrContext defContext; + +END_LEFDEF_PARSER_NAMESPACE diff --git a/src/def/def/defrData.hpp b/src/def/def/defrData.hpp new file mode 100644 index 00000000..1a7f5d15 --- /dev/null +++ b/src/def/def/defrData.hpp @@ -0,0 +1,307 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2015, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: arakhman $ +// $Revision: #6 $ +// $Date: 2013/08/09 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include +#include + +#include "defrReader.hpp" +#include "defrCallBacks.hpp" +#include "defrSettings.hpp" + +#ifndef defrData_h +#define defrData_h + +#define CURRENT_VERSION 5.8 +#define RING_SIZE 10 +#define IN_BUF_SIZE 16384 +#define TOKEN_SIZE 4096 +#define MSG_SIZE 100 + + +BEGIN_LEFDEF_PARSER_NAMESPACE + +struct defCompareStrings +{ + bool operator()(const std::string &lhs, const std::string &rhs) const { + return std::strcmp(lhs.c_str(), rhs.c_str()) < 0; + } +}; + +typedef std::map defAliasMap; +typedef std::map defDefineMap; + +typedef union { + double dval ; + int integer ; + char * string ; + int keyword ; // really just a nop + struct defpoint pt; + defTOKEN *tk; +} YYSTYPE; + +#define YYSTYPE_IS_DECLARED + +class defrData { + +public: + defrData(const defrCallbacks *pCallbacks, + const defrSettings *pSettings, + defrSession *pSession); + ~defrData(); + + inline int defGetKeyword(const char* name, int *result); + inline int defGetAlias(const std::string &name, std::string &result); + inline int defGetDefine(const std::string &name, std::string &result); + void reload_buffer(); + int GETC(); + + void UNGETC(char ch); + char* ringCopy(const char* string); + int DefGetTokenFromStack(char *s); + inline void print_lines(long long lines); + const char * lines2str(long long lines); + static inline void IncCurPos(char **curPos, char **buffer, int *bufferSize); + int DefGetToken(char **buffer, int *bufferSize); + static void uc_array(char *source, char *dest); + void StoreAlias(); + int defyylex(YYSTYPE *pYylval); + int sublex(YYSTYPE *pYylval); + int amper_lookup(YYSTYPE *pYylval, char *tkn); + void defError(int msgNum, const char *s); + void defyyerror(const char *s); + void defInfo(int msgNum, const char *s); + void defWarning(int msgNum, const char *s); + + void defiError(int check, int msgNum, const char* mess); + const char *DEFCASE(const char* ch); + void pathIsDone(int shield, int reset, int netOsnet, int *needCbk); + const char *upperCase(const char* str); + + inline int checkErrors(); + int validateMaskInput(int input, int warningIndex, int getWarningsIndex); + int validateMaskShiftInput(const char* shiftMask, int warningIndex, int getWarningsIndex); + + static double convert_defname2num(char *versionName); + + static int numIsInt (char* volt); + int defValidNum(int values); + + inline static const char *defkywd(int num); + + FILE* defrLog; + char defPropDefType; // save the current type of the property + char* ch; + char* defMsg; + char* deftoken; + char* uc_token; + char* last; + char* magic; + char* next; + char* pv_deftoken; + char* rowName; // to hold the rowName for message + char* shieldName; // to hold the shieldNetName + char* shiftBuf; + char* warningMsg; + double save_x; + double save_y; + double lVal; + double rVal; + int aOxide; // keep track for oxide + int assertionWarnings; + int bit_is_keyword; + int bitsNum; // Scanchain Bits value + int blockageWarnings; + int by_is_keyword; + int caseSensitiveWarnings; + int componentWarnings; + int constraintWarnings; + int cover_is_keyword; + int defIgnoreVersion; // ignore checking version number + int defInvalidChar; + int defMsgCnt; + int defMsgPrinted; // number of msgs output so far + int defPrintTokens; + int defRetVal; + int def_warnings; + int defaultCapWarnings; + int do_is_keyword; + int dumb_mode; + int errors; + int fillWarnings; + int first_buffer; + int fixed_is_keyword; + int gcellGridWarnings; + int hasBlkLayerComp; // only 1 BLOCKAGE/LAYER/COMP + int hasBlkLayerSpac; // only 1 BLOCKAGE/LAYER/SPACING + int hasBlkLayerTypeComp; // SLOTS or FILLS + int hasBlkPlaceComp; // only 1 BLOCKAGE/PLACEMENT/COMP + int hasBlkPlaceTypeComp; // SOFT or PARTIAL + int hasBusBit; // keep track BUSBITCHARS is in the file + int hasDes; // keep track DESIGN is in the file + int hasDivChar; // keep track DIVIDERCHAR is in the file + int hasDoStep; + int hasNameCase; // keep track NAMESCASESENSITIVE is in the file + int hasOpenedDefLogFile; + int hasPort; // keep track is port defined in a Pin + int hasVer; // keep track VERSION is in the file + int hasFatalError; // don't report errors after the file end. + int iOTimingWarnings; + int input_level; + int mask_is_keyword; + int mustjoin_is_keyword; + int names_case_sensitive; // always true in 5.6 + int needNPCbk; // if cbk for net path is needed + int needSNPCbk; // if cbk for snet path is needed + int netOsnet; // net = 1 & snet = 2 + int netWarnings; + int new_is_keyword; + int nl_token; + int no_num; + int nonDefaultWarnings; + int nondef_is_keyword; + int ntokens; + int orient_is_keyword; + int pinExtWarnings; + int pinWarnings; + int real_num; + int rect_is_keyword; + int regTypeDef; // keep track that region type is defined + int regionWarnings; + int ringPlace; + int routed_is_keyword; + int rowWarnings; + int sNetWarnings; + int scanchainWarnings; + int shield; // To identify if the path is shield for 5.3 + int shiftBufLength; + int specialWire_mask; + int step_is_keyword; + int stylesWarnings; + int trackWarnings; + int unitsWarnings; + int versionWarnings; + int viaRule; // keep track the viarule has called first + int viaWarnings; + int virtual_is_keyword; + int deftokenLength; + long long nlines; + + std::vector History_text; + defAliasMap def_alias_set; + defDefineMap def_defines_set; + + char* specialWire_routeStatus; + char* specialWire_routeStatusName; + char* specialWire_shapeType; + double VersionNum; + double xStep; + double yStep; + + //defrParser vars. + defiPath PathObj; + defiProp Prop; + defiSite Site; + defiComponent Component; + defiComponentMaskShiftLayer ComponentMaskShiftLayer; + defiNet Net; + defiPinCap PinCap; + defiSite CannotOccupy; + defiSite Canplace; + defiBox DieArea; + defiPin Pin; + defiRow Row; + defiTrack Track; + defiGcellGrid GcellGrid; + defiVia Via; + defiRegion Region; + defiGroup Group; + defiAssertion Assertion; + defiScanchain Scanchain; + defiIOTiming IOTiming; + defiFPC FPC; + defiTimingDisable TimingDisable; + defiPartition Partition; + defiPinProp PinProp; + defiBlockage Blockage; + defiSlot Slot; + defiFill Fill; + defiNonDefault NonDefault; + defiStyles Styles; + defiGeometries Geometries; + int doneDesign; // keep track if the Design is done parsing + + // Flags to control what happens + int NeedPathData; + + defiSubnet* Subnet; + int msgLimit[DEF_MSGS]; + char buffer[IN_BUF_SIZE]; + char* ring[RING_SIZE]; + int ringSizes[RING_SIZE]; + std::string stack[20]; /* the stack itself */ + + YYSTYPE yylval; + const defrCallbacks *callbacks; + const defrSettings *settings; + defrSession *session; + char lineBuffer[MSG_SIZE]; + + FILE* File; +}; + +class defrContext { +public: + defrContext(int ownConf = 0); + + defrSettings *settings; + defrCallbacks *callbacks; + defrSession *session; + defrData *data; + int ownConfig; + const char *init_call_func; +}; + +int +defrData::checkErrors() +{ + if (errors > 20) { + defError(6011, "Too many syntax errors have been reported."); + errors = 0; + return 1; + } + + return 0; +} + +END_LEFDEF_PARSER_NAMESPACE + +#endif + diff --git a/src/def/def/defrReader.cpp b/src/def/def/defrReader.cpp new file mode 100644 index 00000000..982c2e55 --- /dev/null +++ b/src/def/def/defrReader.cpp @@ -0,0 +1,2540 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2017, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: icftcm $ +// $Revision: #2 $ +// $Date: 2017/06/07 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include "defrReader.hpp" +#include "defiProp.hpp" +#include "defiPropType.hpp" +#include "defrCallBacks.hpp" +#include "defiDebug.hpp" +#include "defiMisc.hpp" +#include "defrData.hpp" +#include "defrSettings.hpp" + +#include +#include +#include +#include "lex.h" +#include "defiUtil.hpp" +#include "defrCallBacks.hpp" + +#define NODEFMSG 4013 // (9012 + 1) - 5000, def msg starts at 5000 + +# define DEF_INIT def_init(__FUNCTION__) + + +BEGIN_LEFDEF_PARSER_NAMESPACE + +extern defrContext defContext; + +void +def_init(const char *func) +{ + // Need for debugging config re-owning; + if (defContext.ownConfig) { + return; + } + + + if (defContext.settings == NULL) { + defContext.settings = new defrSettings(); + defContext.init_call_func = func; + } + + if (defContext.callbacks == NULL) { + defContext.callbacks = new defrCallbacks(); + defContext.init_call_func = func; + } + + if (defContext.session == NULL) { + defContext.session = new defrSession(); + defContext.init_call_func = func; + } +} + + +int +defrCountUnused(defrCallbackType_e e, + void *v, + defiUserData d) +{ + DEF_INIT; + int i; + if (defiDebug(23)) + printf("Count %d, 0x%p, 0x%p\n", (int) e, v, d); + i = (int) e; + if (i <= 0 || i >= CBMAX) { + return 1; + } + + defContext.settings->UnusedCallbacks[i] += 1; + + return 0; +} + + +const char * +typeToString(defrCallbackType_e num) +{ + switch ((int) num) { + + case defrUnspecifiedCbkType: + return "Unspecified"; + case defrDesignStartCbkType: + return "Design Start"; + case defrTechNameCbkType: + return "Tech Name"; + case defrPropCbkType: + return "Property"; + case defrPropDefEndCbkType: + return "Property Definitions Section End"; + case defrPropDefStartCbkType: + return "Property Definitions Section Start"; + case defrFloorPlanNameCbkType: + return "FloorPlanName"; + case defrArrayNameCbkType: + return "Array Name"; + case defrUnitsCbkType: + return "Units"; + case defrDividerCbkType: + return "Divider"; + case defrBusBitCbkType: + return "BusBit Character"; + case defrSiteCbkType: + return "Site"; + case defrComponentMaskShiftLayerCbkType: + return "ComponentMaskShiftLayer"; + case defrComponentStartCbkType: + return "Components Section Start"; + case defrComponentCbkType: + return "Component"; + case defrComponentEndCbkType: + return "Components Section End"; + case defrNetStartCbkType: + return "Nets Section Start"; + case defrNetCbkType: + return "Net"; + case defrNetNameCbkType: + return "Net Name"; + case defrNetNonDefaultRuleCbkType: + return "Net Nondefaultrule"; + case defrNetSubnetNameCbkType: + return "Net Subnet Name"; + case defrNetEndCbkType: + return "Nets Section End"; + case defrPathCbkType: + return "Path"; + case defrVersionCbkType: + return "Version"; + case defrVersionStrCbkType: + return "Version"; + case defrComponentExtCbkType: + return "Component User Extention"; + case defrPinExtCbkType: + return "Pin User Extension"; + case defrViaExtCbkType: + return "Via User Extension"; + case defrNetConnectionExtCbkType: + return "NetConnection User Extention"; + case defrNetExtCbkType: + return "Net User Extension"; + case defrGroupExtCbkType: + return "Group User Extension"; + case defrScanChainExtCbkType: + return "ScanChain User Extension"; + case defrIoTimingsExtCbkType: + return "IoTimings User Extension"; + case defrPartitionsExtCbkType: + return "Partitions User Extension"; + case defrHistoryCbkType: + return "History"; + case defrDieAreaCbkType: + return "DieArea"; + case defrCanplaceCbkType: + return "Canplace"; + case defrCannotOccupyCbkType: + return "CannotOccupy"; + case defrPinCapCbkType: + return "PinCap"; + case defrDefaultCapCbkType: + return "DefaultCap"; + case defrStartPinsCbkType: + return "Start Pins Section"; + case defrPinCbkType: + return "Pin"; + case defrPinEndCbkType: + return "End Pins Section"; + case defrRowCbkType: + return "Row"; + case defrTrackCbkType: + return "Track"; + case defrGcellGridCbkType: + return "GcellGrid"; + case defrViaStartCbkType: + return "Start Vias Section"; + case defrViaCbkType: + return "Via"; + case defrViaEndCbkType: + return "End Vias Section"; + case defrRegionStartCbkType: + return "Region Section Start"; + case defrRegionCbkType: + return "Region"; + case defrRegionEndCbkType: + return "Region Section End"; + case defrSNetStartCbkType: + return "Special Net Section Start"; + case defrSNetCbkType: + return "Special Net"; + case defrSNetEndCbkType: + return "Special Net Section End"; + case defrGroupsStartCbkType: + return "Groups Section Start"; + case defrGroupNameCbkType: + return "Group Name"; + case defrGroupMemberCbkType: + return "Group Member"; + case defrGroupCbkType: + return "Group"; + case defrGroupsEndCbkType: + return "Groups Section End"; + case defrAssertionsStartCbkType: + return "Assertions Section Start"; + case defrAssertionCbkType: + return "Assertion"; + case defrAssertionsEndCbkType: + return "Assertions Section End"; + case defrConstraintsStartCbkType: + return "Constraints Section Start"; + case defrConstraintCbkType: + return "Constraint"; + case defrConstraintsEndCbkType: + return "Constraints Section End"; + case defrScanchainsStartCbkType: + return "Scanchains Section Start"; + case defrScanchainCbkType: + return "Scanchain"; + case defrScanchainsEndCbkType: + return "Scanchains Section End"; + case defrIOTimingsStartCbkType: + return "IOTimings Section Start"; + case defrIOTimingCbkType: + return "IOTiming"; + case defrIOTimingsEndCbkType: + return "IOTimings Section End"; + case defrFPCStartCbkType: + return "Floor Plan Constraints Section Start"; + case defrFPCCbkType: + return "Floor Plan Constraint"; + case defrFPCEndCbkType: + return "Floor Plan Constraints Section End"; + case defrTimingDisablesStartCbkType: + return "TimingDisables Section Start"; + case defrTimingDisableCbkType: + return "TimingDisable"; + case defrTimingDisablesEndCbkType: + return "TimingDisables Section End"; + case defrPartitionsStartCbkType: + return "Partitions Section Start"; + case defrPartitionCbkType: + return "Partition"; + case defrPartitionsEndCbkType: + return "Partitions Section End"; + case defrPinPropStartCbkType: + return "PinProp Section Start"; + case defrPinPropCbkType: + return "PinProp"; + case defrPinPropEndCbkType: + return "PinProp Section End"; + case defrCaseSensitiveCbkType: + return "CaseSensitive"; + case defrBlockageStartCbkType: + return "Blockage Section Start"; + case defrBlockageCbkType: + return "Blockage"; + case defrBlockageEndCbkType: + return "Blockage Section End"; + case defrSlotStartCbkType: + return "Slots Section Start"; + case defrSlotCbkType: + return "Slots"; + case defrSlotEndCbkType: + return "Slots Section End"; + case defrFillStartCbkType: + return "Fills Section Start"; + case defrFillCbkType: + return "Fills"; + case defrFillEndCbkType: + return "Fills Section End"; + case defrNonDefaultStartCbkType: + return "NonDefaultRule Section Start"; + case defrNonDefaultCbkType: + return "NonDefault"; + case defrNonDefaultEndCbkType: + return "NonDefaultRule Section End"; + case defrStylesStartCbkType: + return "Styles Section Start"; + case defrStylesCbkType: + return "Styles"; + case defrStylesEndCbkType: + return "Styles Section End"; + case defrExtensionCbkType: + return "Extension"; + + // NEW CALLBACK - If you created a new callback then add the + // type enums that you created here for debug printing. + + case defrDesignEndCbkType: + return "DesignEnd"; + default: + break; + } + return "BOGUS"; +} + +int +defrCatchAll(defrCallbackType_e typ, void*, defiUserData) +{ + DEF_INIT; + + if ((int) typ >= 0 && (int) typ < CBMAX) { + defContext.settings->UnusedCallbacks[(int) typ] += 1; + } else { + defContext.settings->UnusedCallbacks[0] += 1; + return 1; + } + + return 0; +} + +// ***************************************************************** +// Wrapper functions. +// +// These functions provide access to the class member functions +// for compatibility with previous parser kits. Returns non-zero +// status if the initialization is failed. +// ***************************************************************** +int +defrInit() +{ + return defrInitSession(0); +} + +int +defrInitSession(int startSession) +{ + if (startSession) { + if (defContext.init_call_func != NULL) { + fprintf(stderr, "ERROR: Attempt to call configuration function '%s' in DEF parser before defrInit() call in session-based mode.\n", defContext.init_call_func); + return 1; + } + + delete defContext.settings; + defContext.settings = new defrSettings(); + + delete defContext.callbacks; + defContext.callbacks = new defrCallbacks(); + + delete defContext.session; + defContext.session = new defrSession(); + } else { + if (defContext.callbacks == NULL) { + defContext.callbacks = new defrCallbacks(); + } + + if (defContext.settings == NULL) { + defContext.settings = new defrSettings(); + } + + if (defContext.session == NULL) { + defContext.session = new defrSession(); + } else { + memset(defContext.settings->UnusedCallbacks, 0, CBMAX * sizeof(int)); + } + } + + defContext.ownConfig = 0; + defContext.init_call_func = 0; + + return 0; +} + +// obsoleted now +int +defrReset() +{ + return 0; +} + +int +defrClear() +{ + delete defContext.callbacks; + defContext.callbacks = NULL; + + delete defContext.settings; + defContext.settings = NULL; + + delete defContext.session; + defContext.session = NULL; + + delete defContext.data; + defContext.data = NULL; + + defContext.init_call_func = NULL; + defContext.ownConfig = 0; + + return 0; +} + + +void +defrSetRegisterUnusedCallbacks() +{ + DEF_INIT; + defrSetUnusedCallbacks(defrCountUnused); +} + +void +defrSetUnusedCallbacks(defrVoidCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->SetUnusedCallbacks(f); +} + +void +defrUnsetCallbacks() +{ + DEF_INIT; + delete defContext.callbacks; + defContext.callbacks = new defrCallbacks(); +} + +void +defrPrintUnusedCallbacks(FILE *log) +{ + int i; + int first = 1; + + for (i = 0; i < CBMAX; i++) { + if (defContext.settings->UnusedCallbacks[i]) { + if (first) { + fprintf(log, + "WARNING (DEFPARS-5001): DEF statement found in the def file with no callback set.\n"); + first = 0; + } + fprintf(log, "%5d %s\n", defContext.settings->UnusedCallbacks[i], + typeToString((defrCallbackType_e) i)); + } + } +} + +// obsoleted +int +defrReleaseNResetMemory() +{ + return 0; +} + +void +defrUnsetArrayNameCbk() +{ + DEF_INIT; + defContext.callbacks->ArrayNameCbk = NULL; +} + +void +defrUnsetAssertionCbk() +{ + DEF_INIT; + defContext.callbacks->AssertionCbk = NULL; +} + +void +defrUnsetAssertionsStartCbk() +{ + DEF_INIT; + defContext.callbacks->AssertionsStartCbk = NULL; +} + +void +defrUnsetAssertionsEndCbk() +{ + DEF_INIT; + defContext.callbacks->AssertionsEndCbk = NULL; +} + +void +defrUnsetBlockageCbk() +{ + DEF_INIT; + defContext.callbacks->BlockageCbk = NULL; +} + +void +defrUnsetBlockageStartCbk() +{ + DEF_INIT; + defContext.callbacks->BlockageStartCbk = NULL; +} + +void +defrUnsetBlockageEndCbk() +{ + DEF_INIT; + defContext.callbacks->BlockageEndCbk = NULL; +} + +void +defrUnsetBusBitCbk() +{ + DEF_INIT; + defContext.callbacks->BusBitCbk = NULL; +} + +void +defrUnsetCannotOccupyCbk() +{ + DEF_INIT; + defContext.callbacks->CannotOccupyCbk = NULL; +} + +void +defrUnsetCanplaceCbk() +{ + DEF_INIT; + defContext.callbacks->CanplaceCbk = NULL; +} + +void +defrUnsetCaseSensitiveCbk() +{ + DEF_INIT; + defContext.callbacks->CaseSensitiveCbk = NULL; +} + +void +defrUnsetComponentCbk() +{ + DEF_INIT; + defContext.callbacks->ComponentCbk = NULL; +} + +void +defrUnsetComponentExtCbk() +{ + DEF_INIT; + defContext.callbacks->ComponentExtCbk = NULL; +} + +void +defrUnsetComponentStartCbk() +{ + DEF_INIT; + defContext.callbacks->ComponentStartCbk = NULL; +} + +void +defrUnsetComponentEndCbk() +{ + DEF_INIT; + defContext.callbacks->ComponentEndCbk = NULL; +} + +void +defrUnsetConstraintCbk() +{ + DEF_INIT; + defContext.callbacks->ConstraintCbk = NULL; +} + +void +defrUnsetConstraintsStartCbk() +{ + DEF_INIT; + defContext.callbacks->ConstraintsStartCbk = NULL; +} + +void +defrUnsetConstraintsEndCbk() +{ + DEF_INIT; + defContext.callbacks->ConstraintsEndCbk = NULL; +} + +void +defrUnsetDefaultCapCbk() +{ + DEF_INIT; + defContext.callbacks->DefaultCapCbk = NULL; +} + +void +defrUnsetDesignCbk() +{ + DEF_INIT; + defContext.callbacks->DesignCbk = NULL; +} + +void +defrUnsetDesignEndCbk() +{ + DEF_INIT; + defContext.callbacks->DesignEndCbk = NULL; +} + +void +defrUnsetDieAreaCbk() +{ + DEF_INIT; + defContext.callbacks->DieAreaCbk = NULL; +} + +void +defrUnsetDividerCbk() +{ + DEF_INIT; + defContext.callbacks->DividerCbk = NULL; +} + +void +defrUnsetExtensionCbk() +{ + DEF_INIT; + defContext.callbacks->ExtensionCbk = NULL; +} + +void +defrUnsetFillCbk() +{ + DEF_INIT; + defContext.callbacks->FillCbk = NULL; +} + +void +defrUnsetFillStartCbk() +{ + DEF_INIT; + defContext.callbacks->FillStartCbk = NULL; +} + +void +defrUnsetFillEndCbk() +{ + DEF_INIT; + defContext.callbacks->FillEndCbk = NULL; +} + +void +defrUnsetFPCCbk() +{ + DEF_INIT; + defContext.callbacks->FPCCbk = NULL; +} + +void +defrUnsetFPCStartCbk() +{ + DEF_INIT; + defContext.callbacks->FPCStartCbk = NULL; +} + +void +defrUnsetFPCEndCbk() +{ + DEF_INIT; + defContext.callbacks->FPCEndCbk = NULL; +} + +void +defrUnsetFloorPlanNameCbk() +{ + DEF_INIT; + defContext.callbacks->FloorPlanNameCbk = NULL; +} + +void +defrUnsetGcellGridCbk() +{ + DEF_INIT; + defContext.callbacks->GcellGridCbk = NULL; +} + +void +defrUnsetGroupCbk() +{ + DEF_INIT; + defContext.callbacks->GroupCbk = NULL; +} + +void +defrUnsetGroupExtCbk() +{ + DEF_INIT; + defContext.callbacks->GroupExtCbk = NULL; +} + +void +defrUnsetGroupMemberCbk() +{ + DEF_INIT; + defContext.callbacks->GroupMemberCbk = NULL; +} + +void +defrUnsetComponentMaskShiftLayerCbk() +{ + DEF_INIT; + defContext.callbacks->ComponentMaskShiftLayerCbk = NULL; +} + +void +defrUnsetGroupNameCbk() +{ + DEF_INIT; + defContext.callbacks->GroupNameCbk = NULL; +} + +void +defrUnsetGroupsStartCbk() +{ + DEF_INIT; + defContext.callbacks->GroupsStartCbk = NULL; +} + +void +defrUnsetGroupsEndCbk() +{ + DEF_INIT; + defContext.callbacks->GroupsEndCbk = NULL; +} + +void +defrUnsetHistoryCbk() +{ + DEF_INIT; + defContext.callbacks->HistoryCbk = NULL; +} + +void +defrUnsetIOTimingCbk() +{ + DEF_INIT; + defContext.callbacks->IOTimingCbk = NULL; +} + +void +defrUnsetIOTimingsStartCbk() +{ + DEF_INIT; + defContext.callbacks->IOTimingsStartCbk = NULL; +} + +void +defrUnsetIOTimingsEndCbk() +{ + DEF_INIT; + defContext.callbacks->IOTimingsEndCbk = NULL; +} + +void +defrUnsetIOTimingsExtCbk() +{ + DEF_INIT; + defContext.callbacks->IoTimingsExtCbk = NULL; +} + +void +defrUnsetNetCbk() +{ + DEF_INIT; + defContext.callbacks->NetCbk = NULL; +} + +void +defrUnsetNetNameCbk() +{ + DEF_INIT; + defContext.callbacks->NetNameCbk = NULL; +} + +void +defrUnsetNetNonDefaultRuleCbk() +{ + DEF_INIT; + defContext.callbacks->NetNonDefaultRuleCbk = NULL; +} + +void +defrUnsetNetConnectionExtCbk() +{ + DEF_INIT; + defContext.callbacks->NetConnectionExtCbk = NULL; +} + +void +defrUnsetNetExtCbk() +{ + DEF_INIT; + defContext.callbacks->NetExtCbk = NULL; +} + +void +defrUnsetNetPartialPathCbk() +{ + DEF_INIT; + defContext.callbacks->NetPartialPathCbk = NULL; +} + +void +defrUnsetNetSubnetNameCbk() +{ + DEF_INIT; + defContext.callbacks->NetSubnetNameCbk = NULL; +} + +void +defrUnsetNetStartCbk() +{ + DEF_INIT; + defContext.callbacks->NetStartCbk = NULL; +} + +void +defrUnsetNetEndCbk() +{ + DEF_INIT; + defContext.callbacks->NetEndCbk = NULL; +} + +void +defrUnsetNonDefaultCbk() +{ + DEF_INIT; + defContext.callbacks->NonDefaultCbk = NULL; +} + +void +defrUnsetNonDefaultStartCbk() +{ + DEF_INIT; + defContext.callbacks->NonDefaultStartCbk = NULL; +} + +void +defrUnsetNonDefaultEndCbk() +{ + DEF_INIT; + defContext.callbacks->NonDefaultEndCbk = NULL; +} + +void +defrUnsetPartitionCbk() +{ + DEF_INIT; + defContext.callbacks->PartitionCbk = NULL; +} + +void +defrUnsetPartitionsExtCbk() +{ + DEF_INIT; + defContext.callbacks->PartitionsExtCbk = NULL; +} + +void +defrUnsetPartitionsStartCbk() +{ + DEF_INIT; + defContext.callbacks->PartitionsStartCbk = NULL; +} + +void +defrUnsetPartitionsEndCbk() +{ + DEF_INIT; + defContext.callbacks->PartitionsEndCbk = NULL; +} + +void +defrUnsetPathCbk() +{ + DEF_INIT; + defContext.callbacks->PathCbk = NULL; +} + +void +defrUnsetPinCapCbk() +{ + DEF_INIT; + defContext.callbacks->PinCapCbk = NULL; +} + +void +defrUnsetPinCbk() +{ + DEF_INIT; + defContext.callbacks->PinCbk = NULL; +} + +void +defrUnsetPinEndCbk() +{ + DEF_INIT; + defContext.callbacks->PinEndCbk = NULL; +} + +void +defrUnsetPinExtCbk() +{ + DEF_INIT; + defContext.callbacks->PinExtCbk = NULL; +} + +void +defrUnsetPinPropCbk() +{ + DEF_INIT; + defContext.callbacks->PinPropCbk = NULL; +} + +void +defrUnsetPinPropStartCbk() +{ + DEF_INIT; + defContext.callbacks->PinPropStartCbk = NULL; +} + +void +defrUnsetPinPropEndCbk() +{ + DEF_INIT; + defContext.callbacks->PinPropEndCbk = NULL; +} + +void +defrUnsetPropCbk() +{ + DEF_INIT; + defContext.callbacks->PropCbk = NULL; +} + +void +defrUnsetPropDefEndCbk() +{ + DEF_INIT; + defContext.callbacks->PropDefEndCbk = NULL; +} + +void +defrUnsetPropDefStartCbk() +{ + DEF_INIT; + defContext.callbacks->PropDefStartCbk = NULL; +} + +void +defrUnsetRegionCbk() +{ + DEF_INIT; + defContext.callbacks->RegionCbk = NULL; +} + +void +defrUnsetRegionStartCbk() +{ + DEF_INIT; + defContext.callbacks->RegionStartCbk = NULL; +} + +void +defrUnsetRegionEndCbk() +{ + DEF_INIT; + defContext.callbacks->RegionEndCbk = NULL; +} + +void +defrUnsetRowCbk() +{ + DEF_INIT; + defContext.callbacks->RowCbk = NULL; +} + +void +defrUnsetScanChainExtCbk() +{ + DEF_INIT; + defContext.callbacks->ScanChainExtCbk = NULL; +} + +void +defrUnsetScanchainCbk() +{ + DEF_INIT; + defContext.callbacks->ScanchainCbk = NULL; +} + +void +defrUnsetScanchainsStartCbk() +{ + DEF_INIT; + defContext.callbacks->ScanchainsStartCbk = NULL; +} + +void +defrUnsetScanchainsEndCbk() +{ + DEF_INIT; + defContext.callbacks->ScanchainsEndCbk = NULL; +} + +void +defrUnsetSiteCbk() +{ + DEF_INIT; + defContext.callbacks->SiteCbk = NULL; +} + +void +defrUnsetSlotCbk() +{ + DEF_INIT; + defContext.callbacks->SlotCbk = NULL; +} + +void +defrUnsetSlotStartCbk() +{ + DEF_INIT; + defContext.callbacks->SlotStartCbk = NULL; +} + +void +defrUnsetSlotEndCbk() +{ + DEF_INIT; + defContext.callbacks->SlotEndCbk = NULL; +} + +void +defrUnsetSNetWireCbk() +{ + DEF_INIT; + defContext.callbacks->SNetWireCbk = NULL; +} + +void +defrUnsetSNetCbk() +{ + DEF_INIT; + defContext.callbacks->SNetCbk = NULL; +} + +void +defrUnsetSNetStartCbk() +{ + DEF_INIT; + defContext.callbacks->SNetStartCbk = NULL; +} + +void +defrUnsetSNetEndCbk() +{ + DEF_INIT; + defContext.callbacks->SNetEndCbk = NULL; +} + +void +defrUnsetSNetPartialPathCbk() +{ + DEF_INIT; + defContext.callbacks->SNetPartialPathCbk = NULL; +} + +void +defrUnsetStartPinsCbk() +{ + DEF_INIT; + defContext.callbacks->StartPinsCbk = NULL; +} + +void +defrUnsetStylesCbk() +{ + DEF_INIT; + defContext.callbacks->StylesCbk = NULL; +} + +void +defrUnsetStylesStartCbk() +{ + DEF_INIT; + defContext.callbacks->StylesStartCbk = NULL; +} + +void +defrUnsetStylesEndCbk() +{ + DEF_INIT; + defContext.callbacks->StylesEndCbk = NULL; +} + +void +defrUnsetTechnologyCbk() +{ + DEF_INIT; + defContext.callbacks->TechnologyCbk = NULL; +} + +void +defrUnsetTimingDisableCbk() +{ + DEF_INIT; + defContext.callbacks->TimingDisableCbk = NULL; +} + +void +defrUnsetTimingDisablesStartCbk() +{ + DEF_INIT; + defContext.callbacks->TimingDisablesStartCbk = NULL; +} + +void +defrUnsetTimingDisablesEndCbk() +{ + DEF_INIT; + defContext.callbacks->TimingDisablesEndCbk = NULL; +} + +void +defrUnsetTrackCbk() +{ + DEF_INIT; + defContext.callbacks->TrackCbk = NULL; +} + +void +defrUnsetUnitsCbk() +{ + DEF_INIT; + defContext.callbacks->UnitsCbk = NULL; +} + +void +defrUnsetVersionCbk() +{ + DEF_INIT; + defContext.callbacks->VersionCbk = NULL; +} + +void +defrUnsetVersionStrCbk() +{ + DEF_INIT; + defContext.callbacks->VersionStrCbk = NULL; +} + +void +defrUnsetViaCbk() +{ + DEF_INIT; + defContext.callbacks->ViaCbk = NULL; +} + +void +defrUnsetViaExtCbk() +{ + DEF_INIT; + defContext.callbacks->ViaExtCbk = NULL; +} + +void +defrUnsetViaStartCbk() +{ + DEF_INIT; + defContext.callbacks->ViaStartCbk = NULL; +} + + +void +defrUnsetViaEndCbk() +{ + DEF_INIT; + defContext.callbacks->ViaEndCbk = NULL; +} + +int * +defUnusedCallbackCount() +{ + DEF_INIT; + return defContext.settings->UnusedCallbacks; +} + + +const char * +defrFName() +{ + DEF_INIT; + return NULL; +} + +void +defrClearSession() +{ + if (defContext.session) { + delete defContext.session; + defContext.session = new defrSession(); + } +} + +int +defrRead(FILE *f, + const char *fName, + defiUserData uData, + int case_sensitive) +{ + + int status; + + delete defContext.data; + + defrData *defData = new defrData(defContext.callbacks, + defContext.settings, + defContext.session); + + defContext.data = defData; + + // lex_init + struct stat statbuf; + + /* 4/11/2003 - Remove file lefrRWarning.log from directory if it exist */ + /* pcr 569729 */ + if (stat("defRWarning.log", &statbuf) != -1) { + /* file exist, remove it */ + if (!defContext.settings->LogFileAppend) { + remove("defRWarning.log"); + } + } + + // Propagate Settings parameter to Data. + if (defData->settings->reader_case_sensitive_set) { + defData->names_case_sensitive = defData->session->reader_case_sensitive; + } else if (defData->VersionNum > 5.5) { + defData->names_case_sensitive = true; + } + + defData->session->FileName = (char*) fName; + defData->File = f; + defData->session->UserData = uData; + defData->session->reader_case_sensitive = case_sensitive; + + // Create a path pointer that is all ready to go just in case + // we need it later. + + defData->NeedPathData = ( + ((defData->callbacks->NetCbk || defData->callbacks->SNetCbk) && defData->settings->AddPathToNet) || defData->callbacks->PathCbk) ? 1 : 0; + if (defData->NeedPathData) { + defData->PathObj.Init(); + } + + status = defyyparse(defData); + + return status; +} + +void +defrSetUserData(defiUserData ud) +{ + DEF_INIT; + defContext.session->UserData = ud; +} + + +defiUserData +defrGetUserData() +{ + return defContext.session->UserData; +} + + +void +defrSetDesignCbk(defrStringCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->DesignCbk = f; +} + + +void +defrSetTechnologyCbk(defrStringCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->TechnologyCbk = f; +} + + +void +defrSetDesignEndCbk(defrVoidCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->DesignEndCbk = f; +} + + +void +defrSetPropCbk(defrPropCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->PropCbk = f; +} + + +void +defrSetPropDefEndCbk(defrVoidCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->PropDefEndCbk = f; +} + + +void +defrSetPropDefStartCbk(defrVoidCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->PropDefStartCbk = f; +} + + +void +defrSetArrayNameCbk(defrStringCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->ArrayNameCbk = f; +} + + +void +defrSetFloorPlanNameCbk(defrStringCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->FloorPlanNameCbk = f; +} + + +void +defrSetUnitsCbk(defrDoubleCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->UnitsCbk = f; +} + + +void +defrSetVersionCbk(defrDoubleCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->VersionCbk = f; +} + + +void +defrSetVersionStrCbk(defrStringCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->VersionStrCbk = f; +} + + +void +defrSetDividerCbk(defrStringCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->DividerCbk = f; +} + + +void +defrSetBusBitCbk(defrStringCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->BusBitCbk = f; +} + + +void +defrSetSiteCbk(defrSiteCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->SiteCbk = f; +} + + +void +defrSetCanplaceCbk(defrSiteCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->CanplaceCbk = f; +} + + +void +defrSetCannotOccupyCbk(defrSiteCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->CannotOccupyCbk = f; +} + + +void +defrSetComponentStartCbk(defrIntegerCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->ComponentStartCbk = f; +} + + +void +defrSetComponentEndCbk(defrVoidCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->ComponentEndCbk = f; +} + +void +defrSetComponentCbk(defrComponentCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->ComponentCbk = f; +} + +void +defrSetNetStartCbk(defrIntegerCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->NetStartCbk = f; +} + +void +defrSetNetEndCbk(defrVoidCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->NetEndCbk = f; +} + +void +defrSetNetCbk(defrNetCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->NetCbk = f; +} + +void +defrSetNetNameCbk(defrStringCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->NetNameCbk = f; +} + +void +defrSetNetSubnetNameCbk(defrStringCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->NetSubnetNameCbk = f; +} + +void +defrSetNetNonDefaultRuleCbk(defrStringCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->NetNonDefaultRuleCbk = f; +} + +void +defrSetNetPartialPathCbk(defrNetCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->NetPartialPathCbk = f; +} + +void +defrSetSNetStartCbk(defrIntegerCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->SNetStartCbk = f; +} + +void +defrSetSNetEndCbk(defrVoidCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->SNetEndCbk = f; +} + +void +defrSetSNetCbk(defrNetCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->SNetCbk = f; +} + +void +defrSetSNetPartialPathCbk(defrNetCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->SNetPartialPathCbk = f; +} + +void +defrSetSNetWireCbk(defrNetCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->SNetWireCbk = f; +} + +void +defrSetPathCbk(defrPathCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->PathCbk = f; +} + +void +defrSetAddPathToNet() +{ + DEF_INIT; + defContext.settings->AddPathToNet = 1; +} + +void +defrSetAllowComponentNets() +{ + DEF_INIT; + defContext.settings->AllowComponentNets = 1; +} + +int +defrGetAllowComponentNets() +{ + DEF_INIT; + return defContext.settings->AllowComponentNets; +} + + +void +defrSetComponentExtCbk(defrStringCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->ComponentExtCbk = f; +} + +void +defrSetPinExtCbk(defrStringCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->PinExtCbk = f; +} + +void +defrSetViaExtCbk(defrStringCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->ViaExtCbk = f; +} + +void +defrSetNetConnectionExtCbk(defrStringCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->NetConnectionExtCbk = f; +} + +void +defrSetNetExtCbk(defrStringCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->NetExtCbk = f; +} + +void +defrSetGroupExtCbk(defrStringCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->GroupExtCbk = f; +} + +void +defrSetScanChainExtCbk(defrStringCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->ScanChainExtCbk = f; +} + +void +defrSetIoTimingsExtCbk(defrStringCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->IoTimingsExtCbk = f; +} + +void +defrSetPartitionsExtCbk(defrStringCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->PartitionsExtCbk = f; +} + +void +defrSetHistoryCbk(defrStringCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->HistoryCbk = f; +} + +void +defrSetDieAreaCbk(defrBoxCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->DieAreaCbk = f; +} + +void +defrSetPinCapCbk(defrPinCapCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->PinCapCbk = f; +} + +void +defrSetPinEndCbk(defrVoidCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->PinEndCbk = f; +} + +void +defrSetStartPinsCbk(defrIntegerCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->StartPinsCbk = f; +} + +void +defrSetDefaultCapCbk(defrIntegerCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->DefaultCapCbk = f; +} + +void +defrSetPinCbk(defrPinCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->PinCbk = f; +} + +void +defrSetRowCbk(defrRowCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->RowCbk = f; +} + +void +defrSetTrackCbk(defrTrackCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->TrackCbk = f; +} + +void +defrSetGcellGridCbk(defrGcellGridCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->GcellGridCbk = f; +} + +void +defrSetViaStartCbk(defrIntegerCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->ViaStartCbk = f; +} + +void +defrSetViaEndCbk(defrVoidCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->ViaEndCbk = f; +} + +void +defrSetViaCbk(defrViaCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->ViaCbk = f; +} + +void +defrSetRegionStartCbk(defrIntegerCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->RegionStartCbk = f; +} + +void +defrSetRegionEndCbk(defrVoidCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->RegionEndCbk = f; +} + +void +defrSetRegionCbk(defrRegionCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->RegionCbk = f; +} + +void +defrSetGroupsStartCbk(defrIntegerCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->GroupsStartCbk = f; +} + +void +defrSetGroupsEndCbk(defrVoidCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->GroupsEndCbk = f; +} + +void +defrSetGroupNameCbk(defrStringCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->GroupNameCbk = f; +} + +void +defrSetGroupMemberCbk(defrStringCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->GroupMemberCbk = f; +} + +void +defrSetComponentMaskShiftLayerCbk(defrComponentMaskShiftLayerCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->ComponentMaskShiftLayerCbk = f; +} + +void +defrSetGroupCbk(defrGroupCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->GroupCbk = f; +} + +void +defrSetAssertionsStartCbk(defrIntegerCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->AssertionsStartCbk = f; +} + +void +defrSetAssertionsEndCbk(defrVoidCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->AssertionsEndCbk = f; +} + +void +defrSetAssertionCbk(defrAssertionCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->AssertionCbk = f; +} + +void +defrSetConstraintsStartCbk(defrIntegerCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->ConstraintsStartCbk = f; +} + +void +defrSetConstraintsEndCbk(defrVoidCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->ConstraintsEndCbk = f; +} + +void +defrSetConstraintCbk(defrAssertionCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->ConstraintCbk = f; +} + +void +defrSetScanchainsStartCbk(defrIntegerCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->ScanchainsStartCbk = f; +} + +void +defrSetScanchainsEndCbk(defrVoidCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->ScanchainsEndCbk = f; +} + +void +defrSetScanchainCbk(defrScanchainCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->ScanchainCbk = f; +} + +void +defrSetIOTimingsStartCbk(defrIntegerCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->IOTimingsStartCbk = f; +} + +void +defrSetIOTimingsEndCbk(defrVoidCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->IOTimingsEndCbk = f; +} + +void +defrSetIOTimingCbk(defrIOTimingCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->IOTimingCbk = f; +} + +void +defrSetFPCStartCbk(defrIntegerCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->FPCStartCbk = f; +} + +void +defrSetFPCEndCbk(defrVoidCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->FPCEndCbk = f; +} + +void +defrSetFPCCbk(defrFPCCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->FPCCbk = f; +} + +void +defrSetTimingDisablesStartCbk(defrIntegerCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->TimingDisablesStartCbk = f; +} + +void +defrSetTimingDisablesEndCbk(defrVoidCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->TimingDisablesEndCbk = f; +} + +void +defrSetTimingDisableCbk(defrTimingDisableCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->TimingDisableCbk = f; +} + +void +defrSetPartitionsStartCbk(defrIntegerCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->PartitionsStartCbk = f; +} + +void +defrSetPartitionsEndCbk(defrVoidCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->PartitionsEndCbk = f; +} + +void +defrSetPartitionCbk(defrPartitionCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->PartitionCbk = f; +} + +void +defrSetPinPropStartCbk(defrIntegerCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->PinPropStartCbk = f; +} + +void +defrSetPinPropEndCbk(defrVoidCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->PinPropEndCbk = f; +} + +void +defrSetPinPropCbk(defrPinPropCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->PinPropCbk = f; +} + +void +defrSetCaseSensitiveCbk(defrIntegerCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->CaseSensitiveCbk = f; +} + +void +defrSetBlockageStartCbk(defrIntegerCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->BlockageStartCbk = f; +} + +void +defrSetBlockageEndCbk(defrVoidCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->BlockageEndCbk = f; +} + +void +defrSetBlockageCbk(defrBlockageCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->BlockageCbk = f; +} + +void +defrSetSlotStartCbk(defrIntegerCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->SlotStartCbk = f; +} + +void +defrSetSlotEndCbk(defrVoidCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->SlotEndCbk = f; +} + +void +defrSetSlotCbk(defrSlotCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->SlotCbk = f; +} + +void +defrSetFillStartCbk(defrIntegerCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->FillStartCbk = f; +} + +void +defrSetFillEndCbk(defrVoidCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->FillEndCbk = f; +} + +void +defrSetFillCbk(defrFillCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->FillCbk = f; +} + +void +defrSetNonDefaultStartCbk(defrIntegerCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->NonDefaultStartCbk = f; +} + +void +defrSetNonDefaultEndCbk(defrVoidCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->NonDefaultEndCbk = f; +} + +void +defrSetNonDefaultCbk(defrNonDefaultCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->NonDefaultCbk = f; +} + +void +defrSetStylesStartCbk(defrIntegerCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->StylesStartCbk = f; +} + +void +defrSetStylesEndCbk(defrVoidCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->StylesEndCbk = f; +} + +void +defrSetStylesCbk(defrStylesCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->StylesCbk = f; +} + +void +defrSetExtensionCbk(defrStringCbkFnType f) +{ + DEF_INIT; + defContext.callbacks->ExtensionCbk = f; +} + +// NEW CALLBACK - Put the set functions for the new callbacks here. + +void +defrSetAssertionWarnings(int warn) +{ + DEF_INIT; + defContext.settings->AssertionWarnings = warn; +} + + +void +defrSetBlockageWarnings(int warn) +{ + DEF_INIT; + defContext.settings->BlockageWarnings = warn; +} + + +void +defrSetCaseSensitiveWarnings(int warn) +{ + DEF_INIT; + defContext.settings->CaseSensitiveWarnings = warn; +} + + +void +defrSetComponentWarnings(int warn) +{ + DEF_INIT; + defContext.settings->ComponentWarnings = warn; +} + + +void +defrSetConstraintWarnings(int warn) +{ + DEF_INIT; + defContext.settings->ConstraintWarnings = warn; +} + + +void +defrSetDefaultCapWarnings(int warn) +{ + DEF_INIT; + defContext.settings->DefaultCapWarnings = warn; +} + + +void +defrSetGcellGridWarnings(int warn) +{ + DEF_INIT; + defContext.settings->GcellGridWarnings = warn; +} + + +void +defrSetIOTimingWarnings(int warn) +{ + DEF_INIT; + defContext.settings->IOTimingWarnings = warn; +} + + +void +defrSetNetWarnings(int warn) +{ + DEF_INIT; + defContext.settings->NetWarnings = warn; +} + + +void +defrSetNonDefaultWarnings(int warn) +{ + DEF_INIT; + defContext.settings->NonDefaultWarnings = warn; +} + + +void +defrSetPinExtWarnings(int warn) +{ + DEF_INIT; + defContext.settings->PinExtWarnings = warn; +} + + +void +defrSetPinWarnings(int warn) +{ + DEF_INIT; + defContext.settings->PinWarnings = warn; +} + + +void +defrSetRegionWarnings(int warn) +{ + DEF_INIT; + defContext.settings->RegionWarnings = warn; +} + + +void +defrSetRowWarnings(int warn) +{ + DEF_INIT; + defContext.settings->RowWarnings = warn; +} + + +void +defrSetScanchainWarnings(int warn) +{ + DEF_INIT; + defContext.settings->ScanchainWarnings = warn; +} + + +void +defrSetSNetWarnings(int warn) +{ + DEF_INIT; + defContext.settings->SNetWarnings = warn; +} + + +void +defrSetStylesWarnings(int warn) +{ + DEF_INIT; + defContext.settings->StylesWarnings = warn; +} + + +void +defrSetTrackWarnings(int warn) +{ + DEF_INIT; + defContext.settings->TrackWarnings = warn; +} + + +void +defrSetUnitsWarnings(int warn) +{ + DEF_INIT; + defContext.settings->UnitsWarnings = warn; +} + + +void +defrSetVersionWarnings(int warn) +{ + DEF_INIT; + defContext.settings->VersionWarnings = warn; +} + + +void +defrSetViaWarnings(int warn) +{ + DEF_INIT; + defContext.settings->ViaWarnings = warn; +} + + +void +defrDisableParserMsgs(int nMsg, + int *msgs) +{ + DEF_INIT; + int i, j; + int *tmp; + + if (defContext.settings->nDDMsgs == 0) { + defContext.settings->nDDMsgs = nMsg; + defContext.settings->disableDMsgs = (int*) malloc(sizeof(int) * nMsg); + for (i = 0; i < nMsg; i++) + defContext.settings->disableDMsgs[i] = msgs[i]; + } else { // add the list to the existing list + // 1st check if the msgId is already on the list before adding it on + tmp = (int*) malloc(sizeof(int) * (nMsg + defContext.settings->nDDMsgs)); + for (i = 0; i < defContext.settings->nDDMsgs; i++) // copy the existing to the new list + tmp[i] = defContext.settings->disableDMsgs[i]; + free((int*) (defContext.settings->disableDMsgs)); + defContext.settings->disableDMsgs = tmp; // set disableDMsgs to the new list + for (i = 0; i < nMsg; i++) { // merge the new list with the existing + for (j = 0; j < defContext.settings->nDDMsgs; j++) { + if (defContext.settings->disableDMsgs[j] == msgs[i]) + break; // msgId already on the list + } + if (j == defContext.settings->nDDMsgs) // msgId not on the list, add it on + defContext.settings->disableDMsgs[defContext.settings->nDDMsgs++] = msgs[i]; + } + } + return; +} + + +void +defrEnableParserMsgs(int nMsg, + int *msgs) +{ + DEF_INIT; + int i, j; + + if (defContext.settings->nDDMsgs == 0) + return; // list is empty, nothing to remove + + for (i = 0; i < nMsg; i++) { // loop through the given list + for (j = 0; j < defContext.settings->nDDMsgs; j++) { + if (defContext.settings->disableDMsgs[j] == msgs[i]) { + defContext.settings->disableDMsgs[j] = -1; // temp assign a -1 on that slot + break; + } + } + } + // fill up the empty slot with the next non -1 msgId + for (i = 0; i < defContext.settings->nDDMsgs; i++) { + if (defContext.settings->disableDMsgs[i] == -1) { + j = i + 1; + while (j < defContext.settings->nDDMsgs) { + if (defContext.settings->disableDMsgs[j] != -1) + defContext.settings->disableDMsgs[i++] = defContext.settings->disableDMsgs[j++]; + } + break; // break out the for loop, the list should all moved + } + } + // Count how many messageId left and change all -1 to 0 + for (j = i; j < defContext.settings->nDDMsgs; j++) { + defContext.settings->disableDMsgs[j] = 0; // set to 0 + } + defContext.settings->nDDMsgs = i; + return; +} + + +void +defrEnableAllMsgs() +{ + DEF_INIT; + defContext.settings->nDDMsgs = 0; + free((int*) (defContext.settings->disableDMsgs)); +} + + +void +defrSetTotalMsgLimit(int totNumMsgs) +{ + DEF_INIT; + defContext.settings->totalDefMsgLimit = totNumMsgs; +} + + +void +defrSetLimitPerMsg(int msgId, + int numMsg) +{ + DEF_INIT; + char msgStr[10]; + + if ((msgId <= 0) || ((msgId - 5000) >= NODEFMSG)) { // Def starts at 5000 + sprintf(msgStr, "%d", msgId); + return; + } + defContext.settings->MsgLimit[msgId - 5000] = numMsg; + return; +} + + +// ***************************************************************** +// Utility functions +// +// These are utility functions. Note: this part still contains some +// global variables. Ideally they would be part of the main class. +// ***************************************************************** + +void +defrSetMagicCommentFoundFunction(DEFI_MAGIC_COMMENT_FOUND_FUNCTION f) +{ + DEF_INIT; + defContext.settings->MagicCommentFoundFunction = f; +} + + +void +defrSetMagicCommentString(char *s) +{ + DEF_INIT; + + free(defContext.data->magic); + defContext.data->magic = strdup(s); +} + +void +defrSetLogFunction(DEFI_LOG_FUNCTION f) +{ + DEF_INIT; + defContext.settings->ErrorLogFunction = f; +} + +void +defrSetWarningLogFunction(DEFI_WARNING_LOG_FUNCTION f) +{ + DEF_INIT; + defContext.settings->WarningLogFunction = f; +} + +void +defrSetContextLogFunction(DEFI_CONTEXT_LOG_FUNCTION f) +{ + DEF_INIT; + defContext.settings->ContextErrorLogFunction = f; +} + +void +defrSetContextWarningLogFunction(DEFI_CONTEXT_WARNING_LOG_FUNCTION f) +{ + DEF_INIT; + defContext.settings->ContextWarningLogFunction = f; +} + + +void +defrSetMallocFunction(DEFI_MALLOC_FUNCTION f) +{ + DEF_INIT; + defContext.settings->MallocFunction = f; +} + +void +defrSetReallocFunction(DEFI_REALLOC_FUNCTION f) +{ + DEF_INIT; + defContext.settings->ReallocFunction = f; +} + +void +defrSetFreeFunction(DEFI_FREE_FUNCTION f) +{ + DEF_INIT; + defContext.settings->FreeFunction = f; +} + +void +defrSetLineNumberFunction(DEFI_LINE_NUMBER_FUNCTION f) +{ + DEF_INIT; + defContext.settings->LineNumberFunction = f; +} + +void +defrSetLongLineNumberFunction(DEFI_LONG_LINE_NUMBER_FUNCTION f) +{ + DEF_INIT; + defContext.settings->LongLineNumberFunction = f; +} + + +void +defrSetDeltaNumberLines(int numLines) +{ + DEF_INIT; + defContext.settings->defiDeltaNumberLines = numLines; +} + + +void +defrSetCommentChar(char c) +{ + DEF_INIT; + defContext.settings->CommentChar = c; +} + +void +defrSetCaseSensitivity(int caseSense) +{ + DEF_INIT; + + defContext.settings->reader_case_sensitive_set = 1; + defContext.session->reader_case_sensitive = caseSense; + if (defContext.data) { + defContext.data->names_case_sensitive = caseSense; + } +} + + +void +defrAddAlias(const char *key, + const char *value, + int marked) +{ + // Since the alias data is stored in the hash table, the hash table + // only takes the key and the data, the marked data will be stored + // at the end of the value data + + defrData *defData = defContext.data ; + + char *k1; + char *v1; + int len = strlen(key) + 1; + k1 = (char*) malloc(len); + strcpy(k1, key); + len = strlen(value) + 1 + 1; // 1 for the marked + v1 = (char*) malloc(len); + //strcpy(v1, value); + if (marked != 0) + marked = 1; // make sure only 1 digit + sprintf(v1, "%d%s", marked, value); + + defData->def_alias_set[k1] = v1; + free(k1); + free(v1); +} + +void +defrSetOpenLogFileAppend() +{ + DEF_INIT; + defContext.settings->LogFileAppend = TRUE; +} + +void +defrUnsetOpenLogFileAppend() +{ + DEF_INIT; + defContext.settings->LogFileAppend = FALSE; +} + + +void +defrSetReadFunction(DEFI_READ_FUNCTION f) +{ + DEF_INIT; + defContext.settings->ReadFunction = f; +} + +void +defrUnsetReadFunction() +{ + DEF_INIT; + defContext.settings->ReadFunction = 0; +} + +void +defrDisablePropStrProcess() +{ + DEF_INIT; + defContext.settings->DisPropStrProcess = 1; +} + +void +defrSetNLines(long long n) +{ + defrData *defData = defContext.data; + + defData->nlines = n; +} + +int defrLineNumber() +{ + // Compatibility feature: in old versions the translators, + // the function can be called before defData initialization. + if (defContext.data) { + return (int)defContext.data->nlines; + } + + return 0; +} + +long long defrLongLineNumber() { + // Compatibility feature: in old versions the translators, + // the function can be called before defData initialization. + + if (defContext.data) { + return defContext.data->nlines; + } + + return (long long) 0; +} + +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defrReader.hpp b/src/def/def/defrReader.hpp new file mode 100644 index 00000000..bf80b204 --- /dev/null +++ b/src/def/def/defrReader.hpp @@ -0,0 +1,723 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013-2016, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef DEFRREADER_H +#define DEFRREADER_H + +#include + +#include "defiKRDefs.hpp" +#include "defiDefs.hpp" +#include "defiUser.hpp" + +#define DEF_MSGS 4013 +#define CBMAX 150 // Number of callbacks. + +BEGIN_LEFDEF_PARSER_NAMESPACE + +// An enum describing all of the types of reader callbacks. +typedef enum { + defrUnspecifiedCbkType = 0, + defrDesignStartCbkType, + defrTechNameCbkType, + defrPropCbkType, + defrPropDefEndCbkType, + defrPropDefStartCbkType, + defrFloorPlanNameCbkType, + defrArrayNameCbkType, + defrUnitsCbkType, + defrDividerCbkType, + defrBusBitCbkType, + defrSiteCbkType, + defrComponentStartCbkType, + defrComponentCbkType, + defrComponentEndCbkType, + defrNetStartCbkType, + defrNetCbkType, + defrNetNameCbkType, + defrNetNonDefaultRuleCbkType, + defrNetSubnetNameCbkType, + defrNetEndCbkType, + defrPathCbkType, + defrVersionCbkType, + defrVersionStrCbkType, + defrComponentExtCbkType, + defrPinExtCbkType, + defrViaExtCbkType, + defrNetConnectionExtCbkType, + defrNetExtCbkType, + defrGroupExtCbkType, + defrScanChainExtCbkType, + defrIoTimingsExtCbkType, + defrPartitionsExtCbkType, + defrHistoryCbkType, + defrDieAreaCbkType, + defrCanplaceCbkType, + defrCannotOccupyCbkType, + defrPinCapCbkType, + defrDefaultCapCbkType, + defrStartPinsCbkType, + defrPinCbkType, + defrPinEndCbkType, + defrRowCbkType, + defrTrackCbkType, + defrGcellGridCbkType, + defrViaStartCbkType, + defrViaCbkType, + defrViaEndCbkType, + defrRegionStartCbkType, + defrRegionCbkType, + defrRegionEndCbkType, + defrSNetStartCbkType, + defrSNetCbkType, + defrSNetPartialPathCbkType, + defrSNetWireCbkType, + defrSNetEndCbkType, + defrGroupsStartCbkType, + defrGroupNameCbkType, + defrGroupMemberCbkType, + defrGroupCbkType, + defrGroupsEndCbkType, + defrAssertionsStartCbkType, + defrAssertionCbkType, + defrAssertionsEndCbkType, + defrConstraintsStartCbkType, + defrConstraintCbkType, + defrConstraintsEndCbkType, + defrScanchainsStartCbkType, + defrScanchainCbkType, + defrScanchainsEndCbkType, + defrIOTimingsStartCbkType, + defrIOTimingCbkType, + defrIOTimingsEndCbkType, + defrFPCStartCbkType, + defrFPCCbkType, + defrFPCEndCbkType, + defrTimingDisablesStartCbkType, + defrTimingDisableCbkType, + defrTimingDisablesEndCbkType, + defrPartitionsStartCbkType, + defrPartitionCbkType, + defrPartitionsEndCbkType, + defrPinPropStartCbkType, + defrPinPropCbkType, + defrPinPropEndCbkType, + defrBlockageStartCbkType, + defrBlockageCbkType, + defrBlockageEndCbkType, + defrSlotStartCbkType, + defrSlotCbkType, + defrSlotEndCbkType, + defrFillStartCbkType, + defrFillCbkType, + defrFillEndCbkType, + defrCaseSensitiveCbkType, + defrNonDefaultStartCbkType, + defrNonDefaultCbkType, + defrNonDefaultEndCbkType, + defrStylesStartCbkType, + defrStylesCbkType, + defrStylesEndCbkType, + defrExtensionCbkType, + + // NEW CALLBACK - If you are creating a new callback, you must add + // a unique item to this enum for each callback routine. When the + // callback is called in def.y you have to supply this enum item + // as an argument in the call. + + defrComponentMaskShiftLayerCbkType, + defrDesignEndCbkType +} defrCallbackType_e; + + +// Declarations of function signatures for each type of callback. +// These declarations are type-safe when compiling with ANSI C +// or C++; you will only be able to register a function pointer +// with the correct signature for a given type of callback. +// +// Each callback function is expected to return 0 if successful. +// A non-zero return code will cause the reader to abort. +// +// The defrDesignStart and defrDesignEnd callback is only called once. +// Other callbacks may be called multiple times, each time with a different +// set of data. +// +// For each callback, the Def API will make the callback to the +// function supplied by the client, which should either make a copy +// of the Def object, or store the data in the client's own data structures. +// The Def API will delete or reuse each object after making the callback, +// so the client should not keep a pointer to it. +// +// All callbacks pass the user data pointer provided in defrRead() +// or defrSetUserData() back to the client; this can be used by the +// client to obtain access to the rest of the client's data structures. +// +// The user data pointer is obtained using defrGetUserData() immediately +// prior to making each callback, so the client is free to change the +// user data on the fly if necessary. +// +// Callbacks with the same signature are passed a callback type +// parameter, which allows an application to write a single callback +// function, register that function for multiple callbacks, then +// switch based on the callback type to handle the appropriate type of +// data. + + +// A declaration of the signature of all callbacks that return nothing. +typedef int (*defrVoidCbkFnType) (defrCallbackType_e, void* v, defiUserData); + +// A declaration of the signature of all callbacks that return a string. +typedef int (*defrStringCbkFnType) (defrCallbackType_e, const char *string, defiUserData); + +// A declaration of the signature of all callbacks that return a integer. +typedef int (*defrIntegerCbkFnType) (defrCallbackType_e, int number, defiUserData); + +// A declaration of the signature of all callbacks that return a double. +typedef int (*defrDoubleCbkFnType) (defrCallbackType_e, double number, defiUserData); + +// A declaration of the signature of all callbacks that return a defiProp. +typedef int (*defrPropCbkFnType) (defrCallbackType_e, defiProp *prop, defiUserData); + +// A declaration of the signature of all callbacks that return a defiSite. +typedef int (*defrSiteCbkFnType) (defrCallbackType_e, defiSite *site, defiUserData); + +// A declaration of the signature of all callbacks that return a defComponent. +typedef int (*defrComponentCbkFnType) (defrCallbackType_e, defiComponent *comp, defiUserData); + +// A declaration of the signature of all callbacks that return a defComponentMaskShiftLayer. +typedef int (*defrComponentMaskShiftLayerCbkFnType) (defrCallbackType_e, defiComponentMaskShiftLayer *comp, defiUserData); + +// A declaration of the signature of all callbacks that return a defNet. +typedef int (*defrNetCbkFnType) (defrCallbackType_e, defiNet *net, defiUserData); + +// A declaration of the signature of all callbacks that return a defPath. +typedef int (*defrPathCbkFnType) (defrCallbackType_e, defiPath *path, defiUserData); + +// A declaration of the signature of all callbacks that return a defiBox. +typedef int (*defrBoxCbkFnType) (defrCallbackType_e, defiBox *box, defiUserData); + + +// A declaration of the signature of all callbacks that return a defiPinCap. +typedef int (*defrPinCapCbkFnType) (defrCallbackType_e, defiPinCap *pincap, defiUserData); + + +// A declaration of the signature of all callbacks that return a defiPin. +typedef int (*defrPinCbkFnType) (defrCallbackType_e, defiPin *pin, defiUserData); + + +// A declaration of the signature of all callbacks that return a defiRow. +typedef int (*defrRowCbkFnType) (defrCallbackType_e, defiRow *row, defiUserData); + + +// A declaration of the signature of all callbacks that return a defiTrack. +typedef int (*defrTrackCbkFnType) (defrCallbackType_e, defiTrack *track, defiUserData); + + +// A declaration of the signature of all callbacks that return a defiGcellGrid. +typedef int (*defrGcellGridCbkFnType) (defrCallbackType_e, defiGcellGrid *grid, defiUserData); + + +// A declaration of the signature of all callbacks that return a defiVia. +typedef int (*defrViaCbkFnType) (defrCallbackType_e, defiVia *, defiUserData); + + +// A declaration of the signature of all callbacks that return a defiRegion. +typedef int (*defrRegionCbkFnType) (defrCallbackType_e, defiRegion *, defiUserData); + + +// A declaration of the signature of all callbacks that return a defiGroup. +typedef int (*defrGroupCbkFnType) (defrCallbackType_e, defiGroup *, defiUserData); + + +// A declaration of the signature of all callbacks that return a defiAssertion. +typedef int (*defrAssertionCbkFnType) (defrCallbackType_e, defiAssertion *, defiUserData); + + +// A declaration of the signature of all callbacks that return a defiScanChain. +typedef int (*defrScanchainCbkFnType) (defrCallbackType_e, defiScanchain *, defiUserData); + + +// A declaration of the signature of all callbacks that return a defiIOTiming. +typedef int (*defrIOTimingCbkFnType) (defrCallbackType_e, defiIOTiming *, defiUserData); + + +// A declaration of the signature of all callbacks that return a defiFPC. +typedef int (*defrFPCCbkFnType) (defrCallbackType_e, defiFPC *, defiUserData); + + +// A declaration of the signature of all callbacks that return a defiTimingDisable. +typedef int (*defrTimingDisableCbkFnType) (defrCallbackType_e, defiTimingDisable *, defiUserData); + + +// A declaration of the signature of all callbacks that return a defiPartition. +typedef int (*defrPartitionCbkFnType) (defrCallbackType_e, defiPartition *, defiUserData); + +// A declaration of the signature of all callbacks that return a defiPinProp. +typedef int (*defrPinPropCbkFnType) (defrCallbackType_e, defiPinProp *, defiUserData); + +// A declaration of the signature of all callbacks that return a defiBlockage. +typedef int (*defrBlockageCbkFnType) (defrCallbackType_e, defiBlockage *, defiUserData); + +// A declaration of the signature of all callbacks that return a defiSlot. +typedef int (*defrSlotCbkFnType) (defrCallbackType_e, defiSlot *, defiUserData); + +// A declaration of the signature of all callbacks that return a defiFill. +typedef int (*defrFillCbkFnType) (defrCallbackType_e, defiFill *, defiUserData); + +// A declaration of the signature of all callbacks that return a defiNonDefault. +typedef int (*defrNonDefaultCbkFnType) (defrCallbackType_e, defiNonDefault *, defiUserData); + +// A declaration of the signature of all callbacks that return a defiStyles. +typedef int (*defrStylesCbkFnType) (defrCallbackType_e, defiStyles *, defiUserData); + +// NEW CALLBACK - Each callback must return user data, enum, and +// OUR-DATA item. We must define a callback function type for +// each type of OUR-DATA. Some routines return a string, some +// return an integer, and some return a pointer to a class. +// If you create a new class, then you must create a new function +// type here to return that class to the user. + +// The reader initialization. Must be called before defrRead(). +extern int defrInit (); +extern int defrInitSession (int startSession = 1); + +// obsoleted now. +extern int defrReset (); + +//Sets all parser memory into init state. +extern int defrClear(); + +// Change the comment character in the DEF file. The default +// is '#' +extern void defrSetCommentChar (char c); + +// Functions to call to set specific actions in the parser. +extern void defrSetAddPathToNet (); +extern void defrSetAllowComponentNets (); +extern int defrGetAllowComponentNets (); +extern void defrSetCaseSensitivity (int caseSense); + +// Functions to keep track of callbacks that the user did not +// supply. Normally all parts of the DEF file that the user +// does not supply a callback for will be ignored. These +// routines tell the parser count the DEF constructs that are +// present in the input file, but did not trigger a callback. +// This should help you find any "important" DEF constructs that +// you are ignoring. +extern void defrSetRegisterUnusedCallbacks (); +extern void defrPrintUnusedCallbacks (FILE* log); +// Obsoleted now. +extern int defrReleaseNResetMemory (); + +// This function clear session data. +extern void defrClearSession(); + +// The main reader function. +// The file should already be opened. This requirement allows +// the reader to be used with stdin or a pipe. The file name +// is only used for error messages. +extern int defrRead (FILE *file, + const char *fileName, + defiUserData userData, + int case_sensitive); + +// Set/get the client-provided user data. defi doesn't look at +// this data at all, it simply passes the opaque defiUserData pointer +// back to the application with each callback. The client can +// change the data at any time, and it will take effect on the +// next callback. The defi reader and writer maintain separate +// user data pointers. +extern void defrSetUserData (defiUserData); +extern defiUserData defrGetUserData (); + + +// Functions to call to register a callback function or get the function +//pointer after it has been registered. +// + +// Register one function for all callbacks with the same signature +extern void defrSetArrayNameCbk (defrStringCbkFnType); +extern void defrSetAssertionCbk (defrAssertionCbkFnType); +extern void defrSetAssertionsStartCbk (defrIntegerCbkFnType); +extern void defrSetAssertionsEndCbk (defrVoidCbkFnType); +extern void defrSetBlockageCbk (defrBlockageCbkFnType); +extern void defrSetBlockageStartCbk (defrIntegerCbkFnType); +extern void defrSetBlockageEndCbk (defrVoidCbkFnType); +extern void defrSetBusBitCbk (defrStringCbkFnType); +extern void defrSetCannotOccupyCbk (defrSiteCbkFnType); +extern void defrSetCanplaceCbk (defrSiteCbkFnType); +extern void defrSetCaseSensitiveCbk (defrIntegerCbkFnType); +extern void defrSetComponentCbk (defrComponentCbkFnType); +extern void defrSetComponentExtCbk (defrStringCbkFnType); +extern void defrSetComponentStartCbk (defrIntegerCbkFnType); +extern void defrSetComponentEndCbk (defrVoidCbkFnType); +extern void defrSetConstraintCbk (defrAssertionCbkFnType); +extern void defrSetConstraintsStartCbk (defrIntegerCbkFnType); +extern void defrSetConstraintsEndCbk (defrVoidCbkFnType); +extern void defrSetDefaultCapCbk (defrIntegerCbkFnType); +extern void defrSetDesignCbk (defrStringCbkFnType); +extern void defrSetDesignEndCbk (defrVoidCbkFnType); +extern void defrSetDieAreaCbk (defrBoxCbkFnType); +extern void defrSetDividerCbk (defrStringCbkFnType); +extern void defrSetExtensionCbk (defrStringCbkFnType); +extern void defrSetFillCbk (defrFillCbkFnType); +extern void defrSetFillStartCbk (defrIntegerCbkFnType); +extern void defrSetFillEndCbk (defrVoidCbkFnType); +extern void defrSetFPCCbk (defrFPCCbkFnType); +extern void defrSetFPCStartCbk (defrIntegerCbkFnType); +extern void defrSetFPCEndCbk (defrVoidCbkFnType); +extern void defrSetFloorPlanNameCbk (defrStringCbkFnType); +extern void defrSetGcellGridCbk (defrGcellGridCbkFnType); +extern void defrSetGroupNameCbk (defrStringCbkFnType); +extern void defrSetGroupMemberCbk (defrStringCbkFnType); +extern void defrSetComponentMaskShiftLayerCbk (defrComponentMaskShiftLayerCbkFnType); +extern void defrSetGroupCbk (defrGroupCbkFnType); +extern void defrSetGroupExtCbk (defrStringCbkFnType); +extern void defrSetGroupsStartCbk (defrIntegerCbkFnType); +extern void defrSetGroupsEndCbk (defrVoidCbkFnType); +extern void defrSetHistoryCbk (defrStringCbkFnType); +extern void defrSetIOTimingCbk (defrIOTimingCbkFnType); +extern void defrSetIOTimingsStartCbk (defrIntegerCbkFnType); +extern void defrSetIOTimingsEndCbk (defrVoidCbkFnType); +extern void defrSetIoTimingsExtCbk (defrStringCbkFnType); +extern void defrSetNetCbk (defrNetCbkFnType); +extern void defrSetNetNameCbk (defrStringCbkFnType); +extern void defrSetNetNonDefaultRuleCbk (defrStringCbkFnType); +extern void defrSetNetConnectionExtCbk (defrStringCbkFnType); +extern void defrSetNetExtCbk (defrStringCbkFnType); +extern void defrSetNetPartialPathCbk (defrNetCbkFnType); +extern void defrSetNetSubnetNameCbk (defrStringCbkFnType); +extern void defrSetNetStartCbk (defrIntegerCbkFnType); +extern void defrSetNetEndCbk (defrVoidCbkFnType); +extern void defrSetNonDefaultCbk (defrNonDefaultCbkFnType); +extern void defrSetNonDefaultStartCbk (defrIntegerCbkFnType); +extern void defrSetNonDefaultEndCbk (defrVoidCbkFnType); +extern void defrSetPartitionCbk (defrPartitionCbkFnType); +extern void defrSetPartitionsExtCbk (defrStringCbkFnType); +extern void defrSetPartitionsStartCbk (defrIntegerCbkFnType); +extern void defrSetPartitionsEndCbk (defrVoidCbkFnType); +extern void defrSetPathCbk (defrPathCbkFnType); +extern void defrSetPinCapCbk (defrPinCapCbkFnType); +extern void defrSetPinCbk (defrPinCbkFnType); +extern void defrSetPinExtCbk (defrStringCbkFnType); +extern void defrSetPinPropCbk (defrPinPropCbkFnType); +extern void defrSetPinPropStartCbk (defrIntegerCbkFnType); +extern void defrSetPinPropEndCbk (defrVoidCbkFnType); +extern void defrSetPropCbk (defrPropCbkFnType); +extern void defrSetPropDefEndCbk (defrVoidCbkFnType); +extern void defrSetPropDefStartCbk (defrVoidCbkFnType); +extern void defrSetRegionCbk (defrRegionCbkFnType); +extern void defrSetRegionStartCbk (defrIntegerCbkFnType); +extern void defrSetRegionEndCbk (defrVoidCbkFnType); +extern void defrSetRowCbk (defrRowCbkFnType); +extern void defrSetSNetCbk (defrNetCbkFnType); +extern void defrSetSNetStartCbk (defrIntegerCbkFnType); +extern void defrSetSNetEndCbk (defrVoidCbkFnType); +extern void defrSetSNetPartialPathCbk (defrNetCbkFnType); +extern void defrSetSNetWireCbk (defrNetCbkFnType); +extern void defrSetScanChainExtCbk (defrStringCbkFnType); +extern void defrSetScanchainCbk (defrScanchainCbkFnType); +extern void defrSetScanchainsStartCbk (defrIntegerCbkFnType); +extern void defrSetScanchainsEndCbk (defrVoidCbkFnType); +extern void defrSetSiteCbk (defrSiteCbkFnType); +extern void defrSetSlotCbk (defrSlotCbkFnType); +extern void defrSetSlotStartCbk (defrIntegerCbkFnType); +extern void defrSetSlotEndCbk (defrVoidCbkFnType); +extern void defrSetStartPinsCbk (defrIntegerCbkFnType); +extern void defrSetStylesCbk (defrStylesCbkFnType); +extern void defrSetStylesStartCbk (defrIntegerCbkFnType); +extern void defrSetStylesEndCbk (defrVoidCbkFnType); +extern void defrSetPinEndCbk (defrVoidCbkFnType); +extern void defrSetTechnologyCbk (defrStringCbkFnType); +extern void defrSetTimingDisableCbk (defrTimingDisableCbkFnType); +extern void defrSetTimingDisablesStartCbk (defrIntegerCbkFnType); +extern void defrSetTimingDisablesEndCbk (defrVoidCbkFnType); +extern void defrSetTrackCbk (defrTrackCbkFnType); +extern void defrSetUnitsCbk (defrDoubleCbkFnType); +extern void defrSetVersionCbk (defrDoubleCbkFnType); +extern void defrSetVersionStrCbk (defrStringCbkFnType); +extern void defrSetViaCbk (defrViaCbkFnType); +extern void defrSetViaExtCbk (defrStringCbkFnType); +extern void defrSetViaStartCbk (defrIntegerCbkFnType); +extern void defrSetViaEndCbk (defrVoidCbkFnType); + +// NEW CALLBACK - For each new callback you create, you must +// create a routine that allows the user to set it. Add the +// setting routines here. + +//Set all of the callbacks that have not yet been set to the following +//function. This is especially useful if you want to check to see +//if you forgot anything. +extern void defrUnsetCallbacks (); + +// Functions to call to unregister a callback function. +extern void defrUnsetArrayNameCbk (); +extern void defrUnsetAssertionCbk (); +extern void defrUnsetAssertionsStartCbk (); +extern void defrUnsetAssertionsEndCbk (); +extern void defrUnsetBlockageCbk (); +extern void defrUnsetBlockageStartCbk (); +extern void defrUnsetBlockageEndCbk (); +extern void defrUnsetBusBitCbk (); +extern void defrUnsetCannotOccupyCbk (); +extern void defrUnsetCanplaceCbk (); +extern void defrUnsetCaseSensitiveCbk (); +extern void defrUnsetComponentCbk (); +extern void defrUnsetComponentExtCbk (); +extern void defrUnsetComponentStartCbk (); +extern void defrUnsetComponentEndCbk (); +extern void defrUnsetConstraintCbk (); +extern void defrUnsetConstraintsStartCbk (); +extern void defrUnsetConstraintsEndCbk (); +extern void defrUnsetDefaultCapCbk (); +extern void defrUnsetDesignCbk (); +extern void defrUnsetDesignEndCbk (); +extern void defrUnsetDieAreaCbk (); +extern void defrUnsetDividerCbk (); +extern void defrUnsetExtensionCbk (); +extern void defrUnsetFillCbk (); +extern void defrUnsetFillStartCbk (); +extern void defrUnsetFillEndCbk (); +extern void defrUnsetFPCCbk (); +extern void defrUnsetFPCStartCbk (); +extern void defrUnsetFPCEndCbk (); +extern void defrUnsetFloorPlanNameCbk (); +extern void defrUnsetGcellGridCbk (); +extern void defrUnsetGroupCbk (); +extern void defrUnsetGroupExtCbk (); +extern void defrUnsetGroupMemberCbk (); +extern void defrUnsetComponentMaskShiftLayerCbk (); +extern void defrUnsetGroupNameCbk (); +extern void defrUnsetGroupsStartCbk (); +extern void defrUnsetGroupsEndCbk (); +extern void defrUnsetHistoryCbk (); +extern void defrUnsetIOTimingCbk (); +extern void defrUnsetIOTimingsStartCbk (); +extern void defrUnsetIOTimingsEndCbk (); +extern void defrUnsetIOTimingsExtCbk (); +extern void defrUnsetNetCbk (); +extern void defrUnsetNetNameCbk (); +extern void defrUnsetNetNonDefaultRuleCbk (); +extern void defrUnsetNetConnectionExtCbk (); +extern void defrUnsetNetExtCbk (); +extern void defrUnsetNetPartialPathCbk (); +extern void defrUnsetNetSubnetNameCbk (); +extern void defrUnsetNetStartCbk (); +extern void defrUnsetNetEndCbk (); +extern void defrUnsetNonDefaultCbk (); +extern void defrUnsetNonDefaultStartCbk (); +extern void defrUnsetNonDefaultEndCbk (); +extern void defrUnsetPartitionCbk (); +extern void defrUnsetPartitionsExtCbk (); +extern void defrUnsetPartitionsStartCbk (); +extern void defrUnsetPartitionsEndCbk (); +extern void defrUnsetPathCbk (); +extern void defrUnsetPinCapCbk (); +extern void defrUnsetPinCbk (); +extern void defrUnsetPinEndCbk (); +extern void defrUnsetPinExtCbk (); +extern void defrUnsetPinPropCbk (); +extern void defrUnsetPinPropStartCbk (); +extern void defrUnsetPinPropEndCbk (); +extern void defrUnsetPropCbk (); +extern void defrUnsetPropDefEndCbk (); +extern void defrUnsetPropDefStartCbk (); +extern void defrUnsetRegionCbk (); +extern void defrUnsetRegionStartCbk (); +extern void defrUnsetRegionEndCbk (); +extern void defrUnsetRowCbk (); +extern void defrUnsetScanChainExtCbk (); +extern void defrUnsetScanchainCbk (); +extern void defrUnsetScanchainsStartCbk (); +extern void defrUnsetScanchainsEndCbk (); +extern void defrUnsetSiteCbk (); +extern void defrUnsetSlotCbk (); +extern void defrUnsetSlotStartCbk (); +extern void defrUnsetSlotEndCbk (); +extern void defrUnsetSNetWireCbk (); +extern void defrUnsetSNetCbk (); +extern void defrUnsetSNetStartCbk (); +extern void defrUnsetSNetEndCbk (); +extern void defrUnsetSNetPartialPathCbk (); +extern void defrUnsetStartPinsCbk (); +extern void defrUnsetStylesCbk (); +extern void defrUnsetStylesStartCbk (); +extern void defrUnsetStylesEndCbk (); +extern void defrUnsetTechnologyCbk (); +extern void defrUnsetTimingDisableCbk (); +extern void defrUnsetTimingDisablesStartCbk (); +extern void defrUnsetTimingDisablesEndCbk (); +extern void defrUnsetTrackCbk (); +extern void defrUnsetUnitsCbk (); +extern void defrUnsetVersionCbk (); +extern void defrUnsetVersionStrCbk (); +extern void defrUnsetViaCbk (); +extern void defrUnsetViaExtCbk (); +extern void defrUnsetViaStartCbk (); +extern void defrUnsetViaEndCbk (); + +// Routine to set all unused callbacks. This is useful for checking +//to see if you missed something. +extern void defrSetUnusedCallbacks (defrVoidCbkFnType func); + +// Return the current line number in the input file. +extern int defrLineNumber (); +extern long long defrLongLineNumber (); + +// Routine to set the message logging routine for errors +#ifndef DEFI_LOG_FUNCTION + typedef void (*DEFI_LOG_FUNCTION) (const char*); +#endif +extern void defrSetLogFunction(DEFI_LOG_FUNCTION); + +// Routine to set the message logging routine for warnings +#ifndef DEFI_WARNING_LOG_FUNCTION + typedef void (*DEFI_WARNING_LOG_FUNCTION) (const char*); +#endif +extern void defrSetWarningLogFunction(DEFI_WARNING_LOG_FUNCTION); + +// Routine to set the message logging routine for errors +// Used in re-enterable environment. +#ifndef DEFI_LOG_FUNCTION + typedef void (*DEFI_CONTEXT_LOG_FUNCTION) (defiUserData userData, const char*); +#endif +extern void defrSetContextLogFunction(DEFI_CONTEXT_LOG_FUNCTION); + +// Routine to set the message logging routine for warnings +// Used in re-enterable environment. +#ifndef DEFI_WARNING_LOG_FUNCTION + typedef void (*DEFI_CONTEXT_WARNING_LOG_FUNCTION) (defiUserData userData, const char*); +#endif +extern void defrSetContextWarningLogFunction(DEFI_CONTEXT_WARNING_LOG_FUNCTION); + +// Routine to set the user defined malloc routine +typedef void* (*DEFI_MALLOC_FUNCTION) (size_t); +extern void defrSetMallocFunction(DEFI_MALLOC_FUNCTION); + +// Routine to set the user defined realloc routine +typedef void* (*DEFI_REALLOC_FUNCTION) (void*, size_t); +extern void defrSetReallocFunction(DEFI_REALLOC_FUNCTION); + +// Routine to set the user defined free routine +typedef void (*DEFI_FREE_FUNCTION) (void *); +extern void defrSetFreeFunction(DEFI_FREE_FUNCTION); + +// Routine to set the line number of the file that is parsing routine (takes int) +typedef void (*DEFI_LINE_NUMBER_FUNCTION) (int); +extern void defrSetLineNumberFunction(DEFI_LINE_NUMBER_FUNCTION); + +// Routine to set the line number of the file that is parsing routine (takes long long) +typedef void (*DEFI_LONG_LINE_NUMBER_FUNCTION) (long long); +extern void defrSetLongLineNumberFunction(DEFI_LONG_LINE_NUMBER_FUNCTION); + +// Routine to set the line number of the file that is parsing routine (takes int) +// Used in re-enterable environment. +typedef void (*DEFI_CONTEXT_LINE_NUMBER_FUNCTION) (defiUserData userData, int); +extern void defrSetContextLineNumberFunction(DEFI_CONTEXT_LINE_NUMBER_FUNCTION); + +// Routine to set the line number of the file that is parsing routine (takes long long +// Used in re-enterable environment. +typedef void (*DEFI_CONTEXT_LONG_LINE_NUMBER_FUNCTION) (defiUserData userData, long long); +extern void defrSetContextLongLineNumberFunction(DEFI_CONTEXT_LONG_LINE_NUMBER_FUNCTION); + +// Set the number of lines before calling the line function callback routine +// Default is 10000 +extern void defrSetDeltaNumberLines (int); + +// Routine to set the read function +typedef size_t (*DEFI_READ_FUNCTION) (FILE*, char*, size_t); +extern void defrSetReadFunction(DEFI_READ_FUNCTION); +extern void defrUnsetReadFunction (); + +// Routine to set the defrWarning.log to open as append instead for write +// New in 5.7 +extern void defrSetOpenLogFileAppend (); +extern void defrUnsetOpenLogFileAppend (); + +// Routine to set the magic comment found routine +typedef void (*DEFI_MAGIC_COMMENT_FOUND_FUNCTION) (); +extern void defrSetMagicCommentFoundFunction(DEFI_MAGIC_COMMENT_FOUND_FUNCTION); + +// Routine to set the magic comment string +extern void defrSetMagicCommentString(char *); + +// Routine to disable string property value process, default it will process +// the value string +extern void defrDisablePropStrProcess (); + +// Testing purposes only +extern void defrSetNLines(long long n); + +// Routine to set the max number of warnings for a perticular section + +extern void defrSetAssertionWarnings(int warn); +extern void defrSetBlockageWarnings(int warn); +extern void defrSetCaseSensitiveWarnings(int warn); +extern void defrSetComponentWarnings(int warn); +extern void defrSetConstraintWarnings(int warn); +extern void defrSetDefaultCapWarnings(int warn); +extern void defrSetGcellGridWarnings(int warn); +extern void defrSetIOTimingWarnings(int warn); +extern void defrSetNetWarnings(int warn); +extern void defrSetNonDefaultWarnings(int warn); +extern void defrSetPinExtWarnings(int warn); +extern void defrSetPinWarnings(int warn); +extern void defrSetRegionWarnings(int warn); +extern void defrSetRowWarnings(int warn); +extern void defrSetScanchainWarnings(int warn); +extern void defrSetSNetWarnings(int warn); +extern void defrSetStylesWarnings(int warn); +extern void defrSetTrackWarnings(int warn); +extern void defrSetUnitsWarnings(int warn); +extern void defrSetVersionWarnings(int warn); +extern void defrSetViaWarnings(int warn); + +// Handling output messages +extern void defrDisableParserMsgs(int nMsg, int* msgs); +extern void defrEnableParserMsgs(int nMsg, int* msgs); +extern void defrEnableAllMsgs(); +extern void defrSetTotalMsgLimit(int totNumMsgs); +extern void defrSetLimitPerMsg(int msgId, int numMsg); + +// Return codes for the user callbacks. +//The user should return one of these values. +#define PARSE_OK 0 // continue parsing +#define STOP_PARSE 1 // stop parsing with no error message +#define PARSE_ERROR 2 // stop parsing, print an error message + +// Add this alias to the list for the parser +extern void defrAddAlias (const char* key, + const char* value, + int marked); + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defrSettings.cpp b/src/def/def/defrSettings.cpp new file mode 100644 index 00000000..98ed6efc --- /dev/null +++ b/src/def/def/defrSettings.cpp @@ -0,0 +1,343 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013 - 2014, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: arakhman $ +// $Revision: #6 $ +// $Date: 2013/08/09 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** +#include "defrSettings.hpp" +#include "def.tab.h" + +using namespace std; + +BEGIN_LEFDEF_PARSER_NAMESPACE + +defrSettings *defSettings = NULL; + +defrSettings::defrSettings() +: defiDeltaNumberLines(10000), + AssertionWarnings(999), + BlockageWarnings(999), + CaseSensitiveWarnings(999), + ComponentWarnings(999), + ConstraintWarnings(999), + DefaultCapWarnings(999), + FillWarnings(999), + GcellGridWarnings(999), + IOTimingWarnings(999), + LogFileAppend(0), + NetWarnings(999), + NonDefaultWarnings(999), + PinExtWarnings(999), + PinWarnings(999), + RegionWarnings(999), + RowWarnings(999), + TrackWarnings(999), + ScanchainWarnings(999), + SNetWarnings(999), + StylesWarnings(999), + UnitsWarnings(999), + VersionWarnings(999), + ViaWarnings(999), + nDDMsgs(0), + disableDMsgs(NULL), + totalDefMsgLimit(0), + AddPathToNet(0), + AllowComponentNets(0), + CommentChar('#'), + DisPropStrProcess(0), + reader_case_sensitive_set(0), + ReadFunction(NULL), + ErrorLogFunction(NULL), + WarningLogFunction(NULL), + ContextErrorLogFunction(NULL), + ContextWarningLogFunction(NULL), + MagicCommentFoundFunction(NULL), + MallocFunction(NULL), + ReallocFunction(NULL), + FreeFunction(NULL), + LineNumberFunction(NULL), + LongLineNumberFunction(NULL), + ContextLineNumberFunction(NULL), + ContextLongLineNumberFunction(NULL) +{ + memset(MsgLimit, 0, DEF_MSGS * sizeof(int)); + memset(UnusedCallbacks, 0, CBMAX * sizeof(int)); + + init_symbol_table(); +} + + +void +defrSettings::init_symbol_table() +{ + Keyword_set["ALIGN"] = K_ALIGN; + Keyword_set["ANALOG"] = K_ANALOG; + Keyword_set["ANTENNAMODEL"] = K_ANTENNAMODEL; + Keyword_set["ANTENNAPINGATEAREA"] = K_ANTENNAPINGATEAREA; + Keyword_set["ANTENNAPINDIFFAREA"] = K_ANTENNAPINDIFFAREA; + Keyword_set["ANTENNAPINMAXAREACAR"] = K_ANTENNAPINMAXAREACAR; + Keyword_set["ANTENNAPINMAXCUTCAR"] = K_ANTENNAPINMAXCUTCAR; + Keyword_set["ANTENNAPINMAXSIDEAREACAR"] = K_ANTENNAPINMAXSIDEAREACAR; + Keyword_set["ANTENNAPINPARTIALCUTAREA"] = K_ANTENNAPINPARTIALCUTAREA; + Keyword_set["ANTENNAPINPARTIALMETALAREA"] = K_ANTENNAPINPARTIALMETALAREA; + Keyword_set["ANTENNAPINPARTIALMETALSIDEAREA"] = K_ANTENNAPINPARTIALMETALSIDEAREA; + Keyword_set["ARRAY"] = K_ARRAY; + Keyword_set["ASSERTIONS"] = K_ASSERTIONS; + Keyword_set["BALANCED"] = K_BALANCED; + Keyword_set["BEGINEXT"] = K_BEGINEXT; + Keyword_set["BLOCKAGES"] = K_BLOCKAGES; + Keyword_set["BLOCKAGEWIRE"] = K_BLOCKAGEWIRE; + Keyword_set["BLOCKRING"] = K_BLOCKRING; + Keyword_set["BLOCKWIRE"] = K_BLOCKWIRE; + Keyword_set["BOTTOMLEFT"] = K_BOTTOMLEFT; + Keyword_set["BUSBITCHARS"] = K_BUSBITCHARS; + Keyword_set["BY"] = K_BY; + Keyword_set["CANNOTOCCUPY"] = K_CANNOTOCCUPY; + Keyword_set["CANPLACE"] = K_CANPLACE; + Keyword_set["CAPACITANCE"] = K_CAPACITANCE; + Keyword_set["CLOCK"] = K_CLOCK; + Keyword_set["COMMONSCANPINS"] = K_COMMONSCANPINS; + Keyword_set["COMPONENT"] = K_COMPONENT; + Keyword_set["COMPONENTPIN"] = K_COMPONENTPIN; + Keyword_set["COMPONENTS"] = K_COMPS; + Keyword_set["COMPONENTMASKSHIFT"] = K_COMPSMASKSHIFT; + Keyword_set["CONSTRAINTS"] = K_CONSTRAINTS; + Keyword_set["COREWIRE"] = K_COREWIRE; + Keyword_set["COVER"] = K_COVER; + Keyword_set["CUTSIZE"] = K_CUTSIZE; + Keyword_set["CUTSPACING"] = K_CUTSPACING; + Keyword_set["DEFAULTCAP"] = K_DEFAULTCAP; + Keyword_set["DESIGN"] = K_DESIGN; + Keyword_set["DESIGNRULEWIDTH"] = K_DESIGNRULEWIDTH; + Keyword_set["DIAGWIDTH"] = K_DIAGWIDTH; + Keyword_set["DIEAREA"] = K_DIEAREA; + Keyword_set["DIFF"] = K_DIFF; + Keyword_set["DIRECTION"] = K_DIRECTION; + Keyword_set["DIST"] = K_DIST; + Keyword_set["DISTANCE"] = K_DISTANCE; + Keyword_set["DIVIDERCHAR"] = K_DIVIDERCHAR; + Keyword_set["DO"] = K_DO; + Keyword_set["DRCFILL"] = K_DRCFILL; + Keyword_set["DRIVECELL"] = K_DRIVECELL; + Keyword_set["E"] = K_E; + Keyword_set["EEQMASTER"] = K_EEQMASTER; + Keyword_set["ENCLOSURE"] = K_ENCLOSURE; + Keyword_set["END"] = K_END; + Keyword_set["ENDEXT"] = K_ENDEXT; + Keyword_set["EQUAL"] = K_EQUAL; + Keyword_set["EXCEPTPGNET"] = K_EXCEPTPGNET; + Keyword_set["ESTCAP"] = K_ESTCAP; + Keyword_set["FALL"] = K_FALL; + Keyword_set["FALLMAX"] = K_FALLMAX; + Keyword_set["FALLMIN"] = K_FALLMIN; + Keyword_set["FE"] = K_FE; + Keyword_set["FENCE"] = K_FENCE; + Keyword_set["FILLS"] = K_FILLS; + Keyword_set["FILLWIRE"] = K_FILLWIRE; + Keyword_set["FILLWIREOPC"] = K_FILLWIREOPC; + Keyword_set["FIXED"] = K_FIXED; + Keyword_set["FIXEDBUMP"] = K_FIXEDBUMP; + Keyword_set["FLOATING"] = K_FLOATING; + Keyword_set["FLOORPLANCONSTRAINTS"] = K_FPC; + Keyword_set["FN"] = K_FN; + Keyword_set["FOLLOWPIN"] = K_FOLLOWPIN; + Keyword_set["FOREIGN"] = K_FOREIGN; + Keyword_set["FREQUENCY"] = K_FREQUENCY; + Keyword_set["FROMCLOCKPIN"] = K_FROMCLOCKPIN; + Keyword_set["FROMCOMPPIN"] = K_FROMCOMPPIN; + Keyword_set["FROMIOPIN"] = K_FROMIOPIN; + Keyword_set["FROMPIN"] = K_FROMPIN; + Keyword_set["FS"] = K_FS; + Keyword_set["FW"] = K_FW; + Keyword_set["GCELLGRID"] = K_GCELLGRID; + Keyword_set["GENERATE"] = K_COMP_GEN; + Keyword_set["GUIDE"] = K_GUIDE; + Keyword_set["GROUND"] = K_GROUND; + Keyword_set["GROUNDSENSITIVITY"] = K_GROUNDSENSITIVITY; + Keyword_set["GROUP"] = K_GROUP; + Keyword_set["GROUPS"] = K_GROUPS; + Keyword_set["FLOORPLAN"] = K_FLOORPLAN; + Keyword_set["HALO"] = K_HALO; + Keyword_set["HARDSPACING"] = K_HARDSPACING; + Keyword_set["HISTORY"] = K_HISTORY; + Keyword_set["HOLDRISE"] = K_HOLDRISE; + Keyword_set["HOLDFALL"] = K_HOLDFALL; + Keyword_set["HORIZONTAL"] = K_HORIZONTAL; + Keyword_set["IN"] = K_IN; + Keyword_set["INTEGER"] = K_INTEGER; + Keyword_set["IOTIMINGS"] = K_IOTIMINGS; + Keyword_set["IOWIRE"] = K_IOWIRE; + Keyword_set["LAYER"] = K_LAYER; + Keyword_set["LAYERS"] = K_LAYERS; + Keyword_set["MASK"] = K_MASK; + Keyword_set["MASKSHIFT"] = K_MASKSHIFT; + Keyword_set["MAX"] = K_MAX; + Keyword_set["MAXBITS"] = K_MAXBITS; + Keyword_set["MAXDIST"] = K_MAXDIST; + Keyword_set["MAXHALFPERIMETER"] = K_MAXHALFPERIMETER; + Keyword_set["MAXX"] = K_MAXX; + Keyword_set["MAXY"] = K_MAXY; + Keyword_set["MICRONS"] = K_MICRONS; + Keyword_set["MIN"] = K_MIN; + Keyword_set["MINCUTS"] = K_MINCUTS; + Keyword_set["MINPINS"] = K_MINPINS; + Keyword_set["MUSTJOIN"] = K_MUSTJOIN; + Keyword_set["N"] = K_N; + Keyword_set["NAMESCASESENSITIVE"] = K_NAMESCASESENSITIVE; + Keyword_set["NAMEMAPSTRING"] = K_NAMEMAPSTRING; + Keyword_set["NET"] = K_NET; + Keyword_set["NETEXPR"] = K_NETEXPR; + Keyword_set["NETS"] = K_NETS; + Keyword_set["NETLIST"] = K_NETLIST; + Keyword_set["NEW"] = K_NEW; + Keyword_set["NONDEFAULTRULE"] = K_NONDEFAULTRULE; + Keyword_set["NONDEFAULTRULES"] = K_NONDEFAULTRULES; + Keyword_set["NOSHIELD"] = K_NOSHIELD; + Keyword_set["ON"] = K_ON; + Keyword_set["OFF"] = K_OFF; + Keyword_set["OFFSET"] = K_OFFSET; + Keyword_set["OPC"] = K_OPC; + Keyword_set["ORDERED"] = K_ORDERED; + Keyword_set["ORIGIN"] = K_ORIGIN; + Keyword_set["ORIGINAL"] = K_ORIGINAL; + Keyword_set["OUT"] = K_OUT; + Keyword_set["OXIDE1"] = K_OXIDE1; + Keyword_set["OXIDE2"] = K_OXIDE2; + Keyword_set["OXIDE3"] = K_OXIDE3; + Keyword_set["OXIDE4"] = K_OXIDE4; + Keyword_set["PADRING"] = K_PADRING; + Keyword_set["PARTIAL"] = K_PARTIAL; + Keyword_set["PARTITION"] = K_PARTITION; + Keyword_set["PARALLEL"] = K_PARALLEL; + Keyword_set["PARTITIONS"] = K_PARTITIONS; + Keyword_set["PATH"] = K_PATH; + Keyword_set["PATTERN"] = K_PATTERN; + Keyword_set["PATTERNNAME"] = K_PATTERNNAME; + Keyword_set["PIN"] = K_PIN; + Keyword_set["PINPROPERTIES"] = K_PINPROPERTIES; + Keyword_set["PINS"] = K_PINS; + Keyword_set["PLACED"] = K_PLACED; + Keyword_set["PLACEMENT"] = K_PLACEMENT; + Keyword_set["POLYGON"] = K_POLYGON; + Keyword_set["PORT"] = K_PORT; + Keyword_set["POWER"] = K_POWER; + Keyword_set["PROPERTY"] = K_PROPERTY; + Keyword_set["PROPERTYDEFINITIONS"] = K_PROPERTYDEFINITIONS; + Keyword_set["PUSHDOWN"] = K_PUSHDOWN; + Keyword_set["RANGE"] = K_RANGE; + Keyword_set["REAL"] = K_REAL; + Keyword_set["RECT"] = K_RECT; + Keyword_set["REENTRANTPATHS"] = K_REENTRANTPATHS; + Keyword_set["REGION"] = K_REGION; + Keyword_set["REGIONS"] = K_REGIONS; + Keyword_set["RESET"] = K_RESET; + Keyword_set["RING"] = K_RING; + Keyword_set["RISE"] = K_RISE; + Keyword_set["RISEMAX"] = K_RISEMAX; + Keyword_set["RISEMIN"] = K_RISEMIN; + Keyword_set["ROUTED"] = K_ROUTED; + Keyword_set["ROUTEHALO"] = K_ROUTEHALO; + Keyword_set["ROW"] = K_ROW; + Keyword_set["ROWCOL"] = K_ROWCOL; + Keyword_set["ROWS"] = K_ROWS; + Keyword_set["S"] = K_S; + Keyword_set["SAMEMASK"] = K_SAMEMASK; + Keyword_set["SCAN"] = K_SCAN; + Keyword_set["SCANCHAINS"] = K_SCANCHAINS; + Keyword_set["SETUPFALL"] = K_SETUPFALL; + Keyword_set["SETUPRISE"] = K_SETUPRISE; + Keyword_set["SHAPE"] = K_SHAPE; + Keyword_set["SHIELD"] = K_SHIELD; + Keyword_set["SHIELDNET"] = K_SHIELDNET; + Keyword_set["SIGNAL"] = K_SIGNAL; + Keyword_set["SITE"] = K_SITE; + Keyword_set["SLEWRATE"] = K_SLEWRATE; + Keyword_set["SLOTS"] = K_SLOTS; + Keyword_set["SOFT"] = K_SOFT; + Keyword_set["SOURCE"] = K_SOURCE; + Keyword_set["SPACING"] = K_SPACING; + Keyword_set["SPECIAL"] = K_SPECIAL; + Keyword_set["SPECIALNET"] = K_SNET; + Keyword_set["SPECIALNETS"] = K_SNETS; + Keyword_set["START"] = K_START; + Keyword_set["STEINER"] = K_STEINER; + Keyword_set["STEP"] = K_STEP; + Keyword_set["STOP"] = K_STOP; + Keyword_set["STRING"] = K_STRING; + Keyword_set["STRIPE"] = K_STRIPE; + Keyword_set["STYLE"] = K_STYLE; + Keyword_set["STYLES"] = K_STYLES; + Keyword_set["SUBNET"] = K_SUBNET; + Keyword_set["SUM"] = K_SUM; + Keyword_set["SUPPLYSENSITIVITY"] = K_SUPPLYSENSITIVITY; + Keyword_set["SYNTHESIZED"] = K_SYNTHESIZED; + Keyword_set["TAPER"] = K_TAPER; + Keyword_set["TAPERRULE"] = K_TAPERRULE; + Keyword_set["TECHNOLOGY"] = K_TECH; + Keyword_set["TEST"] = K_TEST; + Keyword_set["TIEOFF"] = K_TIEOFF; + Keyword_set["TIMING"] = K_TIMING; + Keyword_set["TIMINGDISABLES"] = K_TIMINGDISABLES; + Keyword_set["TOCLOCKPIN"] = K_TOCLOCKPIN; + Keyword_set["TOCOMPPIN"] = K_TOCOMPPIN; + Keyword_set["TOIOPIN"] = K_TOIOPIN; + Keyword_set["TOPIN"] = K_TOPIN; + Keyword_set["TOPRIGHT"] = K_TOPRIGHT; + Keyword_set["TRACKS"] = K_TRACKS; + Keyword_set["TRUNK"] = K_TRUNK; + Keyword_set["TURNOFF"] = K_TURNOFF; + Keyword_set["TYPE"] = K_TYPE; + Keyword_set["UNITS"] = K_UNITS; + Keyword_set["UNPLACED"] = K_UNPLACED; + Keyword_set["USE"] = K_USE; + Keyword_set["USER"] = K_USER; + Keyword_set["VARIABLE"] = K_VARIABLE; + Keyword_set["VERSION"] = K_VERSION; + Keyword_set["VERTICAL"] = K_VERTICAL; + Keyword_set["VIA"] = K_VIA; + Keyword_set["VIARULE"] = K_VIARULE; + Keyword_set["VIAS"] = K_VIAS; + Keyword_set["VIRTUAL"] = K_VIRTUAL; + Keyword_set["VOLTAGE"] = K_VOLTAGE; + Keyword_set["VPIN"] = K_VPIN; + Keyword_set["W"] = K_W; + Keyword_set["WEIGHT"] = K_WEIGHT; + Keyword_set["WIDTH"] = K_WIDTH; + Keyword_set["WIRECAP"] = K_WIRECAP; + Keyword_set["WIREEXT"] = K_WIREEXT; + Keyword_set["WIREDLOGIC"] = K_WIREDLOGIC; + Keyword_set["X"] = K_X; + Keyword_set["XTALK"] = K_XTALK; + Keyword_set["Y"] = K_Y; +} + +defrSession::defrSession() +: FileName(0), + reader_case_sensitive(0), + UserData(NULL) +{ +} + +END_LEFDEF_PARSER_NAMESPACE diff --git a/src/def/def/defrSettings.hpp b/src/def/def/defrSettings.hpp new file mode 100644 index 00000000..dca7831e --- /dev/null +++ b/src/def/def/defrSettings.hpp @@ -0,0 +1,142 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013-2014, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: arakhman $ +// $Revision: #6 $ +// $Date: 2013/08/09 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef defrSettings_h +#define defrSettings_h + +#include "defrReader.hpp" + +#include +#include +#include + +#define DEF_DEBUG_IDS 100 + +BEGIN_LEFDEF_PARSER_NAMESPACE + +struct defCompareCStrings +{ + bool operator()(const char* lhs, const char* rhs) const { + return std::strcmp(lhs, rhs) < 0; + } +}; + +typedef std::map defKeywordMap; + +class defrSettings { +public: + defrSettings(); + + void init_symbol_table(); + + defKeywordMap Keyword_set; + + int defiDeltaNumberLines; + + //////////////////////////////////// + // + // Flags to control number of warnings to print out, max will be 999 + // + //////////////////////////////////// + + int AssertionWarnings; + int BlockageWarnings; + int CaseSensitiveWarnings; + int ComponentWarnings; + int ConstraintWarnings; + int DefaultCapWarnings; + int FillWarnings; + int GcellGridWarnings; + int IOTimingWarnings; + int LogFileAppend; + int NetWarnings; + int NonDefaultWarnings; + int PinExtWarnings; + int PinWarnings; + int RegionWarnings; + int RowWarnings; + int TrackWarnings; + int ScanchainWarnings; + int SNetWarnings; + int StylesWarnings; + int UnitsWarnings; + int VersionWarnings; + int ViaWarnings; + + int nDDMsgs; + int* disableDMsgs; + int totalDefMsgLimit; // to save the user set total msg limit to output + int AddPathToNet; + int AllowComponentNets; + char CommentChar; + int DisPropStrProcess; + + int reader_case_sensitive_set; + + DEFI_READ_FUNCTION ReadFunction; + DEFI_LOG_FUNCTION ErrorLogFunction; + DEFI_WARNING_LOG_FUNCTION WarningLogFunction; + DEFI_CONTEXT_LOG_FUNCTION ContextErrorLogFunction; + DEFI_CONTEXT_WARNING_LOG_FUNCTION ContextWarningLogFunction; + DEFI_MAGIC_COMMENT_FOUND_FUNCTION MagicCommentFoundFunction; + DEFI_MALLOC_FUNCTION MallocFunction; + DEFI_REALLOC_FUNCTION ReallocFunction; + DEFI_FREE_FUNCTION FreeFunction; + DEFI_LINE_NUMBER_FUNCTION LineNumberFunction; + DEFI_LONG_LINE_NUMBER_FUNCTION LongLineNumberFunction; + DEFI_CONTEXT_LINE_NUMBER_FUNCTION ContextLineNumberFunction; + DEFI_CONTEXT_LONG_LINE_NUMBER_FUNCTION ContextLongLineNumberFunction; + + int UnusedCallbacks[CBMAX]; + int MsgLimit[DEF_MSGS]; +}; + + +class defrSession { +public: + defrSession(); + + char* FileName; + int reader_case_sensitive; + defiUserData UserData; + + defiPropType CompProp; + defiPropType CompPinProp; + defiPropType DesignProp; + defiPropType GroupProp; + defiPropType NDefProp; + defiPropType NetProp; + defiPropType RegionProp; + defiPropType RowProp; + defiPropType SNetProp; +}; + +END_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defwWriter.cpp b/src/def/def/defwWriter.cpp new file mode 100644 index 00000000..fe6c86bc --- /dev/null +++ b/src/def/def/defwWriter.cpp @@ -0,0 +1,6921 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + + +// This file contains code for implementing the defwriter 5.3 +// It has all the functions user can call in their callbacks or +// just their writer to write out the correct lef syntax. +// +// Author: Wanda da Rosa +// Date: Summer, 1998 +// +// Revisions: 11/25/2002 - bug fix: submitted by Craig Files +// (cfiles@ftc.agilent.com) +// Changed all (!name && !*name) to +// (!name || !*name) + +#include "defwWriter.hpp" +#include +#include +#include +#include "defiUtil.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +// States of the writer. +#define DEFW_UNINIT 0 +#define DEFW_INIT 1 +#define DEFW_VERSION 2 +#define DEFW_CASESENSITIVE 3 +#define DEFW_DIVIDER 4 +#define DEFW_BUSBIT 5 +#define DEFW_DESIGN 6 +#define DEFW_TECHNOLOGY 7 +#define DEFW_ARRAY 8 +#define DEFW_FLOORPLAN 9 +#define DEFW_UNITS 10 +#define DEFW_HISTORY 11 +#define DEFW_PROP_START 12 +#define DEFW_PROP 13 +#define DEFW_PROP_END 14 +#define DEFW_DIE_AREA 15 +#define DEFW_ROW 16 +#define DEFW_TRACKS 17 +#define DEFW_GCELL_GRID 18 +#define DEFW_DEFAULTCAP_START 19 +#define DEFW_DEFAULTCAP 20 +#define DEFW_DEFAULTCAP_END 21 +#define DEFW_CANPLACE 22 +#define DEFW_CANNOTOCCUPY 23 +#define DEFW_VIA_START 24 +#define DEFW_VIA 25 +#define DEFW_VIAVIARULE 26 +#define DEFW_VIAONE_END 27 +#define DEFW_VIA_END 28 +#define DEFW_REGION_START 29 +#define DEFW_REGION 30 +#define DEFW_REGION_END 31 +#define DEFW_COMPONENT_MASKSHIFTLAYERS 32 +#define DEFW_COMPONENT_START 33 +#define DEFW_COMPONENT 34 +#define DEFW_COMPONENT_END 35 +#define DEFW_PIN_START 36 +#define DEFW_PIN 37 +#define DEFW_PIN_PORT 38 +#define DEFW_PIN_END 39 +#define DEFW_PINPROP_START 40 +#define DEFW_PINPROP 41 +#define DEFW_PINPROP_END 42 +#define DEFW_BLOCKAGE_START 43 +#define DEFW_BLOCKAGE_LAYER 44 +#define DEFW_BLOCKAGE_PLACE 45 +#define DEFW_BLOCKAGE_RECT 46 +#define DEFW_BLOCKAGE_POLYGON 47 +#define DEFW_BLOCKAGE_END 48 +#define DEFW_SNET_START 49 +#define DEFW_SNET 50 +#define DEFW_SNET_OPTIONS 51 +#define DEFW_SNET_ENDNET 52 +#define DEFW_SNET_END 53 +#define DEFW_PATH_START 54 +#define DEFW_PATH 55 +#define DEFW_SHIELD 56 +#define DEFW_NET_START 57 +#define DEFW_NET 58 +#define DEFW_NET_OPTIONS 59 +#define DEFW_NET_ENDNET 60 +#define DEFW_NET_END 61 +#define DEFW_SUBNET 62 +#define DEFW_NOSHIELD 63 +#define DEFW_IOTIMING_START 64 +#define DEFW_IOTIMING 65 +#define DEFW_IOTIMING_END 66 +#define DEFW_SCANCHAIN_START 67 +#define DEFW_SCANCHAIN 68 +#define DEFW_SCAN_FLOATING 69 +#define DEFW_SCAN_ORDERED 70 +#define DEFW_SCANCHAIN_END 71 +#define DEFW_FPC_START 72 +#define DEFW_FPC 73 +#define DEFW_FPC_OPER 74 +#define DEFW_FPC_OPER_SUM 75 +#define DEFW_FPC_END 76 +#define DEFW_GROUP_START 77 +#define DEFW_GROUP 78 +#define DEFW_GROUP_END 79 +#define DEFW_SLOT_START 80 +#define DEFW_SLOT_LAYER 81 +#define DEFW_SLOT_RECT 82 +#define DEFW_SLOT_END 83 +#define DEFW_FILL_START 84 +#define DEFW_FILL_LAYER 85 +#define DEFW_FILL_VIA 86 +#define DEFW_FILL_OPC 87 +#define DEFW_FILL_RECT 88 +#define DEFW_FILL_END 89 +#define DEFW_NDR_START 90 +#define DEFW_NDR 91 +#define DEFW_NDR_END 92 +#define DEFW_STYLES_START 93 +#define DEFW_STYLES 94 +#define DEFW_STYLES_END 95 +#define DEFW_BEGINEXT_START 96 +#define DEFW_BEGINEXT 97 +#define DEFW_BEGINEXT_END 98 +#define DEFW_FILL_LAYERMASK 99 +#define DEFW_FILL_VIAMASK 100 +#define DEFW_BLOCKAGE_MASK 101 + +#define DEFW_END 102 + +#define DEFW_DONE 999 + +#define MAXSYN 103 + + +// ***************************************************************************** +// Global Variables +// ***************************************************************************** +FILE *defwFile = 0; // File to write to. +int defwLines = 0; // number of lines written +int defwState = DEFW_UNINIT; // Current state of writer +int defwFunc = DEFW_UNINIT; // Current function of writer +int defwDidNets = 0; // required section +int defwDidComponents = 0; // required section +int defwDidInit = 0; // required section +int defwCounter = 0; // number of nets, components in section +int defwLineItemCounter = 0; // number of items on current line +int defwFPC = 0; // Current number of items in constraints/operand/sum +int defwHasInit = 0; // for defwInit has called +int defwHasInitCbk = 0; // for defwInitCbk has called +int defwSpNetShield = 0; // for special net shieldNetName +static double defVersionNum = 5.7; // default to 5.7 +static int defwObsoleteNum = -1; // keep track the obsolete syntax for error +static int defwViaHasVal = 0; // keep track only ViaRule|Pattern +static int defwBlockageHasSD = 0;// keep track only Spacing|Designrulewidth +static int defwBlockageHasSF = 0;// keep track only SLOTS|FILLS +static int defwBlockageHasSP = 0;// keep track only SOFT|PARTIAL + +char defwStateStr[MAXSYN] [80] = { + "UNINITIALIZE", // 0 + "INITIALIZE", // 1 + "VERSION", // 2 + "CASESENSITIVE", // 3 + "BUSBIT", // 4 + "DIVIDER", // 5 + "DESIGN", // 6 + "TECHNOLOGY", // 7 + "ARRAY", // 8 + "FLOORPLAN", // 9 + "UNITS", // 10 + "HISTORY", // 11 + "PROPERTYDEFINITIONS", // 12 + "PROPERTYDEFINITIONS", // 13 + "PROPERTYDEFINITIONS", // 14 + "DIEAREA", // 15 + "ROW", // 16 + "TRACKS", // 17 + "GCELLGRID", // 18 + "DEFAULTCAP", // 19 + "DEFAULTCAP", // 20 + "DEFAULTCAP", // 21 + "CANPLACE", // 22 + "CANNOTOCCUPY", // 23 + "VIA", // 24 + "VIA", // 25 + "VIA", // 26 + "VIA", // 27 + "VIA", // 28 + "REGION", // 29 + "REGION", // 30 + "REGION", // 31 + "COMPONENT", // 32 + "COMPONENT", // 33 + "COMPONENT", // 34 + "COMPONENT", // 35 + "PIN", // 36 + "PIN", // 37 + "PIN", // 38 + "PIN", // 39 + "PINPROPERTY", // 40 + "PINPROPERTY", // 41 + "PINPROPERTY", // 42 + "SNET", // 43 + "SNET", // 44 + "SNET", // 45 + "SNET", // 46 + "SNET", // 47 + "PATH", // 48 + "PATH", // 49 + "SHIELD", // 50 + "NET", // 51 + "NET", // 52 + "NET", // 53 + "NET", // 54 + "NET", // 55 + "SUBNET", // 56 + "NOSHIELD", // 57 + "IOTIMING", // 58 + "IOTIMING", // 59 + "IOTIMING", // 60 + "SCANCHAIN", // 61 + "SCANCHAIN", // 62 + "SCAN FLOATING", // 63 + "SCAN ORDERED", // 64 + "SCANCHAIN", // 65 + "CONSTRAINTS", // 66 + "CONSTRAINTS", // 67 + "CONSTRAINTS", // 68 + "CONSTRAINTS", // 69 + "CONSTRAINTS", // 70 + "GROUP", // 71 + "GROUP", // 71 + "GROUP", // 72 + "BLOCKAGE", // 73 + "BLOCKAGE LAYER", // 74 + "BLOCKAGE PLACEMENT", // 75 + "BLOCKAGE RECT", // 76 + "BLOCKAGE POLYGON", // 77 + "BLOCKAGE", // 78 + "SLOT", // 79 + "SLOT", // 80 + "SLOT", // 81 + "SLOT", // 82 + "FILL", // 83 + "FILL", // 84 + "FILL", // 85 + "FILL", // 86 + "FILL", // 87 + "FILL", // 88 + "NDR", // 89 + "NDR", // 90 + "NDR", // 91 + "STYLES", // 92 + "STYLES", // 93 + "STYLES", // 94 + "BEGINEXT", // 95 + "BEGINEXT", // 96 + "BEGINEXT", // 97 + "DESIGN END", // 98 + "FILL_LAYERMASK", // 99 + "FILL_VIAMASK", // 100 + "BLOCKAGE_MASK" // 101 + +}; + + +static int printPointsNum = 0; +static void printPoints(FILE *file, double x, double y, + const char* prefix, const char* suffix) +{ + static double x_old = 0; + static double y_old = 0; + + fprintf(file, "%s", prefix); + + if (printPointsNum++ == 0) { + fprintf(file, "( %.11g %.11g )", x, y); + } else if (x_old == x) { + if (y_old == y) { + fprintf(file, "( * * )"); + } else { + fprintf(file, "( * %.11g )", y); + } + } else if (y_old == y) { + fprintf(file, "( %.11g * )", x); + } else { + fprintf(file, "( %.11g %.11g )", x, y); + } + + fprintf(file, "%s", suffix); + + x_old = x; + y_old = y; +} + + + +int +defwNewLine() +{ + if (!defwFile) + return DEFW_BAD_ORDER; + fprintf(defwFile, "\n"); + return DEFW_OK; +} + + +// this function is required to be called first to initialize the required +// sections. +// Either this function or defwInitCbk can be called, cannot be both +int +defwInit(FILE *f, + int vers1, + int vers2, + const char *caseSensitive, + const char *dividerChar, + const char *busBitChars, + const char *designName, + const char *technology, // optional + const char *array, // optional + const char *floorplan, // optional + double units // optional (set to -1 to ignore) + ) +{ + + //if (defwFile) return DEFW_BAD_ORDER; + defwFile = f; + if (defwHasInitCbk == 1) { // defwInitCbk has already called, issue an error + fprintf(stderr, + "ERROR (DEFWRIT-9000): The DEF writer has detected that the function defwInitCbk has already been called and you are trying to call defwInit.\nOnly defwInitCbk or defwInit can be called but not both.\nUpdate your program and then try again.\n"); + fprintf(stderr, "Writer Exit.\n"); + exit(DEFW_BAD_ORDER); + } + + defwState = DEFW_UNINIT; // Current state of writer + defwFunc = DEFW_UNINIT; // Current function of writer + defwDidNets = 0; // required section + defwDidComponents = 0; // required section + defwDidInit = 0; // required section + + if (vers1) { // optional in 5.6 on + fprintf(defwFile, "VERSION %d.%d ;\n", vers1, vers2); + defwLines++; + } + + if ((vers1 == 5) && (vers2 < 6)) { // For version before 5.6 + if (caseSensitive == 0 || *caseSensitive == 0) + return DEFW_BAD_DATA; + fprintf(defwFile, "NAMESCASESENSITIVE %s ;\n", caseSensitive); + } + + if (dividerChar) { // optional in 5.6 on + fprintf(defwFile, "DIVIDERCHAR \"%s\" ;\n", dividerChar); + defwLines++; + } + + if (busBitChars) { // optional in 5.6 on + fprintf(defwFile, "BUSBITCHARS \"%s\" ;\n", busBitChars); + defwLines++; + } + + if (designName == 0 || *designName == 0) + return DEFW_BAD_DATA; + fprintf(defwFile, "DESIGN %s ;\n", designName); + defwLines++; + + if (technology) { + fprintf(defwFile, "TECHNOLOGY %s ;\n", technology); + defwLines++; + } + + if (array) { + fprintf(defwFile, "ARRAY %s ;\n", array); + defwLines++; + } + + if (floorplan) { + fprintf(defwFile, "FLOORPLAN %s ;\n", floorplan); + defwLines++; + } + + if (units != -1.0) { + int unitsVal = (int) units; + switch (unitsVal) { + case 100: + case 200: + case 1000: + case 2000: + case 4000: + case 8000: + case 10000: + case 16000: + case 20000: + fprintf(defwFile, "UNITS DISTANCE MICRONS %d ;\n", ROUND(units)); + defwLines++; + break; + default: + return DEFW_BAD_DATA; + } + } + + defwDidInit = 1; + defwState = DEFW_DESIGN; + defwHasInit = 1; + return DEFW_OK; +} + + +// this function is required to be called first to initialize the variables +// Either this function or defwInit can be called, cannot be both +int +defwInitCbk(FILE *f) +{ + + defwFile = f; + if (defwHasInit == 1) { // defwInit has already called, issue an error + fprintf(stderr, + "ERROR (DEFWRIT-9001): The DEF writer has detected that the function defwInit has already been called and you are trying to call defwInitCbk.\nOnly defwInitCbk or defwInit can be called but not both.\nUpdate your program and then try again.\n"); + fprintf(stderr, "Writer Exit.\n"); + exit(DEFW_BAD_ORDER); + } + + defwState = DEFW_UNINIT; // Current state of writer + defwFunc = DEFW_UNINIT; // Current function of writer + defwDidNets = 0; // required section + defwDidComponents = 0; // required section + defwDidInit = 0; // required section + + defwDidInit = 1; + defwState = DEFW_INIT; + defwHasInitCbk = 1; + return DEFW_OK; +} + +int +defwVersion(int vers1, + int vers2) +{ + defwFunc = DEFW_VERSION; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + if (defwState != DEFW_INIT) // version follows init + return DEFW_BAD_ORDER; + fprintf(defwFile, "VERSION %d.%d ;\n", vers1, vers2); + if (vers2 >= 10) + defVersionNum = vers1 + (vers2 / 100.0); + else + defVersionNum = vers1 + (vers2 / 10.0); + defwLines++; + + defwState = DEFW_VERSION; + return DEFW_OK; +} + +int +defwCaseSensitive(const char *caseSensitive) +{ + defwObsoleteNum = DEFW_CASESENSITIVE; + defwFunc = DEFW_CASESENSITIVE; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + if (defVersionNum >= 5.6) + return DEFW_OBSOLETE; + // Check for repeated casesensitive + if (defwState == DEFW_CASESENSITIVE) + return DEFW_BAD_ORDER; + if (strcmp(caseSensitive, "ON") && strcmp(caseSensitive, "OFF")) + return DEFW_BAD_DATA; // has to be either ON or OFF + fprintf(defwFile, "NAMESCASESENSITIVE %s ;\n", caseSensitive); + defwLines++; + + defwState = DEFW_CASESENSITIVE; + return DEFW_OK; +} + +int +defwBusBitChars(const char *busBitChars) +{ + defwFunc = DEFW_BUSBIT; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + // Check for repeated casesensitive + if (defwState == DEFW_BUSBIT) + return DEFW_BAD_ORDER; + if (busBitChars && busBitChars != 0 && *busBitChars != 0) { + fprintf(defwFile, "BUSBITCHARS \"%s\" ;\n", busBitChars); + defwLines++; + } + + defwState = DEFW_BUSBIT; + return DEFW_OK; +} + +int +defwDividerChar(const char *dividerChar) +{ + defwFunc = DEFW_DIVIDER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + // Check for repeated busbit + if (defwState == DEFW_DIVIDER) + return DEFW_BAD_ORDER; + if (dividerChar && dividerChar != 0 && *dividerChar != 0) { + fprintf(defwFile, "DIVIDERCHAR \"%s\" ;\n", dividerChar); + defwLines++; + } + + defwState = DEFW_DIVIDER; + return DEFW_OK; +} + +int +defwDesignName(const char *name) +{ + defwFunc = DEFW_DESIGN; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + // Check for repeated design + if (defwState == DEFW_DESIGN) + return DEFW_BAD_ORDER; + if (name && name != 0 && *name != 0) { + fprintf(defwFile, "DESIGN %s ;\n", name); + defwLines++; + } + + defwState = DEFW_DESIGN; + return DEFW_OK; +} + +int +defwTechnology(const char *technology) +{ + defwFunc = DEFW_TECHNOLOGY; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + if (technology && technology != 0 && *technology != 0) { + fprintf(defwFile, "TECHNOLOGY %s ;\n", technology); + defwLines++; + } + + defwState = DEFW_TECHNOLOGY; + return DEFW_OK; +} + +int +defwArray(const char *array) +{ + defwFunc = DEFW_ARRAY; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + if (defwState == DEFW_ARRAY) + return DEFW_BAD_ORDER; // check for repeated array + if (array && array != 0 && *array != 0) { + fprintf(defwFile, "ARRAY %s ;\n", array); + defwLines++; + } + + defwState = DEFW_ARRAY; + return DEFW_OK; +} + +int +defwFloorplan(const char *floorplan) +{ + defwFunc = DEFW_FLOORPLAN; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + if (defwState == DEFW_FLOORPLAN) + return DEFW_BAD_ORDER; // Check for repeated floorplan + if (floorplan && floorplan != 0 && *floorplan != 0) { + fprintf(defwFile, "FLOORPLAN %s ;\n", floorplan); + defwLines++; + } + + defwState = DEFW_FLOORPLAN; + return DEFW_OK; +} + +int +defwUnits(int units) +{ + defwFunc = DEFW_UNITS; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + if (defwState == DEFW_UNITS) + return DEFW_BAD_ORDER; // Check for repeated units + if (units != 0) { + switch (units) { + case 100: + case 200: + case 1000: + case 2000: + case 10000: + case 20000: + fprintf(defwFile, "UNITS DISTANCE MICRONS %d ;\n", units); + defwLines++; + break; + default: + return DEFW_BAD_DATA; + } + } + + defwState = DEFW_UNITS; + return DEFW_OK; +} + +int +defwHistory(const char *string) +{ + char *c; + defwFunc = DEFW_HISTORY; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + if (string == 0 || *string == 0) + return DEFW_BAD_DATA; + + for (c = (char*) string; *c; c++) + if (*c == '\n') + defwLines++; + + fprintf(defwFile, "HISTORY %s ;\n", string); + defwLines++; + + defwState = DEFW_HISTORY; + return DEFW_OK; +} + +int +defwStartPropDef() +{ + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + if ((defwState >= DEFW_PROP_START) && (defwState <= DEFW_PROP_END)) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "PROPERTYDEFINITIONS\n"); + defwLines++; + + defwState = DEFW_PROP_START; + return DEFW_OK; +} + + +int +defwIsPropObjType(const char *objType) +{ + if (strcmp(objType, "DESIGN") && strcmp(objType, "COMPONENT") && + strcmp(objType, "NET") && strcmp(objType, "SPECIALNET") && + strcmp(objType, "GROUP") && strcmp(objType, "ROW") && + strcmp(objType, "COMPONENTPIN") && strcmp(objType, "REGION") && + strcmp(objType, "NONDEFAULTRULE")) + return 0; + return 1; +} + +int +defwIntPropDef(const char *objType, + const char *propName, + double leftRange, + double rightRange, // optional + int propValue // optional + ) +{ + + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PROP_START && + defwState != DEFW_PROP) + return DEFW_BAD_ORDER; + if ((!objType || !*objType) || (!propName || !*propName)) // require + return DEFW_BAD_DATA; + + if (!defwIsPropObjType(objType)) + return DEFW_BAD_DATA; + + fprintf(defwFile, " %s %s INTEGER ", objType, propName); + if (leftRange || rightRange) + fprintf(defwFile, "RANGE %.11g %.11g ", leftRange, rightRange); + + if (propValue) + fprintf(defwFile, "%d ", propValue); + + fprintf(defwFile, ";\n"); + + defwLines++; + defwState = DEFW_PROP; + return DEFW_OK; +} + + +int +defwRealPropDef(const char *objType, + const char *propName, + double leftRange, + double rightRange, // optional + double propValue // optional + ) +{ + + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PROP_START && + defwState != DEFW_PROP) + return DEFW_BAD_ORDER; + if ((!objType || !*objType) || (!propName || !*propName)) // require + return DEFW_BAD_DATA; + + if (!defwIsPropObjType(objType)) + return DEFW_BAD_DATA; + + fprintf(defwFile, " %s %s REAL ", objType, propName); + if (leftRange || rightRange) + fprintf(defwFile, "RANGE %.11g %.11g ", leftRange, rightRange); + + if (propValue) + fprintf(defwFile, "%.11g ", propValue); + + fprintf(defwFile, ";\n"); + + defwLines++; + defwState = DEFW_PROP; + return DEFW_OK; +} + + +int +defwStringPropDef(const char *objType, + const char *propName, + double leftRange, + double rightRange, // optional + const char *propValue // optional + ) +{ + + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PROP_START && + defwState != DEFW_PROP) + return DEFW_BAD_ORDER; + if ((!objType || !*objType) || (!propName || !*propName)) + return DEFW_BAD_DATA; + + if (!defwIsPropObjType(objType)) + return DEFW_BAD_DATA; + + fprintf(defwFile, " %s %s STRING ", objType, propName); + if (leftRange || rightRange) + fprintf(defwFile, "RANGE %.11g %.11g ", leftRange, rightRange); + + if (propValue) + fprintf(defwFile, "\"%s\" ", propValue); // string, set quotes + + fprintf(defwFile, ";\n"); + + defwLines++; + defwState = DEFW_PROP; + return DEFW_OK; +} + + +int +defwEndPropDef() +{ + defwFunc = DEFW_PROP_END; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PROP_START && + defwState != DEFW_PROP) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "END PROPERTYDEFINITIONS\n\n"); + defwLines++; + + defwState = DEFW_PROP_END; + return DEFW_OK; +} + +int +defwIsPropState() +{ + if ((defwState != DEFW_ROW) && (defwState != DEFW_REGION) && + (defwState != DEFW_COMPONENT) && (defwState != DEFW_PIN) && + (defwState != DEFW_SNET) && (defwState != DEFW_NET) && + (defwState != DEFW_GROUP) && (defwState != DEFW_PINPROP) && + (defwState != DEFW_SNET_OPTIONS) && (defwState != DEFW_NET_OPTIONS) && + (defwState != DEFW_NDR) && (defwState != DEFW_BEGINEXT)) + return 0; + return 1; +} + +int +defwStringProperty(const char *propName, + const char *propValue) +{ + if (!defwIsPropState()) + return DEFW_BAD_ORDER; + + // new line for the defwRow of the previous line + // do not end with newline, may have more than on properties + fprintf(defwFile, "\n + PROPERTY %s \"%s\" ", propName, propValue); + defwLines++; + return DEFW_OK; +} + + +int +defwRealProperty(const char *propName, + double propValue) +{ + if (!defwIsPropState()) + return DEFW_BAD_ORDER; + + // new line for the defwRow of the previous line + // do not end with newline, may have more than on properties + fprintf(defwFile, "\n + PROPERTY %s %.11g ", propName, propValue); + defwLines++; + return DEFW_OK; +} + + +int +defwIntProperty(const char *propName, + int propValue) +{ + if (!defwIsPropState()) + return DEFW_BAD_ORDER; + + // new line for the defwRow of the previous line + // do not end with newline, may have more than on properties + fprintf(defwFile, "\n + PROPERTY %s %d ", propName, propValue); + defwLines++; + return DEFW_OK; +} + + +int +defwDieArea(int xl, + int yl, + int xh, + int yh) +{ + defwFunc = DEFW_DIE_AREA; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + if (defwState == DEFW_DIE_AREA) + return DEFW_BAD_ORDER; + if (xl > xh || yl > yh) + return DEFW_BAD_DATA; + + fprintf(defwFile, "DIEAREA ( %d %d ) ( %d %d ) ;\n", xl, yl, xh, yh); + defwLines++; + + defwState = DEFW_DIE_AREA; + return DEFW_OK; +} + + +int +defwDieAreaList(int num_points, + int *xl, + int *yl) +{ + int i; + + defwFunc = DEFW_DIE_AREA; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + if (defwState == DEFW_DIE_AREA) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.6) + return DEFW_WRONG_VERSION; + if (num_points < 4) + return DEFW_BAD_DATA; + + fprintf(defwFile, "DIEAREA "); + for (i = 0; i < num_points; i++) { + if (i == 0) + fprintf(defwFile, "( %d %d ) ", *xl++, *yl++); + else { + if ((i % 5) == 0) { + fprintf(defwFile, "\n ( %d %d ) ", *xl++, *yl++); + defwLines++; + } else + fprintf(defwFile, "( %d %d ) ", *xl++, *yl++); + } + } + fprintf(defwFile, ";\n"); + defwLines++; + + defwState = DEFW_DIE_AREA; + return DEFW_OK; +} + + +char * +defwAddr(const char *x) +{ + return (char*) x; +} + + +char * +defwOrient(int num) +{ + switch (num) { + case 0: + return defwAddr("N"); + case 1: + return defwAddr("W"); + case 2: + return defwAddr("S"); + case 3: + return defwAddr("E"); + case 4: + return defwAddr("FN"); + case 5: + return defwAddr("FW"); + case 6: + return defwAddr("FS"); + case 7: + return defwAddr("FE"); + }; + return defwAddr("BOGUS "); +} + + +int +defwRow(const char *rowName, + const char *rowType, + int x_orig, + int y_orig, + int orient, + int do_count, + int do_increment, + int do_x, + int do_y) +{ + defwFunc = DEFW_ROW; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + + if (defwState == DEFW_ROW) + fprintf(defwFile, ";\n");// add the ; and newline for the previous row. + + // required + if ((rowName == 0) || (*rowName == 0) || (rowType == 0) || (*rowType == 0)) + return DEFW_BAD_DATA; + + // do not have ; because the row may have properties + // do not end with newline, if there is no property, ; need to be concat. + fprintf(defwFile, "ROW %s %s %d %d %s ", rowName, rowType, x_orig, y_orig, + defwOrient(orient)); + if ((do_count != 0) || (do_increment != 0)) { + fprintf(defwFile, "DO %d BY %d ", do_count, do_increment); + if ((do_x != 0) || (do_y != 0)) + fprintf(defwFile, "STEP %d %d ", do_x, do_y); + } + defwLines++; + + defwState = DEFW_ROW; + return DEFW_OK; +} + + +int +defwRowStr(const char *rowName, + const char *rowType, + int x_orig, + int y_orig, + const char *orient, + int do_count, + int do_increment, + int do_x, + int do_y) +{ + defwFunc = DEFW_ROW; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + + if (defwState == DEFW_ROW) + fprintf(defwFile, ";\n");// add the ; and newline for the previous row. + + if ((!rowName || !*rowName) || (!rowType || !*rowType)) // required + return DEFW_BAD_DATA; + + // do not have ; because the row may have properties + // do not end with newline, if there is no property, ; need to be concat. + fprintf(defwFile, "ROW %s %s %d %d %s ", rowName, rowType, x_orig, y_orig, + orient); + if ((do_count != 0) || (do_increment != 0)) { + fprintf(defwFile, "DO %d BY %d ", do_count, do_increment); + if ((do_x != 0) || (do_y != 0)) + fprintf(defwFile, "STEP %d %d ", do_x, do_y); + } + defwLines++; + + defwState = DEFW_ROW; + return DEFW_OK; +} + + +int +defwTracks(const char *master, + int do_start, + int do_cnt, + int do_step, + int num_layers, + const char **layers, + int mask, + int sameMask) +{ + int i; + + defwFunc = DEFW_TRACKS; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + + if (defwState == DEFW_ROW) + fprintf(defwFile, ";\n\n"); // add the ; and \n for the previous row + + if (!master || !*master) // required + return DEFW_BAD_DATA; + if (strcmp(master, "X") && strcmp(master, "Y")) + return DEFW_BAD_DATA; + + + if (mask) { + if (defVersionNum < 5.8) { + return DEFW_WRONG_VERSION; + } + + if (sameMask) { + fprintf(defwFile, "TRACKS %s %d DO %d STEP %d MASK %d SAMEMASK", + master, do_start, do_cnt, do_step, mask); + } else { + fprintf(defwFile, "TRACKS %s %d DO %d STEP %d MASK %d", + master, do_start, do_cnt, do_step, mask); + } + } else { + fprintf(defwFile, "TRACKS %s %d DO %d STEP %d", + master, do_start, do_cnt, do_step); + } + + if (num_layers > 0) { + fprintf(defwFile, " LAYER"); + for (i = 0; i < num_layers; i++) { + fprintf(defwFile, " %s", layers[i]); + } + } + fprintf(defwFile, " ;\n"); + defwLines++; + + defwState = DEFW_TRACKS; + return DEFW_OK; +} + + +int +defwGcellGrid(const char *master, + int do_start, + int do_cnt, + int do_step) +{ + defwFunc = DEFW_GCELL_GRID; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + + if (defwState == DEFW_ROW) + fprintf(defwFile, ";\n\n"); // add the ; and \n for the previous row. + + if (!master || !*master) // required + return DEFW_BAD_DATA; + if (strcmp(master, "X") && strcmp(master, "Y")) + return DEFW_BAD_DATA; + + fprintf(defwFile, "GCELLGRID %s %d DO %d STEP %d ;\n", master, do_start, + do_cnt, do_step); + defwLines++; + + defwState = DEFW_GCELL_GRID; + return DEFW_OK; +} + + +int +defwStartDefaultCap(int count) +{ + defwObsoleteNum = DEFW_DEFAULTCAP_START; + defwFunc = DEFW_DEFAULTCAP_START; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + if ((defwState >= DEFW_DEFAULTCAP_START) && + (defwState <= DEFW_DEFAULTCAP_END)) + return DEFW_BAD_ORDER; + if (defVersionNum >= 5.4) + return DEFW_OBSOLETE; + + if (defwState == DEFW_ROW) + fprintf(defwFile, ";\n\n"); // add the ; and \n for the previous row. + + fprintf(defwFile, "DEFAULTCAP %d\n", count); + defwLines++; + + defwCounter = count; + defwState = DEFW_DEFAULTCAP_START; + return DEFW_OK; +} + + +int +defwDefaultCap(int pins, + double cap) +{ + defwFunc = DEFW_DEFAULTCAP; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_DEFAULTCAP_START && + defwState != DEFW_DEFAULTCAP) + return DEFW_BAD_ORDER; + + fprintf(defwFile, " MINPINS %d WIRECAP %f ;\n", pins, cap); + defwLines++; + defwCounter--; + + defwState = DEFW_DEFAULTCAP; + return DEFW_OK; +} + + +int +defwEndDefaultCap() +{ + defwFunc = DEFW_DEFAULTCAP_END; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_DEFAULTCAP_START && + defwState != DEFW_DEFAULTCAP) + return DEFW_BAD_ORDER; + if (defwCounter > 0) + return DEFW_BAD_DATA; + else if (defwCounter < 0) + return DEFW_TOO_MANY_STMS; + + fprintf(defwFile, "END DEFAULTCAP\n\n"); + defwLines++; + + defwState = DEFW_DEFAULTCAP_END; + return DEFW_OK; +} + + +int +defwCanPlace(const char *master, + int xOrig, + int yOrig, + int orient, + int doCnt, + int doInc, + int xStep, + int yStep) +{ + defwFunc = DEFW_CANPLACE; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + + if (defwState == DEFW_ROW) + fprintf(defwFile, ";\n\n"); // add the ; and \n for the previous row. + + if ((master == 0) || (*master == 0)) // required + return DEFW_BAD_DATA; + fprintf(defwFile, "CANPLACE %s %d %d %s DO %d BY %d STEP %d %d ;\n", + master, xOrig, yOrig, defwOrient(orient), + doCnt, doInc, xStep, yStep); + defwLines++; + + defwState = DEFW_CANPLACE; + return DEFW_OK; +} + + +int +defwCanPlaceStr(const char *master, + int xOrig, + int yOrig, + const char *orient, + int doCnt, + int doInc, + int xStep, + int yStep) +{ + defwFunc = DEFW_CANPLACE; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + + if (defwState == DEFW_ROW) + fprintf(defwFile, ";\n\n"); // add the ; and \n for the previous row. + + if (!master || !*master) // required + return DEFW_BAD_DATA; + fprintf(defwFile, "CANPLACE %s %d %d %s DO %d BY %d STEP %d %d ;\n", + master, xOrig, yOrig, orient, + doCnt, doInc, xStep, yStep); + defwLines++; + + defwState = DEFW_CANPLACE; + return DEFW_OK; +} + + +int +defwCannotOccupy(const char *master, + int xOrig, + int yOrig, + int orient, + int doCnt, + int doInc, + int xStep, + int yStep) +{ + defwFunc = DEFW_CANNOTOCCUPY; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + + if ((master == 0) || (*master == 0)) // required + return DEFW_BAD_DATA; + fprintf(defwFile, "CANNOTOCCUPY %s %d %d %s DO %d BY %d STEP %d %d ;\n", + master, xOrig, yOrig, defwOrient(orient), + doCnt, doInc, xStep, yStep); + defwLines++; + + defwState = DEFW_CANNOTOCCUPY; + return DEFW_OK; +} + + +int +defwCannotOccupyStr(const char *master, + int xOrig, + int yOrig, + const char *orient, + int doCnt, + int doInc, + int xStep, + int yStep) +{ + defwFunc = DEFW_CANNOTOCCUPY; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + + if (!master || !*master) // required + return DEFW_BAD_DATA; + fprintf(defwFile, "CANNOTOCCUPY %s %d %d %s DO %d BY %d STEP %d %d ;\n", + master, xOrig, yOrig, orient, + doCnt, doInc, xStep, yStep); + defwLines++; + + defwState = DEFW_CANNOTOCCUPY; + return DEFW_OK; +} + + +int +defwStartVias(int count) +{ + defwFunc = DEFW_VIA_START; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + if ((defwState >= DEFW_VIA_START) && (defwState <= DEFW_VIA_END)) + return DEFW_BAD_ORDER; + + if (defwState == DEFW_ROW) + fprintf(defwFile, ";\n\n"); // add the ; and \n for the previous row. + + fprintf(defwFile, "VIAS %d ;\n", count); + defwLines++; + + defwCounter = count; + defwState = DEFW_VIA_START; + return DEFW_OK; +} + + +int +defwViaName(const char *name) +{ + defwFunc = DEFW_VIA; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_VIA_START && + defwState != DEFW_VIAONE_END) + return DEFW_BAD_ORDER; + defwCounter--; + + if (!name || !*name) // required + return DEFW_BAD_DATA; + fprintf(defwFile, " - %s", name); + + defwState = DEFW_VIA; + defwViaHasVal = 0; + return DEFW_OK; +} + + +int +defwViaPattern(const char *pattern) +{ + defwFunc = DEFW_VIA; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_VIA) + return DEFW_BAD_ORDER; // after defwViaName + + if (defwViaHasVal) + return DEFW_ALREADY_DEFINED; // either PatternName or + // ViaRule has defined + if (!pattern || !*pattern) // required + return DEFW_BAD_DATA; + fprintf(defwFile, " + PATTERNNAME %s", pattern); + + defwState = DEFW_VIA; + defwViaHasVal = 1; + return DEFW_OK; +} + + +int +defwViaRect(const char *layerNames, + int xl, + int yl, + int xh, + int yh, + int mask) +{ + defwFunc = DEFW_VIA; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_VIA) + return DEFW_BAD_ORDER; + + if (!layerNames || !*layerNames) // required + return DEFW_BAD_DATA; + if (!mask) { + fprintf(defwFile, "\n + RECT %s ( %d %d ) ( %d %d )", layerNames, + xl, yl, xh, yh); + } else { + if (defVersionNum < 5.8) { + return DEFW_WRONG_VERSION; + } + + fprintf(defwFile, "\n + RECT %s + MASK %d ( %d %d ) ( %d %d )", + layerNames, mask, xl, yl, xh, yh); + } + defwLines++; + + + defwState = DEFW_VIA; + return DEFW_OK; +} + +int +defwViaPolygon(const char *layerName, + int num_polys, + double *xl, + double *yl, + int mask) +{ + int i; + + defwFunc = DEFW_VIA; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_VIA) + return DEFW_BAD_ORDER; + + if (defVersionNum < 5.6) + return DEFW_WRONG_VERSION; + + if (!mask) { + fprintf(defwFile, "\n + POLYGON %s ", layerName); + } else { + if (defVersionNum < 5.8) { + return DEFW_WRONG_VERSION; + } + + fprintf(defwFile, "\n + POLYGON %s + MASK %d ", layerName, mask); + } + + printPointsNum = 0; + for (i = 0; i < num_polys; i++) { + if ((i == 0) || ((i % 5) != 0)) + printPoints(defwFile, *xl++, *yl++, "", " "); + else { + printPoints(defwFile, *xl++, *yl++, "\n ", " "); + defwLines++; + } + } + defwLines++; + return DEFW_OK; +} + +int +defwViaViarule(const char *viaRuleName, + double xCutSize, + double yCutSize, + const char *botMetalLayer, + const char *cutLayer, + const char *topMetalLayer, + double xCutSpacing, + double yCutSpacing, + double xBotEnc, + double yBotEnc, + double xTopEnc, + double yTopEnc) +{ + defwFunc = DEFW_VIA; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_VIA) + return DEFW_BAD_ORDER; + if (defwViaHasVal) + return DEFW_ALREADY_DEFINED; // either PatternName or + // ViaRule has defined + if (defVersionNum < 5.6) + return DEFW_WRONG_VERSION; + + fprintf(defwFile, " + VIARULE %s\n", viaRuleName); + fprintf(defwFile, " + CUTSIZE %.11g %.11g\n", xCutSize, yCutSize); + fprintf(defwFile, " + LAYERS %s %s %s\n", botMetalLayer, + cutLayer, topMetalLayer); + fprintf(defwFile, " + CUTSPACING %.11g %.11g\n", + xCutSpacing, yCutSpacing); + fprintf(defwFile, " + ENCLOSURE %.11g %.11g %.11g %.11g", + xBotEnc, yBotEnc, xTopEnc, yTopEnc); + defwLines += 5; + defwState = DEFW_VIAVIARULE; + defwViaHasVal = 1; + return DEFW_OK; +} + +int +defwViaViaruleRowCol(int numCutRows, + int numCutCols) +{ + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_VIAVIARULE) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "\n + ROWCOL %d %d", numCutRows, numCutCols); + defwLines++; + return DEFW_OK; +} + +int +defwViaViaruleOrigin(int xOffset, + int yOffset) +{ + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_VIAVIARULE) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "\n + ORIGIN %d %d", xOffset, yOffset); + defwLines++; + return DEFW_OK; +} + +int +defwViaViaruleOffset(int xBotOffset, + int yBotOffset, + int xTopOffset, + int yTopOffset) +{ + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_VIAVIARULE) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "\n + OFFSET %d %d %d %d", + xBotOffset, yBotOffset, xTopOffset, yTopOffset); + defwLines++; + return DEFW_OK; +} + +int +defwViaViarulePattern(const char *cutPattern) +{ + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_VIAVIARULE) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "\n + PATTERN %s", cutPattern); + defwLines++; + return DEFW_OK; +} + +int +defwOneViaEnd() +{ + defwFunc = DEFW_VIA; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if ((defwState != DEFW_VIA) && (defwState != DEFW_VIAVIARULE)) + return DEFW_BAD_ORDER; + + fprintf(defwFile, " ;\n"); + defwLines++; + + defwState = DEFW_VIAONE_END; + return DEFW_OK; +} + + +int +defwEndVias() +{ + defwFunc = DEFW_VIA_END; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_VIA_START && + defwState != DEFW_VIAONE_END) + return DEFW_BAD_ORDER; + if (defwCounter > 0) + return DEFW_BAD_DATA; + else if (defwCounter < 0) + return DEFW_TOO_MANY_STMS; + + fprintf(defwFile, "END VIAS\n\n"); + defwLines++; + + defwState = DEFW_VIA_END; + return DEFW_OK; +} + + +int +defwStartRegions(int count) +{ + defwFunc = DEFW_REGION_START; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + if ((defwState >= DEFW_REGION_START) && (defwState <= DEFW_REGION_END)) + return DEFW_BAD_ORDER; + + if (defwState == DEFW_ROW) + fprintf(defwFile, ";\n\n"); // add the ; and \n for the previous row. + + fprintf(defwFile, "REGIONS %d ;\n", count); + defwLines++; + + defwCounter = count; + defwState = DEFW_REGION_START; + return DEFW_OK; +} + + +int +defwRegionName(const char *name) +{ + defwFunc = DEFW_REGION; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_REGION_START && + defwState != DEFW_REGION) + return DEFW_BAD_ORDER; + defwCounter--; + + if (defwState == DEFW_REGION) + fprintf(defwFile, ";\n"); // add the ; and \n for the previous row. + + if (!name || !*name) // required + return DEFW_BAD_DATA; + fprintf(defwFile, " - %s ", name); + defwState = DEFW_REGION; + return DEFW_OK; +} + + +int +defwRegionPoints(int xl, + int yl, + int xh, + int yh) +{ + defwFunc = DEFW_REGION; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_REGION) + return DEFW_BAD_ORDER; // after RegionName + + fprintf(defwFile, " ( %d %d ) ( %d %d ) ", xl, yl, xh, yh); + + defwState = DEFW_REGION; + return DEFW_OK; +} + + +int +defwRegionType(const char *type) +{ + defwFunc = DEFW_REGION; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_REGION) + return DEFW_BAD_ORDER; // after RegionName + + if (!type || !*type) // required + return DEFW_BAD_DATA; + if (strcmp(type, "FENCE") && strcmp(type, "GUIDE")) + return DEFW_BAD_DATA; + + fprintf(defwFile, " + TYPE %s ", type); + + defwState = DEFW_REGION; + return DEFW_OK; +} + + +int +defwEndRegions() +{ + defwFunc = DEFW_REGION_END; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_REGION_START && + defwState != DEFW_REGION) + return DEFW_BAD_ORDER; + if (defwCounter > 0) + return DEFW_BAD_DATA; + else if (defwCounter < 0) + return DEFW_TOO_MANY_STMS; + + if (defwState == DEFW_REGION) + fprintf(defwFile, ";\nEND REGIONS\n\n"); // ; for the previous statement + else + fprintf(defwFile, "END REGIONS\n\n"); // ; for the previous statement + defwLines++; + + defwState = DEFW_REGION_END; + return DEFW_OK; +} + + +int +defwComponentMaskShiftLayers(const char **layerNames, + int numLayerName) +{ + if (defVersionNum < 5.8) { + return DEFW_WRONG_VERSION; + } + + defwFunc = DEFW_COMPONENT_MASKSHIFTLAYERS; + + if (!defwFile) + return DEFW_UNINITIALIZED; + + if (defwState == DEFW_COMPONENT_MASKSHIFTLAYERS) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "COMPONENTMASKSHIFT "); + + if (numLayerName) { + for (int i = 0; i < numLayerName; i++) + fprintf(defwFile, "%s ", layerNames[i]); + } + + fprintf(defwFile, ";\n\n"); + + defwLines++; + + defwState = DEFW_COMPONENT_MASKSHIFTLAYERS; + return DEFW_OK; +} + + +int +defwStartComponents(int count) +{ + defwFunc = DEFW_COMPONENT_START; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + if ((defwState >= DEFW_COMPONENT_START) && (defwState <= DEFW_COMPONENT_END)) + return DEFW_BAD_ORDER; + + if (defwState == DEFW_ROW) + fprintf(defwFile, ";\n\n"); // add the ; and \n for the previous row. + + fprintf(defwFile, "COMPONENTS %d ;\n", count); + defwLines++; + + defwCounter = count; + defwState = DEFW_COMPONENT_START; + return DEFW_OK; +} + + +int +defwComponent(const char *instance, + const char *master, + int numNetName, + const char **netNames, + const char *eeq, + const char *genName, + const char *genParemeters, + const char *source, + int numForeign, + const char **foreigns, + int *foreignX, + int *foreignY, + int *foreignOrients, + const char *status, + int statusX, + int statusY, + int statusOrient, + double weight, + const char *region, + int xl, + int yl, + int xh, + int yh) +{ + + int i; + int uplace = 0; + + defwFunc = DEFW_COMPONENT; // Current function of writer + + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_COMPONENT_START && + defwState != DEFW_COMPONENT) + return DEFW_BAD_ORDER; + + defwCounter--; + + // required + if ((instance == 0) || (*instance == 0) || (master == 0) || (*master == 0)) + return DEFW_BAD_DATA; + + if (source && strcmp(source, "NETLIST") && strcmp(source, "DIST") && + strcmp(source, "USER") && strcmp(source, "TIMING")) + return DEFW_BAD_DATA; + + if (status) { + if (strcmp(status, "UNPLACED") == 0) { + uplace = 1; + } else if (strcmp(status, "COVER") && strcmp(status, "FIXED") && + strcmp(status, "PLACED")) + return DEFW_BAD_DATA; + } + + // only either region or xl, yl, xh, yh + if (region && (xl || yl || xh || yh)) + return DEFW_BAD_DATA; + + if (defwState == DEFW_COMPONENT) + fprintf(defwFile, ";\n"); // newline for the previous component + + fprintf(defwFile, " - %s %s ", instance, master); + if (numNetName) { + for (i = 0; i < numNetName; i++) + fprintf(defwFile, "%s ", netNames[i]); + } + defwLines++; + // since the rest is optionals, new line is placed before the options + if (eeq) { + fprintf(defwFile, "\n + EEQMASTER %s ", eeq); + defwLines++; + } + if (genName) { + fprintf(defwFile, "\n + GENERATE %s ", genName); + if (genParemeters) + fprintf(defwFile, " %s ", genParemeters); + defwLines++; + } + if (source) { + fprintf(defwFile, "\n + SOURCE %s ", source); + defwLines++; + } + if (numForeign) { + for (i = 0; i < numForeign; i++) { + fprintf(defwFile, "\n + FOREIGN %s ( %d %d ) %s ", foreigns[i], + foreignX[i], foreignY[i], defwOrient(foreignOrients[i])); + defwLines++; + } + } + if (status && (uplace == 0)) { + fprintf(defwFile, "\n + %s ( %d %d ) %s ", status, statusX, statusY, + defwOrient(statusOrient)); + } else if (uplace) { + fprintf(defwFile, "\n + %s ", status); + } + defwLines++; + if (weight) { + fprintf(defwFile, "\n + WEIGHT %.11g ", weight); + defwLines++; + } + if (region) { + fprintf(defwFile, "\n + REGION %s ", region); + defwLines++; + } else if (xl || yl || xh || yh) { + fprintf(defwFile, "\n + REGION ( %d %d ) ( %d %d ) ", + xl, yl, xh, yh); + defwLines++; + } + + defwState = DEFW_COMPONENT; + return DEFW_OK; +} + + +int +defwComponentStr(const char *instance, + const char *master, + int numNetName, + const char **netNames, + const char *eeq, + const char *genName, + const char *genParemeters, + const char *source, + int numForeign, + const char **foreigns, + int *foreignX, + int *foreignY, + const char **foreignOrients, + const char *status, + int statusX, + int statusY, + const char *statusOrient, + double weight, + const char *region, + int xl, + int yl, + int xh, + int yh) +{ + + int i; + int uplace = 0; + + defwFunc = DEFW_COMPONENT; // Current function of writer + + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_COMPONENT_START && + defwState != DEFW_COMPONENT) + return DEFW_BAD_ORDER; + + defwCounter--; + + if ((!instance || !*instance) || (!master || !*master)) // required + return DEFW_BAD_DATA; + + if (source && strcmp(source, "NETLIST") && strcmp(source, "DIST") && + strcmp(source, "USER") && strcmp(source, "TIMING")) + return DEFW_BAD_DATA; + + if (status) { + if (strcmp(status, "UNPLACED") == 0) { + uplace = 1; + } else if (strcmp(status, "COVER") && strcmp(status, "FIXED") && + strcmp(status, "PLACED")) + return DEFW_BAD_DATA; + } + + // only either region or xl, yl, xh, yh + if (region && (xl || yl || xh || yh)) + return DEFW_BAD_DATA; + + if (defwState == DEFW_COMPONENT) + fprintf(defwFile, ";\n"); // newline for the previous component + + fprintf(defwFile, " - %s %s ", instance, master); + if (numNetName) { + for (i = 0; i < numNetName; i++) + fprintf(defwFile, "%s ", netNames[i]); + } + defwLines++; + // since the rest is optionals, new line is placed before the options + if (eeq) { + fprintf(defwFile, "\n + EEQMASTER %s ", eeq); + defwLines++; + } + if (genName) { + fprintf(defwFile, "\n + GENERATE %s ", genName); + if (genParemeters) + fprintf(defwFile, " %s ", genParemeters); + defwLines++; + } + if (source) { + fprintf(defwFile, "\n + SOURCE %s ", source); + defwLines++; + } + if (numForeign) { + for (i = 0; i < numForeign; i++) { + fprintf(defwFile, "\n + FOREIGN %s ( %d %d ) %s ", foreigns[i], + foreignX[i], foreignY[i], foreignOrients[i]); + defwLines++; + } + } + if (status && (uplace == 0)) { + fprintf(defwFile, "\n + %s ( %d %d ) %s ", status, statusX, statusY, + statusOrient); + } else if (uplace) { + fprintf(defwFile, "\n + %s ", status); + } + defwLines++; + if (weight) { + fprintf(defwFile, "\n + WEIGHT %.11g ", weight); + defwLines++; + } + if (region) { + fprintf(defwFile, "\n + REGION %s ", region); + defwLines++; + } else if (xl || yl || xh || yh) { + fprintf(defwFile, "\n + REGION ( %d %d ) ( %d %d ) ", + xl, yl, xh, yh); + defwLines++; + } + + defwState = DEFW_COMPONENT; + return DEFW_OK; +} + +int +defwComponentMaskShift(int shiftLayerMasks) +{ + defwFunc = DEFW_COMPONENT; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defVersionNum < 5.8) { + return DEFW_WRONG_VERSION; + } + + if (defwState != DEFW_COMPONENT) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "\n + MASKSHIFT %d ", shiftLayerMasks); + defwLines++; + return DEFW_OK; +} + +int +defwComponentHalo(int left, + int bottom, + int right, + int top) +{ + defwFunc = DEFW_COMPONENT; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defVersionNum < 5.6) + return DEFW_WRONG_VERSION; + if (defwState != DEFW_COMPONENT) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "\n + HALO %d %d %d %d ", left, bottom, right, top); + defwLines++; + return DEFW_OK; +} + +// 5.7 +int +defwComponentHaloSoft(int left, + int bottom, + int right, + int top) +{ + defwFunc = DEFW_COMPONENT; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defVersionNum < 5.7) + return DEFW_WRONG_VERSION; + if (defwState != DEFW_COMPONENT) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "\n + HALO SOFT %d %d %d %d ", left, bottom, + right, top); + defwLines++; + return DEFW_OK; +} + +// 5.7 +int +defwComponentRouteHalo(int haloDist, + const char *minLayer, + const char *maxLayer) +{ + defwFunc = DEFW_COMPONENT; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defVersionNum < 5.7) + return DEFW_WRONG_VERSION; + if (defwState != DEFW_COMPONENT) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "\n + ROUTEHALO %d %s %s ", haloDist, minLayer, + maxLayer); + defwLines++; + return DEFW_OK; +} + + +int +defwEndComponents() +{ + defwFunc = DEFW_COMPONENT_END; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_COMPONENT_START && + defwState != DEFW_COMPONENT) + return DEFW_BAD_ORDER; + if (defwCounter > 0) + return DEFW_BAD_DATA; + else if (defwCounter < 0) + return DEFW_TOO_MANY_STMS; + + defwDidComponents = 1; + + if (defwState == DEFW_COMPONENT) + fprintf(defwFile, ";\nEND COMPONENTS\n\n"); + else + fprintf(defwFile, "END COMPONENTS\n\n"); + defwLines++; + + defwState = DEFW_COMPONENT_END; + return DEFW_OK; +} + + +int +defwStartPins(int count) +{ + defwFunc = DEFW_PIN_START; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidComponents) + return DEFW_BAD_ORDER; + if ((defwState >= DEFW_PIN_START) && (defwState <= DEFW_PIN_END)) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "PINS %d", count); + defwLines++; + + defwCounter = count; + defwState = DEFW_PIN_START; + return DEFW_OK; +} + + +int +defwPin(const char *name, + const char *net, + int special, // optional 0-ignore 1-special + const char *direction, // optional + const char *use, // optional + const char *status, + int xo, + int yo, + int orient, // optional + const char *layer, + int xl, + int yl, + int xh, + int yh // optional + ) +{ + + defwFunc = DEFW_PIN; // Current function of writer + + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PIN_START && defwState != DEFW_PIN) + return DEFW_BAD_ORDER; + + defwCounter--; + + fprintf(defwFile, " ;\n - %s + NET %s", name, net); + + if (special) + fprintf(defwFile, "\n + SPECIAL"); + if (direction) { + if (strcmp(direction, "INPUT") && strcmp(direction, "OUTPUT") && + strcmp(direction, "INOUT") && strcmp(direction, "FEEDTHRU")) + return DEFW_BAD_DATA; + fprintf(defwFile, "\n + DIRECTION %s", direction); + } + if (use) { + if (strcmp(use, "SIGNAL") && strcmp(use, "POWER") && + strcmp(use, "GROUND") && strcmp(use, "CLOCK") && + strcmp(use, "TIEOFF") && strcmp(use, "ANALOG") && + strcmp(use, "SCAN") && strcmp(use, "RESET")) + return DEFW_BAD_DATA; + fprintf(defwFile, "\n + USE %s", use); + } + if (status) { + if (strcmp(status, "FIXED") && strcmp(status, "PLACED") && + strcmp(status, "COVER")) + return DEFW_BAD_DATA; + + fprintf(defwFile, "\n + %s ( %d %d ) %s", status, xo, yo, + defwOrient(orient)); + } + // In 5.6, user should use defPinLayer to write out layer construct + if (layer) { + fprintf(defwFile, "\n + LAYER %s ( %d %d ) ( %d %d )", + layer, xl, yl, xh, yh); + } + + defwLines++; + + defwState = DEFW_PIN; + return DEFW_OK; +} + + +int +defwPinStr(const char *name, + const char *net, + int special, // optional 0-ignore 1-special + const char *direction, // optional + const char *use, // optional + const char *status, + int xo, + int yo, + const char *orient, // optional + const char *layer, + int xl, + int yl, + int xh, + int yh // optional + ) +{ + + defwFunc = DEFW_PIN; // Current function of writer + + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PIN_START && defwState != DEFW_PIN) + return DEFW_BAD_ORDER; + + defwCounter--; + + fprintf(defwFile, " ;\n - %s + NET %s", name, net); + + if (special) + fprintf(defwFile, "\n + SPECIAL"); + if (direction) { + if (strcmp(direction, "INPUT") && strcmp(direction, "OUTPUT") && + strcmp(direction, "INOUT") && strcmp(direction, "FEEDTHRU")) + return DEFW_BAD_DATA; + fprintf(defwFile, "\n + DIRECTION %s", direction); + } + if (use) { + if (strcmp(use, "SIGNAL") && strcmp(use, "POWER") && + strcmp(use, "GROUND") && strcmp(use, "CLOCK") && + strcmp(use, "TIEOFF") && strcmp(use, "ANALOG") && + strcmp(use, "SCAN") && strcmp(use, "RESET")) + return DEFW_BAD_DATA; + fprintf(defwFile, "\n + USE %s", use); + } + if (status) { + if (strcmp(status, "FIXED") && strcmp(status, "PLACED") && + strcmp(status, "COVER")) + return DEFW_BAD_DATA; + + fprintf(defwFile, "\n + %s ( %d %d ) %s", status, xo, yo, + orient); + } + // In 5.6, user should use defPinLayer to write out layer construct + if (layer) { + fprintf(defwFile, "\n + LAYER %s ( %d %d ) ( %d %d )", + layer, xl, yl, xh, yh); + } + + defwLines++; + + defwState = DEFW_PIN; + return DEFW_OK; +} + +int +defwPinLayer(const char *layerName, + int spacing, + int designRuleWidth, + int xl, + int yl, + int xh, + int yh, + int mask) +{ + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PIN) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.6) + return DEFW_WRONG_VERSION; + if (spacing && designRuleWidth) + return DEFW_BAD_DATA; // only one, spacing + // or designRuleWidth can be defined, not both + + fprintf(defwFile, "\n + LAYER %s ", layerName); + + if (mask) { + if (defVersionNum < 5.8) { + return DEFW_WRONG_VERSION; + } + + fprintf(defwFile, "\n MASK %d", mask); + } + + if (spacing) + fprintf(defwFile, "\n SPACING %d", spacing); + else if (designRuleWidth) // can be both 0 + fprintf(defwFile, "\n DESIGNRULEWIDTH %d", designRuleWidth); + fprintf(defwFile, "\n ( %d %d ) ( %d %d )", xl, yl, xh, yh); + + defwState = DEFW_PIN; + defwLines++; + return DEFW_OK; +} + +int +defwPinPolygon(const char *layerName, + int spacing, + int designRuleWidth, + int num_polys, + double *xl, + double *yl, + int mask) +{ + int i; + + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PIN) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.6) + return DEFW_WRONG_VERSION; + if (spacing && designRuleWidth) + return DEFW_BAD_DATA; // only one, spacing + // or designRuleWidth can be defined, not both + + fprintf(defwFile, "\n + POLYGON %s ", layerName); + + if (mask) { + if (defVersionNum < 5.8) { + return DEFW_WRONG_VERSION; + } + + fprintf(defwFile, "\n MASK %d", mask); + } + + if (spacing) + fprintf(defwFile, "\n SPACING %d", spacing); + else if (designRuleWidth) // can be both 0 + fprintf(defwFile, "\n DESIGNRULEWIDTH %d", designRuleWidth); + + printPointsNum = 0; + + for (i = 0; i < num_polys; i++) { + if ((i == 0) || ((i % 5) == 0)) { + printPoints(defwFile, *xl++, *yl++, "\n ", " "); + defwLines++; + } else + printPoints(defwFile, *xl++, *yl++, "", " "); + } + + defwState = DEFW_PIN; + defwLines++; + return DEFW_OK; +} + +// 5.7 +int +defwPinVia(const char *viaName, + int xl, + int yl, + int mask) +{ + + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PIN) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.7) + return DEFW_WRONG_VERSION; + + if (mask) { + if (defVersionNum < 5.8) { + return DEFW_WRONG_VERSION; + } + + fprintf(defwFile, "\n + VIA %s MASK %d ( %d %d ) ", viaName, mask, xl, yl); + } else { + fprintf(defwFile, "\n + VIA %s ( %d %d ) ", viaName, xl, yl); + } + + defwLines++; + defwState = DEFW_PIN; + return DEFW_OK; +} + + +// 5.7 +int +defwPinPort() +{ + + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PIN) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.7) + return DEFW_WRONG_VERSION; + + fprintf(defwFile, "\n + PORT"); + + defwLines++; + defwState = DEFW_PIN_PORT; + return DEFW_OK; +} + +// 5.7 +int +defwPinPortLayer(const char *layerName, + int spacing, + int designRuleWidth, + int xl, + int yl, + int xh, + int yh, + int mask) +{ + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PIN && defwState != DEFW_PIN_PORT) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.7) + return DEFW_WRONG_VERSION; + if (spacing && designRuleWidth) + return DEFW_BAD_DATA; // only one, spacing + // or designRuleWidth can be defined, not both + + fprintf(defwFile, "\n + LAYER %s ", layerName); + + if (mask) { + if (defVersionNum < 5.8) { + return DEFW_WRONG_VERSION; + } + + fprintf(defwFile, "\n MASK %d", mask); + } + + if (spacing) + fprintf(defwFile, "\n SPACING %d", spacing); + else if (designRuleWidth) // can be both 0 + fprintf(defwFile, "\n DESIGNRULEWIDTH %d", designRuleWidth); + + fprintf(defwFile, "\n ( %d %d ) ( %d %d )", xl, yl, xh, yh); + + defwState = DEFW_PIN; + defwLines++; + return DEFW_OK; +} + +// 5.7 +int +defwPinPortPolygon(const char *layerName, + int spacing, + int designRuleWidth, + int num_polys, + double *xl, + double *yl, + int mask) +{ + int i; + + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PIN && defwState != DEFW_PIN_PORT) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.7) + return DEFW_WRONG_VERSION; + if (spacing && designRuleWidth) + return DEFW_BAD_DATA; // only one, spacing + // or designRuleWidth can be defined, not both + + fprintf(defwFile, "\n + POLYGON %s ", layerName); + + if (mask) { + if (defVersionNum < 5.8) { + return DEFW_WRONG_VERSION; + } + + fprintf(defwFile, "\n MASK %d", mask); + } + + if (spacing) + fprintf(defwFile, "\n SPACING %d", spacing); + else if (designRuleWidth) // can be both 0 + fprintf(defwFile, "\n DESIGNRULEWIDTH %d", designRuleWidth); + + printPointsNum = 0; + for (i = 0; i < num_polys; i++) { + if ((i == 0) || ((i % 5) == 0)) { + printPoints(defwFile, *xl++, *yl++, "\n ", " "); + defwLines++; + } else + printPoints(defwFile, *xl++, *yl++, "", " "); + } + + defwState = DEFW_PIN; + defwLines++; + return DEFW_OK; +} + +// 5.7 +int +defwPinPortVia(const char *viaName, + int xl, + int yl, + int mask) +{ + + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PIN && defwState != DEFW_PIN_PORT) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.7) + return DEFW_WRONG_VERSION; + + if (mask) { + if (defVersionNum < 5.8) { + return DEFW_WRONG_VERSION; + } + + fprintf(defwFile, "\n + VIA %s MASK %d ( %d %d ) ", viaName, mask, xl, yl); + } else { + fprintf(defwFile, "\n + VIA %s ( %d %d ) ", viaName, xl, yl); + } + + defwLines++; + defwState = DEFW_PIN; + return DEFW_OK; +} + +// 5.7 +int +defwPinPortLocation(const char *status, + int statusX, + int statusY, + const char *orient) +{ + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PIN && defwState != DEFW_PIN_PORT) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.7) + return DEFW_WRONG_VERSION; + + if (strcmp(status, "FIXED") && strcmp(status, "PLACED") && + strcmp(status, "COVER")) + return DEFW_BAD_DATA; + fprintf(defwFile, "\n + %s ( %d %d ) %s ", status, statusX, statusY, + orient); + defwState = DEFW_PIN; + defwLines++; + return DEFW_OK; +} + +int +defwPinNetExpr(const char *pinExpr) +{ + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PIN) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.6) + return DEFW_WRONG_VERSION; + if (pinExpr && pinExpr != 0 && *pinExpr != 0) + fprintf(defwFile, "\n + NETEXPR \"%s\"", pinExpr); + + defwLines++; + return DEFW_OK; +} + + +int +defwPinSupplySensitivity(const char *pinName) +{ + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PIN) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.6) + return DEFW_WRONG_VERSION; + if (pinName && pinName != 0 && *pinName != 0) + fprintf(defwFile, "\n + SUPPLYSENSITIVITY %s", pinName); + + defwLines++; + return DEFW_OK; +} + + +int +defwPinGroundSensitivity(const char *pinName) +{ + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PIN) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.6) + return DEFW_WRONG_VERSION; + if (pinName && pinName != 0 && *pinName != 0) + fprintf(defwFile, "\n + GROUNDSENSITIVITY %s", pinName); + + defwLines++; + return DEFW_OK; +} + + +int +defwPinAntennaPinPartialMetalArea(int value, + const char *layerName) +{ + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PIN) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.4) + return DEFW_WRONG_VERSION; + + fprintf(defwFile, "\n + ANTENNAPINPARTIALMETALAREA %d", value); + if (layerName) + fprintf(defwFile, " LAYER %s", layerName); + defwLines++; + + return DEFW_OK; +} + + +int +defwPinAntennaPinPartialMetalSideArea(int value, + const char *layerName) +{ + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PIN) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.4) + return DEFW_WRONG_VERSION; + + fprintf(defwFile, "\n + ANTENNAPINPARTIALMETALSIDEAREA %d", value); + if (layerName) + fprintf(defwFile, " LAYER %s", layerName); + defwLines++; + + return DEFW_OK; +} + + +int +defwPinAntennaPinPartialCutArea(int value, + const char *layerName) +{ + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PIN) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.4) + return DEFW_WRONG_VERSION; + + fprintf(defwFile, "\n + ANTENNAPINPARTIALCUTAREA %d", value); + if (layerName) + fprintf(defwFile, " LAYER %s", layerName); + defwLines++; + + return DEFW_OK; +} + + +int +defwPinAntennaModel(const char *oxide) +{ + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PIN) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.4) + return DEFW_WRONG_VERSION; + + fprintf(defwFile, "\n + ANTENNAMODEL %s", oxide); + defwLines++; + + return DEFW_OK; +} + + +int +defwPinAntennaPinDiffArea(int value, + const char *layerName) +{ + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PIN) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.4) + return DEFW_WRONG_VERSION; + + fprintf(defwFile, "\n + ANTENNAPINDIFFAREA %d", value); + if (layerName) + fprintf(defwFile, " LAYER %s", layerName); + defwLines++; + + return DEFW_OK; +} + + +int +defwPinAntennaPinGateArea(int value, + const char *layerName) +{ + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PIN) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.4) + return DEFW_WRONG_VERSION; + + fprintf(defwFile, "\n + ANTENNAPINGATEAREA %d", value); + if (layerName) + fprintf(defwFile, " LAYER %s", layerName); + defwLines++; + + return DEFW_OK; +} + + +int +defwPinAntennaPinMaxAreaCar(int value, + const char *layerName) +{ + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PIN) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.4) + return DEFW_WRONG_VERSION; + + fprintf(defwFile, "\n + ANTENNAPINMAXAREACAR %d", value); + if (!layerName) + return DEFW_BAD_DATA; // layerName is required + + fprintf(defwFile, " LAYER %s", layerName); + defwLines++; + + return DEFW_OK; +} + + +int +defwPinAntennaPinMaxSideAreaCar(int value, + const char *layerName) +{ + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PIN) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.4) + return DEFW_WRONG_VERSION; + + fprintf(defwFile, "\n + ANTENNAPINMAXSIDEAREACAR %d", value); + if (!layerName) + return DEFW_BAD_DATA; // layerName is required + + fprintf(defwFile, " LAYER %s", layerName); + defwLines++; + + return DEFW_OK; +} + + +int +defwPinAntennaPinMaxCutCar(int value, + const char *layerName) +{ + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PIN) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.4) + return DEFW_WRONG_VERSION; + + fprintf(defwFile, "\n + ANTENNAPINMAXCUTCAR %d", value); + if (!layerName) + return DEFW_BAD_DATA; + + fprintf(defwFile, " LAYER %s", layerName); + defwLines++; + + return DEFW_OK; +} + + +int +defwEndPins() +{ + defwFunc = DEFW_PIN_END; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PIN_START && defwState != DEFW_PIN) + return DEFW_BAD_ORDER; + if (defwCounter > 0) + return DEFW_BAD_DATA; + else if (defwCounter < 0) + return DEFW_TOO_MANY_STMS; + + fprintf(defwFile, " ;\nEND PINS\n\n"); + defwLines++; + + defwState = DEFW_PIN_END; + return DEFW_OK; +} + + +int +defwStartPinProperties(int count) +{ + defwFunc = DEFW_PINPROP_START; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if ((defwState >= DEFW_PINPROP_START) && (defwState <= DEFW_PINPROP_END)) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "PINPROPERTIES %d ;\n", count); + defwLines++; + + defwCounter = count; + defwState = DEFW_PINPROP_START; + return DEFW_OK; +} + + +int +defwPinProperty(const char *name, + const char *pinName) +{ + + defwFunc = DEFW_PINPROP; // Current function of writer + + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PINPROP_START && + defwState != DEFW_PINPROP) + return DEFW_BAD_ORDER; + + defwCounter--; + if ((!name || !*name) || (!pinName || !*pinName)) // required + return DEFW_BAD_DATA; + + if (defwState == DEFW_PINPROP) + fprintf(defwFile, ";\n"); + + fprintf(defwFile, " - %s %s ", name, pinName); + defwLines++; + + defwState = DEFW_PINPROP; + return DEFW_OK; +} + + +int +defwEndPinProperties() +{ + defwFunc = DEFW_PIN_END; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PINPROP_START && + defwState != DEFW_PINPROP) + return DEFW_BAD_ORDER; + if (defwCounter > 0) + return DEFW_BAD_DATA; + else if (defwCounter < 0) + return DEFW_TOO_MANY_STMS; + + if (defwState == DEFW_PINPROP_START) + fprintf(defwFile, "END PINPROPERTIES\n\n"); + else + fprintf(defwFile, ";\nEND PINPROPERTIES\n\n"); + defwLines++; + + defwState = DEFW_PINPROP_END; + return DEFW_OK; +} + + +int +defwStartSpecialNets(int count) +{ + defwFunc = DEFW_SNET_START; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if ((defwState >= DEFW_SNET_START) && (defwState <= DEFW_SNET_END)) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "SPECIALNETS %d ;\n", count); + defwLines++; + + defwCounter = count; + defwState = DEFW_SNET_START; + return DEFW_OK; +} + + +int +defwSpecialNetOptions() +{ + defwFunc = DEFW_SNET; // Current function of writer + if (defwState == DEFW_SNET) { + defwState = DEFW_SNET_OPTIONS; + return 1; + } + if (defwState == DEFW_SNET_OPTIONS) + return 1; + return 0; +} + + +int +defwSpecialNet(const char *name) +{ + defwFunc = DEFW_SNET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_SNET_START && + defwState != DEFW_SNET_ENDNET) + return DEFW_BAD_ORDER; + defwState = DEFW_SNET; + + fprintf(defwFile, " - %s", name); + defwLineItemCounter = 0; + defwCounter--; + + return DEFW_OK; +} + + +int +defwSpecialNetConnection(const char *inst, + const char *pin, + int synthesized) +{ + defwFunc = DEFW_SNET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_SNET) + return DEFW_BAD_ORDER; + + if ((++defwLineItemCounter & 3) == 0) { // since a net can have more than + fprintf(defwFile, "\n "); // one inst pin connection, don't print + defwLines++; // newline until the line is certain length + } + fprintf(defwFile, " ( %s %s ", inst, pin); + if (synthesized) + fprintf(defwFile, " + SYNTHESIZED "); + fprintf(defwFile, ") "); + return DEFW_OK; +} + + +int +defwSpecialNetFixedbump() +{ + defwFunc = DEFW_SNET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwSpecialNetOptions()) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "\n + FIXEDBUMP"); + defwLines++; + return DEFW_OK; +} + +int +defwSpecialNetVoltage(double d) +{ + defwFunc = DEFW_SNET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwSpecialNetOptions()) + return DEFW_BAD_ORDER; + + int v = (int)(d * 1000); + + fprintf(defwFile, "\n + VOLTAGE %d", v); + defwLines++; + return DEFW_OK; +} + + +int +defwSpecialNetSpacing(const char *layer, + int spacing, + double minwidth, + double maxwidth) +{ + defwFunc = DEFW_SNET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwSpecialNetOptions()) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "\n + SPACING %s %d", layer, spacing); + if (minwidth || maxwidth) + fprintf(defwFile, " RANGE %.11g %.11g", minwidth, maxwidth); + defwLines++; + return DEFW_OK; +} + + +int +defwSpecialNetWidth(const char *layer, + int w) +{ + defwFunc = DEFW_SNET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwSpecialNetOptions()) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "\n + WIDTH %s %d", layer, w); + defwLines++; + return DEFW_OK; +} + + +int +defwSpecialNetSource(const char *name) +{ + defwFunc = DEFW_SNET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwSpecialNetOptions()) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "\n + SOURCE %s", name); + defwLines++; + return DEFW_OK; +} + + +int +defwSpecialNetOriginal(const char *name) +{ + defwFunc = DEFW_SNET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwSpecialNetOptions()) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "\n + ORIGINAL %s", name); + defwLines++; + return DEFW_OK; +} + + +int +defwSpecialNetPattern(const char *name) +{ + defwFunc = DEFW_SNET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwSpecialNetOptions()) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "\n + PATTERN %s", name); + defwLines++; + return DEFW_OK; +} + + +int +defwSpecialNetUse(const char *name) +{ + defwFunc = DEFW_SNET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwSpecialNetOptions()) + return DEFW_BAD_ORDER; + + if (strcmp(name, "SIGNAL") && strcmp(name, "POWER") && + strcmp(name, "GROUND") && strcmp(name, "CLOCK") && + strcmp(name, "TIEOFF") && strcmp(name, "ANALOG") && + strcmp(name, "SCAN") && strcmp(name, "RESET")) + return DEFW_BAD_DATA; + + fprintf(defwFile, "\n + USE %s", name); + defwLines++; + return DEFW_OK; +} + + +int +defwSpecialNetWeight(double d) +{ + defwFunc = DEFW_SNET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwSpecialNetOptions()) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "\n + WEIGHT %.11g", d); + defwLines++; + return DEFW_OK; +} + + +int +defwSpecialNetEstCap(double d) +{ + defwFunc = DEFW_SNET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwSpecialNetOptions()) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "\n + ESTCAP %.11g", d); + defwLines++; + return DEFW_OK; +} + +int +defwSpecialNetPathStart(const char *typ) +{ + defwFunc = DEFW_PATH; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwSpecialNetOptions() && + (defwState != DEFW_SUBNET) && // path in subnet + (defwState != DEFW_PATH)) // NEW in the path, path hasn't end yet + return DEFW_BAD_ORDER; + + if (strcmp(typ, "NEW") && strcmp(typ, "FIXED") && strcmp(typ, "COVER") && + strcmp(typ, "ROUTED") && strcmp(typ, "SHIELD")) + return DEFW_BAD_DATA; + + defwSpNetShield = 0; + + // The second time around for a path on this net, we + // must start it with a new instead of a fixed... + if (strcmp(typ, "NEW") == 0) { + if (defwState != DEFW_PATH) + return DEFW_BAD_DATA; + fprintf(defwFile, " NEW"); + } else if (strcmp(typ, "SHIELD") == 0) { + fprintf(defwFile, "\n + %s", typ); + defwSpNetShield = 1; + } else + fprintf(defwFile, "\n + %s", typ); + + defwState = DEFW_PATH_START; + defwLineItemCounter = 0; + return DEFW_OK; +} + + +int +defwSpecialNetShieldNetName(const char *name) +{ + defwFunc = DEFW_PATH; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PATH_START) + return DEFW_BAD_ORDER; + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + if (defwSpNetShield) + fprintf(defwFile, " %s", name); + else + return DEFW_BAD_ORDER; + return DEFW_OK; +} + + +int +defwSpecialNetPathWidth(int w) +{ + defwFunc = DEFW_PATH; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PATH) + return DEFW_BAD_ORDER; + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + fprintf(defwFile, " %d", w); + return DEFW_OK; +} + + +int +defwSpecialNetPathLayer(const char *name) +{ + defwFunc = DEFW_PATH; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PATH_START) + return DEFW_BAD_ORDER; + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + fprintf(defwFile, " %s", name); + defwState = DEFW_PATH; + return DEFW_OK; +} + + +int +defwSpecialNetPathStyle(int styleNum) +{ + defwFunc = DEFW_PATH; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PATH) + return DEFW_BAD_ORDER; + + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + fprintf(defwFile, "\n + STYLE %d", styleNum); + defwState = DEFW_PATH; + defwLineItemCounter = 0; + return DEFW_OK; +} + + +int +defwSpecialNetPathShape(const char *typ) +{ + defwFunc = DEFW_PATH; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PATH) + return DEFW_BAD_ORDER; + + if (strcmp(typ, "RING") && strcmp(typ, "STRIPE") && strcmp(typ, "FOLLOWPIN") && + strcmp(typ, "IOWIRE") && strcmp(typ, "COREWIRE") && + strcmp(typ, "BLOCKWIRE") && strcmp(typ, "FILLWIRE") && + strcmp(typ, "BLOCKAGEWIRE") && strcmp(typ, "PADRING") && + strcmp(typ, "BLOCKRING") && strcmp(typ, "DRCFILL") && + strcmp(typ, "FILLWIREOPC")) // 5.7 + return DEFW_BAD_DATA; + + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + fprintf(defwFile, "\n + SHAPE %s", typ); + + defwState = DEFW_PATH; + defwLineItemCounter = 0; + return DEFW_OK; +} + +int +defwSpecialNetPathMask(int colorMask) +{ + if (defVersionNum < 5.8) { + return DEFW_WRONG_VERSION; + } + + defwFunc = DEFW_PATH; // Current function of writer + + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PATH) + return DEFW_BAD_ORDER; + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + fprintf(defwFile, " MASK %d", colorMask); + return DEFW_OK; +} + +int +defwSpecialNetPathPoint(int numPts, + double *pointx, + double *pointy) +{ + int i; + + defwFunc = DEFW_PATH; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PATH) + return DEFW_BAD_ORDER; + + printPointsNum = 0; + for (i = 0; i < numPts; i++) { + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + + printPoints(defwFile, pointx[i], pointy[i], " ", ""); + } + return DEFW_OK; +} + + +int +defwSpecialNetPathVia(const char *name) +{ + defwFunc = DEFW_PATH; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PATH) + return DEFW_BAD_ORDER; + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + fprintf(defwFile, " %s", name); + return DEFW_OK; +} + + +int +defwSpecialNetPathViaData(int numX, + int numY, + int stepX, + int stepY) +{ + defwFunc = DEFW_PATH; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PATH) + return DEFW_BAD_ORDER; + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + fprintf(defwFile, " DO %d BY %d STEP %d %d", numX, numY, stepX, stepY); + return DEFW_OK; +} + + +int +defwSpecialNetPathPointWithWireExt(int numPts, + double *pointx, + double *pointy, + double *optValue) +{ + int i; + defwFunc = DEFW_PATH; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PATH) + return DEFW_BAD_ORDER; + for (i = 0; i < numPts; i++) { + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + fprintf(defwFile, " ( %.11g %.11g ", pointx[i], pointy[i]); + if (optValue[i]) + fprintf(defwFile, "%.11g ", optValue[i]); + fprintf(defwFile, ")"); + } + return DEFW_OK; +} + + +int +defwSpecialNetPathEnd() +{ + defwFunc = DEFW_SNET_OPTIONS; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PATH) + return DEFW_BAD_ORDER; + defwState = DEFW_SNET_OPTIONS; + return DEFW_OK; +} + + +int +defwSpecialNetPolygon(const char* layerName, + int num_polys, + double* xl, double* yl) { + int i; + + defwFunc = DEFW_SNET_OPTIONS; // Current function of writer + if (! defwSpecialNetOptions() && + (defwState != DEFW_PATH)) // not inside a path + return DEFW_BAD_ORDER; + + if (defVersionNum < 5.6) + return DEFW_WRONG_VERSION; + + fprintf(defwFile, "\n + POLYGON %s ", layerName); + + printPointsNum = 0; + for (i = 0; i < num_polys; i++) { + if ((i == 0) || ((i % 5) != 0)) + printPoints(defwFile, *xl++, *yl++, "", " "); + else { + printPoints(defwFile, *xl++, *yl++, "\n ", " "); + defwLines++; + } + } + defwLines++; + return DEFW_OK; +} + + +int +defwSpecialNetRect(const char *layerName, + int xl, + int yl, + int xh, + int yh) +{ + defwFunc = DEFW_SNET_OPTIONS; // Current function of writer + if (!defwSpecialNetOptions() && + (defwState != DEFW_PATH)) // not inside a path + return DEFW_BAD_ORDER; + + if (defVersionNum < 5.6) + return DEFW_WRONG_VERSION; + + fprintf(defwFile, "\n + RECT %s ( %d %d ) ( %d %d ) ", layerName, + xl, yl, xh, yh); + defwLines++; + return DEFW_OK; +} + + +int +defwSpecialNetVia(const char *layerName) +{ + defwFunc = DEFW_SNET_OPTIONS; // Current function of writer + if (!defwSpecialNetOptions() && + (defwState != DEFW_PATH)) // not inside a path + return DEFW_BAD_ORDER; + + if (defVersionNum < 5.8) + return DEFW_WRONG_VERSION; + + fprintf(defwFile, "\n + VIA %s ", layerName); + defwLines++; + return DEFW_OK; +} + + +int +defwSpecialNetViaWithOrient(const char *layerName, + int orient) +{ + defwFunc = DEFW_SNET_OPTIONS; // Current function of writer + if (!defwSpecialNetOptions() && + (defwState != DEFW_PATH)) // not inside a path + return DEFW_BAD_ORDER; + + if (defVersionNum < 5.8) + return DEFW_WRONG_VERSION; + + fprintf(defwFile, "\n + VIA %s %s", layerName, defwOrient(orient)); + + defwLines++; + return DEFW_OK; +} + + +int +defwSpecialNetViaPoints(int num_points, + double *xl, + double *yl) +{ + defwFunc = DEFW_SNET_OPTIONS; // Current function of writer + if (!defwSpecialNetOptions() && + (defwState != DEFW_PATH)) // not inside a path + return DEFW_BAD_ORDER; + + if (defVersionNum < 5.8) + return DEFW_WRONG_VERSION; + + + printPointsNum = 0; + for (int i = 0; i < num_points; i++) { + if ((i == 0) || ((i % 5) != 0)) + printPoints(defwFile, *xl++, *yl++, "", " "); + else { + printPoints(defwFile, *xl++, *yl++, "\n ", " "); + defwLines++; + } + } + + defwLines++; + return DEFW_OK; + +} + + +int +defwSpecialNetShieldStart(const char *name) +{ + defwFunc = DEFW_SHIELD; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwSpecialNetOptions()) + return DEFW_BAD_ORDER; + + // The second time around for a shield on this net, we + // must start it with a new instead of the name ... + if (strcmp(name, "NEW") == 0) { + if (defwState != DEFW_SHIELD) + return DEFW_BAD_DATA; + fprintf(defwFile, " NEW"); + } else + fprintf(defwFile, "\n + SHIELD %s", name); + + defwState = DEFW_SHIELD; + defwLineItemCounter = 0; + return DEFW_OK; +} + + +int +defwSpecialNetShieldWidth(int w) +{ + defwFunc = DEFW_SHIELD; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_SHIELD) + return DEFW_BAD_ORDER; + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + fprintf(defwFile, " %d", w); + return DEFW_OK; +} + + +int +defwSpecialNetShieldLayer(const char *name) +{ + defwFunc = DEFW_SHIELD; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_SHIELD) + return DEFW_BAD_ORDER; + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + fprintf(defwFile, " %s", name); + return DEFW_OK; +} + + +int +defwSpecialNetShieldShape(const char *typ) +{ + defwFunc = DEFW_SHIELD; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_SHIELD) + return DEFW_BAD_ORDER; + + if (strcmp(typ, "RING") && strcmp(typ, "STRIPE") && strcmp(typ, "FOLLOWPIN") && + strcmp(typ, "IOWIRE") && strcmp(typ, "COREWIRE") && + strcmp(typ, "BLOCKWIRE") && strcmp(typ, "FILLWIRE") && + strcmp(typ, "BLOCKAGEWIRE") && strcmp(typ, "DRCFILL")) + return DEFW_BAD_DATA; + + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + fprintf(defwFile, "\n + SHAPE %s", typ); + + defwState = DEFW_SHIELD; + defwLineItemCounter = 0; + return DEFW_OK; +} + + +int +defwSpecialNetShieldPoint(int numPts, + double *pointx, + double *pointy) +{ + int i; + + defwFunc = DEFW_SHIELD; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_SHIELD) + return DEFW_BAD_ORDER; + + printPointsNum = 0; + for (i = 0; i < numPts; i++) { + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + printPoints(defwFile, pointx[i], pointy[i], " ", ""); + } + return DEFW_OK; +} + + +int +defwSpecialNetShieldVia(const char *name) +{ + defwFunc = DEFW_SHIELD; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_SHIELD) + return DEFW_BAD_ORDER; + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + fprintf(defwFile, " %s", name); + return DEFW_OK; +} + + +int +defwSpecialNetShieldViaData(int numX, + int numY, + int stepX, + int stepY) +{ + defwFunc = DEFW_SHIELD; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_SHIELD) + return DEFW_BAD_ORDER; + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + fprintf(defwFile, " DO %d BY %d STEP %d %d", numX, numY, stepX, stepY); + return DEFW_OK; +} + +int +defwSpecialNetShieldEnd() +{ + defwFunc = DEFW_SNET_OPTIONS; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_SHIELD) + return DEFW_BAD_ORDER; + defwState = DEFW_SNET_OPTIONS; + return DEFW_OK; +} + + +int +defwSpecialNetEndOneNet() +{ + defwFunc = DEFW_SNET_ENDNET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwSpecialNetOptions()) + return DEFW_BAD_ORDER; + + fprintf(defwFile, " ;\n"); + defwLines++; + defwState = DEFW_SNET_ENDNET; + + return DEFW_OK; +} + + +int +defwEndSpecialNets() +{ + defwFunc = DEFW_SNET_END; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_SNET_START && defwState != DEFW_SNET_OPTIONS && + defwState != DEFW_SNET_ENDNET && // last state is special net + defwState != DEFW_SNET) + return DEFW_BAD_ORDER; + if (defwCounter > 0) + return DEFW_BAD_DATA; + else if (defwCounter < 0) + return DEFW_TOO_MANY_STMS; + + fprintf(defwFile, "END SPECIALNETS\n\n"); + defwLines++; + + defwState = DEFW_SNET_END; + return DEFW_OK; +} + + +int +defwStartNets(int count) +{ + defwFunc = DEFW_NET_START; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if ((defwState >= DEFW_NET_START) && (defwState <= DEFW_NET_END)) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "NETS %d ;\n", count); + defwLines++; + + defwCounter = count; + defwState = DEFW_NET_START; + return DEFW_OK; +} + + +int +defwNetOptions() +{ + defwFunc = DEFW_NET; // Current function of writer + if (defwState == DEFW_NET) { + defwState = DEFW_NET_OPTIONS; + return 1; + } + if (defwState == DEFW_NET_OPTIONS) + return 1; + return 0; +} + + +int +defwNet(const char *name) +{ + defwFunc = DEFW_NET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_NET_START && + defwState != DEFW_NET_ENDNET) + return DEFW_BAD_ORDER; + defwState = DEFW_NET; + + fprintf(defwFile, " - %s", name); + defwLineItemCounter = 0; + defwCounter--; + + return DEFW_OK; +} + + +int +defwNetConnection(const char *inst, + const char *pin, + int synthesized) +{ + defwFunc = DEFW_NET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_NET) + return DEFW_BAD_ORDER; + + if ((++defwLineItemCounter & 3) == 0) { // since there is more than one + fprintf(defwFile, "\n"); // inst & pin connection, don't print newline + defwLines++; // until the line is certain length long + } + fprintf(defwFile, " ( %s %s", inst, pin); + if (synthesized) + fprintf(defwFile, " + SYNTHESIZED ) "); + else + fprintf(defwFile, " ) "); + return DEFW_OK; +} + + +int +defwNetMustjoinConnection(const char *inst, + const char *pin) +{ + defwFunc = DEFW_NET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_NET_ENDNET) + return DEFW_BAD_ORDER; + + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + fprintf(defwFile, " - MUSTJOIN ( %s %s )", inst, pin); + + defwState = DEFW_NET; + + defwCounter--; + + return DEFW_OK; +} + + +int +defwNetFixedbump() +{ + defwFunc = DEFW_NET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwNetOptions()) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "\n + FIXEDBUMP"); + defwLines++; + return DEFW_OK; +} + + +int +defwNetFrequency(double frequency) +{ + defwFunc = DEFW_NET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwNetOptions()) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "\n + FREQUENCY %.11g", frequency); + defwLines++; + return DEFW_OK; +} + + +int +defwNetSource(const char *name) +{ + defwFunc = DEFW_NET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwNetOptions()) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "\n + SOURCE %s", name); + defwLines++; + return DEFW_OK; +} + + +int +defwNetXtalk(int xtalk) +{ + defwFunc = DEFW_NET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwNetOptions()) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "\n + XTALK %d", xtalk); + defwLines++; + return DEFW_OK; +} + + +int +defwNetVpin(const char *vpinName, + const char *layerName, + int layerXl, + int layerYl, + int layerXh, + int layerYh, + const char *status, + int statusX, + int statusY, + int orient) +{ + defwFunc = DEFW_NET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwNetOptions()) + return DEFW_BAD_ORDER; + if ((vpinName == 0) || (*vpinName == 0)) // required + return DEFW_BAD_DATA; + + if (status && strcmp(status, "PLACED") && strcmp(status, "FIXED") && + strcmp(status, "COVER")) + return DEFW_BAD_DATA; + if (status && (orient == 1)) // require if status is set + return DEFW_BAD_DATA; + + fprintf(defwFile, "\n + VPIN %s", vpinName); + if (layerName) + fprintf(defwFile, " LAYER %s", layerName); + fprintf(defwFile, " ( %d %d ) ( %d %d )\n", layerXl, layerYl, layerXh, + layerYh); + defwLines++; + + if (status) + fprintf(defwFile, " %s ( %d %d ) %s", status, statusX, statusY, + defwOrient(orient)); + defwLines++; + return DEFW_OK; +} + + +int +defwNetVpinStr(const char *vpinName, + const char *layerName, + int layerXl, + int layerYl, + int layerXh, + int layerYh, + const char *status, + int statusX, + int statusY, + const char *orient) +{ + defwFunc = DEFW_NET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwNetOptions()) + return DEFW_BAD_ORDER; + if (!vpinName || !*vpinName) // required + return DEFW_BAD_DATA; + + if (status && strcmp(status, "PLACED") && strcmp(status, "FIXED") && + strcmp(status, "COVER")) + return DEFW_BAD_DATA; + if (status && orient && *orient == '\0') // require if status is set + return DEFW_BAD_DATA; + + fprintf(defwFile, "\n + VPIN %s", vpinName); + if (layerName) + fprintf(defwFile, " LAYER %s", layerName); + fprintf(defwFile, " ( %d %d ) ( %d %d )\n", layerXl, layerYl, layerXh, + layerYh); + defwLines++; + + if (status) + fprintf(defwFile, " %s ( %d %d ) %s", status, statusX, statusY, + orient); + defwLines++; + return DEFW_OK; +} + + +int +defwNetOriginal(const char *name) +{ + defwFunc = DEFW_NET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwNetOptions()) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "\n + ORIGINAL %s", name); + defwLines++; + return DEFW_OK; +} + + +int +defwNetPattern(const char *name) +{ + defwFunc = DEFW_NET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwNetOptions()) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "\n + PATTERN %s", name); + defwLines++; + return DEFW_OK; +} + + +int +defwNetUse(const char *name) +{ + defwFunc = DEFW_NET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwNetOptions()) + return DEFW_BAD_ORDER; + + if (strcmp(name, "SIGNAL") && strcmp(name, "POWER") && + strcmp(name, "GROUND") && strcmp(name, "CLOCK") && + strcmp(name, "TIEOFF") && strcmp(name, "ANALOG") && + strcmp(name, "SCAN") && strcmp(name, "RESET")) + return DEFW_BAD_DATA; + + fprintf(defwFile, "\n + USE %s", name); + defwLines++; + return DEFW_OK; +} + + +int +defwNetNondefaultRule(const char *name) +{ + defwFunc = DEFW_NET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if ((defwState != DEFW_NET) && (defwState != DEFW_NET_OPTIONS) && + (defwState != DEFW_SUBNET)) + return DEFW_BAD_ORDER; + + if (defwState == DEFW_SUBNET) + fprintf(defwFile, "\n NONDEFAULTRULE %s", name); + else + fprintf(defwFile, "\n + NONDEFAULTRULE %s", name); + defwLines++; + return DEFW_OK; +} + + +int +defwNetWeight(double d) +{ + defwFunc = DEFW_NET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwNetOptions()) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "\n + WEIGHT %.11g", d); + defwLines++; + return DEFW_OK; +} + + +int +defwNetEstCap(double d) +{ + defwFunc = DEFW_NET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwNetOptions()) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "\n + ESTCAP %.11g", d); + defwLines++; + return DEFW_OK; +} + + +int +defwNetShieldnet(const char *name) +{ + defwFunc = DEFW_NET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwNetOptions()) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "\n + SHIELDNET %s", name); + defwLines++; + return DEFW_OK; +} + + +int +defwNetNoshieldStart(const char *name) +{ + defwFunc = DEFW_NOSHIELD; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwNetOptions()) + return DEFW_BAD_ORDER; + fprintf(defwFile, "\n + NOSHIELD %s", name); + + defwState = DEFW_NOSHIELD; + defwLineItemCounter = 0; + return DEFW_OK; +} + + +int +defwNetNoshieldPoint(int numPts, + const char **pointx, + const char **pointy) +{ + int i; + + defwFunc = DEFW_NOSHIELD; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_NOSHIELD) + return DEFW_BAD_ORDER; + for (i = 0; i < numPts; i++) { + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + fprintf(defwFile, " ( %s %s )", pointx[i], pointy[i]); + } + return DEFW_OK; +} + + +int +defwNetNoshieldVia(const char *name) +{ + defwFunc = DEFW_NOSHIELD; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_NOSHIELD) + return DEFW_BAD_ORDER; + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + fprintf(defwFile, " %s", name); + return DEFW_OK; +} + + +int +defwNetNoshieldEnd() +{ + defwFunc = DEFW_NET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_NOSHIELD) + return DEFW_BAD_ORDER; + defwState = DEFW_NET; + return DEFW_OK; +} + + +int +defwNetSubnetStart(const char *name) +{ + defwFunc = DEFW_SUBNET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwNetOptions()) + return DEFW_BAD_ORDER; + if (!name || !*name) // required + return DEFW_BAD_DATA; + + fprintf(defwFile, "\n + SUBNET %s", name); + defwLines++; + defwState = DEFW_SUBNET; + defwLineItemCounter = 0; + return DEFW_OK; +} + + +int +defwNetSubnetPin(const char *compName, + const char *pinName) +{ + defwFunc = DEFW_SUBNET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_SUBNET) + return DEFW_BAD_ORDER; + if ((!compName || !*compName) || (!pinName || !*pinName)) // required + return DEFW_BAD_DATA; + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + fprintf(defwFile, " ( %s %s )", compName, pinName); + defwLines++; + return DEFW_OK; +} + + +int +defwNetSubnetEnd() +{ + defwFunc = DEFW_SUBNET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if ((defwState != DEFW_SUBNET) && // subnet does not have path + (defwState != DEFW_NET_OPTIONS)) // subnet has path and path just ended + return DEFW_BAD_ORDER; + defwState = DEFW_NET_OPTIONS; + return DEFW_OK; +} + + +int +defwNetPathStart(const char *typ) +{ + defwFunc = DEFW_PATH; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwNetOptions() && (defwState != DEFW_SUBNET) && // path in subnet + (defwState != DEFW_PATH)) // NEW in the path, path hasn't end yet + return DEFW_BAD_ORDER; + + if (strcmp(typ, "NEW") && strcmp(typ, "FIXED") && strcmp(typ, "COVER") && + strcmp(typ, "ROUTED") && strcmp(typ, "NOSHIELD")) + return DEFW_BAD_DATA; + + // The second time around for a path on this net, we + // must start it with a new instead of a fixed... + if (strcmp(typ, "NEW") == 0) { + if (defwState != DEFW_PATH) + return DEFW_BAD_DATA; + fprintf(defwFile, "\n NEW"); + } else { + if (defwState == DEFW_SUBNET) + fprintf(defwFile, "\n %s", typ); + else + fprintf(defwFile, "\n + %s", typ); + } + + defwState = DEFW_PATH_START; + defwLineItemCounter = 0; + return DEFW_OK; +} + + +int +defwNetPathWidth(int w) +{ + defwFunc = DEFW_PATH; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PATH) + return DEFW_BAD_ORDER; + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + fprintf(defwFile, " %d", w); + return DEFW_OK; +} + + +int +defwNetPathLayer(const char *name, + int isTaper, + const char *ruleName) +{ + defwFunc = DEFW_PATH; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PATH_START) + return DEFW_BAD_ORDER; + + // only one, either isTaper or ruleName can be set + if (isTaper && ruleName) + return DEFW_BAD_DATA; + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + fprintf(defwFile, " %s", name); + if (isTaper) + fprintf(defwFile, " TAPER"); + else if (ruleName) + fprintf(defwFile, " TAPERRULE %s", ruleName); + defwState = DEFW_PATH; + return DEFW_OK; +} + + +int +defwNetPathStyle(int styleNum) +{ + defwFunc = DEFW_PATH; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PATH) + return DEFW_BAD_ORDER; + + fprintf(defwFile, " STYLE %d", styleNum); + return DEFW_OK; +} + + +int +defwNetPathPoint(int numPts, + double *pointx, + double *pointy) +{ + int i; + defwFunc = DEFW_PATH; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PATH) + return DEFW_BAD_ORDER; + + printPointsNum = 0; + for (i = 0; i < numPts; i++) { + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + printPoints(defwFile, pointx[i], pointy[i], " ", ""); + } + return DEFW_OK; +} + +int +defwNetPathPointWithExt(int numPts, + double *pointx, + double *pointy, + double *optValue) +{ + int i; + defwFunc = DEFW_PATH; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PATH) + return DEFW_BAD_ORDER; + for (i = 0; i < numPts; i++) { + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + fprintf(defwFile, " ( %.11g %.11g %.11g )", pointx[i], pointy[i], optValue[i]); + } + return DEFW_OK; +} + +int +defwNetPathVia(const char *name) +{ + defwFunc = DEFW_PATH; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PATH) + return DEFW_BAD_ORDER; + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + if (!name || !*name) // required + return DEFW_BAD_DATA; + + fprintf(defwFile, " %s", name); + return DEFW_OK; +} + + +int +defwNetPathViaWithOrient(const char *name, + int orient) +{ + defwFunc = DEFW_PATH; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PATH) + return DEFW_BAD_ORDER; + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + + if (!name || !*name) // required + return DEFW_BAD_DATA; + + if (orient == -1) + fprintf(defwFile, " %s", name); + else if (orient >= 0 && orient <= 7) + fprintf(defwFile, " %s %s", name, defwOrient(orient)); + else + return DEFW_BAD_DATA; + return DEFW_OK; +} + + +int +defwNetPathViaWithOrientStr(const char *name, + const char *orient) +{ + defwFunc = DEFW_PATH; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PATH) + return DEFW_BAD_ORDER; + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + + if (!name || !*name) // required + return DEFW_BAD_DATA; + + if (!orient || !*orient) + fprintf(defwFile, " %s", name); + else + fprintf(defwFile, " %s %s", name, orient); + return DEFW_OK; +} + +int +defwNetPathMask(int colorMask) +{ + if (defVersionNum < 5.8) { + return DEFW_WRONG_VERSION; + } + + defwFunc = DEFW_PATH; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PATH) + return DEFW_BAD_ORDER; + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + fprintf(defwFile, " MASK %d", colorMask); + return DEFW_OK; +} + +int +defwNetPathRect(int deltaX1, + int deltaY1, + int deltaX2, + int deltaY2) +{ + if (defVersionNum < 5.8) + return DEFW_WRONG_VERSION; + + defwFunc = DEFW_PATH; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PATH) + return DEFW_BAD_ORDER; + + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + + fprintf(defwFile, " RECT ( %d %d %d %d )", deltaX1, deltaY1, deltaX2, deltaY2); + + return DEFW_OK; +} + +int +defwNetPathVirtual(int x, + int y) +{ + if (defVersionNum < 5.8) + return DEFW_WRONG_VERSION; + + defwFunc = DEFW_PATH; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PATH) + return DEFW_BAD_ORDER; + if ((++defwLineItemCounter & 3) == 0) { + fprintf(defwFile, "\n "); + defwLines++; + } + fprintf(defwFile, " VIRTUAL ( %d %d )", x, y); + return DEFW_OK; +} + +int +defwNetPathEnd() +{ + defwFunc = DEFW_PATH; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_PATH) + return DEFW_BAD_ORDER; + defwState = DEFW_NET_OPTIONS; + return DEFW_OK; +} + + +int +defwNetEndOneNet() +{ + defwFunc = DEFW_NET_ENDNET; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwNetOptions()) + return DEFW_BAD_ORDER; + + fprintf(defwFile, " ;\n"); + defwLines++; + defwState = DEFW_NET_ENDNET; + + return DEFW_OK; +} + + +int +defwEndNets() +{ + defwFunc = DEFW_NET_END; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_NET_START && defwState != DEFW_NET_OPTIONS && + defwState != DEFW_NET && + defwState != DEFW_NET_ENDNET) // last state is a net + return DEFW_BAD_ORDER; + if (defwCounter > 0) + return DEFW_BAD_DATA; + else if (defwCounter < 0) + return DEFW_TOO_MANY_STMS; + + fprintf(defwFile, "END NETS\n\n"); + defwLines++; + + defwState = DEFW_NET_END; + defwDidNets = 1; + return DEFW_OK; +} + + +int +defwStartIOTimings(int count) +{ + defwObsoleteNum = DEFW_IOTIMING_START; + defwFunc = DEFW_IOTIMING_START; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidNets) + return DEFW_BAD_ORDER; + if ((defwState >= DEFW_IOTIMING_START) && + (defwState >= DEFW_IOTIMING_END)) + return DEFW_BAD_ORDER; + if (defVersionNum >= 5.4) + return DEFW_OBSOLETE; + + fprintf(defwFile, "IOTIMINGS %d ;\n", count); + defwLines++; + + defwCounter = count; + defwState = DEFW_IOTIMING_START; + return DEFW_OK; +} + + +int +defwIOTiming(const char *instance, + const char *pin) +{ + defwFunc = DEFW_IOTIMING; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_IOTIMING_START && + defwState != DEFW_IOTIMING) + return DEFW_BAD_ORDER; + + if (defwState == DEFW_IOTIMING) + fprintf(defwFile, " ;\n"); // from previous statement + fprintf(defwFile, " - ( %s %s )\n", instance, pin); + defwLines++; + + defwCounter--; + defwState = DEFW_IOTIMING; + return DEFW_OK; +} + +int +defwIOTimingVariable(const char *riseFall, + int num1, + int num2) +{ + defwFunc = DEFW_IOTIMING; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_IOTIMING) + return DEFW_BAD_ORDER; + + if (strcmp(riseFall, "RISE") && + strcmp(riseFall, "FALL")) + return DEFW_BAD_DATA; + + fprintf(defwFile, " + %s VARIABLE %d %d\n", riseFall, + num1, num2); + defwLines++; + + return DEFW_OK; +} + +int +defwIOTimingSlewrate(const char *riseFall, + int num1, + int num2) +{ + defwFunc = DEFW_IOTIMING; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_IOTIMING) + return DEFW_BAD_ORDER; + + if (strcmp(riseFall, "RISE") && + strcmp(riseFall, "FALL")) + return DEFW_BAD_DATA; + + fprintf(defwFile, " + %s SLEWRATE %d %d\n", riseFall, + num1, num2); + defwLines++; + + return DEFW_OK; +} + +int +defwIOTimingDrivecell(const char *name, + const char *fromPin, + const char *toPin, + int numDrivers) +{ + defwFunc = DEFW_IOTIMING; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_IOTIMING) + return DEFW_BAD_ORDER; + if (!name || !*name) // required + return DEFW_BAD_DATA; + + fprintf(defwFile, " + DRIVECELL %s ", name); + if (fromPin && (!toPin || !*toPin)) // if have fromPin, toPin is required + return DEFW_BAD_DATA; + if (fromPin) + fprintf(defwFile, "FROMPIN %s ", fromPin); + if (toPin) + fprintf(defwFile, "TOPIN %s ", toPin); + if (numDrivers) + fprintf(defwFile, "PARALLEL %d ", numDrivers); + defwLines++; + + return DEFW_OK; +} + + +int +defwIOTimingCapacitance(double num) +{ + defwFunc = DEFW_IOTIMING; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_IOTIMING) + return DEFW_BAD_ORDER; + + fprintf(defwFile, " + CAPACITANCE %.11g", num); + defwLines++; + + return DEFW_OK; +} + +int +defwEndIOTimings() +{ + defwFunc = DEFW_IOTIMING_END; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_IOTIMING_START && defwState != DEFW_IOTIMING) + return DEFW_BAD_ORDER; + if (defwCounter > 0) + return DEFW_BAD_DATA; + else if (defwCounter < 0) + return DEFW_TOO_MANY_STMS; + + if (defwState == DEFW_IOTIMING) + fprintf(defwFile, " ;\n"); // from previous statement + fprintf(defwFile, "END IOTIMINGS\n\n"); + defwLines++; + + defwState = DEFW_IOTIMING_END; + return DEFW_OK; +} + + +int +defwStartScanchains(int count) +{ + defwFunc = DEFW_SCANCHAIN_START; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidNets) + return DEFW_BAD_ORDER; + if ((defwState >= DEFW_SCANCHAIN_START) && + (defwState <= DEFW_SCANCHAIN_END)) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "SCANCHAINS %d ;\n", count); + defwLines++; + + defwState = DEFW_SCANCHAIN_START; + defwCounter = count; + return DEFW_OK; +} + +int +defwScanchain(const char *name) +{ + defwFunc = DEFW_SCANCHAIN; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_SCANCHAIN_START && defwState != DEFW_SCANCHAIN && + defwState != DEFW_SCAN_FLOATING && defwState != DEFW_SCAN_ORDERED) + return DEFW_BAD_ORDER; + + if (defwState == DEFW_SCANCHAIN || defwState == DEFW_SCAN_FLOATING || + defwState == DEFW_SCAN_ORDERED) // put a ; for the previous scanchain + fprintf(defwFile, " ;\n"); + + fprintf(defwFile, " - %s", name); + defwLines++; + + defwCounter--; + defwState = DEFW_SCANCHAIN; + return DEFW_OK; +} + +int +defwScanchainCommonscanpins(const char *inst1, + const char *pin1, + const char *inst2, + const char *pin2) +{ + defwFunc = DEFW_SCANCHAIN; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_SCANCHAIN_START && defwState != DEFW_SCANCHAIN && + defwState != DEFW_SCAN_FLOATING && defwState != DEFW_SCAN_ORDERED) + return DEFW_BAD_ORDER; + + if (!inst1) { // if inst1 is null, nothing will be written + defwState = DEFW_SCANCHAIN; + return DEFW_OK; + } + + if (inst1 && strcmp(inst1, "IN") && strcmp(inst1, "OUT")) // IN | OUT + return DEFW_BAD_DATA; + + if (inst1 && !pin1) // pin1 can't be NULL if inst1 is not + return DEFW_BAD_DATA; + + fprintf(defwFile, "\n + COMMONSCANPINS ( %s %s )", inst1, pin1); + + if (inst2 && !pin2) // pin2 can't be NULL if inst2 is not + return DEFW_BAD_DATA; + + if (inst2 && strcmp(inst2, "IN") && strcmp(inst2, "OUT")) // IN | OUT + return DEFW_BAD_DATA; + + if (inst2) + fprintf(defwFile, " ( %s %s )", inst2, pin2); + + defwLines++; + + defwState = DEFW_SCANCHAIN; + return DEFW_OK; +} + +int +defwScanchainPartition(const char *name, + int maxBits) +{ + defwFunc = DEFW_SCANCHAIN; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_SCANCHAIN_START && defwState != DEFW_SCANCHAIN && + defwState != DEFW_SCAN_FLOATING && defwState != DEFW_SCAN_ORDERED) + return DEFW_BAD_ORDER; + + if (!name || !*name) // require + return DEFW_BAD_DATA; + + fprintf(defwFile, "\n + PARTITION %s", name); + if (maxBits != -1) + fprintf(defwFile, " MAXBITS %d", maxBits); + defwLines++; + + defwState = DEFW_SCANCHAIN; + return DEFW_OK; +} + +int +defwScanchainStart(const char *inst, + const char *pin) +{ + defwFunc = DEFW_SCANCHAIN; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_SCANCHAIN_START && defwState != DEFW_SCANCHAIN && + defwState != DEFW_SCAN_FLOATING && defwState != DEFW_SCAN_ORDERED) + return DEFW_BAD_ORDER; + + if (!inst || !*inst) // require + return DEFW_BAD_DATA; + + fprintf(defwFile, "\n + START %s", inst); + if (pin) + fprintf(defwFile, " %s", pin); + defwLines++; + + defwState = DEFW_SCANCHAIN; + return DEFW_OK; +} + + +int +defwScanchainStop(const char *inst, + const char *pin) +{ + defwFunc = DEFW_SCANCHAIN; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_SCANCHAIN_START && defwState != DEFW_SCANCHAIN && + defwState != DEFW_SCAN_FLOATING && defwState != DEFW_SCAN_ORDERED) + return DEFW_BAD_ORDER; + + if (!inst || !*inst) // require + return DEFW_BAD_DATA; + + fprintf(defwFile, "\n + STOP %s", inst); + if (pin) + fprintf(defwFile, " %s", pin); + defwLines++; + + defwState = DEFW_SCANCHAIN; + return DEFW_OK; +} + +int +defwScanchainFloating(const char *name, + const char *inst1, + const char *pin1, + const char *inst2, + const char *pin2) +{ + defwFunc = DEFW_SCAN_FLOATING; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_SCANCHAIN_START && defwState != DEFW_SCANCHAIN && + defwState != DEFW_SCAN_FLOATING && defwState != DEFW_SCAN_ORDERED) + return DEFW_BAD_ORDER; + + if (!name || !*name) // require + return DEFW_BAD_DATA; + if (inst1 && strcmp(inst1, "IN") && strcmp(inst1, "OUT")) + return DEFW_BAD_DATA; + if (inst2 && strcmp(inst2, "IN") && strcmp(inst2, "OUT")) + return DEFW_BAD_DATA; + if (inst1 && !pin1) + return DEFW_BAD_DATA; + if (inst2 && !pin2) + return DEFW_BAD_DATA; + + if (defwState != DEFW_SCAN_FLOATING) + fprintf(defwFile, "\n + FLOATING"); + else + fprintf(defwFile, "\n "); + + fprintf(defwFile, " %s", name); + if (inst1) + fprintf(defwFile, " ( %s %s )", inst1, pin1); + if (inst2) + fprintf(defwFile, " ( %s %s )", inst2, pin2); + + defwState = DEFW_SCAN_FLOATING; + defwLines++; + + return DEFW_OK; +} + +int +defwScanchainFloatingBits(const char *name, + const char *inst1, + const char *pin1, + const char *inst2, + const char *pin2, + int bits) +{ + defwFunc = DEFW_SCAN_FLOATING; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_SCANCHAIN_START && defwState != DEFW_SCANCHAIN && + defwState != DEFW_SCAN_FLOATING && defwState != DEFW_SCAN_ORDERED) + return DEFW_BAD_ORDER; + + if (!name || !*name) // require + return DEFW_BAD_DATA; + if (inst1 && strcmp(inst1, "IN") && strcmp(inst1, "OUT")) + return DEFW_BAD_DATA; + if (inst2 && strcmp(inst2, "IN") && strcmp(inst2, "OUT")) + return DEFW_BAD_DATA; + if (inst1 && !pin1) + return DEFW_BAD_DATA; + if (inst2 && !pin2) + return DEFW_BAD_DATA; + + if (defwState != DEFW_SCAN_FLOATING) + fprintf(defwFile, "\n + FLOATING"); + else + fprintf(defwFile, "\n "); + + fprintf(defwFile, " %s", name); + if (inst1) + fprintf(defwFile, " ( %s %s )", inst1, pin1); + if (inst2) + fprintf(defwFile, " ( %s %s )", inst2, pin2); + if (bits != -1) + fprintf(defwFile, " ( BITS %d )", bits); + + defwState = DEFW_SCAN_FLOATING; + defwLines++; + + return DEFW_OK; +} +int +defwScanchainOrdered(const char *name1, + const char *inst1, + const char *pin1, + const char *inst2, + const char *pin2, + const char *name2, + const char *inst3, + const char *pin3, + const char *inst4, + const char *pin4) +{ + defwFunc = DEFW_SCAN_ORDERED; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_SCANCHAIN_START && defwState != DEFW_SCANCHAIN && + defwState != DEFW_SCAN_FLOATING && defwState != DEFW_SCAN_ORDERED) + return DEFW_BAD_ORDER; + + if (!name1 || !*name1) // require + return DEFW_BAD_DATA; + if (inst1 && strcmp(inst1, "IN") && strcmp(inst1, "OUT")) + return DEFW_BAD_DATA; + if (inst2 && strcmp(inst2, "IN") && strcmp(inst2, "OUT")) + return DEFW_BAD_DATA; + if (inst1 && !pin1) + return DEFW_BAD_DATA; + if (inst2 && !pin2) + return DEFW_BAD_DATA; + if (defwState != DEFW_SCAN_ORDERED) { // 1st time require both name1 & name2 + if (!name2 || !*name2) // require + return DEFW_BAD_DATA; + if (inst3 && strcmp(inst3, "IN") && strcmp(inst3, "OUT")) + return DEFW_BAD_DATA; + if (inst4 && strcmp(inst4, "IN") && strcmp(inst4, "OUT")) + return DEFW_BAD_DATA; + if (inst3 && !pin3) + return DEFW_BAD_DATA; + if (inst4 && !pin4) + return DEFW_BAD_DATA; + } + + if (defwState != DEFW_SCAN_ORDERED) + fprintf(defwFile, "\n + ORDERED"); + else + fprintf(defwFile, "\n "); + + fprintf(defwFile, " %s", name1); + if (inst1) + fprintf(defwFile, " ( %s %s )", inst1, pin1); + if (inst2) + fprintf(defwFile, " ( %s %s )", inst2, pin2); + defwLines++; + + if (name2) { + fprintf(defwFile, "\n %s", name2); + if (inst3) + fprintf(defwFile, " ( %s %s )", inst3, pin3); + if (inst4) + fprintf(defwFile, " ( %s %s )", inst4, pin4); + defwLines++; + } + + defwState = DEFW_SCAN_ORDERED; + + return DEFW_OK; +} + +int +defwScanchainOrderedBits(const char *name1, + const char *inst1, + const char *pin1, + const char *inst2, + const char *pin2, + int bits1, + const char *name2, + const char *inst3, + const char *pin3, + const char *inst4, + const char *pin4, + int bits2) +{ + defwFunc = DEFW_SCAN_ORDERED; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_SCANCHAIN_START && defwState != DEFW_SCANCHAIN && + defwState != DEFW_SCAN_FLOATING && defwState != DEFW_SCAN_ORDERED) + return DEFW_BAD_ORDER; + + if (!name1 || !*name1) // require + return DEFW_BAD_DATA; + if (inst1 && strcmp(inst1, "IN") && strcmp(inst1, "OUT")) + return DEFW_BAD_DATA; + if (inst2 && strcmp(inst2, "IN") && strcmp(inst2, "OUT")) + return DEFW_BAD_DATA; + if (inst1 && !pin1) + return DEFW_BAD_DATA; + if (inst2 && !pin2) + return DEFW_BAD_DATA; + if (defwState != DEFW_SCAN_ORDERED) { // 1st time require both name1 & name2 + if (!name2 || !*name2) // require + return DEFW_BAD_DATA; + if (inst3 && strcmp(inst3, "IN") && strcmp(inst3, "OUT")) + return DEFW_BAD_DATA; + if (inst4 && strcmp(inst4, "IN") && strcmp(inst4, "OUT")) + return DEFW_BAD_DATA; + if (inst3 && !pin3) + return DEFW_BAD_DATA; + if (inst4 && !pin4) + return DEFW_BAD_DATA; + } + + if (defwState != DEFW_SCAN_ORDERED) + fprintf(defwFile, "\n + ORDERED"); + else + fprintf(defwFile, "\n "); + + fprintf(defwFile, " %s", name1); + if (inst1) + fprintf(defwFile, " ( %s %s )", inst1, pin1); + if (inst2) + fprintf(defwFile, " ( %s %s )", inst2, pin2); + if (bits1 != -1) + fprintf(defwFile, " ( BITS %d )", bits1); + defwLines++; + + if (name2) { + fprintf(defwFile, "\n %s", name2); + if (inst3) + fprintf(defwFile, " ( %s %s )", inst3, pin3); + if (inst4) + fprintf(defwFile, " ( %s %s )", inst4, pin4); + if (bits2 != -1) + fprintf(defwFile, " ( BITS %d )", bits2); + defwLines++; + } + + defwState = DEFW_SCAN_ORDERED; + + return DEFW_OK; +} + +int +defwEndScanchain() +{ + defwFunc = DEFW_SCANCHAIN_END; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_SCANCHAIN_START && defwState != DEFW_SCAN_ORDERED && + defwState != DEFW_SCAN_FLOATING && defwState != DEFW_SCANCHAIN) + return DEFW_BAD_ORDER; + + if (defwState != DEFW_SCANCHAIN_START) // from previous statement + fprintf(defwFile, " ;\n"); + + if (defwCounter > 0) + return DEFW_BAD_DATA; + else if (defwCounter < 0) + return DEFW_TOO_MANY_STMS; + + fprintf(defwFile, "END SCANCHAINS\n\n"); + defwLines++; + + defwState = DEFW_SCANCHAIN_END; + return DEFW_OK; +} + +int +defwStartConstraints(int count) +{ + defwObsoleteNum = DEFW_FPC_START; + defwFunc = DEFW_FPC_START; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if ((defwState >= DEFW_FPC_START) && (defwState <= DEFW_FPC_END)) + return DEFW_BAD_ORDER; + if (defVersionNum >= 5.4) + return DEFW_OBSOLETE; + + fprintf(defwFile, "CONSTRAINTS %d ;\n", count); + defwLines++; + + defwState = DEFW_FPC_START; + defwCounter = count; + return DEFW_OK; +} + +int +defwConstraintOperand() +{ + defwFunc = DEFW_FPC_OPER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_FPC_START && defwState != DEFW_FPC) + return DEFW_BAD_ORDER; + + fprintf(defwFile, " -"); + defwCounter--; + defwFPC = 0; + defwState = DEFW_FPC_OPER; + return DEFW_OK; +} + +int +defwConstraintOperandNet(const char *netName) +{ + defwFunc = DEFW_FPC_OPER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_FPC_OPER && defwState != DEFW_FPC_OPER_SUM) + return DEFW_BAD_ORDER; // net can be within SUM + + if (!netName || !*netName) // require + return DEFW_BAD_DATA; + if (defwFPC > 0) + fprintf(defwFile, " ,"); + if (defwState == DEFW_FPC_OPER_SUM) + defwFPC++; + fprintf(defwFile, " NET %s", netName); + return DEFW_OK; +} + +int +defwConstraintOperandPath(const char *comp1, + const char *fromPin, + const char *comp2, + const char *toPin) +{ + defwFunc = DEFW_FPC_OPER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_FPC_OPER && defwState != DEFW_FPC_OPER_SUM) + return DEFW_BAD_ORDER; // path can be within SUM + + if ((comp1 == 0) || (*comp1 == 0) || (fromPin == 0) || (*fromPin == 0) || + (comp2 == 0) || (*comp2 == 0) || (toPin == 0) || (*toPin == 0)) // require + return DEFW_BAD_DATA; + if (defwFPC > 0) + fprintf(defwFile, " ,"); + if (defwState == DEFW_FPC_OPER_SUM) + defwFPC++; + fprintf(defwFile, " PATH %s %s %s %s", comp1, fromPin, comp2, toPin); + return DEFW_OK; +} + +int +defwConstraintOperandSum() +{ + defwFunc = DEFW_FPC_OPER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_FPC_OPER && defwState != DEFW_FPC_OPER_SUM) + return DEFW_BAD_ORDER; // sum can be within SUM + + fprintf(defwFile, " SUM ("); + defwState = DEFW_FPC_OPER_SUM; + defwFPC = 0; + return DEFW_OK; +} + +int +defwConstraintOperandSumEnd() +{ + defwFunc = DEFW_FPC_OPER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_FPC_OPER_SUM) + return DEFW_BAD_ORDER; + fprintf(defwFile, " )"); + defwState = DEFW_FPC_OPER; + defwFPC = 0; + return DEFW_OK; +} + +int +defwConstraintOperandTime(const char *timeType, + int time) +{ + defwFunc = DEFW_FPC_OPER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_FPC_OPER) + return DEFW_BAD_ORDER; + if (timeType && strcmp(timeType, "RISEMAX") && strcmp(timeType, "FALLMAX") && + strcmp(timeType, "RISEMIN") && strcmp(timeType, "FALLMIN")) + return DEFW_BAD_DATA; + fprintf(defwFile, " + %s %d", timeType, time); + return DEFW_OK; +} + +int +defwConstraintOperandEnd() +{ + defwFunc = DEFW_FPC_OPER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_FPC_OPER) + return DEFW_BAD_ORDER; + fprintf(defwFile, " ;\n"); + defwState = DEFW_FPC; + return DEFW_OK; +} + +int +defwConstraintWiredlogic(const char *netName, + int distance) +{ + defwFunc = DEFW_FPC; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_FPC_START && defwState != DEFW_FPC) + return DEFW_BAD_ORDER; + + if (!netName || !*netName) // require + return DEFW_BAD_DATA; + fprintf(defwFile, " - WIREDLOGIC %s MAXDIST %d ;\n", netName, distance); + defwCounter--; + defwState = DEFW_FPC; + defwLines++; + return DEFW_OK; +} + +int +defwEndConstraints() +{ + defwFunc = DEFW_FPC_END; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_FPC_START && defwState != DEFW_FPC) + return DEFW_BAD_ORDER; + if (defwCounter > 0) + return DEFW_BAD_DATA; + else if (defwCounter < 0) + return DEFW_TOO_MANY_STMS; + + fprintf(defwFile, "END CONSTRAINTS\n\n"); + defwLines++; + + defwState = DEFW_FPC_END; + return DEFW_OK; +} + +int +defwStartGroups(int count) +{ + defwFunc = DEFW_GROUP_START; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if ((defwState >= DEFW_GROUP_START) && (defwState <= DEFW_GROUP_END)) + return DEFW_BAD_ORDER; + + fprintf(defwFile, "GROUPS %d ;\n", count); + defwLines++; + + defwState = DEFW_GROUP_START; + defwCounter = count; + return DEFW_OK; +} + +int +defwGroup(const char *groupName, + int numExpr, + const char **groupExpr) +{ + int i; + + defwFunc = DEFW_GROUP; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_GROUP_START && defwState != DEFW_GROUP) + return DEFW_BAD_ORDER; + + if ((groupName == 0) || (*groupName == 0) || (groupExpr == 0) || + (*groupExpr == 0)) // require + return DEFW_BAD_DATA; + if (defwState == DEFW_GROUP) + fprintf(defwFile, " ;\n"); // add ; for the previous group + fprintf(defwFile, " - %s", groupName); + if (numExpr) { + for (i = 0; i < numExpr; i++) + fprintf(defwFile, " %s", groupExpr[i]); + } + defwCounter--; + defwLines++; + defwState = DEFW_GROUP; + return DEFW_OK; +} + + +int +defwGroupSoft(const char *type1, + double value1, + const char *type2, + double value2, + const char *type3, + double value3) +{ + defwFunc = DEFW_GROUP; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_GROUP) + return DEFW_BAD_ORDER; + + if (type1 && strcmp(type1, "MAXHALFPERIMETER") && strcmp(type1, "MAXX") && + strcmp(type1, "MAXY")) + return DEFW_BAD_DATA; + if (type2 && strcmp(type2, "MAXHALFPERIMETER") && strcmp(type2, "MAXX") && + strcmp(type2, "MAXY")) + return DEFW_BAD_DATA; + if (type3 && strcmp(type3, "MAXHALFPERIMETER") && strcmp(type3, "MAXX") && + strcmp(type3, "MAXY")) + return DEFW_BAD_DATA; + if (type1) + fprintf(defwFile, "\n + SOFT %s %.11g", type1, value1); + if (type2) + fprintf(defwFile, " %s %.11g", type2, value2); + if (type3) + fprintf(defwFile, " %s %.11g", type3, value3); + defwLines++; + return DEFW_OK; +} + +int +defwGroupRegion(int xl, + int yl, + int xh, + int yh, + const char *regionName) +{ + defwFunc = DEFW_GROUP; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_GROUP) + return DEFW_BAD_ORDER; + + if ((xl || yl || xh || yh) && (regionName)) // ether pts or regionName + return DEFW_BAD_DATA; + + if (regionName) + fprintf(defwFile, "\n + REGION %s", regionName); + else + fprintf(defwFile, "\n + REGION ( %d %d ) ( %d %d )", + xl, yl, xh, yh); + defwLines++; + return DEFW_OK; +} + +int +defwEndGroups() +{ + defwFunc = DEFW_GROUP_END; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_GROUP_START && defwState != DEFW_GROUP) + return DEFW_BAD_ORDER; + if (defwCounter > 0) + return DEFW_BAD_DATA; + else if (defwCounter < 0) + return DEFW_TOO_MANY_STMS; + + if (defwState != DEFW_GROUP_START) + fprintf(defwFile, " ;\n"); + + fprintf(defwFile, "END GROUPS\n\n"); + defwLines++; + + defwState = DEFW_GROUP_END; + return DEFW_OK; +} + + +int +defwStartBlockages(int count) +{ + defwFunc = DEFW_BLOCKAGE_START; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if ((defwState >= DEFW_BLOCKAGE_START) && (defwState <= DEFW_BLOCKAGE_END)) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.4) + return DEFW_WRONG_VERSION; + + fprintf(defwFile, "BLOCKAGES %d ;\n", count); + defwLines++; + + defwState = DEFW_BLOCKAGE_START; + defwCounter = count; + return DEFW_OK; +} + +int +defwBlockagesLayer(const char *layerName) +{ + defwFunc = DEFW_BLOCKAGE_LAYER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + + if (defwState != DEFW_BLOCKAGE_START && ((defwState == DEFW_BLOCKAGE_PLACE) + || (defwState == DEFW_BLOCKAGE_LAYER))) + return DEFW_BAD_ORDER; + + if (!layerName || !*layerName) // require + return DEFW_BAD_DATA; + + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, " ;\n"); // end the previous rectangle + + fprintf(defwFile, " - LAYER %s", layerName); + fprintf(defwFile, "\n"); + defwCounter--; + defwLines++; + defwState = DEFW_BLOCKAGE_LAYER; + defwBlockageHasSD = 0; + defwBlockageHasSF = 0; + return DEFW_OK; +} + +int +defwBlockagesLayerSlots() +{ + defwFunc = DEFW_BLOCKAGE_LAYER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + + if ((defwState != DEFW_BLOCKAGE_LAYER) && (defwState != DEFW_BLOCKAGE_RECT)) + return DEFW_BAD_ORDER; + + if (defwBlockageHasSF) + return DEFW_BAD_DATA; + + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, " ;\n"); // end the previous rectangle + fprintf(defwFile, " + SLOTS\n"); + defwLines++; + defwState = DEFW_BLOCKAGE_LAYER; + defwBlockageHasSF = 1; + return DEFW_OK; +} + +int +defwBlockagesLayerFills() +{ + defwFunc = DEFW_BLOCKAGE_LAYER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + + if ((defwState != DEFW_BLOCKAGE_LAYER) && (defwState != DEFW_BLOCKAGE_RECT)) + return DEFW_BAD_ORDER; + + if (defwBlockageHasSF) + return DEFW_BAD_DATA; + + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, " ;\n"); // end the previous rectangle + + fprintf(defwFile, " + FILLS\n"); + defwLines++; + defwState = DEFW_BLOCKAGE_LAYER; + defwBlockageHasSF = 1; + return DEFW_OK; +} + +int +defwBlockagesLayerComponent(const char *compName) +{ + defwFunc = DEFW_BLOCKAGE_LAYER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + + if ((defwState != DEFW_BLOCKAGE_LAYER) && (defwState != DEFW_BLOCKAGE_RECT)) + return DEFW_BAD_ORDER; + + if ((compName == 0) || (*compName == 0)) // require + return DEFW_BAD_DATA; + + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, " ;\n"); // end the previous rectangle + fprintf(defwFile, " + COMPONENT %s\n", compName); + defwLines++; + defwState = DEFW_BLOCKAGE_LAYER; + return DEFW_OK; +} + +int +defwBlockagesLayerPushdown() +{ + defwFunc = DEFW_BLOCKAGE_LAYER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + + if ((defwState != DEFW_BLOCKAGE_LAYER) && (defwState != DEFW_BLOCKAGE_RECT)) + return DEFW_BAD_ORDER; + + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, " ;\n"); // end the previous rectangle + + fprintf(defwFile, " + PUSHDOWN\n"); + defwLines++; + defwState = DEFW_BLOCKAGE_LAYER; + return DEFW_OK; +} + +// 5.7 +int +defwBlockagesLayerExceptpgnet() +{ + defwFunc = DEFW_BLOCKAGE_LAYER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + + if ((defwState != DEFW_BLOCKAGE_LAYER) && (defwState != DEFW_BLOCKAGE_RECT)) + return DEFW_BAD_ORDER; + + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, " ;\n"); // end the previous rectangle + + fprintf(defwFile, " + EXCEPTPGNET\n"); + defwLines++; + defwState = DEFW_BLOCKAGE_LAYER; + return DEFW_OK; +} + +int +defwBlockagesLayerSpacing(int minSpacing) +{ + defwFunc = DEFW_BLOCKAGE_LAYER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + + if ((defwState != DEFW_BLOCKAGE_LAYER) && (defwState != DEFW_BLOCKAGE_RECT)) + return DEFW_BAD_ORDER; + if (defwBlockageHasSD) // Either spacing or designrulewidth has defined + return DEFW_BAD_DATA; + + fprintf(defwFile, " + SPACING %d\n", minSpacing); + defwLines++; + defwBlockageHasSD = 1; + defwState = DEFW_BLOCKAGE_LAYER; + return DEFW_OK; +} + +int +defwBlockagesLayerDesignRuleWidth(int effectiveWidth) +{ + defwFunc = DEFW_BLOCKAGE_LAYER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + + if ((defwState != DEFW_BLOCKAGE_LAYER) && (defwState != DEFW_BLOCKAGE_RECT)) + return DEFW_BAD_ORDER; + if (defwBlockageHasSD) // Either spacing or designrulewidth has defined + return DEFW_BAD_DATA; + + fprintf(defwFile, " + DESIGNRULEWIDTH %d\n", effectiveWidth); + defwLines++; + defwBlockageHasSD = 1; + defwState = DEFW_BLOCKAGE_LAYER; + return DEFW_OK; +} + +int +defwBlockagesLayerMask(int colorMask) +{ + if (defVersionNum < 5.8) { + return DEFW_WRONG_VERSION; + } + + defwFunc = DEFW_BLOCKAGE_MASK; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + + if ((defwState != DEFW_BLOCKAGE_LAYER) && (defwState != DEFW_BLOCKAGE_RECT)) + return DEFW_BAD_ORDER; + + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, "\n"); // set a newline for the previous rectangle + + fprintf(defwFile, " + MASK %d", colorMask); + defwLines++; + defwState = DEFW_BLOCKAGE_LAYER; + return DEFW_OK; +} + +//To be removed, replaced by defwBlockagesLayer +int +defwBlockageLayer(const char *layerName, + const char *compName) +{ // optional(NULL) + defwFunc = DEFW_BLOCKAGE_LAYER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define component or layer slots or fills + if (defwState != DEFW_BLOCKAGE_START && ((defwState == DEFW_BLOCKAGE_PLACE) + || (defwState == DEFW_BLOCKAGE_LAYER))) + return DEFW_BAD_DATA; + + if (!layerName || !*layerName) // require + return DEFW_BAD_DATA; + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, " ;\n"); // end the previous rectangle + fprintf(defwFile, " - LAYER %s ", layerName); + if (compName && *compName != 0) // optional + fprintf(defwFile, "+ COMPONENT %s ", compName); + fprintf(defwFile, "\n"); + defwCounter--; + defwLines++; + defwState = DEFW_BLOCKAGE_LAYER; + defwBlockageHasSD = 0; + return DEFW_OK; +} + +//To be removed, replaced by defwBlockagesLayerSlots +int +defwBlockageLayerSlots(const char *layerName) +{ + defwFunc = DEFW_BLOCKAGE_LAYER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define component or layer or layer fills + if (defwState != DEFW_BLOCKAGE_START && ((defwState == DEFW_BLOCKAGE_PLACE) + || (defwState == DEFW_BLOCKAGE_LAYER))) + return DEFW_BAD_DATA; + + if (!layerName || !*layerName) // require + return DEFW_BAD_DATA; + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, " ;\n"); // end the previous rectangle + fprintf(defwFile, " - LAYER %s + SLOTS\n", layerName); + defwCounter--; + defwLines++; + defwState = DEFW_BLOCKAGE_LAYER; + defwBlockageHasSD = 0; + return DEFW_OK; +} + +//To be removed, replaced by defwBlockagesLayerFills +int +defwBlockageLayerFills(const char *layerName) +{ + defwFunc = DEFW_BLOCKAGE_LAYER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define component or layer or layer slots + if (defwState != DEFW_BLOCKAGE_START && ((defwState == DEFW_BLOCKAGE_PLACE) + || (defwState == DEFW_BLOCKAGE_LAYER))) + return DEFW_BAD_DATA; + + if (!layerName || !*layerName) // require + return DEFW_BAD_DATA; + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, " ;\n"); // end the previous rectangle + fprintf(defwFile, " - LAYER %s + FILLS\n", layerName); + defwCounter--; + defwLines++; + defwState = DEFW_BLOCKAGE_LAYER; + defwBlockageHasSD = 0; + return DEFW_OK; +} + +//To be removed, replaced by defwBlockagesLayerPushdown +int +defwBlockageLayerPushdown(const char *layerName) +{ + defwFunc = DEFW_BLOCKAGE_LAYER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define component or layer or layer slots + if (defwState != DEFW_BLOCKAGE_START && ((defwState == DEFW_BLOCKAGE_PLACE) + || (defwState == DEFW_BLOCKAGE_LAYER))) + return DEFW_BAD_DATA; + + if ((layerName == 0) || (*layerName == 0)) // require + return DEFW_BAD_DATA; + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, " ;\n"); // end the previous rectangle + fprintf(defwFile, " - LAYER %s + PUSHDOWN\n", layerName); + defwCounter--; + defwLines++; + defwState = DEFW_BLOCKAGE_LAYER; + defwBlockageHasSD = 0; + return DEFW_OK; +} + +//To be removed, replaced by defwBlockagesLayerExceptpgnet +int +defwBlockageLayerExceptpgnet(const char *layerName) +{ + defwFunc = DEFW_BLOCKAGE_LAYER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define component or layer or layer slots + if (defwState != DEFW_BLOCKAGE_START && ((defwState == DEFW_BLOCKAGE_PLACE) + || (defwState == DEFW_BLOCKAGE_LAYER))) + return DEFW_BAD_DATA; + + if ((layerName == 0) || (*layerName == 0)) // require + return DEFW_BAD_DATA; + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, " ;\n"); // end the previous rectangle + fprintf(defwFile, " - LAYER %s + EXCEPTPGNET\n", layerName); + defwCounter--; + defwLines++; + defwState = DEFW_BLOCKAGE_LAYER; + defwBlockageHasSD = 0; + return DEFW_OK; +} + +//To be removed, replaced by defwBlockagesLayerSpacing +int +defwBlockageSpacing(int minSpacing) +{ + defwFunc = DEFW_BLOCKAGE_LAYER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // Checked if defwBlockageDesignRuleWidth has already called + if ((defwState != DEFW_BLOCKAGE_LAYER) && (defwState != DEFW_BLOCKAGE_RECT)) + return DEFW_BAD_DATA; + if (defwBlockageHasSD) // Either spacing or designrulewidth has defined + return DEFW_BAD_DATA; + + fprintf(defwFile, " + SPACING %d\n", minSpacing); + defwLines++; + defwBlockageHasSD = 1; + defwState = DEFW_BLOCKAGE_LAYER; + return DEFW_OK; +} + +//To be removed, replaced by defwBlockagesLayerDesignRuleWidth +int +defwBlockageDesignRuleWidth(int effectiveWidth) +{ + defwFunc = DEFW_BLOCKAGE_LAYER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // Checked if defwBlockageDesignRuleWidth has already called + if ((defwState != DEFW_BLOCKAGE_LAYER) && (defwState != DEFW_BLOCKAGE_RECT)) + return DEFW_BAD_DATA; + if (defwBlockageHasSD) // Either spacing or designrulewidth has defined + return DEFW_BAD_DATA; + + fprintf(defwFile, " + DESIGNRULEWIDTH %d\n", effectiveWidth); + defwLines++; + defwBlockageHasSD = 1; + defwState = DEFW_BLOCKAGE_LAYER; + return DEFW_OK; +} + +int +defwBlockagesPlacement() +{ + defwFunc = DEFW_BLOCKAGE_PLACE; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + + if (defwState != DEFW_BLOCKAGE_START && ((defwState == DEFW_BLOCKAGE_LAYER) + || (defwState == DEFW_BLOCKAGE_PLACE))) + return DEFW_BAD_DATA; + + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, " ;\n"); // end the previous rectangle + + fprintf(defwFile, " - PLACEMENT\n"); + defwCounter--; + defwLines++; + defwState = DEFW_BLOCKAGE_PLACE; + defwBlockageHasSP = 0; + return DEFW_OK; +} + + +int +defwBlockagesPlacementComponent(const char *compName) +{ + defwFunc = DEFW_BLOCKAGE_PLACE; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + + if ((defwState != DEFW_BLOCKAGE_PLACE) && (defwState != DEFW_BLOCKAGE_RECT)) + return DEFW_BAD_ORDER; + + if ((compName == 0) || (*compName == 0)) // require + return DEFW_BAD_DATA; + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, " ;\n"); // end the previous rectangle + fprintf(defwFile, " + COMPONENT %s\n", compName); + defwLines++; + defwState = DEFW_BLOCKAGE_PLACE; + return DEFW_OK; +} + + +int +defwBlockagesPlacementPushdown() +{ + defwFunc = DEFW_BLOCKAGE_PLACE; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + + if ((defwState != DEFW_BLOCKAGE_PLACE) && (defwState != DEFW_BLOCKAGE_RECT)) + return DEFW_BAD_ORDER; + + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, " ;\n"); // end the previous rectangle + fprintf(defwFile, " + PUSHDOWN\n"); + defwLines++; + defwState = DEFW_BLOCKAGE_PLACE; + return DEFW_OK; +} + +// 5.7 +int +defwBlockagesPlacementSoft() +{ + defwFunc = DEFW_BLOCKAGE_PLACE; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + + if ((defwState != DEFW_BLOCKAGE_PLACE) && (defwState != DEFW_BLOCKAGE_RECT)) + return DEFW_BAD_ORDER; + + if (defwBlockageHasSP) + return DEFW_BAD_DATA; + + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, " ;\n"); // end the previous rectangle + fprintf(defwFile, " + SOFT\n"); + defwLines++; + defwState = DEFW_BLOCKAGE_PLACE; + defwBlockageHasSP = 1; + return DEFW_OK; +} + +// 5.7 +int +defwBlockagesPlacementPartial(double maxDensity) +{ + defwFunc = DEFW_BLOCKAGE_PLACE; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + + if ((defwState != DEFW_BLOCKAGE_PLACE) && (defwState != DEFW_BLOCKAGE_RECT)) + return DEFW_BAD_ORDER; + + if (defwBlockageHasSP) + return DEFW_BAD_DATA; + + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, " ;\n"); // end the previous rectangle + fprintf(defwFile, " + PARTIAL %.11g\n", maxDensity); + defwLines++; + defwState = DEFW_BLOCKAGE_PLACE; + defwBlockageHasSP = 1; + return DEFW_OK; +} + +int +defwBlockagesRect(int xl, + int yl, + int xh, + int yh) +{ + defwFunc = DEFW_BLOCKAGE_RECT; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_BLOCKAGE_PLACE && defwState != DEFW_BLOCKAGE_LAYER && + defwState != DEFW_BLOCKAGE_RECT) + return DEFW_BAD_DATA; + + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, "\n"); // set a newline for the previous rectangle + + fprintf(defwFile, " RECT ( %d %d ) ( %d %d )", xl, yl, xh, yh); + defwLines++; + defwState = DEFW_BLOCKAGE_RECT; + return DEFW_OK; +} + + +int +defwBlockagesPolygon(int num_polys, + int *xl, + int *yl) +{ + int i; + + defwFunc = DEFW_BLOCKAGE_RECT; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_BLOCKAGE_LAYER && defwState != DEFW_BLOCKAGE_RECT) + return DEFW_BAD_DATA; + + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, "\n"); // set a newline for the previous rectangle + + fprintf(defwFile, " POLYGON "); + for (i = 0; i < num_polys; i++) { + if ((i == 0) || ((i % 5) != 0)) + fprintf(defwFile, "( %d %d ) ", *xl++, *yl++); + else { + fprintf(defwFile, "\n ( %d %d ) ", *xl++, *yl++); + defwLines++; + } + } + defwLines++; + defwState = DEFW_BLOCKAGE_RECT; // use rect flag. It works the same for poly + return DEFW_OK; +} + +// To be removed. Will replace by defwBlcokagesPlacement +// bug fix: submitted by Craig Files (cfiles@ftc.agilent.com) +int +defwBlockagePlacement() +{ + defwFunc = DEFW_BLOCKAGE_PLACE; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_BLOCKAGE_START && ((defwState == DEFW_BLOCKAGE_LAYER) + || (defwState == DEFW_BLOCKAGE_PLACE))) + return DEFW_BAD_DATA; + + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, " ;\n"); // end the previous rectangle + fprintf(defwFile, " - PLACEMENT\n"); + defwCounter--; + defwLines++; + defwState = DEFW_BLOCKAGE_PLACE; + return DEFW_OK; +} + +// To be removed. Will replace by defwBlcokagesPlacementComponent +int +defwBlockagePlacementComponent(const char *compName) +{ + defwFunc = DEFW_BLOCKAGE_PLACE; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_BLOCKAGE_START && ((defwState == DEFW_BLOCKAGE_LAYER) + || (defwState == DEFW_BLOCKAGE_PLACE))) + return DEFW_BAD_DATA; + + if ((compName == 0) || (*compName == 0)) // require + return DEFW_BAD_DATA; + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, " ;\n"); // end the previous rectangle + fprintf(defwFile, " - PLACEMENT + COMPONENT %s\n", compName); + defwCounter--; + defwLines++; + defwState = DEFW_BLOCKAGE_PLACE; + return DEFW_OK; +} + +// To be removed. Will replace by defwBlcokagesPlacementPushdown +int +defwBlockagePlacementPushdown() +{ + defwFunc = DEFW_BLOCKAGE_PLACE; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_BLOCKAGE_START && ((defwState == DEFW_BLOCKAGE_LAYER) + || (defwState == DEFW_BLOCKAGE_PLACE))) + return DEFW_BAD_DATA; + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, " ;\n"); // end the previous rectangle + fprintf(defwFile, " - PLACEMENT + PUSHDOWN\n"); + defwCounter--; + defwLines++; + defwState = DEFW_BLOCKAGE_PLACE; + return DEFW_OK; +} + +// To be removed. Will replace by defwBlcokagesPlacementSoft +int +defwBlockagePlacementSoft() +{ + defwFunc = DEFW_BLOCKAGE_PLACE; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_BLOCKAGE_START && ((defwState == DEFW_BLOCKAGE_LAYER) + || (defwState == DEFW_BLOCKAGE_PLACE))) + return DEFW_BAD_DATA; + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, " ;\n"); // end the previous rectangle + fprintf(defwFile, " - PLACEMENT + SOFT\n"); + defwCounter--; + defwLines++; + defwState = DEFW_BLOCKAGE_PLACE; + return DEFW_OK; +} + +// To be removed. Will replace by defwBlcokagesPlacementPartial +int +defwBlockagePlacementPartial(double maxDensity) +{ + defwFunc = DEFW_BLOCKAGE_PLACE; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_BLOCKAGE_START && ((defwState == DEFW_BLOCKAGE_LAYER) + || (defwState == DEFW_BLOCKAGE_PLACE))) + return DEFW_BAD_DATA; + + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, " ;\n"); // end the previous rectangle + fprintf(defwFile, " - PLACEMENT + PARTIAL %.11g\n", maxDensity); + defwCounter--; + defwLines++; + defwState = DEFW_BLOCKAGE_PLACE; + return DEFW_OK; +} + +// To be removed. Will replace by defwBlockagesLayerMask +int +defwBlockageMask(int colorMask) +{ + if (defVersionNum < 5.8) { + return DEFW_WRONG_VERSION; + } + + defwFunc = DEFW_BLOCKAGE_MASK; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_BLOCKAGE_PLACE && defwState != DEFW_BLOCKAGE_LAYER && + defwState != DEFW_BLOCKAGE_RECT) + return DEFW_BAD_DATA; + + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, "\n"); // set a newline for the previous rectangle + + fprintf(defwFile, " + MASK %d", colorMask); + defwLines++; + defwState = DEFW_BLOCKAGE_LAYER; + return DEFW_OK; +} + +// Tobe removed. Will be replaced by defwBlockagesRect. +int +defwBlockageRect(int xl, + int yl, + int xh, + int yh) +{ + defwFunc = DEFW_BLOCKAGE_RECT; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_BLOCKAGE_PLACE && defwState != DEFW_BLOCKAGE_LAYER && + defwState != DEFW_BLOCKAGE_RECT && defwState != DEFW_BLOCKAGE_MASK) + return DEFW_BAD_DATA; + + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, "\n"); // set a newline for the previous rectangle + + fprintf(defwFile, " RECT ( %d %d ) ( %d %d )", xl, yl, xh, yh); + defwLines++; + defwState = DEFW_BLOCKAGE_RECT; + return DEFW_OK; +} + +// Tobe removed. Will be replaced by defwBlockagesPolygon. +int +defwBlockagePolygon(int num_polys, + int *xl, + int *yl) +{ + int i; + + defwFunc = DEFW_BLOCKAGE_RECT; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_BLOCKAGE_LAYER && defwState != DEFW_BLOCKAGE_RECT + && defwState != DEFW_BLOCKAGE_MASK) + return DEFW_BAD_DATA; + + if (defwState == DEFW_BLOCKAGE_RECT) + fprintf(defwFile, "\n"); // set a newline for the previous rectangle + + fprintf(defwFile, " POLYGON "); + for (i = 0; i < num_polys; i++) { + if ((i == 0) || ((i % 5) != 0)) + fprintf(defwFile, "( %d %d ) ", *xl++, *yl++); + else { + fprintf(defwFile, "\n ( %d %d ) ", *xl++, *yl++); + defwLines++; + } + } + defwLines++; + defwState = DEFW_BLOCKAGE_RECT; // use rect flag. It works the same for poly + return DEFW_OK; +} + + +int +defwEndBlockages() +{ + defwFunc = DEFW_BLOCKAGE_END; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_BLOCKAGE_RECT) + return DEFW_BAD_ORDER; + if (defwCounter > 0) + return DEFW_BAD_DATA; + else if (defwCounter < 0) + return DEFW_TOO_MANY_STMS; + + fprintf(defwFile, " ;\n"); + + fprintf(defwFile, "END BLOCKAGES\n\n"); + defwLines++; + + defwState = DEFW_BLOCKAGE_END; + return DEFW_OK; +} + + +int +defwStartSlots(int count) +{ + defwFunc = DEFW_SLOT_START; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if ((defwState >= DEFW_SLOT_START) && (defwState <= DEFW_SLOT_END)) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.4) + return DEFW_WRONG_VERSION; + + fprintf(defwFile, "SLOTS %d ;\n", count); + defwLines++; + + defwState = DEFW_SLOT_START; + defwCounter = count; + return DEFW_OK; +} + +int +defwSlotLayer(const char *layerName) +{ + defwFunc = DEFW_SLOT_LAYER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_SLOT_START && defwState == DEFW_SLOT_LAYER) + return DEFW_BAD_DATA; + + if (!layerName || !*layerName) // require + return DEFW_BAD_DATA; + if (defwState == DEFW_SLOT_RECT) + fprintf(defwFile, " ;\n"); // end the previous rectangle + fprintf(defwFile, " - LAYER %s \n", layerName); + defwCounter--; + defwLines++; + defwState = DEFW_SLOT_LAYER; + return DEFW_OK; +} + + +int +defwSlotRect(int xl, + int yl, + int xh, + int yh) +{ + defwFunc = DEFW_SLOT_RECT; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_SLOT_LAYER && defwState != DEFW_SLOT_RECT) + return DEFW_BAD_DATA; + + if (defwState == DEFW_SLOT_RECT) + fprintf(defwFile, "\n"); // set a newline for the previous rectangle + + fprintf(defwFile, " RECT ( %d %d ) ( %d %d )", xl, yl, xh, yh); + defwLines++; + defwState = DEFW_SLOT_RECT; + return DEFW_OK; +} + + +int +defwSlotPolygon(int num_polys, + double *xl, + double *yl) +{ + int i; + + defwFunc = DEFW_SLOT_RECT; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_SLOT_LAYER && defwState != DEFW_SLOT_RECT) + return DEFW_BAD_DATA; + + if (defwState == DEFW_SLOT_RECT) + fprintf(defwFile, "\n"); // set a newline for the previous rectangle + + fprintf(defwFile, " POLYGON "); + + printPointsNum = 0; + for (i = 0; i < num_polys; i++) { + if ((i == 0) || ((i % 5) != 0)) + printPoints(defwFile, *xl++, *yl++, "", " "); + else { + printPoints(defwFile, *xl++, *yl++, "\n ", " "); + defwLines++; + } + } + defwLines++; + defwState = DEFW_SLOT_RECT; + return DEFW_OK; +} + + +int +defwEndSlots() +{ + defwFunc = DEFW_SLOT_END; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_SLOT_RECT) + return DEFW_BAD_ORDER; + if (defwCounter > 0) + return DEFW_BAD_DATA; + else if (defwCounter < 0) + return DEFW_TOO_MANY_STMS; + + fprintf(defwFile, " ;\n"); + + fprintf(defwFile, "END SLOTS\n\n"); + defwLines++; + + defwState = DEFW_SLOT_END; + return DEFW_OK; +} + + +int +defwStartFills(int count) +{ + defwFunc = DEFW_FILL_START; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if ((defwState >= DEFW_FILL_START) && (defwState <= DEFW_FILL_END)) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.4) + return DEFW_WRONG_VERSION; + + fprintf(defwFile, "FILLS %d ;\n", count); + defwLines++; + + defwState = DEFW_FILL_START; + defwCounter = count; + return DEFW_OK; +} + +int +defwFillLayer(const char *layerName) +{ + defwFunc = DEFW_FILL_LAYER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_FILL_START && defwState == DEFW_FILL_LAYER) + return DEFW_BAD_DATA; + + if (!layerName || !*layerName) // require + return DEFW_BAD_DATA; + if (defwState == DEFW_FILL_RECT) + fprintf(defwFile, " ;\n"); // end the previous rectangle + fprintf(defwFile, " - LAYER %s \n", layerName); + defwCounter--; + defwLines++; + defwState = DEFW_FILL_LAYER; + return DEFW_OK; +} + +int +defwFillLayerMask(int colorMask) +{ + if (defVersionNum < 5.8) { + return DEFW_WRONG_VERSION; + } + + defwFunc = DEFW_FILL_LAYERMASK; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_FILL_LAYER) + return DEFW_BAD_DATA; + + fprintf(defwFile, " + MASK %d", colorMask); + defwLines++; + defwState = DEFW_FILL_LAYERMASK; + return DEFW_OK; +} + + +// 5.71 +int +defwFillLayerOPC() +{ + defwFunc = DEFW_FILL_OPC; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_FILL_LAYER && defwState != DEFW_FILL_LAYERMASK) + return DEFW_BAD_DATA; + + fprintf(defwFile, " + OPC"); + defwLines++; + defwState = DEFW_FILL_OPC; + return DEFW_OK; +} + +int +defwFillRect(int xl, + int yl, + int xh, + int yh) +{ + defwFunc = DEFW_FILL_RECT; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_FILL_LAYER && defwState != DEFW_FILL_RECT && + defwState != DEFW_FILL_OPC && defwState != DEFW_FILL_LAYERMASK) + return DEFW_BAD_DATA; + + if (defwState == DEFW_FILL_RECT) + fprintf(defwFile, "\n"); // set a newline for the previous rectangle + + fprintf(defwFile, " RECT ( %d %d ) ( %d %d )", xl, yl, xh, yh); + defwLines++; + defwState = DEFW_FILL_RECT; + return DEFW_OK; +} + + +int +defwFillPolygon(int num_polys, + double *xl, + double *yl) +{ + int i; + + defwFunc = DEFW_FILL_RECT; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_FILL_LAYER && defwState != DEFW_FILL_RECT && + defwState != DEFW_FILL_OPC && defwState != DEFW_FILL_LAYERMASK) + return DEFW_BAD_DATA; + + if (defwState == DEFW_FILL_RECT) + fprintf(defwFile, "\n"); // set a newline for the previous rectangle + + fprintf(defwFile, " POLYGON "); + printPointsNum = 0; + for (i = 0; i < num_polys; i++) { + if ((i == 0) || ((i % 5) != 0)) + printPoints(defwFile, *xl++, *yl++, "", " "); + else { + printPoints(defwFile, *xl++, *yl++, "\n ", " "); + defwLines++; + } + } + defwLines++; + defwState = DEFW_FILL_RECT; + return DEFW_OK; +} + +// 5.7 +int +defwFillVia(const char *viaName) +{ + defwFunc = DEFW_FILL_LAYER; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_FILL_START && defwState == DEFW_FILL_LAYER) + return DEFW_BAD_DATA; + + if (!viaName || !*viaName) // require + return DEFW_BAD_DATA; + if (defwState == DEFW_FILL_RECT) + fprintf(defwFile, " ;\n"); // end the previous rectangle + fprintf(defwFile, " - VIA %s \n", viaName); + defwCounter--; + defwLines++; + defwState = DEFW_FILL_VIA; + return DEFW_OK; +} + +int +defwFillViaMask(int maskColor) +{ + if (defVersionNum < 5.8) { + return DEFW_WRONG_VERSION; + } + + defwFunc = DEFW_FILL_VIAMASK; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_FILL_VIA) + return DEFW_BAD_DATA; + + fprintf(defwFile, " + MASK %d", maskColor); + defwLines++; + defwState = DEFW_FILL_VIAMASK; + return DEFW_OK; +} + + +// 5.71 +int +defwFillViaOPC() +{ + defwFunc = DEFW_FILL_OPC; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_FILL_VIA && defwState != DEFW_FILL_VIAMASK) + return DEFW_BAD_DATA; + + fprintf(defwFile, " + OPC"); + defwLines++; + defwState = DEFW_FILL_OPC; + return DEFW_OK; +} + + +int +defwFillPoints(int num_points, + double *xl, + double *yl) +{ + int i; + + defwFunc = DEFW_FILL_RECT; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_FILL_VIA && defwState != DEFW_FILL_RECT && + defwState != DEFW_FILL_OPC && defwState != DEFW_FILL_VIAMASK) + return DEFW_BAD_DATA; + + if (defwState == DEFW_FILL_RECT) + fprintf(defwFile, "\n"); // set a newline for the previous rectangle + + fprintf(defwFile, " "); + printPointsNum = 0; + + for (i = 0; i < num_points; i++) { + if ((i == 0) || ((i % 5) != 0)) + printPoints(defwFile, *xl++, *yl++, "", " "); + else { + printPoints(defwFile, *xl++, *yl++, "\n ", " "); + defwLines++; + } + } + + defwLines++; + defwState = DEFW_FILL_RECT; + return DEFW_OK; +} + + +int +defwEndFills() +{ + defwFunc = DEFW_FILL_END; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_FILL_RECT && defwState != DEFW_FILL_OPC) + return DEFW_BAD_ORDER; + if (defwCounter > 0) + return DEFW_BAD_DATA; + else if (defwCounter < 0) + return DEFW_TOO_MANY_STMS; + + fprintf(defwFile, " ;\n"); + + fprintf(defwFile, "END FILLS\n\n"); + defwLines++; + + defwState = DEFW_FILL_END; + return DEFW_OK; +} + + +int +defwStartNonDefaultRules(int count) +{ + defwFunc = DEFW_NDR_START; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if ((defwState >= DEFW_NDR_START) && (defwState <= DEFW_NDR_END)) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.6) + return DEFW_WRONG_VERSION; + + fprintf(defwFile, "NONDEFAULTRULES %d ;\n", count); + defwLines++; + + defwState = DEFW_NDR_START; + defwCounter = count; + return DEFW_OK; +} + +int +defwNonDefaultRule(const char *ruleName, + int hardSpacing) +{ + defwFunc = DEFW_NDR; + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_NDR_START && defwState != DEFW_NDR) + return DEFW_BAD_ORDER; + + if (!ruleName || !*ruleName) // require + return DEFW_BAD_DATA; + if (defwState == DEFW_NDR) + fprintf(defwFile, ";\n"); + fprintf(defwFile, " - %s", ruleName); + if (hardSpacing) + fprintf(defwFile, "\n + HARDSPACING"); + defwCounter--; + defwLines++; + defwState = DEFW_NDR; + return DEFW_OK; +} + + +int +defwNonDefaultRuleLayer(const char *layerName, + int width, + int diagWidth, + int spacing, + int wireExt) +{ + defwFunc = DEFW_NDR; + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_NDR) + return DEFW_BAD_ORDER; + + if (!layerName || !*layerName) // require + return DEFW_BAD_DATA; + fprintf(defwFile, "\n + LAYER %s ", layerName); + fprintf(defwFile, " WIDTH %d ", width); + if (diagWidth) + fprintf(defwFile, " DIAGWIDTH %d ", diagWidth); + if (spacing) + fprintf(defwFile, " SPACING %d ", spacing); + if (wireExt) + fprintf(defwFile, " WIREEXT %d ", wireExt); + defwLines++; + defwState = DEFW_NDR; + return DEFW_OK; +} + +int +defwNonDefaultRuleVia(const char *viaName) +{ + defwFunc = DEFW_NDR; + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_NDR) + return DEFW_BAD_ORDER; + + if (!viaName || !*viaName) // require + return DEFW_BAD_DATA; + fprintf(defwFile, "\n + VIA %s ", viaName); + defwLines++; + defwState = DEFW_NDR; + return DEFW_OK; +} + +int +defwNonDefaultRuleViaRule(const char *viaRuleName) +{ + defwFunc = DEFW_NDR; + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_NDR) + return DEFW_BAD_ORDER; + + if ((viaRuleName == 0) || (*viaRuleName == 0)) // require + return DEFW_BAD_DATA; + fprintf(defwFile, "\n + VIARULE %s ", viaRuleName); + defwLines++; + defwState = DEFW_NDR; + return DEFW_OK; +} + +int +defwNonDefaultRuleMinCuts(const char *cutLayerName, + int numCuts) +{ + defwFunc = DEFW_NDR; + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_NDR) + return DEFW_BAD_ORDER; + + if ((cutLayerName == 0) || (*cutLayerName == 0)) // require + return DEFW_BAD_DATA; + fprintf(defwFile, "\n + MINCUTS %s %d ", cutLayerName, numCuts); + defwLines++; + defwState = DEFW_NDR; + return DEFW_OK; +} + +int +defwEndNonDefaultRules() +{ + defwFunc = DEFW_NDR_END; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_NDR) + return DEFW_BAD_ORDER; + if (defwCounter > 0) + return DEFW_BAD_DATA; + else if (defwCounter < 0) + return DEFW_TOO_MANY_STMS; + + fprintf(defwFile, ";\nEND NONDEFAULTRULES\n\n"); + defwLines++; + + defwState = DEFW_NDR_END; + return DEFW_OK; +} + + +int +defwStartStyles(int count) +{ + defwFunc = DEFW_STYLES_START; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if ((defwState >= DEFW_STYLES_START) && (defwState <= DEFW_STYLES_END)) + return DEFW_BAD_ORDER; + if (defVersionNum < 5.6) + return DEFW_WRONG_VERSION; + + fprintf(defwFile, "STYLES %d ;\n", count); + defwLines++; + + defwState = DEFW_STYLES_START; + defwCounter = count; + return DEFW_OK; +} + +int +defwStyles(int styleNums, + int num_points, + double *xp, + double *yp) +{ + int i; + + defwFunc = DEFW_STYLES; + if (!defwFile) + return DEFW_UNINITIALIZED; + // May be user already define layer + if (defwState != DEFW_STYLES_START && defwState != DEFW_STYLES) + return DEFW_BAD_ORDER; + + if (styleNums < 0) // require + return DEFW_BAD_DATA; + fprintf(defwFile, " - STYLE %d ", styleNums); + + printPointsNum = 0; + for (i = 0; i < num_points; i++) { + if ((i == 0) || ((i % 5) != 0)) + printPoints(defwFile, *xp++, *yp++, "", " "); + else { + printPoints(defwFile, *xp++, *yp++, "\n ", " "); + defwLines++; + } + } + + defwCounter--; + defwLines++; + fprintf(defwFile, ";\n"); + defwState = DEFW_STYLES; + return DEFW_OK; +} + +int +defwEndStyles() +{ + defwFunc = DEFW_STYLES_END; // Current function of writer + if (!defwFile) + return DEFW_UNINITIALIZED; + if (defwState != DEFW_STYLES) + return DEFW_BAD_ORDER; + if (defwCounter > 0) + return DEFW_BAD_DATA; + else if (defwCounter < 0) + return DEFW_TOO_MANY_STMS; + + fprintf(defwFile, "END STYLES\n\n"); + defwLines++; + + defwState = DEFW_STYLES_END; + return DEFW_OK; +} + + +int +defwStartBeginext(const char *name) +{ + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + if (defwState == DEFW_BEGINEXT_START || + defwState == DEFW_BEGINEXT) + return DEFW_BAD_ORDER; + if (!name || name == 0 || *name == 0) + return DEFW_BAD_DATA; + fprintf(defwFile, "BEGINEXT \"%s\"\n", name); + + defwState = DEFW_BEGINEXT_START; + defwLines++; + return DEFW_OK; +} + +int +defwBeginextCreator(const char *creatorName) +{ + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + if (defwState != DEFW_BEGINEXT_START && + defwState != DEFW_BEGINEXT) + return DEFW_BAD_ORDER; + if (!creatorName || creatorName == 0 || *creatorName == 0) + return DEFW_BAD_DATA; + fprintf(defwFile, " CREATOR \"%s\"\n", creatorName); + + defwState = DEFW_BEGINEXT; + defwLines++; + return DEFW_OK; +} + + +int +defwBeginextDate() +{ + time_t todayTime; + char *rettime; + + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + if (defwState != DEFW_BEGINEXT_START && + defwState != DEFW_BEGINEXT) + return DEFW_BAD_ORDER; + + todayTime = time(NULL); // time in UTC + rettime = ctime(&todayTime); // convert to string + rettime[strlen(rettime) - 1] = '\0'; // replace \n with \0 + fprintf(defwFile, " DATE \"%s\"", rettime); + + defwState = DEFW_BEGINEXT; + defwLines++; + return DEFW_OK; +} + + +int +defwBeginextRevision(int vers1, + int vers2) +{ + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + if (defwState != DEFW_BEGINEXT_START && + defwState != DEFW_BEGINEXT) + return DEFW_BAD_ORDER; + fprintf(defwFile, "\n REVISION %d.%d", vers1, vers2); + + defwState = DEFW_BEGINEXT; + defwLines++; + return DEFW_OK; +} + + +int +defwBeginextSyntax(const char *title, + const char *string) +{ + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + if (defwState != DEFW_BEGINEXT_START && + defwState != DEFW_BEGINEXT) + return DEFW_BAD_ORDER; + fprintf(defwFile, "\n - %s %s", title, string); + + defwState = DEFW_BEGINEXT; + defwLines++; + return DEFW_OK; +} + + +int +defwEndBeginext() +{ + if (!defwFile) + return DEFW_UNINITIALIZED; + if (!defwDidInit) + return DEFW_BAD_ORDER; + if (defwState != DEFW_BEGINEXT_START && + defwState != DEFW_BEGINEXT) + return DEFW_BAD_ORDER; + fprintf(defwFile, ";\nENDEXT\n\n"); + + defwState = DEFW_BEGINEXT_END; + defwLines++; + return DEFW_OK; +} + + +int +defwEnd() +{ + defwFunc = DEFW_END; // Current function of writer + if (!defwFile) + return 1; + + if (defwState == DEFW_ROW) + fprintf(defwFile, ";\n\n"); // add the ; and \n for the previous row. + + fprintf(defwFile, "END DESIGN\n\n"); + defwLines++; + //defwFile = 0; + defwState = DEFW_DONE; + return DEFW_OK; +} + + +int +defwCurrentLineNumber() +{ + return defwLines; +} + + +void +defwPrintError(int status) +{ + switch (status) { + case DEFW_OK: + fprintf(defwFile, "No Error.\n"); + break; + case DEFW_UNINITIALIZED: + printf("Need to call defwInit first.\n"); + break; + case DEFW_BAD_ORDER: + fprintf(defwFile, "%s - Incorrect order of data.\n", + defwStateStr[defwFunc]); + break; + case DEFW_BAD_DATA: + fprintf(defwFile, "%s - Invalid data.\n", + defwStateStr[defwFunc]); + break; + case DEFW_ALREADY_DEFINED: + fprintf(defwFile, "%s - Section is allowed to define only once.\n", + defwStateStr[defwFunc]); + break; + case DEFW_WRONG_VERSION: + fprintf(defwFile, "%s - Version number is set before 5.6, but 5.6 API is used.\n", + defwStateStr[defwFunc]); + break; + case DEFW_OBSOLETE: + fprintf(defwFile, "%s - is no longer valid in 5.6.\n", + defwStateStr[defwObsoleteNum]); + break; + } + return; +} + + +void +defwAddComment(const char *comment) +{ + if (comment) + fprintf(defwFile, "# %s\n", comment); + return; +} + + +void +defwAddIndent() +{ + fprintf(defwFile, " "); + return; +} + + +//*************************** +// Questions: +// - Is only one row rule allowed +// - Is only one tracks rule allowed +// - In the die area is a zero area allowed? overlaps? +// - What type of checking is needed for the rows and tracks do loop? +// - Can you have a default prop with a number AND a range? +// - What is the pin properties section mentioned in the 5.1 spec? +// ***************************** + +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defwWriter.hpp b/src/def/def/defwWriter.hpp new file mode 100644 index 00000000..13af43a9 --- /dev/null +++ b/src/def/def/defwWriter.hpp @@ -0,0 +1,1752 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef DEFW_WRITER_H +#define DEFW_WRITER_H + +#include +#include + +#include "defiKRDefs.hpp" +#include "defiDefs.hpp" +#include "defiUser.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +/* Return codes for writing functions: */ +#define DEFW_OK 0 +#define DEFW_UNINITIALIZED 1 +#define DEFW_BAD_ORDER 2 +#define DEFW_BAD_DATA 3 +#define DEFW_ALREADY_DEFINED 4 +#define DEFW_WRONG_VERSION 5 +#define DEFW_OBSOLETE 6 +#define DEFW_TOO_MANY_STMS 7 // the number defined at the beginning of the + // section is smaller than the actual number + // of statements defined in that section + +/* orient + 0 = N + 1 = W + 2 = S + 3 = E + 4 = FN + 5 = FW + 6 = FS + 7 = FE +*/ + +/* This routine will write a new line */ +extern int defwNewLine(); + +/* The DEF writer initialization. Must be called first. + * Either this routine or defwInitCbk should be call only. + * Can't call both routines in one program. + * This routine is for user who does not want to use the callback machanism. + * Returns 0 if successful. */ +extern int defwInit ( FILE* f, int vers1, int version2, + const char* caseSensitive, /* NAMESCASESENSITIVE */ + const char* dividerChar, /* DIVIDERCHAR */ + const char* busBitChars, /* BUSBITCHARS */ + const char* designName, /* DESIGN */ + const char* technology, /* optional(NULL) - TECHNOLOGY */ + const char* array, /* optional(NULL) - ARRAYNAME */ + const char* floorplan, /* optional(NULL) - FLOORPLAN */ + double units ); /* optional (set to -1 to ignore) */ + +/* The DEF writer initialization. Must be called first. + * Either this routine or defwInit should be call only. + * Can't call both routines in one program. + * This routine is for user who choose to use the callback machanism. + * If user uses the callback for the writer, they need to provide + * callbacks for Version, NamesCaseSensitive, BusBitChars and DividerChar. + * These sections are required by the def. If any of these callbacks + * are missing, defaults will be used. + * Returns 0 if successful. */ +extern int defwInitCbk (FILE* f); + +/* This routine must be called after the defwInit. + * This routine is required. + * Returns 0 if successful. + * The routine can be called only once. */ +extern int defwVersion (int vers1, int vers2); + +/* This routine must be called after the defwInit. + * This routine is required. + * Returns 0 if successful. + * The routine can be called only once. */ +extern int defwCaseSensitive ( const char* caseSensitive ); + +/* This routine must be called after the defwInit. + * This routine is required. + * Returns 0 if successful. + * The routine can be called only once. */ +extern int defwBusBitChars ( const char* busBitChars ); + +/* This routine must be called after the defwInit. + * This routine is required. + * Returns 0 if successful. + * The routine can be called only once. */ +extern int defwDividerChar ( const char* dividerChar ); + +/* This routine must be called after the defwInit. + * This routine is required. + * Returns 0 if successful. + * The routine can be called only once. */ +extern int defwDesignName ( const char* name ); + +/* This routine must be called after the defwInit. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called only once. */ +extern int defwTechnology ( const char* technology ); + +/* This routine must be called after the defwInit. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called only once. */ +extern int defwArray ( const char* array ); + +/* This routine must be called after the defwInit. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called only once. */ +extern int defwFloorplan ( const char* floorplan ); + +/* This routine must be called after the defwInit. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called only once. */ +extern int defwUnits ( int units ); + +/* This routine must be called after the defwInit. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called 0 to many times. */ +extern int defwHistory ( const char* string ); + +/* This routine must be called after the history routines (if any). + * This routine is optional. + * Returns 0 if successful. + * The routine can be called only once. */ +extern int defwStartPropDef ( void ); + +/* This routine must be called after defwStartPropDef. + * This routine can be called multiple times. + * It adds integer property definition to the statement. + * Returns 0 if successfull. + * The objType can be LIBRARY or VIA or MACRO or PIN. */ +extern int defwIntPropDef( + const char* objType, // LIBRARY | LAYER | VIA | VIARULE | + // NONDEFAULTRULE | MACRO | PIN + const char* propName, + double leftRange, /* optional(0) - RANGE */ + double rightRange, /* optional(0) */ + int propValue); /* optional(NULL) */ + +/* This routine must be called after defwStartPropDef. + * This routine can be called multiple times. + * It adds real property definition to the statement. + * Returns 0 if successfull. + * The objType can be LIBRARY or VIA or MACRO or PIN. */ +extern int defwRealPropDef( + const char* objType, // LIBRARY | LAYER | VIA | VIARULE | + // NONDEFAULTRULE | MACRO | PIN + const char* propName, + double leftRange, /* optional(0) - RANGE */ + double rightRange, /* optional(0) */ + double propValue); /* optional(NULL) */ + +/* This routine must be called after defwStartPropDef. + * This routine can be called multiple times. + * It adds string property definition to the statement. + * Returns 0 if successfull. + * The objType can be LIBRARY or VIA or MACRO or PIN. */ +extern int defwStringPropDef( + const char* objType, // LIBRARY | LAYER | VIA | VIARULE | + // NONDEFAULTRULE | MACRO | PIN + const char* propName, + double leftRange, /* optional(0) - RANGE */ + double rightRange, /* optional(0) */ + const char* propValue); /* optional(NULL) */ + +/* This routine must be called after all the properties have been + * added to the file. + * If you called defwPropertyDefinitions then this routine is NOT optional. + * Returns 0 if successful. + * The routine can be called only once. */ +extern int defwEndPropDef ( void ); + +/* This routine can be called after defwRow, defwRegion, defwComponent, + * defwPin, defwSpecialNet, defwNet, and defwGroup + * This routine is optional, it adds string property to the statement. + * Returns 0 if successful. + * This routine can be called 0 to many times */ +extern int defwStringProperty(const char* propName, const char* propValue); + +/* This routine can be called after defwRow, defwRegion, defwComponent, + * defwPin, defwSpecialNet, defwNet, and defwGroup + * This routine is optional, it adds real property to the statement. + * Returns 0 if successful. + * This routine can be called 0 to many times */ +extern int defwRealProperty(const char* propName, double propValue); + +/* This routine can be called after defwRow, defwRegion, defwComponent, + * defwPin, defwSpecialNet, defwNet, and defwGroup + * This routine is optional, it adds int property to the statement. + * Returns 0 if successful. + * This routine can be called 0 to many times */ +extern int defwIntProperty(const char* propName, int propValue); + +/* This routine must be called after the property definitions (if any). + * This routine is optional. + * Returns 0 if successful. + * The routine can be called only once. */ +extern int defwDieArea ( int xl, /* point1 - x */ + int yl, /* point1 - y */ + int xh, /* point2 - x */ + int yh ); /* point2 - y */ + +/* This routine must be called after the property definitions (if any). + * This routine is optional. + * This routine is the same as defwDieArea, but accept more than 2 points + * This is a 5.6 syntax + * Returns 0 if successful. + * The routine can be called only once. */ +extern int defwDieAreaList ( int num_points, /* number of points on list */ + int* xl, /* all the x points */ + int* yh); /* all the y points */ + +/* This routine must be called after the Die Area (if any). + * This routine is optional. + * Returns 0 if successful. + * The integer "orient" and operation of the do is explained in + * the documentation. + * In 5.6, the DO syntax is optional and the STEP syntax is optional in DO */ +extern int defwRow ( const char* rowName, const char* rowType, + int x_orig, int y_orig, int orient, + int do_count, /* optional (0) */ + int do_increment, /* optional (0) */ + int xstep, /* optional (0) */ + int ystep); /* optional (0) */ + +/* This routine must be called after the Die Area (if any). + * This routine is optional. + * Returns 0 if successful. + * This routine is the same as defwRow, excpet orient is a char* */ +extern int defwRowStr ( const char* rowName, const char* rowType, + int x_orig, int y_orig, const char* orient, + int do_count, /* optional (0) */ + int do_increment, /* optional (0) */ + int xstep, /* optional (0) */ + int ystep); /* optional (0) */ + +/* This routine must be called after the defwRow (if any). + * This routine is optional. + * Returns 0 if successful. + * The operation of the do is explained in the documentation. */ +extern int defwTracks ( const char* master, /* X | Y */ + int doStart, /* start */ + int doCount, /* numTracks */ + int doStep, /* space */ + int numLayers, /* number of layers */ + const char** layers, /* list of layers */ + int mask = 0, /* optional */ + int sameMask = 0); /* optional */ + +/* This routine must be called after the defwTracks (if any). + * This routine is optional. + * Returns 0 if successful. + * The operation of the do is explained in the documentation. */ +extern int defwGcellGrid ( const char* master, /* X | Y */ + int doStart, /* start */ + int doCount, /* numColumns | numRows */ + int doStep); /* space */ + +/* This routine must be called after the defwTracks (if any). + * This section of routines is optional. + * Returns 0 if successful. + * The routine starts the default capacitance section. All of the + * capacitances must follow. + * The count is the number of defwDefaultCap calls to follow. + * The routine can be called only once. + * This api is obsolete in 5.4. */ +extern int defwStartDefaultCap ( int count ); + +/* This routine is called once for each default cap. The calls must + * be preceeded by a call to defwStartDefaultCap and must be + * terminated by a call to defwEndDefaultCap. + * Returns 0 if successful. + * This api is obsolete in 5.4. */ +extern int defwDefaultCap ( int pins, /* MINPINS */ + double cap); /* WIRECAP */ + +/* This routine must be called after the defwDefaultCap calls (if any). + * Returns 0 if successful. + * If the count in StartDefaultCap is not the same as the number of + * calls to DefaultCap then DEFW_BAD_DATA will return returned. + * The routine can be called only once. + * This api is obsolete in 5.4. */ +extern int defwEndDefaultCap ( void ); + +/* This routine must be called after the defwDefaultCap calls (if any). + * The operation of the do is explained in the documentation. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called many times. */ +extern int defwCanPlace(const char* master, /* sitename */ + int xOrig, + int yOrig, + int orient, /* 0 to 7 */ + int doCnt, /* numX */ + int doInc, /* numY */ + int xStep, /* spaceX */ + int yStep); /* spaceY */ + +/* This routine must be called after the defwDefaultCap calls (if any). + * The operation of the do is explained in the documentation. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called many times. + * This routine is the same as defwCanPlace, except orient is a char* */ +extern int defwCanPlaceStr(const char* master, /* sitename */ + int xOrig, + int yOrig, + const char* orient, /* 0 to 7 */ + int doCnt, /* numX */ + int doInc, /* numY */ + int xStep, /* spaceX */ + int yStep); /* spaceY */ + +/* This routine must be called after the defwCanPlace calls (if any). + * The operation of the do is explained in the documentation. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called many times. */ +extern int defwCannotOccupy(const char* master, /* sitename */ + int xOrig, + int yOrig, + int orient, /* 0 to 7 */ + int doCnt, /* numX */ + int doInc, /* numY */ + int xStep, /* spaceX */ + int yStep); /* spaceY */ + +/* This routine must be called after the defwCanPlace calls (if any). + * The operation of the do is explained in the documentation. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called many times. + * This routine is the same as defwCannotOccupy, except orient is a char* */ +extern int defwCannotOccupyStr(const char* master, /* sitename */ + int xOrig, + int yOrig, + const char* orient, /* 0 to 7 */ + int doCnt, /* numX */ + int doInc, /* numY */ + int xStep, /* spaceX */ + int yStep); /* spaceY */ + +/* This routine must be called after defwCannotOccupy (if any). + * This section of routines is optional. + * Returns 0 if successful. + * The routine starts the via section. All of the vias must follow. + * The count is the number of defwVia calls to follow. + * The routine can be called only once. */ +extern int defwStartVias( int count ); + +/* These routines enter each via into the file. + * These routines must be called after the defwStartVias call. + * defwViaName should be called first, follow either by defwViaPattern or + * defwViaLayer. At the end of each via, defwOneViaEnd should be called + * These routines are for [- viaName [+ PATTERNNAME patternName + RECT layerName + * pt pt]...;]... + * Returns 0 if successful. + * The routines can be called many times. */ +extern int defwViaName(const char* name); + +extern int defwViaPattern(const char* patternName); + +/* This routine can be called multiple times. */ +/* mask is 5.8 syntax */ +extern int defwViaRect(const char* layerName, + int xl, /* xl from the RECT */ + int yl, /* yl from the RECT */ + int xh, /* xh from the RECT */ + int yh, /* yh from the RECT */ + int mask = 0); /* optional */ + +/* This is a 5.6 syntax + * This routine can be called multiple times. */ +/* mask is 5.8 syntax */ +extern int defwViaPolygon(const char* layerName, + int num_polys, + double* xl, + double* yl, + int mask = 0); + +/* These routine must be called after defwViaName. + * Either this routine or defwViaPattern can be called after each + * defwViaName is called. + * This is a 5.6 syntax + * Returns 0 if successful + * The routine can be called only once per defwViaName called. */ +extern int defwViaViarule(const char* viaRuleName, + double xCutSize, double yCutSize, + const char* botMetalLayer, const char* cutLayer, + const char* topMetalLayer, + double xCutSpacing, double yCutSpacing, + double xBotEnc, double yBotEnc, + double xTopEnc, double yTopEnc); + +/* This routine can call only after defwViaViarule. + * It can only be called once. + * This is a 5.6 syntax. + * Returns 0 if successful. */ +extern int defwViaViaruleRowCol(int numCutRows, int numCutCols); + +/* This routine can call only after defwViaViarule. + * It can only be called once. + * This is a 5.6 syntax. + * Returns 0 if successful. */ +extern int defwViaViaruleOrigin(int xOffset, int yOffset); + +/* This routine can call only after defwViaViarule. + * It can only be called once. + * This is a 5.6 syntax. + * Returns 0 if successful. */ +extern int defwViaViaruleOffset(int xBotOffset, int yBotOffset, + int xTopOffset, int yTopOffset); + +/* This routine can call only after defwViaViarule. + * It can only be called once. + * This is a 5.6 syntax. + * Returns 0 if successful. */ +extern int defwViaViarulePattern(const char* cutPattern); + +extern int defwOneViaEnd(); + +/* This routine must be called after the defwVia calls. + * Returns 0 if successful. + * If the count in StartVias is not the same as the number of + * calls to Via or ViaPattern then DEFW_BAD_DATA will return returned. + * The routine can be called only once. */ +extern int defwEndVias( void ); + +/* This routine must be called after via section (if any). + * This section of routines is optional. + * Returns 0 if successful. + * The routine starts the region section. All of the regions must follow. + * The count is the number of defwRegion calls to follow. + * The routine can be called only once. */ +extern int defwStartRegions( int count ); + +/* This routine enter each region into the file. + * This routine must be called after the defwStartRegions call. + * Returns 0 if successful. + * The routine can be called many times. */ +extern int defwRegionName(const char* name); + +/* This routine enter the region point to the region name. + * This routine must be called after the defwRegionName call. + * Returns 0 if successful. + * The routine can be called many times. */ +extern int defwRegionPoints(int xl, int yl, int xh, int yh); + +/* This routine enter the region type, FENCE | GUIDE. + * This routine must be called after the defwRegionName call. + * This is a 5.4.1 syntax. + * Returns 0 if successful. + * The routine can be called only once. */ +extern int defwRegionType(const char* type); /* FENCE | GUIDE */ + +/* This routine must be called after the defwRegion calls. + * Returns 0 if successful. + * If the count in StartRegions is not the same as the number of + * calls to Region or RegionPattern then DEFW_BAD_DATA will return returned. + * The routine can be called only once. */ +extern int defwEndRegions( void ); + +/* This is a 5.8 syntax. + * Returns 0 if successful. + * The routine can be called only once. */ +extern int defwComponentMaskShiftLayers(const char** layerNames, + int numLayerName); + +/* This routine must be called after the regions section (if any). + * This section of routines is NOT optional. + * Returns 0 if successful. + * The routine starts the components section. All of the components + * must follow. + * The count is the number of defwComponent calls to follow. + * The routine can be called only once. */ +extern int defwStartComponents( int count ); + +/* This routine enter each component into the file. + * This routine must be called after the defwStartComponents call. + * The optional fields will be ignored if they are set to zero + * (except for weight which must be set to -1.0). + * Returns 0 if successful. + * The routine can be called many times. */ +extern int defwComponent(const char* instance, /* compName */ + const char* master, /* modelName */ + int numNetName, // optional(0) - # netNames defined + + const char** netNames, /* optional(NULL) - list */ + const char* eeq, /* optional(NULL) - EEQMASTER */ + const char* genName, /* optional(NULL) - GENERATE */ + const char* genParemeters, /* optional(NULL) - parameters */ + const char* source, // optional(NULL) - NETLIST | DIST | + // USER | TIMING + int numForeign, // optional(0) - # foreigns, + // foreignx, foreigny & orients + const char** foreigns, /* optional(NULL) - list */ + int* foreignX, int* foreignY, /* optional(0) - list foreign pts */ + int* foreignOrients, /* optional(-1) - 0 to 7 */ + const char* status, // optional(NULL) - FIXED | COVER | + // PLACED | UNPLACED + int statusX, int statusY, /* optional(0) - status pt */ + int statusOrient, /* optional(-1) - 0 to 7 */ + double weight, /* optional(0) */ + const char* region, // optional(NULL) - either xl, yl, + // xh, yh or region + int xl, int yl, /* optional(0) - region pt1 */ + int xh, int yh); /* optional(0) - region pt2 */ + + +/* This routine enter each component into the file. + * This routine must be called after the defwStartComponents call. + * The optional fields will be ignored if they are set to zero + * (except for weight which must be set to -1.0). + * Returns 0 if successful. + * The routine can be called many times. + * This routine is the same as defwComponent, except orient is a char** */ +extern int defwComponentStr(const char* instance, /* compName */ + const char* master, /* modelName */ + int numNetName, // optional(0) - # netNames defined + // + const char** netNames, /* optional(NULL) - list */ + const char* eeq, /* optional(NULL) - EEQMASTER */ + const char* genName, /* optional(NULL) - GENERATE */ + const char* genParemeters, /* optional(NULL) - parameters */ + const char* source, // optional(NULL) - NETLIST | DIST | + // USER | TIMING + int numForeign, // optional(0) - # foreigns, + // foreignx, foreigny & orients + const char** foreigns, /* optional(NULL) - list */ + int* foreignX, int* foreignY, /* optional(0) - list foreign pts */ + const char** foreignOrients, /* optional(NULL) */ + const char* status, // optional(NULL) - FIXED | COVER | + // PLACED | UNPLACED + int statusX, int statusY, /* optional(0) - status pt */ + const char* statusOrient, /* optional(NULL) */ + double weight, /* optional(0) */ + const char* region, // optional(NULL) - either xl, yl, + // xh, yh or region + int xl, int yl, /* optional(0) - region pt1 */ + int xh, int yh); /* optional(0) - region pt2 */ + +/* This is a 5.8 syntax. + * Returns 0 if successful. + * The routine can be called only once. */ +extern int defwComponentMaskShift(int shiftLayerMasks); + +/* This routine must be called after either the defwComponent or + * defwComponentStr. + * This routine can only called once per component. + * Either this routine or defwComponentHaloSoft can be called, but not both + * This routine is optional. + * This is a 5.6 syntax. + * Returns 0 if successful. */ +extern int defwComponentHalo(int left, int bottom, int right, int top); + +/* This routine must be called after either the defwComponent or + * defwComponentStr. + * This routine can only called once per component. + * This routine is just like defwComponentHalo, except it writes the option SOFT + * Either this routine or defwComponentHalo can be called, but not both + * This routine is optional. + * This is a 5.7 syntax. + * Returns 0 if successful. */ +extern int defwComponentHaloSoft(int left, int bottom, int right, int top); + +/* This routine must be called after either the defwComponent or + * defwComponentStr. + * This routine can only called once per component. + * This routine is optional. + * This is a 5.7 syntax. + * Returns 0 if successful. */ +extern int defwComponentRouteHalo(int haloDist, const char* minLayer, + const char* maxLayer); + +/* This routine must be called after the defwComponent calls. + * Returns 0 if successful. + * If the count in StartComponents is not the same as the number of + * calls to Component then DEFW_BAD_DATA will return returned. + * The routine can be called only once. */ +extern int defwEndComponents( void ); + +/* This routine must be called after the components section (if any). + * This section of routines is optional. + * Returns 0 if successful. + * The routine starts the pins section. All of the pins must follow. + * The count is the number of defwPin calls to follow. + * The routine can be called only once. */ +extern int defwStartPins( int count ); + +/* This routine enter each pin into the file. + * This routine must be called after the defwStartPins call. + * The optional fields will be ignored if they are set to zero. + * Returns 0 if successful. + * The routine can be called many times. + * NOTE: Use defwPinLayer to write out layer with SPACING or DESIGNRULEWIDTH */ +extern int defwPin(const char* name, /* pinName */ + const char* net, /* netName */ + int special, /* 0 - ignore, 1 - special */ + const char* direction, // optional(NULL) - INPUT | OUTPUT | + // INOUT | FEEDTHRU + const char* use, // optional(NULL) - SIGNAL | POWER | + // GROUND | CLOCK | TIEOFF | ANALOG + const char* status, // optional(NULL) - FIXED | PLACED | + // COVER + int statusX, int statusY, /* optional(0) - status point */ + int orient, /* optional(-1) - status orient */ + const char* layer, /* optional(NULL) - layerName */ + int xl, int yl, /* optional(0) - layer point1 */ + int xh, int yh); /* optional(0) - layer point2 */ + +/* This routine enter each pin into the file. + * This routine must be called after the defwStartPins call. + * The optional fields will be ignored if they are set to zero. + * Returns 0 if successful. + * The routine can be called many times. + * This routine is the same as defwPin, except orient is a char* + * NOTE: Use defwPinLayer to write out layer with SPACING or DESIGNRULEWIDTH */ +extern int defwPinStr(const char* name, /* pinName */ + const char* net, /* netName */ + int special, /* 0 - ignore, 1 - special */ + const char* direction, // optional(NULL) - INPUT | OUTPUT | + // INOUT | FEEDTHRU + const char* use, // optional(NULL) - SIGNAL | POWER | + // GROUND | CLOCK | TIEOFF | ANALOG + const char* status, // optional(NULL) - FIXED | PLACED | + // COVER + int statusX, int statusY, /* optional(0) - status point */ + const char* orient, /* optional(NULL) */ + const char* layer, /* optional(NULL) - layerName */ + int xl, int yl, /* optional(0) - layer point1 */ + int xh, int yh); /* optional(0) - layer point2 */ + +/* This routine should be called if the layer has either SPACING or + * DESIGNRULEWIDTH. If this routine is used and the pin has only one + * layer, the layer in defwPin or defwPinStr has to be null, otherwise + * the layer will be written out twice. + * This routine must be called after defwPin or defwPinStr. + * This is a 5.6 syntax. + * This routine is optional. + * Returns 0 if successful. + * This routine can be called multiple times within a pin. */ +extern int defwPinLayer(const char* layerName, + int spacing, /* optional(0) - SPACING & DESIGNRULEWIDTH */ + int designRuleWidth, /* are mutually exclusive */ + int xl, int yl, + int xh, int yh, + int mask = 0); + +/* This routine must be called after defwPin or defwPinStr. + * This routine is to write out layer with polygon. + * This is a 5.6 syntax. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called multiple times within a pin. */ +extern int defwPinPolygon(const char* layerName, + int spacing, /* optional(0) - SPACING & DESIGNRULEWIDTH */ + int designRuleWidth, /* are mutually exclusive */ + int num_polys, double* xl, double* yl, + int mask = 0); + +/* This routine must be called after defwPin or defwPinStr. + * This routine is to write out layer with via. + * This is a 5.7 syntax. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called multiple times within a pin. */ +extern int defwPinVia(const char* viaName, int xl, int yl, int mask = 0); + +/* This routine must be called after defwPin or defwPinStr. + * This routine is to write out pin with port. + * This is a 5.7 syntax. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called multiple times within a pin. */ +extern int defwPinPort(); + +/* This routine is called after defwPinPort. + * This is a 5.7 syntax. + * This routine is optional. + * Returns 0 if successful. + * This routine can be called multiple times within a pin. */ +extern int defwPinPortLayer(const char* layerName, + int spacing, /* optional(0) - SPACING & DESIGNRULEWIDTH */ + int designRuleWidth, /* are mutually exclusive */ + int xl, int yl, + int xh, int yh, + int mask = 0); + +/* This routine must be called after defwPinPort. + * This is a 5.7 syntax. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called multiple times within a pin. */ +extern int defwPinPortPolygon(const char* layerName, + int spacing, /* optional(0) - SPACING & DESIGNRULEWIDTH */ + int designRuleWidth, /* are mutually exclusive */ + int num_polys, double* xl, double* yl, + int mask = 0); + +/* This routine must be called after defwPinPort. + * This is a 5.7 syntax. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called multiple times within a pin. */ +extern int defwPinPortVia(const char* viaName, int xl, int yl, int mask = 0); + +/* This routine must be called after defwPinPort. + * This is a 5.7 syntax. + * This routine is optional. + * Returns 0 if successful. + * The routine can be called many times. + * NOTE: Use defwPinLayer to write out layer with SPACING or DESIGNRULEWIDTH */ +extern int defwPinPortLocation( + const char* status, /* FIXED | PLACED | COVER */ + int statusX, int statusY, /* status point */ + const char* orient); + +/* This routine must be called after defwPin. + * Returns 0 if successful. + * This is a 5.6 syntax. + * The routine can be called only once per pin. */ +extern int defwPinNetExpr(const char* pinExpr); + +/* This routine must be called after defwPin. + * Returns 0 if successful. + * This is a 5.6 syntax. + * The routine can be called only once per pin. */ +extern int defwPinSupplySensitivity(const char* pinName); + +/* This routine must be called after defwPin. + * Returns 0 if successful. + * This is a 5.6 syntax. + * The routine can be called only once per pin. */ +extern int defwPinGroundSensitivity(const char* pinName); + +/* This routine must be called after defwPin. + * Returns 0 if successful. + * This is a 5.4 syntax. + * The routine can be called multiple times. */ +extern int defwPinAntennaPinPartialMetalArea(int value, + const char* layerName); /* optional(NULL) */ + +/* This routine must be called after defwPin. + * Returns 0 if successful. + * This is a 5.4 syntax. + * The routine can be called multiple times. */ +extern int defwPinAntennaPinPartialMetalSideArea(int value, + const char* layerName); /* optional(NULL) */ + +/* This routine must be called after defwPin. + * Returns 0 if successful. + * This is a 5.4 syntax. + * The routine can be called multiple times. */ +extern int defwPinAntennaPinPartialCutArea(int value, + const char* layerName); /* optional(NULL) */ + +/* This routine must be called after defwPin. + * Returns 0 if successful. + * This is a 5.4 syntax. + * The routine can be called multiple times. */ +extern int defwPinAntennaPinDiffArea(int value, + const char* layerName); /* optional(NULL) */ + +/* This routine must be called after defwPin. + * Returns 0 if successful. + * This is a 5.5 syntax. + * The oxide can be either OXIDE1, OXIDE2, OXIDE3, or OXIDE4. + * Each oxide value can be called only once after defwPin. */ +extern int defwPinAntennaModel(const char* oxide); + +/* This routine must be called after defwPin. + * Returns 0 if successful. + * This is a 5.4 syntax. + * The routine can be called multiple times. */ +extern int defwPinAntennaPinGateArea(int value, + const char* layerName); /* optional(NULL) */ + +/* This routine must be called after defwPin. + * Returns 0 if successful. + * This is a 5.4 syntax. + * The routine can be called multiple times. */ +extern int defwPinAntennaPinMaxAreaCar(int value, + const char* layerName); /* optional(NULL) */ + +/* This routine must be called after defwPin. + * Returns 0 if successful. + * This is a 5.4 syntax. + * The routine can be called multiple times. */ +extern int defwPinAntennaPinMaxSideAreaCar(int value, + const char* layerName); /* optional(NULL) */ + +/* This routine must be called after defwPin. + * Returns 0 if successful. + * This is a 5.4 syntax. + * The routine can be called multiple times. */ +extern int defwPinAntennaPinMaxCutCar(int value, + const char* layerName); /* optional(NULL) */ + +/* This routine must be called after the defwPin calls. + * Returns 0 if successful. + * If the count in StartPins is not the same as the number of + * calls to Pin then DEFW_BAD_DATA will return returned. + * The routine can be called only once. */ +extern int defwEndPins( void ); + +/* This routine must be called after the pin section (if any). + * This section of routines is optional. + * Returns 0 if successful. + * The routine starts the pinproperties section. All of the pinproperties + * must follow. + * The count is the number of defwPinProp calls to follow. + * The routine can be called only once. */ +extern int defwStartPinProperties( int count ); + +/* This routine enter each pinproperty into the file. + * This routine must be called after the defwStartPinProperties call. + * The optional fields will be ignored if they are set to zero. + * Returns 0 if successful. + * The routine can be called many times. */ +extern int defwPinProperty(const char* name, /* compName | PIN */ + const char* pinName); /* pinName */ + +/* This routine must be called after the defwPinProperty calls. + * Returns 0 if successful. + * If the count in StartPins is not the same as the number of + * calls to Pin then DEFW_BAD_DATA will return returned. + * The routine can be called only once. */ +extern int defwEndPinProperties( void ); + +/* Routines to enter a special net or nets into the file. + * You must first call defwStartSpecialNets with the number of + * nets. This section is required, even if you do not have any nets. + * For each net you should call defwSpecialNet followed by + * one or more defwSpecialNetConnection calls. + * After the connections come the options. Options are + * NOT required. + * Each net is completed by calling defwSpecialNetEndOneNet(). + * The nets section is finished by calling defwEndNets(). */ +extern int defwStartSpecialNets(int count); + +/* This routine must be called after the defwStartSpecialNets it is for + * - netName */ +extern int defwSpecialNet(const char* name); /* netName */ + +/* This routine is for compNameRegExpr, pinName, and SYNTHESIZED */ +/* It can be called multiple times */ +extern int defwSpecialNetConnection(const char* inst, /* compNameRegExpr */ + const char* pin, /* pinName */ + int synthesized); /* 0 - ignore, 1 - SYNTHESIZED */ + +/* This routine is for + FIXEDBUMP + * This is a 5.4.1 syntax */ +extern int defwSpecialNetFixedbump(); + +/* This routine is for + VOLTAGE volts */ +extern int defwSpecialNetVoltage(double v); + +/* This routine is for + SPACING layerName spacing [RANGE minwidth maxwidth */ +extern int defwSpecialNetSpacing(const char* layer, /* layerName */ + int spacing, /* spacing */ + double minwidth, /* optional(0) - minwidth */ + double maxwidth); /* optional(0) - maxwidth */ + +/* This routine is for + WIDTH layerName width */ +extern int defwSpecialNetWidth(const char* layer, /* layerName */ + int width); /* width */ + +/* This routine is for + SOURCE {NETLIST | DIST | USER | TIMING} */ +extern int defwSpecialNetSource(const char* name); + +/* This routine is for + ORIGINAL netName */ +extern int defwSpecialNetOriginal(const char* name); /* netName */ + +/* This routine is for + PATTERN {STEINER | BALANCED | WIREDLOGIC | TRUNK} */ +extern int defwSpecialNetPattern(const char* name); + +/* This routine is for + USE {SIGNAL | POWER | GROUND | CLOCK | TIEOFF | + ANALOG | SCAN | RESET} */ +extern int defwSpecialNetUse(const char* name); + +/* This routine is for + WEIGHT weight */ +extern int defwSpecialNetWeight(double value); + +/* This routine is for + ESTCAP wireCapacitance */ +extern int defwSpecialNetEstCap(double value); + +/* Paths are a special type of option. A path must begin + * with a defwSpecialNetPathStart and end with a defwSpecialNetPathEnd(). + * The individual parts of the path can be entered in + * any order. */ +extern int defwSpecialNetPathStart(const char* typ); // ROUTED | FIXED | COVER | + // SHIELD | NEW +extern int defwSpecialNetShieldNetName(const char* name); /* shieldNetName */ + +extern int defwSpecialNetPathLayer(const char* name); /* layerName */ + +extern int defwSpecialNetPathWidth(int width); + +/* This routine is optional. + * This is a 5.6 syntax. */ +extern int defwSpecialNetPathStyle(int styleNum); + +extern int defwSpecialNetPathShape(const char* shapeType); // RING | STRIPE | + // FOLLOWPIN | IOWIRE | COREWIRE | BLOCKWIRE | FILLWIRE | BLOCKAGEWIRE + + +/* This routine is optional. + This is a 5.8 syntax. + * Returns 0 if successful. */ +extern int defwSpecialNetPathMask(int colorMask); + +/* x and y location of the path */ +extern int defwSpecialNetPathPoint(int numPts, /* number of connected points */ + double* pointx, /* point x list */ + double* pointy); /* point y list */ +extern int defwSpecialNetPathVia(const char* name); /* viaName */ + +/* This routine is called after defwSpecialNetPath + * This is a 5.4.1 syntax */ +extern int defwSpecialNetPathViaData(int numX, int numY, int stepX, int stepY); + +/* x and y location of the path */ +extern int defwSpecialNetPathPointWithWireExt( + int numPts, /* number of connected points */ + double* pointx, /* point x list */ + double* pointy, /* point y list */ + double* optValue); /* optional(NULL) value */ + +extern int defwSpecialNetPathEnd(); + +/* This is a 5.6 syntax + * This routine can be called multiple times. */ +extern int defwSpecialNetPolygon(const char* layerName, + int num_polys, double* xl, double* yl); + +/* This is a 5.6 syntax + * This routine can be called multiple times. */ +extern int defwSpecialNetRect(const char* layerName, + int xl, int yl, int xh, int yh); + +extern int defwSpecialNetVia(const char* layerName); + +extern int defwSpecialNetViaWithOrient(const char* layerName, int orient); + +extern int defwSpecialNetViaPoints(int num_points, double* xl, double* yl); + +/* This routine is called at the end of each net */ +extern int defwSpecialNetEndOneNet(); + +/* 5.3 for special net */ +/* Shields are a special type of option. A shield must begin + * with a defwSpecialNetShieldStart and end with a defwSpecialNetShieldEnd(). + * The individual parts of the shield can be entered in + * any order. */ +extern int defwSpecialNetShieldStart(const char* name); + +extern int defwSpecialNetShieldLayer(const char* name); /* layerName */ +extern int defwSpecialNetShieldWidth(int width); /* width */ +extern int defwSpecialNetShieldShape(const char* shapeType); // RING | STRIPE | + // FOLLOWPIN | IOWIRE | COREWIRE | BLOCKWIRE | FILLWIRE | BLOCKAGEWIRE + +/* x and y location of the path */ +extern int defwSpecialNetShieldPoint(int numPts, /* # of connected points */ + double* pointx, /* point x list */ + double* pointy); /* point y list */ +extern int defwSpecialNetShieldVia(const char* name); /* viaName */ + +/* A 5.4.1 syntax */ +extern int defwSpecialNetShieldViaData(int numX, int numY, int stepX, int stepY); +extern int defwSpecialNetShieldEnd(); +/* end 5.3 */ + +/* This routine is called at the end of the special net section */ +extern int defwEndSpecialNets(); + +/* Routines to enter a net or nets into the file. + * You must first call defwNets with the number of nets. + * This section is required, even if you do not have any nets. + * For each net you should call defwNet followed by one or + * more defwNetConnection calls. + * After the connections come the options. Options are + * NOT required. + * Each net is completed by calling defwNetEndOneNet(). + * The nets section is finished by calling defwEndNets(). */ +extern int defwStartNets(int count); + +/* This routine must be called after the defwStartNets, it is for - netName */ +extern int defwNet(const char* name); + +/* This routine is for { compName | PIN } pinName [+ SYNTHESIZED] */ +/* It can be called multiple times */ +extern int defwNetConnection(const char* inst, /* compName */ + const char* pin, /* pinName */ + int synthesized); /* 0 - ignore, 1 - SYNTHESIZED */ + +/* This routine is for MUSTJOIN, compName, pinName */ +extern int defwNetMustjoinConnection(const char* inst, /* compName */ + const char* pin); /* pinName */ + +/* This routine is for + VPIN vpinName [LAYER layerName pt pt + * [{ PLACED | FIXED | COVER } pt orient] */ +extern int defwNetVpin(const char* vpinName, + const char* layerName, /* optional(NULL) */ + int layerXl, int layerYl, /* layer point1 */ + int layerXh, int layerYh, /* layer point2 */ + const char* status, /* optional(NULL) */ + int statusX, int statusY, /* optional(0) - status point */ + int orient); /* optional(-1) */ + +/* This routine is for + VPIN vpinName [LAYER layerName pt pt + * [{ PLACED | FIXED | COVER } pt orient] + * This routine is the same as defwNetVpin, except orient is a char* */ +extern int defwNetVpinStr(const char* vpinName, + const char* layerName, /* optional(NULL) */ + int layerXl, int layerYl, /* layer point1 */ + int layerXh, int layerYh, /* layer point2 */ + const char* status, /* optional(NULL) */ + int statusX, int statusY, /* optional(0) - status point */ + const char* orient); /* optional(NULL) */ + +/* This routine can be called either within net or subnet. + * it is for NONDEFAULTRULE rulename */ +extern int defwNetNondefaultRule(const char* name); + +/* This routine is for + XTALK num */ +extern int defwNetXtalk(int xtalk); + +/* This routine is for + FIXEDBUMP + * This is a 5.4.1 syntax */ +extern int defwNetFixedbump(); + +/* This routine is for + FREQUENCY + * This is a 5.4.1 syntax */ +extern int defwNetFrequency(double frequency); + +/* This routine is for + SOURCE {NETLIST | DIST | USER | TEST | TIMING} */ +extern int defwNetSource(const char* name); + +/* This routine is for + ORIGINAL netname */ +extern int defwNetOriginal(const char* name); + +/* This routine is for + USE {SIGNAL | POWER | GROUND | CLOCK | TIEOFF | + * ANALOG} */ +extern int defwNetUse(const char* name); + +/* This routine is for + PATTERN {STEINER | BALANCED | WIREDLOGIC} */ +extern int defwNetPattern(const char* name); + +/* This routine is for + ESTCAP wireCapacitance */ +extern int defwNetEstCap(double value); + +/* This routine is for + WEIGHT weight */ +extern int defwNetWeight(double value); + +/* 5.3 for net */ +/* This routine is for + SHIELDNET weight */ +extern int defwNetShieldnet(const char* name); + +/* Noshield are a special type of option. A noshield must begin + * with a defwNetNoshieldStart and end with a defwNetNoshieldEnd(). + * The individual parts of the noshield can be entered in + * any order. */ +extern int defwNetNoshieldStart(const char* name); + +/* x and y location of the path */ +extern int defwNetNoshieldPoint(int numPts, /* number of connected points */ + const char** pointx, /* point x list */ + const char** pointy); /* point y list */ +extern int defwNetNoshieldVia(const char* name); /* viaName */ +extern int defwNetNoshieldEnd(); +/* end 5.3 */ + +/* Subnet are a special type of option. A subnet must begin + * with a defwNetSubnetStart and end with a defwNetSubnetEnd(). + * Routines to call within the subnet are: defwNetSubnetPin, + * defwNetNondefaultRule and defwNetPathStart... */ +extern int defwNetSubnetStart(const char* name); + +/* This routine is called after the defwNetSubnet, it is for + * [({compName | PIN} pinName) | (VPIN vpinName)]... */ +extern int defwNetSubnetPin(const char* compName, /* compName | PIN | VPIN */ + const char* pinName); /* pinName | vpinName */ + +extern int defwNetSubnetEnd(); + +/* Paths are a special type of option. A path must begin + * with a defwNetPathStart and end with a defwPathEnd(). + * The individual parts of the path can be entered in + * any order. */ +extern int defwNetPathStart(const char* typ); // ROUTED | FIXED | COVER | + // NOSHIELD | NEW +extern int defwNetPathWidth(int w); /* width */ +extern int defwNetPathLayer(const char* name, /* layerName */ + int isTaper, /* 0 - ignore, 1 - TAPER */ + const char* rulename); /* only one, isTaper or */ + /*rulename can be assigned */ +/* This routine is optional. + * This is a 5.6 syntax. */ +extern int defwNetPathStyle(int styleNum); + +/* This routine is optional. + * This is a 5.8 syntax. */ +extern int defwNetPathMask(int maskNum); + +extern int defwNetPathRect(int deltaX1, int deltaY1, int deltaX2, int deltaY2); + +extern int defwNetPathVirtual(int x, int y); + +/* x and y location of the path */ +extern int defwNetPathPoint(int numPts, /* number of connected points */ + double* pointx, /* point x list */ + double* pointy); /* point y list */ + +extern int defwNetPathPointWithExt(int numPts, + double* pointx, + double* pointy, + double* optValue); + +extern int defwNetPathVia(const char* name); /* viaName */ + +extern int defwNetPathViaWithOrient(const char* name, + int orient); /* optional(-1) */ + +extern int defwNetPathViaWithOrientStr(const char* name, + const char* orient); /* optional(Null) */ +extern int defwNetPathEnd(); + +/* This routine is called at the end of each net */ +extern int defwNetEndOneNet(); + +/* This routine is called at the end of the net section */ +extern int defwEndNets(); + +/* This section of routines is optional. + * Returns 0 if successful. + * The routine starts the I/O Timing section. All of the iotimings options + * must follow. + * The count is the number of defwIOTiming calls to follow. + * The routine can be called only once. + * This api is obsolete in 5.4. */ +extern int defwStartIOTimings(int count); + +/* This routine can be called after defwStaratIOTiming + * It is for - - {(comp pin) | (PIN name)} + * This api is obsolete in 5.4. */ +extern int defwIOTiming(const char* inst, /* compName | PIN */ + const char* pin); /* pinName */ + +/* This routine is for + { RISE | FALL } VARIABLE min max + * This api is obsolete in 5.4. */ +extern int defwIOTimingVariable(const char* riseFall, /* RISE | FALL */ + int num1, /* min */ + int num2); /* max */ + +/* This routine is for + { RISE | FALL } SLEWRATE min max + * This api is obsolete in 5.4. */ +extern int defwIOTimingSlewrate(const char* riseFall, /* RISE | FALL */ + int num1, /* min */ + int num2); /* max */ + +/* This routine is for + DRIVECELL macroName [[FROMPIN pinName] TOPIN pinName] + * [PARALLEL numDrivers] + * This api is obsolete in 5.4. */ +extern int defwIOTimingDrivecell(const char* name, /* macroName*/ + const char* fromPin, /* optional(NULL) */ + const char* toPin, /* optional(NULL) */ + int numDrivers); /* optional(0) */ + +/* This routine is for + CAPACITANCE capacitance + * This api is obsolete in 5.4. */ +extern int defwIOTimingCapacitance(double num); + +/* This api is obsolete in 5.4. */ +extern int defwEndIOTimings(); + +/* Routines to enter scan chains. This section is optional + * The section must start with a defwStartScanchains() call and + * end with a defwEndScanchain() call. + * Each scan chain begins with a defwScanchain() call. + * The rest of the calls follow. */ +extern int defwStartScanchains(int count); + +/* This routine can be called after defwStartScanchains + * It is for - chainName */ +extern int defwScanchain(const char* name); + +/* This routine is for + COMMONSCANPINS [IN pin] [OUT pin] */ +extern int defwScanchainCommonscanpins( + const char* inst1, /* optional(NULL) - IN | OUT*/ + const char* pin1, /* can't be null if inst1 is set */ + const char* inst2, /* optional(NULL) - IN | OUT */ + const char* pin2); /* can't be null if inst2 is set */ + + +/* This routine is for + PARTITION paratitionName [MAXBITS maxBits] */ +/* This is 5.4.1 syntax */ +extern int defwScanchainPartition(const char* name, + int maxBits); /* optional(-1) */ + +/* This routine is for + START {fixedInComp | PIN } [outPin] */ +extern int defwScanchainStart(const char* inst, /* fixedInComp | PIN */ + const char* pin); /* outPin */ + +/* This routine is for + STOP {fixedOutComp | PIN } [inPin] */ +extern int defwScanchainStop(const char* inst, /* fixedOutComp | PIN */ + const char* pin); /* inPin */ + +/* This routine is for + FLOATING {floatingComp [IN pin] [OUT pin]} + * This is a 5.4.1 syntax */ +extern int defwScanchainFloating(const char* name, /* floatingComp */ + const char* inst1, /* optional(NULL) - IN | OUT */ + const char* pin1, /* can't be null if inst1 is set */ + const char* inst2, /* optional(NULL) - IN | OUT */ + const char* pin2); /* can't be null if inst2 is set */ + +/* This routine is for + FLOATING {floatingComp [IN pin] [OUT pin]} + * This is a 5.4.1 syntax. + * This routine is the same as defwScanchainFloating. But also added + * the option BITS. */ +extern int defwScanchainFloatingBits(const char* name, /* floatingComp */ + const char* inst1, /* optional(NULL) - IN | OUT */ + const char* pin1, /* can't be null if inst1 is set */ + const char* inst2, /* optional(NULL) - IN | OUT */ + const char* pin2, /* can't be null if inst2 is set */ + int bits); /* optional (-1) */ + +/* This routine is for + ORDERED {fixedComp [IN pin] [OUT pin] + * fixedComp [IN pin] [OUT pin]. + * When this routine is called for the 1st time within a scanchain, + * both name1 and name2 are required. Only name1 is required is the + * routine is called more than once. */ +extern int defwScanchainOrdered(const char* name1, + const char* inst1, /* optional(NULL) - IN | OUT */ + const char* pin1, /* can't be null if inst1 is set */ + const char* inst2, /* optional(NULL) - IN | OUT */ + const char* pin2, /* can't be null if inst2 is set */ + const char* name2, + const char* inst3, /* optional(NULL) - IN | OUT */ + const char* pin3, /* can't be null if inst3 is set */ + const char* inst4, /* optional(NULL) - IN | OUT */ + const char* pin4); /* can't be null if inst4 is set */ + +/* This routine is for + ORDERED {fixedComp [IN pin] [OUT pin] + * fixedComp [IN pin] [OUT pin]. + * When this routine is called for the 1st time within a scanchain, + * both name1 and name2 are required. Only name1 is required is the + * routine is called more than once. + * This is a 5.4.1 syntax. + * This routine is the same as defwScanchainOrdered. But also added + * the option BITS */ +extern int defwScanchainOrderedBits(const char* name1, + const char* inst1, /* optional(NULL) - IN | OUT */ + const char* pin1, /* can't be null if inst1 is set */ + const char* inst2, /* optional(NULL) - IN | OUT */ + const char* pin2, /* can't be null if inst2 is set */ + int bits1, /* optional(-1) */ + const char* name2, + const char* inst3, /* optional(NULL) - IN | OUT */ + const char* pin3, /* can't be null if inst3 is set */ + const char* inst4, /* optional(NULL) - IN | OUT */ + const char* pin4, /* can't be null if inst4 is set */ + int bits2); /* optional(-1) */ + +extern int defwEndScanchain(); + +/* Routines to enter constraints. This section is optional + * The section must start with a defwStartConstrains() call and + * end with a defwEndConstraints() call. + * Each contraint will call the defwConstraint...(). + * This api is obsolete in 5.4. */ +extern int defwStartConstraints (int count); /* optional */ + +/* The following routines are for - {operand [+ RISEMAX time] [+ FALLMAX time] + * [+ RISEMIN time] [+ FALLMIN time] | WIREDLOGIC netName MAXDIST distance };} + * operand - NET netName | PATH comp fromPin comp toPin | SUM (operand, ...) + * The following apis are obsolete in 5.4. */ +extern int defwConstraintOperand(); /* begin an operand */ +extern int defwConstraintOperandNet(const char* netName); /* NET */ +extern int defwConstraintOperandPath(const char* comp1, /* PATH - comp|PIN */ + const char* fromPin, + const char* comp2, + const char* toPin); +extern int defwConstraintOperandSum(); /* SUM */ +extern int defwConstraintOperandSumEnd(); /* mark the end of SUM */ +extern int defwConstraintOperandTime(const char* timeType, // RISEMAX | FALLMAX | RISEMIN | FALLMIN + int time); +extern int defwConstraintOperandEnd(); /* mark the end of operand */ + +/* This routine is for - WIRELOGIC netName MAXDIST distance */ +extern int defwConstraintWiredlogic(const char* netName, + int distance); + +extern int defwEndConstraints (); + +/* Routines to enter groups. This section is optional + * The section must start with a defwStartGroups() call and + * end with a defwEndGroups() call. + * Each group will call the defwGroup...(). */ +extern int defwStartGroups (int count); /* optional */ + +/* This routine is for - groupName compNameRegExpr ... */ +extern int defwGroup(const char* groupName, + int numExpr, + const char** groupExpr); + +/* This routine is for + SOFT [MAXHALFPERIMETER value] [MAXX value] + * [MAXY value] */ +extern int defwGroupSoft(const char* type1, /* MAXHALFPERIMETER | MAXX | MAXY */ + double value1, + const char* type2, + double value2, + const char* type3, + double value3); + +/* This routine is for + REGION {pt pt | regionName} */ +extern int defwGroupRegion(int xl, int yl, /* either the x & y or */ + int xh, int yh, /* regionName only, can't */ + const char* regionName); /* be both */ + +extern int defwEndGroups(); + +/* Routines to enter Blockages. This section is optional + * The section must start with a defwStartBlockages() call and + * end with a defwEndBlockages() call. + * Each blockage will call the defwBlockages...(). + * This is a 5.4 syntax. */ +extern int defwStartBlockages(int count); /* count = numBlockages */ + +/* This routine is for - layerName +* This routine is called per entry within a blockage for layer. +* This is a 5.4 syntax. */ +extern int defwBlockagesLayer(const char* layerName); + +/* This routine is for - slots +* This routine is called per entry within a blockage layer, can't be more then one. +* This is a 5.4 syntax. */ +extern int defwBlockagesLayerSlots(); + +/* This routine is for - fills +* This routine is called per entry within a blockage layer, can't be more then one. +* This is a 5.4 syntax. */ +extern int defwBlockagesLayerFills(); + +/* This routine is for - pushdown +* This routine is called per entry within a blockage layer, can't be more then one. +* This is a 5.4 syntax. */ +extern int defwBlockagesLayerPushdown(); + +/* This routine is for - exceptpgnet +* This routine is called per entry within a blockage layer, can't be more then one. +* This is a 5.7 syntax. */ +extern int defwBlockagesLayerExceptpgnet(); + +/* This routine is for - component +* This routine called per entry within a blockage layer, can't be more than one. +* This is a 5.6 syntax. */ +extern int defwBlockagesLayerComponent(const char* compName); + +/* This routine is for - spacing +* Either this routine or defwBlockagesDesignRuleWidth is called per entry +* within a blockage layer, can't be more than one. +* This is a 5.6 syntax. */ +extern int defwBlockagesLayerSpacing(int minSpacing); + +/* This routine is for - designrulewidth +* Either this routine or defwBlockagesSpacing is called per entry +* within a blockage layer, can't be more than one. +* This is a 5.6 syntax. */ +extern int defwBlockagesLayerDesignRuleWidth(int effectiveWidth); + +/* This routine is for - mask. +* This routine called per entry within a blockage layer, can't be more than one. +* This is a 5.8 syntax. */ +extern int defwBlockagesLayerMask(int maskColor); + +/* This routine is for - layerName & compName + * Either this routine, defBlockageLayerSlots, defBlockageLayerFills, + * or defwBlockagePlacement is called per entry within + * a blockage, can't be more then one. + * This is a 5.4 syntax. */ +extern int defwBlockageLayer(const char* layerName, + const char* compName); /* optional(NULL) */ + +/* This routine is for - layerName & slots + * Either this routine, defBlockageLayer, defBlockageLayerFills, + * defwBlockagePlacement, or defwBlockagePushdown is called per entry within + * a blockage, can't be more then one. + * This is a 5.4 syntax. */ +extern int defwBlockageLayerSlots(const char* layerName); + +/* This routine is for - layerName & fills + * Either this routine, defBlockageLayer, defBlockageLayerSlots, + * defwBlockagePlacement, or defwBlockagePushdown is called per entry within + * a blockage, can't be more then one. + * This is a 5.4 syntax. */ +extern int defwBlockageLayerFills(const char* layerName); + +/* This routine is for - layerName & pushdown + * Either this routine, defBlockageLayer, defBlockageLayerSlots, + * defwBlockagePlacement, or defwBlockageFills is called per entry within + * a blockage, can't be more then one. + * This is a 5.4 syntax. */ +extern int defwBlockageLayerPushdown(const char* layerName); + +/* This routine is for - exceptpgnet + * Either this routine, defBlockageLayer, defBlockageLayerSlots, + * defwBlockagePlacement, or defwBlockageFills is called per entry within + * a blockage, can't be more then one. + * This is a 5.7 syntax. */ +extern int defwBlockageLayerExceptpgnet(const char* layerName); + +/* This routine is for - spacing + * Either this routine or defwBlockageDesignRuleWidth is called per entry + * within a blockage, can't be more than one. + * This is a 5.6 syntax. */ +extern int defwBlockageSpacing(int minSpacing); + +/* This routine is for - designrulewidth + * Either this routine or defwBlockageSpacing is called per entry + * within a blockage, can't be more than one. + * This is a 5.6 syntax. */ +extern int defwBlockageDesignRuleWidth(int effectiveWidth); + +/* This routine is for - placement + * This routine is called per entry within blockage for placement. + * This is a 5.4 syntax. + * 11/25/2002 - bug fix: submitted by Craig Files (cfiles@ftc.agilent.com) + * this routine allows to call blockage without a component. */ +extern int defwBlockagesPlacement(); + +/* This routine is for - component +* This routine is called per entry within blockage placement, can't be more then one. +* This is a 5.4 syntax. */ +extern int defwBlockagesPlacementComponent(const char* compName); + +/* This routine is for - Pushdown +* This routine is called per entry within blockage placement, can't be more then one. +* This is a 5.4 syntax. */ +extern int defwBlockagesPlacementPushdown(); + +/* This routine is for - soft +* Either this routine or defwBlockagesPlacementPartial +* is called per entry within blockage placement, can't be more then one. +* This is a 5.7 syntax. */ +extern int defwBlockagesPlacementSoft(); + +/* This routine is for - Partial +* Either this routine or defwBlockagesPlacementSoft +* is called per entry within blockage placement, can't be more then one. +* This is a 5.7 syntax. */ +extern int defwBlockagesPlacementPartial(double maxDensity); + +/* This routine is for rectangle. +* This routine is optional and can be called multiple time. +* This is a 5.4 syntax. */ +extern int defwBlockagesRect(int xl, int yl, int xh, int yh); + +/* This routine is for polygon. +* This routine is optional and can be called multiple time. +* This is a 5.6 syntax. */ +extern int defwBlockagesPolygon(int num_polys, int* xl, int* yl); + +/* This routine is for - placement +* Either this routine or defBlockageLayer +* is called per entry within blockage, can't be more then one. +* This is a 5.4 syntax. +* 11/25/2002 - bug fix: submitted by Craig Files (cfiles@ftc.agilent.com) +* this routine allows to call blockage without a component. */ +extern int defwBlockagePlacement(); + +/* This routine is for - placement & component + * Either this routine or defwBlockagePlacementPushdown + * is called per entry within blockage, can't be more then one. + * This is a 5.4 syntax. */ +extern int defwBlockagePlacementComponent(const char* compName); + +/* This routine is for - placement & Pushdown + * Either this routine or defwBlockagePlacementComponent + * is called per entry within blockage, can't be more then one. + * This is a 5.4 syntax. */ +extern int defwBlockagePlacementPushdown(); + +/* This routine is for - placement & soft + * Either this routine or defwBlockagePlacementPushdown + * is called per entry within blockage, can't be more then one. + * This is a 5.7 syntax. */ +extern int defwBlockagePlacementSoft(); + +/* This routine is for - placement & Partial + * Either this routine or defwBlockagePlacementComponent + * is called per entry within blockage, can't be more then one. + * This is a 5.7 syntax. */ +extern int defwBlockagePlacementPartial(double maxDensity); + +/* This routine is optional. + * This is a 5.8 syntax. */ +extern int defwBlockageMask(int maskColor); + +/* This routine is for rectangle. + * This is a 5.4 syntax. */ +extern int defwBlockageRect(int xl, int yl, int xh, int yh); + +/* This routine is for polygon. + * This routine is optinal and can be called multiple time. + * This is a 5.6 syntax. */ +extern int defwBlockagePolygon(int num_polys, int* xl, int* yl); + +/* This is a 5.4 syntax. */ +extern int defwEndBlockages(); + +/* Routines to enter Slots. This section is optional + * The section must start with a defwStartSlots() call and + * end with a defwEndSlots() call. + * Each slots will call the defwSlots...(). + * This is a 5.4 syntax. */ +extern int defwStartSlots(int count); /* count = numSlots */ + +/* This routine is for - layerName & compName + * Either this routine, defSlots, defSlotsLayerFills, + * or defwSlotsPlacement is called per entry within + * a slot, can't be more then one. + * This is a 5.4 syntax. */ +extern int defwSlotLayer(const char* layerName); + +/* This routine is for rectangle + * This is a 5.4 syntax. */ +extern int defwSlotRect(int xl, int yl, int xh, int yh); + +/* This routine is for rectangle + * This is a 5.6 syntax and can be called multiple time. */ +extern int defwSlotPolygon(int num_polys, double* xl, double* yl); + +/* This is a 5.4 syntax. */ +extern int defwEndSlots(); + +/* Routines to enter Fills. This section is optional + * The section must start with a defwStartFills() call and + * end with a defwEndFills() call. + * Each fills will call the defwFills...(). + * This is a 5.4 syntax. */ +extern int defwStartFills(int count); /* count = numFills */ + +/* This routine is for - layerName & compName + * Either this routine, defFills, defFillsLayerFills, + * or defwFillsPlacement is called per entry within + * a fill, can't be more then one. + * This is a 5.4 syntax. */ +extern int defwFillLayer(const char* layerName); + +/* This routine is optional. + * This is a 5.8 syntax. */ +extern int defwFillLayerMask(int maskColor); + +/* This routine has to be called after defwFillLayer + * This routine is optional. + * This is a 5.7 syntax. */ +extern int defwFillLayerOPC(); + +/* This routine is for rectangle. + * This is a 5.4 syntax. */ +extern int defwFillRect(int xl, int yl, int xh, int yh); + +/* This routine is for polygon. + * This is a 5.6 syntax and can be called multiple time. */ +extern int defwFillPolygon(int num_polys, double* xl, double* yl); + +/* This routine is for via. + * This routine is optional. + * This is a 5.7 syntax and can be called multiple time. */ +extern int defwFillVia(const char* viaName); + +/* This routine is optional. + * This is a 5.8 syntax. */ +extern int defwFillViaMask(int colorMask); + +/* This routine is for via OPC. + * This routine can only be called after defwFillVia. + * This routine is optional. + * This is a 5.7 syntax and can be called multiple time. */ +extern int defwFillViaOPC(); + +/* This routine is for via OPC. + * This routine can only be called after defwFillVia. + * This routine is required following defwFillVia. + * This is a 5.7 syntax and can be called multiple time. */ +extern int defwFillPoints(int num_points, double* xl, double* yl); + +/* This is a 5.4 syntax. */ +extern int defwEndFills(); + +/* Routines to enter NONDEFAULTRULES. This section is required + * The section must start with a defwStartNonDefaultRules() and + * end with defwEndNonDefaultRules() call. + * This is a 5.6 syntax. */ +extern int defwStartNonDefaultRules(int count); + +/* This routine is for Layer within the NONDEFAULTRULES + * This routine can be called multiple times. It is required. + * This is a 5.6 syntax. + * Returns 0 if successful. */ +extern int defwNonDefaultRule(const char* ruleName, + int hardSpacing); /* optional(0) */ + +/* Routines to enter NONDEFAULTRULES. This section is required + * This routine must be called after the defwNonDefaultRule. + * This routine can be called multiple times. + * This is a 5.6 syntax. + * Returns 0 if successful. */ +extern int defwNonDefaultRuleLayer(const char* layerName, + int width, + int diagWidth, /* optional(0) */ + int spacing, /* optional(0) */ + int wireExt); /* optional(0) */ + +/* Routines to enter NONDEFAULTRULES. This section is optional. + * This routine must be called after the defwNonDefaultRule. + * This routine can be called multiple times. + * This is a 5.6 syntax. + * Returns 0 if successful. */ +extern int defwNonDefaultRuleVia(const char* viaName); + +/* Routines to enter NONDEFAULTRULES. This section is optional. + * This routine must be called after the defwNonDefaultRule. + * This routine can be called multiple times. + * This is a 5.6 syntax. + * Returns 0 if successful. */ +extern int defwNonDefaultRuleViaRule(const char* viaRuleName); + +/* Routines to enter NONDEFAULTRULES. This section is optional. + * This routine must be called after the defwNonDefaultRule. + * This routine can be called multiple times. + * This is a 5.6 syntax. + * Returns 0 if successful. */ +extern int defwNonDefaultRuleMinCuts(const char* cutLayerName, int numCutS); + +/* This is a 5.4 syntax. */ +extern int defwEndNonDefaultRules(); + +/* Routines to enter STYLES. This section is required + * The section must start with a defwStartStyles() and + * end with defwEndStyles() call. + * This is a 5.6 syntax. */ +extern int defwStartStyles(int count); + +/* This routine is for Layer within the NONDEFAULTRULES + * This routine can be called multiple times. It is required. + * This is a 5.6 syntax. + * Returns 0 if successful. */ +extern int defwStyles(int styleNums, int num_points, double* xp, double* yp); + +/* This is a 5.4 syntax. */ +extern int defwEndStyles(); + +/* This routine is called after defwInit. + * This routine is optional and it can be called only once. + * Returns 0 if successful. */ +extern int defwStartBeginext(const char* name); + +/* This routine is called after defwBeginext. + * This routine is optional, it can be called only once. + * Returns 0 if successful. */ +extern int defwBeginextCreator (const char* creatorName); + +/* This routine is called after defwBeginext. + * This routine is optional, it can be called only once. + * It gets the current system time and date. + * Returns 0 if successful. */ +extern int defwBeginextDate (); + +/* This routine is called after defwBeginext. + * This routine is optional, it can be called only once. + * Returns 0 if successful. */ +extern int defwBeginextRevision (int vers1, int vers2); /* vers1.vers2 */ + +/* This routine is called after defwBeginext. + * This routine is optional, it can be called many times. + * It allows user to customize their own syntax. + * Returns 0 if successful. */ +extern int defwBeginextSyntax (const char* title, const char* string); + +/* This routine is called after defwInit. + * This routine is optional and it can be called only once. + * Returns 0 if successful. */ +extern int defwEndBeginext(); + +/* End the DEF file. + * This routine IS NOT OPTIONAL. + * The routine must be called LAST. */ +extern int defwEnd ( void ); + +/* General routines that can be called anytime after the Init is called. + */ +extern int defwCurrentLineNumber ( void ); + +/* + * extern void defwError ( const char *, ... ); + * extern void defwWarning ( const char *, ... ); + * extern void defwVError ( const char *, va_list ); + * extern void defwVWarning ( const char *, va_list ); + * extern int defwGetCurrentLineNumber (void); + * extern const char *defwGetCurrentFileName (void); + */ + +/* This routine will print the error message. */ +extern void defwPrintError(int status); + +/* This routine will allow user to write their own comemnt. It will + * automactically add a # infront of the line. + */ +extern void defwAddComment(const char* comment); + +/* This routine will indent 3 blank spaces */ +extern void defwAddIndent(); + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/defwWriterCalls.cpp b/src/def/def/defwWriterCalls.cpp new file mode 100644 index 00000000..386db620 --- /dev/null +++ b/src/def/def/defwWriterCalls.cpp @@ -0,0 +1,613 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + + +// This file contains code for implementing the defwriter 5.3 +// It has functions to set the user callback functions. If functions +// are set, the defwriter will call the user callback functions when +// it comes to the section. If the section is required, but user +// does not set any callback functions, a warning will be printed +// both on stderr and on the output file if there is one. +// Def writer provides default callback routines for some but not all +// required sections. +// Sections the writer provides default callbacks are: +// Version -- default to 5.3 +// NamesCaseSensitive -- default to OFF +// BusBitChars -- default to "[]" +// DividerChar -- default to "/"; // +// Author: Wanda da Rosa +// Date: 05/14/99 +// +// Revisions: + +#include "defwWriterCalls.hpp" +#include "defwWriter.hpp" +#include +#include +#include "lex.h" +#include "defiDebug.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +#define MAXCBS 33 + +#define defwVersionCbk 0 +#define defwCaseSensitiveCbk 1 +#define defwDividerCbk 2 +#define defwBusBitCbk 3 +#define defwDesignCbk 4 +#define defwTechCbk 5 +#define defwArrayCbk 6 +#define defwFloorPlanCbk 7 +#define defwUnitsCbk 8 +#define defwHistoryCbk 9 +#define defwPropDefCbk 10 +#define defwDieAreaCbk 11 +#define defwRowCbk 12 +#define defwTrackCbk 13 +#define defwGcellGridCbk 14 +#define defwDefaultCapCbk 15 +#define defwCanplaceCbk 16 +#define defwCannotOccupyCbk 17 +#define defwViaCbk 18 +#define defwRegionCbk 19 +#define defwComponentCbk 20 +#define defwPinCbk 21 +#define defwPinPropCbk 22 +#define defwSNetCbk 23 +#define defwNetCbk 24 +#define defwIOTimingCbk 25 +#define defwScanchainCbk 26 +#define defwConstraintCbk 27 +#define defwAssertionCbk 28 /* pre 5.2 */ +#define defwGroupCbk 29 +#define defwBlockageCbk 30 +#define defwExtCbk 31 +#define defwDesignEndCbk 32 + +/* NEW CALLBACK - then place it here. */ + +int defWRetVal; +extern int defwHasInit; +extern int defwHasInitCbk; + +DEFI_LOG_FUNCTION defwErrorLogFunction; +DEFI_WARNING_LOG_FUNCTION defwWarningLogFunction; + +#define WRITER_CALLBACK(func, type) \ + if ((defWRetVal = (*func)(type, defwUserData)) == 0) { \ + } else { \ + return defWRetVal; \ + } + +#define CHECK_DEF_STATUS(status) \ + if (status) { \ + defwPrintError(status); \ + return(status); \ + } + +//////////////////////////////////// +// +// Global variables +// +///////////////////////////////////// + +defiUserData defwUserData = 0; +static char* defwFileName = 0; +static int defwRegisterUnused = 0; + +extern FILE* defwFile; + +//////////////////////////////////// +// +// List of call back routines +// These are filled in by the user. See the +// "set" routines at the end of the file +// +///////////////////////////////////// +// The callback routines +defwVoidCbkFnType defwCallbacksSeq[MAXCBS] = {0, // defwVersionCbk + 0, // defwCaseSensitiveCbk + 0, // defwDividerCbk + 0, // defwBusBitCbk + 0, // defwDesignCbk + 0, // defwTechCbk + 0, // defwArrayCbk + 0, // defwFloorPlanCbk + 0, // defwUnitsCbk + 0, // defwHistoryCbk + 0, // defwPropDefCbk + 0, // defwDieAreaCbk + 0, // defwRowCbk + 0, // defwTrackCbk + 0, // defwGcellGridCbk + 0, // defwDefaultCapCbk + 0, // defwCanplaceCbk + 0, // defwCannotOccupyCbk + 0, // defwViaCbk + 0, // defwRegionCbk + 0, // defwComponentCbk + 0, // defwPinCbk + 0, // defwPinPropCbk + 0, // defwSNetCbk + 0, // defwNetCbk + 0, // defwIOTimingCbk + 0, // defwScanchainCbk + 0, // defwConstraintCbk + 0, // defwAssertionCbk pre 5.2 + 0, // defwGroupCbk + 0, // defwBlockageCbk 5.4 + 0, // defwExtCbk + 0, // defwDesignEndCbk + // Add NEW CALLBACK here + }; + +// the optional and required callbacks and +// if default routines are available +int defwCallbacksReq[MAXCBS][2] = {{0, 0}, // Version + {0, 0}, // CaseSensitive + {0, 0}, // Divider + {0, 0}, // BusBit + {1, 0}, // Design + {0, 0}, // Tech + {0, 0}, // Array + {0, 0}, // FloorPlan + {0, 0}, // Units + {0, 0}, // History + {0, 0}, // PropDef + {0, 0}, // DieArea + {0, 0}, // Row + {0, 0}, // Track + {0, 0}, // GcellGrid + {0, 0}, // DefaultCap + {0, 0}, // Canplace + {0, 0}, // CannotOccupy + {0, 0}, // Via + {0, 0}, // Region + {0, 0}, // Component + {0, 0}, // Pin + {0, 0}, // PinProp + {0, 0}, // SNet + {0, 0}, // Net + {0, 0}, // IOTiming + {0, 0}, // Scanchain + {0, 0}, // Constraint + {0, 0}, // Assertion pre 5.2 + {0, 0}, // Group + {0, 0}, // Blockage + {0, 0}, // Ext + {1, 0}, // DesignEnd + // Add NEW CALLBACK here + }; + +// The section names +char defwSectionNames[MAXCBS] [80] = {"Version", + "CaseSensitive", + "Divider", + "BusBit", + "Design", + "Tech", + "Array", + "FloorPlan", + "Units", + "History", + "PropertyDefinition", + "DieArea", + "Row", + "Track", + "GcellGrid", + "DefaultCap", + "Canplace", + "CannotOccupy", + "Via", + "Region", + "Component", + "Pin", + "PinProp", + "SpecialNet", + "Net", + "IOTiming", + "Scanchain", + "Constraint", + "Assertion", // pre 5.2 + "Group", + "Blockage", + "Extension", + "DesignEnd" + // Add NEW CALLBACK here + }; + +// the call back types from the defwCallbackType_e +defwCallbackType_e defwCallbacksType[MAXCBS] = {defwVersionCbkType, + defwCaseSensitiveCbkType, + defwDividerCbkType, + defwBusBitCbkType, + defwDesignCbkType, + defwTechCbkType, + defwArrayCbkType, + defwFloorPlanCbkType, + defwUnitsCbkType, + defwHistoryCbkType, + defwPropDefCbkType, + defwDieAreaCbkType, + defwRowCbkType, + defwTrackCbkType, + defwGcellGridCbkType, + defwDefaultCapCbkType, + defwCanplaceCbkType, + defwCannotOccupyCbkType, + defwViaCbkType, + defwRegionCbkType, + defwComponentCbkType, + defwPinCbkType, + defwPinPropCbkType, + defwSNetCbkType, + defwNetCbkType, + defwIOTimingCbkType, + defwScanchainCbkType, + defwConstraintCbkType, + defwAssertionCbkType, // pre 5.2 + defwGroupCbkType, + defwBlockageCbkType, // 5.4 + defwExtCbkType, + defwDesignEndCbkType + // Add NEW TYPES here + }; + + +//////////////////////////////////// +// +// Routines for the callbacks +// +///////////////////////////////////// +const char* defwFName() { + return defwFileName; +} + + +int defwWrite(FILE* f, const char* fName, defiUserData uData) { + int i; + + if (defwHasInit == 0 && defwHasInitCbk == 0) { + fprintf(stderr, "ERROR DEFWRIT-9010): The function defwWrite is called before the function defwInitCbk.\nYou need to call defwInitCbk before calling any other functions.\nUpdate your program and then try again."); + return -1; + } + + if (defwHasInit) { + fprintf(stderr, "ERROR DEFWRIT-9011): You program has called the function defwInit to initialize the writer.\nIf you want to use the callback option you need to use the function defwInitCbk."); + } + + defwFileName = (char*)fName; + defwFile = f; + defwUserData = uData; + + // Loop through the list of callbacks and call the user define + // callback routines if any are set + + for (i = 0; i < MAXCBS; i++) { + if (defwCallbacksSeq[i] != 0) { // user has set a callback function + WRITER_CALLBACK(defwCallbacksSeq[i], defwCallbacksType[i]); + } else if ((defwCallbacksReq[i][0]) && (defwCallbacksReq[i][1] == 0)) { + // it is required but user hasn't set up callback and there isn't a + // default routine + fprintf(f, + "# WARNING: Callback for %s is required, but is not defined\n\n", + defwSectionNames[i]); + fprintf(stderr, + "WARNING: Callback for %s is required, but is not defined\n\n", + defwSectionNames[i]); + } + } + return 0; +} + + +void defwSetUnusedCallbacks(defwVoidCbkFnType func) { + // Set all of the callbacks that have not been set yet to + // the given function. + int i; + + for (i = 0; i < MAXCBS; i++) { + if (defwCallbacksSeq[i] == 0) + defwCallbacksSeq[i] = (defwVoidCbkFnType)func; + } +} + + +/* These count up the number of times an unset callback is called... */ +static int defwUnusedCount[100]; + + +int defwCountFunc(defwCallbackType_e e, defiUserData d) { + int i = (int)e; + if (defiDebug(23)) printf("count %d 0x%p\n", (int)e, d); + if (i >= 0 && i < 100) { + defwUnusedCount[i] += 1; + return 0; + } + return 1; +} + + +void defwSetRegisterUnusedCallbacks() { + int i; + defwRegisterUnused = 1; + defwSetUnusedCallbacks(defwCountFunc); + for (i = 0; i < 100; i++) + defwUnusedCount[i] = 0; +} + + +void defwPrintUnusedCallbacks(FILE* f) { + int i; + int first = 1; + + if (defwRegisterUnused == 0) { + fprintf(f, + "ERROR DEFWRIT-9012): You are calling the function defwPrintUnusedCallbacks but you did call the function defwSetRegisterUnusedCallbacks which is required before you can call defwPrintUnusedCallbacks."); + return; + } + + for (i = 0; i < 100; i++) { + if (defwUnusedCount[i]) { + if (first) + fprintf(f, + "DEF items that were present but ignored because of no callback:\n"); + first = 0; + switch ((defwCallbackType_e) i) { + case defwVersionCbkType: fprintf(f, "Version"); break; + case defwCaseSensitiveCbkType: fprintf(f, "CaseSensitive"); break; + case defwDividerCbkType: fprintf(f, "Divider"); break; + case defwBusBitCbkType: fprintf(f, "BusBit"); break; + case defwDesignCbkType: fprintf(f, "Design"); break; + case defwTechCbkType: fprintf(f, "Technology"); break; + case defwArrayCbkType: fprintf(f, "Array"); break; + case defwFloorPlanCbkType: fprintf(f, "FloorPlan"); break; + case defwUnitsCbkType: fprintf(f, "Units"); break; + case defwHistoryCbkType: fprintf(f, "History"); break; + case defwPropDefCbkType: fprintf(f, "PropertyDefinition"); break; + case defwDieAreaCbkType: fprintf(f, "DieArea"); break; + case defwRowCbkType: fprintf(f, "Row"); break; + case defwTrackCbkType: fprintf(f, "Track"); break; + case defwGcellGridCbkType: fprintf(f, "GcellGrid"); break; + case defwDefaultCapCbkType: fprintf(f, "DefaultCap"); break; + case defwCanplaceCbkType: fprintf(f, "Canplace"); break; + case defwCannotOccupyCbkType: fprintf(f, "CannotOccupy"); break; + case defwViaCbkType: fprintf(f, "Via"); break; + case defwRegionCbkType: fprintf(f, "Region"); break; + case defwComponentCbkType: fprintf(f, "Component"); break; + case defwPinCbkType: fprintf(f, "Pin"); break; + case defwPinPropCbkType: fprintf(f, "PinProperty"); break; + case defwSNetCbkType: fprintf(f, "SpecialNet"); break; + case defwNetCbkType: fprintf(f, "Net"); break; + case defwIOTimingCbkType: fprintf(f, "IOTiming"); break; + case defwScanchainCbkType: fprintf(f, "Scanchain"); break; + case defwConstraintCbkType: fprintf(f, "Constraint"); break; + case defwAssertionCbkType: fprintf(f, "Assertion"); break; + case defwGroupCbkType: fprintf(f, "Group"); break; + case defwBlockageCbkType: fprintf(f, "Blockages"); break; + case defwExtCbkType: fprintf(f, "Extension"); break; + case defwDesignEndCbkType: fprintf(f, "DesignEnd"); break; + /* NEW CALLBACK add the print here */ + default: fprintf(f, "BOGUS ENTRY"); break; + } + fprintf(f, " %d\n", defwUnusedCount[i]); + } + } +} + + +void defwSetUserData(defiUserData d) { + defwUserData = d; +} + + +defiUserData defwGetUserData() { + return defwUserData; +} + + +void defwSetArrayCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwArrayCbk] = f; +} + + +void defwSetAssertionCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwAssertionCbk] = f; +} + + +void defwSetBlockageCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwBlockageCbk] = f; +} + + +void defwSetBusBitCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwBusBitCbk] = f; +} + + +void defwSetCannotOccupyCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwCannotOccupyCbk] = f; +} + + +void defwSetCanplaceCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwCanplaceCbk] = f; +} + + +void defwSetCaseSensitiveCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwCaseSensitiveCbk] = f; +} + + +void defwSetComponentCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwComponentCbk] = f; +} + + +void defwSetConstraintCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwConstraintCbk] = f; +} + + +void defwSetDefaultCapCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwDefaultCapCbk] = f; +} + + +void defwSetDesignCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwDesignCbk] = f; +} + + +void defwSetDesignEndCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwDesignEndCbk] = f; +} + + +void defwSetDieAreaCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwDieAreaCbk] = f; +} + + +void defwSetDividerCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwDividerCbk] = f; +} + + +void defwSetExtCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwExtCbk] = f; +} + + +void defwSetFloorPlanCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwFloorPlanCbk] = f; +} + + +void defwSetGcellGridCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwGcellGridCbk] = f; +} + + +void defwSetGroupCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwGroupCbk] = f; +} + + +void defwSetHistoryCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwHistoryCbk] = f; +} + + +void defwSetIOTimingCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwIOTimingCbk] = f; +} + + +void defwSetNetCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwNetCbk] = f; +} + + +void defwSetPinCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwPinCbk] = f; +} + + +void defwSetPinPropCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwPinPropCbk] = f; +} + + +void defwSetPropDefCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwPropDefCbk] = f; +} + + +void defwSetRegionCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwRegionCbk] = f; +} + + +void defwSetRowCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwRowCbk] = f; +} + + +void defwSetSNetCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwSNetCbk] = f; +} + + +void defwSetScanchainCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwScanchainCbk] = f; +} + + +void defwSetTechnologyCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwTechCbk] = f; +} + + +void defwSetTrackCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwTrackCbk] = f; +} + + +void defwSetUnitsCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwUnitsCbk] = f; +} + + +void defwSetVersionCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwVersionCbk] = f; +} + + +void defwSetViaCbk(defwVoidCbkFnType f) { + defwCallbacksSeq[defwViaCbk] = f; +} + + +/* NEW CALLBACK - Each callback routine must have a routine that allows + * the user to set it. The set routines go here. */ + + +void defwSetLogFunction(DEFI_LOG_FUNCTION f) { + defwErrorLogFunction = f; +} + +void defwSetWarningLogFunction(DEFI_WARNING_LOG_FUNCTION f) { + defwWarningLogFunction = f; +} +END_LEFDEF_PARSER_NAMESPACE + diff --git a/src/def/def/defwWriterCalls.hpp b/src/def/def/defwWriterCalls.hpp new file mode 100644 index 00000000..b80c45fc --- /dev/null +++ b/src/def/def/defwWriterCalls.hpp @@ -0,0 +1,220 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2013-2014, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author: dell $ +// $Revision: #1 $ +// $Date: 2017/06/06 $ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef DEFI_WRITER_H +#define DEFI_WRITER_H + +#include +#include + +#include "defiKRDefs.hpp" +#include "defiDefs.hpp" +#include "defiUser.hpp" + +BEGIN_LEFDEF_PARSER_NAMESPACE + +/* + * The main writer function. + * The file should already be opened. This requirement allows + * the writer to be used with stdin or a pipe. The file name + * is only used for error messages. The includeSearchPath is + * a colon-delimited list of directories in which to find + * include files. + */ +extern int defwWrite ( FILE *file, + const char *fileName, + defiUserData userData ); + +/* + * Set all of the callbacks that have not yet been set to a function + * that will add up how many times a given def data type was ignored + * (ie no callback was done). The statistics can later be printed out. + */ +extern void defwSetRegisterUnusedCallbacks (void); +extern void defwPrintUnusedCallbacks (FILE* log); + +/* + * Set/get the client-provided user data. defi doesn't look at + * this data at all, it simply passes the opaque defiUserData pointer + * back to the application with each callback. The client can + * change the data at any time, and it will take effect on the + * next callback. The defi writer and writer maintain separate + * user data pointers. + */ +extern void defwSetUserData ( defiUserData ); +extern defiUserData defwGetUserData ( void ); + +/* + * An enum describing all of the types of writer callbacks. + */ +typedef enum { + defwUnspecifiedCbkType = 0, + defwVersionCbkType, + defwCaseSensitiveCbkType, + defwBusBitCbkType, + defwDividerCbkType, + defwDesignCbkType, + defwTechCbkType, + defwArrayCbkType, + defwFloorPlanCbkType, + defwUnitsCbkType, + defwHistoryCbkType, + defwPropDefCbkType, + defwDieAreaCbkType, + defwRowCbkType, + defwTrackCbkType, + defwGcellGridCbkType, + defwDefaultCapCbkType, + defwCanplaceCbkType, + defwCannotOccupyCbkType, + defwViaCbkType, + defwRegionCbkType, + defwComponentCbkType, + defwPinCbkType, + defwPinPropCbkType, + defwSNetCbkType, + defwNetCbkType, + defwIOTimingCbkType, + defwScanchainCbkType, + defwConstraintCbkType, + defwAssertionCbkType, // pre 5.2 + defwGroupCbkType, + defwBlockageCbkType, // 5.4 + defwExtCbkType, + defwDesignEndCbkType + + /* NEW CALLBACKS - each callback has its own type. For each callback + * that you add, you must add an item to this enum. */ + +} defwCallbackType_e; + + +/* Declarations of function signatures for each type of callback. + * These declarations are type-safe when compiling with ANSI C + * or C++; you will only be able to register a function pointer + * with the correct signature for a given type of callback. + * + * Each callback function is expected to return 0 if successful. + * A non-zero return code will cause the writer to abort. + * + * The defwDesignStart and defwDesignEnd callback is only called once. + * Other callbacks may be called multiple times, each time with a different + * set of data. + * + * For each callback, the Def API will make the callback to the + * function supplied by the client, which should either make a copy + * of the Def object, or store the data in the client's own data structures. + * The Def API will delete or reuse each object after making the callback, + * so the client should not keep a pointer to it. + * + * All callbacks pass the user data pointer provided in defwRead() + * or defwSetUserData() back to the client; this can be used by the + * client to obtain access to the rest of the client's data structures. + * + * The user data pointer is obtained using defwGetUserData() immediately + * prior to making each callback, so the client is free to change the + * user data on the fly if necessary. + * + * Callbacks with the same signature are passed a callback type + * parameter, which allows an application to write a single callback + * function, register that function for multiple callbacks, then + * switch based on the callback type to handle the appropriate type of + * data. + */ + + +/* A declaration of the signature of all callbacks that return nothing. */ +typedef int (*defwVoidCbkFnType) ( defwCallbackType_e, defiUserData ); + +/* Functions to call to register a callback function. + */ +extern void defwSetArrayCbk (defwVoidCbkFnType); +extern void defwSetAssertionCbk (defwVoidCbkFnType); +extern void defwSetBlockageCbk (defwVoidCbkFnType); +extern void defwSetBusBitCbk (defwVoidCbkFnType); +extern void defwSetCannotOccupyCbk (defwVoidCbkFnType); +extern void defwSetCanplaceCbk (defwVoidCbkFnType); +extern void defwSetCaseSensitiveCbk (defwVoidCbkFnType); +extern void defwSetComponentCbk (defwVoidCbkFnType); +extern void defwSetConstraintCbk (defwVoidCbkFnType); +extern void defwSetDefaultCapCbk (defwVoidCbkFnType); +extern void defwSetDesignCbk (defwVoidCbkFnType); +extern void defwSetDesignEndCbk (defwVoidCbkFnType); +extern void defwSetDieAreaCbk (defwVoidCbkFnType); +extern void defwSetDividerCbk (defwVoidCbkFnType); +extern void defwSetExtCbk (defwVoidCbkFnType); +extern void defwSetFloorPlanCbk (defwVoidCbkFnType); +extern void defwSetGcellGridCbk (defwVoidCbkFnType); +extern void defwSetGroupCbk (defwVoidCbkFnType); +extern void defwSetHistoryCbk (defwVoidCbkFnType); +extern void defwSetIOTimingCbk (defwVoidCbkFnType); +extern void defwSetNetCbk (defwVoidCbkFnType); +extern void defwSetPinCbk (defwVoidCbkFnType); +extern void defwSetPinPropCbk (defwVoidCbkFnType); +extern void defwSetPropDefCbk (defwVoidCbkFnType); +extern void defwSetRegionCbk (defwVoidCbkFnType); +extern void defwSetRowCbk (defwVoidCbkFnType); +extern void defwSetSNetCbk (defwVoidCbkFnType); +extern void defwSetScanchainCbk (defwVoidCbkFnType); +extern void defwSetTechnologyCbk (defwVoidCbkFnType); +extern void defwSetTrackCbk (defwVoidCbkFnType); +extern void defwSetUnitsCbk (defwVoidCbkFnType); +extern void defwSetVersionCbk (defwVoidCbkFnType); +extern void defwSetViaCbk (defwVoidCbkFnType); + +/* NEW CALLBACK - each callback must have a function to allow the user + * to set it. Add the function here. */ + + +/* + * Set all of the callbacks that have not yet been set to the following + * function. This is especially useful if you want to check to see + * if you forgot anything. + */ +extern void defwSetUnusedCallbacks (defwVoidCbkFnType func); + +/* Routine to set the message logging routine for errors */ +#ifndef DEFI_LOG_FUNCTION + typedef void (*DEFI_LOG_FUNCTION) (const char*); +#endif + +extern void defwSetLogFunction ( DEFI_LOG_FUNCTION ); + +/* Routine to set the message logging routine for warnings */ +#ifndef DEFI_WARNING_LOG_FUNCTION + typedef void (*DEFI_WARNING_LOG_FUNCTION)(const char*); +#endif + +extern void defwSetWarningLogFunction( DEFI_WARNING_LOG_FUNCTION ); + +END_LEFDEF_PARSER_NAMESPACE + +USE_LEFDEF_PARSER_NAMESPACE + +#endif diff --git a/src/def/def/lex.h b/src/def/def/lex.h new file mode 100644 index 00000000..cb4820a0 --- /dev/null +++ b/src/def/def/lex.h @@ -0,0 +1,46 @@ +/******************************************************************************* + ******************************************************************************* + * Copyright 2014, Cadence Design Systems + * + * This file is part of the Cadence LEF/DEF Open Source + * Distribution, Product Version 5.8. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + * + * For updates, support, or to become part of the LEF/DEF Community, + * check www.openeda.org for details. + ******************************************************************************* + * + * $Author: dell $ + * $Revision: #1 $ + * $Date: 2017/06/06 $ + * $State: $ + ******************************************************************************/ + +#include "defiKRDefs.hpp" +#include "defrData.hpp" + + +BEGIN_LEFDEF_PARSER_NAMESPACE + +extern void lex_init(); +extern void lex_un_init(); +extern int defyyparse(defrData *data); + +void AddStringDefine(char *token, char *string); +void AddBooleanDefine(char *token, int val); +void AddNumDefine(char *token, double val); + +int fake_ftell(); + +END_LEFDEF_PARSER_NAMESPACE diff --git a/src/def/defdiff/diffDefRW.cpp b/src/def/defdiff/diffDefRW.cpp new file mode 100644 index 00000000..207c05a7 --- /dev/null +++ b/src/def/defdiff/diffDefRW.cpp @@ -0,0 +1,2252 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2014 - 2015, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author$ +// $Revision$ +// $Date$ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +// This program is the diffDef core program. It has all the callback +// routines and write it out to a temporary file. + +#include +#include +#include +#include +#ifndef WIN32 +# include +#endif /* not WIN32 */ +#include "defrReader.hpp" + + +char defaultName[64]; +char defaultOut[64]; +static int ignorePE = 0; +static int ignoreRN = 0; +static int ignoreVN = 0; +static int netSeCmp = 0; + +// Global variables +FILE* fout; +void *userData; +int numObjs; +int isSumSet; // to keep track if within SUM +int isProp = 0; // for PROPDEF +int begOperand; // to keep track for constraint, to print - as the 1st char +static double curVer = 5.7; + +// TX_DIR:TRANSLATION ON + +void dataError() { + fprintf(fout, "ERROR: returned user data is not correct!\n"); +} + + +void checkType(defrCallbackType_e c) { + if (c >= 0 && c <= defrDesignEndCbkType) { + // OK + } else { + fprintf(fout, "ERROR: callback type is out of bounds!\n"); + } +} + +// 05/24/2001 - Wanda da Rosa. PCR 373170 +// This function is added due to the rounding between machines are +// different. For a 5, solaries will round down while hppa will roundup. +// This function will make sure it round up for all the machine +double checkDouble(double num) { + long tempNum; + if ((num > 1000004) || (num < -1000004)) { + tempNum = (long)num; + if ((tempNum%5) == 0) + return num + 3; + } + return num; +} + +int compMSL(defrCallbackType_e c, defiComponentMaskShiftLayer* co, defiUserData ud) { + int i; + + checkType(c); + if (ud != userData) dataError(); + + if (co->numMaskShiftLayers()) { + fprintf(fout, "\nCOMPONENTMASKSHIFT "); + + for (i = 0; i < co->numMaskShiftLayers(); i++) { + fprintf(fout, "%s ", co->maskShiftLayer(i)); + } + fprintf(fout, ";\n"); + } + + return 0; +} + + +// Component +int compf(defrCallbackType_e c, defiComponent* co, defiUserData ud) { + int i; + + checkType(c); + if (ud != userData) dataError(); + // missing GENERATE, FOREIGN + fprintf(fout, "COMP %s %s", co->id(), co->name()); + if (co->hasNets()) { + for (i = 0; i < co->numNets(); i++) + fprintf(fout, " %s", co->net(i)); + fprintf(fout,"\n"); + } else + fprintf(fout,"\n"); + if (co->isFixed()) + fprintf(fout, "COMP %s FIXED ( %d %d ) %s\n", co->id(), + co->placementX(), co->placementY(), co->placementOrientStr()); + if (co->isCover()) + fprintf(fout, "COMP %s COVER ( %d %d ) %s\n", co->id(), + co->placementX(), co->placementY(), co->placementOrientStr()); + if (co->isPlaced()) + fprintf(fout,"COMP %s PLACED ( %d %d ) %s\n", co->id(), + co->placementX(), co->placementY(), co->placementOrientStr()); + if (co->isUnplaced()) + fprintf(fout,"COMP %s UNPLACED\n", co->id()); + if (co->hasSource()) + fprintf(fout, "COMP %s SOURCE %s\n", co->id(), co->source()); + if (co->hasGenerate()) + fprintf(fout, "COMP %s GENERATE %s %s\n", co->id(), + co->generateName(), co->macroName()); + if (co->hasHalo()) { + int left, bottom, right, top; + (void) co->haloEdges(&left, &bottom, &right, &top); + fprintf(fout, "COMP %s HALO", co->id()); + if (co->hasHaloSoft()) + fprintf(fout, " SOFT"); + fprintf(fout, " %d %d %d %d\n", left, bottom, right, top); + + } + if (co->hasRouteHalo()) { + fprintf(fout, "COMP %s ROUTEHALO %d %s %s\n", co->id(), + co->haloDist(), co->minLayer(), co->maxLayer()); + } + if (co->hasForeignName()) + fprintf(fout, "COMP %s FOREIGN %s %d %d %s\n", co->id(), + co->foreignName(), co->foreignX(), co->foreignY(), + co->foreignOri()); + if (co->hasWeight()) + fprintf(fout, "COMP %s WEIGHT %d\n", co->id(), co->weight()); + if (co->hasEEQ()) + fprintf(fout, "COMP %s EEQMASTER %s\n", co->id(), co->EEQ()); + if (co->hasRegionName()) + fprintf(fout, "COMP %s REGION %s\n", co->id(), co->regionName()); + if (co->hasRegionBounds()) { + int *xl, *yl, *xh, *yh; + int size; + co->regionBounds(&size, &xl, &yl, &xh, &yh); + for (i = 0; i < size; i++) { + fprintf(fout, "COMP %s REGION ( %d %d ) ( %d %d )\n", co->id(), + xl[i], yl[i], xh[i], yh[i]); + } + } + if (co->maskShiftSize()) { + fprintf(fout, "MASKSHIFT "); + + for (int i = co->maskShiftSize()-1; i >= 0; i--) { + fprintf(fout, "%d", co->maskShift(i)); + } + fprintf(fout, "\n"); + } + if (co->numProps()) { + for (i = 0; i < co->numProps(); i++) { + fprintf(fout, "COMP %s PROP %s %s ", co->id(), + co->propName(i), + co->propValue(i)); + switch (co->propType(i)) { + case 'R': fprintf(fout, "REAL "); + break; + case 'I': fprintf(fout, "INT "); + break; + case 'S': fprintf(fout, "STR "); + break; + case 'Q': fprintf(fout, "QSTR "); + break; + case 'N': fprintf(fout, "NUM "); + break; + } + fprintf(fout, "\n"); + } + } + + --numObjs; + return 0; +} + +// Net +int netf(defrCallbackType_e c, defiNet* net, defiUserData ud) { + // For net and special net. + int i, j, k, w, x, y, z, px, py, pz; + defiPath* p; + defiSubnet* s; + int path; + defiVpin *vpin; + defiShield* noShield; + defiWire* wire; + int nline; + const char* layerName = "N/A"; + + checkType(c); + if (ud != userData) dataError(); + if (c != defrNetCbkType) + fprintf(fout, "BOGUS NET TYPE "); + if (net->pinIsMustJoin(0)) + fprintf(fout, "NET MUSTJOIN "); + else + fprintf(fout, "NET %s ", net->name()); + + // compName & pinName + for (i = 0; i < net->numConnections(); i++) { + fprintf(fout, "\nNET %s ( %s %s ) ", net->name(), net->instance(i), + net->pin(i)); + } + + if (net->hasNonDefaultRule()) + fprintf(fout, "\nNET %s NONDEFAULTRULE %s", net->name(), + net->nonDefaultRule()); + + for (i = 0; i < net->numVpins(); i++) { + vpin = net->vpin(i); + fprintf(fout, "\nNET %s %s", net->name(), vpin->name()); + if (vpin->layer()) + fprintf(fout, " %s", vpin->layer()); + fprintf(fout, " %d %d %d %d", vpin->xl(), vpin->yl(), vpin->xh(), + vpin->yh()); + if (vpin->status() != ' ') { + switch (vpin->status()) { + case 'P': + case 'p': + fprintf(fout, " PLACED"); + break; + case 'F': + case 'f': + fprintf(fout, " FIXED"); + break; + case 'C': + case 'c': + fprintf(fout, " COVER"); + break; + } + fprintf(fout, " %d %d", vpin->xLoc(), vpin->yLoc()); + if (vpin->orient() != -1) + fprintf(fout, " %s", vpin->orientStr()); + } + } + + // regularWiring + if (net->numWires()) { + for (i = 0; i < net->numWires(); i++) { + wire = net->wire(i); + for (j = 0; j < wire->numPaths(); j++) { + p = wire->path(j); + p->initTraverse(); + fprintf(fout, "\nNET %s %s", net->name(), wire->wireType()); + nline = 0; + while ((path = (int)p->next()) != DEFIPATH_DONE) { + switch (path) { + case DEFIPATH_LAYER: + if (!netSeCmp) + fprintf(fout, " %s", p->getLayer()); + layerName = p->getLayer(); + px = py = pz = -99; // reset the 1 set of point to 0 + break; + case DEFIPATH_MASK: + fprintf(fout, "MASK %d ", p->getMask()); + break; + case DEFIPATH_VIAMASK: + fprintf(fout, "MASK %d%d%d ", + p->getViaTopMask(), + p->getViaCutMask(), + p->getViaBottomMask()); + break; + case DEFIPATH_VIA: + if (!netSeCmp) { + if (!ignoreVN) + fprintf(fout, " %s", p->getVia()); + } else { + if (nline) { + if (!ignoreVN) + fprintf(fout, "\nNET %s %s ( %d %d ) %s", net->name(), + wire->wireType(), px, py, p->getVia()); + else + fprintf(fout, "\nNET %s %s ( %d %d )", net->name(), + wire->wireType(), px, py); + } else { + if (!ignoreVN) + fprintf(fout, " ( %d %d ) %s", px, py, p->getVia()); + else + fprintf(fout, " ( %d %d )", px, py); + } + px = py = pz = -99; // reset the 1 set of point to 0 + } + nline = 1; + break; + case DEFIPATH_RECT: + p->getViaRect(&w, &x, &y, &z); + fprintf(fout, "RECT ( %d %d %d %d ) ", w, x, y, z); + break; + case DEFIPATH_VIRTUALPOINT: + p->getVirtualPoint(&x, &y); + fprintf(fout, "VIRTUAL ( %d %d ) ", x, y); + break; + case DEFIPATH_VIAROTATION: + fprintf(fout, "%d ",p->getViaRotation()); + nline = 1; + break; + case DEFIPATH_WIDTH: + fprintf(fout, " %d ", p->getWidth()); + break; + case DEFIPATH_POINT: + p->getPoint(&x, &y); + if (!netSeCmp) { + if (!nline) { + fprintf(fout, " ( %d %d )", x, y); + nline = 1; + } else { + fprintf(fout, "\nNET %s %s %s ( %d %d )", net->name(), + wire->wireType(), layerName, x, y); + } + } else { + if ((px == -99) && (py == -99)) { + px = x; + py = y; + } else { + if (nline) + fprintf(fout, "\nNET %s %s %s", net->name(), + wire->wireType(), layerName); + if (px < x) { + fprintf (fout, " ( %d %d ) ( %d %d )", px, py, x, y); + } else if (px == x) { + if (py < y) + fprintf (fout, " ( %d %d ) ( %d %d )", + px, py, x, y); + else + fprintf (fout, " ( %d %d ) ( %d %d )", + x, y, px, py); + } else { // px > x + fprintf (fout, " ( %d %d ) ( %d %d )", x, y, px, py); + } + px = x; + py = y; + nline = 1; + } + } + break; + case DEFIPATH_FLUSHPOINT: + p->getFlushPoint(&x, &y, &z); + if (!netSeCmp) { + if (!nline) { + fprintf(fout, " ( %d %d %d )", x, y, z); + } else { + fprintf(fout, "\nNET %s %s %s ( %d %d %d )", net->name(), + wire->wireType(), layerName, x, y, z); + } + } else { + if ((px == -99) && (py == -99) && (pz == -99)) { + px = x; + py = y; + pz = z; + } else { + if (nline) + fprintf(fout, "\nNET %s %s %s", net->name(), + wire->wireType(), layerName); + if (px < x) { + if (pz != -99) + fprintf (fout, " ( %d %d %d ) ( %d %d %d )", + px, py, pz, x, y, z); + else + fprintf (fout, " ( %d %d ) ( %d %d %d )", + px, py, x, y, z); + } else if (px == x) { + if (py < y) { + if (pz != -99) + fprintf (fout, " ( %d %d %d ) ( %d %d %d )", + px, py, pz, x, y, z); + else + fprintf (fout, " ( %d %d ) ( %d %d %d )", + px, py, x, y, z); + } else { + if (pz != -99) + fprintf (fout, " ( %d %d %d ) ( %d %d %d )", + x, y, z, px, py, pz); + else + fprintf (fout, " ( %d %d %d ) ( %d %d )", + x, y, z, px, py); + } + } else { // px > x + if (pz != -99) + fprintf (fout, " ( %d %d %d ) ( %d %d %d )", + x, y, z, px, py, pz); + else + fprintf (fout, " ( %d %d %d ) ( %d %d )", + x, y, z, px, py); + } + px = x; + py = y; + pz = z; + nline = 1; + } + } + break; + case DEFIPATH_TAPER: + fprintf(fout, " TAPER"); + break; + case DEFIPATH_TAPERRULE: + fprintf(fout, " TAPERRULE %s",p->getTaperRule()); + break; + } + } + } + } + } + + // shieldnet + if (net->numShieldNets()) { + for (i = 0; i < net->numShieldNets(); i++) + fprintf(fout, "\nNET %s SHIELDNET %s ", net->name(), + net->shieldNet(i)); + } + if (net->numNoShields()) { + for (i = 0; i < net->numNoShields(); i++) { + noShield = net->noShield(i); + for (j = 0; j < noShield->numPaths(); j++) { + p = noShield->path(j); + p->initTraverse(); + fprintf(fout, "\nNET %s NOSHIELD", net->name()); + nline = 0; + while ((path = (int)p->next()) != DEFIPATH_DONE) { + switch (path) { + case DEFIPATH_LAYER: + fprintf(fout, " %s", p->getLayer()); + layerName = p->getLayer(); + break; + case DEFIPATH_MASK: + fprintf(fout, "MASK %d ", p->getMask()); + break; + case DEFIPATH_VIAMASK: + fprintf(fout, "MASK %d%d%d ", + p->getViaTopMask(), + p->getViaCutMask(), + p->getViaBottomMask()); + break; + case DEFIPATH_VIA: + if (!ignoreVN) + fprintf(fout, " %s", p->getVia()); + nline = 1; + break; + case DEFIPATH_VIAROTATION: + fprintf(fout, " %d", p->getViaRotation()); + nline = 1; + break; + case DEFIPATH_WIDTH: + fprintf(fout, " %d", p->getWidth()); + break; + case DEFIPATH_POINT: + p->getPoint(&x, &y); + if (!nline) { + fprintf(fout, " ( %d %d )", x, y); + nline = 1; + } else { + fprintf(fout, "\nNET %s %s ( %d %d )", + net->name(), layerName, x, y); + nline = 1; + } + break; + case DEFIPATH_FLUSHPOINT: + p->getFlushPoint(&x, &y, &z); + if (!nline) { + fprintf(fout, " ( %d %d )", x, y); + nline = 1; + } else { + fprintf(fout, "\nNET %s %s ( %d %d )", + net->name(), layerName, x, y); + nline = 1; + } + case DEFIPATH_TAPER: + fprintf(fout, " TAPER"); + break; + case DEFIPATH_TAPERRULE: + fprintf(fout, " TAPERRULE %s", + p->getTaperRule()); + break; + } + } + } + } + } + + if (net->hasSubnets()) { + for (i = 0; i < net->numSubnets(); i++) { + s = net->subnet(i); + + if (s->numConnections()) { + for (j = 0; j < s->numConnections(); j++) { + if (s->pinIsMustJoin(0)) + fprintf(fout, "\nNET MUSTJOIN"); + else + fprintf(fout, "\nNET %s", s->name()); + fprintf(fout, " ( %s %s )", s->instance(j), s->pin(j)); + } + } + + for (j = 0; j < s->numWires(); j++) { + wire = s->wire(j); + if (s->numPaths()) { + for (k = 0; k < wire->numPaths(); k++) { + int elem; + p = wire->path(k); + p->initTraverse(); + fprintf(fout, "\nNET %s %s", s->name(), wire->wireType()); + nline = 0; + elem = p->next(); + while (elem) { + switch (elem) { + case DEFIPATH_LAYER: + fprintf(fout, " LAYER %s", p->getLayer()); + layerName = p->getLayer(); + break; + case DEFIPATH_MASK: + fprintf(fout, "MASK %d ", p->getMask()); + break; + case DEFIPATH_VIAMASK: + fprintf(fout, "MASK %d%d%d ", + p->getViaTopMask(), + p->getViaCutMask(), + p->getViaBottomMask()); + break; + case DEFIPATH_VIA: + if (!ignoreVN) + fprintf(fout, " VIA %s", p->getVia()); + nline = 1; + break; + case DEFIPATH_VIAROTATION: + fprintf(fout, " VIAROTATION %d", p->getViaRotation()); + nline = 1; + break; + case DEFIPATH_WIDTH: + fprintf(fout, " WIDTH %d", p->getWidth()); + break; + case DEFIPATH_POINT: + p->getPoint(&x, &y); + if (!nline) { + fprintf(fout, " POINT %d %d", x, y); + nline = 1; + } else { + fprintf(fout, "\nNET %s %s %s POINT %d %d", + s->name(), wire->wireType(), layerName, x, y); + nline = 1; + } + break; + //case DEFIPATH_FLUSHPOINT: + //l = 0; + //p->getFlushPoint(i1, i2, ext); + //while (i1[l] && i2[l] && ext[l]) { + //fprintf(fout, "NET %s FLUSHPOINT %d %d %d\n", + //s->name(), i1[l], i2[l], ext[l]); + //l++; + //} + //break; + case DEFIPATH_TAPERRULE: + fprintf(fout, " TAPERRULE %s", p->getTaperRule()); + break; + case DEFIPATH_SHAPE: + fprintf(fout, " SHAPE %s", p->getShape()); + break; + case DEFIPATH_STYLE: + fprintf(fout, " STYLE %d", p->getStyle()); + break; + } + elem = p->next(); + } + } + } + } + } + } + + /* Put the following all in one line */ + if (net->hasWeight() || net->hasCap() || net->hasSource() || + net->hasPattern() || net->hasOriginal() || net->hasUse()) { + fprintf(fout, "\nNET %s ", net->name()); + + if (net->hasWeight()) + fprintf(fout, "WEIGHT %d ", net->weight()); + if (net->hasCap()) + fprintf(fout, "ESTCAP %g ", checkDouble(net->cap())); + if (net->hasSource()) + fprintf(fout, "SOURCE %s ", net->source()); + if (net->hasFixedbump()) + fprintf(fout, "FIXEDBUMP "); + if (net->hasFrequency()) + fprintf(fout, "FREQUENCY %g ", net->frequency()); + if (net->hasPattern()) + fprintf(fout, "PATTERN %s ", net->pattern()); + if (net->hasOriginal()) + fprintf(fout, "ORIGINAL %s ", net->original()); + if (net->hasUse()) + fprintf(fout, "USE %s ", net->use()); + } + + fprintf (fout, "\n"); + --numObjs; + return 0; +} + + +// Special Net +int snetf(defrCallbackType_e c, defiNet* net, defiUserData ud) { + // For net and special net. + int i, j, x, y, z; + char *layerName; + double dist, left, right; + defiPath *p; + defiSubnet *s; + int path; + defiShield* shield; + defiWire *wire; + int nline; + const char* sNLayerName = "N/A"; + int numX, numY, stepX, stepY; + + checkType(c); + if (ud != userData) dataError(); + if (c != defrSNetCbkType) + fprintf(fout, "BOGUS NET TYPE "); + + // compName & pinName + if (net->numConnections() > 0) { + for (i = 0; i < net->numConnections(); i++) + fprintf (fout, "SNET %s ( %s %s )\n", net->name(), net->instance(i), + net->pin(i)); + } + + if (net->numRectangles()) { // 5.6 + + for (i = 0; i < net->numRectangles(); i++) { + if (curVer >= 5.8 ) { + fprintf (fout, "\nSNET %s ", net->name()); + if (strcmp(net->rectRouteStatus(i), "") != 0) { + fprintf(fout, "%s ", net->rectRouteStatus(i)); + if (strcmp(net->rectRouteStatus(i), "SHIELD") == 0) { + fprintf(fout, "%s ", net->rectRouteStatusShieldName(i)); + } + } + if (strcmp(net->rectShapeType(i), "") != 0) { + fprintf(fout, "SHAPE %s ", net->rectShapeType(i)); + } + } + if (net->rectMask(i)) { + fprintf(fout, "MASK %d RECT %s %d %d %d %d", + net->rectMask(i), net->rectName(i), + net->xl(i), net->yl(i), net->xh(i), + net->yh(i)); + } else { + fprintf(fout, "RECT %s %d %d %d %d", net->name(), + net->xl(i), net->yl(i), net->xh(i), + net->yh(i)); + } + } + } + + if (net->numPolygons()) { + struct defiPoints points; + + for (i = 0; i < net->numPolygons(); i++) { + fprintf (fout, "\nSNET %s ", net->name()); + if (curVer >= 5.8 ) { + if (strcmp(net->polyRouteStatus(i), "") != 0) { + fprintf(fout, "%s ", net->polyRouteStatus(i)); + if (strcmp(net->polyRouteStatus(i), "SHIELD") == 0) { + fprintf(fout, "%s ", net->polyRouteStatusShieldName(i)); + } + } + if (strcmp(net->polyShapeType(i), "") != 0) { + fprintf(fout, "SHAPE %s ", net->polyShapeType(i)); + } + } + if (net->polyMask(i)) { + fprintf(fout, "MASK %d POLYGON % s ", + net->polyMask(i), + net->polygonName(i)); + } else { + fprintf(fout, "POLYGON %s", net->polygonName(i)); + } + + points = net->getPolygon(i); + for (j = 0; j < points.numPoints; j++) + fprintf(fout, " %d %d", points.x[j], points.y[j]); + } + } + + if (curVer >= 5.8 && net->numViaSpecs()) { + for (i = 0; i < net->numViaSpecs(); i++) { + fprintf (fout, "\nSNET %s ", net->name()); + if (strcmp(net->viaRouteStatus(i), "") != 0) { + fprintf(fout, "%s ", net->viaRouteStatus(i)); + if (strcmp(net->viaRouteStatus(i), "SHIELD") == 0) { + fprintf(fout, "%s ", net->viaRouteStatusShieldName(i)); + } + } + if (strcmp(net->viaShapeType(i), "") != 0) { + fprintf(fout, "SHAPE %s ", net->viaShapeType(i)); + } + if (net->topMaskNum(i) || net->cutMaskNum(i) || net->bottomMaskNum(i)) { + fprintf(fout, "MASK %d%d%d VIA %s ", net->topMaskNum(i), + net->cutMaskNum(i), + net->bottomMaskNum(i), + net->viaName(i)); + } else { + fprintf(fout, "\n VIA %s ", net->viaName(i)); + } + fprintf(fout, " %s", net->viaOrientStr(i)); + + defiPoints points = net->getViaPts(i); + + for (int j = 0; j < points.numPoints; j++) { + fprintf(fout, " %d %d", points.x[j], points.y[j]); + } + fprintf(fout, ";\n"); + } + } + + + // specialWiring + if (net->numWires()) { + for (i = 0; i < net->numWires(); i++) { + wire = net->wire(i); + for (j = 0; j < wire->numPaths(); j++) { + p = wire->path(j); + fprintf(fout, "\nSNET %s %s", net->name(), wire->wireType()); + nline = 0; + p->initTraverse(); + while ((path = (int)p->next()) != DEFIPATH_DONE) { + switch (path) { + case DEFIPATH_LAYER: + fprintf(fout, " %s", p->getLayer()); + sNLayerName = p->getLayer(); + break; + case DEFIPATH_MASK: + fprintf(fout, "MASK %d ", p->getMask()); + break; + case DEFIPATH_VIAMASK: + fprintf(fout, "MASK %d%d%d ", + p->getViaTopMask(), + p->getViaCutMask(), + p->getViaBottomMask()); + break; + case DEFIPATH_VIA: + if (!ignoreVN) + fprintf(fout, " %s", p->getVia()); + nline = 1; + break; + case DEFIPATH_VIAROTATION: + fprintf(fout, " %d", p->getViaRotation()); + nline = 1; + break; + case DEFIPATH_VIADATA: + p->getViaData(&numX, &numY, &stepX, &stepY); + fprintf(fout, " DO %d BY %d STEP %d %d", numX, numY, + stepX, stepY); + nline = 1; + break; + case DEFIPATH_WIDTH: + fprintf(fout, " %d", p->getWidth()); + break; + case DEFIPATH_POINT: + p->getPoint(&x, &y); + if (!nline) { + fprintf(fout, " ( %d %d ) ", x, y); + nline = 1; + } else { + fprintf(fout, "\nSNET %s %s %s ( %d %d )", net->name(), + wire->wireType(), sNLayerName, x, y); + nline = 1; + } + break; + case DEFIPATH_FLUSHPOINT: + p->getFlushPoint(&x, &y, &z); + fprintf(fout, "( %d %d %d ) ", x, y, z); + nline = 1; + break; + case DEFIPATH_TAPER: + fprintf(fout, " TAPER"); + break; + case DEFIPATH_SHAPE: + fprintf(fout, " + SHAPE %s", p->getShape()); + break; + case DEFIPATH_STYLE: + fprintf(fout, " + STYLE %d", p->getStyle()); + break; + } + } + } + } + } + + if (net->hasSubnets()) { + for (i = 0; i < net->numSubnets(); i++) { + s = net->subnet(i); + if (s->numConnections()) { + if (s->pinIsMustJoin(0)) + fprintf(fout, "\nSNET %s MUSTJOIN", net->name()); + else + fprintf(fout, "\nSNET %s", net->name()); + for (j = 0; j < s->numConnections(); j++) { + fprintf(fout, "( %s %s ) ", s->instance(j), s->pin(j)); + } + } + + // regularWiring + if (s->numWires()) { + for (i = 0; i < s->numWires(); i++) { + wire = s->wire(i); + for (j = 0; j < wire->numPaths(); j++) { + p = wire->path(j); + p->initTraverse(); + fprintf(fout, "\nSNET %s %s", net->name(), wire->wireType()); + nline = 0; + while ((path = (int)p->next()) != DEFIPATH_DONE) { + switch (path) { + case DEFIPATH_LAYER: + fprintf(fout, " %s", p->getLayer()); + sNLayerName = p->getLayer(); + break; + case DEFIPATH_VIA: + if (!ignoreVN) + fprintf(fout, " %s", p->getVia()); + break; + case DEFIPATH_MASK: + fprintf(fout, "MASK %d ", p->getMask()); + break; + case DEFIPATH_VIAMASK: + fprintf(fout, "MASK %d%d%d ", + p->getViaTopMask(), + p->getViaCutMask(), + p->getViaBottomMask()); + break; + + case DEFIPATH_VIAROTATION: + fprintf(fout, " %d", p->getViaRotation()); + break; + case DEFIPATH_WIDTH: + fprintf(fout, " %d", p->getWidth()); + break; + case DEFIPATH_POINT: + p->getPoint(&x, &y); + if (!nline) { + fprintf(fout, "( %d %d ) ", x, y); + nline = 1; + } else { + fprintf(fout, "\nSNET %s %s %s ( %d %d ) ", + net->name(), wire->wireType(), sNLayerName, + x, y); + nline = 1; + } + break; + case DEFIPATH_TAPER: + fprintf(fout, " TAPER"); + break; + } + } + } + } + } + } + } + + if (net->numProps()) { + for (i = 0; i < net->numProps(); i++) { + fprintf(fout, "\nSNET %s PROP %s %s ", net->name(), + net->propName(i), net->propValue(i)); + switch (net->propType(i)) { + case 'R': fprintf(fout, "REAL "); + break; + case 'I': fprintf(fout, "INT "); + break; + case 'S': fprintf(fout, "STR "); + break; + case 'Q': fprintf(fout, "QSTR "); + break; + case 'N': fprintf(fout, "NUM "); + break; + } + } + } + + // SHIELD + // testing the SHIELD for 5.3 + if (net->numShields()) { + for (i = 0; i < net->numShields(); i++) { + shield = net->shield(i); + for (j = 0; j < shield->numPaths(); j++) { + p = shield->path(j); + fprintf(fout, "\nSNET %s SHIELD %s", net->name(), + shield->shieldName()); + p->initTraverse(); + while ((path = (int)p->next()) != DEFIPATH_DONE) { + switch (path) { + case DEFIPATH_LAYER: + fprintf(fout, " %s", p->getLayer()); + sNLayerName = p->getLayer(); + break; + case DEFIPATH_VIA: + if (!ignoreVN) + fprintf(fout, " %s", p->getVia()); + break; + case DEFIPATH_MASK: + fprintf(fout, "MASK %d ", p->getMask()); + break; + case DEFIPATH_VIAMASK: + fprintf(fout, "MASK %d%d%d ", + p->getViaTopMask(), + p->getViaCutMask(), + p->getViaBottomMask()); + break; + case DEFIPATH_VIAROTATION: + fprintf(fout, " %d", p->getViaRotation()); + break; + case DEFIPATH_WIDTH: + fprintf(fout, " %d", p->getWidth()); + break; + case DEFIPATH_POINT: + p->getPoint(&x, &y); + if (!nline) { + fprintf(fout, "( %d %d ) ", x, y); + nline = 1; + } else { + fprintf(fout, "\nSNET %s SHIELD %s %s ( %d %d )", + net->name(), shield->shieldName(), sNLayerName, + x, y); + } + break; + case DEFIPATH_TAPER: + fprintf(fout, " TAPER"); + break; + } + } + } + } + } + + // layerName width + if (net->hasWidthRules()) { + fprintf(fout, "\nSNET %s", net->name()); + for (i = 0; i < net->numWidthRules(); i++) { + net->widthRule(i, &layerName, &dist); + fprintf (fout, " WIDTH %s %g ", layerName, checkDouble(dist)); + } + } + + // layerName spacing + if (net->hasSpacingRules()) { + fprintf(fout, "\nSNET %s", net->name()); + for (i = 0; i < net->numSpacingRules(); i++) { + net->spacingRule(i, &layerName, &dist, &left, &right); + if (left == right) + fprintf (fout, " SPACING %s %g ", layerName, checkDouble(dist)); + else + fprintf (fout, " SPACING %s %g RANGE %g %g ", + layerName, checkDouble(dist), checkDouble(left), + checkDouble(right)); + } + } + + if (net->hasVoltage() || net->hasWeight() || net->hasCap() || + net->hasSource() || net->hasPattern() || net->hasOriginal() || + net->hasUse()) { + fprintf(fout, "\nSNET %s", net->name()); + if (net->hasVoltage()) + fprintf(fout, " VOLTAGE %g", checkDouble(net->voltage())); + if (net->hasWeight()) + fprintf(fout, " WEIGHT %d", net->weight()); + if (net->hasCap()) + fprintf(fout, " ESTCAP %g", checkDouble(net->cap())); + if (net->hasSource()) + fprintf(fout, " SOURCE %s", net->source()); + if (net->hasPattern()) + fprintf(fout, " PATTERN %s", net->pattern()); + if (net->hasOriginal()) + fprintf(fout, " ORIGINAL %s", net->original()); + if (net->hasUse()) + fprintf(fout, " USE %s", net->use()); + } + + fprintf(fout,"\n"); + --numObjs; + return 0; +} + +int ndr(defrCallbackType_e c, defiNonDefault* nd, defiUserData ud) { + // For nondefaultrule + int i; + + checkType(c); + if (ud != userData) dataError(); + if (c != defrNonDefaultCbkType) + fprintf(fout, "BOGUS NONDEFAULTRULE TYPE "); + fprintf(fout, "NDR %s", nd->name()); + if (nd->hasHardspacing()) + fprintf(fout, " HARDSPACING\n"); + fprintf(fout, "\n"); + for (i = 0; i < nd->numLayers(); i++) { + fprintf(fout, "NDR %s LAYER %s", nd->name(), nd->layerName(i)); + fprintf(fout, " WIDTH %d", nd->layerWidthVal(i)); + if (nd->hasLayerDiagWidth(i)) + fprintf(fout, " DIAGWIDTH %d", + nd->layerDiagWidthVal(i)); + if (nd->hasLayerSpacing(i)) + fprintf(fout, " SPACING %d", nd->layerSpacingVal(i)); + if (nd->hasLayerWireExt(i)) + fprintf(fout, " WIREEXT %d", nd->layerWireExtVal(i)); + fprintf(fout, "\n"); + } + for (i = 0; i < nd->numVias(); i++) + fprintf(fout, "NDR %s VIA %s\n", nd->name(), nd->viaName(i)); + for (i = 0; i < nd->numViaRules(); i++) + fprintf(fout, "NDR %s VIARULE %s\n", nd->name(), nd->viaRuleName(i)); + for (i = 0; i < nd->numMinCuts(); i++) + fprintf(fout, "NDR %s MINCUTS %s %d\n", nd->name(), nd->cutLayerName(i), + nd->numCuts(i)); + for (i = 0; i < nd->numProps(); i++) + fprintf(fout, "NDR %s PROPERTY %s %s\n", nd->name(), nd->propName(i), + nd->propValue(i)); + --numObjs; + return 0; +} + +// Technology +int tname(defrCallbackType_e c, const char* string, defiUserData ud) { + checkType(c); + if (ud != userData) dataError(); + fprintf(fout, "TECHNOLOGY %s\n", string); + return 0; +} + +// Design +int dname(defrCallbackType_e c, const char* string, defiUserData ud) { + checkType(c); + if (ud != userData) dataError(); + fprintf(fout, "DESIGN %s\n", string); + + return 0; +} + + +char* address(const char* in) { + return ((char*)in); +} + +// Assertion or Constraints +void operand(defrCallbackType_e c, defiAssertion* a, int ind) { + int i, first = 1; + char* netName; + char* fromInst, * fromPin, * toInst, * toPin; + + if (a->isSum()) { + // Sum in operand, recursively call operand + fprintf(fout, "ASSERTIONS/CONSTRAINTS SUM ( "); + a->unsetSum(); + isSumSet = 1; + begOperand = 0; + operand (c, a, ind); + fprintf(fout, ") "); + } else { + // operand + if (ind >= a->numItems()) { + fprintf(fout, "ERROR: when writing out SUM in Constraints.\n"); + return; + } + if (begOperand) { + fprintf(fout, "ASSRT/CONSTR "); + begOperand = 0; + } + for (i = ind; i < a->numItems(); i++) { + if (a->isNet(i)) { + a->net(i, &netName); + if (!first) + fprintf(fout, ", "); // print , as separator + fprintf(fout, "NET %s ", netName); + } else if (a->isPath(i)) { + a->path(i, &fromInst, &fromPin, &toInst, + &toPin); + if (!first) + fprintf(fout, ", "); + fprintf(fout, "PATH %s %s %s %s ", fromInst, fromPin, toInst, + toPin); + } else if (isSumSet) { + // SUM within SUM, reset the flag + a->setSum(); + operand(c, a, i); + } + first = 0; + } + + } +} + +// Assertion or Constraints +int constraint(defrCallbackType_e c, defiAssertion* a, defiUserData ud) { + // Handles both constraints and assertions + + checkType(c); + if (ud != userData) dataError(); + if (a->isWiredlogic()) + // Wirelogic + fprintf(fout, "ASSRT/CONSTR WIREDLOGIC %s + MAXDIST %g\n", + a->netName(), checkDouble(a->fallMax())); + else { + // Call the operand function + isSumSet = 0; // reset the global variable + begOperand = 1; + operand (c, a, 0); + // Get the Rise and Fall + if (a->hasRiseMax()) + fprintf(fout, " RISEMAX %g ", checkDouble(a->riseMax())); + if (a->hasFallMax()) + fprintf(fout, " FALLMAX %g ", checkDouble(a->fallMax())); + if (a->hasRiseMin()) + fprintf(fout, " RISEMIN %g ", checkDouble(a->riseMin())); + if (a->hasFallMin()) + fprintf(fout, " FALLMIN %g ", checkDouble(a->fallMin())); + fprintf(fout, "\n"); + } + --numObjs; + return 0; +} + + +// Property definitions +int prop(defrCallbackType_e c, defiProp* p, defiUserData ud) { + checkType(c); + if (ud != userData) dataError(); + if (strcmp(p->propType(), "design") == 0) + fprintf(fout, "PROPDEF DESIGN %s ", p->propName()); + else if (strcmp(p->propType(), "net") == 0) + fprintf(fout, "PROPDEF NET %s ", p->propName()); + else if (strcmp(p->propType(), "component") == 0) + fprintf(fout, "PROPDEF COMP %s ", p->propName()); + else if (strcmp(p->propType(), "specialnet") == 0) + fprintf(fout, "PROPDEF SNET %s ", p->propName()); + else if (strcmp(p->propType(), "group") == 0) + fprintf(fout, "PROPDEF GROUP %s ", p->propName()); + else if (strcmp(p->propType(), "row") == 0) + fprintf(fout, "PROPDEF ROW %s ", p->propName()); + else if (strcmp(p->propType(), "componentpin") == 0) + fprintf(fout, "PROPDEF COMPPIN %s ", p->propName()); + else if (strcmp(p->propType(), "region") == 0) + fprintf(fout, "PROPDEF REGION %s ", p->propName()); + else if (strcmp(p->propType(), "nondefaultrule") == 0) + fprintf(fout, "PROPDEF NONDEFAULTRULE %s ", p->propName()); + if (p->dataType() == 'I') + fprintf(fout, "INT "); + if (p->dataType() == 'R') + fprintf(fout, "REAL "); + if (p->dataType() == 'S') + fprintf(fout, "STR "); + if (p->dataType() == 'Q') + fprintf(fout, "STR "); + if (p->hasRange()) { + fprintf(fout, "RANGE %g %g ", checkDouble(p->left()), + checkDouble(p->right())); + } + if (p->hasNumber()) + fprintf(fout, "%g ", checkDouble(p->number())); + if (p->hasString()) + fprintf(fout, "\"%s\" ", p->string()); + fprintf(fout, "\n"); + + return 0; +} + + +// History +int hist(defrCallbackType_e c, const char* h, defiUserData ud) { + checkType(c); + if (ud != userData) dataError(); + fprintf(fout, "HIST %s\n", h); + return 0; +} + + +// Busbitchars +int bbn(defrCallbackType_e c, const char* h, defiUserData ud) { + checkType(c); + if (ud != userData) dataError(); + fprintf(fout, "BUSBITCHARS \"%s\" \n", h); + return 0; +} + + +// Version +int vers(defrCallbackType_e c, double d, defiUserData ud) { + checkType(c); + if (ud != userData) dataError(); + fprintf(fout, "VERSION %g\n", d); + + curVer = d; + return 0; +} + + +// Units +int units(defrCallbackType_e c, double d, defiUserData ud) { + checkType(c); + if (ud != userData) dataError(); + fprintf(fout, "UNITS DISTANCE MICRONS %g\n", checkDouble(d)); + return 0; +} + + +// Casesensitive +int casesens(defrCallbackType_e c, int d, defiUserData ud) { + checkType(c); + if (ud != userData) dataError(); + if (d == 1) + fprintf(fout, "NAMESCASESENSITIVE OFF\n", d); + else + fprintf(fout, "NAMESCASESENSITIVE ON\n", d); + return 0; +} + + +// Site, Canplace, Cannotoccupy, Diearea, Pin, Pincap, DefaultCap, +// Row, Gcellgrid, Track, Via, Scanchain, IOtiming, Flooplan, +// Region, Group, TiminDisable, Pin property +int cls(defrCallbackType_e c, void* cl, defiUserData ud) { + defiSite* site; // Site and Canplace and CannotOccupy + defiBox* box; // DieArea and + defiPinCap* pc; + defiPin* pin; + int i, j, k; + defiRow* row; + defiTrack* track; + defiGcellGrid* gcg; + defiVia* via; + defiRegion* re; + defiGroup* group; + defiComponentMaskShiftLayer* maskShiftLayer = NULL; + defiScanchain* sc; + defiIOTiming* iot; + defiFPC* fpc; + defiTimingDisable* td; + defiPartition* part; + defiPinProp* pprop; + defiBlockage* block; + defiSlot* slot; + defiFill* fill; + defiStyles* styles; + int xl, yl, xh, yh; + char *name, *a1, *b1; + char **inst, **inPin, **outPin; + int *bits; + int size; + int corner, typ; + const char *itemT; + char dir; + defiPinAntennaModel* aModel; + char *tmpPinName = NULL; + char *extraPinName = NULL; + char *pName = NULL; + char *tmpName = NULL; + struct defiPoints points; + + checkType(c); + if (ud != userData) dataError(); + switch (c) { + + case defrSiteCbkType : + site = (defiSite*)cl; + fprintf(fout, "SITE %s %g %g %s ", site->name(), + checkDouble(site->x_orig()), checkDouble(site->y_orig()), + site->orientStr()); + fprintf(fout, "DO %g BY %g STEP %g %g\n", + checkDouble(site->x_num()), checkDouble(site->y_num()), + checkDouble(site->x_step()), checkDouble(site->y_step())); + break; + case defrCanplaceCbkType : + site = (defiSite*)cl; + fprintf(fout, "CANPLACE %s %g %g %s ", site->name(), + checkDouble(site->x_orig()), checkDouble(site->y_orig()), + site->orientStr()); + fprintf(fout, "DO %g BY %g STEP %g %g\n", + checkDouble(site->x_num()), checkDouble(site->y_num()), + checkDouble(site->x_step()), checkDouble(site->y_step())); + break; + case defrCannotOccupyCbkType : + site = (defiSite*)cl; + fprintf(fout, "CANNOTOCCUPY %s %g %g %s ", + site->name(), checkDouble(site->x_orig()), + checkDouble(site->y_orig()), site->orientStr()); + fprintf(fout, "DO %g BY %g STEP %g %g\n", + checkDouble(site->x_num()), checkDouble(site->y_num()), + checkDouble(site->x_step()), checkDouble(site->y_step())); + break; + case defrDieAreaCbkType : + box = (defiBox*)cl; + fprintf(fout, "DIEAREA"); + points = box->getPoint(); + for (i = 0; i < points.numPoints; i++) + fprintf(fout, " %d %d", points.x[i], points.y[i]); + fprintf(fout, "\n"); + break; + case defrPinCapCbkType : + pc = (defiPinCap*)cl; + fprintf(fout, "DEFCAP MINPINS %d WIRECAP %g\n", pc->pin(), + checkDouble(pc->cap())); + --numObjs; + break; + case defrPinCbkType : + pin = (defiPin*)cl; + pName = strdup((char*)pin->pinName()); // get the pinName + // check if there has .extra in the pName and ignorePE + // is set to 1 + if (ignorePE) { + // check if .extra is in the name, if it is, ignore it + if ((extraPinName = strstr(pName, ".extra")) == NULL) + tmpPinName = pName; + else { + // make sure name ends with .extraNNN + tmpName = extraPinName; + extraPinName = extraPinName + 6; + *tmpName = '\0'; + tmpPinName = pName; + if (extraPinName != NULL) { + while (*extraPinName != '\0' && *extraPinName != '\n') { + if (isdigit(*extraPinName++)) + continue; + else { // Name does not end only .extraNNN + tmpPinName = strdup(pin->pinName()); + break; + } + } + } + } + } else + tmpPinName = pName; + fprintf(fout, "PIN %s + NET %s ", tmpPinName, + pin->netName()); + if (pin->hasDirection()) + fprintf(fout, "+ DIRECTION %s ", pin->direction()); + if (pin->hasUse()) + fprintf(fout, "+ USE %s ", pin->use()); + if (pin->hasNetExpr()) + fprintf(fout, "+ NETEXPR %s", pin->netExpr()); + if (pin->hasSupplySensitivity()) + fprintf(fout, "+ SUPPLYSENSITIVITY %s ", pin->supplySensitivity()); + if (pin->hasGroundSensitivity()) + fprintf(fout, "+ GROUNDSENSITIVITY %s ", pin->groundSensitivity()); + if (pin->hasLayer()) { + for (i = 0; i < pin->numLayer(); i++) { + fprintf(fout, "+ LAYER %s ", pin->layer(i)); + if (pin->layerMask(i)) + fprintf(fout, "MASK %d ", + pin->layerMask(i)); + if (pin->hasLayerSpacing(i)) + fprintf(fout, "SPACING %d ", + pin->layerSpacing(i)); + if (pin->hasLayerDesignRuleWidth(i)) + fprintf(fout, "DESIGNRULEWIDTH %d ", + pin->layerDesignRuleWidth(i)); + pin->bounds(i, &xl, &yl, &xh, &yh); + fprintf(fout, "( %d %d ) ( %d %d ) ", xl, yl, xh, yh); + } + for (i = 0; i < pin->numPolygons(); i++) { + fprintf(fout, "+ POLYGON %s", pin->polygonName(i)); + if (pin->polygonMask(i)) + fprintf(fout, "MASK %d ", + pin->polygonMask(i)); + if (pin->hasPolygonSpacing(i)) + fprintf(fout, "SPACING %d ", + pin->polygonSpacing(i)); + if (pin->hasPolygonDesignRuleWidth(i)) + fprintf(fout, "DESIGNRULEWIDTH %d ", + pin->polygonDesignRuleWidth(i)); + points = pin->getPolygon(i); + for (k = 0; k < points.numPoints; k++) + fprintf(fout, " %d %d", points.x[k], points.y[k]); + } + for (i = 0; i < pin->numVias(); i++) { + if (pin->viaTopMask(i) || pin->viaCutMask(i) || pin->viaBottomMask(i)) { + fprintf(fout, "\nVIA %s MASK %d%d%d %d %d ", + pin->viaName(i), + pin->viaTopMask(i), + pin->viaCutMask(i), + pin->viaBottomMask(i), + pin->viaPtX(i), + pin->viaPtY(i)); + } else { + fprintf(fout, "\nVIA %s %d %d ", pin->viaName(i), + pin->viaPtX(i), pin->viaPtY(i)); + } + } + } + if (pin->hasPlacement()) { + if (pin->isPlaced()) + fprintf(fout, " PLACED "); + if (pin->isCover()) + fprintf(fout, " COVER "); + if (pin->isFixed()) + fprintf(fout, " FIXED "); + fprintf(fout, "( %d %d ) %s ", pin->placementX(), + pin->placementY(), pin->orientStr()); + } + if (pin->hasSpecial()) + fprintf(fout, " SPECIAL "); + fprintf(fout, "\n"); + + if (pin->hasPort()) { + struct defiPoints points; + defiPinPort* port; + for (j = 0; j < pin->numPorts(); j++) { + fprintf(fout, "PIN %s", tmpPinName); + port = pin->pinPort(j); + fprintf(fout, " + PORT"); + for (i = 0; i < port->numLayer(); i++) { + fprintf(fout, "+ LAYER %s", port->layer(i)); + if (port->layerMask(i)) + fprintf(fout, "MASK %d ", + port->layerMask(i)); + if (port->hasLayerSpacing(i)) + fprintf(fout, " SPACING %d", port->layerSpacing(i)); + if (port->hasLayerDesignRuleWidth(i)) + fprintf(fout, " DESIGNRULEWIDTH %d", + port->layerDesignRuleWidth(i)); + port->bounds(i, &xl, &yl, &xh, &yh); + fprintf(fout, " %d %d %d %d", xl, yl, xh, yh); + } + for (i = 0; i < port->numPolygons(); i++) { + fprintf(fout, " + POLYGON %s", port->polygonName(i)); + if (port->polygonMask(i)) + fprintf(fout, "MASK %d ", + port->polygonMask(i)); + if (port->hasPolygonSpacing(i)) + fprintf(fout, " SPACING %d", port->polygonSpacing(i)); + if (port->hasPolygonDesignRuleWidth(i)) + fprintf(fout, " DESIGNRULEWIDTH %d", + port->polygonDesignRuleWidth(i)); + points = port->getPolygon(i); + for (k = 0; k < points.numPoints; k++) + fprintf(fout, " %d %d", points.x[k], points.y[k]); + } + for (i = 0; i < port->numVias(); i++) { + if (port->viaTopMask(i) || port->viaCutMask(i) + || port->viaBottomMask(i)) { + fprintf(fout, "\n VIA %s MASK %d%d%d ( %d %d ) ", + port->viaName(i), + port->viaTopMask(i), + port->viaCutMask(i), + port->viaBottomMask(i), + port->viaPtX(i), + port->viaPtY(i)); + } else { + fprintf(fout, " VIA %s ( %d %d ) ", port->viaName(i), + port->viaPtX(i), port->viaPtY(i)); + } + } + if (port->hasPlacement()) { + if (port->isPlaced()) { + fprintf(fout, " + PLACED"); + fprintf(fout, " %d %d %d ", port->placementX(), + port->placementY(), port->orient()); + } + if (port->isCover()) { + fprintf(fout, " + COVER"); + fprintf(fout, " %d %d %d ", port->placementX(), + port->placementY(), port->orient()); + } + if (port->isFixed()) { + fprintf(fout, " + FIXED"); + fprintf(fout, " %d %d %d", port->placementX(), + port->placementY(), port->orient()); + } + } + fprintf(fout,"\n"); + } + } + if (pin->hasAPinPartialMetalArea()) { + fprintf(fout, "PIN %s + NET %s ", tmpPinName, + pin->netName()); + for (i = 0; i < pin->numAPinPartialMetalArea(); i++) { + fprintf(fout, " ANTPINPARTIALMETALAREA %d ", + pin->APinPartialMetalArea(i)); + if (*(pin->APinPartialMetalAreaLayer(i))) + fprintf(fout, " %s ", pin->APinPartialMetalAreaLayer(i)); + } + fprintf(fout, "\n"); + } + if (pin->hasAPinPartialMetalSideArea()) { + fprintf(fout, "PIN %s + NET %s ", tmpPinName, + pin->netName()); + for (i = 0; i < pin->numAPinPartialMetalSideArea(); i++) { + fprintf(fout, "ANTPINPARTIALMETALSIDEAREA %d", + pin->APinPartialMetalSideArea(i)); + if (*(pin->APinPartialMetalSideAreaLayer(i))) + fprintf(fout, " %s", pin->APinPartialMetalSideAreaLayer(i)); + } + fprintf(fout, "\n"); + } + if (pin->hasAPinPartialCutArea()) { + fprintf(fout, "PIN %s + NET %s ", tmpPinName, + pin->netName()); + for (i = 0; i < pin->numAPinPartialCutArea(); i++) { + fprintf(fout, "ANTPINPARTIALCUTAREA %d", + pin->APinPartialCutArea(i)); + if (*(pin->APinPartialCutAreaLayer(i))) + fprintf(fout, " %s", pin->APinPartialCutAreaLayer(i)); + } + fprintf(fout, "\n"); + } + if (pin->hasAPinDiffArea()) { + fprintf(fout, "PIN %s + NET %s ", tmpPinName, + pin->netName()); + for (i = 0; i < pin->numAPinDiffArea(); i++) { + fprintf(fout, "ANTPINDIFFAREA %d", pin->APinDiffArea(i)); + if (*(pin->APinDiffAreaLayer(i))) + fprintf(fout, " %s", pin->APinDiffAreaLayer(i)); + } + fprintf(fout, "\n"); + } + + for (j = 0; j < pin->numAntennaModel(); j++) { + aModel = pin->antennaModel(j); + + if (aModel->hasAPinGateArea()) { + fprintf(fout, "PIN %s + NET %s %s ", tmpPinName, + pin->netName(), aModel->antennaOxide()); + for (i = 0; i < aModel->numAPinGateArea(); + i++) { + fprintf(fout, "ANTPINGATEAREA %d", aModel->APinGateArea(i)); + if (*(aModel->APinGateAreaLayer(i))) + fprintf(fout, " %s", aModel->APinGateAreaLayer(i)); + } + fprintf(fout, "\n"); + } + if (aModel->hasAPinMaxAreaCar()) { + fprintf(fout, "PIN %s + NET %s %s ", tmpPinName, + pin->netName(), aModel->antennaOxide()); + for (i = 0; i < + aModel->numAPinMaxAreaCar(); i++) { + fprintf(fout, "ANTPINMAXAREACAR %d", + aModel->APinMaxAreaCar(i)); + if (*(aModel->APinMaxAreaCarLayer(i))) + fprintf(fout, " %s", aModel->APinMaxAreaCarLayer(i)); + } + fprintf(fout, "\n"); + } + if (aModel->hasAPinMaxSideAreaCar()) { + fprintf(fout, "PIN %s + NET %s %s ", tmpPinName, + pin->netName(), aModel->antennaOxide()); + for (i = 0; + i < aModel->numAPinMaxSideAreaCar(); + i++) { + fprintf(fout, "ANTPINMAXSIDEAREACAR %d", + aModel->APinMaxSideAreaCar(i)); + if (*(aModel->APinMaxSideAreaCarLayer(i))) + fprintf(fout, " %s", aModel->APinMaxSideAreaCarLayer(i)); + } + fprintf(fout, "\n"); + } + if (aModel->hasAPinMaxCutCar()) { + fprintf(fout, "PIN %s + NET %s %s ", tmpPinName, + pin->netName(), aModel->antennaOxide()); + for (i = 0; i < aModel->numAPinMaxCutCar(); + i++) { + fprintf(fout, "ANTPINMAXCUTCAR %d", + aModel->APinMaxCutCar(i)); + if (*(aModel->APinMaxCutCarLayer(i))) + fprintf(fout, " %s", aModel->APinMaxCutCarLayer(i)); + } + fprintf(fout, "\n"); + } + } + if (tmpPinName) + free(tmpPinName); + --numObjs; + break; + case defrDefaultCapCbkType : + i = (long)cl; + fprintf(fout, "DEFAULTCAP %d\n", i); + numObjs = i; + break; + case defrRowCbkType : + row = (defiRow*)cl; + if (ignoreRN) // PCR 716759, if flag is set don't bother with name + fprintf(fout, "ROW %s %g %g %d", + row->macro(), checkDouble(row->x()), checkDouble(row->y()), + row->orient()); + else + fprintf(fout, "ROW %s %s %g %g %d", row->name(), + row->macro(), checkDouble(row->x()), checkDouble(row->y()), + row->orient()); + if (row->hasDo()) { + fprintf(fout, " DO %g BY %g", + checkDouble(row->xNum()), checkDouble(row->yNum())); + if (row->hasDoStep()) + fprintf(fout, " STEP %g %g\n", + checkDouble(row->xStep()), checkDouble(row->yStep())); + } + fprintf(fout, "\n"); + if (row->numProps() > 0) { + if (ignoreRN) { + for (i = 0; i < row->numProps(); i++) + fprintf(fout, "ROW PROP %s %s\n", + row->propName(i), row->propValue(i)); + } else { + for (i = 0; i < row->numProps(); i++) + fprintf(fout, "ROW %s PROP %s %s\n", row->name(), + row->propName(i), row->propValue(i)); + } + } + break; + case defrTrackCbkType : + track = (defiTrack*)cl; + /*if (track->firstTrackMask()) { + if (track->sameMask()) { + fprintf(fout, "TRACKS %s %g DO %g STEP %g MASK %d SAMEMASK LAYER ", + track->macro(), track->x(), + track->xNum(), track->xStep(), + track->firstTrackMask()); + } else { + fprintf(fout, "TRACKS %s %g DO %g STEP %g MASK %d LAYER ", + track->macro(), track->x(), + track->xNum(), track->xStep(), + track->firstTrackMask()); + } + } else { + fprintf(fout, "TRACKS %s %g DO %g STEP %g LAYER ", + track->macro(), track->x(), + track->xNum(), track->xStep()); + } */ + for (i = 0; i < track->numLayers(); i++) { + if (track->firstTrackMask()) { + if (track->sameMask()) { + fprintf(fout, "TRACKS %s %g DO %g STEP %g MASK %d SAMEMASK LAYER %s\n", + track->macro(), track->x(), + track->xNum(), track->xStep(), + track->firstTrackMask(), track->layer(i)); + } else { + fprintf(fout, "TRACKS %s %g DO %g STEP %g MASK %d LAYER %s\n", + track->macro(), track->x(), + track->xNum(), track->xStep(), + track->firstTrackMask(), + track->layer(i)); + } + } else { + fprintf(fout, "TRACKS %s %g DO %g STEP %g LAYER %s\n", + track->macro(), track->x(), + track->xNum(), track->xStep(), + track->layer(i)); + } + } + break; + case defrGcellGridCbkType : + gcg = (defiGcellGrid*)cl; + fprintf(fout, "GCELLGRID %s %d DO %d STEP %g\n", + gcg->macro(), gcg->x(), + gcg->xNum(), + checkDouble(gcg->xStep())); + break; + case defrViaCbkType : + via = (defiVia*)cl; + fprintf(fout, "VIA %s ", via->name()); + if (via->hasPattern()) + fprintf(fout, " PATTERNNAME %s\n", via->pattern()); + else + fprintf(fout, "\n"); + for (i = 0; i < via->numLayers(); i++) { + via->layer(i, &name, &xl, &yl, &xh, &yh); + int rectMask = via->rectMask(i); + + if (rectMask) { + fprintf(fout, "VIA %s RECT %s MASK %d ( %d %d ) ( %d %d ) \n", + via->name(), name, rectMask, xl, yl, xh, yh); + } else { + fprintf(fout, "VIA %s RECT %s ( %d %d ) ( %d %d ) \n", via->name(), + name, xl, yl, xh, yh); + } + } + // POLYGON + if (via->numPolygons()) { + struct defiPoints points; + for (i = 0; i < via->numPolygons(); i++) { + int polyMask = via->polyMask(i); + + if (polyMask) { + fprintf(fout, "\n POLYGON %s MASK %d ", + via->polygonName(i), polyMask); + } else { + fprintf(fout, "\n POLYGON %s ", via->polygonName(i)); + } + points = via->getPolygon(i); + for (j = 0; j < points.numPoints; j++) + fprintf(fout, "%d %d ", points.x[j], points.y[j]); + } + fprintf(fout, " \n"); + } + + if (via->hasViaRule()) { + char *vrn, *bl, *cl, *tl; + int xs, ys, xcs, ycs, xbe, ybe, xte, yte; + int cr, cc, xo, yo, xbo, ybo, xto, yto; + (void)via->viaRule(&vrn, &xs, &ys, &bl, &cl, &tl, &xcs, + &ycs, &xbe, &ybe, &xte, &yte); + fprintf(fout, "VIA %s VIARULE %s CUTSIZE %d %d LAYERS %s %s %s", + via->name(), vrn, xs, ys, bl, cl, tl); + fprintf(fout, " CUTSPACING %d %d ENCLOSURE %d %d %d %d", xcs, ycs, + xbe, ybe, xte, yte); + if (via->hasRowCol()) { + (void)via->rowCol(&cr, &cc); + fprintf(fout, " ROWCOL %d %d", cr, cc); + } + if (via->hasOrigin()) { + (void)via->origin(&xo, &yo); + fprintf(fout, " ORIGIN %d %d", xo, yo); + } + if (via->hasOffset()) { + (void)via->offset(&xbo, &ybo, &xto, &yto); + fprintf(fout, " OFFSET %d %d %d %d", xbo, ybo, xto, yto); + } + if (via->hasCutPattern()) + fprintf(fout, " PATTERN %s", via->cutPattern()); + fprintf(fout, "\n"); + } + --numObjs; + break; + case defrRegionCbkType : + re = (defiRegion*)cl; + for (i = 0; i < re->numRectangles(); i++) + fprintf(fout, "REGION %s ( %d %d ) ( %d %d )\n",re->name(), + re->xl(i), re->yl(i), re->xh(i), re->yh(i)); + if (re->hasType()) + fprintf(fout, "REGION %s TYPE %s\n",re->name(), re->type()); + --numObjs; + break; + case defrGroupCbkType : + group = (defiGroup*)cl; + fprintf(fout, "GROUP %s ", group->name()); + if (group->hasMaxX() | group->hasMaxY() + | group->hasPerim()) { + fprintf(fout, "SOFT "); + if (group->hasPerim()) + fprintf(fout, "MAXHALFPERIMETER %d ", + group->perim()); + if (group->hasMaxX()) + fprintf(fout, "MAXX %d ", group->maxX()); + if (group->hasMaxY()) + fprintf(fout, "MAXY %d ", group->maxY()); + } + if (group->hasRegionName()) + fprintf(fout, "REGION %s ", group->regionName()); + if (group->hasRegionBox()) { + int *gxl, *gyl, *gxh, *gyh; + int size; + group->regionRects(&size, &gxl, &gyl, &gxh, &gyh); + for (i = 0; i < size; i++) + fprintf(fout, "REGION (%d %d) (%d %d) ", gxl[i], gyl[i], + gxh[i], gyh[i]); + } + fprintf(fout, "\n"); + --numObjs; + break; + case defrComponentMaskShiftLayerCbkType : + fprintf(fout, "COMPONENTMASKSHIFT "); + + for (i = 0; i < maskShiftLayer->numMaskShiftLayers(); i++) { + fprintf(fout, "%s ", maskShiftLayer->maskShiftLayer(i)); + } + fprintf(fout, ";\n"); + break; + case defrScanchainCbkType : + sc = (defiScanchain*)cl; + fprintf(fout, "SCANCHAINS %s", sc->name()); + if (sc->hasStart()) { + sc->start(&a1, &b1); + fprintf(fout, " START %s %s", sc->name(), a1, b1); + } + if (sc->hasStop()) { + sc->stop(&a1, &b1); + fprintf(fout, " STOP %s %s", sc->name(), a1, b1); + } + if (sc->hasCommonInPin() || + sc->hasCommonOutPin()) { + fprintf(fout, " COMMONSCANPINS ", sc->name()); + if (sc->hasCommonInPin()) + fprintf(fout, " ( IN %s )", sc->commonInPin()); + if (sc->hasCommonOutPin()) + fprintf(fout, " ( OUT %s )",sc->commonOutPin()); + } + fprintf(fout, "\n"); + if (sc->hasFloating()) { + sc->floating(&size, &inst, &inPin, &outPin, &bits); + for (i = 0; i < size; i++) { + fprintf(fout, "SCANCHAINS %s FLOATING %s", sc->name(), inst[i]); + if (inPin[i]) + fprintf(fout, " IN %s", inPin[i]); + if (outPin[i]) + fprintf(fout, " OUT %s", outPin[i]); + if (bits[i] != -1) + fprintf(fout, " BITS %d", bits[i]); + fprintf(fout, "\n"); + } + } + + if (sc->hasOrdered()) { + for (i = 0; i < sc->numOrderedLists(); i++) { + sc->ordered(i, &size, &inst, &inPin, &outPin, &bits); + for (j = 0; j < size; j++) { + fprintf(fout, "SCANCHAINS %s ORDERED %s", sc->name(), + inst[j]); + if (inPin[j]) + fprintf(fout, " IN %s", inPin[j]); + if (outPin[j]) + fprintf(fout, " OUT %s", outPin[j]); + if (bits[j] != -1) + fprintf(fout, " BITS %d", bits[j]); + fprintf(fout, "\n"); + } + } + } + + if (sc->hasPartition()) { + fprintf(fout, "SCANCHAINS %s PARTITION %s", sc->name(), + sc->partitionName()); + if (sc->hasPartitionMaxBits()) + fprintf(fout, " MAXBITS %d", sc->partitionMaxBits()); + } + fprintf(fout, "\n"); + --numObjs; + break; + case defrIOTimingCbkType : + iot = (defiIOTiming*)cl; + fprintf(fout, "IOTIMING ( %s %s )\n", iot->inst(), iot->pin()); + if (iot->hasSlewRise()) + fprintf(fout, "IOTIMING %s RISE SLEWRATE %g %g\n", iot->inst(), + checkDouble(iot->slewRiseMin()), + checkDouble(iot->slewRiseMax())); + if (iot->hasSlewFall()) + fprintf(fout, "IOTIMING %s FALL SLEWRATE %g %g\n", iot->inst(), + checkDouble(iot->slewFallMin()), + checkDouble(iot->slewFallMax())); + if (iot->hasVariableRise()) + fprintf(fout, "IOTIMING %s RISE VARIABLE %g %g\n", iot->inst(), + checkDouble(iot->variableRiseMin()), + checkDouble(iot->variableRiseMax())); + if (iot->hasVariableFall()) + fprintf(fout, "IOTIMING %s FALL VARIABLE %g %g\n", iot->inst(), + checkDouble(iot->variableFallMin()), + checkDouble(iot->variableFallMax())); + if (iot->hasCapacitance()) + fprintf(fout, "IOTIMING %s CAPACITANCE %g\n", iot->inst(), + checkDouble(iot->capacitance())); + if (iot->hasDriveCell()) { + fprintf(fout, "IOTIMING %s DRIVECELL %s ", iot->inst(), + iot->driveCell()); + if (iot->hasFrom()) + fprintf(fout, " FROMPIN %s ", + iot->from()); + if (iot->hasTo()) + fprintf(fout, " TOPIN %s ", + iot->to()); + if (iot->hasParallel()) + fprintf(fout, "PARALLEL %g", checkDouble(iot->parallel())); + fprintf(fout, "\n"); + } + --numObjs; + break; + case defrFPCCbkType : + fpc = (defiFPC*)cl; + fprintf(fout, "FLOORPLAN %s ", fpc->name()); + if (fpc->isVertical()) + fprintf(fout, "VERTICAL "); + if (fpc->isHorizontal()) + fprintf(fout, "HORIZONTAL "); + if (fpc->hasAlign()) + fprintf(fout, "ALIGN "); + if (fpc->hasMax()) + fprintf(fout, "%g ", checkDouble(fpc->alignMax())); + if (fpc->hasMin()) + fprintf(fout, "%g ", checkDouble(fpc->alignMin())); + if (fpc->hasEqual()) + fprintf(fout, "%g ", checkDouble(fpc->equal())); + for (i = 0; i < fpc->numParts(); i++) { + fpc->getPart(i, &corner, &typ, &name); + if (corner == 'B') + fprintf(fout, "BOTTOMLEFT "); + else + fprintf(fout, "TOPRIGHT "); + if (typ == 'R') + fprintf(fout, "ROWS %s ", name); + else + fprintf(fout, "COMPS %s ", name); + } + fprintf(fout, "\n"); + --numObjs; + break; + case defrTimingDisableCbkType : + td = (defiTimingDisable*)cl; + if (td->hasFromTo()) fprintf(fout, "TIMINGDISABLE FROMPIN %s %s ", td->fromInst(), td->fromPin(), td->toInst(), td->toPin()); if (td->hasThru()) + fprintf(fout, " THRUPIN %s %s ", td->thruInst(), td->thruPin()); + if (td->hasMacroFromTo()) + fprintf(fout, " MACRO %s FROMPIN %s %s ", td->macroName(), + td->fromPin(), td->toPin()); + if (td->hasMacroThru()) + fprintf(fout, " MACRO %s THRUPIN %s %s ", td->macroName(), + td->fromPin()); + fprintf(fout, "\n"); + break; + case defrPartitionCbkType : + part = (defiPartition*)cl; + fprintf(fout, "PARTITION %s ", part->name()); + if (part->isSetupRise() | part->isSetupFall() | part->isHoldRise() | + part->isHoldFall()) { + // has turnoff + fprintf(fout, "TURNOFF "); + if (part->isSetupRise()) + fprintf(fout, "SETUPRISE "); + if (part->isSetupFall()) + fprintf(fout, "SETUPFALL "); + if (part->isHoldRise()) + fprintf(fout, "HOLDRISE "); + if (part->isHoldFall()) + fprintf(fout, "HOLDFALL "); + } + itemT = part->itemType(); + dir = part->direction(); + if (strcmp(itemT, "CLOCK") == 0) { + if (dir == 'T') // toclockpin + fprintf(fout, " TOCLOCKPIN %s %s ", part->instName(), + part->pinName()); + if (dir == 'F') // fromclockpin + fprintf(fout, " FROMCLOCKPIN %s %s ", part->instName(), + part->pinName()); + if (part->hasMin()) + fprintf(fout, "MIN %g %g ", + checkDouble(part->partitionMin()), + checkDouble(part->partitionMax())); + if (part->hasMax()) + fprintf(fout, "MAX %g %g ", + checkDouble(part->partitionMin()), + checkDouble(part->partitionMax())); + fprintf(fout, "PINS "); + for (i = 0; i < part->numPins(); i++) + fprintf(fout, "%s ", part->pin(i)); + } else if (strcmp(itemT, "IO") == 0) { + if (dir == 'T') // toiopin + fprintf(fout, " TOIOPIN %s %s ", part->instName(), + part->pinName()); + if (dir == 'F') // fromiopin + fprintf(fout, " FROMIOPIN %s %s ", part->instName(), + part->pinName()); + } else if (strcmp(itemT, "COMP") == 0) { + if (dir == 'T') // tocomppin + fprintf(fout, " TOCOMPPIN %s %s ", part->instName(), + part->pinName()); + if (dir == 'F') // fromcomppin + fprintf(fout, " FROMCOMPPIN %s %s ", part->instName(), + part->pinName()); + } + fprintf(fout, "\n"); + --numObjs; + break; + + case defrPinPropCbkType : + pprop = (defiPinProp*)cl; + if (pprop->isPin()) + fprintf(fout, "PINPROP PIN %s ", pprop->pinName()); + else + fprintf(fout, "PINPROP %s %s ", pprop->instName(), + pprop->pinName()); + fprintf(fout, "\n"); + if (pprop->numProps() > 0) { + for (i = 0; i < pprop->numProps(); i++) { + fprintf(fout, "PINPROP PIN %s PROP %s %s\n", + pprop->pinName(), pprop->propName(i), + pprop->propValue(i)); + } + } + --numObjs; + break; + + case defrBlockageCbkType : + block = (defiBlockage*)cl; + if (block->hasLayer()) { + fprintf(fout, "BLOCKAGE LAYER %s", block->layerName()); + if (block->hasComponent()) + fprintf(fout, " COMP %s", block->layerComponentName()); + if (block->hasSlots()) + fprintf(fout, " SLOTS"); + if (block->hasFills()) + fprintf(fout, " FILLS"); + if (block->hasPushdown()) + fprintf(fout, " PUSHDOWN"); + if (block->hasExceptpgnet()) + fprintf(fout, " EXCEPTPGNET"); + if (block->hasMask()) + fprintf(fout, " MASK %d", block->mask()); + if (block->hasSpacing()) + fprintf(fout, " SPACING %d", + block->minSpacing()); + if (block->hasDesignRuleWidth()) + fprintf(fout, " DESIGNRULEWIDTH %d", block->designRuleWidth()); + fprintf(fout, "\n"); + for (i = 0; i < block->numRectangles(); i++) { + fprintf(fout, "BLOCKAGE LAYER %s RECT %d %d %d %d\n", + block->layerName(), block->xl(i), block->yl(i), + block->xh(i), block->yh(i)); + } + for (i = 0; i < block->numPolygons(); i++) { + fprintf(fout, "BLOCKAGE LAYER %s POLYGON", block->layerName()); + points = block->getPolygon(i); + for (j = 0; j < points.numPoints; j++) + fprintf(fout, "%d %d ", points.x[j], points.y[j]); + fprintf(fout, "\n"); + } + } + else if (block->hasPlacement()) { + fprintf(fout, "BLOCKAGE PLACEMENT"); + if (block->hasSoft()) + fprintf(fout, " SOFT"); + if (block->hasPartial()) + fprintf(fout, " PARTIAL %g", block->placementMaxDensity()); + if (block->hasComponent()) + fprintf(fout, " COMP %s", block->layerComponentName()); + if (block->hasPushdown()) + fprintf(fout, " PUSHDOWN"); + fprintf(fout, "\n"); + for (i = 0; i < block->numRectangles(); i++) { + fprintf(fout, "BLOCKAGE PLACEMENT RECT %d %d %d %d\n", + block->xl(i), block->yl(i), + block->xh(i), block->yh(i)); + } + } + --numObjs; + break; + + case defrSlotCbkType : + slot = (defiSlot*)cl; + for (i = 0; i < slot->numRectangles(); i++) { + fprintf(fout, "SLOT LAYER %s", slot->layerName()); + fprintf(fout, " RECT %d %d %d %d\n", + slot->xl(i), slot->yl(i), + slot->xh(i), slot->yh(i)); + } + for (i = 0; i < slot->numPolygons(); i++) { + fprintf(fout, "SLOT LAYER %s POLYGON"); + points = slot->getPolygon(i); + for (j = 0; j < points.numPoints; j++) + fprintf(fout, " %d %d", points.x[j], points.y[j]); + fprintf(fout, "\n"); + } + --numObjs; + break; + + case defrFillCbkType : + fill = (defiFill*)cl; + for (i = 0; i < fill->numRectangles(); i++) { + fprintf(fout, "FILL LAYER %s", fill->layerName()); + if (fill->layerMask()) { + fprintf(fout, " MASK %d", fill->layerMask()); + } + if (fill->hasLayerOpc()) + fprintf(fout, " OPC"); + fprintf(fout, " RECT %d %d %d %d\n", + fill->xl(i), fill->yl(i), + fill->xh(i), fill->yh(i)); + } + for (i = 0; i < fill->numPolygons(); i++) { + fprintf(fout, "FILL LAYER %s POLYGON", fill->layerName()); + points = fill->getPolygon(i); + for (j = 0; j < points.numPoints; j++) + fprintf(fout, " %d %d", points.x[j], points.y[j]); + fprintf(fout, "\n"); + } + if (fill->hasVia()) { + fprintf(fout, "FILL VIA %s", fill->viaName()); + if (fill->viaTopMask() || fill->viaCutMask() + || fill->viaBottomMask()) { + fprintf(fout, " MASK %d%d%d", + fill->viaTopMask(), + fill->viaCutMask(), + fill->viaBottomMask()); + } + if (fill->hasViaOpc()) + fprintf(fout, " OPC\n"); + for (i = 0; i < fill->numViaPts(); i++) { + points = fill->getViaPts(i); + for (j = 0; j < points.numPoints; j++) + fprintf(fout, " %d %d", points.x[j], points.y[j]); + } + fprintf(fout, "\n"); + } + --numObjs; + break; + + case defrStylesCbkType : + styles = (defiStyles*)cl; + fprintf(fout, "STYLE %d", styles->style()); + points = styles->getPolygon(); + for (j = 0; j < points.numPoints; j++) + fprintf(fout, " %d %d", points.x[j], points.y[j]); + fprintf(fout, "\n"); + --numObjs; + break; + + default: fprintf(fout, "BOGUS callback to cls.\n"); return 1; + } + return 0; +} + + +int dn(defrCallbackType_e c, const char* h, defiUserData ud) { + checkType(c); + if (ud != userData) dataError(); + fprintf(fout, "DIVIDERCHAR \"%s\" \n",h); + return 0; +} + + +int ext(defrCallbackType_e t, const char* c, defiUserData ud) { + char* name; + + checkType(t); + if (ud != userData) dataError(); + + switch (t) { + case defrNetExtCbkType : name = address("net"); break; + case defrComponentExtCbkType : name = address("component"); break; + case defrPinExtCbkType : name = address("pin"); break; + case defrViaExtCbkType : name = address("via"); break; + case defrNetConnectionExtCbkType : name = address("net connection"); break; + case defrGroupExtCbkType : name = address("group"); break; + case defrScanChainExtCbkType : name = address("scanchain"); break; + case defrIoTimingsExtCbkType : name = address("io timing"); break; + case defrPartitionsExtCbkType : name = address("partition"); break; + default: name = address("BOGUS"); return 1; + } + fprintf(fout, "EXTENSION %s %s\n", name, c); + return 0; +} + +//======== + +int diffDefReadFile(char* inFile, char* outFile, char* ignorePinExtra, + char* ignoreRowName, char* ignoreViaName, char* netSegComp) { + FILE* f; + int res; + + userData = (void*)0x01020304; + defrInit(); + + defrSetDesignCbk(dname); + defrSetTechnologyCbk(tname); + defrSetPropCbk(prop); + defrSetNetCbk(netf); + defrSetSNetCbk(snetf); + defrSetComponentMaskShiftLayerCbk(compMSL); + defrSetComponentCbk(compf); + defrSetAddPathToNet(); + defrSetHistoryCbk(hist); + defrSetConstraintCbk(constraint); + defrSetAssertionCbk(constraint); + defrSetDividerCbk(dn); + defrSetBusBitCbk(bbn); + defrSetNonDefaultCbk(ndr); + + // All of the extensions point to the same function. + defrSetNetExtCbk(ext); + defrSetComponentExtCbk(ext); + defrSetPinExtCbk(ext); + defrSetViaExtCbk(ext); + defrSetNetConnectionExtCbk(ext); + defrSetGroupExtCbk(ext); + defrSetScanChainExtCbk(ext); + defrSetIoTimingsExtCbk(ext); + defrSetPartitionsExtCbk(ext); + + defrSetUnitsCbk(units); + defrSetVersionCbk(vers); + defrSetCaseSensitiveCbk(casesens); + + // The following calls are an example of using one function "cls" + // to be the callback for many DIFFERENT types of constructs. + // We have to cast the function type to meet the requirements + // of each different set function. + defrSetSiteCbk((defrSiteCbkFnType)cls); + defrSetCanplaceCbk((defrSiteCbkFnType)cls); + defrSetCannotOccupyCbk((defrSiteCbkFnType)cls); + defrSetDieAreaCbk((defrBoxCbkFnType)cls); + defrSetPinCapCbk((defrPinCapCbkFnType)cls); + defrSetPinCbk((defrPinCbkFnType)cls); + defrSetPinPropCbk((defrPinPropCbkFnType)cls); + defrSetDefaultCapCbk((defrIntegerCbkFnType)cls); + defrSetRowCbk((defrRowCbkFnType)cls); + defrSetTrackCbk((defrTrackCbkFnType)cls); + defrSetGcellGridCbk((defrGcellGridCbkFnType)cls); + defrSetViaCbk((defrViaCbkFnType)cls); + defrSetRegionCbk((defrRegionCbkFnType)cls); + defrSetGroupCbk((defrGroupCbkFnType)cls); + defrSetScanchainCbk((defrScanchainCbkFnType)cls); + defrSetIOTimingCbk((defrIOTimingCbkFnType)cls); + defrSetFPCCbk((defrFPCCbkFnType)cls); + defrSetTimingDisableCbk((defrTimingDisableCbkFnType)cls); + defrSetPartitionCbk((defrPartitionCbkFnType)cls); + defrSetBlockageCbk((defrBlockageCbkFnType)cls); + defrSetSlotCbk((defrSlotCbkFnType)cls); + defrSetFillCbk((defrFillCbkFnType)cls); + + if (strcmp(ignorePinExtra, "0") != 0) + ignorePE = 1; + + if (strcmp(ignoreRowName, "0") != 0) + ignoreRN = 1; + + if (strcmp(ignoreViaName, "0") != 0) + ignoreVN = 1; + + if (strcmp(netSegComp, "0") != 0) + netSeCmp = 1; + + if ((f = fopen(inFile,"r")) == 0) { + fprintf(stderr,"Couldn't open input file '%s'\n", inFile); + return(2); + } + + if ((fout = fopen(outFile, "w")) == 0) { + fprintf(stderr, "Couldn't open output file '%s'\n", outFile); + fclose(f); + return(2); + } + + res = defrRead(f, inFile, userData, 1); + + fclose(f); + fclose(fout); + + return 0; +} diff --git a/src/def/defdiff/diffDefRW.hpp b/src/def/defdiff/diffDefRW.hpp new file mode 100644 index 00000000..e2305ed2 --- /dev/null +++ b/src/def/defdiff/diffDefRW.hpp @@ -0,0 +1,39 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author$ +// $Revision$ +// $Date$ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#ifndef DIFFDEFRW_H +#define DIFFDEFRW_H + +#include +#include + +int diffDefReadFile(char* inFile, char* outFile, char* ignorePinExtra, + char* ignoreRowName, char* ignoreViaName, char* netSegComp); + +#endif diff --git a/src/def/defdiff/differDef.cpp b/src/def/defdiff/differDef.cpp new file mode 100644 index 00000000..d064feea --- /dev/null +++ b/src/def/defdiff/differDef.cpp @@ -0,0 +1,99 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012 - 2016, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author$ +// $Revision$ +// $Date$ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + + +// This program will diff two lef files or two def files and list the +// different between the two files. This problem is not intend to +// diff a real design. If user runs this program will a big design, +// they may experience long execution time and may even ran out of +// memory. +// +// This program is to give user a feel of whether they are using the +// parser correctly. After they read the lef/def file in, and +// write them back out in lef/def format. +// +// This program support lef/def 5.6. + +#include +#include +#include +#ifdef ibmrs +# include +#endif +#ifndef WIN32 +# include +extern char VersionIdent[]; +#else +char* VersionIdent = "N/A"; +#endif /* not WIN32 */ +#include "defrReader.hpp" +#include "diffDefRW.hpp" + +char * exeName; // use to save the executable name + +// This program requires 3 input, the type of the file, lef or def +// fileName1 and fileName2 +void diffUsage() { + printf("Usage: lefdefdiff -lef|-def fileName1 fileName2 [-o outputFileName]\n"); +} + +int main(int argc, char** argv) { + char *fileName1, *fileName2; // For the filenames to compare + char *defOut1, *defOut2; // For the tmp output files + +#ifdef WIN32 + // Enable two-digit exponent format + _set_output_format(_TWO_DIGIT_EXPONENT); +#endif + + exeName = argv[0]; + + if (argc != 9) { // If pass in from lefdefdiff, argc is + diffUsage(); // always 9: defdiff file1 file2 out1 out2 + return(1); // ignorePinExtra ignoreRowName ignoreViaName + } // newSegCmp + + fileName1 = argv[1]; + fileName2 = argv[2]; + + // Temporary output files, to whole the def file information as + // they are read in. Later these files will be sorted for compare + defOut1 = argv[3]; + defOut2 = argv[4]; + + // def files + printf("Reading file: %s\n", fileName1); + if (diffDefReadFile(fileName1, defOut1, argv[5], argv[6], argv[7], argv[8]) != 0) + return(1); + printf("Reading file: %s\n", fileName2); + if (diffDefReadFile(fileName2, defOut2, argv[5], argv[6], argv[7], argv[8]) != 0) + return(1); + + return (0); +} diff --git a/src/def/defrw/defrw.cpp b/src/def/defrw/defrw.cpp new file mode 100644 index 00000000..c4dac3f0 --- /dev/null +++ b/src/def/defrw/defrw.cpp @@ -0,0 +1,3395 @@ +// ***************************************************************************** +// ***************************************************************************** +// Copyright 2012 - 2017, Cadence Design Systems +// +// This file is part of the Cadence LEF/DEF Open Source +// Distribution, Product Version 5.8. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +// implied. See the License for the specific language governing +// permissions and limitations under the License. +// +// For updates, support, or to become part of the LEF/DEF Community, +// check www.openeda.org for details. +// +// $Author$ +// $Revision$ +// $Date$ +// $State: $ +// ***************************************************************************** +// ***************************************************************************** + +#include +#include +#include +#include +#ifndef WIN32 +# include +#endif /* not WIN32 */ +#include "defrReader.hpp" +#include "defiAlias.hpp" + +char defaultName[64]; +char defaultOut[64]; + +// Global variables +FILE* fout; +void* userData; +int numObjs; +int isSumSet; // to keep track if within SUM +int isProp = 0; // for PROPERTYDEFINITIONS +int begOperand; // to keep track for constraint, to print - as the 1st char +static double curVer = 0; +static int setSNetWireCbk = 0; +static int isSessionless = 0; +static int ignoreRowNames = 0; +static int ignoreViaNames = 0; +static int testDebugPrint = 0; // test for ccr1488696 + +// TX_DIR:TRANSLATION ON + +void myLogFunction(const char* errMsg){ + fprintf(fout, "ERROR: found error: %s\n", errMsg); +} + +void myWarningLogFunction(const char* errMsg){ + fprintf(fout, "WARNING: found error: %s\n", errMsg); +} + +void dataError() { + fprintf(fout, "ERROR: returned user data is not correct!\n"); +} + +void checkType(defrCallbackType_e c) { + if (c >= 0 && c <= defrDesignEndCbkType) { + // OK + } else { + fprintf(fout, "ERROR: callback type is out of bounds!\n"); + } +} + + +int done(defrCallbackType_e c, void*, defiUserData ud) { + checkType(c); + if (ud != userData) dataError(); + fprintf(fout, "END DESIGN\n"); + return 0; +} + +int endfunc(defrCallbackType_e c, void*, defiUserData ud) { + checkType(c); + if (ud != userData) dataError(); + return 0; +} + + +char* orientStr(int orient) { + switch (orient) { + case 0: return ((char*)"N"); + case 1: return ((char*)"W"); + case 2: return ((char*)"S"); + case 3: return ((char*)"E"); + case 4: return ((char*)"FN"); + case 5: return ((char*)"FW"); + case 6: return ((char*)"FS"); + case 7: return ((char*)"FE"); + }; + return ((char*)"BOGUS"); +} + +int compMSL(defrCallbackType_e c, defiComponentMaskShiftLayer* co, defiUserData ud) { + int i; + + checkType(c); + if (ud != userData) dataError(); + + if (co->numMaskShiftLayers()) { + fprintf(fout, "\nCOMPONENTMASKSHIFT "); + + for (i = 0; i < co->numMaskShiftLayers(); i++) { + fprintf(fout, "%s ", co->maskShiftLayer(i)); + } + fprintf(fout, ";\n"); + } + + return 0; +} + +int compf(defrCallbackType_e c, defiComponent* co, defiUserData ud) { + if (testDebugPrint) { + co->print(fout); + } else { + int i; + + checkType(c); + if (ud != userData) dataError(); + // missing GENERATE, FOREIGN + fprintf(fout, "- %s %s ", co->id(), + co->name()); + // co->changeIdAndName("idName", "modelName"); + // fprintf(fout, "%s %s ", co->id(), + // co->name()); + if (co->hasNets()) { + for (i = 0; i < co->numNets(); i++) + fprintf(fout, "%s ", co->net(i)); + } + if (co->isFixed()) + fprintf(fout, "+ FIXED %d %d %s ", + co->placementX(), + co->placementY(), + //orientStr(co->placementOrient())); + co->placementOrientStr()); + if (co->isCover()) + fprintf(fout, "+ COVER %d %d %s ", + co->placementX(), + co->placementY(), + orientStr(co->placementOrient())); + if (co->isPlaced()) + fprintf(fout,"+ PLACED %d %d %s ", + co->placementX(), + co->placementY(), + orientStr(co->placementOrient())); + if (co->isUnplaced()) { + fprintf(fout,"+ UNPLACED "); + if ((co->placementX() != -1) || + (co->placementY() != -1)) + fprintf(fout,"%d %d %s ", + co->placementX(), + co->placementY(), + orientStr(co->placementOrient())); + } + if (co->hasSource()) + fprintf(fout, "+ SOURCE %s ", co->source()); + if (co->hasGenerate()) { + fprintf(fout, "+ GENERATE %s ", co->generateName()); + if (co->macroName() && + *(co->macroName())) + fprintf(fout, "%s ", co->macroName()); + } + if (co->hasWeight()) + fprintf(fout, "+ WEIGHT %d ", co->weight()); + if (co->hasEEQ()) + fprintf(fout, "+ EEQMASTER %s ", co->EEQ()); + if (co->hasRegionName()) + fprintf(fout, "+ REGION %s ", co->regionName()); + if (co->hasRegionBounds()) { + int *xl, *yl, *xh, *yh; + int size; + co->regionBounds(&size, &xl, &yl, &xh, &yh); + for (i = 0; i < size; i++) { + fprintf(fout, "+ REGION %d %d %d %d \n", + xl[i], yl[i], xh[i], yh[i]); + } + } + if (co->maskShiftSize()) { + fprintf(fout, "+ MASKSHIFT "); + + for (int i = co->maskShiftSize()-1; i >= 0; i--) { + fprintf(fout, "%d", co->maskShift(i)); + } + fprintf(fout, "\n"); + } + if (co->hasHalo()) { + int left, bottom, right, top; + (void) co->haloEdges(&left, &bottom, &right, &top); + fprintf(fout, "+ HALO "); + if (co->hasHaloSoft()) + fprintf(fout, "SOFT "); + fprintf(fout, "%d %d %d %d\n", left, bottom, right, top); + } + if (co->hasRouteHalo()) { + fprintf(fout, "+ ROUTEHALO %d %s %s\n", co->haloDist(), + co->minLayer(), co->maxLayer()); + } + if (co->hasForeignName()) { + fprintf(fout, "+ FOREIGN %s %d %d %s %d ", + co->foreignName(), co->foreignX(), + co->foreignY(), co->foreignOri(), + co->foreignOrient()); + } + if (co->numProps()) { + for (i = 0; i < co->numProps(); i++) { + fprintf(fout, "+ PROPERTY %s %s ", co->propName(i), + co->propValue(i)); + switch (co->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"); + --numObjs; + if (numObjs <= 0) + fprintf(fout, "END COMPONENTS\n"); + } + + return 0; +} + + +int netpath(defrCallbackType_e, defiNet*, defiUserData) { + fprintf(fout, "\n"); + + fprintf (fout, "Callback of partial path for net\n"); + + return 0; +} + + +int netNamef(defrCallbackType_e c, const char* netName, defiUserData ud) { + checkType(c); + if (ud != userData) dataError(); + fprintf(fout, "- %s ", netName); + return 0; +} + +int subnetNamef(defrCallbackType_e c, const char* subnetName, defiUserData ud) { + checkType(c); + if (ud != userData) dataError(); + if (curVer >= 5.6) + fprintf(fout, " + SUBNET CBK %s ", subnetName); + return 0; +} + +int nondefRulef(defrCallbackType_e c, const char* ruleName, defiUserData ud) { + checkType(c); + if (ud != userData) dataError(); + if (curVer >= 5.6) + fprintf(fout, " + NONDEFAULTRULE CBK %s ", ruleName); + return 0; +} + +int netf(defrCallbackType_e c, defiNet* net, defiUserData ud) { + // For net and special net. + int i, j, k, w, x, y, z, count, newLayer; + defiPath* p; + defiSubnet *s; + int path; + defiVpin *vpin; + // defiShield *noShield; + defiWire *wire; + + checkType(c); + if (ud != userData) dataError(); + if (c != defrNetCbkType) + fprintf(fout, "BOGUS NET TYPE "); + if (net->pinIsMustJoin(0)) + fprintf(fout, "- MUSTJOIN "); +// 5/6/2004 - don't need since I have a callback for the name +// else +// fprintf(fout, "- %s ", net->name()); + +// net->changeNetName("newNetName"); +// fprintf(fout, "%s ", net->name()); + count = 0; + // compName & pinName + for (i = 0; i < net->numConnections(); i++) { + // set the limit of only 5 items per line + count++; + if (count >= 5) { + fprintf(fout, "\n"); + count = 0; + } + fprintf(fout, "( %s %s ) ", net->instance(i), + net->pin(i)); +// net->changeInstance("newInstance", i); +// net->changePin("newPin", i); +// fprintf(fout, "( %s %s ) ", net->instance(i), +// net->pin(i)); + if (net->pinIsSynthesized(i)) + fprintf(fout, "+ SYNTHESIZED "); + } + + if (net->hasNonDefaultRule()) + fprintf(fout, "+ NONDEFAULTRULE %s\n", net->nonDefaultRule()); + + for (i = 0; i < net->numVpins(); i++) { + vpin = net->vpin(i); + fprintf(fout, " + %s", vpin->name()); + if (vpin->layer()) + fprintf(fout, " %s", vpin->layer()); + fprintf(fout, " %d %d %d %d", vpin->xl(), vpin->yl(), vpin->xh(), + vpin->yh()); + if (vpin->status() != ' ') { + fprintf(fout, " %c", vpin->status()); + fprintf(fout, " %d %d", vpin->xLoc(), vpin->yLoc()); + if (vpin->orient() != -1) + fprintf(fout, " %s", orientStr(vpin->orient())); + } + fprintf(fout, "\n"); + } + + // regularWiring + if (net->numWires()) { + for (i = 0; i < net->numWires(); i++) { + newLayer = 0; + wire = net->wire(i); + fprintf(fout, "\n + %s ", wire->wireType()); + count = 0; + for (j = 0; j < wire->numPaths(); j++) { + p = wire->path(j); + p->initTraverse(); + while ((path = (int)p->next()) != DEFIPATH_DONE) { + count++; + // Don't want the line to be too long + if (count >= 5) { + fprintf(fout, "\n"); + count = 0; + } + switch (path) { + case DEFIPATH_LAYER: + if (newLayer == 0) { + fprintf(fout, "%s ", p->getLayer()); + newLayer = 1; + } else + fprintf(fout, "NEW %s ", p->getLayer()); + break; + case DEFIPATH_MASK: + fprintf(fout, "MASK %d ", p->getMask()); + break; + case DEFIPATH_VIAMASK: + fprintf(fout, "MASK %d%d%d ", + p->getViaTopMask(), + p->getViaCutMask(), + p->getViaBottomMask()); + break; + case DEFIPATH_VIA: + fprintf(fout, "%s ", ignoreViaNames ? "XXX" : p->getVia()); + break; + case DEFIPATH_VIAROTATION: + fprintf(fout, "%s ", + orientStr(p->getViaRotation())); + break; + case DEFIPATH_RECT: + p->getViaRect(&w, &x, &y, &z); + fprintf(fout, "RECT ( %d %d %d %d ) ", w, x, y, z); + break; + case DEFIPATH_VIRTUALPOINT: + p->getVirtualPoint(&x, &y); + fprintf(fout, "VIRTUAL ( %d %d ) ", x, y); + break; + case DEFIPATH_WIDTH: + fprintf(fout, "%d ", p->getWidth()); + break; + case DEFIPATH_POINT: + p->getPoint(&x, &y); + fprintf(fout, "( %d %d ) ", x, y); + break; + case DEFIPATH_FLUSHPOINT: + p->getFlushPoint(&x, &y, &z); + fprintf(fout, "( %d %d %d ) ", x, y, z); + break; + case DEFIPATH_TAPER: + fprintf(fout, "TAPER "); + break; + case DEFIPATH_TAPERRULE: + fprintf(fout, "TAPERRULE %s ",p->getTaperRule()); + break; + case DEFIPATH_STYLE: + fprintf(fout, "STYLE %d ",p->getStyle()); + break; + } + } + } + fprintf(fout, "\n"); + count = 0; + } + } + + // SHIELDNET + if (net->numShieldNets()) { + for (i = 0; i < net->numShieldNets(); i++) + fprintf(fout, "\n + SHIELDNET %s", net->shieldNet(i)); + } +/* obsolete in 5.4 + if (net->numNoShields()) { + for (i = 0; i < net->numNoShields(); i++) { + noShield = net->noShield(i); + fprintf(fout, "\n + NOSHIELD "); + newLayer = 0; + for (j = 0; j < noShield->numPaths(); j++) { + p = noShield->path(j); + p->initTraverse(); + while ((path = (int)p->next()) != DEFIPATH_DONE) { + count++; + // Don't want the line to be too long + if (count >= 5) { + fprintf(fout, "\n"); + count = 0; + } + switch (path) { + case DEFIPATH_LAYER: + if (newLayer == 0) { + fprintf(fout, "%s ", p->getLayer()); + newLayer = 1; + } else + fprintf(fout, "NEW %s ", p->getLayer()); + break; + case DEFIPATH_VIA: + fprintf(fout, "%s ", p->getVia()); + break; + case DEFIPATH_VIAROTATION: + fprintf(fout, "%s ", + orientStr(p->getViaRotation())); + break; + case DEFIPATH_WIDTH: + fprintf(fout, "%d ", p->getWidth()); + break; + case DEFIPATH_POINT: + p->getPoint(&x, &y); + fprintf(fout, "( %d %d ) ", x, y); + break; + case DEFIPATH_FLUSHPOINT: + p->getFlushPoint(&x, &y, &z); + fprintf(fout, "( %d %d %d ) ", x, y, z); + break; + case DEFIPATH_TAPER: + fprintf(fout, "TAPER "); + break; + case DEFIPATH_TAPERRULE: + fprintf(fout, "TAPERRULE %s ", + p->getTaperRule()); + break; + } + } + } + } + } +*/ + + if (net->hasSubnets()) { + for (i = 0; i < net->numSubnets(); i++) { + s = net->subnet(i); + fprintf(fout, "\n"); + + if (s->numConnections()) { + if (s->pinIsMustJoin(0)) + fprintf(fout, "- MUSTJOIN "); + else + fprintf(fout, " + SUBNET %s ", s->name()); + for (j = 0; j < s->numConnections(); j++) + fprintf(fout, " ( %s %s )\n", s->instance(j), + s->pin(j)); + + // regularWiring + if (s->numWires()) { + for (k = 0; k < s->numWires(); k++) { + newLayer = 0; + wire = s->wire(k); + fprintf(fout, " %s ", wire->wireType()); + count = 0; + for (j = 0; j < wire->numPaths(); j++) { + p = wire->path(j); + p->initTraverse(); + while ((path = (int)p->next()) != DEFIPATH_DONE) { + count++; + // Don't want the line to be too long + if (count >= 5) { + fprintf(fout, "\n"); + count = 0; + } + switch (path) { + case DEFIPATH_LAYER: + if (newLayer == 0) { + fprintf(fout, "%s ", p->getLayer()); + newLayer = 1; + } else + fprintf(fout, "NEW %s ", + p->getLayer()); + break; + case DEFIPATH_VIA: + fprintf(fout, "%s ", ignoreViaNames ? "XXX" : p->getVia()); + break; + case DEFIPATH_VIAROTATION: + fprintf(fout, "%s ", + p->getViaRotationStr()); + break; + case DEFIPATH_WIDTH: + fprintf(fout, "%d ", p->getWidth()); + break; + case DEFIPATH_POINT: + p->getPoint(&x, &y); + fprintf(fout, "( %d %d ) ", x, y); + break; + case DEFIPATH_FLUSHPOINT: + p->getFlushPoint(&x, &y, &z); + fprintf(fout, "( %d %d %d ) ", x, y, z); + break; + case DEFIPATH_TAPER: + fprintf(fout, "TAPER "); + break; + case DEFIPATH_TAPERRULE: + fprintf(fout, "TAPERRULE %s ", + p->getTaperRule()); + break; + case DEFIPATH_STYLE: + fprintf(fout, "STYLE %d ", + p->getStyle()); + break; + } + } + } + } + } + } + } + } + + if (net->numProps()) { + for (i = 0; i < net->numProps(); i++) { + fprintf(fout, " + PROPERTY %s ", net->propName(i)); + switch (net->propType(i)) { + case 'R': fprintf(fout, "%g REAL ", net->propNumber(i)); + break; + case 'I': fprintf(fout, "%g INTEGER ", net->propNumber(i)); + break; + case 'S': fprintf(fout, "%s STRING ", net->propValue(i)); + break; + case 'Q': fprintf(fout, "%s QUOTESTRING ", net->propValue(i)); + break; + case 'N': fprintf(fout, "%g NUMBER ", net->propNumber(i)); + break; + } + fprintf(fout, "\n"); + } + } + + if (net->hasWeight()) + fprintf(fout, "+ WEIGHT %d ", net->weight()); + if (net->hasCap()) + fprintf(fout, "+ ESTCAP %g ", net->cap()); + if (net->hasSource()) + fprintf(fout, "+ SOURCE %s ", net->source()); + if (net->hasFixedbump()) + fprintf(fout, "+ FIXEDBUMP "); + if (net->hasFrequency()) + fprintf(fout, "+ FREQUENCY %g ", net->frequency()); + if (net->hasPattern()) + fprintf(fout, "+ PATTERN %s ", net->pattern()); + if (net->hasOriginal()) + fprintf(fout, "+ ORIGINAL %s ", net->original()); + if (net->hasUse()) + fprintf(fout, "+ USE %s ", net->use()); + + fprintf (fout, ";\n"); + --numObjs; + if (numObjs <= 0) + fprintf(fout, "END NETS\n"); + return 0; +} + + +int snetpath(defrCallbackType_e c, defiNet* ppath, defiUserData ud) { + int i, j, x, y, z, count, newLayer; + char* layerName; + double dist, left, right; + defiPath* p; + defiSubnet *s; + int path; + defiShield* shield; + defiWire* wire; + int numX, numY, stepX, stepY; + + if (c != defrSNetPartialPathCbkType) + return 1; + if (ud != userData) dataError(); + + fprintf (fout, "SPECIALNET partial data\n"); + + fprintf(fout, "- %s ", ppath->name()); + + count = 0; + // compName & pinName + for (i = 0; i < ppath->numConnections(); i++) { + // set the limit of only 5 items print out in one line + count++; + if (count >= 5) { + fprintf(fout, "\n"); + count = 0; + } + fprintf (fout, "( %s %s ) ", ppath->instance(i), + ppath->pin(i)); + if (ppath->pinIsSynthesized(i)) + fprintf(fout, "+ SYNTHESIZED "); + } + + // specialWiring + // POLYGON + if (ppath->numPolygons()) { + defiPoints points; + for (i = 0; i < ppath->numPolygons(); i++) { + fprintf(fout, "\n + POLYGON %s ", ppath->polygonName(i)); + points = ppath->getPolygon(i); + for (j = 0; j < points.numPoints; j++) + fprintf(fout, "%d %d ", points.x[j], points.y[j]); + } + } + // RECT + if (ppath->numRectangles()) { + for (i = 0; i < ppath->numRectangles(); i++) { + fprintf(fout, "\n + RECT %s %d %d %d %d", ppath->rectName(i), + ppath->xl(i), ppath->yl(i), + ppath->xh(i), ppath->yh(i)); + } + } + + // COVER, FIXED, ROUTED or SHIELD + if (ppath->numWires()) { + newLayer = 0; + for (i = 0; i < ppath->numWires(); i++) { + newLayer = 0; + wire = ppath->wire(i); + fprintf(fout, "\n + %s ", wire->wireType()); + if (strcmp (wire->wireType(), "SHIELD") == 0) + fprintf(fout, "%s ", wire->wireShieldNetName()); + for (j = 0; j < wire->numPaths(); j++) { + p = wire->path(j); + p->initTraverse(); + while ((path = (int)p->next()) != DEFIPATH_DONE) { + count++; + // Don't want the line to be too long + if (count >= 5) { + fprintf(fout, "\n"); + count = 0; + } + switch (path) { + case DEFIPATH_LAYER: + if (newLayer == 0) { + fprintf(fout, "%s ", p->getLayer()); + newLayer = 1; + } else + fprintf(fout, "NEW %s ", p->getLayer()); + break; + case DEFIPATH_VIA: + fprintf(fout, "%s ", ignoreViaNames ? "XXX" : p->getVia()); + break; + case DEFIPATH_VIAROTATION: + fprintf(fout, "%s ", + orientStr(p->getViaRotation())); + break; + case DEFIPATH_VIADATA: + p->getViaData(&numX, &numY, &stepX, &stepY); + fprintf(fout, "DO %d BY %d STEP %d %d ", numX, numY, + stepX, stepY); + break; + case DEFIPATH_WIDTH: + fprintf(fout, "%d ", p->getWidth()); + break; + case DEFIPATH_MASK: + fprintf(fout, "MASK %d ", p->getMask()); + break; + case DEFIPATH_VIAMASK: + fprintf(fout, "MASK %d%d%d ", + p->getViaTopMask(), + p->getViaCutMask(), + p->getViaBottomMask()); + break; + case DEFIPATH_POINT: + p->getPoint(&x, &y); + fprintf(fout, "( %d %d ) ", x, y); + break; + case DEFIPATH_FLUSHPOINT: + p->getFlushPoint(&x, &y, &z); + fprintf(fout, "( %d %d %d ) ", x, y, z); + break; + case DEFIPATH_TAPER: + fprintf(fout, "TAPER "); + break; + case DEFIPATH_SHAPE: + fprintf(fout, "+ SHAPE %s ", p->getShape()); + break; + case DEFIPATH_STYLE: + fprintf(fout, "+ STYLE %d ", p->getStyle()); + break; + } + } + } + fprintf(fout, "\n"); + count = 0; + } + } + + if (ppath->hasSubnets()) { + for (i = 0; i < ppath->numSubnets(); i++) { + s = ppath->subnet(i); + if (s->numConnections()) { + if (s->pinIsMustJoin(0)) + fprintf(fout, "- MUSTJOIN "); + else + fprintf(fout, "- %s ", s->name()); + for (j = 0; j < s->numConnections(); j++) { + fprintf(fout, " ( %s %s )\n", s->instance(j), + s->pin(j)); + } + } + + // regularWiring + if (s->numWires()) { + for (i = 0; i < s->numWires(); i++) { + wire = s->wire(i); + fprintf(fout, " + %s ", wire->wireType()); + for (j = 0; j < wire->numPaths(); j++) { + p = wire->path(j); + p->print(fout); + } + } + } + } + } + + if (ppath->numProps()) { + for (i = 0; i < ppath->numProps(); i++) { + if (ppath->propIsString(i)) + fprintf(fout, " + PROPERTY %s %s ", ppath->propName(i), + ppath->propValue(i)); + if (ppath->propIsNumber(i)) + fprintf(fout, " + PROPERTY %s %g ", ppath->propName(i), + ppath->propNumber(i)); + switch (ppath->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"); + } + } + + // SHIELD + count = 0; + // testing the SHIELD for 5.3, obsolete in 5.4 + if (ppath->numShields()) { + for (i = 0; i < ppath->numShields(); i++) { + shield = ppath->shield(i); + fprintf(fout, "\n + SHIELD %s ", shield->shieldName()); + newLayer = 0; + for (j = 0; j < shield->numPaths(); j++) { + p = shield->path(j); + p->initTraverse(); + while ((path = (int)p->next()) != DEFIPATH_DONE) { + count++; + // Don't want the line to be too long + if (count >= 5) { + fprintf(fout, "\n"); + count = 0; + } + switch (path) { + case DEFIPATH_LAYER: + if (newLayer == 0) { + fprintf(fout, "%s ", p->getLayer()); + newLayer = 1; + } else + fprintf(fout, "NEW %s ", p->getLayer()); + break; + case DEFIPATH_VIA: + fprintf(fout, "%s ", ignoreViaNames ? "XXX" : p->getVia()); + break; + case DEFIPATH_VIAROTATION: + if (newLayer) + fprintf(fout, "%s ", + orientStr(p->getViaRotation())); + else + fprintf(fout, "Str %s ", + p->getViaRotationStr()); + break; + case DEFIPATH_WIDTH: + fprintf(fout, "%d ", p->getWidth()); + break; + case DEFIPATH_MASK: + fprintf(fout, "MASK %d ", p->getMask()); + break; + case DEFIPATH_VIAMASK: + fprintf(fout, "MASK %d%d%d ", + p->getViaTopMask(), + p->getViaCutMask(), + p->getViaBottomMask()); + break; + case DEFIPATH_POINT: + p->getPoint(&x, &y); + fprintf(fout, "( %d %d ) ", x, y); + break; + case DEFIPATH_FLUSHPOINT: + p->getFlushPoint(&x, &y, &z); + fprintf(fout, "( %d %d %d ) ", x, y, z); + break; + case DEFIPATH_TAPER: + fprintf(fout, "TAPER "); + break; + case DEFIPATH_SHAPE: + fprintf(fout, "+ SHAPE %s ", p->getShape()); + break; + case DEFIPATH_STYLE: + fprintf(fout, "+ STYLE %d ", p->getStyle()); + } + } + } + } + } + + // layerName width + if (ppath->hasWidthRules()) { + for (i = 0; i < ppath->numWidthRules(); i++) { + ppath->widthRule(i, &layerName, &dist); + fprintf (fout, "\n + WIDTH %s %g ", layerName, dist); + } + } + + // layerName spacing + if (ppath->hasSpacingRules()) { + for (i = 0; i < ppath->numSpacingRules(); i++) { + ppath->spacingRule(i, &layerName, &dist, &left, &right); + if (left == right) + fprintf (fout, "\n + SPACING %s %g ", layerName, dist); + else + fprintf (fout, "\n + SPACING %s %g RANGE %g %g ", + layerName, dist, left, right); + } + } + + if (ppath->hasFixedbump()) + fprintf(fout, "\n + FIXEDBUMP "); + if (ppath->hasFrequency()) + fprintf(fout, "\n + FREQUENCY %g ", ppath->frequency()); + if (ppath->hasVoltage()) + fprintf(fout, "\n + VOLTAGE %g ", ppath->voltage()); + if (ppath->hasWeight()) + fprintf(fout, "\n + WEIGHT %d ", ppath->weight()); + if (ppath->hasCap()) + fprintf(fout, "\n + ESTCAP %g ", ppath->cap()); + if (ppath->hasSource()) + fprintf(fout, "\n + SOURCE %s ", ppath->source()); + if (ppath->hasPattern()) + fprintf(fout, "\n + PATTERN %s ", ppath->pattern()); + if (ppath->hasOriginal()) + fprintf(fout, "\n + ORIGINAL %s ", ppath->original()); + if (ppath->hasUse()) + fprintf(fout, "\n + USE %s ", ppath->use()); + + fprintf(fout, "\n"); + + return 0; +} + + +int snetwire(defrCallbackType_e c, defiNet* ppath, defiUserData ud) { + int i, j, x, y, z, count = 0, newLayer; + defiPath* p; + int path; + defiWire* wire; + defiShield* shield; + int numX, numY, stepX, stepY; + + if (c != defrSNetWireCbkType) + return 1; + if (ud != userData) dataError(); + + fprintf (fout, "SPECIALNET wire data\n"); + + fprintf(fout, "- %s ", ppath->name()); + + // POLYGON + if (ppath->numPolygons()) { + defiPoints points; + for (i = 0; i < ppath->numPolygons(); i++) { + fprintf(fout, "\n + POLYGON %s ", ppath->polygonName(i)); + + points = ppath->getPolygon(i); + + for (j = 0; j < points.numPoints; j++) { + fprintf(fout, "%d %d ", points.x[j], points.y[j]); + } + } + // RECT + } + if (ppath->numRectangles()) { + for (i = 0; i < ppath->numRectangles(); i++) { + fprintf(fout, "\n + RECT %s %d %d %d %d", ppath->rectName(i), + ppath->xl(i), ppath->yl(i), + ppath->xh(i), ppath->yh(i)); + } + } + // VIA + if (ppath->numViaSpecs()) { + for (i = 0; i < ppath->numViaSpecs(); i++) { + fprintf(fout, "\n + VIA %s ", ppath->viaName(i)), + fprintf(fout, " %s", ppath->viaOrientStr(i)); + + defiPoints points = ppath->getViaPts(i); + + for (int j = 0; j < points.numPoints; j++) { + fprintf(fout, " %d %d", points.x[j], points.y[j]); + } + } + } + + // specialWiring + if (ppath->numWires()) { + newLayer = 0; + for (i = 0; i < ppath->numWires(); i++) { + newLayer = 0; + wire = ppath->wire(i); + fprintf(fout, "\n + %s ", wire->wireType()); + if (strcmp (wire->wireType(), "SHIELD") == 0) + fprintf(fout, "%s ", wire->wireShieldNetName()); + for (j = 0; j < wire->numPaths(); j++) { + p = wire->path(j); + p->initTraverse(); + while ((path = (int)p->next()) != DEFIPATH_DONE) { + count++; + // Don't want the line to be too long + if (count >= 5) { + fprintf(fout, "\n"); + count = 0; + } + switch (path) { + case DEFIPATH_LAYER: + if (newLayer == 0) { + fprintf(fout, "%s ", p->getLayer()); + newLayer = 1; + } else + fprintf(fout, "NEW %s ", p->getLayer()); + break; + case DEFIPATH_VIA: + fprintf(fout, "%s ", ignoreViaNames ? "XXX" : p->getVia()); + break; + case DEFIPATH_VIAROTATION: + fprintf(fout, "%s ", + orientStr(p->getViaRotation())); + break; + case DEFIPATH_VIADATA: + p->getViaData(&numX, &numY, &stepX, &stepY); + fprintf(fout, "DO %d BY %d STEP %d %d ", numX, numY, + stepX, stepY); + break; + case DEFIPATH_WIDTH: + fprintf(fout, "%d ", p->getWidth()); + break; + case DEFIPATH_MASK: + fprintf(fout, "MASK %d ", p->getMask()); + break; + case DEFIPATH_VIAMASK: + fprintf(fout, "MASK %d%d%d ", + p->getViaTopMask(), + p->getViaCutMask(), + p->getViaBottomMask()); + break; + case DEFIPATH_POINT: + p->getPoint(&x, &y); + fprintf(fout, "( %d %d ) ", x, y); + break; + case DEFIPATH_FLUSHPOINT: + p->getFlushPoint(&x, &y, &z); + fprintf(fout, "( %d %d %d ) ", x, y, z); + break; + case DEFIPATH_TAPER: + fprintf(fout, "TAPER "); + break; + case DEFIPATH_SHAPE: + fprintf(fout, "+ SHAPE %s ", p->getShape()); + break; + case DEFIPATH_STYLE: + fprintf(fout, "+ STYLE %d ", p->getStyle()); + break; + } + } + } + fprintf(fout, "\n"); + count = 0; + } + } else if (ppath->numShields()) { + for (i = 0; i < ppath->numShields(); i++) { + shield = ppath->shield(i); + fprintf(fout, "\n + SHIELD %s ", shield->shieldName()); + newLayer = 0; + for (j = 0; j < shield->numPaths(); j++) { + p = shield->path(j); + p->initTraverse(); + while ((path = (int)p->next()) != DEFIPATH_DONE) { + count++; + // Don't want the line to be too long + if (count >= 5) { + fprintf(fout, "\n"); + count = 0; + } + switch (path) { + case DEFIPATH_LAYER: + if (newLayer == 0) { + fprintf(fout, "%s ", p->getLayer()); + newLayer = 1; + } else + fprintf(fout, "NEW %s ", p->getLayer()); + break; + case DEFIPATH_VIA: + fprintf(fout, "%s ", ignoreViaNames ? "XXX" : p->getVia()); + break; + case DEFIPATH_VIAROTATION: + fprintf(fout, "%s ", + orientStr(p->getViaRotation())); + break; + case DEFIPATH_WIDTH: + fprintf(fout, "%d ", p->getWidth()); + break; + case DEFIPATH_MASK: + fprintf(fout, "MASK %d ", p->getMask()); + break; + case DEFIPATH_VIAMASK: + fprintf(fout, "MASK %d%d%d ", + p->getViaTopMask(), + p->getViaCutMask(), + p->getViaBottomMask()); + break; + case DEFIPATH_POINT: + p->getPoint(&x, &y); + fprintf(fout, "( %d %d ) ", x, y); + break; + case DEFIPATH_FLUSHPOINT: + p->getFlushPoint(&x, &y, &z); + fprintf(fout, "( %d %d %d ) ", x, y, z); + break; + case DEFIPATH_TAPER: + fprintf(fout, "TAPER "); + break; + case DEFIPATH_SHAPE: + fprintf(fout, "+ SHAPE %s ", p->getShape()); + break; + case DEFIPATH_STYLE: + fprintf(fout, "+ STYLE %d ", p->getStyle()); + break; + } + } + } + } + } + + fprintf(fout, "\n"); + + return 0; +} + +int snetf(defrCallbackType_e c, defiNet* net, defiUserData ud) { + // For net and special net. + int i, j, x, y, z, count, newLayer; + char* layerName; + double dist, left, right; + defiPath* p; + defiSubnet *s; + int path; + defiShield* shield; + defiWire* wire; + int numX, numY, stepX, stepY; + + checkType(c); + if (ud != userData) dataError(); + if (c != defrSNetCbkType) + fprintf(fout, "BOGUS NET TYPE "); + +// 5/6/2004 - don't need since I have a callback for the name +// fprintf(fout, "- %s ", net->name()); + + count = 0; + // compName & pinName + for (i = 0; i < net->numConnections(); i++) { + // set the limit of only 5 items print out in one line + count++; + if (count >= 5) { + fprintf(fout, "\n"); + count = 0; + } + fprintf (fout, "( %s %s ) ", net->instance(i), + net->pin(i)); + if (net->pinIsSynthesized(i)) + fprintf(fout, "+ SYNTHESIZED "); + } + + // specialWiring + if (net->numWires()) { + newLayer = 0; + for (i = 0; i < net->numWires(); i++) { + newLayer = 0; + wire = net->wire(i); + fprintf(fout, "\n + %s ", wire->wireType()); + if (strcmp (wire->wireType(), "SHIELD") == 0) + fprintf(fout, "%s ", wire->wireShieldNetName()); + for (j = 0; j < wire->numPaths(); j++) { + p = wire->path(j); + p->initTraverse(); + if (testDebugPrint) { + p->print(fout); + } else { + while ((path = (int)p->next()) != DEFIPATH_DONE) { + count++; + // Don't want the line to be too long + if (count >= 5) { + fprintf(fout, "\n"); + count = 0; + } + switch (path) { + case DEFIPATH_LAYER: + if (newLayer == 0) { + fprintf(fout, "%s ", p->getLayer()); + newLayer = 1; + } else + fprintf(fout, "NEW %s ", p->getLayer()); + break; + case DEFIPATH_VIA: + fprintf(fout, "%s ", ignoreViaNames ? "XXX" : p->getVia()); + break; + case DEFIPATH_VIAROTATION: + fprintf(fout, "%s ", + orientStr(p->getViaRotation())); + break; + case DEFIPATH_VIADATA: + p->getViaData(&numX, &numY, &stepX, &stepY); + fprintf(fout, "DO %d BY %d STEP %d %d ", numX, numY, + stepX, stepY); + break; + case DEFIPATH_WIDTH: + fprintf(fout, "%d ", p->getWidth()); + break; + case DEFIPATH_MASK: + fprintf(fout, "MASK %d ", p->getMask()); + break; + case DEFIPATH_VIAMASK: + fprintf(fout, "MASK %d%d%d ", + p->getViaTopMask(), + p->getViaCutMask(), + p->getViaBottomMask()); + break; + case DEFIPATH_POINT: + p->getPoint(&x, &y); + fprintf(fout, "( %d %d ) ", x, y); + break; + case DEFIPATH_FLUSHPOINT: + p->getFlushPoint(&x, &y, &z); + fprintf(fout, "( %d %d %d ) ", x, y, z); + break; + case DEFIPATH_TAPER: + fprintf(fout, "TAPER "); + break; + case DEFIPATH_SHAPE: + fprintf(fout, "+ SHAPE %s ", p->getShape()); + break; + case DEFIPATH_STYLE: + fprintf(fout, "+ STYLE %d ", p->getStyle()); + break; + } + } + } + } + fprintf(fout, "\n"); + count = 0; + } + } + + // POLYGON + if (net->numPolygons()) { + defiPoints points; + + for (i = 0; i < net->numPolygons(); i++) { + if (curVer >= 5.8 ) { + if (strcmp(net->polyRouteStatus(i), "") != 0) { + fprintf(fout, "\n + %s ", net->polyRouteStatus(i)); + if (strcmp(net->polyRouteStatus(i), "SHIELD") == 0) { + fprintf(fout, "\n + %s ", net->polyRouteStatusShieldName(i)); + } + } + if (strcmp(net->polyShapeType(i), "") != 0) { + fprintf(fout, "\n + SHAPE %s ", net->polyShapeType(i)); + } + } + if (net->polyMask(i)) { + fprintf(fout, "\n + MASK %d + POLYGON % s ", net->polyMask(i), + net->polygonName(i)); + } else { + fprintf(fout, "\n + POLYGON %s ", net->polygonName(i)); + } + points = net->getPolygon(i); + for (j = 0; j < points.numPoints; j++) + fprintf(fout, "%d %d ", points.x[j], points.y[j]); + } + } + // RECT + if (net->numRectangles()) { + + for (i = 0; i < net->numRectangles(); i++) { + if (curVer >= 5.8 ) { + if (strcmp(net->rectRouteStatus(i), "") != 0) { + fprintf(fout, "\n + %s ", net->rectRouteStatus(i)); + if (strcmp(net->rectRouteStatus(i), "SHIELD") == 0) { + fprintf(fout, "\n + %s ", net->rectRouteStatusShieldName(i)); + } + } + if (strcmp(net->rectShapeType(i), "") != 0) { + fprintf(fout, "\n + SHAPE %s ", net->rectShapeType(i)); + } + } + if (net->rectMask(i)) { + fprintf(fout, "\n + MASK %d + RECT %s %d %d %d %d", + net->rectMask(i), net->rectName(i), + net->xl(i), net->yl(i), net->xh(i), + net->yh(i)); + } else { + fprintf(fout, "\n + RECT %s %d %d %d %d", + net->rectName(i), + net->xl(i), + net->yl(i), + net->xh(i), + net->yh(i)); + } + } + } + // VIA + if (curVer >= 5.8 && net->numViaSpecs()) { + for (i = 0; i < net->numViaSpecs(); i++) { + if (strcmp(net->viaRouteStatus(i), "") != 0) { + fprintf(fout, "\n + %s ", net->viaRouteStatus(i)); + if (strcmp(net->viaRouteStatus(i), "SHIELD") == 0) { + fprintf(fout, "\n + %s ", net->viaRouteStatusShieldName(i)); + } + } + if (strcmp(net->viaShapeType(i), "") != 0) { + fprintf(fout, "\n + SHAPE %s ", net->viaShapeType(i)); + } + if (net->topMaskNum(i) || net->cutMaskNum(i) || net->bottomMaskNum(i)) { + fprintf(fout, "\n + MASK %d%d%d + VIA %s ", net->topMaskNum(i), + net->cutMaskNum(i), + net->bottomMaskNum(i), + net->viaName(i)); + } else { + fprintf(fout, "\n + VIA %s ", net->viaName(i)); + } + fprintf(fout, " %s", net->viaOrientStr(i)); + + defiPoints points = net->getViaPts(i); + + for (int j = 0; j < points.numPoints; j++) { + fprintf(fout, " %d %d", points.x[j], points.y[j]); + } + fprintf(fout, ";\n"); + + } + } + + if (net->hasSubnets()) { + for (i = 0; i < net->numSubnets(); i++) { + s = net->subnet(i); + if (s->numConnections()) { + if (s->pinIsMustJoin(0)) + fprintf(fout, "- MUSTJOIN "); + else + fprintf(fout, "- %s ", s->name()); + for (j = 0; j < s->numConnections(); j++) { + fprintf(fout, " ( %s %s )\n", s->instance(j), + s->pin(j)); + } + } + + // regularWiring + if (s->numWires()) { + for (i = 0; i < s->numWires(); i++) { + wire = s->wire(i); + fprintf(fout, " + %s ", wire->wireType()); + for (j = 0; j < wire->numPaths(); j++) { + p = wire->path(j); + p->print(fout); + } + } + } + } + } + + if (net->numProps()) { + for (i = 0; i < net->numProps(); i++) { + if (net->propIsString(i)) + fprintf(fout, " + PROPERTY %s %s ", net->propName(i), + net->propValue(i)); + if (net->propIsNumber(i)) + fprintf(fout, " + PROPERTY %s %g ", net->propName(i), + net->propNumber(i)); + switch (net->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"); + } + } + + // SHIELD + count = 0; + // testing the SHIELD for 5.3, obsolete in 5.4 + if (net->numShields()) { + for (i = 0; i < net->numShields(); i++) { + shield = net->shield(i); + fprintf(fout, "\n + SHIELD %s ", shield->shieldName()); + newLayer = 0; + for (j = 0; j < shield->numPaths(); j++) { + p = shield->path(j); + p->initTraverse(); + while ((path = (int)p->next()) != DEFIPATH_DONE) { + count++; + // Don't want the line to be too long + if (count >= 5) { + fprintf(fout, "\n"); + count = 0; + } + switch (path) { + case DEFIPATH_LAYER: + if (newLayer == 0) { + fprintf(fout, "%s ", p->getLayer()); + newLayer = 1; + } else + fprintf(fout, "NEW %s ", p->getLayer()); + break; + case DEFIPATH_VIA: + fprintf(fout, "%s ", ignoreViaNames ? "XXX" : p->getVia()); + break; + case DEFIPATH_VIAROTATION: + fprintf(fout, "%s ", + orientStr(p->getViaRotation())); + break; + case DEFIPATH_WIDTH: + fprintf(fout, "%d ", p->getWidth()); + break; + case DEFIPATH_MASK: + fprintf(fout, "MASK %d ", p->getMask()); + break; + case DEFIPATH_VIAMASK: + fprintf(fout, "MASK %d%d%d ", + p->getViaTopMask(), + p->getViaCutMask(), + p->getViaBottomMask()); + break; + case DEFIPATH_POINT: + p->getPoint(&x, &y); + fprintf(fout, "( %d %d ) ", x, y); + break; + case DEFIPATH_FLUSHPOINT: + p->getFlushPoint(&x, &y, &z); + fprintf(fout, "( %d %d %d ) ", x, y, z); + break; + case DEFIPATH_TAPER: + fprintf(fout, "TAPER "); + break; + case DEFIPATH_SHAPE: + fprintf(fout, "+ SHAPE %s ", p->getShape()); + break; + case DEFIPATH_STYLE: + fprintf(fout, "+ STYLE %d ", p->getStyle()); + break; + } + } + } + } + } + + // layerName width + if (net->hasWidthRules()) { + for (i = 0; i < net->numWidthRules(); i++) { + net->widthRule(i, &layerName, &dist); + fprintf (fout, "\n + WIDTH %s %g ", layerName, dist); + } + } + + // layerName spacing + if (net->hasSpacingRules()) { + for (i = 0; i < net->numSpacingRules(); i++) { + net->spacingRule(i, &layerName, &dist, &left, &right); + if (left == right) + fprintf (fout, "\n + SPACING %s %g ", layerName, dist); + else + fprintf (fout, "\n + SPACING %s %g RANGE %g %g ", + layerName, dist, left, right); + } + } + + if (net->hasFixedbump()) + fprintf(fout, "\n + FIXEDBUMP "); + if (net->hasFrequency()) + fprintf(fout, "\n + FREQUENCY %g ", net->frequency()); + if (net->hasVoltage()) + fprintf(fout, "\n + VOLTAGE %g ", net->voltage()); + if (net->hasWeight()) + fprintf(fout, "\n + WEIGHT %d ", net->weight()); + if (net->hasCap()) + fprintf(fout, "\n + ESTCAP %g ", net->cap()); + if (net->hasSource()) + fprintf(fout, "\n + SOURCE %s ", net->source()); + if (net->hasPattern()) + fprintf(fout, "\n + PATTERN %s ", net->pattern()); + if (net->hasOriginal()) + fprintf(fout, "\n + ORIGINAL %s ", net->original()); + if (net->hasUse()) + fprintf(fout, "\n + USE %s ", net->use()); + + fprintf (fout, ";\n"); + --numObjs; + if (numObjs <= 0) + fprintf(fout, "END SPECIALNETS\n"); + return 0; +} + + +int ndr(defrCallbackType_e c, defiNonDefault* nd, defiUserData ud) { + // For nondefaultrule + int i; + + checkType(c); + if (ud != userData) dataError(); + if (c != defrNonDefaultCbkType) + fprintf(fout, "BOGUS NONDEFAULTRULE TYPE "); + fprintf(fout, "- %s\n", nd->name()); + if (nd->hasHardspacing()) + fprintf(fout, " + HARDSPACING\n"); + for (i = 0; i < nd->numLayers(); i++) { + fprintf(fout, " + LAYER %s", nd->layerName(i)); + fprintf(fout, " WIDTH %d", nd->layerWidthVal(i)); + if (nd->hasLayerDiagWidth(i)) + fprintf(fout, " DIAGWIDTH %d", + nd->layerDiagWidthVal(i)); + if (nd->hasLayerSpacing(i)) + fprintf(fout, " SPACING %d", nd->layerSpacingVal(i)); + if (nd->hasLayerWireExt(i)) + fprintf(fout, " WIREEXT %d", nd->layerWireExtVal(i)); + fprintf(fout, "\n"); + } + for (i = 0; i < nd->numVias(); i++) + fprintf(fout, " + VIA %s\n", nd->viaName(i)); + for (i = 0; i < nd->numViaRules(); i++) + fprintf(fout, " + VIARULE %s\n", ignoreViaNames ? "XXX" : nd->viaRuleName(i)); + for (i = 0; i < nd->numMinCuts(); i++) + fprintf(fout, " + MINCUTS %s %d\n", nd->cutLayerName(i), + nd->numCuts(i)); + for (i = 0; i < nd->numProps(); i++) { + fprintf(fout, " + PROPERTY %s %s ", nd->propName(i), + nd->propValue(i)); + switch (nd->propType(i)) { + case 'R': fprintf(fout, "REAL\n"); + break; + case 'I': fprintf(fout, "INTEGER\n"); + break; + case 'S': fprintf(fout, "STRING\n"); + break; + case 'Q': fprintf(fout, "QUOTESTRING\n"); + break; + case 'N': fprintf(fout, "NUMBER\n"); + break; + } + } + --numObjs; + if (numObjs <= 0) + fprintf(fout, "END NONDEFAULTRULES\n"); + return 0; +} + +int tname(defrCallbackType_e c, const char* string, defiUserData ud) { + checkType(c); + if (ud != userData) dataError(); + fprintf(fout, "TECHNOLOGY %s ;\n", string); + return 0; +} + +int dname(defrCallbackType_e c, const char* string, defiUserData ud) { + checkType(c); + if (ud != userData) dataError(); + fprintf(fout, "DESIGN %s ;\n", string); + + return 0; +} + + +char* address(const char* in) { + return ((char*)in); +} + +int cs(defrCallbackType_e c, int num, defiUserData ud) { + char* name; + + checkType(c); + + if (ud != userData) dataError(); + + switch (c) { + case defrComponentStartCbkType : name = address("COMPONENTS"); break; + case defrNetStartCbkType : name = address("NETS"); break; + case defrStartPinsCbkType : name = address("PINS"); break; + case defrViaStartCbkType : name = address("VIAS"); break; + case defrRegionStartCbkType : name = address("REGIONS"); break; + case defrSNetStartCbkType : name = address("SPECIALNETS"); break; + case defrGroupsStartCbkType : name = address("GROUPS"); break; + case defrScanchainsStartCbkType : name = address("SCANCHAINS"); break; + case defrIOTimingsStartCbkType : name = address("IOTIMINGS"); break; + case defrFPCStartCbkType : name = address("FLOORPLANCONSTRAINTS"); break; + case defrTimingDisablesStartCbkType : name = address("TIMING DISABLES"); break; + case defrPartitionsStartCbkType : name = address("PARTITIONS"); break; + case defrPinPropStartCbkType : name = address("PINPROPERTIES"); break; + case defrBlockageStartCbkType : name = address("BLOCKAGES"); break; + case defrSlotStartCbkType : name = address("SLOTS"); break; + case defrFillStartCbkType : name = address("FILLS"); break; + case defrNonDefaultStartCbkType : name = address("NONDEFAULTRULES"); break; + case defrStylesStartCbkType : name = address("STYLES"); break; + default : name = address("BOGUS"); return 1; + } + fprintf(fout, "\n%s %d ;\n", name, num); + numObjs = num; + return 0; +} + +int constraintst(defrCallbackType_e c, int num, defiUserData ud) { + // Handles both constraints and assertions + checkType(c); + if (ud != userData) dataError(); + if (c == defrConstraintsStartCbkType) + fprintf(fout, "\nCONSTRAINTS %d ;\n\n", num); + else + fprintf(fout, "\nASSERTIONS %d ;\n\n", num); + numObjs = num; + return 0; +} + +void operand(defrCallbackType_e c, defiAssertion* a, int ind) { + int i, first = 1; + char* netName; + char* fromInst, * fromPin, * toInst, * toPin; + + if (a->isSum()) { + // Sum in operand, recursively call operand + fprintf(fout, "- SUM ( "); + a->unsetSum(); + isSumSet = 1; + begOperand = 0; + operand (c, a, ind); + fprintf(fout, ") "); + } else { + // operand + if (ind >= a->numItems()) { + fprintf(fout, "ERROR: when writing out SUM in Constraints.\n"); + return; + } + if (begOperand) { + fprintf(fout, "- "); + begOperand = 0; + } + for (i = ind; i < a->numItems(); i++) { + if (a->isNet(i)) { + a->net(i, &netName); + if (!first) + fprintf(fout, ", "); // print , as separator + fprintf(fout, "NET %s ", netName); + } else if (a->isPath(i)) { + a->path(i, &fromInst, &fromPin, &toInst, + &toPin); + if (!first) + fprintf(fout, ", "); + fprintf(fout, "PATH %s %s %s %s ", fromInst, fromPin, toInst, + toPin); + } else if (isSumSet) { + // SUM within SUM, reset the flag + a->setSum(); + operand(c, a, i); + } + first = 0; + } + + } +} + +int constraint(defrCallbackType_e c, defiAssertion* a, defiUserData ud) { + // Handles both constraints and assertions + + checkType(c); + if (ud != userData) dataError(); + if (a->isWiredlogic()) + // Wirelogic + fprintf(fout, "- WIREDLOGIC %s + MAXDIST %g ;\n", +// Wiredlogic dist is also store in fallMax +// a->netName(), a->distance()); + a->netName(), a->fallMax()); + else { + // Call the operand function + isSumSet = 0; // reset the global variable + begOperand = 1; + operand (c, a, 0); + // Get the Rise and Fall + if (a->hasRiseMax()) + fprintf(fout, "+ RISEMAX %g ", a->riseMax()); + if (a->hasFallMax()) + fprintf(fout, "+ FALLMAX %g ", a->fallMax()); + if (a->hasRiseMin()) + fprintf(fout, "+ RISEMIN %g ", a->riseMin()); + if (a->hasFallMin()) + fprintf(fout, "+ FALLMIN %g ", a->fallMin()); + fprintf(fout, ";\n"); + } + --numObjs; + if (numObjs <= 0) { + if (c == defrConstraintCbkType) + fprintf(fout, "END CONSTRAINTS\n"); + else + fprintf(fout, "END ASSERTIONS\n"); + } + return 0; +} + + +int propstart(defrCallbackType_e c, void*, defiUserData) { + checkType(c); + fprintf(fout, "\nPROPERTYDEFINITIONS\n"); + isProp = 1; + + return 0; +} + + +int prop(defrCallbackType_e c, defiProp* p, defiUserData ud) { + checkType(c); + if (ud != userData) dataError(); + if (strcmp(p->propType(), "design") == 0) + fprintf(fout, "DESIGN %s ", p->propName()); + else if (strcmp(p->propType(), "net") == 0) + fprintf(fout, "NET %s ", p->propName()); + else if (strcmp(p->propType(), "component") == 0) + fprintf(fout, "COMPONENT %s ", p->propName()); + else if (strcmp(p->propType(), "specialnet") == 0) + fprintf(fout, "SPECIALNET %s ", p->propName()); + else if (strcmp(p->propType(), "group") == 0) + fprintf(fout, "GROUP %s ", p->propName()); + else if (strcmp(p->propType(), "row") == 0) + fprintf(fout, "ROW %s ", p->propName()); + else if (strcmp(p->propType(), "componentpin") == 0) + fprintf(fout, "COMPONENTPIN %s ", p->propName()); + else if (strcmp(p->propType(), "region") == 0) + fprintf(fout, "REGION %s ", p->propName()); + else if (strcmp(p->propType(), "nondefaultrule") == 0) + fprintf(fout, "NONDEFAULTRULE %s ", p->propName()); + if (p->dataType() == 'I') + fprintf(fout, "INTEGER "); + if (p->dataType() == 'R') + fprintf(fout, "REAL "); + if (p->dataType() == 'S') + fprintf(fout, "STRING "); + if (p->dataType() == 'Q') + fprintf(fout, "STRING "); + if (p->hasRange()) { + fprintf(fout, "RANGE %g %g ", p->left(), + p->right()); + } + if (p->hasNumber()) + fprintf(fout, "%g ", p->number()); + if (p->hasString()) + fprintf(fout, "\"%s\" ", p->string()); + fprintf(fout, ";\n"); + + return 0; +} + + +int propend(defrCallbackType_e c, void*, defiUserData) { + checkType(c); + if (isProp) { + fprintf(fout, "END PROPERTYDEFINITIONS\n\n"); + isProp = 0; + } + + return 0; +} + + +int hist(defrCallbackType_e c, const char* h, defiUserData ud) { + checkType(c); + defrSetCaseSensitivity(0); + if (ud != userData) dataError(); + fprintf(fout, "HISTORY %s ;\n", h); + defrSetCaseSensitivity(1); + return 0; +} + + +int an(defrCallbackType_e c, const char* h, defiUserData ud) { + checkType(c); + if (ud != userData) dataError(); + fprintf(fout, "ARRAY %s ;\n", h); + return 0; +} + + +int fn(defrCallbackType_e c, const char* h, defiUserData ud) { + checkType(c); + if (ud != userData) dataError(); + fprintf(fout, "FLOORPLAN %s ;\n", h); + return 0; +} + + +int bbn(defrCallbackType_e c, const char* h, defiUserData ud) { + checkType(c); + if (ud != userData) dataError(); + fprintf(fout, "BUSBITCHARS \"%s\" ;\n", h); + return 0; +} + + +int vers(defrCallbackType_e c, double d, defiUserData ud) { + checkType(c); + if (ud != userData) + dataError(); + fprintf(fout, "VERSION %g ;\n", d); + curVer = d; + + fprintf(fout, "ALIAS alias1 aliasValue1 1 ;\n"); + fprintf(fout, "ALIAS alias2 aliasValue2 0 ;\n"); + + return 0; +} + + +int versStr(defrCallbackType_e c, const char* versionName, defiUserData ud) { + checkType(c); + if (ud != userData) dataError(); + fprintf(fout, "VERSION %s ;\n", versionName); + return 0; +} + + +int units(defrCallbackType_e c, double d, defiUserData ud) { + checkType(c); + if (ud != userData) dataError(); + fprintf(fout, "UNITS DISTANCE MICRONS %g ;\n", d); + return 0; +} + + +int casesens(defrCallbackType_e c, int d, defiUserData ud) { + checkType(c); + if (ud != userData) dataError(); + if (d == 1) + fprintf(fout, "NAMESCASESENSITIVE ON ;\n", d); + else + fprintf(fout, "NAMESCASESENSITIVE OFF ;\n", d); + return 0; +} + + +int cls(defrCallbackType_e c, void* cl, defiUserData ud) { + defiSite* site; // Site and Canplace and CannotOccupy + defiBox* box; // DieArea and + defiPinCap* pc; + defiPin* pin; + int i, j, k; + defiRow* row; + defiTrack* track; + defiGcellGrid* gcg; + defiVia* via; + defiRegion* re; + defiGroup* group; + defiComponentMaskShiftLayer* maskShiftLayer = NULL; + defiScanchain* sc; + defiIOTiming* iot; + defiFPC* fpc; + defiTimingDisable* td; + defiPartition* part; + defiPinProp* pprop; + defiBlockage* block; + defiSlot* slots; + defiFill* fills; + defiStyles* styles; + int xl, yl, xh, yh; + char *name, *a1, *b1; + char **inst, **inPin, **outPin; + int *bits; + int size; + int corner, typ; + const char *itemT; + char dir; + defiPinAntennaModel* aModel; + defiPoints points; + + checkType(c); + if (ud != userData) dataError(); + switch (c) { + + case defrSiteCbkType : + site = (defiSite*)cl; + fprintf(fout, "SITE %s %g %g %s ", site->name(), + site->x_orig(), site->y_orig(), + orientStr(site->orient())); + fprintf(fout, "DO %g BY %g STEP %g %g ;\n", + site->x_num(), site->y_num(), + site->x_step(), site->y_step()); + break; + case defrCanplaceCbkType : + site = (defiSite*)cl; + fprintf(fout, "CANPLACE %s %g %g %s ", site->name(), + site->x_orig(), site->y_orig(), + orientStr(site->orient())); + fprintf(fout, "DO %g BY %g STEP %g %g ;\n", + site->x_num(), site->y_num(), + site->x_step(), site->y_step()); + break; + case defrCannotOccupyCbkType : + site = (defiSite*)cl; + fprintf(fout, "CANNOTOCCUPY %s %g %g %s ", + site->name(), site->x_orig(), + site->y_orig(), orientStr(site->orient())); + fprintf(fout, "DO %g BY %g STEP %g %g ;\n", + site->x_num(), site->y_num(), + site->x_step(), site->y_step()); + break; + case defrDieAreaCbkType : + box = (defiBox*)cl; + fprintf(fout, "DIEAREA %d %d %d %d ;\n", + box->xl(), box->yl(), box->xh(), + box->yh()); + fprintf(fout, "DIEAREA "); + points = box->getPoint(); + for (i = 0; i < points.numPoints; i++) + fprintf(fout, "%d %d ", points.x[i], points.y[i]); + fprintf(fout, ";\n"); + break; + case defrPinCapCbkType : + pc = (defiPinCap*)cl; + if (testDebugPrint) { + pc->print(fout); + } else { + fprintf(fout, "MINPINS %d WIRECAP %g ;\n", + pc->pin(), pc->cap()); + --numObjs; + if (numObjs <= 0) + fprintf(fout, "END DEFAULTCAP\n"); + } + break; + case defrPinCbkType : + pin = (defiPin*)cl; + if (testDebugPrint) { + pin->print(fout); + } else { + fprintf(fout, "- %s + NET %s ", pin->pinName(), + pin->netName()); + // pin->changePinName("pinName"); + // fprintf(fout, "%s ", pin->pinName()); + if (pin->hasDirection()) + fprintf(fout, "+ DIRECTION %s ", pin->direction()); + if (pin->hasUse()) + fprintf(fout, "+ USE %s ", pin->use()); + if (pin->hasNetExpr()) + fprintf(fout, "+ NETEXPR \"%s\" ", pin->netExpr()); + if (pin->hasSupplySensitivity()) + fprintf(fout, "+ SUPPLYSENSITIVITY %s ", + pin->supplySensitivity()); + if (pin->hasGroundSensitivity()) + fprintf(fout, "+ GROUNDSENSITIVITY %s ", + pin->groundSensitivity()); + if (pin->hasLayer()) { + defiPoints points; + for (i = 0; i < pin->numLayer(); i++) { + fprintf(fout, "\n + LAYER %s ", pin->layer(i)); + if (pin->layerMask(i)) + fprintf(fout, "MASK %d ", + pin->layerMask(i)); + if (pin->hasLayerSpacing(i)) + fprintf(fout, "SPACING %d ", + pin->layerSpacing(i)); + if (pin->hasLayerDesignRuleWidth(i)) + fprintf(fout, "DESIGNRULEWIDTH %d ", + pin->layerDesignRuleWidth(i)); + pin->bounds(i, &xl, &yl, &xh, &yh); + fprintf(fout, "%d %d %d %d ", xl, yl, xh, yh); + } + for (i = 0; i < pin->numPolygons(); i++) { + fprintf(fout, "\n + POLYGON %s ", + pin->polygonName(i)); + if (pin->polygonMask(i)) + fprintf(fout, "MASK %d ", + pin->polygonMask(i)); + if (pin->hasPolygonSpacing(i)) + fprintf(fout, "SPACING %d ", + pin->polygonSpacing(i)); + if (pin->hasPolygonDesignRuleWidth(i)) + fprintf(fout, "DESIGNRULEWIDTH %d ", + pin->polygonDesignRuleWidth(i)); + points = pin->getPolygon(i); + for (j = 0; j < points.numPoints; j++) + fprintf(fout, "%d %d ", points.x[j], points.y[j]); + } + for (i = 0; i < pin->numVias(); i++) { + if (pin->viaTopMask(i) || pin->viaCutMask(i) || pin->viaBottomMask(i)) { + fprintf(fout, "\n + VIA %s MASK %d%d%d %d %d ", + pin->viaName(i), + pin->viaTopMask(i), + pin->viaCutMask(i), + pin->viaBottomMask(i), + pin->viaPtX(i), + pin->viaPtY(i)); + } else { + fprintf(fout, "\n + VIA %s %d %d ", pin->viaName(i), + pin->viaPtX(i), pin->viaPtY(i)); + } + } + } + if (pin->hasPort()) { + defiPoints points; + defiPinPort* port; + for (j = 0; j < pin->numPorts(); j++) { + port = pin->pinPort(j); + fprintf(fout, "\n + PORT"); + for (i = 0; i < port->numLayer(); i++) { + fprintf(fout, "\n + LAYER %s ", + port->layer(i)); + if (port->layerMask(i)) + fprintf(fout, "MASK %d ", + port->layerMask(i)); + if (port->hasLayerSpacing(i)) + fprintf(fout, "SPACING %d ", + port->layerSpacing(i)); + if (port->hasLayerDesignRuleWidth(i)) + fprintf(fout, "DESIGNRULEWIDTH %d ", + port->layerDesignRuleWidth(i)); + port->bounds(i, &xl, &yl, &xh, &yh); + fprintf(fout, "%d %d %d %d ", xl, yl, xh, yh); + } + for (i = 0; i < port->numPolygons(); i++) { + fprintf(fout, "\n + POLYGON %s ", + port->polygonName(i)); + if (port->polygonMask(i)) + fprintf(fout, "MASK %d ", + port->polygonMask(i)); + if (port->hasPolygonSpacing(i)) + fprintf(fout, "SPACING %d ", + port->polygonSpacing(i)); + if (port->hasPolygonDesignRuleWidth(i)) + fprintf(fout, "DESIGNRULEWIDTH %d ", + port->polygonDesignRuleWidth(i)); + points = port->getPolygon(i); + for (k = 0; k < points.numPoints; k++) + fprintf(fout, "( %d %d ) ", points.x[k], points.y[k]); + } + for (i = 0; i < port->numVias(); i++) { + if (port->viaTopMask(i) || port->viaCutMask(i) + || port->viaBottomMask(i)) { + fprintf(fout, "\n + VIA %s MASK %d%d%d ( %d %d ) ", + port->viaName(i), + port->viaTopMask(i), + port->viaCutMask(i), + port->viaBottomMask(i), + port->viaPtX(i), + port->viaPtY(i)); + } else { + fprintf(fout, "\n + VIA %s ( %d %d ) ", + port->viaName(i), + port->viaPtX(i), + port->viaPtY(i)); + } + } + if (port->hasPlacement()) { + if (port->isPlaced()) { + fprintf(fout, "\n + PLACED "); + fprintf(fout, "( %d %d ) %s ", + port->placementX(), + port->placementY(), + orientStr(port->orient())); + } + if (port->isCover()) { + fprintf(fout, "\n + COVER "); + fprintf(fout, "( %d %d ) %s ", + port->placementX(), + port->placementY(), + orientStr(port->orient())); + } + if (port->isFixed()) { + fprintf(fout, "\n + FIXED "); + fprintf(fout, "( %d %d ) %s ", + port->placementX(), + port->placementY(), + orientStr(port->orient())); + } + } + } + } + if (pin->hasPlacement()) { + if (pin->isPlaced()) { + fprintf(fout, "+ PLACED "); + fprintf(fout, "( %d %d ) %s ", pin->placementX(), + pin->placementY(), + orientStr(pin->orient())); + } + if (pin->isCover()) { + fprintf(fout, "+ COVER "); + fprintf(fout, "( %d %d ) %s ", pin->placementX(), + pin->placementY(), + orientStr(pin->orient())); + } + if (pin->isFixed()) { + fprintf(fout, "+ FIXED "); + fprintf(fout, "( %d %d ) %s ", pin->placementX(), + pin->placementY(), + orientStr(pin->orient())); + } + if (pin->isUnplaced()) + fprintf(fout, "+ UNPLACED "); + } + if (pin->hasSpecial()) { + fprintf(fout, "+ SPECIAL "); + } + if (pin->hasAPinPartialMetalArea()) { + for (i = 0; i < pin->numAPinPartialMetalArea(); i++) { + fprintf(fout, "ANTENNAPINPARTIALMETALAREA %d", + pin->APinPartialMetalArea(i)); + if (*(pin->APinPartialMetalAreaLayer(i))) + fprintf(fout, " LAYER %s", + pin->APinPartialMetalAreaLayer(i)); + fprintf(fout, "\n"); + } + } + if (pin->hasAPinPartialMetalSideArea()) { + for (i = 0; i < pin->numAPinPartialMetalSideArea(); i++) { + fprintf(fout, "ANTENNAPINPARTIALMETALSIDEAREA %d", + pin->APinPartialMetalSideArea(i)); + if (*(pin->APinPartialMetalSideAreaLayer(i))) + fprintf(fout, " LAYER %s", + pin->APinPartialMetalSideAreaLayer(i)); + fprintf(fout, "\n"); + } + } + if (pin->hasAPinDiffArea()) { + for (i = 0; i < pin->numAPinDiffArea(); i++) { + fprintf(fout, "ANTENNAPINDIFFAREA %d", pin->APinDiffArea(i)); + if (*(pin->APinDiffAreaLayer(i))) + fprintf(fout, " LAYER %s", pin->APinDiffAreaLayer(i)); + fprintf(fout, "\n"); + } + } + if (pin->hasAPinPartialCutArea()) { + for (i = 0; i < pin->numAPinPartialCutArea(); i++) { + fprintf(fout, "ANTENNAPINPARTIALCUTAREA %d", + pin->APinPartialCutArea(i)); + if (*(pin->APinPartialCutAreaLayer(i))) + fprintf(fout, " LAYER %s", pin->APinPartialCutAreaLayer(i)); + fprintf(fout, "\n"); + } + } + + for (j = 0; j < pin->numAntennaModel(); j++) { + aModel = pin->antennaModel(j); + + fprintf(fout, "ANTENNAMODEL %s\n", + aModel->antennaOxide()); + + if (aModel->hasAPinGateArea()) { + for (i = 0; i < aModel->numAPinGateArea(); + i++) { + fprintf(fout, "ANTENNAPINGATEAREA %d", + aModel->APinGateArea(i)); + if (aModel->hasAPinGateAreaLayer(i)) + fprintf(fout, " LAYER %s", aModel->APinGateAreaLayer(i)); + fprintf(fout, "\n"); + } + } + if (aModel->hasAPinMaxAreaCar()) { + for (i = 0; + i < aModel->numAPinMaxAreaCar(); i++) { + fprintf(fout, "ANTENNAPINMAXAREACAR %d", + aModel->APinMaxAreaCar(i)); + if (aModel->hasAPinMaxAreaCarLayer(i)) + fprintf(fout, + " LAYER %s", aModel->APinMaxAreaCarLayer(i)); + fprintf(fout, "\n"); + } + } + if (aModel->hasAPinMaxSideAreaCar()) { + for (i = 0; + i < aModel->numAPinMaxSideAreaCar(); + i++) { + fprintf(fout, "ANTENNAPINMAXSIDEAREACAR %d", + aModel->APinMaxSideAreaCar(i)); + if (aModel->hasAPinMaxSideAreaCarLayer(i)) + fprintf(fout, + " LAYER %s", aModel->APinMaxSideAreaCarLayer(i)); + fprintf(fout, "\n"); + } + } + if (aModel->hasAPinMaxCutCar()) { + for (i = 0; i < aModel->numAPinMaxCutCar(); + i++) { + fprintf(fout, "ANTENNAPINMAXCUTCAR %d", + aModel->APinMaxCutCar(i)); + if (aModel->hasAPinMaxCutCarLayer(i)) + fprintf(fout, " LAYER %s", + aModel->APinMaxCutCarLayer(i)); + fprintf(fout, "\n"); + } + } + } + fprintf(fout, ";\n"); + --numObjs; + if (numObjs <= 0) + fprintf(fout, "END PINS\n"); + } + break; + case defrDefaultCapCbkType : + i = (long)cl; + fprintf(fout, "DEFAULTCAP %d\n", i); + numObjs = i; + break; + case defrRowCbkType : + row = (defiRow*)cl; + fprintf(fout, "ROW %s %s %g %g %s ", ignoreRowNames ? "XXX" : row->name(), + row->macro(), row->x(), row->y(), + orientStr(row->orient())); + if (row->hasDo()) { + fprintf(fout, "DO %g BY %g ", + row->xNum(), row->yNum()); + if (row->hasDoStep()) + fprintf(fout, "STEP %g %g ;\n", + row->xStep(), row->yStep()); + else + fprintf(fout, ";\n"); + } else + fprintf(fout, ";\n"); + if (row->numProps() > 0) { + for (i = 0; i < row->numProps(); i++) { + fprintf(fout, " + PROPERTY %s %s ", + row->propName(i), + row->propValue(i)); + switch (row->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"); + } + break; + case defrTrackCbkType : + track = (defiTrack*)cl; + if (track->firstTrackMask()) { + if (track->sameMask()) { + fprintf(fout, "TRACKS %s %g DO %g STEP %g MASK %d SAMEMASK LAYER ", + track->macro(), track->x(), + track->xNum(), track->xStep(), + track->firstTrackMask()); + } else { + fprintf(fout, "TRACKS %s %g DO %g STEP %g MASK %d LAYER ", + track->macro(), track->x(), + track->xNum(), track->xStep(), + track->firstTrackMask()); + } + } else { + fprintf(fout, "TRACKS %s %g DO %g STEP %g LAYER ", + track->macro(), track->x(), + track->xNum(), track->xStep()); + } + for (i = 0; i < track->numLayers(); i++) + fprintf(fout, "%s ", track->layer(i)); + fprintf(fout, ";\n"); + break; + case defrGcellGridCbkType : + gcg = (defiGcellGrid*)cl; + fprintf(fout, "GCELLGRID %s %d DO %d STEP %g ;\n", + gcg->macro(), gcg->x(), + gcg->xNum(), gcg->xStep()); + break; + case defrViaCbkType : + via = (defiVia*)cl; + if (testDebugPrint) { + via->print(fout); + } else { + fprintf(fout, "- %s ", via->name()); + if (via->hasPattern()) + fprintf(fout, "+ PATTERNNAME %s ", via->pattern()); + for (i = 0; i < via->numLayers(); i++) { + via->layer(i, &name, &xl, &yl, &xh, &yh); + int rectMask = via->rectMask(i); + + if (rectMask) { + fprintf(fout, "+ RECT %s + MASK %d %d %d %d %d \n", + name, rectMask, xl, yl, xh, yh); + } else { + fprintf(fout, "+ RECT %s %d %d %d %d \n", + name, xl, yl, xh, yh); + } + } + // POLYGON + if (via->numPolygons()) { + defiPoints points; + for (i = 0; i < via->numPolygons(); i++) { + int polyMask = via->polyMask(i); + + if (polyMask) { + fprintf(fout, "\n + POLYGON %s + MASK %d ", + via->polygonName(i), polyMask); + } else { + fprintf(fout, "\n + POLYGON %s ", via->polygonName(i)); + } + points = via->getPolygon(i); + for (j = 0; j < points.numPoints; j++) + fprintf(fout, "%d %d ", points.x[j], points.y[j]); + } + } + fprintf(fout, " ;\n"); + if (via->hasViaRule()) { + char *vrn, *bl, *cl, *tl; + int xs, ys, xcs, ycs, xbe, ybe, xte, yte; + int cr, cc, xo, yo, xbo, ybo, xto, yto; + (void)via->viaRule(&vrn, &xs, &ys, &bl, &cl, &tl, &xcs, + &ycs, &xbe, &ybe, &xte, &yte); + fprintf(fout, "+ VIARULE '%s'\n", ignoreViaNames ? "XXX" : vrn); + fprintf(fout, " + CUTSIZE %d %d\n", xs, ys); + fprintf(fout, " + LAYERS %s %s %s\n", bl, cl, tl); + fprintf(fout, " + CUTSPACING %d %d\n", xcs, ycs); + fprintf(fout, " + ENCLOSURE %d %d %d %d\n", xbe, ybe, xte, yte); + if (via->hasRowCol()) { + (void)via->rowCol(&cr, &cc); + fprintf(fout, " + ROWCOL %d %d\n", cr, cc); + } + if (via->hasOrigin()) { + (void)via->origin(&xo, &yo); + fprintf(fout, " + ORIGIN %d %d\n", xo, yo); + } + if (via->hasOffset()) { + (void)via->offset(&xbo, &ybo, &xto, &yto); + fprintf(fout, " + OFFSET %d %d %d %d\n", xbo, ybo, xto, yto); + } + if (via->hasCutPattern()) + fprintf(fout, " + PATTERN '%s'\n", via->cutPattern()); + } + --numObjs; + if (numObjs <= 0) + fprintf(fout, "END VIAS\n"); + } + break; + case defrRegionCbkType : + re = (defiRegion*)cl; + fprintf(fout, "- %s ", re->name()); + for (i = 0; i < re->numRectangles(); i++) + fprintf(fout, "%d %d %d %d \n", re->xl(i), + re->yl(i), re->xh(i), + re->yh(i)); + if (re->hasType()) + fprintf(fout, "+ TYPE %s\n", re->type()); + if (re->numProps()) { + for (i = 0; i < re->numProps(); i++) { + fprintf(fout, "+ PROPERTY %s %s ", re->propName(i), + re->propValue(i)); + switch (re->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"); + --numObjs; + if (numObjs <= 0) { + fprintf(fout, "END REGIONS\n"); + } + break; + case defrGroupNameCbkType : + if ((char*)cl) { + fprintf(fout, "- %s", (char*)cl); + } + break; + case defrGroupMemberCbkType : + if ((char*)cl) { + fprintf(fout, " %s", (char*)cl); + } + break; + case defrComponentMaskShiftLayerCbkType : + fprintf(fout, "COMPONENTMASKSHIFT "); + + for (i = 0; i < maskShiftLayer->numMaskShiftLayers(); i++) { + fprintf(fout, "%s ", maskShiftLayer->maskShiftLayer(i)); + } + fprintf(fout, ";\n"); + break; + case defrGroupCbkType : + group = (defiGroup*)cl; + if (group->hasMaxX() | group->hasMaxY() + | group->hasPerim()) { + fprintf(fout, "\n + SOFT "); + if (group->hasPerim()) + fprintf(fout, "MAXHALFPERIMETER %d ", + group->perim()); + if (group->hasMaxX()) + fprintf(fout, "MAXX %d ", group->maxX()); + if (group->hasMaxY()) + fprintf(fout, "MAXY %d ", group->maxY()); + } + if (group->hasRegionName()) + fprintf(fout, "\n + REGION %s ", group->regionName()); + if (group->hasRegionBox()) { + int *gxl, *gyl, *gxh, *gyh; + int size; + group->regionRects(&size, &gxl, &gyl, &gxh, &gyh); + for (i = 0; i < size; i++) + fprintf(fout, "REGION %d %d %d %d ", gxl[i], gyl[i], + gxh[i], gyh[i]); + } + if (group->numProps()) { + for (i = 0; i < group->numProps(); i++) { + fprintf(fout, "\n + PROPERTY %s %s ", + group->propName(i), + group->propValue(i)); + switch (group->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"); + --numObjs; + if (numObjs <= 0) + fprintf(fout, "END GROUPS\n"); + break; + case defrScanchainCbkType : + sc = (defiScanchain*)cl; + fprintf(fout, "- %s\n", sc->name()); + if (sc->hasStart()) { + sc->start(&a1, &b1); + fprintf(fout, " + START %s %s\n", a1, b1); + } + if (sc->hasStop()) { + sc->stop(&a1, &b1); + fprintf(fout, " + STOP %s %s\n", a1, b1); + } + if (sc->hasCommonInPin() || + sc->hasCommonOutPin()) { + fprintf(fout, " + COMMONSCANPINS "); + if (sc->hasCommonInPin()) + fprintf(fout, " ( IN %s ) ", sc->commonInPin()); + if (sc->hasCommonOutPin()) + fprintf(fout, " ( OUT %s ) ",sc->commonOutPin()); + fprintf(fout, "\n"); + } + if (sc->hasFloating()) { + sc->floating(&size, &inst, &inPin, &outPin, &bits); + if (size > 0) + fprintf(fout, " + FLOATING\n"); + for (i = 0; i < size; i++) { + fprintf(fout, " %s ", inst[i]); + if (inPin[i]) + fprintf(fout, "( IN %s ) ", inPin[i]); + if (outPin[i]) + fprintf(fout, "( OUT %s ) ", outPin[i]); + if (bits[i] != -1) + fprintf(fout, "( BITS %d ) ", bits[i]); + fprintf(fout, "\n"); + } + } + + if (sc->hasOrdered()) { + for (i = 0; i < sc->numOrderedLists(); i++) { + sc->ordered(i, &size, &inst, &inPin, &outPin, + &bits); + if (size > 0) + fprintf(fout, " + ORDERED\n"); + for (j = 0; j < size; j++) { + fprintf(fout, " %s ", inst[j]); + if (inPin[j]) + fprintf(fout, "( IN %s ) ", inPin[j]); + if (outPin[j]) + fprintf(fout, "( OUT %s ) ", outPin[j]); + if (bits[j] != -1) + fprintf(fout, "( BITS %d ) ", bits[j]); + fprintf(fout, "\n"); + } + } + } + + if (sc->hasPartition()) { + fprintf(fout, " + PARTITION %s ", + sc->partitionName()); + if (sc->hasPartitionMaxBits()) + fprintf(fout, "MAXBITS %d ", + sc->partitionMaxBits()); + } + fprintf(fout, ";\n"); + --numObjs; + if (numObjs <= 0) + fprintf(fout, "END SCANCHAINS\n"); + break; + case defrIOTimingCbkType : + iot = (defiIOTiming*)cl; + fprintf(fout, "- ( %s %s )\n", iot->inst(), + iot->pin()); + if (iot->hasSlewRise()) + fprintf(fout, " + RISE SLEWRATE %g %g\n", + iot->slewRiseMin(), + iot->slewRiseMax()); + if (iot->hasSlewFall()) + fprintf(fout, " + FALL SLEWRATE %g %g\n", + iot->slewFallMin(), + iot->slewFallMax()); + if (iot->hasVariableRise()) + fprintf(fout, " + RISE VARIABLE %g %g\n", + iot->variableRiseMin(), + iot->variableRiseMax()); + if (iot->hasVariableFall()) + fprintf(fout, " + FALL VARIABLE %g %g\n", + iot->variableFallMin(), + iot->variableFallMax()); + if (iot->hasCapacitance()) + fprintf(fout, " + CAPACITANCE %g\n", + iot->capacitance()); + if (iot->hasDriveCell()) { + fprintf(fout, " + DRIVECELL %s ", + iot->driveCell()); + if (iot->hasFrom()) + fprintf(fout, " FROMPIN %s ", + iot->from()); + if (iot->hasTo()) + fprintf(fout, " TOPIN %s ", + iot->to()); + if (iot->hasParallel()) + fprintf(fout, "PARALLEL %g", + iot->parallel()); + fprintf(fout, "\n"); + } + fprintf(fout, ";\n"); + --numObjs; + if (numObjs <= 0) + fprintf(fout, "END IOTIMINGS\n"); + break; + case defrFPCCbkType : + fpc = (defiFPC*)cl; + fprintf(fout, "- %s ", fpc->name()); + if (fpc->isVertical()) + fprintf(fout, "VERTICAL "); + if (fpc->isHorizontal()) + fprintf(fout, "HORIZONTAL "); + if (fpc->hasAlign()) + fprintf(fout, "ALIGN "); + if (fpc->hasMax()) + fprintf(fout, "%g ", fpc->alignMax()); + if (fpc->hasMin()) + fprintf(fout, "%g ", fpc->alignMin()); + if (fpc->hasEqual()) + fprintf(fout, "%g ", fpc->equal()); + for (i = 0; i < fpc->numParts(); i++) { + fpc->getPart(i, &corner, &typ, &name); + if (corner == 'B') + fprintf(fout, "BOTTOMLEFT "); + else + fprintf(fout, "TOPRIGHT "); + if (typ == 'R') + fprintf(fout, "ROWS %s ", name); + else + fprintf(fout, "COMPS %s ", name); + } + fprintf(fout, ";\n"); + --numObjs; + if (numObjs <= 0) + fprintf(fout, "END FLOORPLANCONSTRAINTS\n"); + break; + case defrTimingDisableCbkType : + td = (defiTimingDisable*)cl; + if (td->hasFromTo()) + fprintf(fout, "- FROMPIN %s %s ", + td->fromInst(), + td->fromPin(), + td->toInst(), + td->toPin()); + if (td->hasThru()) + fprintf(fout, "- THRUPIN %s %s ", + td->thruInst(), + td->thruPin()); + if (td->hasMacroFromTo()) + fprintf(fout, "- MACRO %s FROMPIN %s %s ", + td->macroName(), + td->fromPin(), + td->toPin()); + if (td->hasMacroThru()) + fprintf(fout, "- MACRO %s THRUPIN %s %s ", + td->macroName(), + td->fromPin()); + fprintf(fout, ";\n"); + break; + case defrPartitionCbkType : + part = (defiPartition*)cl; + fprintf(fout, "- %s ", part->name()); + if (part->isSetupRise() | + part->isSetupFall() | + part->isHoldRise() | + part->isHoldFall()) { + // has turnoff + fprintf(fout, "TURNOFF "); + if (part->isSetupRise()) + fprintf(fout, "SETUPRISE "); + if (part->isSetupFall()) + fprintf(fout, "SETUPFALL "); + if (part->isHoldRise()) + fprintf(fout, "HOLDRISE "); + if (part->isHoldFall()) + fprintf(fout, "HOLDFALL "); + } + itemT = part->itemType(); + dir = part->direction(); + if (strcmp(itemT, "CLOCK") == 0) { + if (dir == 'T') // toclockpin + fprintf(fout, "+ TOCLOCKPIN %s %s ", + part->instName(), + part->pinName()); + if (dir == 'F') // fromclockpin + fprintf(fout, "+ FROMCLOCKPIN %s %s ", + part->instName(), + part->pinName()); + if (part->hasMin()) + fprintf(fout, "MIN %g %g ", + part->partitionMin(), + part->partitionMax()); + if (part->hasMax()) + fprintf(fout, "MAX %g %g ", + part->partitionMin(), + part->partitionMax()); + fprintf(fout, "PINS "); + for (i = 0; i < part->numPins(); i++) + fprintf(fout, "%s ", part->pin(i)); + } else if (strcmp(itemT, "IO") == 0) { + if (dir == 'T') // toiopin + fprintf(fout, "+ TOIOPIN %s %s ", + part->instName(), + part->pinName()); + if (dir == 'F') // fromiopin + fprintf(fout, "+ FROMIOPIN %s %s ", + part->instName(), + part->pinName()); + } else if (strcmp(itemT, "COMP") == 0) { + if (dir == 'T') // tocomppin + fprintf(fout, "+ TOCOMPPIN %s %s ", + part->instName(), + part->pinName()); + if (dir == 'F') // fromcomppin + fprintf(fout, "+ FROMCOMPPIN %s %s ", + part->instName(), + part->pinName()); + } + fprintf(fout, ";\n"); + --numObjs; + if (numObjs <= 0) + fprintf(fout, "END PARTITIONS\n"); + break; + + case defrPinPropCbkType : + pprop = (defiPinProp*)cl; + if (pprop->isPin()) + fprintf(fout, "- PIN %s ", pprop->pinName()); + else + fprintf(fout, "- %s %s ", + pprop->instName(), + pprop->pinName()); + fprintf(fout, ";\n"); + if (pprop->numProps() > 0) { + for (i = 0; i < pprop->numProps(); i++) { + fprintf(fout, " + PROPERTY %s %s ", + pprop->propName(i), + pprop->propValue(i)); + switch (pprop->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"); + } + --numObjs; + if (numObjs <= 0) + fprintf(fout, "END PINPROPERTIES\n"); + break; + case defrBlockageCbkType : + block = (defiBlockage*)cl; + if (testDebugPrint) { + block->print(fout); + } else { + if (block->hasLayer()) { + fprintf(fout, "- LAYER %s\n", block->layerName()); + if (block->hasComponent()) + fprintf(fout, " + COMPONENT %s\n", + block->layerComponentName()); + if (block->hasSlots()) + fprintf(fout, " + SLOTS\n"); + if (block->hasFills()) + fprintf(fout, " + FILLS\n"); + if (block->hasPushdown()) + fprintf(fout, " + PUSHDOWN\n"); + if (block->hasExceptpgnet()) + fprintf(fout, " + EXCEPTPGNET\n"); + if (block->hasMask()) + fprintf(fout, " + MASK %d\n", block->mask()); + if (block->hasSpacing()) + fprintf(fout, " + SPACING %d\n", + block->minSpacing()); + if (block->hasDesignRuleWidth()) + fprintf(fout, " + DESIGNRULEWIDTH %d\n", + block->designRuleWidth()); + } + else if (block->hasPlacement()) { + fprintf(fout, "- PLACEMENT\n"); + if (block->hasSoft()) + fprintf(fout, " + SOFT\n"); + if (block->hasPartial()) + fprintf(fout, " + PARTIAL %g\n", + block->placementMaxDensity()); + if (block->hasComponent()) + fprintf(fout, " + COMPONENT %s\n", + block->placementComponentName()); + if (block->hasPushdown()) + fprintf(fout, " + PUSHDOWN\n"); + } + + for (i = 0; i < block->numRectangles(); i++) { + fprintf(fout, " RECT %d %d %d %d\n", + block->xl(i), block->yl(i), + block->xh(i), block->yh(i)); + } + + for (i = 0; i < block->numPolygons(); i++) { + fprintf(fout, " POLYGON "); + points = block->getPolygon(i); + for (j = 0; j < points.numPoints; j++) + fprintf(fout, "%d %d ", points.x[j], points.y[j]); + fprintf(fout, "\n"); + } + fprintf(fout, ";\n"); + --numObjs; + if (numObjs <= 0) + fprintf(fout, "END BLOCKAGES\n"); + } + break; + case defrSlotCbkType : + slots = (defiSlot*)cl; + if (slots->hasLayer()) + fprintf(fout, "- LAYER %s\n", slots->layerName()); + + for (i = 0; i < slots->numRectangles(); i++) { + fprintf(fout, " RECT %d %d %d %d\n", + slots->xl(i), slots->yl(i), + slots->xh(i), slots->yh(i)); + } + for (i = 0; i < slots->numPolygons(); i++) { + fprintf(fout, " POLYGON "); + points = slots->getPolygon(i); + for (j = 0; j < points.numPoints; j++) + fprintf(fout, "%d %d ", points.x[j], points.y[j]); + fprintf(fout, ";\n"); + } + fprintf(fout, ";\n"); + --numObjs; + if (numObjs <= 0) + fprintf(fout, "END SLOTS\n"); + break; + case defrFillCbkType : + fills = (defiFill*)cl; + if (testDebugPrint) { + fills->print(fout); + } else { + if (fills->hasLayer()) { + fprintf(fout, "- LAYER %s", fills->layerName()); + if (fills->layerMask()) { + fprintf(fout, " + MASK %d", fills->layerMask()); + } + if (fills->hasLayerOpc()) + fprintf(fout, " + OPC"); + fprintf(fout, "\n"); + + for (i = 0; i < fills->numRectangles(); i++) { + fprintf(fout, " RECT %d %d %d %d\n", + fills->xl(i), fills->yl(i), + fills->xh(i), fills->yh(i)); + } + for (i = 0; i < fills->numPolygons(); i++) { + fprintf(fout, " POLYGON "); + points = fills->getPolygon(i); + for (j = 0; j < points.numPoints; j++) + fprintf(fout, "%d %d ", points.x[j], points.y[j]); + fprintf(fout, ";\n"); + } + fprintf(fout, ";\n"); + } + --numObjs; + if (fills->hasVia()) { + fprintf(fout, "- VIA %s", fills->viaName()); + if (fills->viaTopMask() || fills->viaCutMask() + || fills->viaBottomMask()) { + fprintf(fout, " + MASK %d%d%d", + fills->viaTopMask(), + fills->viaCutMask(), + fills->viaBottomMask()); + } + if (fills->hasViaOpc()) + fprintf(fout, " + OPC"); + fprintf(fout, "\n"); + + for (i = 0; i < fills->numViaPts(); i++) { + points = fills->getViaPts(i); + for (j = 0; j < points.numPoints; j++) + fprintf(fout, " %d %d", points.x[j], points.y[j]); + fprintf(fout, ";\n"); + } + fprintf(fout, ";\n"); + } + if (numObjs <= 0) + fprintf(fout, "END FILLS\n"); + } + break; + case defrStylesCbkType : +// defiPoints points; + styles = (defiStyles*)cl; + fprintf(fout, "- STYLE %d ", styles->style()); + points = styles->getPolygon(); + for (j = 0; j < points.numPoints; j++) + fprintf(fout, "%d %d ", points.x[j], points.y[j]); + fprintf(fout, ";\n"); + --numObjs; + if (numObjs <= 0) + fprintf(fout, "END STYLES\n"); + break; + + default: fprintf(fout, "BOGUS callback to cls.\n"); return 1; + } + return 0; +} + + +int dn(defrCallbackType_e c, const char* h, defiUserData ud) { + checkType(c); + if (ud != userData) dataError(); + fprintf(fout, "DIVIDERCHAR \"%s\" ;\n",h); + return 0; +} + + +int ext(defrCallbackType_e t, const char* c, defiUserData ud) { + char* name; + + checkType(t); + if (ud != userData) dataError(); + + switch (t) { + case defrNetExtCbkType : name = address("net"); break; + case defrComponentExtCbkType : name = address("component"); break; + case defrPinExtCbkType : name = address("pin"); break; + case defrViaExtCbkType : name = address("via"); break; + case defrNetConnectionExtCbkType : name = address("net connection"); break; + case defrGroupExtCbkType : name = address("group"); break; + case defrScanChainExtCbkType : name = address("scanchain"); break; + case defrIoTimingsExtCbkType : name = address("io timing"); break; + case defrPartitionsExtCbkType : name = address("partition"); break; + default: name = address("BOGUS"); return 1; + } + fprintf(fout, " %s extension %s\n", name, c); + return 0; +} + +int extension(defrCallbackType_e c, const char* extsn, defiUserData ud) { + checkType(c); + if (ud != userData) dataError(); + fprintf(fout, "BEGINEXT %s\n", extsn); + return 0; +} + +void* mallocCB(size_t size) { + return malloc(size); +} + +void* reallocCB(void* name, size_t size) { + return realloc(name, size); +} + +void freeCB(void* name) { + free(name); + return; +} + + +BEGIN_LEFDEF_PARSER_NAMESPACE +extern long long nlines; +END_LEFDEF_PARSER_NAMESPACE +static int ccr1131444 = 0; + +void lineNumberCB(long long lineNo) { + + // The CCR 1131444 tests ability of the DEF parser to count + // input line numbers out of 32-bit int range. On the first callback + // call 10G lines will be added to line counter. It should be + // reflected in output. + if (ccr1131444) { + lineNo += 10000000000LL; + defrSetNLines(lineNo); + ccr1131444 = 0; + } + +#ifdef _WIN32 + fprintf(fout, "Parsed %I64d number of lines!!\n", lineNo); +#else + fprintf(fout, "Parsed %lld number of lines!!\n", lineNo); +#endif +} + +int unUsedCB(defrCallbackType_e, void*, defiUserData) { + fprintf(fout, "This callback is not used.\n"); + return 0; +} + +void printWarning(const char *str) +{ + fprintf(stderr, "%s\n", str); +} + +int main(int argc, char** argv) { + int num = 99; + char* inFile[6]; + char* outFile; + FILE* f; + int res; + int noCalls = 0; +// long start_mem; + int retStr = 0; + int numInFile = 0; + int fileCt = 0; + int test1 = 0; + int test2 = 0; + int noNetCb = 0; + int ccr749853 = 0; + int line_num_print_interval = 50; + +#ifdef WIN32 + // Enable two-digit exponent format + _set_output_format(_TWO_DIGIT_EXPONENT); +#endif + +// start_mem = (long)sbrk(0); + + strcpy(defaultName, "def.in"); + strcpy(defaultOut, "list"); + inFile[0] = defaultName; + outFile = defaultOut; + fout = stdout; + userData = (void*) 0x01020304; + argc--; + argv++; + + if (argc == 0) { + fprintf(stderr, "Type 'defrw --help' for the help.\n"); + return 2; + } + + while (argc--) { + if (strcmp(*argv, "-d") == 0) { + argv++; + argc--; + sscanf(*argv, "%d", &num); + defiSetDebug(num, 1); + } else if (strcmp(*argv, "-nc") == 0) { + noCalls = 1; + } else if (strcmp(*argv, "-o") == 0) { + argv++; + argc--; + outFile = *argv; + if ((fout = fopen(outFile, "w")) == 0) { + fprintf(stderr, "ERROR: could not open output file\n"); + return 2; + } + } else if (strcmp(*argv, "-verStr") == 0) { + /* New to set the version callback routine to return a string */ + /* instead of double. */ + retStr = 1; + } else if (strcmp(*argv, "-i") == 0) { + argv++; + argc--; + line_num_print_interval = atoi(*argv); + } else if (strcmp(*argv, "-test1") == 0) { + test1 = 1; + } else if (strcmp(*argv, "-test2") == 0) { + test2 = 1; + } else if (strcmp(*argv, "-noNet") == 0) { + noNetCb = 1; + } else if (strcmp(*argv, "-ccr749853") == 0) { + ccr749853 = 1; + } else if (strcmp(*argv, "-ccr1131444") == 0) { + ccr1131444 = 1; + } else if (strcmp(*argv, "-testDebugPrint") == 0) { + testDebugPrint = 1; + } else if (strcmp(*argv, "-sessionless") == 0) { + isSessionless = 1; + } else if (strcmp(*argv, "-ignoreRowNames") == 0) { + ignoreRowNames = 1; + } else if (strcmp(*argv, "-ignoreViaNames") == 0) { + ignoreViaNames = 1; + } else if (argv[0][0] != '-') { + if (numInFile >= 6) { + fprintf(stderr, "ERROR: too many input files, max = 6.\n"); + return 2; + } + inFile[numInFile++] = *argv; + } else if ((strcmp(*argv, "-h") == 0) || (strcmp(*argv, "--help") == 0)) { + fprintf(stderr, "Usage: defrw (