From d776996658ea34c6645659ec0c6fa15e7a91850e Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Wed, 21 Jun 2017 17:46:45 +0200 Subject: [PATCH] Cell::flattenNets() is now able to work on one instance only. * New: Occurrence_Contains filter that tells if an instance is part of an Occurrence. Checks for two cases: - The Instance is part of the *path* of the Occurrence. - The Instance is the associated entity itself. * New: In Cell::flattenNets() adds a new parameter Instance* to allow partial flatten of one instance only. * Bug: In Anabatic::Disjstra::_materialize() check that the NetRoutingState exists before trying to access it... --- anabatic/src/Dijkstra.cpp | 10 +- hurricane/src/hurricane/CMakeLists.txt | 1 + hurricane/src/hurricane/Cell.cpp | 11 +- hurricane/src/hurricane/Occurrences.cpp | 63 +++++++++++ hurricane/src/hurricane/hurricane/Cell.h | 1 + .../src/hurricane/hurricane/Occurrences.h | 101 ++++++++++-------- 6 files changed, 135 insertions(+), 52 deletions(-) create mode 100644 hurricane/src/hurricane/Occurrences.cpp diff --git a/anabatic/src/Dijkstra.cpp b/anabatic/src/Dijkstra.cpp index ede13cf2..7f7a3844 100644 --- a/anabatic/src/Dijkstra.cpp +++ b/anabatic/src/Dijkstra.cpp @@ -1782,11 +1782,14 @@ namespace Anabatic { if (sourceContact->getX() > targetContact->getX()) std::swap( sourceContact, targetContact ); + DbU::Unit width = Session::getPitch(Hurricane::DataBase::getDB()->getTechnology()->getLayer("METAL2")); //DbU::fromLambda(2.0); + if (state) width *= state->getWPitch(); + segment = Horizontal::create( sourceContact , targetContact , _anabatic->getConfiguration()->getGHorizontalLayer() , constraint.getCenter() - , state->getWPitch()*Session::getPitch(Hurricane::DataBase::getDB()->getTechnology()->getLayer("METAL2"))//DbU::fromLambda(2.0) + , width ); for ( Edge* through : aligneds ) through->add( segment ); if (state){ @@ -1796,11 +1799,14 @@ namespace Anabatic { if (sourceContact->getY() > targetContact->getY()) std::swap( sourceContact, targetContact ); + DbU::Unit width = Session::getPitch(Hurricane::DataBase::getDB()->getTechnology()->getLayer("METAL3")); //DbU::fromLambda(2.0); + if (state) width *= state->getWPitch(); + segment = Vertical::create( sourceContact , targetContact , _anabatic->getConfiguration()->getGVerticalLayer() , constraint.getCenter() - , state->getWPitch()*Session::getPitch(Hurricane::DataBase::getDB()->getTechnology()->getLayer("METAL3"))//DbU::fromLambda(2.0) + , width ); for ( Edge* through : aligneds ) through->add( segment ); if (state){ diff --git a/hurricane/src/hurricane/CMakeLists.txt b/hurricane/src/hurricane/CMakeLists.txt index c9a827f0..a1e6ef32 100644 --- a/hurricane/src/hurricane/CMakeLists.txt +++ b/hurricane/src/hurricane/CMakeLists.txt @@ -171,6 +171,7 @@ SharedPath.cpp Path.cpp Occurrence.cpp + Occurrences.cpp QuadTree.cpp Slice.cpp ExtensionSlice.cpp diff --git a/hurricane/src/hurricane/Cell.cpp b/hurricane/src/hurricane/Cell.cpp index 6a81e63d..3745b708 100644 --- a/hurricane/src/hurricane/Cell.cpp +++ b/hurricane/src/hurricane/Cell.cpp @@ -813,9 +813,14 @@ DeepNet* Cell::getDeepNet ( Path path, const Net* leafNet ) const return NULL; } +void Cell::flattenNets (uint64_t flags ) +// ************************************* +{ + flattenNets( NULL, flags ); +} -void Cell::flattenNets(uint64_t flags) -// *************************************** +void Cell::flattenNets ( const Instance* instance, uint64_t flags ) +// **************************************************************** { cdebug_log(18,0) << "Cell::flattenNets() flags:0x" << hex << flags << endl; @@ -828,7 +833,7 @@ void Cell::flattenNets(uint64_t flags) vector hyperNets; vector topHyperNets; - for ( Occurrence occurrence : getHyperNetRootNetOccurrences() ) { + for ( Occurrence occurrence : getHyperNetRootNetOccurrences().getSubSet(NotFilter(Occurrence_Contains(instance))) ) { Net* net = static_cast(occurrence.getEntity()); if (net->isClock() and (flags & Flags::NoClockFlatten)) continue; diff --git a/hurricane/src/hurricane/Occurrences.cpp b/hurricane/src/hurricane/Occurrences.cpp new file mode 100644 index 00000000..cce5d612 --- /dev/null +++ b/hurricane/src/hurricane/Occurrences.cpp @@ -0,0 +1,63 @@ +// -*- C++ -*- +// +// Copyright (c) BULL S.A. 2017-2017, All Rights Reserved +// +// This file is part of Hurricane. +// +// Hurricane is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// Hurricane is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- +// TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU +// General Public License for more details. +// +// You should have received a copy of the Lesser GNU General Public +// License along with Hurricane. If not, see +// . +// +// +-----------------------------------------------------------------+ +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul Chaput | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./Occurrences.cpp" | +// +-----------------------------------------------------------------+ + + +#include "hurricane/Occurrences.h" +#include "hurricane/Instance.h" + + +namespace Hurricane { + + +// ------------------------------------------------------------------- +// Class : "Occurrence_Contains". + + OccurrenceFilter* Occurrence_Contains::getClone () const + { return new Occurrence_Contains(_instance); } + + + bool Occurrence_Contains::accept ( Occurrence occurrence ) const + { + if (not _instance) return false; + + if (dynamic_cast(occurrence.getEntity()) == _instance) return true; + for ( Instance* instance : occurrence.getPath().getInstances() ) { + if (instance == _instance) return true; + } + return false; + } + + + string Occurrence_Contains::_getString () const + { return ""; } + + + +} // Hurricane namespace. diff --git a/hurricane/src/hurricane/hurricane/Cell.h b/hurricane/src/hurricane/hurricane/Cell.h index 0086815e..00b3d796 100644 --- a/hurricane/src/hurricane/hurricane/Cell.h +++ b/hurricane/src/hurricane/hurricane/Cell.h @@ -507,6 +507,7 @@ class Cell : public Entity { public: void setPad(bool isPad) {_flags.set(Flags::Pad,isPad);}; public: void setFeed(bool isFeed) {_flags.set(Flags::Feed,isFeed);}; public: void flattenNets(uint64_t flags=Flags::BuildRings); + public: void flattenNets(const Instance* instance, uint64_t flags=Flags::BuildRings); public: void createRoutingPadRings(uint64_t flags=Flags::BuildRings); public: void setFlags(uint64_t flags) { _flags |= flags; } public: void resetFlags(uint64_t flags) { _flags &= ~flags; } diff --git a/hurricane/src/hurricane/hurricane/Occurrences.h b/hurricane/src/hurricane/hurricane/Occurrences.h index bd81d5d9..ff31f5c6 100644 --- a/hurricane/src/hurricane/hurricane/Occurrences.h +++ b/hurricane/src/hurricane/hurricane/Occurrences.h @@ -1,21 +1,33 @@ -// **************************************************************************************************** -// File: ./hurricane/Occurrences.h -// Authors: R. Escassut -// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved +// -*- C++ -*- +// +// Copyright (c) BULL S.A. 2000-2017, All Rights Reserved // // This file is part of Hurricane. // -// Hurricane is free software: you can redistribute it and/or modify it under the terms of the GNU -// Lesser General Public License as published by the Free Software Foundation, either version 3 of the +// Hurricane is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // -// Hurricane is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU +// Hurricane is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- +// TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU // General Public License for more details. // -// You should have received a copy of the Lesser GNU General Public License along with Hurricane. If -// not, see . -// **************************************************************************************************** +// You should have received a copy of the Lesser GNU General Public +// License along with Hurricane. If not, see +// . +// +// +-----------------------------------------------------------------+ +// | H U R R I C A N E | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Rémy Escassut | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./Occurrences.cpp" | +// +-----------------------------------------------------------------+ + #ifndef HURRICANE_OCCURENCES #define HURRICANE_OCCURENCES @@ -25,52 +37,47 @@ namespace Hurricane { + class Instance; + + typedef GenericCollection Occurrences; + typedef GenericLocator OccurrenceLocator; + typedef GenericFilter OccurrenceFilter; -// **************************************************************************************************** -// Occurrences declaration -// **************************************************************************************************** +// ------------------------------------------------------------------- +// Class : "Occurrence_Contains". -typedef GenericCollection Occurrences; + class Occurrence_Contains : public OccurrenceFilter { + public: + inline Occurrence_Contains ( const Instance* ); + inline Occurrence_Contains ( const Occurrence_Contains& ); + virtual OccurrenceFilter* getClone () const; + virtual bool accept ( Occurrence ) const; + virtual string _getString () const; + protected: + const Instance* _instance; + }; + Occurrence_Contains::Occurrence_Contains ( const Instance* instance ) + : OccurrenceFilter() + , _instance(instance) + { } -// **************************************************************************************************** -// OccurrenceLocator declaration -// **************************************************************************************************** - -typedef GenericLocator OccurrenceLocator; + Occurrence_Contains::Occurrence_Contains ( const Occurrence_Contains& other ) + : OccurrenceFilter() + , _instance(other._instance) + { } - -// **************************************************************************************************** -// OccurrenceFilter declaration -// **************************************************************************************************** - -typedef GenericFilter OccurrenceFilter; - - - -// **************************************************************************************************** -// for_each_occurrence declaration -// **************************************************************************************************** - -#define for_each_occurrence(occurrence, occurrences)\ -/************************************************/\ -{\ - OccurrenceLocator _locator = occurrences.getLocator();\ - while (_locator.isValid()) {\ - Occurrence occurrence = _locator.getElement();\ +#define for_each_occurrence(occurrence, occurrences) \ +{ \ + OccurrenceLocator _locator = occurrences.getLocator(); \ + while (_locator.isValid()) { \ + Occurrence occurrence = _locator.getElement(); \ _locator.progress(); - -} // End of Hurricane namespace. - +} // Hurricane namespace. #endif // HURRICANE_OCCURENCES - - -// **************************************************************************************************** -// Copyright (c) BULL S.A. 2000-2016, All Rights Reserved -// ****************************************************************************************************