Skip to content

Commit c7e2850

Browse files
committed
Merge remote-tracking branch 'private/master' into gui-tcl-worst-path-image
2 parents d0a4618 + 0f7807e commit c7e2850

File tree

108 files changed

+9044
-7311
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+9044
-7311
lines changed

src/Exception-py.i

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
#ifdef BAZEL
55
%{
66

7-
#include <boost/stacktrace.hpp>
87
#include <cstdlib>
98
#include <sstream>
109

10+
#include "boost/stacktrace/stacktrace.hpp"
1111
#include "utl/Logger.h"
1212
%}
1313
#else
1414
%{
15-
16-
#include <boost/stacktrace.hpp>
15+
1716
#include <cstdlib>
1817
#include <sstream>
1918

19+
#include "boost/stacktrace/stacktrace.hpp"
2020
#include "ord/OpenRoad.hh"
2121
#include "utl/Logger.h"
2222
%}

src/Exception.i

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
// Copied from OpenSTA/tcl/Exception.i
22
// Copyright (c) 2021, Parallax Software, Inc.
3-
//
3+
//
44
// This program is free software: you can redistribute it and/or modify
55
// it under the terms of the GNU General Public License as published by
66
// the Free Software Foundation, either version 3 of the License, or
77
// (at your option) any later version.
8-
//
8+
//
99
// This program is distributed in the hope that it will be useful,
1010
// but WITHOUT ANY WARRANTY; without even the implied warranty of
1111
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1212
// GNU General Public License for more details.
13-
//
13+
//
1414
// You should have received a copy of the GNU General Public License
1515
// along with this program. If not, see <https://www.gnu.org/licenses/>.
1616

1717
%{
18-
#include <boost/stacktrace.hpp>
1918
#include <cstdlib>
2019
#include <new>
2120
#include <sstream>
2221

22+
#include "boost/stacktrace/stacktrace.hpp"
2323
#include "ord/OpenRoad.hh"
2424
#include "utl/Logger.h"
2525
%}

src/cts/include/cts/TritonCTS.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,10 @@ class TritonCTS
8181
void setSinkBuffer(const char* buffers);
8282

