# Katabatic Documentation

# Katabatic - Routing Toolbox

List of all members | Static Public Member Functions
Session Class Reference

Modification Session for Katabatic. More...

## Static Public Member Functions

static bool | isInDemoMode ()
static bool | doWarnGCellOverload ()
static Session * | get (const char *message=NULL)
static Technology * | getTechnology ()
static KatabaticEngine * | getKatabatic ()
static const Configuration * | getConfiguration ()
static float | getSaturateRatio ()
static size_t | getSaturateRp ()
static DbU::Unit | getExtensionCap ()
static RoutingGauge * | getRoutingGauge ()
static const Layer * | getRoutingLayer (size_t)
static const Layer * | getContactLayer (size_t)
static size_t | getSegmentStackSize ()
static size_t | getContactStackSize ()
static const vector< AutoSegment * > & | getInvalidateds ()
static const vector< AutoSegment * > & | getRevalidateds ()
static const vector< AutoSegment * > & | getDoglegs ()
static const set< Net * > & | getNetsModificateds ()
static Session * | open (KatabaticEngine *)
static void | close ()
static void | setKatabaticFlags (unsigned int)
static void | dogleg (AutoSegment *)
static void | revalidateTopology ()
static void | setInvalidateMask (unsigned int)
static void | invalidate (Net *)
static void | invalidate (AutoContact *)
static void | invalidate (AutoSegment *)
static size_t | revalidate ()
static void | link (AutoContact *)
static void | link (AutoSegment *)
static void | unlink (AutoContact *)
static void | unlink (AutoSegment *)
static AutoContact * | lookup (Contact *)
static AutoSegment * | lookup (Segment *)

## Detailed Description

Modification Session for Katabatic.

To perform modifications, the Katabatic data structure uses a session mechanism built on top of the Hurricane::UpdateSession one. Sessions obeys very simples rules:

- Only one Session can be opened at a time with Session::open().
- Subsequent calls to Session::open() returns the currently opened session until Session::close() is called.
- Revalidation can take place whithout closing the Session by calling Session::revalidate().

The task of a Session is to keep track of the AutoContact and AutoSegment that have been modificateds (i.e. invalidated) and, to restore connexity and/or topology when closed.

Two kinds of revalidation could be performed:

- Geometrical : only positions of AutoContacts and AutoSegments extensions are recomputed.
- Topological : a whole net have been invalidated because of a dogleg creation or a move up/move down of a segment.
  - Dogleg : needs to insert the newly created AutoSegments and AutoContacts.
  - Move up/Move down : may needs to create additional dogleg to restore connexity (gaps), and then insert them like above.
  After a topological mofication has been done, the net needs to be re-canonized then the geometrical step takes place.

The kind of revalidation needed is automatically detected by the Session.

In addition to it's main purpose, Session also provides cached access to frequently needed variables either from Hurricane or Katabatic Configuration and access to the AutoContact & AutoSegment LUTs of KatabaticEngine.

From a software point of view, Session is a singleton object.

# Session Algorithm

Main attributes of a Session:

- `_netInvalidateds`, nets on which topology has changed.
- `_autoSegments`, that have been moved or createds.
- `_autoContacts`, that have been created or one of their slave segment has moved.
- `_revalidateds`, the list of AutoSegments that have just been revalidated (after calling `revalidate()`).

Schematic description of how a Session works:

- If at least one net has been invalidated, meaning that it's topology has changed, perform `_revalidateTopology()`.

  - Update net topology: correct the topology of each contacts, making dogleg when needed. The AutoContact segment caching is updated at this point.
  - Compute net constraints (on AutoContacts & AutoSegments).
  - Compute net optimal positions (on AutoSegments).
  - Compute the state of the segments regarding to terminals.
  - Canonize sets of aligneds segments. The canonical segment is the one with the lowest `id`.
  - If the segments has just been created, put it on its optimal axis.

  This stage can add itself more invalidated AutoSegments and AutoContacts as it create doglegs.

- Revalidate geometry of AutoContacts. That is, expand or shrink the extremities of the invalidated AutoSegments. Note that AutoSegments are already at on their final axis position.

- Revalidate AutoSegments. Just before this stage, they are on the correct axis and their extensions are also correct, so we may update the caching of their characteristics (mostly the extension).

## Member Function Documentation

## ◆ isInDemoMode()

bool isInDemoMode | ( |  | ) |

static

Katabatic shortcut.

References KatabaticEngine::isInDemoMode().

Referenced by GCell::checkDensity().

## ◆ doWarnGCellOverload()

bool doWarnGCellOverload | ( |  | ) |

