From 2906d90b0482d76b0b80199b8d7b71c33f59f127 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Sun, 7 Jun 2015 14:12:00 +0200 Subject: [PATCH] Re-activate the LEF/DEF symbolic exporter (for benchmarking). * Change: In bootstrap, in FindLEFDEF.cmake, adds my personal path where the LEF/DEF libraries are to be found (~jpc/oa/lefdef/5.7-s038/). * Change: In CRL Core, in LEF/DEF exporters, use the default routing gauge and cell gauge, instead of systematically requiring "sxlib". IMPORTANT: In order to build a *shared* library including the *static* LEF/DEF libraries, those libraries, even if static, must be build with the "-fPIC" flag (otherwise the compiler complains). I have done so on my 64 bit build of LEF/DEF, but it's a completly *local* patch. You may have to do it manually on your installations. --- bootstrap/cmake_modules/FindLEFDEF.cmake | 54 +++++++++++++----------- crlcore/src/ccore/lefdef/DefExport.cpp | 4 +- crlcore/src/ccore/lefdef/LefExport.cpp | 8 ++-- 3 files changed, 36 insertions(+), 30 deletions(-) diff --git a/bootstrap/cmake_modules/FindLEFDEF.cmake b/bootstrap/cmake_modules/FindLEFDEF.cmake index 99508085..52f3a4cd 100644 --- a/bootstrap/cmake_modules/FindLEFDEF.cmake +++ b/bootstrap/cmake_modules/FindLEFDEF.cmake @@ -38,43 +38,46 @@ # LEFDEF_ZLEF_LIBRARY_DEBUG -macro ( _find_lefdef_lib varname libname ) - find_library ( LEFDEF_${varname}_LIBRARY_RELEASE NAMES ${libname} PATHS ${LEFDEF_LIBRARY_DIR} ) - find_library ( LEFDEF_${varname}_LIBRARY_DEBUG NAMES ${libname}_Debug PATHS ${LEFDEF_LIBRARY_DIR} ) +macro( _find_lefdef_lib varname libname ) + find_library( LEFDEF_${varname}_LIBRARY_RELEASE NAMES ${libname} PATHS ${LEFDEF_LIBRARY_DIR} ) + find_library( LEFDEF_${varname}_LIBRARY_DEBUG NAMES ${libname}_Debug PATHS ${LEFDEF_LIBRARY_DIR} ) - if ( LEFDEF_${varname}_LIBRARY_RELEASE AND NOT LEFDEF_${varname}_LIBRARY_DEBUG ) - set ( LEFDEF_${varname}_LIBRARY_DEBUG ${LEFDEF_${varname}_LIBRARY_RELEASE} CACHE STRING "Path to a library" FORCE ) - endif ( LEFDEF_${varname}_LIBRARY_RELEASE AND NOT LEFDEF_${varname}_LIBRARY_DEBUG ) + if( LEFDEF_${varname}_LIBRARY_RELEASE AND NOT LEFDEF_${varname}_LIBRARY_DEBUG ) + set( LEFDEF_${varname}_LIBRARY_DEBUG ${LEFDEF_${varname}_LIBRARY_RELEASE} CACHE STRING "Path to a library" FORCE ) + endif() - if ( LEFDEF_${varname}_LIBRARY_DEBUG AND NOT LEFDEF_${varname}_LIBRARY_RELEASE ) - set ( LEFDEF_${varname}_LIBRARY_RELEASE LEFDEF_${varname}_LIBRARY_DEBUG CACHE STRING "Path to a library" FORCE ) - endif ( LEFDEF_${varname}_LIBRARY_DEBUG AND NOT LEFDEF_${varname}_LIBRARY_RELEASE ) + if( LEFDEF_${varname}_LIBRARY_DEBUG AND NOT LEFDEF_${varname}_LIBRARY_RELEASE ) + set( LEFDEF_${varname}_LIBRARY_RELEASE LEFDEF_${varname}_LIBRARY_DEBUG CACHE STRING "Path to a library" FORCE ) + endif() - if ( LEFDEF_${varname}_LIBRARY_RELEASE ) - list ( APPEND LEFDEF_LIBRARIES "optimized" ${LEFDEF_${varname}_LIBRARY_RELEASE} - "debug" ${LEFDEF_${varname}_LIBRARY_DEBUG} ) - set ( LEFDEF_${varname}_LIBRARY_FOUND 1 ) - mark_as_advanced ( LEFDEF_${varname}_LIBRARY_RELEASE - LEFDEF_${varname}_LIBRARY_DEBUG ) - else ( LEFDEF_${varname}_LIBRARY_RELEASE ) + if( LEFDEF_${varname}_LIBRARY_RELEASE ) + list( APPEND LEFDEF_LIBRARIES "optimized" ${LEFDEF_${varname}_LIBRARY_RELEASE} + "debug" ${LEFDEF_${varname}_LIBRARY_DEBUG} ) + set( LEFDEF_${varname}_LIBRARY_FOUND 1 ) + mark_as_advanced( LEFDEF_${varname}_LIBRARY_RELEASE + LEFDEF_${varname}_LIBRARY_DEBUG ) + else() set ( LEFDEF_FOUND "NO" ) - endif ( LEFDEF_${varname}_LIBRARY_RELEASE ) -endmacro ( _find_lefdef_lib ) + endif() +endmacro() -set ( LEFDEF_INCLUDE_DIR_DESCRIPTION "directory containing the LEF/DEF include files. E.g /opt/lefdef-5.6/include" ) -set ( LEFDEF_LIBRARY_DIR_DESCRIPTION "directory containing the LEF/DEF library files. E.g /opt/lefdef-5.6/lib" ) -set ( LEFDEF_DIR_MESSAGE "Set the LEFDEF_INCLUDE_DIR cmake cache entry to the ${LEFDEF_INCLUDE_DIR_DESCRIPTION}" ) +set( LEFDEF_INCLUDE_DIR_DESCRIPTION "directory containing the LEF/DEF include files. E.g /opt/lefdef-5.6/include" ) +set( LEFDEF_LIBRARY_DIR_DESCRIPTION "directory containing the LEF/DEF library files. E.g /opt/lefdef-5.6/lib" ) +set( LEFDEF_DIR_MESSAGE "Set the LEFDEF_INCLUDE_DIR cmake cache entry to the ${LEFDEF_INCLUDE_DIR_DESCRIPTION}" ) # Don't even bother under Win32 if ( UNIX ) set ( LEFDEF_FOUND "YES" ) - set ( LEFDEF_SEARCH_PATH $ENV{LEFDEF_TOP} + set ( LEFDEF_SEARCH_PATH "$ENV{LEFDEF_TOP}" "/usr" "/opt/lefdef-5.6" "/opt/lefdef-5.7" - "/opt/lefdef") + "/opt/lefdef" + "$ENV{HOME}/oa/lefdef/5.7-s038" + ) + message( STATUS "LEFDEF_SEARCH_PATH: ${LEFDEF_SEARCH_PATH}" ) set ( LEFDEF_LIBRARIES "" ) set ( LEFDEF_LIBRARY_SEARCH_PATH "" ) @@ -83,11 +86,13 @@ if ( UNIX ) PATHS ${LEFDEF_SEARCH_PATH} PATH_SUFFIXES "include" "include/lefdef" DOC "The ${LEFDEF_INCLUDE_DIR_DESCRIPTION}" ) + message( STATUS "LEFDEF_INCLUDE_DIR: ${LEFDEF_INCLUDE_DIR}" ) find_path ( LEFDEF_LIBRARY_DIR NAMES "libdef.a" "libdef_Debug.a" - PATHS ${LEFDEF_LIBRARY_SEARCH_PATH} + PATHS ${LEFDEF_SEARCH_PATH} PATH_SUFFIXES "lib${LIB_SUFFIX}" DOC "The ${LEFDEF_LIBRARY_DIR_DESCRIPTION}" ) + message( STATUS "LEFDEF_LIBRARY_DIR: ${LEFDEF_LIBRARY_DIR}" ) if ( LEFDEF_INCLUDE_DIR AND LEFDEF_LIBRARY_DIR ) _find_lefdef_lib ( "CDEF" "cdef" ) @@ -103,6 +108,7 @@ if ( UNIX ) endif ( LEFDEF_INCLUDE_DIR AND LEFDEF_LIBRARY_DIR ) if ( LEFDEF_FOUND ) + message ( STATUS "Found LEF/DEF" ) add_definitions ( -DHAVE_LEFDEF ) if ( NOT LEFDEF_FIND_QUIETLY ) message ( STATUS "Found LEF/DEF" ) diff --git a/crlcore/src/ccore/lefdef/DefExport.cpp b/crlcore/src/ccore/lefdef/DefExport.cpp index 4026231b..11f8865d 100644 --- a/crlcore/src/ccore/lefdef/DefExport.cpp +++ b/crlcore/src/ccore/lefdef/DefExport.cpp @@ -391,7 +391,7 @@ namespace { Box abutmentBox ( cell->getAbutmentBox() ); const vector& rg - = AllianceFramework::get()->getRoutingGauge("sxlib")->getLayerGauges(); + = AllianceFramework::get()->getRoutingGauge()->getLayerGauges(); int status = 0; @@ -652,7 +652,7 @@ namespace { { FILE* defStream = NULL; try { - string designName = getString(cell->getName()) + "export"; + string designName = getString(cell->getName()) + "_export"; string path = "./" + designName + ".def"; cmess1 << " o Export DEF: <" << path << ">" << endl; diff --git a/crlcore/src/ccore/lefdef/LefExport.cpp b/crlcore/src/ccore/lefdef/LefExport.cpp index b549706d..1f7e6697 100644 --- a/crlcore/src/ccore/lefdef/LefExport.cpp +++ b/crlcore/src/ccore/lefdef/LefExport.cpp @@ -152,7 +152,7 @@ namespace { { if ( _framework == NULL ) { _framework = AllianceFramework::get (); - CellGauge* cg = _framework->getCellGauge("sxlib"); + CellGauge* cg = _framework->getCellGauge(); _sliceHeight = cg->getSliceHeight (); _pitchWidth = cg->getPitch (); @@ -500,7 +500,7 @@ namespace { LefDriver* driver = (LefDriver*)udata; Technology* technology = DataBase::getDB()->getTechnology(); const vector& rg - = driver->getFramework()->getRoutingGauge("sxlib")->getLayerGauges(); + = driver->getFramework()->getRoutingGauge()->getLayerGauges(); int status = 0; for ( size_t ilayer=0 ; ilayergetTechnology(); const vector& rg - = driver->getFramework()->getRoutingGauge("sxlib")->getLayerGauges(); + = driver->getFramework()->getRoutingGauge()->getLayerGauges(); int status = 0; for ( size_t ilayer=1 ; ilayer cells; if ( cell != NULL ) { - libraryName = getString(cell->getName()) + "export"; + libraryName = getString(cell->getName()) + "_export"; forEach ( Instance*, iinstance, cell->getInstances() ) { cells.insert ( (*iinstance)->getMasterCell() );