Skip to content

Commit

Permalink
Merge pull request The-OpenROAD-Project#6134 from arthurjolo/cts_enha…
Browse files Browse the repository at this point in the history
…nce_clkgater_handling

Cts enhance clkgater handling
  • Loading branch information
maliberty authored Nov 21, 2024
2 parents c00d748 + 928902c commit d7c5a8a
Show file tree
Hide file tree
Showing 8 changed files with 377 additions and 279 deletions.
31 changes: 25 additions & 6 deletions src/cts/include/cts/TritonCTS.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class Clock;
class dbNetwork;
class Unit;
class LibertyCell;
class Vertex;
class Graph;
} // namespace sta

namespace stt {
Expand Down Expand Up @@ -119,23 +121,27 @@ class TritonCTS
// db functions
bool masterExists(const std::string& master) const;
void populateTritonCTS();
void writeClockNetsToDb(Clock& clockNet, std::set<odb::dbNet*>& clkLeafNets);
void writeClockNetsToDb(TreeBuilder* builder,
std::set<odb::dbNet*>& clkLeafNets);
void writeClockNDRsToDb(const std::set<odb::dbNet*>& clkLeafNets);
void incrementNumClocks() { ++numberOfClocks_; }
void clearNumClocks() { numberOfClocks_ = 0; }
unsigned getNumClocks() const { return numberOfClocks_; }
void initOneClockTree(odb::dbNet* driverNet,
odb::dbNet* clkInputNet,
const std::string& sdcClockName,
TreeBuilder* parent);
TreeBuilder* initClock(odb::dbNet* net,
TreeBuilder* initClock(odb::dbNet* firstNet,
odb::dbNet* clkInputNet,
const std::string& sdcClock,
TreeBuilder* parentBuilder);
void disconnectAllSinksFromNet(odb::dbNet* net);
void disconnectAllPinsFromNet(odb::dbNet* net);
void checkUpstreamConnections(odb::dbNet* net);
void createClockBuffers(Clock& clockNet, odb::dbModule* parent);
HTreeBuilder* initClockTreeForMacrosAndRegs(
odb::dbNet*& net,
odb::dbNet*& firstNet,
odb::dbNet* clkInputNet,
const std::unordered_set<odb::dbMaster*>& buffer_masters,
Clock& ClockNet,
TreeBuilder* parentBuilder);
Expand All @@ -155,7 +161,8 @@ class TritonCTS
Clock& clockNet,
const std::vector<std::pair<odb::dbInst*, odb::dbMTerm*>>& registerSinks,
odb::dbNet*& firstNet,
odb::dbNet*& secondNet);
odb::dbNet*& secondNet,
std::string& topBufferName);
void computeITermPosition(odb::dbITerm* term, int& x, int& y) const;
void countSinksPostDbWrite(TreeBuilder* builder,
odb::dbNet* net,
Expand Down Expand Up @@ -200,11 +207,18 @@ class TritonCTS
ClockInst& dummyClock);
void printClockNetwork(const Clock& clockNet) const;
void balanceMacroRegisterLatencies();
void computeAveSinkArrivals(TreeBuilder* builder);
float getVertexClkArrival(sta::Vertex* sinkVertex,
odb::dbNet* topNet,
odb::dbITerm* iterm);
void computeAveSinkArrivals(TreeBuilder* builder, sta::Graph* graph);
void computeSinkArrivalRecur(odb::dbNet* topClokcNet,
odb::dbITerm* iterm,
float& sumArrivals,
unsigned& numSinks,
sta::Graph* graph);
void adjustLatencies(TreeBuilder* macroBuilder, TreeBuilder* registerBuilder);
void computeTopBufferDelay(TreeBuilder* builder);
odb::dbInst* insertDelayBuffer(odb::dbInst* driver,
int index,
const std::string& clockName,
int locX,
int locY);
Expand Down Expand Up @@ -232,6 +246,11 @@ class TritonCTS
// root buffer and sink bufer candidates
std::vector<std::string> rootBuffers_;
std::vector<std::string> sinkBuffers_;

// register tree root buffer indices
unsigned regTreeRootBufIndex_ = 0;
// index for delay buffer added for latency adjustment
unsigned delayBufIndex_ = 0;
};

} // namespace cts
9 changes: 9 additions & 0 deletions src/cts/src/TreeBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,12 @@ class TreeBuilder
void setTopBufferDelay(float delay) { topBufferDelay_ = delay; }
odb::dbInst* getTopBuffer() const { return topBuffer_; }
void setTopBuffer(odb::dbInst* inst) { topBuffer_ = inst; }
std::string getTopBufferName() const { return topBufferName_; }
void setTopBufferName(std::string name) { topBufferName_ = std::move(name); }
odb::dbNet* getTopInputNet() const { return topInputNet_; }
void setTopInputNet(odb::dbNet* net) { topInputNet_ = net; }
odb::dbNet* getDrivingNet() const { return drivingNet_; }
void setDrivingNet(odb::dbNet* net) { drivingNet_ = net; }

protected:
CtsOptions* options_ = nullptr;
Expand Down Expand Up @@ -276,6 +282,9 @@ class TreeBuilder
float aveArrival_ = 0.0;
float topBufferDelay_ = 0.0;
odb::dbInst* topBuffer_ = nullptr;
std::string topBufferName_;
odb::dbNet* drivingNet_ = nullptr;
odb::dbNet* topInputNet_ = nullptr;
};

} // namespace cts
Loading

0 comments on commit d7c5a8a

Please sign in to comment.