8383
private:
84-
bool isClockCellCandidate(sta::LibertyCell* cell);
8584
std::string selectRootBuffer(std::vector<std::string>& buffers);
8685
std::string selectSinkBuffer(std::vector<std::string>& buffers);
8786
std::string selectBestMaxCapBuffer(const std::vector<std::string>& buffers,
8887
float totalCap);
89-
void inferBufferList(std::vector<std::string>& buffers);
9088
TreeBuilder* addBuilder(CtsOptions* options,
9189
Clock& net,
9290
odb::dbNet* topInputNet,

src/cts/src/TritonCTS.cpp

Lines changed: 8 additions & 174 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,10 @@ void TritonCTS::setBufferList(const char* buffers)
660660
std::vector<std::string> bufferList(begin, end);
661661
// If the vector is empty, then the buffers are inferred
662662
if (bufferList.empty()) {
663-
inferBufferList(bufferList);
663+
const char* lib_name
664+
= options_->isCtsLibrarySet() ? options_->getCtsLibrary() : nullptr;
665+
resizer_->inferClockBufferList(lib_name, bufferList);
666+
options_->setBufferListInferred(true);
664667
} else {
665668
// Iterate the user-defined buffer list
666669
sta::Vector<sta::LibertyCell*> selected_buffers;
@@ -684,169 +687,6 @@ void TritonCTS::setBufferList(const char* buffers)
684687
options_->setBufferList(bufferList);
685688
}
686689

687-
void TritonCTS::inferBufferList(std::vector<std::string>& buffers)
688-
{
689-
sta::Vector<sta::LibertyCell*> selected_buffers;
690-
691-
// first, look for buffers with "is_clock_cell: true" cell attribute
692-
sta::LibertyLibraryIterator* lib_iter = network_->libertyLibraryIterator();
693-
while (lib_iter->hasNext()) {
694-
sta::LibertyLibrary* lib = lib_iter->next();
695-
if (options_->isCtsLibrarySet()
696-
&& strcmp(lib->name(), options_->getCtsLibrary()) != 0) {
697-
continue;
698-
}
699-
for (sta::LibertyCell* buffer : *lib->buffers()) {
700-
if (buffer->isClockCell() && isClockCellCandidate(buffer)) {
701-
// "is_clock_cell: true"
702-
selected_buffers.emplace_back(buffer);
703-
debugPrint(logger_,
704-
CTS,
705-
"buffering",
706-
1,
707-
"{} has clock cell attribute",
708-
buffer->name());
709-
}
710-
}
711-
}
712-
delete lib_iter;
713-
714-
// second, look for buffers with an input port that has
715-
// LEF USE as "CLOCK"
716-
if (selected_buffers.empty()) {
717-
sta::LibertyLibraryIterator* lib_iter = network_->libertyLibraryIterator();
718-
while (lib_iter->hasNext()) {
719-
sta::LibertyLibrary* lib = lib_iter->next();
720-
if (options_->isCtsLibrarySet()
721-
&& strcmp(lib->name(), options_->getCtsLibrary()) != 0) {
722-
continue;
723-
}
724-
for (sta::LibertyCell* buffer : *lib->buffers()) {
725-
odb::dbMaster* master = db_->findMaster(buffer->name());
726-
for (odb::dbMTerm* mterm : master->getMTerms()) {
727-
if (mterm->getIoType() == odb::dbIoType::INPUT
728-
&& mterm->getSigType() == odb::dbSigType::CLOCK
729-
&& isClockCellCandidate(buffer)) {
730-
// input port with LEF USE as "CLOCK"
731-
selected_buffers.emplace_back(buffer);
732-
debugPrint(logger_,
733-
CTS,
734-
"buffering",
735-
1,
736-
"{} has input port {} with LEF USE as CLOCK",
737-
buffer->name(),
738-
mterm->getName());
739-
}
740-
}
741-
}
742-
}
743-
delete lib_iter;
744-
}
745-
746-
// third, look for all buffers with name CLKBUF or clkbuf
747-
if (selected_buffers.empty()) {
748-
sta::PatternMatch patternClkBuf(".*CLKBUF.*",
749-
/* is_regexp */ true,
750-
/* nocase */ true,
751-
/* Tcl_interp* */ nullptr);
752-
sta::LibertyLibraryIterator* lib_iter = network_->libertyLibraryIterator();
753-
while (lib_iter->hasNext()) {
754-
sta::LibertyLibrary* lib = lib_iter->next();
755-
if (options_->isCtsLibrarySet()
756-
&& strcmp(lib->name(), options_->getCtsLibrary()) != 0) {
757-
continue;
758-
}
759-
for (sta::LibertyCell* buffer :
760-
lib->findLibertyCellsMatching(&patternClkBuf)) {
761-
if (buffer->isBuffer() && isClockCellCandidate(buffer)) {
762-
debugPrint(logger_,
763-
CTS,
764-
"buffering",
765-
1,
766-
"{} found by 'CLKBUF' pattern match",
767-
buffer->name());
768-
selected_buffers.emplace_back(buffer);
769-
}
770-
}
771-
}
772-
delete lib_iter;
773-
}
774-
775-
// fourth, look for all buffers with name BUF or buf
776-
if (selected_buffers.empty()) {
777-
sta::PatternMatch patternBuf(".*BUF.*",
778-
/* is_regexp */ true,
779-
/* nocase */ true,
780-
/* Tcl_interp* */ nullptr);
781-
lib_iter = network_->libertyLibraryIterator();
782-
while (lib_iter->hasNext()) {
783-
sta::LibertyLibrary* lib = lib_iter->next();
784-
if (options_->isCtsLibrarySet()
785-
&& strcmp(lib->name(), options_->getCtsLibrary()) != 0) {
786-
continue;
787-
}
788-
for (sta::LibertyCell* buffer :
789-
lib->findLibertyCellsMatching(&patternBuf)) {
790-
if (buffer->isBuffer() && isClockCellCandidate(buffer)) {
791-
debugPrint(logger_,
792-
CTS,
793-
"buffering",
794-
1,
795-
"{} found by 'BUF' pattern match",
796-
buffer->name());
797-
selected_buffers.emplace_back(buffer);
798-
}
799-
}
800-
}
801-
delete lib_iter;
802-
}
803-
804-
// abandon attributes & name patterns, just look for all buffers
805-
if (selected_buffers.empty()) {
806-
debugPrint(logger_,
807-
CTS,
808-
"buffering",
809-
1,
810-
"No buffers with clock atributes or name patterns found, using "
811-
"all buffers");
812-
lib_iter = network_->libertyLibraryIterator();
813-
while (lib_iter->hasNext()) {
814-
sta::LibertyLibrary* lib = lib_iter->next();
815-
if (options_->isCtsLibrarySet()
816-
&& strcmp(lib->name(), options_->getCtsLibrary()) != 0) {
817-
continue;
818-
}
819-
for (sta::LibertyCell* buffer : *lib->buffers()) {
820-
if (isClockCellCandidate(buffer)) {
821-
selected_buffers.emplace_back(buffer);
822-
}
823-
}
824-
}
825-
delete lib_iter;
826-
827-
if (selected_buffers.empty()) {
828-
logger_->error(
829-
CTS,
830-
110,
831-
"No clock buffer candidates could be found from any libraries.");
832-
}
833-
}
834-
835-
resizer_->setClockBuffersList(selected_buffers);
836-
837-
for (sta::LibertyCell* buffer : selected_buffers) {
838-
buffers.emplace_back(buffer->name());
839-
debugPrint(logger_,
840-
CTS,
841-
"buffering",
842-
1,
843-
"{} has been inferred as clock buffer",
844-
buffer->name());
845-
}
846-
847-
options_->setBufferListInferred(true);
848-
}
849-
850690
std::string toLowerCase(std::string str)
851691
{
852692
std::transform(str.begin(), str.end(), str.begin(), [](unsigned char c) {
@@ -855,12 +695,6 @@ std::string toLowerCase(std::string str)
855695
return str;
856696
}
857697

858-
bool TritonCTS::isClockCellCandidate(sta::LibertyCell* cell)
859-
{
860-
return (!cell->dontUse() && !resizer_->dontUse(cell) && !cell->alwaysOn()
861-
&& !cell->isIsolationCell() && !cell->isLevelShifter());
862-
}
863-
864698
std::string TritonCTS::getRootBufferToString()
865699
{
866700
std::ostringstream buffer_names;
@@ -2557,7 +2391,7 @@ void TritonCTS::findCandidateDummyCells(
25572391
while (lib_iter->hasNext()) {
25582392
sta::LibertyLibrary* lib = lib_iter->next();
25592393
for (sta::LibertyCell* inv : *lib->inverters()) {
2560-
if (inv->isClockCell() && isClockCellCandidate(inv)) {
2394+
if (inv->isClockCell() && resizer_->isClockCellCandidate(inv)) {
25612395
inverters.emplace_back(inv);
25622396
dummyCandidates.emplace_back(inv);
25632397
}
@@ -2576,7 +2410,7 @@ void TritonCTS::findCandidateDummyCells(
25762410
sta::LibertyLibrary* lib = lib_iter->next();
25772411
for (sta::LibertyCell* inv :
25782412
lib->findLibertyCellsMatching(&patternClkInv)) {
2579-
if (inv->isInverter() && isClockCellCandidate(inv)) {
2413+
if (inv->isInverter() && resizer_->isClockCellCandidate(inv)) {
25802414
inverters.emplace_back(inv);
25812415
dummyCandidates.emplace_back(inv);
25822416
}
@@ -2595,7 +2429,7 @@ void TritonCTS::findCandidateDummyCells(
25952429
while (lib_iter->hasNext()) {
25962430
sta::LibertyLibrary* lib = lib_iter->next();
25972431
for (sta::LibertyCell* inv : lib->findLibertyCellsMatching(&patternInv)) {
2598-
if (inv->isInverter() && isClockCellCandidate(inv)) {
2432+
if (inv->isInverter() && resizer_->isClockCellCandidate(inv)) {
25992433
inverters.emplace_back(inv);
26002434
dummyCandidates.emplace_back(inv);
26012435
}
@@ -2610,7 +2444,7 @@ void TritonCTS::findCandidateDummyCells(
26102444
while (lib_iter->hasNext()) {
26112445
sta::LibertyLibrary* lib = lib_iter->next();
26122446
for (sta::LibertyCell* inv : *lib->inverters()) {
2613-
if (isClockCellCandidate(inv)) {
2447+
if (resizer_->isClockCellCandidate(inv)) {
26142448
inverters.emplace_back(inv);
26152449
dummyCandidates.emplace_back(inv);
26162450
}

0 commit comments

Comments
 (0)