@@ -942,18 +942,23 @@ std::vector<TechChar::SolutionData> TechChar::createPatterns(
942942 // can be placed and...
943943 // ...the number of topologies (combinations of buffers, considering only 1
944944 // drive) that can exist.
945+
945946 const unsigned numberOfNodes
946947 = setupWirelength / options_->getWireSegmentUnit ();
947948 const unsigned numberOfTopologies = 1 << numberOfNodes;
948949 std::vector<SolutionData> topologiesVector;
949950 odb::dbNet* net = nullptr ;
950951 // clang-format off
951- debugPrint (logger_, CTS, " tech char" , 1 , " createPatterns WL:{} #nodes: {}"
952- " #topo: {}" , setupWirelength, numberOfNodes, numberOfTopologies);
952+ debugPrint (logger_, CTS, " tech char" , 1 , " * createPatterns for #nodes = {}"
953+ " #topologies = {}" , setupWirelength, numberOfNodes, numberOfTopologies);
953954 // clang-format on
954955 // For each possible topology...
955956 for (unsigned solutionCounterInt = 0 ; solutionCounterInt < numberOfTopologies;
956957 solutionCounterInt++) {
958+ debugPrint (
959+ logger_, CTS, " tech char" , 1 , " **topology {}" , solutionCounterInt + 1 );
960+ std::stringstream tmp;
961+ tmp << " ***IN " ;
957962 // Creates a bitset that represents the buffer locations.
958963 const std::bitset<5 > solutionCounter (solutionCounterInt);
959964 int wireCounter = 0 ;
@@ -983,20 +988,24 @@ std::vector<TechChar::SolutionData> TechChar::createPatterns(
983988 // Not a buffer, only a wire segment.
984989 nodesWithoutBuf++;
985990 // clang-format off
986- debugPrint (logger_, CTS, " tech char" , 1 , " wire at node:{} topo: {}" ,
991+ debugPrint (logger_, CTS, " tech char" , 2 , " *** wire at node : {}" ,
987992 nodeIndex, solutionCounterInt);
988993 // clang-format on
989994 } else {
990995 // Buffer, need to create the instance and a new net.
991996 nodesWithoutBuf++;
997+ for (int i = 0 ; i < nodesWithoutBuf - 1 ; i++) {
998+ tmp << " -- " ;
999+ }
1000+ tmp << " -> " ;
9921001 // Creates a new buffer instance.
9931002 const std::string bufName = fmt::format (" buf_{}_{}_{}" ,
9941003 setupWirelength,
9951004 solutionCounter.to_string (),
9961005 wireCounter);
9971006 // clang-format off
998- debugPrint (logger_, CTS, " tech char" , 1 , " buffer {} at node:{} "
999- " topo:{} " , bufName, nodeIndex, solutionCounterInt);
1007+ debugPrint (logger_, CTS, " tech char" , 2 , " *** buffer {} at node : {} "
1008+ , bufName, nodeIndex, solutionCounterInt);
10001009 // clang-format on
10011010 odb::dbInst* bufInstance
10021011 = odb::dbInst::create (charBlock_, charBuf_, bufName.c_str ());
@@ -1020,11 +1029,6 @@ std::vector<TechChar::SolutionData> TechChar::createPatterns(
10201029 // Updates the topology wih the new instance and the current topology
10211030 // (as a vector of strings).
10221031 topology.instVector .push_back (bufInstance);
1023- // clang-format off
1024- debugPrint (logger_, CTS, " tech char" , 1 , " topo instVector size:{} "
1025- " node:{} topo:{}" , topology.instVector .size (), nodeIndex,
1026- solutionCounterInt);
1027- // clang-format on
10281032 topology.topologyDescriptor .push_back (
10291033 std::to_string (nodesWithoutBuf * options_->getWireSegmentUnit ()));
10301034 topology.topologyDescriptor .push_back (charBuf_->getName ());
@@ -1041,6 +1045,11 @@ std::vector<TechChar::SolutionData> TechChar::createPatterns(
10411045 odb::dbBPin* outPortPin = odb::dbBPin::create (outPort);
10421046 // Updates the topology with the output port, old new, possible instances
10431047 // and other attributes.
1048+ for (int i = 0 ; i < nodesWithoutBuf; i++) {
1049+ tmp << " -- " ;
1050+ }
1051+ tmp << " OUT" ;
1052+ debugPrint (logger_, CTS, " tech char" , 1 , tmp.str ());
10441053 topology.outPort = outPortPin;
10451054 if (isPureWire) {
10461055 topology.instVector .push_back (nullptr );
@@ -1194,7 +1203,7 @@ TechChar::ResultData TechChar::computeTopologyResults(
11941203 const float pinArrival = openStaChar_->vertexArrival (
11951204 outPinVert, sta::RiseFall::fall (), charPathAnalysis_);
11961205 results.pinArrival = pinArrival;
1197- // Computations for output slew.
1206+ // Computations for output slew. Avg of rise and fall slew.
11981207 const float pinRise = openStaChar_->vertexSlew (
11991208 outPinVert, sta::RiseFall::rise (), sta::MinMax::max ());
12001209 const float pinFall = openStaChar_->vertexSlew (
@@ -1333,7 +1342,7 @@ void TechChar::updateBufferTopologies(TechChar::SolutionData& solution)
13331342 odb::dbInst* inst = solution.instVector [nodeIndex];
13341343 inst->swapMaster (newMaster);
13351344 // clang-format off
1336- debugPrint (logger_, CTS, " tech char" , 1 , " **updateBufferTopologies swap "
1345+ debugPrint (logger_, CTS, " tech char" , 1 , " *** updateBufferTopologies swap "
13371346 " from {} to {}, index:{}" , oldMaster->getName (),
13381347 newMaster->getName (), nodeIndex);
13391348 // clang-format on
@@ -1344,6 +1353,10 @@ void TechChar::updateBufferTopologies(TechChar::SolutionData& solution)
13441353
13451354std::vector<size_t > TechChar::getCurrConfig (const SolutionData& solution)
13461355{
1356+ if (solution.isPureWire ) {
1357+ debugPrint (logger_, CTS, " tech char" , 1 , " **currConfig is a pure wire" );
1358+ return {};
1359+ }
13471360 std::vector<size_t > config;
13481361 for (auto inst : solution.instVector ) {
13491362 size_t masterID = cellNameToID (inst->getMaster ()->getName ());
@@ -1352,11 +1365,11 @@ std::vector<size_t> TechChar::getCurrConfig(const SolutionData& solution)
13521365
13531366 if (logger_->debugCheck (CTS, " tech char" , 1 )) {
13541367 std::stringstream tmp;
1355- tmp << " currConfig: " ;
1368+ tmp << " ** currConfig: " ;
13561369 for (unsigned i : config) {
13571370 tmp << i << " " ;
13581371 }
1359- logger_-> report ( tmp.str ());
1372+ debugPrint (logger_, CTS, " tech char " , 1 , tmp.str ());
13601373 }
13611374 return config;
13621375}
@@ -1368,7 +1381,7 @@ size_t TechChar::cellNameToID(const std::string& masterName)
13681381 return std::distance (masterNames_.begin (), masterIter);
13691382}
13701383
1371- // Find a buffer config that is monotonic from current buffer config
1384+ // Find a buffer config that is monotonic from current buffer config.
13721385std::vector<size_t > TechChar::getNextConfig (
13731386 const std::vector<size_t >& currConfig)
13741387{
@@ -1392,11 +1405,11 @@ std::vector<size_t> TechChar::getNextConfig(
13921405
13931406 if (logger_->debugCheck (CTS, " tech char" , 1 )) {
13941407 std::stringstream tmp;
1395- tmp << " nextConfig: " ;
1408+ tmp << " ** nextConfig: " ;
13961409 for (unsigned i : nextConfig) {
13971410 tmp << i << " " ;
13981411 }
1399- logger_-> report ( tmp.str ());
1412+ debugPrint (logger_, CTS, " tech char " , 1 , tmp.str ());
14001413 }
14011414
14021415 return nextConfig;
@@ -1426,15 +1439,15 @@ void TechChar::swapTopologyBuffer(SolutionData& solution,
14261439 topologyIndex++) {
14271440 const std::string topologyS = solution.topologyDescriptor [topologyIndex];
14281441 // clang-format off
1429- debugPrint (logger_, CTS, " tech char" , 1 , " **topo:{} topoIdx:{}" ,
1442+ debugPrint (logger_, CTS, " tech char" , 1 , " *** topo:{} topoIdx:{}" ,
14301443 topologyS, topologyIndex);
14311444 // clang-format on
14321445 if (!(std::find (masterNames_.begin (), masterNames_.end (), topologyS)
14331446 == masterNames_.end ())) {
14341447 if (topologyCounter == nodeIndex) {
14351448 solution.topologyDescriptor [topologyIndex] = newMasterName;
14361449 // clang-format off
1437- debugPrint (logger_, CTS, " tech char" , 1 , " **soln topo descript at "
1450+ debugPrint (logger_, CTS, " tech char" , 1 , " *** soln topo descript at "
14381451 " {} set to {}" , topologyIndex, newMasterName);
14391452 // clang-format on
14401453 break ;
@@ -1561,6 +1574,8 @@ void TechChar::create()
15611574 int64_t topologiesCreated = 0 ;
15621575 for (unsigned setupWirelength : wirelengthsToTest_) {
15631576 // Creates the topologies for the current wirelength.
1577+ debugPrint (
1578+ logger_, CTS, " tech char" , 1 , " Wirelength = {}" , setupWirelength);
15641579 std::vector<SolutionData> topologiesVector
15651580 = createPatterns (setupWirelength);
15661581 // Creates an OpenSTA instance.
@@ -1572,9 +1587,8 @@ void TechChar::create()
15721587 int topoIndex = 0 ;
15731588 for (SolutionData solution : topologiesVector) {
15741589 // clang-format off
1575- debugPrint (logger_, CTS, " tech char" , 1 , " create WL:{} of {}, "
1576- " topo:{} of {}" , setupWirelength, wirelengthsToTest_.size (),
1577- topoIndex, topologiesVector.size ());
1590+ debugPrint (logger_, CTS, " tech char" , 1 , " *genrate combinations for "
1591+ " topology: {} of {}" , topoIndex + 1 , topologiesVector.size ());
15781592 // clang-format on
15791593 topoIndex++;
15801594 // Gets the input and output port (as terms, pins and vertices).
@@ -1610,15 +1624,15 @@ void TechChar::create()
16101624 r1,
16111625 c1,
16121626 piExists);
1627+
1628+ // clang-format off
1629+ debugPrint (logger_, CTS, " tech char" , 1 , " *# bufs = {}; "
1630+ " # nodes with buf = {}" ,
1631+ masterNames_.size (), solution.instVector .size ());
1632+ // clang-format on
16131633 // For each possible buffer combination (different sizes).
16141634 unsigned buffersUpdate
16151635 = getBufferingCombo (masterNames_.size (), solution.instVector .size ());
1616- // clang-format off
1617- debugPrint (logger_, CTS, " tech char" , 1 , " create #bufs={} "
1618- " #soln.instVector.size={}, #bufUpdate={}, #topo={}" ,
1619- masterNames_.size (), solution.instVector .size (),
1620- buffersUpdate, topologiesCreated);
1621- // clang-format on
16221636
16231637 if (buffersUpdate == 0 ) {
16241638 continue ;
@@ -1737,14 +1751,15 @@ void TechChar::create()
17371751unsigned TechChar::getBufferingCombo (size_t numBuffers, size_t numNodes)
17381752{
17391753 // check if this has been computed already
1740- std::stringstream tmp;
17411754 std::pair iPair (numBuffers, numNodes);
17421755 auto iter = bufferingComboTable_.find (iPair);
17431756 if (iter != bufferingComboTable_.end ()) {
1744- if (logger_->debugCheck (CTS, " tech char" , 1 )) {
1745- tmp << " Monotonic entries (hashed): " << iter->second << ' \n ' ;
1746- logger_->report (tmp.str ());
1747- }
1757+ debugPrint (logger_,
1758+ CTS,
1759+ " tech char" ,
1760+ 1 ,
1761+ " **Monotonic entries are already hashed: {}" ,
1762+ iter->second );
17481763 return iter->second ;
17491764 }
17501765
@@ -1762,6 +1777,8 @@ unsigned TechChar::getBufferingCombo(size_t numBuffers, size_t numNodes)
17621777
17631778 unsigned numMonotonic = 0 ;
17641779 for (const auto & row : matrix) {
1780+ std::stringstream tmp;
1781+ tmp << " **" ;
17651782 for (size_t val : row) {
17661783 if (logger_->debugCheck (CTS, " tech char" , 1 )) {
17671784 tmp << val << " " ;
@@ -1773,15 +1790,10 @@ unsigned TechChar::getBufferingCombo(size_t numBuffers, size_t numNodes)
17731790 }
17741791 numMonotonic++;
17751792 }
1776- if (logger_->debugCheck (CTS, " tech char" , 1 )) {
1777- logger_->report (tmp.str ());
1778- }
1779- }
1780- if (logger_->debugCheck (CTS, " tech char" , 1 )) {
1781- tmp << " Monotonic entries: " << numMonotonic;
1782- logger_->report (tmp.str ());
1793+ debugPrint (logger_, CTS, " tech char" , 1 , tmp.str ());
17831794 }
1784-
1795+ debugPrint (
1796+ logger_, CTS, " tech char" , 1 , " **Monotonic entries: {}" , numMonotonic);
17851797 // insert new result into hash table
17861798 bufferingComboTable_[iPair] = numMonotonic;
17871799 return numMonotonic;
0 commit comments