Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/mpl/src/SimulatedAnnealingCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ void SimulatedAnnealingCore<T>::fastSA()
notch_weight_ = 0.0;

if (isValid()) {
updateBestValidResult();
updateBestValidResult(cost);
}

while (step <= max_num_step_) {
Expand All @@ -729,7 +729,7 @@ void SimulatedAnnealingCore<T>::fastSA()
= cost < pre_cost
|| best_valid_result_.sequence_pair.pos_sequence.empty();
if (isValid() && keep_result) {
updateBestValidResult();
updateBestValidResult(cost);
}

delta_cost = cost - pre_cost;
Expand Down Expand Up @@ -763,13 +763,14 @@ void SimulatedAnnealingCore<T>::fastSA()
}
calPenalty();

if (!isValid() && !best_valid_result_.sequence_pair.pos_sequence.empty()) {
if (!best_valid_result_.sequence_pair.pos_sequence.empty()
&& (!isValid() || best_valid_result_.cost < calNormCost())) {
useBestValidResult();
}
}

template <class T>
void SimulatedAnnealingCore<T>::updateBestValidResult()
void SimulatedAnnealingCore<T>::updateBestValidResult(const float cost)
{
best_valid_result_.sequence_pair.pos_sequence = pos_seq_;
best_valid_result_.sequence_pair.neg_sequence = neg_seq_;
Expand All @@ -780,6 +781,8 @@ void SimulatedAnnealingCore<T>::updateBestValidResult()
best_valid_result_.macro_id_to_width[macro_id] = macro.getWidth();
}
}

best_valid_result_.cost = cost;
}

template <class T>
Expand Down
3 changes: 2 additions & 1 deletion src/mpl/src/SimulatedAnnealingCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class SimulatedAnnealingCore
protected:
struct Result
{
float cost{std::numeric_limits<float>::max()};
SequencePair sequence_pair;
// [Only for SoftMacro] The same sequence pair can represent different
// floorplan arrangements depending on the macros' shapes.
Expand All @@ -102,7 +103,7 @@ class SimulatedAnnealingCore
const BoundaryRegionList& regions);
void initSequencePair();
void setDieArea(const Rect& die_area);
void updateBestValidResult();
void updateBestValidResult(float cost);
void useBestValidResult();

virtual float calNormCost() const = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/mpl/test/boundary_push2.defok
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ TRACKS Y 140 DO 282 STEP 3200 LAYER metal9 ;
TRACKS X 190 DO 282 STEP 3200 LAYER metal10 ;
TRACKS Y 140 DO 282 STEP 3200 LAYER metal10 ;
COMPONENTS 54 ;
- MACRO_1 HM_100x100_1x1 + FIXED ( 600 221810 ) S ;
- MACRO_2 HM_100x100_1x1 + FIXED ( 600 20770 ) FS ;
- MACRO_1 HM_100x100_1x1 + FIXED ( 600 20770 ) S ;
- MACRO_2 HM_100x100_1x1 + FIXED ( 600 221810 ) FS ;
- MACRO_3 HM_100x100_1x1 + FIXED ( 239440 221810 ) FS ;
- MACRO_4 HM_100x100_1x1 + FIXED ( 239440 20770 ) FS ;
- _001_ DFF_X1 + PLACED ( 15591 18600 ) N ;
Expand Down
4 changes: 2 additions & 2 deletions src/mpl/test/boundary_push3.defok
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ TRACKS Y 140 DO 282 STEP 3200 LAYER metal9 ;
TRACKS X 190 DO 282 STEP 3200 LAYER metal10 ;
TRACKS Y 140 DO 282 STEP 3200 LAYER metal10 ;
COMPONENTS 54 ;
- MACRO_1 HM_100x100_1x1 + FIXED ( 220620 610 ) S ;
- MACRO_1 HM_100x100_1x1 + FIXED ( 220620 241970 ) S ;
- MACRO_2 HM_100x100_1x1 + FIXED ( 19420 241970 ) FS ;
- MACRO_3 HM_100x100_1x1 + FIXED ( 19420 610 ) FS ;
- MACRO_4 HM_100x100_1x1 + FIXED ( 220620 241970 ) FS ;
- MACRO_4 HM_100x100_1x1 + FIXED ( 220620 610 ) FS ;
- _001_ DFF_X1 + PLACED ( 15590 18601 ) N ;
- _002_ DFF_X1 + PLACED ( 15590 18601 ) N ;
- _003_ DFF_X1 + PLACED ( 15590 18601 ) N ;
Expand Down
Loading