Skip to content

Commit

Permalink
Folded in latest master. Signed-off-by: Andy Fox. [email protected]
Browse files Browse the repository at this point in the history
Signed-off-by: andyfox-rushc <[email protected]>
  • Loading branch information
andyfox-rushc committed Aug 3, 2024
2 parents d3af1b9 + 57c59a6 commit 8fe0461
Show file tree
Hide file tree
Showing 24 changed files with 1,500 additions and 301 deletions.
27 changes: 17 additions & 10 deletions src/grt/src/GlobalRouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1206,14 +1206,14 @@ void GlobalRouter::computeGridAdjustments(int min_routing_layer,

if (!grid_->isPerfectRegularX()) {
fastroute_->setLastColVCapacity(new_v_capacity, level - 1);
for (int i = 1; i < y_grids; i++) {
for (int i = 1; i < y_grids + 1; i++) {
fastroute_->addAdjustment(
x_grids - 1, i - 1, x_grids - 1, i, level, new_v_capacity, false);
}
}
if (!grid_->isPerfectRegularY()) {
fastroute_->setLastRowHCapacity(new_h_capacity, level - 1);
for (int i = 1; i < x_grids; i++) {
for (int i = 1; i < x_grids + 1; i++) {
fastroute_->addAdjustment(
i - 1, y_grids - 1, i, y_grids - 1, level, new_h_capacity, false);
}
Expand Down Expand Up @@ -1935,16 +1935,23 @@ void GlobalRouter::updateDbCongestionFromGuides()

const auto& h_edges_3D = fastroute_->getHorizontalEdges3D();
const auto& v_edges_3D = fastroute_->getVerticalEdges3D();

const unsigned short capH = fastroute_->getHorizontalCapacities()[k];
const unsigned short capV = fastroute_->getVerticalCapacities()[k];
const uint16_t capH = fastroute_->getHorizontalCapacities()[k];
const uint16_t capV = fastroute_->getVerticalCapacities()[k];
const uint16_t last_row_capH
= fastroute_->getLastRowHorizontalCapacities()[k];
const uint16_t last_col_capV
= fastroute_->getLastColumnVerticalCapacities()[k];
for (int y = 0; y < grid_->getYGrids(); y++) {
for (int x = 0; x < grid_->getXGrids(); x++) {
const unsigned short blockageH = capH - h_edges_3D[k][y][x].cap;
const unsigned short blockageV = capV - v_edges_3D[k][y][x].cap;
const unsigned short usageH = h_edges_3D[k][y][x].usage + blockageH;
const unsigned short usageV = v_edges_3D[k][y][x].usage + blockageV;
db_gcell->setCapacity(layer, x, y, capH + capV);
const uint16_t thisCapH
= (y == grid_->getYGrids() - 1 ? last_row_capH : capH);
const uint16_t thisCapV
= (x == grid_->getXGrids() - 1 ? last_col_capV : capV);
const uint16_t blockageH = thisCapH - h_edges_3D[k][y][x].cap;
const uint16_t blockageV = thisCapV - v_edges_3D[k][y][x].cap;
const uint16_t usageH = h_edges_3D[k][y][x].usage + blockageH;
const uint16_t usageV = v_edges_3D[k][y][x].usage + blockageV;
db_gcell->setCapacity(layer, x, y, thisCapH + thisCapV);
db_gcell->setUsage(layer, x, y, usageH + usageV);
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/grt/src/fastroute/include/FastRoute.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,14 @@ class FastRouteCore
{
last_row_h_capacity_3D_[layer] = cap;
}
const std::vector<int16_t>& getLastColumnVerticalCapacities()
{
return last_col_v_capacity_3D_;
}
const std::vector<int16_t>& getLastRowHorizontalCapacities()
{
return last_row_h_capacity_3D_;
}
void setRegularX(bool regular_x) { regular_x_ = regular_x; }
void setRegularY(bool regular_y) { regular_y_ = regular_y; }
void incrementEdge3DUsage(int x1, int y1, int x2, int y2, int layer);
Expand Down
48 changes: 30 additions & 18 deletions src/grt/src/fastroute/src/FastRoute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,15 @@ void FastRouteCore::initEdges()
h_edges_3D_.resize(boost::extents[num_layers_][y_grid_][x_grid_]);

for (int i = 0; i < y_grid_; i++) {
for (int j = 0; j < x_grid_ - 1; j++) {
for (int j = 0; j < x_grid_; j++) {
// 2D edge initialization
h_edges_[i][j].cap = h_capacity_;
h_edges_[i][j].usage = 0;
h_edges_[i][j].est_usage = 0;
h_edges_[i][j].red = 0;
h_edges_[i][j].last_usage = 0;
if (j < x_grid_ - 1) {
h_edges_[i][j].cap = h_capacity_;
h_edges_[i][j].usage = 0;
h_edges_[i][j].est_usage = 0;
h_edges_[i][j].red = 0;
h_edges_[i][j].last_usage = 0;
}

// 3D edge initialization
for (int k = 0; k < num_layers_; k++) {
Expand All @@ -346,14 +348,16 @@ void FastRouteCore::initEdges()
}
}
}
for (int i = 0; i < y_grid_ - 1; i++) {
for (int i = 0; i < y_grid_; i++) {
for (int j = 0; j < x_grid_; j++) {
// 2D edge initialization
v_edges_[i][j].cap = v_capacity_;
v_edges_[i][j].usage = 0;
v_edges_[i][j].est_usage = 0;
v_edges_[i][j].red = 0;
v_edges_[i][j].last_usage = 0;
if (i < y_grid_ - 1) {
v_edges_[i][j].cap = v_capacity_;
v_edges_[i][j].usage = 0;
v_edges_[i][j].est_usage = 0;
v_edges_[i][j].red = 0;
v_edges_[i][j].last_usage = 0;
}

// 3D edge initialization
for (int k = 0; k < num_layers_; k++) {
Expand Down Expand Up @@ -408,13 +412,17 @@ void FastRouteCore::addAdjustment(int x1,

if (!isReduce) {
const int increase = reducedCap - cap;
h_edges_[y1][x1].cap += increase;
if (x1 < x_grid_ - 1) {
h_edges_[y1][x1].cap += increase;
}
} else {
h_edges_3D_[k][y1][x1].red += reduce;
}

h_edges_[y1][x1].cap -= reduce;
h_edges_[y1][x1].red += reduce;
if (x1 < x_grid_ - 1) {
h_edges_[y1][x1].cap -= reduce;
h_edges_[y1][x1].red += reduce;
}

} else if (x1 == x2) { // vertical edge
const int cap = v_edges_3D_[k][y1][x1].cap;
Expand All @@ -438,13 +446,17 @@ void FastRouteCore::addAdjustment(int x1,

if (!isReduce) {
int increase = reducedCap - cap;
v_edges_[y1][x1].cap += increase;
if (y1 < y_grid_ - 1) {
v_edges_[y1][x1].cap += increase;
}
} else {
v_edges_3D_[k][y1][x1].red += reduce;
}

v_edges_[y1][x1].cap -= reduce;
v_edges_[y1][x1].red += reduce;
if (y1 < y_grid_ - 1) {
v_edges_[y1][x1].cap -= reduce;
v_edges_[y1][x1].red += reduce;
}
}
}

Expand Down
8 changes: 8 additions & 0 deletions src/odb/include/odb/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,14 @@ class dbDatabase : public dbObject
///
static void commitEco(dbBlock* block);

///
/// Undo any pending netlist changes. Only supports:
/// create and destroy of dbInst and dbNet
/// dbInst::swapMaster
/// connect and disconnect of dbBTerm and dbITerm
///
static void undoEco(dbBlock* block);

///
/// links to utl::Logger
///
Expand Down
8 changes: 5 additions & 3 deletions src/odb/src/db/dbBTerm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,10 @@ void dbBTerm::connect(dbNet* net_)
net->_name);
}

if (bterm->_net) {
disconnect();
}

if (block->_journal) {
debugPrint(block->getImpl()->getLogger(),
utl::ODB,
Expand All @@ -510,9 +514,6 @@ void dbBTerm::connect(dbNet* net_)
block->_journal->endAction();
}

if (bterm->_net) {
bterm->disconnectNet(bterm, block);
}
bterm->connectNet(net, block);
}

Expand Down Expand Up @@ -541,6 +542,7 @@ void dbBTerm::disconnect()
block->_journal->beginAction(dbJournal::DISCONNECT_OBJECT);
block->_journal->pushParam(dbBTermObj);
block->_journal->pushParam(bterm->getId());
block->_journal->pushParam(net->getOID());
block->_journal->endAction();
}

Expand Down
14 changes: 12 additions & 2 deletions src/odb/src/db/dbDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,15 +610,25 @@ void dbDatabase::commitEco(dbBlock* block_)
_dbBlock* block = (_dbBlock*) block_;

// TODO: Need a check to ensure the commit is not applied to the block of
// which
// this eco was generated from.
// which this eco was generated from.
if (block->_journal_pending) {
block->_journal_pending->redo();
delete block->_journal_pending;
block->_journal_pending = nullptr;
}
}

void dbDatabase::undoEco(dbBlock* block_)
{
_dbBlock* block = (_dbBlock*) block_;

if (block->_journal_pending) {
block->_journal_pending->undo();
delete block->_journal_pending;
block->_journal_pending = nullptr;
}
}

void dbDatabase::setLogger(utl::Logger* logger)
{
_dbDatabase* _db = (_dbDatabase*) this;
Expand Down
1 change: 1 addition & 0 deletions src/odb/src/db/dbITerm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ void dbITerm::disconnect()
block->_journal->beginAction(dbJournal::DISCONNECT_OBJECT);
block->_journal->pushParam(dbITermObj);
block->_journal->pushParam(getId());
block->_journal->pushParam(net->getOID());
block->_journal->endAction();
}

Expand Down
22 changes: 14 additions & 8 deletions src/odb/src/db/dbInst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,8 @@ dbInst* dbInst::create(dbBlock* block_,
name_);
}

_dbInst* inst = block->_inst_tbl->create();

if (block->_journal) {
debugPrint(block->getImpl()->getLogger(),
utl::ODB,
Expand All @@ -1419,10 +1421,10 @@ dbInst* dbInst::create(dbBlock* block_,
block->_journal->pushParam(lib->getId());
block->_journal->pushParam(master_->getId());
block->_journal->pushParam(name_);
block->_journal->pushParam(inst->getOID());
block->_journal->endAction();
}

_dbInst* inst = block->_inst_tbl->create();
inst->_name = strdup(name_);
ZALLOCATED(inst->_name);
inst->_inst_hdr = inst_hdr->getOID();
Expand Down Expand Up @@ -1563,19 +1565,19 @@ void dbInst::destroy(dbInst* inst_)
uint i;
uint n = inst->_iterms.size();

// Delete these in reverse order so undo creates the in
// the correct order.
for (i = 0; i < n; ++i) {
dbId<_dbITerm> id = inst->_iterms[i];
dbId<_dbITerm> id = inst->_iterms[n - 1 - i];
_dbITerm* it = block->_iterm_tbl->getPtr(id);
((dbITerm*) it)->disconnect();

// Bugzilla #7: notify when pins are deleted (assumption: pins
// are destroyed only when the related instance is destroyed)
// payam 01/10/2006
// Notify when pins are deleted (assumption: pins are destroyed only when
// the related instance is destroyed)
std::list<dbBlockCallBackObj*>::iterator cbitr;
for (cbitr = block->_callbacks.begin(); cbitr != block->_callbacks.end();
++cbitr) {
(**cbitr)().inDbITermDestroy(
(dbITerm*) it); // client ECO optimization - payam
(**cbitr)().inDbITermDestroy((dbITerm*) it);
}

dbProperty::destroyProperties(it);
Expand All @@ -1597,9 +1599,13 @@ void dbInst::destroy(dbInst* inst_)
"DB_ECO",
1,
"ECO: dbInst:destroy");
auto master = inst_->getMaster();
block->_journal->beginAction(dbJournal::DELETE_OBJECT);
block->_journal->pushParam(dbInstObj);
block->_journal->pushParam(inst->getId());
block->_journal->pushParam(master->getLib()->getId());
block->_journal->pushParam(master->getId());
block->_journal->pushParam(inst_->getName().c_str());
block->_journal->pushParam(inst_->getId());
block->_journal->endAction();
}

Expand Down
Loading

0 comments on commit 8fe0461

Please sign in to comment.