mirror of
https://github.com/The-OpenROAD-Project/OpenDB.git
synced 2026-03-06 17:31:17 +08:00
destroy function for dbTrackGrid
This commit is contained in:
@@ -3896,6 +3896,11 @@ class dbTrackGrid : public dbObject
|
||||
/// Translate a database-id back to a pointer.
|
||||
///
|
||||
static dbTrackGrid* getTrackGrid(dbBlock* block, uint oid);
|
||||
|
||||
///
|
||||
/// destroy a grid
|
||||
///
|
||||
static void destroy(dbTrackGrid* grid_);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -263,5 +263,12 @@ dbTrackGrid* dbTrackGrid::getTrackGrid(dbBlock* block_, uint dbid_)
|
||||
_dbBlock* block = (_dbBlock*) block_;
|
||||
return (dbTrackGrid*) block->_track_grid_tbl->getPtr(dbid_);
|
||||
}
|
||||
void dbTrackGrid::destroy(dbTrackGrid* grid_)
|
||||
{
|
||||
_dbTrackGrid* grid = (_dbTrackGrid*) grid_;
|
||||
_dbBlock* block = (_dbBlock*) grid->getOwner();
|
||||
dbProperty::destroyProperties(grid);
|
||||
block->_track_grid_tbl->destroy(grid);
|
||||
}
|
||||
|
||||
} // namespace odb
|
||||
|
||||
@@ -83,10 +83,7 @@ class TestDestroy(odbUnitTest.TestCase):
|
||||
self.assertEqual(len(self.parentBlock.getChildren()), 2)
|
||||
_block.destroy(_block)
|
||||
self.assertEqual(len(self.parentBlock.getChildren()), 1)
|
||||
#destroying parent block
|
||||
# _block = helper.create1LevelBlock(self.db, self.db.getLibs()[0], self.parentBlock)
|
||||
odb.dbBlock_destroy(self.parentBlock)
|
||||
self.assertIsNone(self.db.getChip().getBlock())
|
||||
|
||||
def test_destroy_bpin(self):
|
||||
IN1 = self.block.findBTerm('IN1')
|
||||
self.assertEqual(len(IN1.getBPins()), 1)
|
||||
@@ -162,7 +159,16 @@ class TestDestroy(odbUnitTest.TestCase):
|
||||
parentRegion, childRegion = self.setup_regions()
|
||||
parentRegion.destroy(parentRegion)
|
||||
self.assertEqual(len(self.block.getRegions()), 0)
|
||||
|
||||
def test_destroy_trackgrid(self):
|
||||
tech = self.db.getLibs()[0].getTech()
|
||||
L1 = tech.findLayer("L1")
|
||||
grid = odb.dbTrackGrid_create(self.block,L1)
|
||||
self.assertIsNone(odb.dbTrackGrid_create(self.block,L1))
|
||||
grid = grid.destroy(grid)
|
||||
self.assertIsNotNone(odb.dbTrackGrid_create(self.block,L1))
|
||||
|
||||
if __name__=='__main__':
|
||||
odbUnitTest.mainParallel(TestDestroy)
|
||||
# odbUnitTest.main()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user