Skip to content

Commit

Permalink
make it an option to disable cell orientation flipping
Browse files Browse the repository at this point in the history
  • Loading branch information
Yang-Yihang committed Jul 15, 2023
1 parent 886f6ff commit 61abc8f
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 5 deletions.
2 changes: 2 additions & 0 deletions dali/application/dali_standalone.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ int main(int argc, char *argv[]) {
}
} else if (arg == "-disable_welltap") {
config_set_int("dali.disable_welltap", 1);
} else if (arg == "-disable_cell_flip"){
config_set_int("dali.disable_cell_flip", 1);
} else if (arg == "-disable_io_place") {
config_set_int("dali.disable_io_place", 1);
} else if (arg == "-export_well_cluster_matlab") {
Expand Down
7 changes: 7 additions & 0 deletions dali/dali.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ void Dali::LoadParamsFromConfig() {
disable_welltap_ = config_get_int(param_name.c_str()) == 1;
}

param_name = prefix_ + "disable_cell_flip";
if (config_exists(param_name.c_str())) {
disable_cell_flip_ = config_get_int(param_name.c_str()) == 1;
}

param_name = prefix_ + "max_row_width";
if (config_exists(param_name.c_str())) {
max_row_width_ = config_get_real(param_name.c_str());
Expand Down Expand Up @@ -355,10 +360,12 @@ bool Dali::StartPlacement(double density, int number_of_threads) {
if (!disable_legalization_) {
if (is_standard_cell_) {
legalizer_.TakeOver(&gb_placer_);
legalizer_.disable_cell_flip_ = disable_cell_flip_,
legalizer_.StartPlacement();
} else {
well_legalizer_.TakeOver(&gb_placer_);
well_legalizer_.disable_welltap_ = disable_welltap_;
well_legalizer_.disable_cell_flip_ = disable_cell_flip_,
well_legalizer_.SetStripePartitionMode(static_cast<int>(well_legalization_mode_));
well_legalizer_.StartPlacement();
if (export_well_cluster_matlab_) {
Expand Down
1 change: 1 addition & 0 deletions dali/dali.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class Dali {
int io_metal_layer_ = 0;
bool export_well_cluster_matlab_ = false;
bool disable_welltap_ = false;
bool disable_cell_flip_ = false;
double max_row_width_ = 0;
bool is_standard_cell_ = false;
bool enable_filler_cell_ = false;
Expand Down
8 changes: 8 additions & 0 deletions dali/placer/legalizer/LGTetrisEx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,11 @@ bool LGTetrisEx::IsFitToRow(int row_id, Block &block) const {
}

bool LGTetrisEx::ShouldOrientN(int row_id, Block &block) const {
// if cell flip is disabled, then cell orientation is always N
if (disable_cell_flip_) {
return true;
}

auto well_ptr = block.TypePtr()->WellPtr();
bool is_gnd_bottom = true;
if (well_ptr == nullptr) {
Expand Down Expand Up @@ -1123,6 +1128,9 @@ bool LGTetrisEx::StartPlacement() {
if (is_success) {
ExportRowsToCircuit();
}

// TODO: local reordering

PrintEndStatement("LGTetrisEx Legalization", is_success);

return true;
Expand Down
2 changes: 2 additions & 0 deletions dali/placer/legalizer/LGTetrisEx.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ class LGTetrisEx : public Placer {

bool legalize_from_left_;

bool disable_cell_flip_ = false;

size_t cur_iter_;
size_t max_iter_;

Expand Down
14 changes: 9 additions & 5 deletions dali/placer/well_legalizer/stdclusterwelllegalizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1022,11 +1022,15 @@ bool StdClusterWellLegalizer::StartPlacement() {
//circuit_ptr_->GenMATLABWellTable("clu", false);
//GenMatlabClusterTable("clu_result");

BOOST_LOG_TRIVIAL(info) << "Flip cluster orientation\n";
UpdateClusterOrient();
ReportHPWL();
//circuit_ptr_->GenMATLABWellTable("ori", false);
//GenMatlabClusterTable("ori_result");
if (disable_cell_flip_) {
BOOST_LOG_TRIVIAL(info) << "Skip flipping cluster orientation\n";
} else {
BOOST_LOG_TRIVIAL(info) << "Flip cluster orientation\n";
UpdateClusterOrient();
ReportHPWL();
//circuit_ptr_->GenMATLABWellTable("ori", false);
//GenMatlabClusterTable("ori_result");
}

BOOST_LOG_TRIVIAL(info) << "Perform local reordering\n";
for (int i = 0; i < 6; ++i) {
Expand Down
3 changes: 3 additions & 0 deletions dali/placer/well_legalizer/stdclusterwelllegalizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ class StdClusterWellLegalizer : public Placer {
int well_tap_cell_width_;
int well_spacing_;

/**** cell orientation ****/
bool disable_cell_flip_ = false;

/**** stripe parameters ****/
int stripe_mode_ = 0;
DefaultSpacePartitioner space_partitioner_;
Expand Down

0 comments on commit 61abc8f

Please sign in to comment.