From e364edca523cfe5b53bae42a9442bf9569e6569e Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Wed, 7 May 2014 23:12:37 +0200 Subject: [PATCH] Take account of fixed placement in Bookshelf & Ispd 05 parser. --- crlcore/src/ccore/iccad04/Iccad04Lefdef.cpp | 15 +++-------- crlcore/src/ccore/ispd05/Ispd05Bookshelf.cpp | 26 +++++++++++++++++++ crlcore/src/ccore/lefdef/DefImport.cpp | 15 +++-------- crlcore/src/ccore/lefdef/DefParser.cpp | 16 +++--------- etesian/src/EtesianEngine.cpp | 15 +++++++++-- vlsisapd/src/bookshelf/src/Node.cpp | 8 +++--- vlsisapd/src/bookshelf/src/Parser.cpp | 6 +++++ .../bookshelf/src/vlsisapd/bookshelf/Node.h | 18 +++++++++---- 8 files changed, 71 insertions(+), 48 deletions(-) diff --git a/crlcore/src/ccore/iccad04/Iccad04Lefdef.cpp b/crlcore/src/ccore/iccad04/Iccad04Lefdef.cpp index 3bd54a45..6a7b5cab 100644 --- a/crlcore/src/ccore/iccad04/Iccad04Lefdef.cpp +++ b/crlcore/src/ccore/iccad04/Iccad04Lefdef.cpp @@ -1,15 +1,9 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2010-2010, All Rights Reserved +// Copyright (c) UPMC/LIP6 2010-2014, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | ICCAD04 IBM Standard Cell Benchmarks | // | | @@ -17,10 +11,7 @@ // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | // | C++ Module : "./Iccad04Lefdef.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ #include diff --git a/crlcore/src/ccore/ispd05/Ispd05Bookshelf.cpp b/crlcore/src/ccore/ispd05/Ispd05Bookshelf.cpp index ae14f535..e5d63777 100644 --- a/crlcore/src/ccore/ispd05/Ispd05Bookshelf.cpp +++ b/crlcore/src/ccore/ispd05/Ispd05Bookshelf.cpp @@ -111,6 +111,29 @@ namespace { } + Transformation toTransformation ( Bookshelf::Node* node ) + { + DbU::Unit x = DbU::fromLambda( node->getX ()*pitch ); + DbU::Unit y = DbU::fromLambda( node->getY ()*pitch ); + DbU::Unit width = DbU::fromLambda( node->getWidth ()*pitch ); + DbU::Unit height = DbU::fromLambda( node->getHeight()*pitch ); + + + switch (node->getOrientation()) { + case Bookshelf::Orientation::Disabled: + case Bookshelf::Orientation::N: return Transformation( x , y , Transformation::Orientation::ID ); + case Bookshelf::Orientation::W: return Transformation( x , y+width , Transformation::Orientation::R1 ); + case Bookshelf::Orientation::S: return Transformation( x+width , y+height, Transformation::Orientation::R2 ); + case Bookshelf::Orientation::E: return Transformation( x+height, y , Transformation::Orientation::R3 ); + case Bookshelf::Orientation::FN: return Transformation( x+width , y , Transformation::Orientation::MX ); + case Bookshelf::Orientation::FW: return Transformation( x+height, y+width , Transformation::Orientation::XR ); + case Bookshelf::Orientation::FS: return Transformation( x , y+height, Transformation::Orientation::MY ); + case Bookshelf::Orientation::FE: return Transformation( x+height, y+width , Transformation::Orientation::YR ); + } + return Transformation(); + } + + } // End of anonymous namespace. @@ -162,6 +185,9 @@ namespace CRL { } Instance* instance = Instance::create( cell, node->getName(), master ); + instance->setTransformation( toTransformation(node) ); + if (node->isFixed()) + instance->setPlacementStatus( Instance::PlacementStatus::FIXED ); for ( auto ipin : node->getPins() ) { Name netName = ipin.second->getNet()->getName(); diff --git a/crlcore/src/ccore/lefdef/DefImport.cpp b/crlcore/src/ccore/lefdef/DefImport.cpp index 45c41bd7..f89c3508 100644 --- a/crlcore/src/ccore/lefdef/DefImport.cpp +++ b/crlcore/src/ccore/lefdef/DefImport.cpp @@ -1,15 +1,9 @@ - // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2010-2010, All Rights Reserved +// Copyright (c) UPMC/LIP6 2010-2014, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | C a d e n c e D E F I m p o r t e r | // | | @@ -17,10 +11,7 @@ // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | // | C++ Module : "./DefImport.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ #include diff --git a/crlcore/src/ccore/lefdef/DefParser.cpp b/crlcore/src/ccore/lefdef/DefParser.cpp index 53d010dd..2d0d9184 100644 --- a/crlcore/src/ccore/lefdef/DefParser.cpp +++ b/crlcore/src/ccore/lefdef/DefParser.cpp @@ -2,14 +2,9 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2014, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | Alliance / Hurricane Interface | // | | @@ -20,12 +15,7 @@ // | E-mail : Damien.Dupuis@lip6.fr | // | =============================================================== | // | C++ Module : "./DefParser.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// | * 2007-03-26 : To be compliant with LEFDEF 5.6 | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ diff --git a/etesian/src/EtesianEngine.cpp b/etesian/src/EtesianEngine.cpp index ba181fd7..20257e7d 100644 --- a/etesian/src/EtesianEngine.cpp +++ b/etesian/src/EtesianEngine.cpp @@ -300,8 +300,11 @@ namespace Etesian { getCell()->flattenNets( Cell::BuildRings ); // Coloquinte circuit description data-structures. + size_t instancesNb = getCell()->getLeafInstanceOccurrences().getSize(); + vector idsToTransf ( instancesNb ); + _circuit = new Coloquinte::circuit(); - _circuit->cells .resize( getCell()->getLeafInstanceOccurrences().getSize() ); + _circuit->cells .resize( instancesNb ); _circuit->hypernets.resize( getCell()->getNets().getSize() ); cmess1 << " - Converting Instances (Bookshelf nodes)" << endl; @@ -322,6 +325,7 @@ namespace Etesian { Coloquinte::circuit_coordinate cellSize ( masterCell->getAbutmentBox().getWidth () / DbU::fromLambda(5.0) , masterCell->getAbutmentBox().getHeight() / DbU::fromLambda(5.0) ); _cellsToIds.insert( make_pair(instanceName,cellId) ); + idsToTransf[cellId] = (*ioccurrence).getPath().getTransformation(); dots.dot(); //cerr << instanceName << " " << (int)instance->getPlacementStatus().getCode() @@ -331,6 +335,8 @@ namespace Etesian { _circuit->cells[cellId].sizes = cellSize; _circuit->cells[cellId].area = cellSize.cast().prod(); _circuit->cells[cellId].movable = not instance->isFixed() and instance->isTerminal(); + if (not _circuit->cells[cellId].movable) + cerr << "FIXED (movable=false):" << instance << endl; //_circuit->cells[cellId].movable = (instance->getPlacementStatus() == Instance::PlacementStatus::UNPLACED); cellId++; @@ -392,10 +398,15 @@ namespace Etesian { _circuit->position_overlays[0].y_pos = Coloquinte::circuit_vector( _cellsToIds.size() ); for ( auto ipair : _cellsToIds ) { - Coloquinte::circuit_coordinate position = Coloquinte::circuit_coordinate::Zero(); + Coloquinte::circuit_coordinate position ( idsToTransf[ipair.second].getTx() / DbU::fromLambda(5.0) + , idsToTransf[ipair.second].getTy() / DbU::fromLambda(5.0) ); position += _circuit->cells[ipair.second].get_sizes() / 2; _circuit->position_overlays[0].x_pos[ipair.second] = position.x(); _circuit->position_overlays[0].y_pos[ipair.second] = position.y(); + + if (not _circuit->cells[ipair.second].movable) { + cerr << "Fixed cell @" << position.x() << "x" << position.y() << endl; + } } // Temporarily force the circuit size. diff --git a/vlsisapd/src/bookshelf/src/Node.cpp b/vlsisapd/src/bookshelf/src/Node.cpp index dc8a79fe..9e64ef33 100644 --- a/vlsisapd/src/bookshelf/src/Node.cpp +++ b/vlsisapd/src/bookshelf/src/Node.cpp @@ -61,7 +61,7 @@ namespace Bookshelf { if ( (_width != 0.0) or (_height != 0.0) ) { o << " " << std::setw(10) << std::right << _width << " " << std::setw(10) << std::right << _height; } - if ( _terminal ) o << " terminal"; + if ( flags & Terminal ) o << " terminal"; if ( _symmetry != Symmetry::Disabled ) { o << " :"; if ( _symmetry & Symmetry::R90 ) o << " R90"; @@ -83,6 +83,7 @@ namespace Bookshelf { if ( _orientation == Orientation::FS ) o << " FS"; if ( _orientation == Orientation::FW ) o << " FW"; } + if ( flags & Fixed ) o << " /FIXED"; o << std::endl; } } @@ -100,9 +101,8 @@ namespace Bookshelf { if ( node->_symmetry & Symmetry::Y ) o << " Y"; if ( node->_symmetry & Symmetry::R90 ) o << " R90"; } - if ( node->_terminal ) { - o << " terminal"; - } + if ( node->_flags & Node::Terminal ) o << " terminal"; + if ( node->_flags & Node::Fixed ) o << " /FIXED"; return o; } diff --git a/vlsisapd/src/bookshelf/src/Parser.cpp b/vlsisapd/src/bookshelf/src/Parser.cpp index 2bac4bfd..46bb5a9f 100644 --- a/vlsisapd/src/bookshelf/src/Parser.cpp +++ b/vlsisapd/src/bookshelf/src/Parser.cpp @@ -533,6 +533,7 @@ namespace Bookshelf { { unsigned int orientation = Orientation::N; bool orientationToken = false; + unsigned int flags = 0; double x = 0; double y = 0; @@ -544,6 +545,10 @@ namespace Bookshelf { for ( size_t itoken=1 ; itoken<_tokens.size() ; ++itoken ) { //std::cerr << "F:" << _tokens[itoken] << " "; if ( orientationToken ) { + if (itoken+1 < _tokens.size()) { + if ( _keywordCompare("/FIXED",_tokens[itoken+1]) == 0 ) flags |= Node::Fixed; + } + if ( _keywordCompare("N" ,_tokens[itoken]) == 0 ) { orientation |= Orientation::N; continue; } if ( _keywordCompare("E" ,_tokens[itoken]) == 0 ) { orientation |= Orientation::E; continue; } if ( _keywordCompare("S" ,_tokens[itoken]) == 0 ) { orientation |= Orientation::S; continue; } @@ -572,6 +577,7 @@ namespace Bookshelf { node->setX ( x ); node->setY ( y ); node->setOrientation ( orientation ); + node->setFlags ( flags ); } diff --git a/vlsisapd/src/bookshelf/src/vlsisapd/bookshelf/Node.h b/vlsisapd/src/bookshelf/src/vlsisapd/bookshelf/Node.h index 85c7703d..81e98a06 100644 --- a/vlsisapd/src/bookshelf/src/vlsisapd/bookshelf/Node.h +++ b/vlsisapd/src/bookshelf/src/vlsisapd/bookshelf/Node.h @@ -41,13 +41,16 @@ namespace Bookshelf { class Node { + public: + enum Flag { NoFlags=0x0000, Terminal=0x0001, Fixed=0x0002 }; public: inline Node ( const std::string& name , double width =0.0 , double height =0.0 , unsigned int symmetry=Symmetry::Disabled - , bool terminal=false ); + , unsigned int flags =NoFlags ); inline bool isTerminal () const; + inline bool isFixed () const; inline const std::string& getName () const; inline double getWidth () const; inline double getHeight () const; @@ -58,6 +61,8 @@ namespace Bookshelf { Pin* getPin ( size_t id ) const; inline std::map& getPins (); void addPin ( Pin* ); + inline void setFlags ( unsigned int flags ); + inline void unsetFlags ( unsigned int flags ); inline void setX ( double ); inline void setY ( double ); inline void setOrientation ( unsigned int ); @@ -71,7 +76,7 @@ namespace Bookshelf { double _x; double _y; unsigned int _orientation; - bool _terminal; + unsigned int _flags; std::map _pins; }; @@ -80,7 +85,7 @@ namespace Bookshelf { , double width , double height , unsigned int symmetry - , bool terminal + , unsigned int flags ) : _name (name) , _width (width) @@ -89,7 +94,7 @@ namespace Bookshelf { , _x (0.0) , _y (0.0) , _orientation(Orientation::Disabled) - , _terminal (terminal) + , _flags (flags) { // std::cerr << "Node::Node() " // << (void*)this @@ -102,7 +107,8 @@ namespace Bookshelf { // << ">." << std::endl; } - inline bool Node::isTerminal () const { return _terminal; } + inline bool Node::isTerminal () const { return _flags&Terminal; } + inline bool Node::isFixed () const { return _flags&Fixed; } inline const std::string& Node::getName () const { return _name; } inline double Node::getWidth () const { return _width; } inline double Node::getHeight () const { return _height; } @@ -111,6 +117,8 @@ namespace Bookshelf { inline unsigned int Node::getSymmetry () const { return _symmetry; } inline unsigned int Node::getOrientation () const { return _orientation; } inline std::map& Node::getPins () { return _pins; } + inline void Node::setFlags ( unsigned int flags ) { _flags |= flags; } + inline void Node::unsetFlags ( unsigned int flags ) { _flags &= ~flags; } inline void Node::setX ( double x ) { _x=x; } inline void Node::setY ( double y ) { _y=y; } inline void Node::setOrientation ( unsigned int orient ) { _orientation=orient; }