coriolis/etesian/src/FeedCells.cpp

124 lines
3.4 KiB
C++
Raw Normal View History

// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC 2015-2018, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | E t e s i a n - A n a l y t i c P l a c e r |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./FeedCells.cpp" |
// +-----------------------------------------------------------------+
#include <sstream>
#include "hurricane/Warning.h"
#include "etesian/FeedCells.h"
#include "etesian/EtesianEngine.h"
namespace Etesian {
using std::cerr;
using std::endl;
using std::map;
using std::string;
using std::ostringstream;
using std::make_pair;
using Hurricane::Warning;
using Hurricane::DbU;
void FeedCells::useTie ( Cell* cell )
{
if (cell == NULL) return;
DbU::Unit pitch = _etesian->getSliceStep();
if (cell->getAbutmentBox().getWidth() % pitch != 0)
cerr << Warning( "FeedCells::useTie(): \"%s\" has not a width (%s) multiple of pitch (%s)."
, getString(cell->getName()).c_str()
, DbU::getValueString(cell->getAbutmentBox().getWidth()).c_str()
, DbU::getValueString(pitch).c_str()
) << endl;
Migration towards Python3, first stage: still based on C-Macros. * New: Python/C++ API level: * Write a new C++/template wrapper to get rid of boost::python * The int & long Python type are now merged. So a C/C++ level, it became "PyLong_X" (remove "PyInt_X") and at Python code level, it became "int" (remove "long"). * Change: VLSISAPD finally defunct. * Configuration is now integrated as a Hurricane component, makes use of the new C++/template wrapper. * vlsisapd is now defunct. Keep it in the source for now as some remaining non essential code may have to be ported in the future. * Note: Python code (copy of the migration howto): * New print function syntax print(). * Changed "dict.has_key(k)" for "k" in dict. * Changed "except Exception, e" for "except Exception as e". * The division "/" is now the floating point division, even if both operand are integers. So 3/2 now gives 1.5 and no longer 1. The integer division is now "//" : 1 = 3//2. So have to carefully review the code to update. Most of the time we want to use "//". We must never change to float for long that, in fact, represents DbU (exposed as Python int type). * execfile() must be replaced by exec(open("file").read()). * iter().__next__() becomes iter(x).__next__(). * __getslice__() has been removed, integrated to __getitem__(). * The formating used for str(type(o)) has changed, so In Stratus, have to update them ("<class 'MyClass'>" instead of "MyClass"). * the "types" module no longer supply values for default types like str (types.StringType) or list (types.StringType). Must use "isinstance()" where they were occuring. * Remove the 'L' to indicate "long integer" (like "12L"), now all Python integer are long. * Change in bootstrap: * Ported Coriolis builder (ccb) to Python3. * Ported Coriolis socInstaller.py to Python3. * Note: In PyQt4+Python3, QVariant no longer exists. Use None or directly convert using the python syntax: bool(x), int(x), ... By default, it is a string (str). * Note: PyQt4 bindings & Python3 under SL7. * In order to compile user's must upgrade to my own rebuild of PyQt 4 & 5 bindings 4.19.21-1.el7.soc. * Bug: In cumulus/plugins.block.htree.HTree.splitNet(), set the root buffer of the H-Tree to the original signal (mainly: top clock). Strangely, it was only done when working in full chip mode.
2021-09-19 12:41:24 -05:00
//int pitchNb = (int)( cell->getAbutmentBox().getWidth() / pitch );
_tieCell = cell;
}
void FeedCells::useFeed ( Cell* cell )
{
if ( cell == NULL ) return;
DbU::Unit pitch = _etesian->getSliceStep();
if (cell->getAbutmentBox().getWidth() % pitch != 0)
cerr << Warning( "FeedCells::useFeed(): \"%s\" has not a width (%s) multiple of pitch (%s)."
, getString(cell->getName()).c_str()
, DbU::getValueString(cell->getAbutmentBox().getWidth()).c_str()
, DbU::getValueString(pitch).c_str()
) << endl;
int pitchNb = (int)( cell->getAbutmentBox().getWidth() / pitch );
if (getFeed(pitchNb) != NULL) {
cerr << Warning( "FeedCells::addFeed(): \"%s\" duplicate feed for width %d."
, getString(cell->getName()).c_str()
, pitchNb
) << endl;
return;
}
_feedCells.insert( make_pair(pitchNb,cell) );
}
Cell* FeedCells::getBiggestFeed () const
{
if (_feedCells.empty()) return NULL;
return (*(--_feedCells.end())).second;
}
Cell* FeedCells::getSmallestFeed () const
{
if (_feedCells.empty()) return NULL;
return (*(_feedCells.begin())).second;
}
Cell* FeedCells::getFeed ( int pitches ) const
{
map<int,Cell*>::const_iterator ifeed = _feedCells.find( pitches );
if (ifeed == _feedCells.end()) return NULL;
return (*ifeed).second;
}
Cell* FeedCells::getFeedByWidth ( DbU::Unit width ) const
{
for ( auto item : _feedCells ) {
if (item.second->getAbutmentBox().getWidth() == width)
return item.second;
}
return NULL;
}
string FeedCells::getUniqueInstanceName () const
{
ostringstream name;
name << "feed_" << _feedCount++;
return name.str();
}
} // Etesian namespace.