From 010d9a3782cc2e5cca6c2e567e0c23bd56c5b564 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Fri, 17 Apr 2020 11:28:47 +0200 Subject: [PATCH] Clean policy of netlist (vst) and layout (ap) views recursive loading. * Bug: In CRL::VstParserGrammar & VstParserScanner, when loading the instances models, we where loading both logical & physical views. This was causing cases of reentrency of the parser, with reset of the lexer static dictionary, leading to memory corruption. Now the identifiers are stored in the YaccState of each parsed cell and we only recursively call for the logical view. * Change: In CRL::ApParser::_parseInstance(), recursively load the physical views as they are no longer loaded by the Vst parser. * Change: In CRL::AllianceFramework::getCell(), sets the TerminalNetlist flag from the state (mode 'C' in CATAL) onto the cell. * Change: In EtesianEngine::loadLeafcelllayouts(), new functions to load the layouts of the leaf cells if only the netlist has been loaded. --- crlcore/src/ccore/AllianceFramework.cpp | 2 +- crlcore/src/ccore/alliance/ap/ApParser.cpp | 56 +++--- crlcore/src/ccore/alliance/vst/Vst.h | 60 ++---- crlcore/src/ccore/alliance/vst/VstParser.h | 172 ++++++++++++++++++ .../ccore/alliance/vst/VstParserGrammar.yy | 149 ++------------- .../ccore/alliance/vst/VstParserScanner.ll | 76 ++------ etesian/src/EtesianEngine.cpp | 30 ++- etesian/src/etesian/EtesianEngine.h | 85 ++++----- katana/src/KatanaEngine.cpp | 5 +- 9 files changed, 323 insertions(+), 312 deletions(-) create mode 100644 crlcore/src/ccore/alliance/vst/VstParser.h diff --git a/crlcore/src/ccore/AllianceFramework.cpp b/crlcore/src/ccore/AllianceFramework.cpp index b4faaf25..7cd625d5 100644 --- a/crlcore/src/ccore/AllianceFramework.cpp +++ b/crlcore/src/ccore/AllianceFramework.cpp @@ -380,7 +380,7 @@ namespace CRL { if (state->getCell() == NULL) { state->setCell ( Cell::create( _libraries[ _environment.getLIBRARIES().getIndex() ]->getLibrary() , name ) ); state->getCell ()->put( CatalogProperty::create(state) ); - state->getCell ()->setTerminalNetlist( false ); + state->getCell ()->setTerminalNetlist( state->isTerminalNetlist() ); createCell = true; } diff --git a/crlcore/src/ccore/alliance/ap/ApParser.cpp b/crlcore/src/ccore/alliance/ap/ApParser.cpp index bfc1a6b5..b4950a0d 100644 --- a/crlcore/src/ccore/alliance/ap/ApParser.cpp +++ b/crlcore/src/ccore/alliance/ap/ApParser.cpp @@ -646,20 +646,20 @@ namespace { void ApParser::_parseInstance () { static DbU::Unit XINS, YINS; - static Name masterCellName; - static Name instanceName; - static Name orientName; + static Name masterCellName; + static Name instanceName; + static Name orientName; static Transformation::Orientation - orient = Transformation::Orientation::ID; - static Name NOSYM = "NOSYM"; - static Name SYM_X = "SYM_X"; - static Name SYM_Y = "SYM_Y"; - static Name SYMXY = "SYMXY"; - static Name ROT_P = "ROT_P"; - static Name ROT_M = "ROT_M"; - static Name SY_RM = "SY_RM"; - static Name SY_RP = "SY_RP"; - static string padreal = "padreal"; + orient = Transformation::Orientation::ID; + static Name NOSYM = "NOSYM"; + static Name SYM_X = "SYM_X"; + static Name SYM_Y = "SYM_Y"; + static Name SYMXY = "SYMXY"; + static Name ROT_P = "ROT_P"; + static Name ROT_M = "ROT_M"; + static Name SY_RM = "SY_RM"; + static Name SY_RP = "SY_RP"; + static string padreal = "padreal"; vector fields = _splitString ( _rawLine+2, ',' ); if ( fields.size() < 5 ) @@ -680,18 +680,27 @@ namespace { else if (orientName == "SYM_Y") orient = Transformation::Orientation::MY; else if (orientName == "SY_RP") orient = Transformation::Orientation::YR; else - _printError ( false, "Unknown orientation (%s).", getString(orientName).c_str() ); + _printError( false, "Unknown orientation (%s).", getString(orientName).c_str() ); - Instance* instance = _cell->getInstance ( instanceName ); + Instance* instance = _cell->getInstance( instanceName ); if (instance) { - instance->setTransformation - ( getTransformation( instance->getMasterCell()->getAbutmentBox() - , XINS - , YINS - , orient - ) - ); - instance->setPlacementStatus( Instance::PlacementStatus::FIXED ); + Cell* masterCell = instance->getMasterCell(); + bool hasLayout = not masterCell->getAbutmentBox().isEmpty(); + if (not hasLayout) { + AllianceFramework::get()->getCell( getString(masterCell->getName()), Catalog::State::Physical ); + hasLayout = not masterCell->getAbutmentBox().isEmpty(); + } + + if (hasLayout) { + instance->setTransformation + ( getTransformation( masterCell->getAbutmentBox() + , XINS + , YINS + , orient + ) + ); + instance->setPlacementStatus( Instance::PlacementStatus::FIXED ); + } } else { bool ignoreInstance = _framework->isPad( _cell ); Catalog::State* instanceState = _framework->getCatalog()->getState( masterCellName ); @@ -781,7 +790,6 @@ namespace { _state = catalogProperty->getState (); _state->setPhysical ( true ); - if ( _state->isTerminalNetlist() ) _cell->setTerminalNetlist ( true ); if ( _framework->isPad(_cell) ) _state->setPad ( true ); IoFile fileStream ( cellPath ); diff --git a/crlcore/src/ccore/alliance/vst/Vst.h b/crlcore/src/ccore/alliance/vst/Vst.h index 372ef6cc..74eade0e 100644 --- a/crlcore/src/ccore/alliance/vst/Vst.h +++ b/crlcore/src/ccore/alliance/vst/Vst.h @@ -1,63 +1,33 @@ - - // -*- C++ -*- // -// This file is part of the Coriolis Project. -// Copyright (C) Laboratoire LIP6 - Departement ASIM -// Universite Pierre et Marie Curie +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2008-2020, All Rights Reserved // -// Main contributors : -// Christophe Alexandre -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// The Coriolis Project is free software; you can redistribute it -// and/or modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// The Coriolis Project 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 -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with the Coriolis Project; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA -// -// License-Tag -// Authors-Tag -// =================================================================== +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | Alliance / Hurricane Interface | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./alliance/vst/Vst.h" | +// +-----------------------------------------------------------------+ - -# include +#pragma once +#include namespace Hurricane { class Cell; } -#ifndef __VST_H__ -#define __VST_H__ - namespace CRL { - using namespace std; - using namespace Hurricane; -// ------------------------------------------------------------------- -// functions. + void vstParser ( const std::string cellPath, Hurricane::Cell* ); + void vstDriver ( const std::string cellPath, Hurricane::Cell* , unsigned int& saveState); - void vstParser ( const string cellPath, Cell* cell ); - void vstDriver ( const string cellPath, Cell* cell, unsigned int& saveState); } - -# endif diff --git a/crlcore/src/ccore/alliance/vst/VstParser.h b/crlcore/src/ccore/alliance/vst/VstParser.h new file mode 100644 index 00000000..631a0fa5 --- /dev/null +++ b/crlcore/src/ccore/alliance/vst/VstParser.h @@ -0,0 +1,172 @@ +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC 2020-2020, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | C O R I O L I S | +// | Alliance / Hurricane Interface | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./alliance/vst/VstParser.h" | +// +-----------------------------------------------------------------+ + + +#pragma once +#include +#include +#include +#include +#include +namespace Hurricane { + class Net; + class Cell; + class Instance; +} +#include + + +namespace Vst { + + extern void incVhdLineNumber (); + + + enum TokenConstants { VhdlTo = 1 + , VhdlDownto = 2 + , VhdlPlus = 3 + , VhdlMinus = 4 + , VhdlBus = 5 + }; + + + class Constraint { + public: + inline Constraint (); + public: + inline int getFrom () const; + inline int getTo () const; + inline bool IsSet () const; + inline void Set ( int from, unsigned int direction, int to ); + inline void UnSet () { _set = false; } + inline void Init ( int& index ); + inline void Next ( int& index ); + inline bool End ( int index ); + private: + int _from; + int _to; + bool _set; + }; + + inline Constraint::Constraint () + : _from(0), _to(0), _set(false) + { } + + inline int Constraint::getFrom () const { return _from; } + inline int Constraint::getTo () const { return _to; } + inline bool Constraint::IsSet () const { return _set; } + inline void Constraint::Init ( int& index ) { index = _from; }; + + inline void Constraint::Set ( int from, unsigned int direction, int to ) + { _set = true; _from = from; _to = to; } + + inline void Constraint::Next ( int& index ) + { (_from < _to) ? index++ : index--; } + + inline bool Constraint::End ( int index ) + { + if ( _from < _to ) return index <= _to; + return index >= _to; + } + + + typedef std::vector PinVector; + typedef std::map VectorMap; + typedef std::map CellVectorMap; + + + class YaccState { + public: + std::string _vhdFileName; + int _vhdLineNumber; + int _errorCount; + int _maxErrors; + std::vector _lexIdentifiers; + std::deque _cellQueue; + CRL::Catalog::State* _state; + Hurricane::Cell* _cell; + Hurricane::Cell* _masterCell; + Hurricane::Instance* _instance; + Constraint _constraint; + std::vector _identifiersList; + CellVectorMap _cellVectorMap; + PinVector _instanceNets; + PinVector _masterNets; + bool _masterPort; + bool _firstPass; + bool _behavioral; + bool _ieeeVhdl; + bool _ieeeWarned; + public: + inline YaccState ( const std::string& vhdFileName ); + inline ~YaccState (); + inline bool pushCell ( Hurricane::Name ); + inline std::string* addLexIdentifier ( const char* ); + }; + + + YaccState::YaccState ( const std::string& vhdFileName ) + : _vhdFileName (vhdFileName) + , _vhdLineNumber (1) + , _errorCount (0) + , _maxErrors (10) + , _lexIdentifiers () + , _cellQueue () + , _state (NULL) + , _cell (NULL) + , _masterCell (NULL) + , _instance (NULL) + , _constraint () + , _identifiersList() + , _cellVectorMap () + , _instanceNets () + , _masterNets () + , _masterPort (true) + , _firstPass (true) + , _behavioral (false) + , _ieeeVhdl (false) + , _ieeeWarned (false) + { } + + inline YaccState::~YaccState () + { for ( std::string* s : _lexIdentifiers ) delete s; } + + inline bool YaccState::pushCell ( Hurricane::Name cellName ) + { + for ( size_t i=0 ; i<_cellQueue.size(); ++i ) { + if (_cellQueue[i] == cellName) return false; + } + _cellQueue.push_back( cellName ); + return true; + } + + + inline std::string* YaccState::addLexIdentifier ( const char* identifier ) + { + _lexIdentifiers.push_back( new std::string(identifier) ); + return _lexIdentifiers.back(); + } + + + class YaccStateStack : public std::vector { + public: + inline YaccState* operator->() { return back(); }; + inline void pop_back () { delete back (); std::vector::pop_back (); } + }; + + + extern YaccStateStack states; + + +} // Vst namespace. diff --git a/crlcore/src/ccore/alliance/vst/VstParserGrammar.yy b/crlcore/src/ccore/alliance/vst/VstParserGrammar.yy index 7467c25b..55c4fe8b 100644 --- a/crlcore/src/ccore/alliance/vst/VstParserGrammar.yy +++ b/crlcore/src/ccore/alliance/vst/VstParserGrammar.yy @@ -40,6 +40,7 @@ using namespace Hurricane; #include "crlcore/AllianceFramework.h" #include "crlcore/NetExtension.h" #include "Vst.h" +#include "VstParser.h" using namespace CRL; @@ -48,6 +49,7 @@ using namespace CRL; #define yytext VSTtext #define yywrap VSTwrap #define yyin VSTin +#define YYDEBUG 0 extern int yylex (); @@ -65,137 +67,15 @@ namespace { namespace Vst { - extern void incVhdLineNumber (); - extern void ClearIdentifiers (); - void checkForIeee ( bool ieeeEnabled ); - - - enum TokenConstants { VhdlTo = 1 - , VhdlDownto = 2 - , VhdlPlus = 3 - , VhdlMinus = 4 - , VhdlBus = 5 - }; - - - class Constraint { - private: - int _from; - int _to; - bool _set; - public: - Constraint () : _from(0), _to(0), _set(false) { }; - public: - int getFrom () const { return _from; } - int getTo () const { return _to; } - bool IsSet () const { return _set; } - void Set ( int from, unsigned int direction, int to ); - void UnSet () { _set = false; } - void Init ( int& index ) { index = _from; }; - void Next ( int& index ); - bool End ( int index ); - }; - - - void Constraint::Set ( int from, unsigned int direction, int to ) - { - _set = true; - _from = from; - _to = to; - } - - - void Constraint::Next ( int& index ) - { - if ( _from < _to ) index++; - else index--; - } - - - bool Constraint::End ( int index ) - { - if ( _from < _to ) return index <= _to; - - return index >= _to; - } - - - typedef vector PinVector; - typedef map VectorMap; - typedef map CellVectorMap; - - - class YaccState { - public: - string _vhdFileName; - int _vhdLineNumber; - int _errorCount; - int _maxErrors; - deque _cellQueue; - Catalog::State* _state; - Cell* _cell; - Cell* _masterCell; - Instance* _instance; - Constraint _constraint; - vector _identifiersList; - CellVectorMap _cellVectorMap; - PinVector _instanceNets; - PinVector _masterNets; - bool _masterPort; - bool _firstPass; - bool _behavioral; - bool _ieeeVhdl; - bool _ieeeWarned; - public: - YaccState ( const string& vhdFileName ) - : _vhdFileName (vhdFileName) - , _vhdLineNumber (1) - , _errorCount (0) - , _maxErrors (10) - , _cellQueue () - , _state (NULL) - , _cell (NULL) - , _masterCell (NULL) - , _instance (NULL) - , _constraint () - , _identifiersList() - , _cellVectorMap () - , _instanceNets () - , _masterNets () - , _masterPort (true) - , _firstPass (true) - , _behavioral (false) - , _ieeeVhdl (false) - , _ieeeWarned (false) - { } - bool pushCell ( Name ); - }; - - - bool YaccState::pushCell ( Name cellName ) - { - for ( size_t i=0 ; i<_cellQueue.size(); ++i ) { - if (_cellQueue[i] == cellName) return false; - } - _cellQueue.push_back( cellName ); - return true; - } - - - class YaccStateStack : public vector { - public: - YaccState* operator->() { return back(); }; - void pop_back () { delete back (); vector::pop_back (); } - }; - YaccStateStack states; AllianceFramework* framework; - void Error ( int code, const string& name ); - Net* getNet ( Cell* cell, const string& name ); - void SetNetType ( Net* net ); + void checkForIeee ( bool ieeeEnabled ); + void Error ( int code, const string& name ); + Net* getNet ( Cell* cell, const string& name ); + void SetNetType ( Net* net ); } // Vst namespace. @@ -681,10 +561,11 @@ component_declaration : COMPONENT Identifier { if (Vst::states->_firstPass) { - if (not Vst::framework->getCell(*$2,Catalog::State::Views|Catalog::State::InMemory)) + if (not Vst::framework->getCell(*$2,Catalog::State::Logical|Catalog::State::InMemory)) Vst::states->pushCell( *$2 ); } else { - Vst::states->_masterCell = Vst::framework->getCell ( *$2, Catalog::State::Views ); + Vst::states->_masterCell = Vst::framework->getCell ( *$2, Catalog::State::Logical ); + cerr.flush(); } } .generic_clause. @@ -775,7 +656,7 @@ component_instantiation_statement : a_label simple_name { if (not Vst::states->_firstPass) { - Vst::states->_masterCell = Vst::framework->getCell( *$2, Catalog::State::Views|Catalog::State::InMemory ); + Vst::states->_masterCell = Vst::framework->getCell( *$2, Catalog::State::Logical|Catalog::State::InMemory ); if (not Vst::states->_masterCell) { ostringstream message; message << "CParsVst() VHDL Parser - File:<" << Vst::states->_vhdFileName @@ -787,7 +668,7 @@ component_instantiation_statement Vst::states->_instance = Instance::create( Vst::states->_cell, *$1, Vst::states->_masterCell ); Vst::states->_cell->setTerminalNetlist( false ); } else { - if (not Vst::framework->getCell(*$2,Catalog::State::Views|Catalog::State::InMemory)) { + if (not Vst::framework->getCell(*$2,Catalog::State::Logical|Catalog::State::InMemory)) { if (Vst::states->pushCell(*$2)) { ostringstream message; message << "CParsVst() VHDL Parser - File:<" << Vst::states->_vhdFileName @@ -1218,7 +1099,7 @@ namespace { ostringstream formatted; formatted << "CParsVst() - VHDL Parser, File:<" << Vst::states->_vhdFileName << ">, Line:" << Vst::states->_vhdLineNumber << "\n " - << message << " before " << yytext << ".\n"; + << message << " before keyword or identifier \"" << yytext << "\".\n"; throw Hurricane::Error( formatted.str() ); return 0; } @@ -1231,7 +1112,7 @@ namespace Vst { void incVhdLineNumber () - { ++states->_vhdLineNumber; } + { ++(states->_vhdLineNumber); } // --------------------------------------------------------------- @@ -1397,12 +1278,13 @@ void vstParser ( const string cellPath, Cell *cell ) // 1.0 step: Build the ordered list of model (Cell) required by the instances. yyin = ccell.getFile (); if ( !firstCall ) yyrestart ( VSTin ); + //yydebug = 0; yyparse (); // 1.5 step: Load, in order, the model Cells (recursive). while ( !Vst::states->_cellQueue.empty() ) { if ( !Vst::framework->getCell ( getString(Vst::states->_cellQueue.front()) - , Catalog::State::Views + , Catalog::State::Logical , Vst::states->_state->getDepth()-1) ) { throw Error ( "CParsVst() VHDL Parser:\n" " Unable to find cell \"%s\", please check your <./coriolis2/settings.py>.\n" @@ -1426,7 +1308,6 @@ void vstParser ( const string cellPath, Cell *cell ) UpdateSession::open (); yyparse (); UpdateSession::close (); - Vst::ClearIdentifiers (); Vst::states.pop_back(); ccell.close (); diff --git a/crlcore/src/ccore/alliance/vst/VstParserScanner.ll b/crlcore/src/ccore/alliance/vst/VstParserScanner.ll index 53d09956..3c5fd864 100644 --- a/crlcore/src/ccore/alliance/vst/VstParserScanner.ll +++ b/crlcore/src/ccore/alliance/vst/VstParserScanner.ll @@ -23,25 +23,17 @@ // +-----------------------------------------------------------------+ -# include +#include -# include -# include -# include -# include +#include +#include +#include +#include using namespace std; -# include "VstParserGrammar.hpp" - - - -namespace Vst { - - extern void ClearIdentifiers (); - extern void incVhdLineNumber (); - -} +#include "VstParser.h" +#include "VstParserGrammar.hpp" namespace { @@ -175,29 +167,7 @@ namespace { } - class Identifiers : public vector { - public: - ~Identifiers (); - void clear (); - }; - - - Identifiers::~Identifiers () { - for ( unsigned int i=0 ; i < size() ; i++ ) - delete (*this)[i]; - } - - - void Identifiers::clear () { - for ( unsigned int i=0 ; i < size() ; i++ ) - delete (*this)[i]; - - vector::clear (); - } - - VHDLKeywords vhdlKeywords; - Identifiers identifiers; char* lower ( char* str ); @@ -259,37 +229,29 @@ base_specifier (B|b|O|o|X|x) \/ { return Slash; } {letter}(_?{letter_or_digit})* { - VHDLKeywords::iterator it = vhdlKeywords.find ( lower(yytext) ); - - if ( it != vhdlKeywords.end() ) { return it->second; } - - VSTlval._text = new string ( yytext ); - identifiers.push_back ( VSTlval._text ); - + VHDLKeywords::iterator it = vhdlKeywords.find( lower(yytext) ); + if (it != vhdlKeywords.end()) { return it->second; } + VSTlval._text = Vst::states->addLexIdentifier( yytext ); return Identifier; } ({decimal_literal})|({base}#{based_integer}(\.{based_integer})?#({exponent})?)|({base}:{based_integer}(\.{based_integer})?:({exponent})?) { - VSTlval._text = new string ( yytext ); - identifiers.push_back ( VSTlval._text ); + VSTlval._text = Vst::states->addLexIdentifier( yytext ); return AbstractLit; } '({graphic_character}|\"|\%)' { - VSTlval._text = new string ( yytext ); - identifiers.push_back ( VSTlval._text ); + VSTlval._text = Vst::states->addLexIdentifier( yytext ); return CharacterLit; } (\"({graphic_character}|(\"\")|\%)*\")|(\%({graphic_character}|(\%\%)|\")*\%) { - VSTlval._text = new string ( yytext ); - identifiers.push_back ( VSTlval._text ); + VSTlval._text = Vst::states->addLexIdentifier( yytext ); return StringLit; } {base_specifier}(\"{extended_digit}(_?{extended_digit})*\"|\%{extended_digit}(_?{extended_digit})*\%) { - VSTlval._text = new string ( yytext ); - identifiers.push_back ( VSTlval._text ); + VSTlval._text = Vst::states->addLexIdentifier( yytext ); return BitStringLit; } @@ -304,16 +266,6 @@ base_specifier (B|b|O|o|X|x) int yywrap () { return 1; } -namespace Vst { - - - void ClearIdentifiers () - { identifiers.clear (); } - - -} // Vst namespace. - - namespace { diff --git a/etesian/src/EtesianEngine.cpp b/etesian/src/EtesianEngine.cpp index 63673859..1875f304 100644 --- a/etesian/src/EtesianEngine.cpp +++ b/etesian/src/EtesianEngine.cpp @@ -311,6 +311,8 @@ namespace Etesian { } } _sliceHeight = getCellGauge()->getSliceHeight(); + + loadLeafCellLayouts(); } @@ -383,6 +385,12 @@ namespace Etesian { instanceNb += 1; } + if (cellLength == 0) { + throw Error( "EtesianEngine::setDefaultAb(): Null surface area computed for \"%s\" (are physical views loaded?)." + , getString(getCell()->getName()).c_str() + ); + } + if (cellLength < 0) throw Error( "EtesianEngine::setDefaultAb(): Negative surface area computed for \"%s\" (bad bloat profile?)." , getString(getCell()->getName()).c_str() @@ -393,6 +401,12 @@ namespace Etesian { double gcellLength = cellLength*(1.0+spaceMargin) / DbU::toLambda( getSliceHeight() ); + if (gcellLength == 0.0) { + throw Error( "EtesianEngine::setDefaultAb(): Null g-length for \"%s\" (are you using the right gauge?)." + , getString(getCell()->getName()).c_str() + ); + } + double rows = 0.0; //setFixedAbHeight( 0 ); if (getFixedAbHeight()) rows = getFixedAbHeight() / getSliceHeight(); @@ -458,8 +472,8 @@ namespace Etesian { } else { bool isFullyPlaced = true; for ( Instance* subInstance : masterCell->getInstances() ) { - if ( (instance->getPlacementStatus() != Instance::PlacementStatus::PLACED) - and (instance->getPlacementStatus() != Instance::PlacementStatus::FIXED ) ) { + if ( (subInstance->getPlacementStatus() != Instance::PlacementStatus::PLACED) + and (subInstance->getPlacementStatus() != Instance::PlacementStatus::FIXED ) ) { isFullyPlaced = false; break; } @@ -965,6 +979,18 @@ namespace Etesian { } + void EtesianEngine::loadLeafCellLayouts () + { + AllianceFramework* af = AllianceFramework::get(); + for ( Occurrence occurrence : getCell()->getTerminalNetlistInstanceOccurrences(getBlockInstance()) ) { + Instance* instance = static_cast(occurrence.getEntity()); + Cell* masterCell = instance->getMasterCell(); + + af->getCell( getString(masterCell->getName()), Catalog::State::Physical ); + } + } + + void EtesianEngine::place () { if (getBlockCell()->isPlaced()) { diff --git a/etesian/src/etesian/EtesianEngine.h b/etesian/src/etesian/EtesianEngine.h index ee35e595..1f45cf09 100644 --- a/etesian/src/etesian/EtesianEngine.h +++ b/etesian/src/etesian/EtesianEngine.h @@ -56,48 +56,49 @@ namespace Etesian { public: typedef ToolEngine Super; public: - static const Name& staticGetName (); - static EtesianEngine* create ( Cell* ); - static EtesianEngine* get ( const Cell* ); - public: - virtual Configuration* getConfiguration (); - virtual const Configuration* getConfiguration () const; - virtual const Name& getName () const; - inline RoutingGauge* getGauge () const; - inline CellGauge* getCellGauge () const; - inline DbU::Unit getHorizontalPitch () const; - inline DbU::Unit getVerticalPitch () const; - inline DbU::Unit getSliceHeight () const; - inline DbU::Unit getSliceStep () const; - inline DbU::Unit getFixedAbHeight () const; - inline Effort getPlaceEffort () const; - inline GraphicUpdate getUpdateConf () const; - inline Density getSpreadingConf () const; - inline double getSpaceMargin () const; - inline double getAspectRatio () const; - inline const FeedCells& getFeedCells () const; - inline Hurricane::CellViewer* getViewer () const; - inline void setViewer ( Hurricane::CellViewer* ); - inline Cell* getBlockCell () const; - inline Instance* getBlockInstance () const; - inline void setBlock ( Instance* ); - inline void setFixedAbHeight ( DbU::Unit ); - void setDefaultAb (); - void adjustSliceHeight (); - void resetPlacement (); - void toColoquinte (); - void preplace (); - void roughLegalize ( float minDisruption, unsigned options ); - void globalPlace ( float initPenalty, float minDisruption, float targetImprovement, float minInc, float maxInc, unsigned options=0 ); - void detailedPlace ( int iterations, int effort, unsigned options=0 ); - void place (); - inline void useFeed ( Cell* ); - size_t findYSpin (); - void addFeeds (); - inline void selectBloat ( std::string ); - virtual Record* _getRecord () const; - virtual std::string _getString () const; - virtual std::string _getTypeName () const; + static const Name& staticGetName (); + static EtesianEngine* create ( Cell* ); + static EtesianEngine* get ( const Cell* ); + public: + virtual Configuration* getConfiguration (); + virtual const Configuration* getConfiguration () const; + virtual const Name& getName () const; + inline RoutingGauge* getGauge () const; + inline CellGauge* getCellGauge () const; + inline DbU::Unit getHorizontalPitch () const; + inline DbU::Unit getVerticalPitch () const; + inline DbU::Unit getSliceHeight () const; + inline DbU::Unit getSliceStep () const; + inline DbU::Unit getFixedAbHeight () const; + inline Effort getPlaceEffort () const; + inline GraphicUpdate getUpdateConf () const; + inline Density getSpreadingConf () const; + inline double getSpaceMargin () const; + inline double getAspectRatio () const; + inline const FeedCells& getFeedCells () const; + inline Hurricane::CellViewer* getViewer () const; + inline void setViewer ( Hurricane::CellViewer* ); + inline Cell* getBlockCell () const; + inline Instance* getBlockInstance () const; + inline void setBlock ( Instance* ); + inline void setFixedAbHeight ( DbU::Unit ); + void setDefaultAb (); + void adjustSliceHeight (); + void resetPlacement (); + void loadLeafCellLayouts (); + void toColoquinte (); + void preplace (); + void roughLegalize ( float minDisruption, unsigned options ); + void globalPlace ( float initPenalty, float minDisruption, float targetImprovement, float minInc, float maxInc, unsigned options=0 ); + void detailedPlace ( int iterations, int effort, unsigned options=0 ); + void place (); + inline void useFeed ( Cell* ); + size_t findYSpin (); + void addFeeds (); + inline void selectBloat ( std::string ); + virtual Record* _getRecord () const; + virtual std::string _getString () const; + virtual std::string _getTypeName () const; private: // Attributes. static Name _toolName; diff --git a/katana/src/KatanaEngine.cpp b/katana/src/KatanaEngine.cpp index 95edaa3f..bd647bcb 100644 --- a/katana/src/KatanaEngine.cpp +++ b/katana/src/KatanaEngine.cpp @@ -153,6 +153,7 @@ namespace Katana { using Hurricane::Cell; using Hurricane::Instance; using CRL::System; + using CRL::Catalog; using CRL::AllianceFramework; using CRL::addMeasure; using CRL::Measures; @@ -203,10 +204,10 @@ namespace Katana { void KatanaEngine::_postCreate () { - Super::_postCreate (); + Super::_postCreate(); // Flute: load POWV9.dat & POST9.dat - Flute::readLUT( System::getPath("coriolis_top").toString() ); + Flute::readLUT( System::getPath( "coriolis_top" ).toString() ); }