Skip to content

Commit

Permalink
Return average expansion for easier reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
Coloquinte committed Nov 6, 2023
1 parent 4a869b6 commit 9ace7c4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
5 changes: 3 additions & 2 deletions pycoloquinte/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,15 +317,16 @@ Construct a circuit.
.def("expand_cells_by_factor", &Circuit::expandCellsByFactor,
py::arg("expansion_factor"), py::arg("max_density") = 1.0,
py::arg("row_side_margin") = 0.0,
"Expand the standard cells by an individual factor")
"Expand the standard cells by an individual factor, up to a maximum "
"density")
.def("compute_cell_expansion", &Circuit::computeCellExpansion,
py::arg("congestion_map"), py::arg("fixed_penalty") = 0.0,
py::arg("penalty_factor") = 1.0,
"Compute an expansion factor given a congestion map")
.def("check", &Circuit::check, "Check the datastructure")
.def("report", &Circuit::report)
.def("export_ispd", &Circuit::exportIspd,
"Export the circuit to ISPD benchmark files")
py::arg("filename") "Export the circuit to ISPD benchmark files")
.def("__str__", &Circuit::toString)
.def("__repr__", &Circuit::toString);
}
6 changes: 4 additions & 2 deletions src/coloquinte.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,8 @@ void Circuit::expandCellsToDensity(double targetDensity, double rowSideMargin) {
}
}

void Circuit::expandCellsByFactor(const std::vector<float> &expansionFactor,
double maxDensity, double rowSideMargin) {
double Circuit::expandCellsByFactor(const std::vector<float> &expansionFactor,
double maxDensity, double rowSideMargin) {
// Setup the target expansion if not done explicitly
if ((int)expansionFactor.size() != nbCells()) {
throw std::runtime_error(
Expand Down Expand Up @@ -724,6 +724,8 @@ void Circuit::expandCellsByFactor(const std::vector<float> &expansionFactor,
cellWidth_[i] *= expansion[i];
}
}

return expandedDensity / density;
}

std::vector<float> Circuit::computeCellExpansion(
Expand Down
7 changes: 5 additions & 2 deletions src/coloquinte.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1014,9 +1014,12 @@ class Circuit {
* will be adjusted to not go over this.
* @param rowSideMargin Margin applied to each row before computing available
* area, in standard cell heights.
*
* @return Average expansion
*/
void expandCellsByFactor(const std::vector<float> &expansionFactor,
double maxDensity = 1.0, double rowSideMargin = 0.0);
double expandCellsByFactor(const std::vector<float> &expansionFactor,
double maxDensity = 1.0,
double rowSideMargin = 0.0);

/*
* TODO: find a way that the expansion could happen on both sides (cleaner),
Expand Down

0 comments on commit 9ace7c4

Please sign in to comment.