static

Katabatic shortcut.

References KatabaticEngine::doWarnOnGCellOverload().

Referenced by GCell::checkDensity().

## ◆ get()

Session * get | ( | const char * | message = `NULL` | ) |

static

Return the Session singleton, if no session is currently open throw an exception carrying `message`.

## ◆ getTechnology()

Technology * getTechnology | ( |  | ) |

inlinestatic

Hurricane shortcut.

## ◆ getKatabatic()

KatabaticEngine * getKatabatic | ( |  | ) |

inlinestatic

Katabatic shortcut.

Referenced by AutoSegment::create(), GCellTopology::doRp_AccessPad(), GCellTopology::doRp_AutoContacts(), AutoSegment::makeDogleg(), and Session::open().

## ◆ getConfiguration()

const Configuration * getConfiguration | ( |  | ) |

inlinestatic

Katabatic shortcut.

Referenced by AutoHorizontal::_makeDogleg(), AutoVertical::_makeDogleg(), and AutoSegment::canMoveUp().

## ◆ getSaturateRatio()

float getSaturateRatio | ( |  | ) |

static

Katabatic shortcut.

References KatabaticEngine::getSaturateRatio().

Referenced by GCell::isSaturated().

## ◆ getSaturateRp()

size_t getSaturateRp | ( |  | ) |

static

Katabatic shortcut.

References KatabaticEngine::getSaturateRp().

Referenced by GCell::rpDesaturate().

## ◆ getExtensionCap()

DbU::Unit getExtensionCap | ( |  | ) |

static

Katabatic shortcut.

Referenced by AutoHorizontal::checkPositions(), AutoVertical::checkPositions(), AutoHorizontal::updatePositions(), and AutoVertical::updatePositions().

## ◆ getRoutingGauge()

RoutingGauge * getRoutingGauge | ( |  | ) |

inlinestatic

Katabatic shortcut.

Referenced by AutoHorizontal::_makeDogleg(), AutoVertical::_makeDogleg(), AutoHorizontal::canMoveULeft(), AutoVertical::canMoveULeft(), AutoSegment::canMoveUp(), AutoHorizontal::canMoveURight(), AutoVertical::canMoveURight(), AutoSegment::canPivotDown(), AutoSegment::canPivotUp(), GCell::checkDensity(), Session::getContactLayer(), Session::getRoutingLayer(), GCell::hasFreeTrack(), AutoSegment::makeDogleg(), anonymous_namespace{LoadGrByNet.cpp}::singleGCell(), GCell::stepDesaturate(), GCell::stepNetDesaturate(), GCell::updateDensity(), AutoContactVTee::updateTopology(), AutoContactTurn::updateTopology(), AutoContactHTee::updateTopology(), and AutoContactTerminal::updateTopology().

## ◆ getRoutingLayer()

const Layer * getRoutingLayer | ( | size_t | depth | ) |

inlinestatic

Katabatic shortcut.

References Session::getRoutingGauge(), and RoutingGauge::getRoutingLayer().

Referenced by GCellTopology::_do_xG_1M1_1M2(), GCellTopology::_do_xG_xM1_xM3(), AutoSegment::create(), GCellTopology::doRp_AccessPad(), AutoSegment::reduceDoglegLayer(), and GCell::rpDesaturate().

## ◆ getContactLayer()

const Layer * getContactLayer | ( | size_t | depth | ) |

inlinestatic

Katabatic shortcut.

References RoutingGauge::getContactLayer(), and Session::getRoutingGauge().

Referenced by GCellTopology::_do_1G_1M3(), GCellTopology::_do_1G_xM1(), GCellTopology::_do_xG(), GCellTopology::_do_xG_1M1_1M2(), GCellTopology::_do_xG_1Pad(), GCellTopology::_do_xG_xM1_xM3(), GCellTopology::_do_xG_xM2(), GCellTopology::_do_xG_xM3(), GCellTopology::doRp_Access(), GCellTopology::doRp_AccessPad(), GCellTopology::doRp_AutoContacts(), GCellTopology::doRp_StairCaseH(), GCellTopology::doRp_StairCaseV(), and anonymous_namespace{LoadGrByNet.cpp}::singleGCell().

## ◆ getSegmentStackSize()

size_t getSegmentStackSize | ( |  | ) |

inlinestatic

Returns: The number of AutoSegment in the invalidated stack.

## ◆ getContactStackSize()

size_t getContactStackSize | ( |  | ) |

inlinestatic

Returns: The number of AutoSegment in the invalidated stack.

## ◆ getInvalidateds()

