Skip to content

Commit

Permalink
Merge pull request The-OpenROAD-Project#5110 from gadfort/int64-block
Browse files Browse the repository at this point in the history
odb: provide dbuToMicrons for various datatypes to avoid casting errors
  • Loading branch information
maliberty authored May 15, 2024
2 parents bdc23aa + fe51ff8 commit 8327880
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/odb/include/odb/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,9 @@ class dbBlock : public dbObject
/// Convert a length from database units (DBUs) to microns.
///
double dbuToMicrons(int dbu);
double dbuToMicrons(unsigned int dbu);
double dbuToMicrons(int64_t dbu);
double dbuToMicrons(double dbu);

///
/// Convert an area from database units squared (DBU^2) to square microns.
Expand Down
20 changes: 19 additions & 1 deletion src/odb/src/db/dbBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2319,7 +2319,25 @@ int dbBlock::getDbUnitsPerMicron()
return block->_dbu_per_micron;
}

double dbBlock::dbuToMicrons(const int dbu)
double dbBlock::dbuToMicrons(int dbu)
{
const double dbu_micron = getTech()->getDbUnitsPerMicron();
return dbu / dbu_micron;
}

double dbBlock::dbuToMicrons(unsigned int dbu)
{
const double dbu_micron = getTech()->getDbUnitsPerMicron();
return dbu / dbu_micron;
}

double dbBlock::dbuToMicrons(int64_t dbu)
{
const double dbu_micron = getTech()->getDbUnitsPerMicron();
return dbu / dbu_micron;
}

double dbBlock::dbuToMicrons(double dbu)
{
const double dbu_micron = getTech()->getDbUnitsPerMicron();
return dbu / dbu_micron;
Expand Down

0 comments on commit 8327880

Please sign in to comment.