Skip to content

Commit

Permalink
Merge pull request #5990 from AcKoucher/mpl2-check-extra-layers-snap
Browse files Browse the repository at this point in the history
mpl2: don't move macro if all layers are already snapped
  • Loading branch information
maliberty authored Oct 21, 2024
2 parents 2b28607 + 8fb2c04 commit 3ec79f8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
12 changes: 9 additions & 3 deletions src/mpl2/src/hier_rtlmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4621,9 +4621,15 @@ void Snapper::attemptSnapToExtraLayers(
bool all_layers_snapped = false;

while (remaining_attempts > 0) {
// Move one track ahead.
new_origin += snap_layer_params.pitch;
setOrigin(new_origin, target_direction);
const bool is_first_attempt = remaining_attempts == total_attempts;
// The pins may already be aligned for all extra layers (in that case,
// we don't need to move the macro at all), hence, we use the first
// attempt to check if there are in fact any extra layers to snap.
if (!is_first_attempt) {
// Move one track ahead.
new_origin += snap_layer_params.pitch;
setOrigin(new_origin, target_direction);
}

int curr_number_of_snapped_layers = 1;
for (const auto [layer, pin] : layers_data.layer_to_pin) {
Expand Down
11 changes: 2 additions & 9 deletions src/odb/src/zutil/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,20 +259,13 @@ std::string generateMacroPlacementString(dbBlock* block)
{
std::string macro_placement;

const float dbu = block->getTech()->getDbUnitsPerMicron();
float x = 0.0f;
float y = 0.0f;

for (odb::dbInst* inst : block->getInsts()) {
if (inst->isBlock()) {
x = (inst->getLocation().x()) / dbu;
y = (inst->getLocation().y()) / dbu;

macro_placement += fmt::format(
"place_macro -macro_name {} -location {{{} {}}} -orientation {}\n",
inst->getName(),
x,
y,
block->dbuToMicrons(inst->getLocation().x()),
block->dbuToMicrons(inst->getLocation().y()),
inst->getOrient().getString());
}
}
Expand Down

0 comments on commit 3ec79f8

Please sign in to comment.