Skip to content

Commit de02894

Browse files
committed
odb: move destroy_net_routes implementation from grt to odb
Signed-off-by: Eder Monteiro <[email protected]>
1 parent c282dfc commit de02894

File tree

9 files changed

+33
-22
lines changed

9 files changed

+33
-22
lines changed

src/grt/include/grt/GlobalRouter.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,6 @@ class GlobalRouter
300300
Rudy* getRudy();
301301

302302
void writePinLocations(const char* file_name);
303-
void destroyRoutes();
304303

305304
private:
306305
// Net functions

src/grt/src/GlobalRouter.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3748,22 +3748,6 @@ void GlobalRouter::removeNet(odb::dbNet* db_net)
37483748
routes_.erase(db_net);
37493749
}
37503750

3751-
void GlobalRouter::destroyRoutes()
3752-
{
3753-
if (block_ == nullptr) {
3754-
block_ = db_->getChip()->getBlock();
3755-
}
3756-
for (odb::dbNet* db_net : block_->getNets()) {
3757-
if (!db_net->getSigType().isSupply() && !db_net->isSpecial()
3758-
&& db_net->getSWires().empty() && !db_net->isConnectedByAbutment()) {
3759-
odb::dbWire* wire = db_net->getWire();
3760-
if (wire != nullptr) {
3761-
odb::dbWire::destroy(wire);
3762-
}
3763-
}
3764-
}
3765-
}
3766-
37673751
Net* GlobalRouter::getNet(odb::dbNet* db_net)
37683752
{
37693753
return db_net_map_[db_net];

src/grt/src/GlobalRouter.i

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,6 @@ void write_pin_locations(const char* file_name)
257257
getGlobalRouter()->writePinLocations(file_name);
258258
}
259259

260-
void destroy_routes()
261-
{
262-
getGlobalRouter()->destroyRoutes();
263-
}
264-
265260
} // namespace
266261

267262
%} // inline

src/odb/include/odb/db.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,6 +1330,11 @@ class dbBlock : public dbObject
13301330

13311331
std::map<dbTechLayer*, dbTechVia*> getDefaultVias();
13321332

1333+
///
1334+
/// Destroy all the routing wires from signal and clock nets in this block.
1335+
///
1336+
void destroyRoutes();
1337+
13331338
public:
13341339
///
13351340
/// Create a chip's top-block. Returns nullptr of a top-block already

src/odb/include/odb/util.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ void set_bterm_top_layer_grid(dbBlock* block,
220220
int height,
221221
int keepout);
222222

223+
void destroy_routes(dbBlock* block);
224+
223225
class WireLengthEvaluator
224226
{
225227
public:

src/odb/src/db/dbBlock.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3167,6 +3167,20 @@ std::map<dbTechLayer*, odb::dbTechVia*> dbBlock::getDefaultVias()
31673167
return default_vias;
31683168
}
31693169

3170+
void dbBlock::destroyRoutes()
3171+
{
3172+
dbBlock* block = this;
3173+
for (odb::dbNet* db_net : block->getNets()) {
3174+
if (!db_net->getSigType().isSupply() && !db_net->isSpecial()
3175+
&& db_net->getSWires().empty() && !db_net->isConnectedByAbutment()) {
3176+
odb::dbWire* wire = db_net->getWire();
3177+
if (wire != nullptr) {
3178+
odb::dbWire::destroy(wire);
3179+
}
3180+
}
3181+
}
3182+
}
3183+
31703184
void dbBlock::setDrivingItermsforNets()
31713185
{
31723186
for (dbNet* net : getNets()) {

src/odb/src/swig/common/odb.i

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,4 @@ void set_bterm_top_layer_grid(odb::dbBlock* block,
8383
int width,
8484
int height,
8585
int keepout);
86+
void destroy_routes(odb::dbBlock* block);

src/odb/src/swig/tcl/odb.tcl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,4 +1101,10 @@ proc get_block { } {
11011101
set chip [$db getChip]
11021102
return [$chip getBlock]
11031103
}
1104+
1105+
proc destroy_net_routes { } {
1106+
set block [ord::get_db_block]
1107+
odb::destroy_routes $block
1108+
}
1109+
11041110
}

src/odb/src/zutil/util.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,11 @@ void set_bterm_top_layer_grid(dbBlock* block,
267267
block->setBTermTopLayerGrid(top_layer_grid);
268268
}
269269

270+
void destroy_routes(dbBlock* block)
271+
{
272+
block->destroyRoutes();
273+
}
274+
270275
bool hasOneSiteMaster(dbDatabase* db)
271276
{
272277
for (dbLib* lib : db->getLibs()) {

0 commit comments

Comments
 (0)