coriolis/katabatic/src/ChipTools.cpp

275 lines
9.2 KiB
C++
Raw Normal View History

// -*- C++ -*-
//
// This file is part of the Coriolis Software.
Improved UpdateSession & exception catching. Start of RoutingGauge implem. Miscellaneous: * Change: In <crlcore>, in display.conf use the same display threshold for both METAL2 & METAL3. In alliance.conf, the side of VIAs in the gauge is 2l (not 3l). In kite.conf, separate edge densities for H/V. * Change: In <Cell>, in flattenNets() use flag as argument, not a boolean. Do not create rings for clock or supply nets. * Change: In <DeepNet>, in _createRoutingPads() do not create rings for clock or supply net (duplicated policy as in Cell::flattenNets()). * Bug: In <ControllerWidget>, at last find the bad signal disconnect that was causing ungraceful messages. * Change: In <knik>, in Edge display occupancy/capacity in the string name. Improved display progress and debugging capabilities. Improved exception catch & breakpoint managment: * Bug: In <PaletteWidget>, in updateExtensions() replace the calls to deleteLayer() by delete. This cause the widget to be immediatly erased instead of waiting for the event queue to be completly processed. This was causing the widget to be left in a incoherent state when stoping at a breakpoint. * Bug: In <BreakpointWidget>, in execNoModal(), flush the main event loop (QApplication::flush()) *before* lauching the *local* event loop. This is to ensure all widgets are in their final state when waiting (especially <PaletteWidget>). * Change: In <ExceptionWidget>, new method catchAllWrapper() to execute any std::function< void() > function/method with a "try"/ "catch" wraparound and lauch the widget in case something is catch. * New: In <hurricane>, support for a oberver pattern, backported from <katabatic> with an Obervable capable of being linked to any number of Obervers. * New: In <Cell>, made it observable to detect Cell change, currently emit two kind of signals: - Cell::CellAboutToChange : *before* any change. - Cell::CellChanged : *after* the change has been completed. * New: In <UpdateSession>, in Go::invalidate() add the Cell owning the Go to the UPDATOR_STACK (of course the cell is added only once). In addition, when the Cell is added, send a notification of Cell::CellAboutToChange to all it's observers. The slave instances are also invalidated. Conversely in UpdateSession::_preDestroy() for each invalidated Cell send a Cell::CellChanged notification to all observer. The UPDATOR_STACK has been slightly amended to accept Cell which are not Gos. Prior to this, the Cell where completly excluded from the UpdateSession mechanism, so it's instances where never actualised of anything referring to the Cell for that matter. Note: we use two different mechanisms to transmit a Cell change, observers and the slave instance map. I think at some point it should be unificated. * Change: In <CellViewer>, make it a Cell observer to redraw when the cell is modificated (also update the palette). Uses the catchAllWrapper() to protect all critical actions. * Change: In <GraphicTool>, no longer need of cellPreModificated and cellPostModificated signals. Now done through the Cell obersvers. * Change: In <mauka>, <etesian> & <kite> now uses the catchAllWrapper method for protection (need to split methods in two, to be able to pass it as argument). No longer emit cellPreModificated and cellPostModificated. Support for RoutingGauge in P&R: * Bug: In <placeandroute.py>, the connection from the internal power ring to the connectors was not done correctly. Wrong contact layers leading to a gap. * Change: In <BuildPowerRails>, detection of the corona signals based on how the "pck_px" pad is connected. No longer based on name matching. * Change: In <placeandroute.py>, support for 2 routing metal only (3 metal in the technology). * Change: In <katabatic> & <kite> support for a "top layer" limitation on the routing gauge, this allows to use only two routing metals (METAL2 & METAL3). Work in progress.
2014-04-20 12:25:08 -05:00
// Copyright (c) UPMC/LIP6 2008-2014, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | K a t a b a t i c - Routing Toolbox |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./ChipTools.cpp" |
// +-----------------------------------------------------------------+
#include <string>
#include <sstream>
#include "hurricane/Warning.h"
#include "hurricane/Bug.h"
#include "hurricane/DataBase.h"
#include "hurricane/Technology.h"
#include "hurricane/Horizontal.h"
#include "hurricane/Vertical.h"
* ./katabatic: - New: In AutoSegment, adds a "_parent" attribute to keep track of the fragmentation processus. Currently used only for strap segments, points to the original segment in the appropriate direction (before the split). - New: In GCell & LayerAssign, new method of layer assignment. Move up the whole net trunk if only one of it's segment is inside an over-saturated GCell. AutoSegment are moved up only if there is at least 2 free tracks remaining on the upper level. - Change: In Session::_canonize(), uses the lowest segment Id as canonical. More reliable than geometricals criterions in the end. Assuming that the segments are being created in deterministic order, which *should* be the case consediring the way we are walking through the global routing. - Change: In AutoSegment, completly suppress the CompareCanonical(), replace it by the much simpler CompareId(). - Change: In GCell::rpDesaturate(), stops desaturation when bottom density is under 0.5, otherwise we are causing a severe imbalance in M2/M4 densities. All wires pushed up to M4... - Change: In ChipTools, for the Pad's RoutingPad, reslect the best component using the one in the lowest layer. To avoid problem when splitting AutoContact as we expect the base Contact to be on the lower layer. - Bug: In GCellConfiguration::_GCell_xG_xL1_xL3(), add H/V alignement constraints in fork case. This allow NE/SW contact to be splitted correctly later. - Bug: In AutoContact::split(), the connexity on the splitted contacts was not correctly restored, leading to canonization and parentage looping errors. This was concealed by the Kite Track::_check() bug (incomplete individual TrackSegment checking).
2010-12-30 12:41:19 -06:00
#include "hurricane/RoutingPad.h"
#include "crlcore/RoutingGauge.h"
#include "crlcore/AllianceFramework.h"
#include "katabatic/Session.h"
#include "katabatic/AutoContact.h"
#include "katabatic/AutoSegment.h"
#include "katabatic/AutoHorizontal.h"
#include "katabatic/AutoVertical.h"
#include "katabatic/GCell.h"
#include "katabatic/GCellGrid.h"
#include "katabatic/KatabaticEngine.h"
namespace {
using namespace std;
using namespace CRL;
using namespace Hurricane;
using namespace Katabatic;
enum SegmentType { LocalSegments=0x10, GlobalSegments=0x20 };
bool isChip ( Cell* cell, Instance*& core, Cell*& referencePad )
{
AllianceFramework* af = AllianceFramework::get();
int pads = 0;
int cores = 0;
core = NULL;
referencePad = NULL;
forEach ( Instance*, iinstance, cell->getInstances() ) {
if ( af->isPad(iinstance->getMasterCell()) ) {
++pads;
if (not referencePad)
referencePad = iinstance->getMasterCell();
} else {
++cores;
core = *iinstance;
}
}
return (pads > 0) and (cores == 1);
}
void breakSegments ( GCell* begin, GCell* end, Layer::Mask mask, unsigned int flags )
{
for ( GCell* gcell=begin ; gcell != NULL ; ) {
ltrace(200) << "Pre-break in " << gcell << endl;
if ( (flags & KbHorizontal) and (flags & KbGlobalSegment) ) {
const vector<AutoSegment*>& hsegments = gcell->getHSegments();
for ( size_t i=0 ; i<hsegments.size() ; ++i ) {
if ( not (hsegments[i]->getLayer()->getMask() & mask) ) continue;
ltrace(200) << "Pre-break: " << hsegments[i] << " @" << gcell << endl;
#ifdef THIS_IS_DISABLED
hsegments[i]->makeDogLeg ( gcell, true );
#endif
}
if ( gcell == end ) break;
gcell = gcell->getUp();
}
if ( (flags & KbVertical) and (flags & KbGlobalSegment) ) {
const vector<AutoSegment*>& vsegments = gcell->getVSegments();
for ( size_t i=0 ; i<vsegments.size() ; ++i ) {
if ( not (vsegments[i]->getLayer()->getMask() & mask) ) continue;
ltrace(200) << "Pre-break: " << vsegments[i] << " @" << gcell << endl;
#if THIS_IS_DISABLED
vsegments[i]->makeDogLeg ( gcell, true );
#endif
}
if ( gcell == end ) break;
gcell = gcell->getUp();
}
if (flags & KbGlobalSegment) {
const vector<AutoContact*>& contacts = gcell->getContacts();
vector<AutoSegment*> segments;
for ( size_t i=0 ; i<contacts.size() ; i++ ) {
forEach ( Component*, component, contacts[i]->getSlaveComponents() ) {
Segment* segment = dynamic_cast<Segment*>(*component);
AutoSegment* autoSegment = Session::lookup( segment );
if ( autoSegment and (autoSegment->getDirection() & flags) )
segments.push_back( autoSegment );
}
}
for ( size_t i=0 ; i<segments.size() ; ++i ) {
ltrace(200) << "Pre-break: "
<< segments[i]->getDirection() << "&" << flags
<< " " << segments[i] << endl;
#if THIS_IS_DISABLED
segments[i]->makeDogLeg( gcell, true );
#endif
}
}
}
Session::revalidate ();
}
* ./katabatic: - New: In AutoSegment, adds a "_parent" attribute to keep track of the fragmentation processus. Currently used only for strap segments, points to the original segment in the appropriate direction (before the split). - New: In GCell & LayerAssign, new method of layer assignment. Move up the whole net trunk if only one of it's segment is inside an over-saturated GCell. AutoSegment are moved up only if there is at least 2 free tracks remaining on the upper level. - Change: In Session::_canonize(), uses the lowest segment Id as canonical. More reliable than geometricals criterions in the end. Assuming that the segments are being created in deterministic order, which *should* be the case consediring the way we are walking through the global routing. - Change: In AutoSegment, completly suppress the CompareCanonical(), replace it by the much simpler CompareId(). - Change: In GCell::rpDesaturate(), stops desaturation when bottom density is under 0.5, otherwise we are causing a severe imbalance in M2/M4 densities. All wires pushed up to M4... - Change: In ChipTools, for the Pad's RoutingPad, reslect the best component using the one in the lowest layer. To avoid problem when splitting AutoContact as we expect the base Contact to be on the lower layer. - Bug: In GCellConfiguration::_GCell_xG_xL1_xL3(), add H/V alignement constraints in fork case. This allow NE/SW contact to be splitted correctly later. - Bug: In AutoContact::split(), the connexity on the splitted contacts was not correctly restored, leading to canonization and parentage looping errors. This was concealed by the Kite Track::_check() bug (incomplete individual TrackSegment checking).
2010-12-30 12:41:19 -06:00
void reselectPadRp ( Cell* cell )
{
AllianceFramework* af = AllianceFramework::get();
forEach ( Net*, inet, cell->getNets() ) {
if ( inet->getType() == Net::Type::GROUND ) continue;
if ( inet->getType() == Net::Type::POWER ) continue;
if ( inet->getType() == Net::Type::CLOCK ) continue;
forEach ( RoutingPad*, irp, inet->getRoutingPads() ) {
Instance* instance = irp->getOccurrence().getPath().getTailInstance();
if ( instance ) {
Cell* masterCell = instance->getMasterCell();
if ( af->isPad(masterCell) )
irp->setOnBestComponent(RoutingPad::LowestLayer);
}
} // RoutingPad*.
} // Net*.
}
} // End of anonymous namespace.
namespace Katabatic {
void KatabaticEngine::slackenBorder ( Box bb, Layer::Mask mask, unsigned int flags )
{
GCell* begin = getGCellGrid()->getGCell ( Point(bb.getXMin(),bb.getYMin()) );
GCell* end = getGCellGrid()->getGCell ( Point(bb.getXMin(),bb.getYMax()) );
breakSegments ( begin, end, mask, flags );
begin = getGCellGrid()->getGCell ( Point(bb.getXMax(),bb.getYMin()) );
end = getGCellGrid()->getGCell ( Point(bb.getXMax(),bb.getYMax()) );
breakSegments ( begin, end, mask, flags );
Session::revalidate ();
}
void KatabaticEngine::slackenBlockIos ( Instance* core )
{
cmess1 << " o Slackening IOs of <" << core->getName() << ">." << endl;
Layer::Mask mask = Session::getRoutingLayer(1)->getMask();
slackenBorder ( core->getBoundingBox().inflate(Session::getSliceHeight())
, mask
, GlobalSegments|Constant::Horizontal
);
}
void KatabaticEngine::chipPrep ()
{
if (isChip()) {
reselectPadRp( getCell() );
//slackenBlockIos( _core );
//cmess1 << " o Slackening Pads-connected segments." << endl;
//slackenBorder( _cell->getBoundingBox().inflate(DbU::lambda(-425.0))
// , Session::getRoutingLayer(3)->getMask()
// , GlobalSegments|LocalSegments|Constant::Horizontal
// );
//slackenBorder( _cell->getBoundingBox().inflate(DbU::lambda(-425.0))
// , Session::getRoutingLayer(1)->getMask()
// , GlobalSegments|Constant::Horizontal
// );
}
}
ChipTools::ChipTools ( Cell* cell )
: _cell (cell)
, _core (NULL)
, _referencePad(NULL)
, _isChip (false)
, _chipBb (cell->getBoundingBox())
, _leftPadsBb ()
, _rightPadsBb ()
, _topPadsBb ()
, _bottomPadsBb()
, _chipCorona ()
{
_isChip = ::isChip( _cell, _core, _referencePad );
if (_isChip) {
// Ugly: hard-coded pads height.
const DbU::Unit padHeight = _referencePad->getAbutmentBox().getHeight();
Box outer = _cell->getBoundingBox().inflate ( -padHeight );
_chipCorona = Torus ( outer, _core->getBoundingBox() );
_leftPadsBb = Box ( _chipBb.getXMin() , _chipBb.getYMin(), _chipCorona.getOuterBox().getXMin(), _chipBb.getYMax() );
_rightPadsBb = Box ( _chipCorona.getOuterBox().getXMax(), _chipBb.getYMin(), _chipBb.getXMax(), _chipBb.getYMax() );
_bottomPadsBb = Box ( _chipBb.getXMin() , _chipBb.getYMin(), _chipBb.getXMax(), _chipCorona.getOuterBox().getYMin() );
_topPadsBb = Box ( _chipBb.getXMin(), _chipCorona.getOuterBox().getYMax(), _chipBb.getXMax(), _chipBb.getYMax() );
cmess1 << " o Design is a complete chip." << endl;
cmess1 << " - Core: <" << _core->getName() << ">/<"
<< _core->getMasterCell()->getName() << ">." << endl;
cmess1 << " - Reference pad: <" << _referencePad->getName() << ">" << endl;
cmess1 << " - Corona: " << _chipCorona << "." << endl;
} else {
_chipCorona = Torus ( _cell->getBoundingBox(), _cell->getBoundingBox() );
}
}
string ChipTools::_getString () const
{
ostringstream s;
s << "<" << _getTypeName() << " " << _cell->getName()
<< " core:" << getString(((_core) ? _core->getName() : "NULL"))
<< ">";
return s.str();
}
Record* ChipTools::_getRecord () const
{
Record* record = new Record ( _getString() );
record->add ( getSlot ( "_cell" , _cell ) );
record->add ( getSlot ( "_core" , _core ) );
record->add ( getSlot ( "_referencePad", _referencePad ) );
record->add ( getSlot ( "_isChip" , &_isChip ) );
record->add ( getSlot ( "_chipBb" , &_chipBb ) );
record->add ( getSlot ( "_leftPadsBb" , &_leftPadsBb ) );
record->add ( getSlot ( "_rightPadsBb" , &_rightPadsBb ) );
record->add ( getSlot ( "_topPadsBb" , &_topPadsBb ) );
record->add ( getSlot ( "_bottomPadsBb", &_bottomPadsBb ) );
record->add ( getSlot ( "_chipCorona" , &_chipCorona ) );
return record;
}
} // End of Katabatic namespace.