Skip to content

Commit

Permalink
Merge pull request #6224 from The-OpenROAD-Project-staging/odb-rm-int…
Browse files Browse the repository at this point in the history
…64-uint64

odb & pad: use std int64_t instead of int64 (likewise uint64)
  • Loading branch information
maliberty authored Nov 23, 2024
2 parents 35d3dd3 + d827454 commit bc13277
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 42 deletions.
2 changes: 1 addition & 1 deletion src/odb/include/odb/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -3913,7 +3913,7 @@ class dbWire : public dbObject
///
/// Get the total path length contained in this wire.
///
uint64 getLength();
uint64_t getLength();

///
/// Get the number of entries contained in this wire.
Expand Down
8 changes: 4 additions & 4 deletions src/odb/include/odb/dbTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -1279,13 +1279,13 @@ class dbSourceType
Value _value;
};

constexpr uint64 MAX_UINT64 = 0xffffffffffffffffLL;
constexpr uint64 MIN_UINT64 = 0;
constexpr uint64_t MAX_UINT64 = 0xffffffffffffffffLL;
constexpr uint64_t MIN_UINT64 = 0;
constexpr uint MAX_UINT = 0xffffffff;
constexpr uint MIN_UINT = 0;

constexpr int64 MAX_INT64 = 0x7fffffffffffffffLL;
constexpr int64 MIN_INT64 = 0x8000000000000000LL;
constexpr int64_t MAX_INT64 = 0x7fffffffffffffffLL;
constexpr int64_t MIN_INT64 = 0x8000000000000000LL;
constexpr int MAX_INT = 0x7fffffff;
constexpr int MIN_INT = 0x80000000;

Expand Down
30 changes: 15 additions & 15 deletions src/odb/include/odb/geom.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ class Point
int y() const { return y_; }

// compute the square distance between two points
static int64 squaredDistance(Point p0, Point p1);
static int64_t squaredDistance(Point p0, Point p1);

// compute the manhattan distance between two points
static int64 manhattanDistance(Point p0, Point p1);
static int64_t manhattanDistance(Point p0, Point p1);

friend dbIStream& operator>>(dbIStream& stream, Point& p);
friend dbOStream& operator<<(dbOStream& stream, const Point& p);
Expand Down Expand Up @@ -304,8 +304,8 @@ class Rect
// Compute the intersection of these two rectangles.
Rect intersect(const Rect& r) const;

int64 area() const;
int64 margin() const;
int64_t area() const;
int64_t margin() const;

void printf(FILE* fp, const char* prefix = "");
void print(const char* prefix = "");
Expand Down Expand Up @@ -431,17 +431,17 @@ inline void Point::rotate270()
y_ = yp;
}

inline int64 Point::squaredDistance(Point p0, Point p1)
inline int64_t Point::squaredDistance(Point p0, Point p1)
{
const int64 dx = p1.x_ - p0.x_;
const int64 dy = p1.y_ - p0.y_;
const int64_t dx = p1.x_ - p0.x_;
const int64_t dy = p1.y_ - p0.y_;
return dx * dx + dy * dy;
}

inline int64 Point::manhattanDistance(Point p0, Point p1)
inline int64_t Point::manhattanDistance(Point p0, Point p1)
{
const int64 dx = std::abs(p1.x_ - p0.x_);
const int64 dy = std::abs(p1.y_ - p0.y_);
const int64_t dx = std::abs(p1.x_ - p0.x_);
const int64_t dy = std::abs(p1.y_ - p0.y_);
return dx + dy;
}

Expand Down Expand Up @@ -730,15 +730,15 @@ inline Rect Rect::intersect(const Rect& r) const
return result;
}

inline int64 Rect::area() const
inline int64_t Rect::area() const
{
return dx() * static_cast<int64>(dy());
return dx() * static_cast<int64_t>(dy());
}

inline int64 Rect::margin() const
inline int64_t Rect::margin() const
{
const int64 DX = dx();
const int64 DY = dy();
const int64_t DX = dx();
const int64_t DY = dy();
return DX + DX + DY + DY;
}

