Skip to content

Commit

Permalink
mpl2: reorganize
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
  • Loading branch information
AcKoucher committed Nov 3, 2024
1 parent 78ad6cc commit 6376457
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
4 changes: 1 addition & 3 deletions src/mpl2/src/SACoreSoftMacro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ void SACoreSoftMacro::run()
= best_valid_result_->macro_id_to_width.at(macro_id);

if (macro.isMacroCluster()) {
const float area = macro.getArea();
const float valid_result_height = area / valid_result_width;
const float valid_result_height = macro.getArea() / valid_result_width;
macro.setShapeF(valid_result_width, valid_result_height);
} else {
macro.setWidth(valid_result_width);
Expand Down Expand Up @@ -1148,7 +1147,6 @@ void SACoreSoftMacro::addBlockages(const std::vector<Rect>& blockages)
blockages_.insert(blockages_.end(), blockages.begin(), blockages.end());
}

// Only when using the SoftMacro SACore for cluster placement.
void SACoreSoftMacro::attemptCentralization(const float pre_cost)
{
if (outline_penalty_ > 0) {
Expand Down
8 changes: 5 additions & 3 deletions src/mpl2/src/SACoreSoftMacro.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ class SACoreSoftMacro : public SimulatedAnnealingCore<SoftMacro>
};

private:
void attemptCentralization(float pre_cost);
void moveFloorplan(const std::pair<float, float>& offset);

float getAreaPenalty() const;
float calNormCost() const override;
void calPenalty() override;
Expand All @@ -132,6 +129,11 @@ class SACoreSoftMacro : public SimulatedAnnealingCore<SoftMacro>
void calBoundaryPenalty();
void calNotchPenalty();
void calMacroBlockagePenalty();

// Only for Cluster Placement:
void attemptCentralization(float pre_cost);
void moveFloorplan(const std::pair<float, float>& offset);

std::vector<Rect> blockages_;

Cluster* root_;
Expand Down
3 changes: 0 additions & 3 deletions src/mpl2/src/SimulatedAnnealingCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,9 +639,6 @@ void SimulatedAnnealingCore<T>::fastSA()
calPenalty();
}

// The same sequence pair can represent different floorplan depending
// on the shape of each cluster, so, to ensure that a result is truly
// the one we're looking for, we need toalso keep its shapes.
template <class T>
void SimulatedAnnealingCore<T>::updateBestValidResult()
{
Expand Down
4 changes: 3 additions & 1 deletion src/mpl2/src/SimulatedAnnealingCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,12 @@ class SimulatedAnnealingCore
virtual void fillDeadSpace() = 0;

protected:
// The same sequence pair can represent different floorplan
// arrangements depending on the macros' shapes.
struct Result
{
SequencePair sequence_pair;
std::map<int, float> macro_id_to_width; // Result's shapes.
std::map<int, float> macro_id_to_width; // Macros' shapes.
};

void initSequencePair();
Expand Down

0 comments on commit 6376457

Please sign in to comment.