Fix divide by zero in GCells of null size.

* Bug: In Anabatic::GCell, when width and/or heigh is null, do not try to
    compute densities as it will trigger a divide by zero (and do not make
    much sense anyway).
* Change: In CRL Core, in cmos/alliance.conf, honor the ALLIANCE_TOP variable
    if it is found in the user's environement.
This commit is contained in:
Jean-Paul Chaput 2016-08-06 18:19:22 +02:00
parent 3835d6f7ad
commit e19893ac32
3 changed files with 25 additions and 15 deletions

View File

@ -1417,21 +1417,36 @@ namespace Anabatic {
for ( size_t i=0 ; i<_depth ; i++ ) {
switch ( Session::getDirection(i) ) {
case Flags::Horizontal:
_densities [i] = ((float)uLengths2[i]) / ( hcapacity * (float)width );
_feedthroughs [i] += (float)(_blockages[i] / width);
_fragmentations[i] = (float)ufragments[i].getMaxFree().getSize() / (float)width;
if (width) {
_densities [i] = ((float)uLengths2[i]) / ( hcapacity * (float)width );
_feedthroughs [i] += (float)(_blockages[i] / width);
_fragmentations[i] = (float)ufragments[i].getMaxFree().getSize() / (float)width;
} else {
_densities [i] = 0;
_feedthroughs [i] = 0;
_fragmentations[i] = 0;
}
break;
case Flags::Vertical:
_densities [i] = ((float)uLengths2[i]) / ( vcapacity * (float)height );
_feedthroughs [i] += (float)(_blockages[i] / height);
_fragmentations[i] = (float)ufragments[i].getMaxFree().getSize() / (float)height;
if (height) {
_densities [i] = ((float)uLengths2[i]) / ( vcapacity * (float)height );
_feedthroughs [i] += (float)(_blockages[i] / height);
_fragmentations[i] = (float)ufragments[i].getMaxFree().getSize() / (float)height;
} else {
_densities [i] = 0;
_feedthroughs [i] = 0;
_fragmentations[i] = 0;
}
break;
}
if (_densities[i] >= 1.0) _flags |= Flags::Saturated;
}
_cDensity = ( (float)_contacts.size() ) / ccapacity;
if (ccapacity)
_cDensity = ( (float)_contacts.size() ) / ccapacity;
else
_cDensity = 0;
_flags.reset( Flags::Invalidated );
checkDensity();

View File

@ -32,13 +32,8 @@
namespace {
const char* reopenSession =
"Session::open() :\n\n"
" Session already open for %s (internal error).";
const char* openSessionError =
"%s :\n\n"
" Session has not been opened (internal error).";
const char* reopenSession = "Session::open(): Session already open for %s (internal error).";
const char* openSessionError = "%s: Session has not been opened (internal error).";
} // End of local namespace.

View File

@ -6,7 +6,7 @@ from helpers.Alliance import Gauge
allianceTop = None
if os.environ.has_key['ALLIANCE_TOP']:
if os.environ.has_key('ALLIANCE_TOP'):
allianceTop = os.environ['ALLIANCE_TOP']
if not os.path.isdir(allianceTop):
allianceTop = None