Expand Down
3 changes: 0 additions & 3 deletions src/odb/include/odb/odb.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ namespace odb {
using uint = unsigned int;
using uchar = unsigned char;

using int64 = std::int64_t;
using uint64 = std::uint64_t;

#ifndef SWIG
using utl::format_as;
#endif
Expand Down
4 changes: 2 additions & 2 deletions src/odb/src/db/dbWire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -962,11 +962,11 @@ void dbWire::printWire(FILE* fp, int fid, int tid)
}
}

uint64 dbWire::getLength()
uint64_t dbWire::getLength()
{
dbWireShapeItr shapes;
dbShape s;
uint64 rtlen = 0;
uint64_t rtlen = 0;
for (shapes.begin(this); shapes.next(s);) {
if (!s.isVia()) {
rtlen += s.getLength();
Expand Down
14 changes: 7 additions & 7 deletions src/pad/include/pad/ICeWall.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,13 @@ class ICeWall
std::string getRowName(const std::string& name, int ring_index) const;
odb::Direction2D::Value getRowEdge(odb::dbRow* row) const;

odb::int64 estimateWirelengths(odb::dbInst* inst,
const std::set<odb::dbITerm*>& iterms) const;
odb::int64 computePadBumpDistance(odb::dbInst* inst,
int inst_width,
odb::dbITerm* bump,
odb::dbRow* row,
int center_pos) const;
int64_t estimateWirelengths(odb::dbInst* inst,
const std::set<odb::dbITerm*>& iterms) const;
int64_t computePadBumpDistance(odb::dbInst* inst,
int inst_width,
odb::dbITerm* bump,
odb::dbRow* row,
int center_pos) const;
void placePadsUniform(const std::vector<odb::dbInst*>& insts,
odb::dbRow* row,
const std::map<odb::dbInst*, int>& inst_widths,
Expand Down
20 changes: 10 additions & 10 deletions src/pad/src/ICeWall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ void ICeWall::placePad(odb::dbMaster* master,
placeInstance(row, snapToRowSite(row, location), inst, orient.getOrient());
}

odb::int64 ICeWall::estimateWirelengths(
int64_t ICeWall::estimateWirelengths(
odb::dbInst* inst,
const std::set<odb::dbITerm*>& iterms) const
{
Expand All @@ -605,7 +605,7 @@ odb::int64 ICeWall::estimateWirelengths(
}
}

odb::int64 dist = 0;
int64_t dist = 0;

for (const auto& [term0, term1] : terms) {
dist += odb::Point::manhattanDistance(term0->getBBox().center(),
Expand All @@ -615,11 +615,11 @@ odb::int64 ICeWall::estimateWirelengths(
return dist;
}

odb::int64 ICeWall::computePadBumpDistance(odb::dbInst* inst,
int inst_width,
odb::dbITerm* bump,
odb::dbRow* row,
int center_pos) const
int64_t ICeWall::computePadBumpDistance(odb::dbInst* inst,
int inst_width,
odb::dbITerm* bump,
odb::dbRow* row,
int center_pos) const
{
const odb::Point row_center = row->getBBox().center();
const odb::Point center = bump->getBBox().center();
Expand All @@ -635,7 +635,7 @@ odb::int64 ICeWall::computePadBumpDistance(odb::dbInst* inst,
odb::Point(row_center.x(), center_pos + inst_width / 2), center);
}

return std::numeric_limits<odb::int64>::max();
return std::numeric_limits<int64_t>::max();
}

void ICeWall::placePads(const std::vector<odb::dbInst*>& insts, odb::dbRow* row)
Expand Down Expand Up @@ -822,7 +822,7 @@ void ICeWall::performPadFlip(
const auto& pins = find_assignment->second;
if (pins.size() > 1) {
// only need to check if pad has more than one connection
const odb::int64 start_wirelength = estimateWirelengths(inst, pins);
const int64_t start_wirelength = estimateWirelengths(inst, pins);
const auto start_orient = inst->getOrient();

// try flipping pad
Expand All @@ -839,7 +839,7 @@ void ICeWall::performPadFlip(
}

// get new wirelength
const odb::int64 flipped_wirelength = estimateWirelengths(inst, pins);
const int64_t flipped_wirelength = estimateWirelengths(inst, pins);
const bool undo = flipped_wirelength > start_wirelength;

if (undo) {
Expand Down

0 comments on commit bc13277

Please sign in to comment.