2010-03-09 09:24:29 -06:00
|
|
|
|
|
|
|
// -*- C++ -*-
|
|
|
|
|
|
|
|
namespace Katabatic {
|
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
/*! \class KatabaticEngine
|
|
|
|
*
|
|
|
|
* \brief The Katabatic Tool
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* \section secEngineStates States of KatabaticEngine
|
|
|
|
*
|
|
|
|
* During it's lifecycle, the engine go through a serie of states.
|
|
|
|
* It only can go forward between states.
|
|
|
|
* - \b EngineCreation : just after C++ object creation until
|
|
|
|
* the global routing is loaded.
|
|
|
|
* - \b EngineGlobalLoaded : \e after the global routing has
|
|
|
|
* been done. This state must be set by an external tool,
|
|
|
|
* Katabatic cannot know by itself when the global routing
|
|
|
|
* has been done (see Kite).
|
|
|
|
* - \b EngineActive : \e after the global routing has been
|
|
|
|
* converted into the Katabatic data structure. At this point
|
|
|
|
* the tool is ready to run.
|
|
|
|
* - \b EngineDriving : \e during the stage of stripping all
|
|
|
|
* the decorations the tool has added over the Hurricane data
|
|
|
|
* structure (mostly: AutoContact & AutoSegment).
|
|
|
|
* - \b EngineGutted : \e after the tool decorations have been
|
|
|
|
* removed. The tool is now useless and can only be destroyed.
|
|
|
|
* - \b EnginePreDestroying : this special state is reached when
|
|
|
|
* going straight from EngineActive to the destructor, that is,
|
|
|
|
* skipping the EngineDriving state. That means we <em>do not</em>
|
|
|
|
* want to save whatever routing has been done. In that case,
|
|
|
|
* not only the tool decorations are destroyeds, but also the
|
|
|
|
* Hurricane data-structures they relies on (Contact, Segments).
|
|
|
|
*
|
2010-03-09 09:24:29 -06:00
|
|
|
*
|
2013-12-03 18:58:58 -06:00
|
|
|
* \section secEngineImpl KatabaticEngine Implementation Details
|
2010-03-09 09:24:29 -06:00
|
|
|
*
|
2013-12-03 18:58:58 -06:00
|
|
|
* Due to the size of the code and the fact that the main body
|
|
|
|
* of some methods do not need to be present in the class,
|
|
|
|
* the implementation of KatabaticEngine is split in several
|
|
|
|
* files. The list below summarize them:
|
|
|
|
* - \c KatabaticEngine.cpp : the core of the class, methods that really
|
|
|
|
* need their bodies here.
|
|
|
|
* - \c PowerRails.cpp : utilities to construct an abstract from all
|
|
|
|
* the power rails through the hierarchy.
|
|
|
|
* - \c LayerAssign.cpp : layer assignement related methods and helpers.
|
|
|
|
* - \c LoadGrByNet.cpp : global routing loader, transform global routing
|
|
|
|
* into Katabatic data-structure.
|
|
|
|
* - \c NetConstraints.cpp : compute the topological constraints of all
|
|
|
|
* AutoSegment/AutoContact of a Net.
|
|
|
|
* - \c NetOptimals.cpp : compute the optimal positions of all AutoSegment
|
|
|
|
* of a Net.
|
2010-03-09 09:24:29 -06:00
|
|
|
*/
|
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \enum EngineState
|
|
|
|
//! Describe the current state of the KatabaticEngine.
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \var EngineCreation
|
|
|
|
//! The tool is created, but still in the \c _postCreate stage.
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \var EngineGlobalLoaded
|
|
|
|
//! The global routing has been loaded from Knik.
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \var EngineActive
|
|
|
|
//! The Engine is in normal running mode (routing ordinary wires).
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \var EngineDriving
|
|
|
|
//! The Engine is transforming the AutoContact/AutoSegment into
|
|
|
|
//! normal Contact/Segment (prior to tool deletion).
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \var EnginePreDestroying
|
|
|
|
//! This state is used whenever the tool is destroyed without passing
|
|
|
|
//! through the EngineDriving state.
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \var EngineGutted
|
|
|
|
//! After the EngineDriving state, all the working structures are
|
|
|
|
//! removed and the tool can no longer be used. It only awaits clean
|
|
|
|
//! destruction.
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \typedef set<Net*, NetCompareByName> KatabaticEngine::NetSet;
|
|
|
|
//! Set of Net to be routed, alphabetically sorteds.
|
2010-03-09 09:24:29 -06:00
|
|
|
|
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \function KatabaticEngine* KatabaticEngine::create ( Cell* cell );
|
|
|
|
//! Create a KatabaticEngine on \c cell.
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \function const Name& KatabaticEngine::staticGetName ();
|
|
|
|
//! \sreturn The unique string identifier for the KatabaticEngine class of ToolEngine.
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \function bool KatabaticEngine::isGMetal ( const Layer* layer ) const;
|
|
|
|
//! \sreturn \true if \c layer is one of the special (fake) metals used to build
|
|
|
|
//! the global routing.
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \function bool KatabaticEngine::isChip () const;
|
|
|
|
//! \sreturn \true if the hierarchy top-level of the Cell matches the one of a complete
|
|
|
|
//! design (i.e. pads and one core instance).
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \function bool KatabaticEngine::isInDemoMode () const;
|
|
|
|
//! \sreturn \true if the tool is in demo mode, that is suppress almost all warning
|
|
|
|
//! and debug messages.
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \function bool KatabaticEngine::doWarnOnGCellOverload () const;
|
|
|
|
//! \sreturn \true if the tool should issue a warning when a GCell is overloaded
|
|
|
|
//! (overload could be transient).
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \function bool KatabaticEngine::doDestroyBaseContact () const;
|
|
|
|
//! \sreturn \true if the EngineDestroyBaseContact is set, meaning that when an
|
|
|
|
//! AutoContact is destroyed, the Contact it decorates is destroyed
|
|
|
|
//! altogether.
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \function bool KatabaticEngine::doDestroyBaseSegment () const;
|
|
|
|
//! \sreturn \true if the EngineDestroyBaseSegment is set, meaning that when an
|
|
|
|
//! AutoSegment is destroyed, the Segment it decorates is destroyed
|
|
|
|
//! altogether.
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \function bool KatabaticEngine::doDestroyTool () const;
|
|
|
|
//! \sreturn \true if the tool state is beyond EngineStateGutted, that is, only
|
|
|
|
//! waits for \c destroy() to be called.
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \function const Name& KatabaticEngine::getName () const;
|
|
|
|
//! \sreturn The unique string identifier for the KatabaticEngine class of ToolEngine.
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \function EngineState KatabaticEngine::getState () const;
|
|
|
|
//! \sreturn The state the tool is currently in.
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \function unsigned int KatabaticEngine::getFlags ( unsigned int mask ) const;
|
|
|
|
//! \sreturn The \e anded combination of the tool flags and \c mask.
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \function Configuration* KatabaticEngine::getKatabaticConfiguration ();
|
|
|
|
//! \sreturn The Configuration of Katabatic. In this class it is redundant with
|
|
|
|
//! getConfiguration(), but may be useful in derived classes.
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \function Configuration* KatabaticEngine::getConfiguration ();
|
|
|
|
//! \sreturn The Configuration of the current ToolEngine.
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \function RoutingGauge* KatabaticEngine::getRoutingGauge () const;
|
|
|
|
//! \sreturn The RoutingGauge (Configuration shortcut).
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \function RoutingLayerGauge* KatabaticEngine::getLayerGauge ( size_t depth ) const;
|
|
|
|
//! \sreturn The RoutingLayerGauge associated to \c depth (Configuration shortcut).
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \function const Layer* KatabaticEngine::getRoutingLayer ( size_t depth ) const;
|
|
|
|
//! \sreturn The routing Layer associated to \c depth (Configuration shortcut).
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \function Layer* KatabaticEngine::getContactLayer ( size_t depth ) const;
|
|
|
|
//! \sreturn The contact Layer associated to \c depth (Configuration shortcut).
|
|
|
|
|
|
|
|
//! \function DbU::Unit KatabaticEngine::getGlobalThreshold () const;
|
|
|
|
//! \sreturn The length above which a global wire is moved up in the layer assignment
|
|
|
|
//! stage (Configuration shortcut).
|
|
|
|
|
|
|
|
//! \function float KatabaticEngine::getSaturateRatio () const;
|
|
|
|
//! \sreturn The ratio above which a GCell is considered to be saturated
|
|
|
|
//! (Configuration shortcut).
|
|
|
|
|
|
|
|
//! \function DbU::Unit KatabaticEngine::getExtensionCap () const;
|
|
|
|
//! \sreturn The wires extension cap, same for all layers for the time beeing
|
|
|
|
//! (Configuration shortcut).
|
2010-03-09 09:24:29 -06:00
|
|
|
|
2013-12-03 18:58:58 -06:00
|
|
|
//! \function size_t KatabaticEngine::getSaturateRp () const;
|
|
|
|
//! \sreturn The number of RoutingPad above which a GCell is saturated, causing
|
|
|
|
//! extras global segments to be moved up.
|
|
|
|
//! (Configuration shortcut).
|
|
|
|
|
|
|
|
//! \function GCellGrid* KatabaticEngine::getGCellGrid () const;
|
|
|
|
//! \sreturn The GCellGrid.
|
|
|
|
|
|
|
|
//! \function const NetSet& KatabaticEngine::getRoutingNets () const;
|
|
|
|
//! \sreturn The set of nets to be routeds.
|
|
|
|
|
|
|
|
//! \function const ChipTools& KatabaticEngine::getChipTools () const;
|
|
|
|
//! \sreturn The chip tools (for whole designs).
|
|
|
|
|
|
|
|
//! \function void KatabaticEngine::xmlWriteGCellGrid ( ostream& );
|
|
|
|
//! Write in a stream all informations on the GCells in XML format.
|
|
|
|
|
|
|
|
//! \function void KatabaticEngine::xmlWriteGCellGrid ( const string& );
|
|
|
|
//! Write in a file all informations on the GCells in XML format.
|
|
|
|
|
|
|
|
//! \function void KatabaticEngine::setState ( EngineState state );
|
|
|
|
//! Force the state of the tool. Must be used with caution, as no sanity
|
|
|
|
//! checks are performeds. This method is normally invoked from inside
|
|
|
|
//! the KatabaticEngine various methods.
|
|
|
|
|
|
|
|
//! \function void KatabaticEngine::setFlags ( unsigned int flags );
|
|
|
|
//! Set the flags given in \c flags.
|
|
|
|
|
|
|
|
//! \function void KatabaticEngine::unsetFlags ( unsigned int flags );
|
|
|
|
//! Reset the flags given in \c flags.
|
|
|
|
|
|
|
|
//! \function void KatabaticEngine::setGlobalThreshold ( DbU::Unit );
|
|
|
|
//! (Configuration shortcut).
|
|
|
|
|
|
|
|
//! \function void KatabaticEngine::setSaturateRatio ( float );
|
|
|
|
//! (Configuration shortcut).
|
|
|
|
|
|
|
|
//! \function void KatabaticEngine::setSaturateRp ( size_t );
|
|
|
|
//! (Configuration shortcut).
|
|
|
|
|
|
|
|
//! \function void KatabaticEngine::startMeasures ();
|
|
|
|
//! Starts memory consuption & time measurements.
|
|
|
|
|
|
|
|
//! \function void KatabaticEngine::stopMeasures ();
|
|
|
|
//! Stops memory consuption & time measurements. Recorded measures are
|
|
|
|
//! kept until the next call to Katabatic::startMeasures().
|
|
|
|
|
|
|
|
//! \function void KatabaticEngine::printMeasures ( const string& tag ) const;
|
|
|
|
//! Print memory & time measurement on ``cmess1``. If \c tag is not empty,
|
|
|
|
//! also adds the measurement to the internal table (with \c tag as label).
|
|
|
|
|
|
|
|
//! \function void KatabaticEngine::refresh ( unsigned int flags=KbOpenSession );
|
|
|
|
//! In case the tool is associated with a graphic display, trigger
|
|
|
|
//! a full redraw of the Cell. Slow the router but allow to see work
|
|
|
|
//! in progress... If \c flags <em>do not</em> contains \c KbOpenSession
|
|
|
|
//! the refresh operation will not be enclosed inside it's own session.
|
|
|
|
//! This assumes that a session is already opened.
|
|
|
|
|
|
|
|
//! \function void KatabaticEngine::makePowerRails ();
|
|
|
|
//! Detect all the aligned segments of same width that compose power
|
|
|
|
//! rails, unificate them and copy them at the design top level.
|
|
|
|
|
|
|
|
//! \function void KatabaticEngine::createDetailedGrid ();
|
|
|
|
//! Allocate the GCellGrid.
|
|
|
|
|
|
|
|
//! \function void KatabaticEngine::loadGlobalRouting ( unsigned int method, NetSet& nets );
|
|
|
|
//! \param method the loading algorithm
|
|
|
|
//! \param nets the set of nets to route.
|
|
|
|
//!
|
|
|
|
//! Convert the global routing into the initial detailed routing. For the
|
|
|
|
//! time beeing, only one loading algorithm is available: <em>net by net</em>
|
|
|
|
//! (EngineLoadGrByNet). Only Net given in \c nets are routeds. If \c nets is empty
|
|
|
|
//! then all ordinary nets are routeds. In either cases the set of nets to route
|
|
|
|
//! is pruned from any power, ground or clock signals.
|
|
|
|
//!
|
|
|
|
//! \remark The tool state must be \b EngineGlobalLoaded \e before calling this method
|
|
|
|
//! and will be set to \b EngineActive on exit.
|
|
|
|
|
|
|
|
//! \function void KatabaticEngine::layerAssign ( unsigned int method );
|
|
|
|
//! Perform the layer assignment. The global routing loading stage uses only
|
|
|
|
//! the two bottom most layers, this method spread them on all the availables
|
|
|
|
//! routing layers, according to GCell and RoutingPad density criterions.
|
|
|
|
//!
|
|
|
|
//! Two algorithms are availables:
|
|
|
|
//! - \b EngineLayerAssignByLength : the global wires are moved up one by
|
|
|
|
//! one.
|
|
|
|
//! - \b EngineLayerAssignByTrunk : if one global wire of a net is to be
|
|
|
|
//! moved up, then all the global trunk of the net is moved along.
|
|
|
|
//! This methods gives the best results for now.
|
|
|
|
|
|
|
|
//! \function void KatabaticEngine::finalizeLayout ();
|
|
|
|
//! Transform the Katabatic wires into the Hurricane data-structure.
|
|
|
|
//! Mostly by removing the AutoSegment/AutoContact \e without removing
|
|
|
|
//! their Hurricane conterparts. May also fill gaps that may have appeared.
|
|
|
|
//!
|
|
|
|
//! \remark The tool state must be \b EngineActive \e before calling this method
|
|
|
|
//! and will be set to \b EngineGutted on exit.
|
|
|
|
|
|
|
|
//! \function void KatabaticEngine::slackenBorder ( Box bb, Layer::Mask mask, unsigned int flags );
|
|
|
|
//! \param bb The bounding box, defines the edges.
|
|
|
|
//! \param mask Consider only layers that are fully included in that mask.
|
|
|
|
//! \param flags Consider only segment in that direction.
|
|
|
|
//!
|
|
|
|
//! Perform a preventive break on all global segments going through the
|
|
|
|
//! \e vertical left and right edges of the \c bb box. The set of global
|
|
|
|
//! segments to be broken could be further restricted using \c mask and
|
|
|
|
//! \c flags.
|
|
|
|
//!
|
|
|
|
//! <span class="red">The Semantic of \c flags is not clear, must review the
|
|
|
|
//! code more closely.</span>
|
|
|
|
|
|
|
|
//! \function void KatabaticEngine::slackenBlockIos ( Instance* core );
|
|
|
|
//! Perform a preventive break on horizontal segments in the GCell immediatly
|
|
|
|
//! \e outside the instance \c core area in the routing layer of index \c 1.
|
|
|
|
//!
|
|
|
|
//! \red{This method is too much hardwired to the \c SxLib gauge. It's effect is to break all \b METAL2 outside the core (in a chip).}
|
|
|
|
|
|
|
|
//! \function bool KatabaticEngine::moveUpNetTrunk ( AutoSegment* seed, set<Net*>& globalNets, GCell::SetIndex& invalidateds );
|
|
|
|
//! \param seed The AutoSegment to take the net from.
|
|
|
|
//! \param globalNets The set of nets that has been moved up.
|
|
|
|
//! \param invalidateds The set of GCells that have been invalidated.
|
|
|
|
//! \sreturn \true if the net trunk have been moved up.
|
|
|
|
//!
|
|
|
|
//! Try to move up a whole net trunk. The net is supplied through the \c seed
|
|
|
|
//! argument (the segment that triggers the move). If the net is actually moved
|
|
|
|
//! up, it is added to \c globalNets and all GCells that have been invalidateds
|
|
|
|
//! are added to \c invalidateds.
|
|
|
|
//!
|
|
|
|
//! <span class="red">An individual AutoSegment of the net is moved up if it's length
|
|
|
|
//! is greater that \c 150 lambdas, that is, three times the side of a GCell. This is
|
|
|
|
//! hard-wired and should be parametrized in the future.</span>
|
|
|
|
|
|
|
|
//! \function void KatabaticEngine::computeNetConstraints ( Net* net );
|
|
|
|
//! Compute the box constraints on AutoContacts (and therefore those applied to
|
|
|
|
//! AutoSegments). Constraints comes from AutoContacts anchoreds on RoutingPads
|
|
|
|
//! and transmitted through AutoContactHTee or AutoContactVTee. Constraints are
|
|
|
|
//! applied to all AutoContacts of an aligned set.
|
|
|
|
//!
|
|
|
|
//! \remark The \c net must have been canonized before this function to be called.
|
|
|
|
|
|
|
|
//! \function void KatabaticEngine::toOptimals ( Net* net );
|
|
|
|
//! Move all AutoSegment of \c net so that their axis are inside their
|
|
|
|
//! optimals interval. If a AutoSegment is already inside the interval is
|
|
|
|
//! not moved, otherwise it is put on the nearest bound of the optimal
|
|
|
|
//! interval.
|
2010-03-09 09:24:29 -06:00
|
|
|
|
|
|
|
}
|