Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
179 commits
Select commit Hold shift + click to select a range
e1e49c3
Changed checkAxioms() and checkSanity*() return type (void -> int).
jhkim-pii Oct 9, 2025
cefac8f
Implemented a new dbNet::insertBufferBeforeLoad().
jhkim-pii Oct 9, 2025
4b030ee
Added a new TestInsertBuffer.cpp.
jhkim-pii Oct 9, 2025
8d5712b
Added insertBufferBeforeLoad(output_bterm, ...) test.
jhkim-pii Oct 9, 2025
27674d7
Implemented a new dbNet::insertBufferAfterDriver().
jhkim-pii Oct 9, 2025
bcc7700
Added tests for insertBufferAfterDriver().
jhkim-pii Oct 9, 2025
6576b85
Factored out placeNewBuffer().
jhkim-pii Oct 9, 2025
56f2bef
Cleaned up verilog_file_4 in TestInsertBuffer.cpp.
jhkim-pii Oct 9, 2025
f158462
Factored out common codes.
jhkim-pii Oct 9, 2025
f5a064d
Added renaming original net to avoid collision with BTerm name.
jhkim-pii Oct 9, 2025
b1510c5
Factored out createBufferNet().
jhkim-pii Oct 9, 2025
2c132fd
Factored out rewireBuffer().
jhkim-pii Oct 9, 2025
2eaaee9
Minor refactoring in insertBuffer*().
jhkim-pii Oct 9, 2025
49eb6cf
Merge branch 'master' of https://github.com/The-OpenROAD-Project-priv…
jhkim-pii Oct 9, 2025
d9f4716
Merge branch 'master' of https://github.com/The-OpenROAD-Project-priv…
jhkim-pii Nov 20, 2025
9b2eeb8
Fixed build issue after merge
jhkim-pii Nov 20, 2025
a7bc64e
Fixed TestInsertBuffer regression fail
jhkim-pii Nov 20, 2025
211d17c
Moved TestInsertBuffer.cpp from odb to rsz for more convenient testin…
jhkim-pii Nov 20, 2025
656fb57
Used removeFile() in TestInsertBuffer.cpp
jhkim-pii Nov 20, 2025
25fa05d
Added insertBufferBeforeLoads() - flat version
jhkim-pii Nov 20, 2025
219ca9d
Fixed buildifier issue
jhkim-pii Nov 20, 2025
e035eec
Fixed lint issues
jhkim-pii Nov 20, 2025
69f3d90
Changed style of TestInsertBuffer.cpp
jhkim-pii Nov 20, 2025
fcab1e2
Merge branch 'secure-insert-buffer' of https://github.com/The-OpenROA…
jhkim-pii Nov 20, 2025
4942ac1
Added port punching in dbNet::insertBufferBeforeLoads()
jhkim-pii Nov 20, 2025
080d105
Fixed lint issue
jhkim-pii Nov 20, 2025
17839b3
Added new test cases for insertBufferBeforeLoads
jhkim-pii Nov 20, 2025
29e19e7
Changed to create a dbModNet only if it is needed
jhkim-pii Nov 20, 2025
37767ee
Considered a design without clk port
jhkim-pii Nov 24, 2025
74ad669
Used the base name of dbNet for a new corresponding dbModNet
jhkim-pii Nov 24, 2025
d35d7a1
Added TestInsertBuffer - BeforeLoads_Case6
jhkim-pii Nov 24, 2025
1863c5d
Added dbModBTerm::getModInst() method
jhkim-pii Nov 24, 2025
1ea418e
Added an existing port/net reuse logic (in progress)
jhkim-pii Nov 24, 2025
0d66eb6
Fixed lint issue
jhkim-pii Nov 24, 2025
b78cca4
Fixed an existing port/net reuse logic
jhkim-pii Nov 24, 2025
bf21e5e
Prevent `dbModNet` logical connection mismatches and add `dbBTerm` ty…
jhkim-pii Nov 24, 2025
d60dc55
Used the deafult name for a newly created net
jhkim-pii Nov 24, 2025
1791838
Added a new TEST_F(TestInsertBuffer, BeforeLoads_Case7)
jhkim-pii Nov 24, 2025
1947a3a
Changed the default name uniquify type (ALWAYS -> IF_NEEDED_WITH_UNDE…
jhkim-pii Nov 24, 2025
90be594
Removed debug code
jhkim-pii Nov 24, 2025
ce825b9
Added new test cases (8~13) in TestInsertBuffer.cpp
jhkim-pii Nov 26, 2025
be9a5ca
Fixed lint issue
jhkim-pii Nov 26, 2025
5a9c9a5
Added dbObject* dbNetwork::staToDb(const Pin* pin)
jhkim-pii Nov 27, 2025
40a83ac
Applied insertBufferBeforeLoads() for rebuffer logic
jhkim-pii Nov 27, 2025
dabca46
Added Pin* dbNetwork::dbToSta(dbObject* term_obj)
jhkim-pii Nov 27, 2025
255c595
Added `bool loads_on_same_db_net` argument in insertBufferBeforeLoads()
jhkim-pii Nov 27, 2025
faed125
Added a new test BeforeLoads_Case14 in TestInsertBuffer
jhkim-pii Nov 28, 2025
fa6c511
Rebased regressions
jhkim-pii Nov 28, 2025
d8265e5
Fixed incomplete dbModNet handling issue in dbNet::insertBufferBefore…
jhkim-pii Nov 28, 2025
2cbdca4
Enhanced insertBufferBeforeLoads to reuse a newly punched port
jhkim-pii Nov 28, 2025
0e40579
Deployed insertBufferBeforeLoads() for SplitLoadMove
jhkim-pii Nov 28, 2025
2d6ae6c
Minor change
jhkim-pii Nov 28, 2025
59d1905
Rebased regressions after SplitLoadMove enhancement
jhkim-pii Nov 28, 2025
f920de0
Removed special codes for hier flow in Rebuffer.cc
jhkim-pii Nov 28, 2025
6876feb
Added dbDatabase::hierarchy_ attribute
jhkim-pii Nov 29, 2025
fdd103f
Modified dbNetwork::setHierarchy() to call dbDatabase::setHierarchy(t…
jhkim-pii Nov 29, 2025
c81c96f
insertBufferBeforeLoads() does not create hierarchical ports & nets i…
jhkim-pii Nov 29, 2025
301669c
Minor change
jhkim-pii Nov 29, 2025
b888647
Used base name instead of full net name for a new net name
jhkim-pii Nov 29, 2025
58f98f4
Changed the name uniquification type (IF_NEEDED -> ALWAYS) for Resize…
jhkim-pii Nov 29, 2025
53abb47
Changed name uniquification type for insertBuffer*()
jhkim-pii Nov 29, 2025
31172c4
Rebasing regression (in prog)
jhkim-pii Nov 29, 2025
cb8ea5c
Rebased TestInsertBuffer.cpp
jhkim-pii Nov 29, 2025
e36eeb4
Removed stale comment
jhkim-pii Nov 29, 2025
ef87090
Added concrete port attribute checking in TestInsertBuffer
jhkim-pii Nov 29, 2025
28d4b11
Fixed existing port reuse bug in dbNet::insertBufferBeforeLoads()
jhkim-pii Dec 1, 2025
019bf8c
Changed Resizer::hasFanout() from protected to public in order to use…
jhkim-pii Dec 2, 2025
28c14ac
Changed net editing sequence (edit dbModNet first and then dbNet) for…
jhkim-pii Dec 2, 2025
1f7bd6e
Added debug code in Rebuffer.cc
jhkim-pii Dec 2, 2025
a5e93e6
Added new tests Case17~19 in TestInsertBuffer.cpp
jhkim-pii Dec 2, 2025
c3b2d38
Modified dbITerm::connect(). Connect dbModNet first, and then dbNet.
jhkim-pii Dec 3, 2025
176a93f
Fixed a port punching bug in insertBufferBeforeLoads().
jhkim-pii Dec 3, 2025
01d07f5
Added dbSta::checkSanity() to check consistency b/w STA and ODB
jhkim-pii Dec 3, 2025
2fd246c
Added dbSta::checkSanityDrvrVertexEdges() call for debug
jhkim-pii Dec 3, 2025
9c0cfec
Added debug code in Rebuffer.cc
jhkim-pii Dec 3, 2025
0646035
Modified dbNetwork behaviors: `net(Pin*)`, `pin(Term*)`, `connectPinA…
jhkim-pii Dec 3, 2025
00b6e25
Removed a mistakenly-committed file
jhkim-pii Dec 3, 2025
73ca0a6
Removed checkSanityDrvrVertexEdges() call in insertBufferBeforeLoads()
jhkim-pii Dec 3, 2025
56eed14
Added `bool show_modnets` argument in dbNet::dump() for easier debugging
jhkim-pii Dec 3, 2025
6ca7aaa
Fixed the missing dbModBTerm direction check bug in dbNet::insertBuff…
jhkim-pii Dec 4, 2025
f5d83b1
Fixed a wrong dbModNet retrieval by name collision. Used dbNet::findR…
jhkim-pii Dec 4, 2025
94117b2
Added a dbModNet decision logic for the new buffer input pin
jhkim-pii Dec 5, 2025
3ddad16
dbReadVerilog bug fix: Added dbModNet connection for feedthrough port
jhkim-pii Dec 6, 2025
51a043e
Fixed a bug in port reuse decision in dbNet::insertBufferBeforeLoads()
jhkim-pii Dec 6, 2025
708e5f7
Merge branch 'master' of https://github.com/The-OpenROAD-Project-priv…
jhkim-pii Dec 8, 2025
ae0626a
Changed error code in dbNet::insertBuffer*()
jhkim-pii Dec 8, 2025
9586646
Merge branch 'secure-default_logger-for-test' of https://github.com/T…
jhkim-pii Dec 8, 2025
085b25d
Merge branch 'secure-override-highest-net-above' of https://github.co…
jhkim-pii Dec 8, 2025
401c9a0
Reverted dbNetwork::net(Pin*) change
jhkim-pii Dec 8, 2025
97f7f99
Created dbModule and dbModInst earlier than dbModBTerm creation
jhkim-pii Dec 8, 2025
90573c5
Rebased failed regressions
jhkim-pii Dec 8, 2025
05c40ff
Added a debug knob (RSZ, "old_split_load_move") to go back to the old…
jhkim-pii Dec 9, 2025
9aad1f9
Minor change in dbSta::checkSanityDrvrVertexEdges()
jhkim-pii Dec 10, 2025
c79d5cd
Added dbSta::checkSanity() call in sta::check_axioms tcl command
jhkim-pii Dec 10, 2025
9c8c2c2
Updated debug logs
jhkim-pii Dec 10, 2025
0e23752
Added dbSta::checkSanity() calls in TestBufferRemoval3.cc
jhkim-pii Dec 10, 2025
0d97108
Added a new dbInst::getFirstInput() API
jhkim-pii Dec 10, 2025
5a86d05
Used insertBufferBeforeLoads() in RepairDesign::makeRepeater()
jhkim-pii Dec 10, 2025
c1819c6
Used insertBufferAfterDriver() in Resizer::bufferInput()
jhkim-pii Dec 11, 2025
4a1f480
Disabled debug switches
jhkim-pii Dec 11, 2025
22c3ae8
Merge branch 'master' of https://github.com/The-OpenROAD-Project-priv…
jhkim-pii Dec 11, 2025
b5575f2
Applied insertBuffer in RepairHold::makeHoldDelay()
jhkim-pii Dec 11, 2025
494041b
Applied insertBuffer in LatencyBalancer::insertDelayBuffers()
jhkim-pii Dec 11, 2025
de3c107
Applied insertBuffer in Resizer::bufferInput()
jhkim-pii Dec 11, 2025
0d87ee1
Fixed the net name collision issue with output BTerm name
jhkim-pii Dec 11, 2025
ec0927d
Added more test cases in TestInsertBuffer.cpp
jhkim-pii Dec 11, 2025
c5124d2
Replaced std::format() to fmt::format()
jhkim-pii Dec 11, 2025
514724f
Minor debug log change
jhkim-pii Dec 11, 2025
01cef87
Changed dbSta::checkSanityDrvrVertexEdges() to compare Edge strings i…
jhkim-pii Dec 12, 2025
9b25cea
Minor change
jhkim-pii Dec 12, 2025
8838ba1
Added a header comment in CloneMove::doMove()
jhkim-pii Dec 12, 2025
ec262a1
Removed redundant betweenPorts restrictions in UnbufferMove::canRemov…
jhkim-pii Dec 13, 2025
8f65284
Minor change
jhkim-pii Dec 13, 2025
b155759
Rebased TestBufferRemoval3.cc test
jhkim-pii Dec 13, 2025
2e0157c
Added Case26 in TestInsertBuffer.cpp
jhkim-pii Dec 13, 2025
d3e65f9
Added dbNet::hierarchicalConnect().
jhkim-pii Dec 13, 2025
d68f072
Skipped dbModNet handling in insertBufferBeforeLoads when it is a fla…
jhkim-pii Dec 13, 2025
6c266a5
Fixed net_slack_map_ lookup fail issue in Resizer::findResizeSlacks1().
jhkim-pii Dec 14, 2025
8d9a38b
Fixed minor typo in messages
jhkim-pii Dec 14, 2025
5343006
Fixed wrong dbModNet handling in EST OdbCallBack::inDbInstSwapMasterA…
jhkim-pii Dec 15, 2025
33e6d9f
Used findFlatDbNet() instead of flatNet() in EstimateParasitics::para…
jhkim-pii Dec 15, 2025
9372812
Fixed instance sequence difference b/w flat and hier flows
jhkim-pii Dec 16, 2025
4786ebe
Disabled insert_buffer_check_sanity debug switch
jhkim-pii Dec 17, 2025
3301e19
Merge branch 'master' of https://github.com/The-OpenROAD-Project-priv…
jhkim-pii Dec 17, 2025
008d244
Added sort in Resizer::findCellInstances()
jhkim-pii Dec 17, 2025
5057467
Merge branch 'master' of https://github.com/The-OpenROAD-Project-priv…
jhkim-pii Dec 20, 2025
33283d0
Factored out insert buffer codes into dbInsertBuffer.h,cpp
jhkim-pii Dec 20, 2025
007ee55
Rebased regressions
jhkim-pii Dec 20, 2025
e8656a4
odb: simplify and generalize buffer insertion common logic and term v…
jhkim-pii Dec 20, 2025
36f9f1f
Rebased regressions (slight location change)
jhkim-pii Dec 20, 2025
acea689
odb: Changed API names and added comment in dbInsertBuffer.cpp & .h
jhkim-pii Dec 21, 2025
2e19f09
odb: Added new_net_base_name argument in dbNet::insertBuffer*()
jhkim-pii Dec 21, 2025
d1eb75e
odb: Added new_net_base_name in Resizer::insertBuffer*()
jhkim-pii Dec 21, 2025
8a68ff0
rsz: Added a new tcl command `insert_buffer`
jhkim-pii Dec 22, 2025
0dd3a39
odb, rsz: Changed default parameters. Minor fixes
jhkim-pii Dec 22, 2025
2954bf7
rsz: Added new tests insert_buffer.tcl and insert_buffer_hier.tcl
jhkim-pii Dec 22, 2025
411f0f5
test: Updated ORFS mock-array and ram_8x7 rules
jhkim-pii Dec 22, 2025
918297e
rsz: Created two sets of insertBuffer APIs for STA data structure and…
jhkim-pii Dec 22, 2025
8df3dc1
odb, rsz: Changed insert buffer argument name (loads_on_same_net -> l…
jhkim-pii Dec 22, 2025
5158db8
rsz: Added initBlock() and IncrementalParasiticsGuard in Resizer.i
jhkim-pii Dec 22, 2025
56e6e7c
rsz: Moved insert_buffer.md location
jhkim-pii Dec 22, 2025
b1ea6a2
rsz: Removed -load_pin option in insert_buffer command
jhkim-pii Dec 23, 2025
aaf38bf
Merge branch 'master' of https://github.com/The-OpenROAD-Project-priv…
jhkim-pii Dec 23, 2025
8165b6a
dbSta: Resolved a merge conflict
jhkim-pii Dec 23, 2025
1e5e782
Merge branch 'secure-fix-repair-clock-nets' of https://github.com/The…
jhkim-pii Dec 23, 2025
2051cea
Merge branch 'secure-fix-repair-clock-nets' of https://github.com/The…
jhkim-pii Dec 23, 2025
da4a7c7
rsz: Added a via case in Rebuffer::exportBufferTree()
jhkim-pii Dec 23, 2025
20020fa
Merge branch 'secure-fix-repair-clock-nets' of https://github.com/The…
jhkim-pii Dec 23, 2025
bc21dae
odb: Refactored dbInsertBuffer::hierarchicalConnect()
jhkim-pii Dec 23, 2025
1b5361f
odb: Generalized `hierarchicalConnect` API to accept `dbObject*` and …
jhkim-pii Dec 23, 2025
efb7b42
odb: Enhanced rewireBufferLoadPins()
jhkim-pii Dec 24, 2025
18b43f1
odb: Minor change
jhkim-pii Dec 24, 2025
2e475c5
Merge branch 'master' of https://github.com/The-OpenROAD-Project-priv…
jhkim-pii Dec 24, 2025
e547b95
Merge branch 'secure-fix-restore-odb-hash-in-module' of https://githu…
jhkim-pii Dec 24, 2025
0f044a1
Fixed lint issues
jhkim-pii Dec 26, 2025
da4ae41
Rebased OpenROAD/test metrics
jhkim-pii Dec 26, 2025
b8a6bf0
odb: Changed new net naming in insertBuffer*()
jhkim-pii Dec 26, 2025
1df340c
odb: Refactored dbInsertBuffer::stitchLoadToDriver()
jhkim-pii Dec 26, 2025
5e6061e
odb: Minor refactoring
jhkim-pii Dec 26, 2025
09cdfb1
odb: Added a static attribute for debug
jhkim-pii Dec 26, 2025
4f7783a
Optimized RepairDesign::makeRepeater() and Removed debug code for ins…
jhkim-pii Dec 26, 2025
baf373a
odb: Now insertBufferBeforeLoads(.., load_pins_on_diff_net = true) ca…
jhkim-pii Dec 27, 2025
351ad1b
cts: Deployed insertBufferBeforeLoads() in LatencyBalancer
jhkim-pii Dec 27, 2025
eddd5e9
odb:: Added a new overload function dbNet::insertBufferBeforeLoads(st…
jhkim-pii Dec 27, 2025
8f494eb
cts: Fixed a wrong insertBuffer usage in LatencyBalancer
jhkim-pii Dec 27, 2025
603fb4a
cts: Minor change in LatencyBalancer
jhkim-pii Dec 27, 2025
4aeae80
Merge branch 'master' of https://github.com/The-OpenROAD-Project-priv…
jhkim-pii Dec 27, 2025
880f687
Fixed lint issues
jhkim-pii Dec 27, 2025
b33e516
Minor changes
jhkim-pii Dec 27, 2025
6108bc5
Rebased OR flow test - ibex_sky130hd
jhkim-pii Dec 27, 2025
11aa8b6
odb: Refactored based on review feedback
jhkim-pii Dec 29, 2025
67b794d
odb: Refactored based on review feedback 2
jhkim-pii Dec 30, 2025
0cdb575
odb: Refactored based on review feedback 2-1
jhkim-pii Dec 30, 2025
618ea19
Merge branch 'master' of https://github.com/The-OpenROAD-Project-priv…
jhkim-pii Dec 31, 2025
a8d8653
odb, rsz: Refactored based on review feedback 2-2
jhkim-pii Dec 31, 2025
ad41cef
odb: Fixed ODB code generation issue
jhkim-pii Dec 31, 2025
948c9a9
Merge branch 'master' of https://github.com/The-OpenROAD-Project-priv…
jhkim-pii Dec 31, 2025
4fc5c46
Rebased test/orfs/mock-array rules-*.json
jhkim-pii Dec 31, 2025
f9a6aca
Merge branch 'master' of https://github.com/The-OpenROAD-Project-priv…
jhkim-pii Dec 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 50 additions & 77 deletions src/cts/src/LatencyBalancer.cpp

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arthurjolo I deployed the insertBuffer*() in LatencyBalancer.cpp. Could you please review this file?

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "Util.h"
#include "cts/TritonCTS.h"
#include "odb/db.h"
#include "odb/dbObject.h"
#include "odb/dbSet.h"
#include "odb/geom.h"
#include "sta/Clock.hh"
Expand Down Expand Up @@ -496,96 +497,68 @@ odb::dbITerm* LatencyBalancer::insertDelayBuffers(
float offsetY = (float) (loadPinsBbox.yCenter() - srcY) / (numBuffers + 1);

odb::dbInst* returnBuffer = nullptr;
odb::dbInst* lastBuffer = nullptr;

for (int i = 0; i < numBuffers; i++) {
double locX = (double) (srcX + offsetX * (i + 1)) / wireSegmentUnit_;
double locY = (double) (srcY + offsetY * (i + 1)) / wireSegmentUnit_;
// Set the location
double locX = (double) (srcX + (offsetX * (i + 1))) / wireSegmentUnit_;
double locY = (double) (srcY + (offsetY * (i + 1))) / wireSegmentUnit_;
Point<double> bufferLoc(locX, locY);
Point<double> legalBufferLoc
= root_->legalizeOneBuffer(bufferLoc, options_->getRootBuffer());
lastBuffer = createDelayBuffer(drivingNet,
root_->getClock().getSdcName(),
legalBufferLoc.getX() * wireSegmentUnit_,
legalBufferLoc.getY() * wireSegmentUnit_);

drivingNet = lastBuffer->getFirstOutput()->getNet();
odb::Point loc{static_cast<int>(legalBufferLoc.getX() * wireSegmentUnit_),
static_cast<int>(legalBufferLoc.getY() * wireSegmentUnit_)};

// Insert buffer
std::string clkName = root_->getClock().getSdcName();
std::string newNetName
= fmt::format("delaynet_{}_{}", delayBufIndex_, clkName);
std::string newBufferName
= fmt::format("delaybuf_{}_{}", delayBufIndex_++, clkName);
odb::dbMaster* bufferMaster
= db_->findMaster(options_->getRootBuffer().c_str());

odb::dbInst* lastBuffer = nullptr;

// Use load pins buffering at the end
std::set<odb::dbObject*> load_pins;
for (odb::dbITerm* sinkInput : sinksInput) {
load_pins.insert(sinkInput);
}

// load_pins are not connected yet. So this option is required.
bool loads_on_different_nets = true;
lastBuffer = drivingNet->insertBufferBeforeLoads(
load_pins,
bufferMaster,
&loc,
newBufferName.c_str(),
newNetName.c_str(),
odb::dbNameUniquifyType::IF_NEEDED,
loads_on_different_nets);

debugPrint(logger_,
CTS,
"insertion delay",
1,
"new delay buffer {} is inserted at ({} {})",
lastBuffer->getName(),
loc.getX(),
loc.getY());

// Update the driving iterm & net to insert a next buffer on it
odb::dbITerm* drvrPin = lastBuffer->getFirstOutput();
drivingNet = drvrPin->getNet();

// Update return buffer (the first buffer inserted)
if (returnBuffer == nullptr) {
returnBuffer = lastBuffer;
}
}

for (odb::dbITerm* sinkInput : sinksInput) {
sinkInput->connect(drivingNet);
if (network_->hasHierarchy()) {
network_->hierarchicalConnect(lastBuffer->getFirstOutput(),
sinkInput,
drivingNet->getName().c_str());
}
}
return getFirstInput(returnBuffer);
}

// Create a new delay buffer and connect output pin of driver to input pin of
// new buffer. Output pin of new buffer will be connected later.
odb::dbInst* LatencyBalancer::createDelayBuffer(odb::dbNet* driverNet,
const std::string& clockName,
int locX,
int locY)
{
odb::dbBlock* block = db_->getChip()->getBlock();
// creat a new input net
std::string newNetName
= "delaynet_" + std::to_string(delayBufIndex_) + "_" + clockName;

// hierarchy fix, make the net in the right scope
sta::Pin* driver = nullptr;
odb::dbModule* module = network_->getNetDriverParentModule(
network_->dbToSta(driverNet), driver);
if (module == nullptr) {
// if none put in top level
module = block->getTopModule();
}
sta::Instance* scope
= (module == nullptr || (module == block->getTopModule()))
? network_->topInstance()
: (sta::Instance*) (module->getModInst());
odb::dbNet* newNet = network_->staToDb(network_->makeNet(
newNetName.c_str(), scope, odb::dbNameUniquifyType::IF_NEEDED));

newNet->setSigType(odb::dbSigType::CLOCK);

// create a new delay buffer
std::string newBufName
= "delaybuf_" + std::to_string(delayBufIndex_++) + "_" + clockName;
odb::dbMaster* master = db_->findMaster(options_->getRootBuffer().c_str());

// fix: make buffer in same hierarchical module as driver

odb::dbInst* newBuf
= odb::dbInst::create(block, master, newBufName.c_str(), false, module);

newBuf->setSourceType(odb::dbSourceType::TIMING);
newBuf->setLocation(locX, locY);
newBuf->setPlacementStatus(odb::dbPlacementStatus::PLACED);

// connect driver output with new buffer input
odb::dbITerm* newBufOutTerm = newBuf->getFirstOutput();
odb::dbITerm* newBufInTerm = getFirstInput(newBuf);
newBufInTerm->connect(driverNet);
newBufOutTerm->connect(newNet);

debugPrint(logger_,
CTS,
"insertion delay",
1,
"new delay buffer {} is inserted at ({} {})",
newBuf->getName(),
locX,
locY);

return newBuf;
}

bool LatencyBalancer::propagateClock(odb::dbITerm* input)
{
odb::dbInst* inst = input->getInst();
Expand Down
4 changes: 0 additions & 4 deletions src/cts/src/LatencyBalancer.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ class LatencyBalancer
int srcX,
int srcY,
const std::vector<odb::dbITerm*>& sinksInput);
odb::dbInst* createDelayBuffer(odb::dbNet* driverNet,
const std::string& clockName,
int locX,
int locY);
bool propagateClock(odb::dbITerm* input);
bool isSink(odb::dbITerm* iterm);

Expand Down
4 changes: 2 additions & 2 deletions src/cts/test/gated_clock4.ok
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ delta HPWL 44584 %
[INFO CTS-0033] Balancing latency for clock core
[DEBUG CTS-insertion delay] new delay buffer delaybuf_0_core is inserted at (1005383 1975061)
[DEBUG CTS-insertion delay] new delay buffer delaybuf_1_core is inserted at (1004321 1975143)
[DEBUG CTS-insertion delay] new delay buffer delaybuf_2_core is inserted at (1004458 1963273)
[DEBUG CTS-insertion delay] new delay buffer delaybuf_3_core is inserted at (1003836 1964731)
[DEBUG CTS-insertion delay] new delay buffer h1/delaybuf_2_core is inserted at (1004458 1963273)
[DEBUG CTS-insertion delay] new delay buffer h1/delaybuf_3_core is inserted at (1003836 1964731)
[DEBUG CTS-insertion delay] new delay buffer delaybuf_4_core is inserted at (1005080 1979315)
[DEBUG CTS-insertion delay] new delay buffer delaybuf_5_core is inserted at (1005080 1982815)
[DEBUG CTS-insertion delay] new delay buffer delaybuf_6_core is inserted at (1005080 1986315)
Expand Down
26 changes: 13 additions & 13 deletions src/cts/test/gated_clock4.vok
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
module multi_sink (clk);
input clk;

wire delaynet_3_core;
wire clknet_1_1__leaf_clk;
wire clknet_1_0__leaf_clk;
wire gclk1;
wire gclk3;
wire gclk4;
wire gclk4_regs;
wire clknet_0_clk;
wire clknet_1_0__leaf_clk;
wire \clknet_4_0__leaf_h1/gclk5 ;
wire \clknet_4_1__leaf_h1/gclk5 ;
wire \clknet_4_2__leaf_h1/gclk5 ;
Expand Down Expand Up @@ -46,7 +45,6 @@ module multi_sink (clk);
wire clknet_2_3__leaf_gclk1;
wire delaynet_0_core;
wire delaynet_1_core;
wire delaynet_2_core;
wire delaynet_4_core;
wire delaynet_5_core;
wire delaynet_6_core;
Expand All @@ -57,10 +55,6 @@ module multi_sink (clk);
.Z(delaynet_5_core));
CLKBUF_X3 delaybuf_4_core (.A(clknet_0_clk),
.Z(delaynet_4_core));
CLKBUF_X3 delaybuf_3_core (.A(delaynet_2_core),
.Z(delaynet_3_core));
CLKBUF_X3 delaybuf_2_core (.A(clknet_1_0__leaf_clk),
.Z(delaynet_2_core));
CLKBUF_X3 delaybuf_1_core (.A(delaynet_0_core),
.Z(delaynet_1_core));
CLKBUF_X3 delaybuf_0_core (.A(gclk4),
Expand Down Expand Up @@ -247,13 +241,13 @@ module multi_sink (clk);
.GCK(gclk3));
CLKGATE_X1 gclk4 (.CK(clknet_1_0__leaf_clk),
.GCK(gclk4));
hier_block h1 (.delaynet_3_core_i(delaynet_3_core),
.clknet_1_1__leaf_clk_i(clknet_1_1__leaf_clk));
hier_block h1 (.clknet_1_1__leaf_clk_i(clknet_1_1__leaf_clk),
.clknet_1_0__leaf_clk_i(clknet_1_0__leaf_clk));
endmodule
module hier_block (delaynet_3_core_i,
clknet_1_1__leaf_clk_i);
input delaynet_3_core_i;
module hier_block (clknet_1_1__leaf_clk_i,
clknet_1_0__leaf_clk_i);
input clknet_1_1__leaf_clk_i;
input clknet_1_0__leaf_clk_i;

wire gclk2;
wire gclk5;
Expand All @@ -279,7 +273,13 @@ module hier_block (delaynet_3_core_i,
wire \clknet_2_1__leaf_h1/gclk2 ;
wire \clknet_2_2__leaf_h1/gclk2 ;
wire \clknet_2_3__leaf_h1/gclk2 ;
wire delaynet_2_core;
wire delaynet_3_core;

CLKBUF_X3 delaybuf_3_core (.A(delaynet_2_core),
.Z(delaynet_3_core));
CLKBUF_X3 delaybuf_2_core (.A(clknet_1_0__leaf_clk_i),
.Z(delaynet_2_core));
CLKBUF_X3 \clkbuf_2_3__f_h1/gclk2 (.A(\clknet_0_h1/gclk2 ),
.Z(\clknet_2_3__leaf_h1/gclk2 ));
CLKBUF_X3 \clkbuf_2_2__f_h1/gclk2 (.A(\clknet_0_h1/gclk2 ),
Expand Down Expand Up @@ -496,6 +496,6 @@ module hier_block (delaynet_3_core_i,
DFF_X1 ff99 (.CK(\clknet_4_7__leaf_h1/gclk5 ));
CLKGATE_X1 gclk2 (.CK(clknet_1_1__leaf_clk_i),
.GCK(gclk2));
CLKGATE_X1 gclk5 (.CK(delaynet_3_core_i),
CLKGATE_X1 gclk5 (.CK(delaynet_3_core),
.GCK(gclk5));
endmodule
18 changes: 17 additions & 1 deletion src/dbSta/include/db_sta/dbNetwork.hh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class dbNetwork : public ConcreteNetwork
CellPortIterator* portIterator(const Cell* cell) const override;

// Sanity checkers
void checkAxioms(odb::dbObject* obj = nullptr) const;
int checkAxioms(odb::dbObject* obj = nullptr) const;
void checkSanityModBTerms() const;
void checkSanityModITerms() const;
void checkSanityModuleInsts() const;
Expand Down Expand Up @@ -119,6 +119,7 @@ class dbNetwork : public ConcreteNetwork
dbITerm*& iterm,
dbBTerm*& bterm,
dbModITerm*& moditerm) const;
dbObject* staToDb(const Pin* pin) const;

dbNet* staToDb(const Net* net) const;
void staToDb(const Net* net, dbNet*& dnet, dbModNet*& modnet) const;
Expand All @@ -145,6 +146,12 @@ class dbNetwork : public ConcreteNetwork
Pin* dbToSta(dbBTerm* bterm) const;
Term* dbToStaTerm(dbBTerm* bterm) const;
Pin* dbToSta(dbITerm* iterm) const;

///
/// Convert dbObject* to Pin* if it's a terminal type (dbITerm or dbBTerm or
/// dbModITerm)
///
Pin* dbToSta(dbObject* term_obj) const;
Instance* dbToSta(dbInst* inst) const;
Net* dbToSta(dbNet* net) const;
const Net* dbToSta(const dbNet* net) const;
Expand Down Expand Up @@ -187,9 +194,15 @@ class dbNetwork : public ConcreteNetwork
bool isConnected(const Net* net, const Pin* pin) const override;
bool isConnected(const Net* net1, const Net* net2) const override;
bool isConnected(const Pin* source_pin, const Pin* dest_pin) const;

// DEPRECATED.
// - Use dbNet::hierarchicalConnect(dbObject* driver, dbObject* load) instead.
// - The new API can handle both dbBTerm and dbIterm.
void hierarchicalConnect(dbITerm* source_pin,
dbITerm* dest_pin,
const char* connection_name = "net");

// This API is still needed if dbModITerm connection is required.
void hierarchicalConnect(dbITerm* source_pin,
dbModITerm* dest_pin,
const char* connection_name = "net");
Expand Down Expand Up @@ -416,6 +429,9 @@ class dbNetwork : public ConcreteNetwork
bool hasMembers(const Port* port) const override;
Port* findMember(const Port* port, int index) const override;
PortMemberIterator* memberIterator(const Port* port) const override;
PinSet* drivers(const Pin* pin) override;
PinSet* drivers(const Net* net) override;
void removeDriverFromCache(const Net* net);
void removeDriverFromCache(const Net* net, const Pin* drvr);

using Network::cell;
Expand Down
6 changes: 6 additions & 0 deletions src/dbSta/include/db_sta/dbSta.hh
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@ class dbSta : public Sta, public odb::dbDatabaseObserver

BufferUse getBufferUse(sta::LibertyCell* buffer);

// Sanity checkers
int checkSanity();
void checkSanityDrvrVertexEdges(const Pin* pin) const;
void checkSanityDrvrVertexEdges(const odb::dbObject* term) const;
void checkSanityDrvrVertexEdges() const;

using Sta::netSlack;
using Sta::replaceCell;

Expand Down
11 changes: 1 addition & 10 deletions src/dbSta/src/dbEditHierarchy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -622,16 +622,7 @@ std::string dbEditHierarchy::makeUniqueName(dbModule* module,

const char* dbEditHierarchy::getBaseName(const char* connection_name) const
{
// If connect_name contains the hierarchy delimiter, use the partial string
// after the last occurrence of the hierarchy delimiter.
// This prevents a very long term/net name creation when the connection_name
// begins with a back-slash as "\soc/module1/instance_a/.../clk_port"
const char* last_hier_delimiter
= strrchr(connection_name, db_network_->block()->getHierarchyDelimiter());
if (last_hier_delimiter != nullptr) {
return last_hier_delimiter + 1;
}
return connection_name;
return db_network_->block()->getBaseName(connection_name);
}

void dbEditHierarchy::dlogHierConnStart(dbITerm* source_pin,
Expand Down
Loading