Skip to content

Commit

Permalink
Merge pull request The-OpenROAD-Project#4523 from gudeh/rudySupplyNetFix
Browse files Browse the repository at this point in the history
Rudy supply net fix
  • Loading branch information
eder-matheus authored Jan 12, 2024
2 parents 9c2fe56 + a106ada commit a54d477
Show file tree
Hide file tree
Showing 8 changed files with 197 additions and 154 deletions.
6 changes: 2 additions & 4 deletions src/grt/src/GlobalRouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2426,8 +2426,7 @@ void GlobalRouter::initGrid(int max_layer)
odb::dbTechLayer* tech_layer = routing_layers_[layer_for_guide_dimension_];
odb::dbTrackGrid* track_grid = block_->findTrackGrid(tech_layer);
int track_spacing, track_init, num_tracks;
tech_layer->getAverageTrackSpacing(
track_grid, track_spacing, track_init, num_tracks);
track_grid->getAverageTrackSpacing(track_spacing, track_init, num_tracks);

odb::Rect rect = block_->getDieArea();

Expand Down Expand Up @@ -2599,8 +2598,7 @@ void GlobalRouter::initRoutingTracks(int max_routing_layer)
}

int track_step, track_init, num_tracks;
tech_layer->getAverageTrackSpacing(
track_grid, track_step, track_init, num_tracks);
track_grid->getAverageTrackSpacing(track_step, track_init, num_tracks);

RoutingTracks layer_tracks = RoutingTracks(level,
track_step,
Expand Down
17 changes: 8 additions & 9 deletions src/odb/include/odb/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -3917,6 +3917,14 @@ class dbTrackGrid : public dbObject
///
static dbTrackGrid* create(dbBlock* block, dbTechLayer* layer);

///
/// Get the spacing between tracks for this grid.
/// If the layer has a multi pattern spacing, returns the average.
///
void getAverageTrackSpacing(int& track_step,
int& track_init,
int& num_tracks);

///
/// Translate a database-id back to a pointer.
///
Expand Down Expand Up @@ -7824,15 +7832,6 @@ class dbTechLayer : public dbObject
///
int getSpacing(int width, int length = 0);

///
/// Get the spacing between tracks for this layer.
/// If the layer has a multi pattern spacing returns the average.
///
void getAverageTrackSpacing(odb::dbTrackGrid* track_grid,
int& track_step,
int& track_init,
int& num_tracks);

///
/// The number of masks for this layer (aka double/triple patterning).
/// Allowable values are in [1, 3].
Expand Down
7 changes: 7 additions & 0 deletions src/odb/include/odb/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,13 @@ class RUDYCalculator
void makeGrid();
Tile& getEditableTile(int x, int y) { return grid_.at(x).at(y); }
void processMacroObstruction(odb::dbMaster* macro, odb::dbInst* instance);
void processIntersectionGenericObstruction(odb::Rect obstruction_rect,
int tile_width,
int tile_height,
int nets_per_tile);
void processIntersectionSignalNet(odb::Rect net_rect,
int tile_width,
int tile_height);

dbBlock* block_;
odb::Rect gridBlock_;
Expand Down
52 changes: 0 additions & 52 deletions src/odb/src/db/dbTechLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1055,23 +1055,6 @@ uint _dbTechLayer::getTwIdx(const int width, const int prl) const
}
return 0;
}
void _dbTechLayer::getAverageTrackPattern(dbTrackGrid* grid,
bool is_x,
int& track_init,
int& num_tracks,
int& track_step)
{
std::vector<int> coordinates;
if (is_x) {
grid->getGridX(coordinates);
} else {
grid->getGridY(coordinates);
}
const int span = coordinates.back() - coordinates.front();
track_init = coordinates.front();
track_step = std::ceil((float) span / coordinates.size());
num_tracks = coordinates.size();
}
// User Code End PrivateMethods

////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1424,41 +1407,6 @@ void dbTechLayer::setSpacing(int spacing)
layer->_spacing = spacing;
}

