diff --git a/nimbus/CMakeLists.txt b/nimbus/CMakeLists.txt new file mode 100644 index 00000000..33f550fb --- /dev/null +++ b/nimbus/CMakeLists.txt @@ -0,0 +1,49 @@ +PROJECT(NIMBUS) + +CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0) + +SET(CMAKE_C_FLAGS_DEBUG "-pg -g -Wall" CACHE STRING "Debug options." FORCE) +SET(CMAKE_CXX_FLAGS_DEBUG "-pg -g -Wall" CACHE STRING "Debug options." FORCE) +#SET(CMAKE_LINKER_FLAGS_DEBUG "-pg" CACHE STRING "Debug options." FORCE) +#SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "-pg" CACHE STRING "Debug options." FORCE) +#SET(CMAKE_MODULE_LINKER_FLAGS_DEBUG "-pg" CACHE STRING "Debug options." FORCE) +#SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "-pg" CACHE STRING "Debug options." FORCE) +SET(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG -Wall" CACHE STRING "Release options." FORCE) +SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -Wall" CACHE STRING "Release options." FORCE) + +IF(COMMAND CMAKE_POLICY) + CMAKE_POLICY(SET CMP0003 NEW) +ENDIF(COMMAND CMAKE_POLICY) + +# This macro has to be included in all the tools CMakeLists.txt as it's +# the sole means of localizing other tools/projects. +MACRO(SETUP_PROJECT_PATHS project) + IF( NOT("$ENV{${project}_TOP}" STREQUAL "") ) + MESSAGE("-- ${project}_TOP is set to $ENV{${project}_TOP}") + SET(PROJECT_MODULE_PATH "${DESTDIR}$ENV{${project}_TOP}/share/cmake/Modules/") + LIST(INSERT CMAKE_MODULE_PATH 0 "${PROJECT_MODULE_PATH}") + ENDIF( NOT("$ENV{${project}_TOP}" STREQUAL "") ) + + IF( NOT("$ENV{${project}_USER_TOP}" STREQUAL "") ) + MESSAGE("-- ${project}_USER_TOP is set to $ENV{${project}_USER_TOP}") + SET(PROJECT_MODULE_PATH "${DESTDIR}$ENV{${project}_USER_TOP}/share/cmake/Modules/") + LIST(INSERT CMAKE_MODULE_PATH 0 "${PROJECT_MODULE_PATH}") + ENDIF( NOT("$ENV{${project}_USER_TOP}" STREQUAL "") ) + + LIST(REMOVE_DUPLICATES CMAKE_MODULE_PATH) +ENDMACRO(SETUP_PROJECT_PATHS project) + +SETUP_PROJECT_PATHS(VLSISAPD) +SETUP_PROJECT_PATHS(CORIOLIS) + +IF(BUILD_DOC) + FIND_PACKAGE(Doxygen) +ENDIF(BUILD_DOC) +FIND_PACKAGE(Qt4 REQUIRED) # find and setup Qt4 for this project +FIND_PACKAGE(HURRICANE REQUIRED) +FIND_PACKAGE(CORIOLIS REQUIRED) + +SET_LIB_LINK_MODE() + +ADD_SUBDIRECTORY(src) +ADD_SUBDIRECTORY(cmake_modules) diff --git a/nimbus/cmake_modules/CMakeLists.txt b/nimbus/cmake_modules/CMakeLists.txt new file mode 100644 index 00000000..87fd24cc --- /dev/null +++ b/nimbus/cmake_modules/CMakeLists.txt @@ -0,0 +1 @@ +install ( FILES FindNIMBUS.cmake DESTINATION share/cmake/Modules ) diff --git a/nimbus/cmake_modules/FindNIMBUS.cmake b/nimbus/cmake_modules/FindNIMBUS.cmake new file mode 100644 index 00000000..39defb5c --- /dev/null +++ b/nimbus/cmake_modules/FindNIMBUS.cmake @@ -0,0 +1,37 @@ +# - Find the Nimbus includes and libraries. +# The following variables are set if Coriolis is found. If NIMBUS is not +# found, NIMBUS_FOUND is set to false. +# NIMBUS_FOUND - True when the Coriolis include directory is found. +# NIMBUS_INCLUDE_DIR - the path to where the Coriolis include files are. +# NIMBUS_LIBRARIES - The path to where the Coriolis library files are. + + +SET(NIMBUS_INCLUDE_PATH_DESCRIPTION "directory containing the Nimbus include files. E.g /usr/local/include/coriolis or /asim/coriolis/include/coriolis") + +SET(NIMBUS_DIR_MESSAGE "Set the NIMBUS_INCLUDE_DIR cmake cache entry to the ${NIMBUS_INCLUDE_PATH_DESCRIPTION}") + +# don't even bother under WIN32 +IF(UNIX) + # + # Look for an installation. + # + FIND_PATH(NIMBUS_INCLUDE_PATH NAMES nimbus/Nimbus.h PATHS + # Look in other places. + ${CORIOLIS_DIR_SEARCH} + PATH_SUFFIXES include/coriolis2 + # Help the user find it if we cannot. + DOC "The ${NIMBUS_INCLUDE_PATH_DESCRIPTION}" + ) + + FIND_LIBRARY(NIMBUS_LIBRARY_PATH + NAMES nimbus + PATHS ${CORIOLIS_DIR_SEARCH} + PATH_SUFFIXES lib${LIB_SUFFIX} + # Help the user find it if we cannot. + DOC "The ${NIMBUS_INCLUDE_PATH_DESCRIPTION}" + ) + + SET_LIBRARIES_PATH(NIMBUS NIMBUS) + HURRICANE_CHECK_LIBRARIES(NIMBUS) + +ENDIF(UNIX) diff --git a/nimbus/src/CMakeLists.txt b/nimbus/src/CMakeLists.txt new file mode 100644 index 00000000..c1d6d798 --- /dev/null +++ b/nimbus/src/CMakeLists.txt @@ -0,0 +1,45 @@ + + include ( ${QT_USE_FILE} ) + + include_directories ( ${HURRICANE_INCLUDE_DIR} + ${NIMBUS_SOURCE_DIR}/src + ${CORIOLIS_INCLUDE_DIR} + ) + set ( includes nimbus/SplitterContact.h nimbus/SplitterContacts.h + nimbus/Splitter.h nimbus/Splitters.h + nimbus/Fence.h nimbus/Fences.h + nimbus/HFence.h + nimbus/VFence.h + nimbus/FrontLine.h + nimbus/FenceProperty.h + nimbus/StepProperty.h + nimbus/GCell.h nimbus/GCells.h + nimbus/Grid.h + nimbus/Nimbus.h + nimbus/RoutTools.h + ) + set ( cpps SplitterContact.cpp + Splitter.cpp + Fence.cpp + FenceProperty.cpp + HFence.cpp + VFence.cpp + FrontLine.cpp + GCell.cpp + Grid.cpp + StepProperty.cpp + Nimbus.cpp + RoutTools.cpp + ) + + + add_library ( nimbus ${cpps} ) + target_link_libraries ( nimbus ${HURRICANE_LIBRARIES} + ${HURRICANE_GRAPHICAL_LIBRARIES} + ${LEFDEF_LIBRARIES} + ${OA_LIBRARIES} + ${QT_LIBRARIES} + ) + install ( TARGETS nimbus DESTINATION lib${LIB_SUFFIX} ) + install ( FILES ${includes} DESTINATION include/coriolis2/nimbus ) + diff --git a/nimbus/src/HFence.cpp b/nimbus/src/HFence.cpp new file mode 100644 index 00000000..ad9722e7 --- /dev/null +++ b/nimbus/src/HFence.cpp @@ -0,0 +1,227 @@ + +// This file is part of the Coriolis Project. +// Copyright (C) Laboratoire LIP6 - Departement ASIM +// Universite Pierre et Marie Curie +// +// Date : 29/01/2004 +// Author : Hugo Clément + + +#include "crlcore/RoutingLayerGauge.h" +#include "nimbus/Nimbus.h" +#include "nimbus/RoutTools.h" +#include "nimbus/HFence.h" + +namespace Nimbus { + +HFence::HFence ( Grid* grid, GCell* gcup, GCell* gcdown) + : Fence (grid) + , _gcup (gcup) + , _gcdown (gcdown) +{ + return; +} + +HFence::~HFence () +{ + _gcup->setDownFence(NULL); + _gcdown->setUpFence(NULL); + + return; +} + +HFence* HFence::create (Grid* grid, GCell* gcup, GCell* gcdown) { + + if ( (!gcup) && (!gcdown) ) + throw Error("cannot create a flying fence"); + + unsigned step; + if (gcup) { + step = gcup->getStep(); + } else if (gcdown) { + step = gcdown->getStep(); + } else { + step = 0; + } + + HFence* hfence = new HFence (grid, gcup, gcdown); + + if (!hfence) + throw Error("cannot create Fence"); + + hfence->_postCreate(); + + return hfence; +} + +void HFence::_postCreate () { + + DbU::Unit size = 0; + if (_gcup) { + size = _gcup->getWidth(); + _gcup->setDownFence (this); + _step = _gcup->getStep(); + } + if (_gcdown) { + size = _gcdown->getWidth(); + _gcdown->setUpFence (this); + _step = _gcdown->getStep(); + } + + setSize(size); + + Inherit::_postCreate(); + + return; +} + +string HFence::_getString() const { + return "<" + _TName ( "HFence") + + " " + getString ( getX() ) + + " " + getString ( getY() ) + ">"; +} + +Record* HFence::_getRecord() const { + Record* record = Inherit::_getRecord(); + + if (record) { + record->add(getSlot("Up gcell", _gcup)); + record->add(getSlot("Down gcell", _gcdown)); + } + + return record; +} + +DbU::Unit HFence::getY() const { + DbU::Unit Y; + + if (_gcup) { + Y = _gcup->getYMin(); + } else if (_gcdown) { + Y = _gcdown->getYMax(); + } else { + throw Error ("Floating fence"); + } + + return Y; +} + +DbU::Unit HFence::getXMin() const { + + DbU::Unit X; + + if (_gcup) { + X = _gcup->getXMin(); + } else if (_gcdown) { + X = _gcdown->getXMin(); + } else { + throw Error ("Floating fence"); + } + + return X; +} + +DbU::Unit HFence::getXMax() const { + + DbU::Unit X; + + if (_gcup) { + X = _gcup->getXMax(); + } else if (_gcdown) { + X = _gcdown->getXMax(); + } else { + throw Error ("Floating fence"); + } + + return X; +} + +DbU::Unit HFence::getX() const { + DbU::Unit X; + + if (_gcup) { + X = _gcup->getXCenter(); + } else if (_gcdown) { + X = _gcdown->getXCenter(); + } else { + throw Error ("Floating fence"); + } + + return X; +} + +Point HFence::getP1() const { + + DbU::Unit X = getXMin(); + DbU::Unit Y = getY(); + + return Point(X, Y); +} + +Point HFence::getP2() const { + + DbU::Unit X = getXMax(); + DbU::Unit Y = getY(); + + return Point(X, Y); +} + +DbU::Unit HFence::getXCenter() const { + + DbU::Unit X = (getXMin() + getXMax()) / 2; + + return X; +} + +DbU::Unit HFence::getYCenter() const { + + DbU::Unit Y = getY(); + + return Y; +} + +Point HFence::getCenter() const { + + DbU::Unit X = getXCenter(); + DbU::Unit Y = getYCenter(); + + return Point(X, Y); +} + +void HFence::_moveTo (DbU::Unit target) +{ + Inherit::_moveTo (target); + getUpGCell()->setYMin(target); + getDownGCell()->setYMax(target); + for_each_splitter (splitter, getSplitters()) + { + splitter->setY(target); + end_for; + } + return; +} + +void HFence::computeCapacity() { + + unsigned capa(0); + const vector& gauges = Fence::_routingGauge->getLayerGauges(); + for ( size_t i=0 ; igetType() != Constant::Default) + continue; + if (gauges[i]->getDirection() == Constant::Horizontal) + continue; + capa += gauges[i]->getTrackNumber(getXMin(), getXMax()); + } + setCapacity(capa); +#if 0 + unsigned pitch = static_cast(getValue (getCDataBase()->getPitch())); + unsigned nlayers = getGrid()->getNimbus()->getNumberOfRoutingLayers(); + + setCapacity(static_cast((nlayers / 2) * getValue (_size) / pitch)); + +#endif + return; +} + +} // namespace Nimbus diff --git a/nimbus/src/VFence.cpp b/nimbus/src/VFence.cpp new file mode 100644 index 00000000..94ceb448 --- /dev/null +++ b/nimbus/src/VFence.cpp @@ -0,0 +1,237 @@ + +// This file is part of the Coriolis Project. +// Copyright (C) Laboratoire LIP6 - Departement ASIM +// Universite Pierre et Marie Curie +// +// Date : 29/01/2004 +// Author : Hugo Clément + + +#include "nimbus/Nimbus.h" +#include "nimbus/RoutTools.h" +#include "nimbus/VFence.h" + +namespace Nimbus { + +VFence::VFence (Grid* grid, GCell* gcleft, GCell* gcright) + : Fence (grid) + , _gcleft (gcleft) + , _gcright (gcright) +{ + return; +} + +VFence::~VFence () +{ + _gcleft->setRightFence(NULL); + _gcright->setLeftFence(NULL); + + return; +} + +VFence* VFence::create (Grid* grid, GCell* gcleft, GCell* gcright) { + + if ( (!gcleft) && (!gcright) ) + throw Error("cannot create a flying fence"); + + unsigned step; + if (gcleft) { + step = gcleft->getStep(); + } else if (gcright) { + step = gcright->getStep(); + } else { + step = 0; + } + + VFence* vfence = new VFence (grid, gcleft, gcright); + + if (!vfence) + throw Error ("cannot create fence"); + + vfence->_postCreate(); + + return vfence; +} + +void VFence::_postCreate() { + + DbU::Unit size = 0; + if (_gcleft) { + size = _gcleft->getHeight(); + _gcleft->setRightFence (this); + _step = _gcleft->getStep(); + } + if (_gcright) { + size = _gcright->getHeight(); + _gcright->setLeftFence (this); + _step = _gcright->getStep(); + } + + setSize(size); + + Inherit::_postCreate(); + + return; +} + +string VFence::_getString() const { + return "<" + _TName ( "VFence") + + " " + getString ( getX() ) + + " " + getString ( getY() ) + ">"; +} + +Record* VFence::_getRecord() const { + Record* record = Inherit::_getRecord(); + + if (record) { + record->add(getSlot("Left nimbox", _gcleft)); + record->add(getSlot("Right nimbox", _gcright)); + } + + return record; +} + + +DbU::Unit VFence::getX() const { + DbU::Unit X; + + if (_gcleft) { + X = _gcleft->getXMax(); + } else if (_gcright) { + X = _gcright->getXMin(); + } else { + throw Error ("Floating fence"); + } + + return X; +} + +DbU::Unit VFence::getY() const { + DbU::Unit Y; + + if (_gcleft) { + Y = _gcleft->getYCenter(); + } else if (_gcright) { + Y = _gcright->getYCenter(); + } else { + throw Error ("Floating fence"); + } + + return Y; +} + +DbU::Unit VFence::getYMin() const { + + DbU::Unit Y; + + if (_gcleft) { + Y = _gcleft->getYMin(); + } else if (_gcright) { + Y = _gcright->getYMin(); + } else { + throw Error ("Floating fence"); + } + + return Y; +} + +DbU::Unit VFence::getYMax() const { + + DbU::Unit Y; + + if (_gcleft) { + Y = _gcleft->getYMax(); + } else if (_gcright) { + Y = _gcright->getYMax(); + } else { + throw Error ("Floating fence"); + } + + return Y; +} + +Point VFence::getP1() const { + + DbU::Unit X = getX(); + DbU::Unit Y = getYMin(); + + return Point(X, Y); +} + +Point VFence::getP2() const { + + DbU::Unit X = getX(); + DbU::Unit Y = getYMax(); + + return Point(X, Y); +} + +DbU::Unit VFence::getXCenter() const { + + DbU::Unit X = getX(); + + return X; +} + +DbU::Unit VFence::getYCenter() const { + + DbU::Unit Y = (getYMin()+getYMax()) / 2; + + return Y; +} + +Point VFence::getCenter() const { + + DbU::Unit X = getXCenter(); + DbU::Unit Y = getYCenter(); + + return Point(X, Y); +} + +void VFence::_moveTo (DbU::Unit target) +{ + Inherit::_moveTo (target); + getLeftGCell()->setXMax(target); + getRightGCell()->setXMin(target); + for_each_splitter (splitter, getSplitters()) + { + splitter->setX(target); + end_for; + } + return; +} + +void VFence::computeCapacity() { + + unsigned capa(0); + const vector& gauges = Fence::_routingGauge->getLayerGauges(); + for ( size_t i=0 ; igetType() != Constant::Default) + continue; + if (gauges[i]->getDirection() == Constant::Vertical) + continue; + capa += gauges[i]->getTrackNumber(getYMin(), getYMax()); + } + setCapacity(capa); + +#if 0 + unsigned pitch = static_cast(getValue (getCDataBase()->getPitch())); + unsigned nlayers = getGrid()->getNimbus()->getNumberOfRoutingLayers(); + double capa (0); + double powerrail (0); + for_each_layer (layer, _grid->getNimbus()->getRoutingLayers()) + { + double pitch = getValue(layer->getPitch()); + if (pitch == 0) pitch = 5; + capa += getValue(_size) / pitch / 2; + powerrail += ( (12 * (getValue(_size) / pitch) /50) ); + end_for; + } + + setCapacity(static_cast ((capa - powerrail)/2)); +#endif + return; +} + +} // namespace Nimbus