* ./nimbus:

- Bug: In Grid::Grid(), uses trans-hierarchical iterators to compute the
        sum of "instance width" instead of the "flat" ones.
    - Bug: In Grid::rectangularShape(), uses "minWith" parameter *only* if it's
        different from DbU::Max.
This commit is contained in:
Jean-Paul Chaput 2011-01-09 18:25:58 +00:00
parent 3390c400dd
commit eb96663040
1 changed files with 28 additions and 13 deletions

View File

@ -161,13 +161,23 @@ Grid::Grid (NimbusEngine* nimbus)
if ( isNoInstancePlacedOrFixed(_cell) ) { if ( isNoInstancePlacedOrFixed(_cell) ) {
DbU::Unit minWidth = DbU::Max; DbU::Unit minWidth = DbU::Max;
double sumWidth = 0.0; double sumWidth = 0.0;
forEach ( Instance*, iinstance, _cell->getInstances() ) {
Cell* model = iinstance->getMasterCell(); forEach ( Occurrence, ioccurrence, _cell->getLeafInstanceOccurrences() ) {
DbU::Unit width = model->getAbutmentBox().getWidth(); Instance* instance = static_cast<Instance*>((*ioccurrence).getEntity());
if ( width < minWidth ) minWidth = width; if ( not instance->isFixed() and instance->isTerminal() ) {
sumWidth += DbU::getLambda(width); Cell* model = instance->getMasterCell();
sumWidth += DbU::getLambda(model->getAbutmentBox().getWidth());
}
} }
// forEach ( Instance*, iinstance, _cell->getInstances() ) {
// Cell* model = iinstance->getMasterCell();
// DbU::Unit width = model->getAbutmentBox().getWidth();
// if ( width < minWidth ) minWidth = width;
// sumWidth += DbU::getLambda(width);
// }
rectangularShape(_nimbus->getMargin(), nimbus->getAspectRatio(), sumWidth, minWidth ); rectangularShape(_nimbus->getMargin(), nimbus->getAspectRatio(), sumWidth, minWidth );
UpdateSession::open(); UpdateSession::open();
@ -230,18 +240,19 @@ void Grid::Clear()
void Grid::rectangularShape(double margin, double aspectRatio, double sumWidth, DbU::Unit minWidth) void Grid::rectangularShape(double margin, double aspectRatio, double sumWidth, DbU::Unit minWidth)
// ************************************************************************************************ // ************************************************************************************************
{ {
cmess1 << " o Creating abutment box: (margin: " << margin cmess1 << " o Creating abutment box: (margin:" << (margin*100.0)
<< ", aspect ratio:" << aspectRatio << ")" << endl; << "%, aspect ratio:" << (aspectRatio*100.0)
<< "%, sumWidth:" << sumWidth << ")" << endl;
double dMinWidth = DbU::getLambda(minWidth); double dMinWidth = DbU::getLambda(minWidth);
double rowHeight = DbU::getLambda(_nimbus->getSliceHeight()); double rowHeight = DbU::getLambda(_nimbus->getSliceHeight());
DbU::Unit pitch = _nimbus->getPitch(); DbU::Unit pitch = _nimbus->getPitch();
double marginWidth = (1.0+margin) * sumWidth; double marginWidth = (1.0+margin) * sumWidth;
// cerr << "sumWidth:" << sumWidth // cerr << "sumWidth:" << sumWidth
// << " rowHeight:" << rowHeight // << " rowHeight:" << rowHeight
// << " pitch:" << DbU::getValueString(pitch) // << " pitch:" << DbU::getValueString(pitch)
// << " minWidth:" << minWidth // << " marginWidth:" << marginWidth
// << endl; // << endl;
// AR = x/y S = x*y = marginWidth*SH x=S/y AR = S/y^2 // AR = x/y S = x*y = marginWidth*SH x=S/y AR = S/y^2
@ -253,15 +264,19 @@ void Grid::Clear()
if ( rows == 0 ) ++rows; if ( rows == 0 ) ++rows;
double rowWidth = marginWidth / rows; double rowWidth = marginWidth / rows;
//cerr << "y:" << y << " rows:" << rows << endl; // cerr << "y:" << y << " rows:" << rows << endl;
// cerr << "rowWidth:" << rowWidth << endl;
// cerr << "dMinWidth:" << dMinWidth << endl;
if ( rowWidth < dMinWidth ) { if ( (minWidth != DbU::Max) and (rowWidth < dMinWidth) ) {
rowWidth = dMinWidth; rowWidth = dMinWidth;
rows = (unsigned int)(marginWidth / rowWidth); rows = (unsigned int)(marginWidth / rowWidth);
if ( rows == 0 ) ++rows; if ( rows == 0 ) ++rows;
} }
// cerr << "rowWidth:" << rowWidth << endl;
DbU::Unit unitRowWidth = DbU::lambda(rowWidth); DbU::Unit unitRowWidth = DbU::lambda(rowWidth);
DbU::Unit adjustWidth = unitRowWidth % pitch; DbU::Unit adjustWidth = unitRowWidth % pitch;
if ( adjustWidth != 0 ) if ( adjustWidth != 0 )