1818#include < sstream>
1919#include < stdexcept>
2020#include < string>
21+ #include < string_view>
2122#include < unordered_set>
2223#include < utility>
2324#include < vector>
@@ -733,8 +734,27 @@ void Resizer::reportFastBufferSizes()
733734{
734735 resizePreamble ();
735736
737+ // Sort fast buffers by capacitance and then by name.
738+ std::vector<LibertyCell*> buffers{buffer_fast_sizes_.begin (),
739+ buffer_fast_sizes_.end ()};
740+ std::sort (buffers.begin (),
741+ buffers.end (),
742+ [=](const LibertyCell* a, const LibertyCell* b) {
743+ LibertyPort* scratch;
744+ LibertyPort* in_a;
745+ LibertyPort* in_b;
746+
747+ a->bufferPorts (in_a, scratch);
748+ b->bufferPorts (in_b, scratch);
749+
750+ return std::make_pair (in_a->capacitance (),
751+ std::string_view (a->name ()))
752+ < std::make_pair (in_b->capacitance (),
753+ std::string_view (b->name ()));
754+ });
755+
736756 logger_->report (" \n Fast Buffer Report:" );
737- logger_->report (" There are {} fast buffers" , buffer_fast_sizes_ .size ());
757+ logger_->report (" There are {} fast buffers" , buffers .size ());
738758 logger_->report (" {:->80}" , " " );
739759 logger_->report (
740760 " Cell Area Input Intrinsic "
@@ -743,7 +763,7 @@ void Resizer::reportFastBufferSizes()
743763 " Cap Delay Res" );
744764 logger_->report (" {:->80}" , " " );
745765
746- for (auto size : buffer_fast_sizes_ ) {
766+ for (auto size : buffers ) {
747767 LibertyPort *in, *out;
748768 size->bufferPorts (in, out);
749769 logger_->report (" {:<41} {:>7.1f} {:>7.1e} {:>7.1e} {:>7.1f}" ,
0 commit comments