Skip to content

Commit 880921f

Browse files
refactor to use debugPrint for debug msgs
Signed-off-by: Ravi Varadarajan <[email protected]>
1 parent b6cdbf5 commit 880921f

File tree

2 files changed

+142
-62
lines changed

2 files changed

+142
-62
lines changed

src/mpl2/src/SACoreHardMacro.cpp

Lines changed: 61 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "utl/Logger.h"
3737

3838
namespace mpl2 {
39+
using utl::MPL;
3940

4041
//////////////////////////////////////////////////////////////////
4142
// Class SACoreHardMacro
@@ -276,30 +277,68 @@ void SACoreHardMacro::initialize()
276277

277278
void SACoreHardMacro::printResults()
278279
{
279-
logger_->report(std::string(80, '*'));
280-
logger_->report("SACoreHardMacro");
281-
logger_->report("number of macros : {}", macros_.size());
280+
debugPrint(logger_, MPL, "macro_placement", 1, "SACoreHardMacro");
281+
debugPrint(logger_,
282+
MPL,
283+
"macro_placement",
284+
1,
285+
"number of macros : {}",
286+
macros_.size());
282287
for (auto macro : macros_) {
283-
logger_->report("lx = {}, ly = {}, width = {}, height = {}",
284-
macro.getX(),
285-
macro.getY(),
286-
macro.getWidth(),
287-
macro.getHeight());
288+
debugPrint(logger_,
289+
MPL,
290+
"macro_placement",
291+
1,
292+
"lx = {}, ly = {}, width = {}, height = {}",
293+
macro.getX(),
294+
macro.getY(),
295+
macro.getWidth(),
296+
macro.getHeight());
288297
}
289-
logger_->report("width = {}, outline_width = {}", width_, outline_width_);
290-
logger_->report("height = {}, outline_height = {}", height_, outline_height_);
291-
logger_->report("outline_penalty = {}, norm_outline_penalty = {}",
292-
outline_penalty_,
293-
norm_outline_penalty_);
294-
logger_->report(
295-
"wirelength = {}, norm_wirelength = {}", wirelength_, norm_wirelength_);
296-
logger_->report("guidance_penalty = {}, norm_guidance_penalty = {}",
297-
guidance_penalty_,
298-
norm_guidance_penalty_);
299-
logger_->report("fence_penalty = {}, norm_fence_penalty = {}",
300-
fence_penalty_,
301-
norm_fence_penalty_);
302-
logger_->report("final cost = {}", getNormCost());
298+
debugPrint(logger_,
299+
MPL,
300+
"macro_placement",
301+
1,
302+
"width = {}, outline_width = {}",
303+
width_,
304+
outline_width_);
305+
debugPrint(logger_,
306+
MPL,
307+
"macro_placement",
308+
1,
309+
"height = {}, outline_height = {}",
310+
height_,
311+
outline_height_);
312+
debugPrint(logger_,
313+
MPL,
314+
"macro_placement",
315+
1,
316+
"outline_penalty = {}, norm_outline_penalty = {}",
317+
outline_penalty_,
318+
norm_outline_penalty_);
319+
debugPrint(logger_,
320+
MPL,
321+
"macro_placement",
322+
1,
323+
"wirelength = {}, norm_wirelength = {}",
324+
wirelength_,
325+
norm_wirelength_);
326+
debugPrint(logger_,
327+
MPL,
328+
"macro_placement",
329+
1,
330+
"guidance_penalty = {}, norm_guidance_penalty = {}",
331+
guidance_penalty_,
332+
norm_guidance_penalty_);
333+
debugPrint(logger_,
334+
MPL,
335+
"macro_placement",
336+
1,
337+
"fence_penalty = {}, norm_fence_penalty = {}",
338+
fence_penalty_,
339+
norm_fence_penalty_);
340+
debugPrint(
341+
logger_, MPL, "macro_placement", 1, "final cost = {}", getNormCost());
303342
}
304343

305344
} // namespace mpl2

src/mpl2/src/SACoreSoftMacro.cpp

Lines changed: 81 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "utl/Logger.h"
3737

