diff --git a/src/mpl/src/hier_rtlmp.cpp b/src/mpl/src/hier_rtlmp.cpp index 1512bc545f0..8b4a6a1ff72 100644 --- a/src/mpl/src/hier_rtlmp.cpp +++ b/src/mpl/src/hier_rtlmp.cpp @@ -294,6 +294,11 @@ void HierRTLMP::blockMacroChannels() void HierRTLMP::init() { block_ = db_->getChip()->getBlock(); + // Each rtl_macro_placer call starts from a fresh hierarchy: a completed + // run releases the previous one in clear(), and a call that found no + // macro to place must not skip placement in the next one. + tree_ = std::make_unique(); + skip_macro_placement_ = false; clustering_engine_ = std::make_unique( block_, logger_, tritonpart_, graphics_.get()); diff --git a/src/mpl/test/BUILD b/src/mpl/test/BUILD index f9d21dce41a..a10b27a0131 100644 --- a/src/mpl/test/BUILD +++ b/src/mpl/test/BUILD @@ -48,11 +48,17 @@ COMPULSORY_TESTS = [ "orientation_improve3", "place_macro_right_angle_rotation", "placement_blockages1", + "rerun1", "unfixed_cells_dont_fit_in_core", ] ALL_TESTS = COMPULSORY_TESTS +# Self-checking: the script reports pass/fail, no golden log. +PASSFAIL_TESTS = [ + "rerun1", +] + filegroup( name = "regression_resources", # Dependencies could be specified more narrowly per test case, @@ -243,6 +249,10 @@ filegroup( "testcases/macro_only.lef", "testcases/placement_blockages1.def", ], + "rerun1": [ + "testcases/fixed_macros1.def", + "testcases/orientation_improve1.lef", + ], "unfixed_cells_dont_fit_in_core": [ "testcases/macro_only.lef", "testcases/unfixed_cells_dont_fit_in_core.def", @@ -256,6 +266,8 @@ filegroup( [ regression_test( name = test_name, + check_log = test_name not in PASSFAIL_TESTS, + check_passfail = test_name in PASSFAIL_TESTS, data = [":" + test_name + "_resources"], tags = [] if test_name in COMPULSORY_TESTS else ["manual"], visibility = ["//visibility:public"], diff --git a/src/mpl/test/CMakeLists.txt b/src/mpl/test/CMakeLists.txt index 27ab6943cd9..c8f9650244d 100644 --- a/src/mpl/test/CMakeLists.txt +++ b/src/mpl/test/CMakeLists.txt @@ -38,6 +38,8 @@ or_integration_tests( halos2 halos3 halos4 + PASSFAIL_TESTS + rerun1 ) diff --git a/src/mpl/test/rerun1.tcl b/src/mpl/test/rerun1.tcl new file mode 100644 index 00000000000..e04c7e29200 --- /dev/null +++ b/src/mpl/test/rerun1.tcl @@ -0,0 +1,26 @@ +# rtl_macro_placer called more than once in one session places what is +# unfixed each time: after a call that found every macro fixed, and after +# a completed run. +source "helpers.tcl" + +read_lef "./Nangate45/Nangate45.lef" +read_lef "./testcases/orientation_improve1.lef" + +read_def "./testcases/fixed_macros1.def" + +set_thread_count 0 +set macro [[ord::get_db_block] findInst MACRO_2] + +$macro setPlacementStatus FIRM +rtl_macro_placer -report_directory [make_result_dir] + +$macro setPlacementStatus PLACED +rtl_macro_placer -report_directory [make_result_dir] +check "placed after a call with nothing to place" \ + { $macro getPlacementStatus } LOCKED + +$macro setPlacementStatus PLACED +rtl_macro_placer -report_directory [make_result_dir] +check "placed after a completed run" { $macro getPlacementStatus } LOCKED + +exit_summary