void dbTechLayer::getAverageTrackSpacing(odb::dbTrackGrid* track_grid,
int& track_step,
int& track_init,
int& num_tracks)
{
if (getDirection() == odb::dbTechLayerDir::HORIZONTAL) {
if (track_grid->getNumGridPatternsY() == 1) {
track_grid->getGridPatternY(0, track_init, num_tracks, track_step);
} else if (track_grid->getNumGridPatternsY() > 1) {
_dbTechLayer* layer = (_dbTechLayer*) this;
layer->getAverageTrackPattern(
track_grid, false, track_init, num_tracks, track_step);
} else {
getImpl()->getLogger()->error(utl::ODB,
414,
"Horizontal tracks for layer {} not found.",
getName());
}
} else if (getDirection() == odb::dbTechLayerDir::VERTICAL) {
if (track_grid->getNumGridPatternsX() == 1) {
track_grid->getGridPatternX(0, track_init, num_tracks, track_step);
} else if (track_grid->getNumGridPatternsX() > 1) {
_dbTechLayer* layer = (_dbTechLayer*) this;
layer->getAverageTrackPattern(
track_grid, true, track_init, num_tracks, track_step);
} else {
getImpl()->getLogger()->error(
utl::ODB, 415, "Vertical tracks for layer {} not found.", getName());
}
} else {
getImpl()->getLogger()->error(
utl::ODB, 416, "Layer {} has invalid direction.", getName());
}
}

double dbTechLayer::getEdgeCapacitance()
{
_dbTechLayer* layer = (_dbTechLayer*) this;
Expand Down
5 changes: 0 additions & 5 deletions src/odb/src/db/dbTechLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,6 @@ class _dbTechLayer : public _dbObject
uint getV55RowIdx(const int& rowVal) const;
uint getV55ColIdx(const int& colVal) const;
uint getTwIdx(const int width, const int prl) const;
void getAverageTrackPattern(dbTrackGrid* grid,
bool is_x,
int& track_init,
int& num_tracks,
int& track_step);
// User Code End Methods

dbTechLayerFlags flags_;
Expand Down
61 changes: 61 additions & 0 deletions src/odb/src/db/dbTrackGrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,47 @@ void dbTrackGrid::getGridPatternY(int i,
step = grid->_y_step[i];
}

void dbTrackGrid::getAverageTrackSpacing(int& track_step,
int& track_init,
int& num_tracks)
{
auto layer = getTechLayer();
if (layer == nullptr) {
getImpl()->getLogger()->error(utl::ODB, 418, "Layer is empty.");
return;
}
if (layer->getDirection() == odb::dbTechLayerDir::HORIZONTAL) {
if (getNumGridPatternsY() == 1) {
getGridPatternY(0, track_init, num_tracks, track_step);
} else if (getNumGridPatternsY() > 1) {
_dbTrackGrid* track_grid = (_dbTrackGrid*) this;
track_grid->getAverageTrackPattern(
false, track_init, num_tracks, track_step);
} else {
getImpl()->getLogger()->error(utl::ODB,
414,
"Horizontal tracks for layer {} not found.",
layer->getName());
}
} else if (layer->getDirection() == odb::dbTechLayerDir::VERTICAL) {
if (getNumGridPatternsX() == 1) {
getGridPatternX(0, track_init, num_tracks, track_step);
} else if (getNumGridPatternsX() > 1) {
_dbTrackGrid* track_grid = (_dbTrackGrid*) this;
track_grid->getAverageTrackPattern(
true, track_init, num_tracks, track_step);
} else {
getImpl()->getLogger()->error(utl::ODB,
415,
"Vertical tracks for layer {} not found.",
layer->getName());
}
} else {
getImpl()->getLogger()->error(
utl::ODB, 416, "Layer {} has invalid direction.", layer->getName());
}
}

dbTrackGrid* dbTrackGrid::create(dbBlock* block_, dbTechLayer* layer_)
{
_dbBlock* block = (_dbBlock*) block_;
Expand All @@ -271,4 +312,24 @@ void dbTrackGrid::destroy(dbTrackGrid* grid_)
block->_track_grid_tbl->destroy(grid);
}

// User Code Begin PrivateMethods
void _dbTrackGrid::getAverageTrackPattern(bool is_x,
int& track_init,
int& num_tracks,
int& track_step)
{
std::vector<int> coordinates;
dbTrackGrid* track_grid = (dbTrackGrid*) this;
if (is_x) {
track_grid->getGridX(coordinates);
} else {
track_grid->getGridY(coordinates);
}
const int span = coordinates.back() - coordinates.front();
track_init = coordinates.front();
track_step = std::ceil((float) span / coordinates.size());
num_tracks = coordinates.size();
}
// User Code End PrivateMethods

} // namespace odb
7 changes: 7 additions & 0 deletions src/odb/src/db/dbTrackGrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ class _dbTrackGrid : public _dbObject
const char* field,
const _dbTrackGrid& rhs) const;
void out(dbDiff& diff, char side, const char* field) const;

// User Code Begin Methods
void getAverageTrackPattern(bool is_x,
int& track_init,
int& num_tracks,
int& track_step);
// User Code End Methods
};

inline _dbTrackGrid::_dbTrackGrid(_dbDatabase*, const _dbTrackGrid& g)
Expand Down
Loading

0 comments on commit a54d477

Please sign in to comment.