3838
namespace mpl2 {
39+
using utl::MPL;
3940

4041
//////////////////////////////////////////////////////////////////
4142
// Class SACoreSoftMacro
@@ -752,51 +753,91 @@ void SACoreSoftMacro::shrink()
752753

753754
void SACoreSoftMacro::printResults() const
754755
{
755-
logger_->report(std::string(80, '*'));
756-
logger_->report("SACoreSoftMacro");
757-
logger_->report("number of macros : {}", macros_.size());
756+
debugPrint(logger_, MPL, "macro_placement", 1, "SACoreSoftMacro");
757+
debugPrint(logger_,
758+
MPL,
759+
"macro_placement",
760+
1,
761+
"number of macros : {}",
762+
macros_.size());
758763
for (auto macro : macros_)
759-
logger_->report("lx = {}, ly = {}, width = {}, height = {}, name = {}",
760-
macro.getX(),
761-
macro.getY(),
762-
macro.getWidth(),
763-
macro.getHeight(),
764-
macro.getName());
765-
logger_->report("width = {}, outline_width = {}", width_, outline_width_);
766-
logger_->report("height = {}, outline_height = {}", height_, outline_height_);
767-
logger_->report(
764+
debugPrint(logger_,
765+
MPL,
766+
"macro_placement",
767+
1,
768+
"lx = {}, ly = {}, width = {}, height = {}, name = {}",
769+
macro.getX(),
770+
macro.getY(),
771+
macro.getWidth(),
772+
macro.getHeight(),
773+
macro.getName());
774+
debugPrint(logger_,
775+
MPL,
776+
"macro_placement",
777+
1,
778+
"width = {}, outline_width = {}",
779+
width_,
780+
outline_width_);
781+
debugPrint(logger_,
782+
MPL,
783+
"macro_placement",
784+
1,
785+
"height = {}, outline_height = {}",
786+
height_,
787+
outline_height_);
788+
debugPrint(
789+
logger_,
790+
MPL,
791+
"macro_placement",
792+
1,
768793
"outline_weight = {}, outline_penalty = {}, norm_outline_penalty = {}",
769794
outline_weight_,
770795
outline_penalty_,
771796
norm_outline_penalty_);
772-
logger_->report(
773-
"wirelength_weight = {}, wirelength = {}, norm_wirelength = {}",
774-
wirelength_weight_,
775-
wirelength_,
776-
norm_wirelength_);
777-
logger_->report(
778-
"guidance_weight = {}, guidance_penalty = {}, norm_guidance_penalty = "
779-
"{}",
780-
guidance_weight_,
781-
guidance_penalty_,
782-
norm_guidance_penalty_);
783-
logger_->report(
784-
"fence_weight = {}, fence_penalty = {}, norm_fence_penalty = {}",
785-
fence_weight_,
786-
fence_penalty_,
787-
norm_fence_penalty_);
788-
logger_->report(
789-
"macro_blockage_weight = {}, macro_blockage_penalty = {}, "
790-
"norm_macro_blockage_penalty = {}",
791-
macro_blockage_weight_,
792-
macro_blockage_penalty_,
793-
norm_macro_blockage_penalty_);
794-
logger_->report(
795-
"notch_weight = {}, notch_penalty = {}, norm_notch_penalty = {}",
796-
notch_weight_,
797-
notch_penalty_,
798-
norm_notch_penalty_);
799-
logger_->report("final cost = {}", getNormCost());
797+
debugPrint(logger_,
798+
MPL,
799+
"macro_placement",
800+
1,
801+
"wirelength_weight = {}, wirelength = {}, norm_wirelength = {}",
802+
wirelength_weight_,
803+
wirelength_,
804+
norm_wirelength_);
805+
debugPrint(logger_,
806+
MPL,
807+
"macro_placement",
808+
1,
809+
"guidance_weight = {}, guidance_penalty = {}, "
810+
"norm_guidance_penalty = {}",
811+
guidance_weight_,
812+
guidance_penalty_,
813+
norm_guidance_penalty_);
814+
debugPrint(logger_,
815+
MPL,
816+
"macro_placement",
817+
1,
818+
"fence_weight = {}, fence_penalty = {}, norm_fence_penalty = {}",
819+
fence_weight_,
820+
fence_penalty_,
821+
norm_fence_penalty_);
822+
debugPrint(logger_,
823+
MPL,
824+
"macro_placement",
825+
1,
826+
"macro_blockage_weight = {}, macro_blockage_penalty = {}, "
827+
"norm_macro_blockage_penalty = {}",
828+
macro_blockage_weight_,
829+
macro_blockage_penalty_,
830+
norm_macro_blockage_penalty_);
831+
debugPrint(logger_,
832+
MPL,
833+
"macro_placement",
834+
1,
835+
"notch_weight = {}, notch_penalty = {}, norm_notch_penalty = {}",
836+
notch_weight_,
837+
notch_penalty_,
838+
norm_notch_penalty_);
839+
debugPrint(
840+
logger_, MPL, "macro_placement", 1, "final cost = {}", getNormCost());
800841
}
801842

802843
// fill the dead space by adjust the size of MixedCluster

0 commit comments

Comments
 (0)