@@ -283,12 +283,13 @@ void GCell::print(utl::Logger* logger, bool print_only_name = true) const
283283 }
284284}
285285
286- void GCell::writeAttributesToCSV (std::ostream& out) const {
287- out << " ," << insts_.size () << " ," << gPins_ .size ();
288- out << " ," << lx_ << " ," << ly_ << " ," << ux_ << " ," << uy_;
289- out << " ," << dLx_ << " ," << dLy_ << " ," << dUx_ << " ," << dUy_;
290- out << " ," << densityScale_ << " ," << gradientX_ << " ," << gradientY_;
291- }
286+ void GCell::writeAttributesToCSV (std::ostream& out) const
287+ {
288+ out << " ," << insts_.size () << " ," << gPins_ .size ();
289+ out << " ," << lx_ << " ," << ly_ << " ," << ux_ << " ," << uy_;
290+ out << " ," << dLx_ << " ," << dLy_ << " ," << dUx_ << " ," << dUy_;
291+ out << " ," << densityScale_ << " ," << gradientX_ << " ," << gradientY_;
292+ }
292293
293294// //////////////////////////////////////////////
294295// GNet
@@ -659,22 +660,22 @@ int BinGrid::dy() const
659660{
660661 return (uy_ - ly_);
661662}
662- int BinGrid::binCntX () const
663+ int BinGrid::getBinCntX () const
663664{
664665 return binCntX_;
665666}
666667
667- int BinGrid::binCntY () const
668+ int BinGrid::getBinCntY () const
668669{
669670 return binCntY_;
670671}
671672
672- double BinGrid::binSizeX () const
673+ double BinGrid::getBinSizeX () const
673674{
674675 return binSizeX_;
675676}
676677
677- double BinGrid::binSizeY () const
678+ double BinGrid::getBinSizeY () const
678679{
679680 return binSizeY_;
680681}
@@ -930,10 +931,11 @@ void BinGrid::updateBinsGCellDensityArea(const std::vector<GCellHandle>& cells)
930931 + static_cast <float >(bin.getNonPlaceArea ()) - scaledBinArea);
931932 sumOverflowArea_ += overflowArea; // NOLINT
932933
933- const float overflowAreaUnscaled = std::max (
934- 0 .0f ,
935- static_cast <float >(bin.getInstPlacedAreaUnscaled ())
936- + static_cast <float >(bin.getNonPlaceAreaUnscaled ()) - scaledBinArea);
934+ const float overflowAreaUnscaled
935+ = std::max (0 .0f ,
936+ static_cast <float >(bin.getInstPlacedAreaUnscaled ())
937+ + static_cast <float >(bin.getNonPlaceAreaUnscaled ())
938+ - scaledBinArea);
937939 sumOverflowAreaUnscaled_ += overflowAreaUnscaled;
938940 if (overflowAreaUnscaled > 0 ) {
939941 debugPrint (log_,
@@ -1736,8 +1738,10 @@ NesterovBase::NesterovBase(NesterovBaseVars nbVars,
17361738 bg_.initBins ();
17371739
17381740 // initialize fft structrue based on bins
1739- std::unique_ptr<FFT> fft (
1740- new FFT (bg_.binCntX (), bg_.binCntY (), bg_.binSizeX (), bg_.binSizeY ()));
1741+ std::unique_ptr<FFT> fft (new FFT (bg_.getBinCntX (),
1742+ bg_.getBinCntY (),
1743+ bg_.getBinSizeX (),
1744+ bg_.getBinSizeY ()));
17411745
17421746 fft_ = std::move (fft);
17431747
@@ -1987,22 +1991,22 @@ void NesterovBase::setTargetDensity(float density)
19871991
19881992int NesterovBase::getBinCntX () const
19891993{
1990- return bg_.binCntX ();
1994+ return bg_.getBinCntX ();
19911995}
19921996
19931997int NesterovBase::getBinCntY () const
19941998{
1995- return bg_.binCntY ();
1999+ return bg_.getBinCntY ();
19962000}
19972001
1998- double NesterovBase::binSizeX () const
2002+ double NesterovBase::getBinSizeX () const
19992003{
2000- return bg_.binSizeX ();
2004+ return bg_.getBinSizeX ();
20012005}
20022006
2003- double NesterovBase::binSizeY () const
2007+ double NesterovBase::getBinSizeY () const
20042008{
2005- return bg_.binSizeY ();
2009+ return bg_.getBinSizeY ();
20062010}
20072011
20082012int64_t NesterovBase::getOverflowArea () const
@@ -2035,18 +2039,18 @@ int64_t NesterovBase::getFillerCellArea() const
20352039 return static_cast <int64_t >(fillerDx_) * static_cast <int64_t >(fillerDy_);
20362040}
20372041
2038- GCell& NesterovBase::getFillerGCell (size_t index)
2039- {
2040- if (index >= fillerStor_.size ()) {
2041- log_->error (
2042- utl::GPL,
2043- 314 ,
2044- " getFillerGCell: index {} out of bounds (fillerStor_.size() = {})." ,
2045- index,
2046- fillerStor_.size ());
2047- }
2048- return fillerStor_[index];
2042+ GCell& NesterovBase::getFillerGCell (size_t index)
2043+ {
2044+ if (index >= fillerStor_.size ()) {
2045+ log_->error (
2046+ utl::GPL,
2047+ 314 ,
2048+ " getFillerGCell: index {} out of bounds (fillerStor_.size() = {})." ,
2049+ index,
2050+ fillerStor_.size ());
20492051 }
2052+ return fillerStor_[index];
2053+ }
20502054
20512055int64_t NesterovBase::getWhiteSpaceArea () const
20522056{
@@ -2075,7 +2079,7 @@ float NesterovBase::getSumPhi() const
20752079 return sumPhi_;
20762080}
20772081
2078- float NesterovBase::uniformTargetDensity () const
2082+ float NesterovBase::getUniformTargetDensity () const
20792083{
20802084 return uniformTargetDensity_;
20812085}
@@ -2099,19 +2103,19 @@ void NesterovBase::updateDensitySize()
20992103 auto & gCell = *it; // old-style loop for old OpenMP
21002104 float scaleX = 0 , scaleY = 0 ;
21012105 float densitySizeX = 0 , densitySizeY = 0 ;
2102- if (gCell ->dx () < REPLACE_SQRT2 * bg_.binSizeX ()) {
2106+ if (gCell ->dx () < REPLACE_SQRT2 * bg_.getBinSizeX ()) {
21032107 scaleX = static_cast <float >(gCell ->dx ())
2104- / static_cast <float >(REPLACE_SQRT2 * bg_.binSizeX ());
2105- densitySizeX = REPLACE_SQRT2 * static_cast <float >(bg_.binSizeX ());
2108+ / static_cast <float >(REPLACE_SQRT2 * bg_.getBinSizeX ());
2109+ densitySizeX = REPLACE_SQRT2 * static_cast <float >(bg_.getBinSizeX ());
21062110 } else {
21072111 scaleX = 1.0 ;
21082112 densitySizeX = gCell ->dx ();
21092113 }
21102114
2111- if (gCell ->dy () < REPLACE_SQRT2 * bg_.binSizeY ()) {
2115+ if (gCell ->dy () < REPLACE_SQRT2 * bg_.getBinSizeY ()) {
21122116 scaleY = static_cast <float >(gCell ->dy ())
2113- / static_cast <float >(REPLACE_SQRT2 * bg_.binSizeY ());
2114- densitySizeY = REPLACE_SQRT2 * static_cast <float >(bg_.binSizeY ());
2117+ / static_cast <float >(REPLACE_SQRT2 * bg_.getBinSizeY ());
2118+ densitySizeY = REPLACE_SQRT2 * static_cast <float >(bg_.getBinSizeY ());
21152119 } else {
21162120 scaleY = 1.0 ;
21172121 densitySizeY = gCell ->dy ();
@@ -2310,8 +2314,9 @@ void NesterovBase::initDensity1()
23102314 // FFT update
23112315 updateDensityForceBin ();
23122316
2313- baseWireLengthCoef_ = npVars_->initWireLengthCoef
2314- / (static_cast <float >(binSizeX () + binSizeY ()) * 0.5 );
2317+ baseWireLengthCoef_
2318+ = npVars_->initWireLengthCoef
2319+ / (static_cast <float >(getBinSizeX () + getBinSizeY ()) * 0.5 );
23152320
23162321 sumOverflow_ = static_cast <float >(getOverflowArea ())
23172322 / static_cast <float >(getNesterovInstsArea ());
@@ -2871,11 +2876,11 @@ bool NesterovBase::checkConvergence()
28712876
28722877 if (static_cast <double >(getNesterovInstsArea ()) / (whiteSpaceArea_ * 0.50 )
28732878 <= 1.0 ) {
2874- log_->info (
2875- GPL ,
2876- 1009 ,
2877- " - For 50% usage of free space: {:.4f} " ,
2878- static_cast < double >( getNesterovInstsArea ()) / (whiteSpaceArea_ * 0.50 ));
2879+ log_->info (GPL,
2880+ 1009 ,
2881+ " - For 50% usage of free space: {:.4f} " ,
2882+ static_cast < double >( getNesterovInstsArea ())
2883+ / (whiteSpaceArea_ * 0.50 ));
28792884 }
28802885
28812886 if (uniformTargetDensity_ > 0 .95f ) {
@@ -3010,19 +3015,19 @@ void NesterovBase::updateGCellState(float wlCoeffX, float wlCoeffY)
30103015 // analogous to NesterovBase::updateDensitySize()
30113016 float scaleX = 0 , scaleY = 0 ;
30123017 float densitySizeX = 0 , densitySizeY = 0 ;
3013- if (gcell->dx () < REPLACE_SQRT2 * bg_.binSizeX ()) {
3018+ if (gcell->dx () < REPLACE_SQRT2 * bg_.getBinSizeX ()) {
30143019 scaleX = static_cast <float >(gcell->dx ())
3015- / static_cast <float >(REPLACE_SQRT2 * bg_.binSizeX ());
3016- densitySizeX = REPLACE_SQRT2 * static_cast <float >(bg_.binSizeX ());
3020+ / static_cast <float >(REPLACE_SQRT2 * bg_.getBinSizeX ());
3021+ densitySizeX = REPLACE_SQRT2 * static_cast <float >(bg_.getBinSizeX ());
30173022 } else {
30183023 scaleX = 1.0 ;
30193024 densitySizeX = gcell->dx ();
30203025 }
30213026
3022- if (gcell->dy () < REPLACE_SQRT2 * bg_.binSizeY ()) {
3027+ if (gcell->dy () < REPLACE_SQRT2 * bg_.getBinSizeY ()) {
30233028 scaleY = static_cast <float >(gcell->dy ())
3024- / static_cast <float >(REPLACE_SQRT2 * bg_.binSizeY ());
3025- densitySizeY = REPLACE_SQRT2 * static_cast <float >(bg_.binSizeY ());
3029+ / static_cast <float >(REPLACE_SQRT2 * bg_.getBinSizeY ());
3030+ densitySizeY = REPLACE_SQRT2 * static_cast <float >(bg_.getBinSizeY ());
30263031 } else {
30273032 scaleY = 1.0 ;
30283033 densitySizeY = gcell->dy ();
@@ -3548,7 +3553,8 @@ void NesterovBaseCommon::destroyCbkGNet(odb::dbNet* db_net)
35483553 std::swap (gNetStor_ [index_remove], gNetStor_ [last_index]);
35493554
35503555 // Update index map for the swapped net
3551- odb::dbNet* swapped_net = gNetStor_ [index_remove].getPbNets ()[0 ]->getDbNet ();
3556+ odb::dbNet* swapped_net
3557+ = gNetStor_ [index_remove].getPbNets ()[0 ]->getDbNet ();
35523558 db_net_to_index_map_[swapped_net] = index_remove;
35533559 }
35543560
@@ -3573,7 +3579,8 @@ void NesterovBaseCommon::destroyCbkITerm(odb::dbITerm* db_iterm)
35733579 }
35743580 if (index_remove != last_index) {
35753581 std::swap (gPinStor_ [index_remove], gPinStor_ [last_index]);
3576- odb::dbITerm* swapped_iterm = gPinStor_ [index_remove].getPbPin ()->getDbITerm ();
3582+ odb::dbITerm* swapped_iterm
3583+ = gPinStor_ [index_remove].getPbPin ()->getDbITerm ();
35773584 db_iterm_to_index_map_[swapped_iterm] = index_remove;
35783585 }
35793586 gPinStor_ .pop_back ();
@@ -3689,6 +3696,20 @@ void NesterovBaseCommon::printGPins()
36893696 }
36903697}
36913698
3699+ void NesterovBase::appendGCellCSVNote (const std::string& filename,
3700+ int iteration,
3701+ const std::string& message) const
3702+ {
3703+ std::ofstream file (filename, std::ios::app);
3704+ if (!file.is_open ()) {
3705+ log_->report (" Could not open CSV file for appending message: {}" , filename);
3706+ return ;
3707+ }
3708+
3709+ file << " # NOTE @ iteration " << iteration << " : " << message << " \n " ;
3710+ file.close ();
3711+ }
3712+
36923713void NesterovBase::writeGCellVectorsToCSV (const std::string& filename,
36933714 int iteration,
36943715 bool write_header) const
0 commit comments