const vector< AutoSegment * > & getInvalidateds | ( |  | ) |

inlinestatic

Returns: The stack (vector) of invalidateds AutoSegments.

## ◆ getRevalidateds()

const vector< AutoSegment * > & getRevalidateds | ( |  | ) |

inlinestatic

Returns: The stack (vector) of AutoSegments that have been revalidateds.

## ◆ getDoglegs()

const vector< AutoSegment * > & getDoglegs | ( |  | ) |

inlinestatic

Returns: The vector of AutoSegments part of a newly created dogleg. The dogleg creation functions in AutoHorizontal and AutoVertical put a triplet (for example in horizontal direction ``(h1,v1,h2) ) for each dogleg composed of:

- h1 the segment before the dogleg (which is also the original one).
- v1 the segment perpandicular (new).
- h2 the segment after (new).

Referenced by AutoSegment::makeDogleg().

## ◆ getNetsModificateds()

const set< Net * > & getNetsModificateds | ( |  | ) |

inlinestatic

Returns: The set of Nets that needs either a topological update or a new canonization.

## ◆ open()

Session * open | ( | KatabaticEngine * | ktbt | ) |

static

Opens a new session or returns the already opened one, if any.

References Session::getKatabatic().

Referenced by GCellGrid::updateContacts().

## ◆ close()

void close | ( |  | ) |

static

Close the Session, triggering the revalidation of the AutoSegemnts and AutoContacts. If no Session is opened, throws an execption.

Referenced by GCellGrid::updateContacts().

## ◆ setKatabaticFlags()

void setKatabaticFlags | ( | unsigned int | flags | ) |

static

Katabatic shortcut.

References KatabaticEngine::setFlags().

## ◆ dogleg()

void dogleg | ( | AutoSegment * | autoSegment | ) |

inlinestatic

Adds an AutoSegment to the dogleg vector.

Referenced by AutoHorizontal::_makeDogleg(), and AutoVertical::_makeDogleg().

## ◆ revalidateTopology()

void revalidateTopology | ( |  | ) |

inlinestatic

Revalidate Net that have been invalidateds and re-canonize them.

## ◆ setInvalidateMask()

void setInvalidateMask | ( | unsigned int | flags | ) |

inlinestatic

Tells what kind of revalidation must be performed.

## ◆ invalidate() [1/3]

void invalidate | ( | Net * | net | ) |

inlinestatic

Schedule `net` for a full revalidation, topological correction and canonization.

Referenced by AutoSegment::_invalidate(), and AutoSegment::_postCreate().

## ◆ invalidate() [2/3]

void invalidate | ( | AutoContact * | contact | ) |

inlinestatic

Schedule `contact` for revalidation.

## ◆ invalidate() [3/3]

void invalidate | ( | AutoSegment * | segment | ) |

inlinestatic

Schedule `segment` for revalidation.

## ◆ revalidate()

size_t revalidate | ( |  | ) |

inlinestatic

Perform the revalidation. Returns the sum of AutoContacts and AutoSegemnts that have been revalidated.

Referenced by KatabaticEngine::createDetailedGrid().

## ◆ link() [1/2]

void link | ( | AutoContact * | ac | ) |

static

Adds `ac` in the AutoContact lookup table (allow to retrieve an AutoContact by it's base Contact).

Referenced by AutoSegment::_postCreate().

## ◆ link() [2/2]

void link | ( | AutoSegment * | as | ) |

static

Adds `as` in the AutoSegment lookup table (allow to retrieve an AutoSegment by it's base Segment).

## ◆ unlink() [1/2]

void unlink | ( | AutoContact * | ac | ) |

static

Removes `ac` from the AutoContact lookup table.

Referenced by AutoSegment::_preDestroy().

## ◆ unlink() [2/2]

void unlink | ( | AutoSegment * | as | ) |

static

Removes `as` from the AutoSegment lookup table.

## ◆ lookup() [1/2]

AutoContact * lookup | ( | Contact * | contact | ) |

static

Lookup the AutoContact associated with `contact`. `NULL` if not found.

Referenced by AutoSegment::AutoSegment(), GCell::checkEdgeSaturation(), AutoSegment::create(), AutoSegment::getAutoSource(), AutoSegment::getAutoTarget(), AutoSegment::getOppositeAnchor(), and AutoSegment::getPerpandicularsBound().

## ◆ lookup() [2/2]

AutoSegment * lookup | ( | Segment * | segment | ) |

static

Lookup the AutoSegment associated with `segment`. `NULL` if not found.

The documentation for this class was generated from the following files:

- Session.h
- Session.cpp
- Session.dox