Skip to content

Commit 58b735b

Browse files
committed
grt/cugr: tidy via-demand comments and fix stale wording
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
1 parent 835ac63 commit 58b735b

4 files changed

Lines changed: 14 additions & 32 deletions

File tree

src/grt/src/cugr/src/Design.cpp

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -355,12 +355,8 @@ void Design::setUnitCosts()
355355
odb::dbTechVia* Design::chooseViaForPair(odb::dbTechLayer* lower_tl,
356356
odb::dbTechLayer* upper_tl) const
357357
{
358-
// Select the via whose footprint best approximates what drt will place.
359-
// odb::dbBlock::getDefaultVias fabricates a default from the first via in db
360-
// order when no OR_DEFAULT is set, which is arbitrary; instead rank all vias
361-
// connecting the pair. drt's initDefaultVias always takes the single-cut
362-
// group first, so order by: OR_DEFAULT, then fewest cuts, then the
363-
// LEF-default flag, then the smallest metal enclosure.
358+
// Rank vias connecting the pair by a drt-like priority: OR_DEFAULT, then
359+
// fewest cuts, then LEF-default, then smallest enclosure.
364360
odb::dbTechLayer* cut_tl = lower_tl->getUpperLayer();
365361
odb::dbTechVia* best = nullptr;
366362
std::tuple<bool, int, bool, int64_t> best_key;
@@ -393,8 +389,7 @@ odb::dbTechVia* Design::chooseViaForPair(odb::dbTechLayer* lower_tl,
393389
void Design::computeViaDemandLengths()
394390
{
395391
const int num_layers = getNumLayers();
396-
// Legacy proxy: min-area stub length inflated by the flat via_multiplier.
397-
// Used as the fallback when the tech has no default via for a layer pair.
392+
// Fallback proxy (min-area stub x via_multiplier) for pairs with no via.
398393
via_demand_length_lower_.assign(num_layers, 0.0);
399394
via_demand_length_upper_.assign(num_layers, 0.0);
400395

@@ -412,8 +407,7 @@ void Design::computeViaDemandLengths()
412407

413408
double num_lower = lower.getMinLength() * constants_.via_multiplier;
414409
double num_upper = upper.getMinLength() * constants_.via_multiplier;
415-
// Union all boxes on each routing layer: a via may have several rects on a
416-
// layer, and the footprint is their combined extent, not the last one.
410+
// Union the boxes on each layer; a via may have several rects per layer.
417411
odb::Rect lo_box, up_box;
418412
lo_box.mergeInit();
419413
up_box.mergeInit();
@@ -436,8 +430,7 @@ void Design::computeViaDemandLengths()
436430
via_demand_length_upper_[i] = num_upper;
437431

438432
if (debug) {
439-
// Enclosure sizes are the via pad extents (x*y DBU); demand is the
440-
// per-via fraction of one track for a uniform gcell.
433+
// Report enclosures, lengths, and per-track demand for each pair.
441434
const int gcell = default_gridline_spacing_;
442435
const std::string via_src
443436
= via != nullptr ? via->getName() : std::string("min_area-fallback");
@@ -475,15 +468,13 @@ double Design::viaDemandLength(const MetalLayer& layer,
475468
const int dy) const
476469
{
477470
const int pitch = layer.getPitch();
478-
// getSpacing() is 0 on techs that give spacing only via a parallel table;
479-
// fall back to the table-derived default so the spacing term is not lost.
471+
// getSpacing() is 0 on parallel-table-only techs; use default spacing then.
480472
const int spacing
481473
= layer.getSpacing() > 0 ? layer.getSpacing() : layer.getDefaultSpacing();
482474
// Split the pad into extent along the routing direction and across tracks.
483475
const int along = (layer.getDirection() == MetalLayer::H) ? dx : dy;
484476
const int perp = (layer.getDirection() == MetalLayer::H) ? dy : dx;
485-
// A via blocks whole tracks perpendicular to the routing direction; round the
486-
// keep-out (via metal + spacing on both sides) up to an integer track count.
477+
// A via blocks whole tracks; ceil the keep-out to an integer track count.
487478
const double tracks_blocked
488479
= pitch > 0 ? std::ceil(static_cast<double>(perp + 2 * spacing) / pitch)
489480
: 1.0;

src/grt/src/cugr/src/Design.h

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ class Design
5858
{
5959
return layers_[layer_index];
6060
}
61-
// Effective via demand length (enclosure_along * tracks_blocked) for the via
62-
// between routing layers i and i+1, charged to the lower/upper layer.
61+
// Effective via demand length charged to the lower / upper layer of via i.
6362
double getViaDemandLengthLower(int i) const
6463
{
6564
return via_demand_length_lower_[i];
@@ -97,15 +96,12 @@ class Design
9796
void readDesignObstructions();
9897
void computeGrid();
9998
void setUnitCosts();
100-
// Fill via_demand_length_{lower,upper}_ from the tech's default vias.
99+
// Fill via_demand_length_{lower,upper}_ from each pair's via geometry.
101100
void computeViaDemandLengths();
102-
// Pick the via connecting two routing layers, ranked to approximate drt:
103-
// OR_DEFAULT, then fewest cuts, then LEF-default, then smallest enclosure.
101+
// Pick the via for a layer pair, ranked to approximate drt's choice.
104102
odb::dbTechVia* chooseViaForPair(odb::dbTechLayer* lower_tl,
105103
odb::dbTechLayer* upper_tl) const;
106-
// Effective demand length of a via pad on one layer: its enclosure extent
107-
// along the routing direction scaled by the number of tracks it blocks
108-
// across.
104+
// Via pad demand length: extent along routing dir x tracks blocked across.
109105
double viaDemandLength(const MetalLayer& layer, int dx, int dy) const;
110106

111107
// debug functions
@@ -115,9 +111,7 @@ class Design
115111
int lib_dbu_;
116112
BoxT die_region_;
117113
std::vector<MetalLayer> layers_;
118-
// Indexed by the via's lower routing-layer; lower_ is charged to layer i,
119-
// upper_ to layer i+1. Falls back to min_length * via_multiplier when the
120-
// tech exposes no default via for the pair.
114+
// Effective via demand length per lower layer i (lower_ = i, upper_ = i+1).
121115
std::vector<double> via_demand_length_lower_;
122116
std::vector<double> via_demand_length_upper_;
123117
std::vector<CUGRNet> nets_;

src/grt/src/cugr/src/GridGraph.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,7 @@ CapacityT GridGraph::viaDemand(const int layer_index,
297297
const int l,
298298
const int edge_sum) const
299299
{
300-
// Design digested the via geometry into an effective length per layer role;
301-
// spread it over the two flanking edges (lower role for the via's lower
302-
// layer, upper role for the upper layer).
300+
// Spread the layer's precomputed via demand length over its two edges.
303301
const double via_num = (l == layer_index)
304302
? design_->getViaDemandLengthLower(layer_index)
305303
: design_->getViaDemandLengthUpper(layer_index);

src/grt/src/cugr/src/GridGraph.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,7 @@ class GridGraph
354354
void commitTree(const std::shared_ptr<GRTreeNode>& tree,
355355
bool rip_up = false,
356356
const std::vector<double>& net_costs = {});
357-
// Per-via demand on layer `l` (lower or upper role) of the via at
358-
// `layer_index`, spread over its two flanking edges (`edge_sum`).
357+
// Per-via demand on layer `l` of via `layer_index`, spread over `edge_sum`.
359358
CapacityT viaDemand(int layer_index, int l, int edge_sum) const;
360359

361360
utl::Logger* logger_;

0 commit comments

Comments
 (0)