Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drt: PA minor refactoring #5744

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
26 changes: 21 additions & 5 deletions src/drt/src/pa/FlexPA.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ class FlexPA
bool allow_via,
frAccessPointEnum lower_type,
frAccessPointEnum upper_type);

bool enclosesOnTrackPlanarAccess(const gtl::rectangle_data<frCoord>& rect,
frLayerNum layer_num);

Expand Down Expand Up @@ -389,8 +390,8 @@ class FlexPA
frLayerNum layer_num,
frDirEnum dir,
bool is_block);
template <typename T>

template <typename T>
void check_addViaAccess(
frAccessPoint* ap,
const std::vector<gtl::polygon_90_data<frCoord>>& layer_polys,
Expand All @@ -399,7 +400,6 @@ class FlexPA
T* pin,
frInstTerm* inst_term,
bool deep_search = false);
template <typename T>

/**
* @brief Checks if a Via Access Point is legal
Expand All @@ -412,13 +412,13 @@ class FlexPA
*
* @return If the Via Access Point is legal
*/
template <typename T>
bool checkViaAccess(
frAccessPoint* ap,
frVia* via,
T* pin,
frInstTerm* inst_term,
const std::vector<gtl::polygon_90_data<frCoord>>& layer_polys);
template <typename T>

/**
* @brief Checks if a the Via Access can be subsequently accesses from the
Expand All @@ -433,20 +433,20 @@ class FlexPA
*
* @return If an access from that direction causes no DRV
*/
template <typename T>
bool checkDirectionalViaAccess(
frAccessPoint* ap,
frVia* via,
T* pin,
frInstTerm* inst_term,
const std::vector<gtl::polygon_90_data<frCoord>>& layer_polys,
frDirEnum dir);
template <typename T>

template <typename T>
void updatePinStats(
const std::vector<std::unique_ptr<frAccessPoint>>& tmp_aps,
T* pin,
frInstTerm* inst_term);
template <typename T>

/**
* @brief initializes the accesses of a given pin but only considered
Expand All @@ -462,6 +462,22 @@ class FlexPA
*
* @return if the initialization was sucessful
*/

/**
* @brief initializes the accesses of a given pin but only considered
* acccesses costed bounded between lower and upper cost.
*
* @param aps access points of the pin
* @param apset data of the access points (auxilary)
* @param pin_shapes shapes of the pin
* @param pin the pin
* @param inst_term terminal
* @param lower_type lower bound cost
* @param upper_type upper bound cost
*
* @return if the initialization was sucessful
*/
template <typename T>
bool initPinAccessCostBounded(
std::vector<std::unique_ptr<frAccessPoint>>& aps,
std::set<std::pair<Point, frLayerNum>>& apset,
Expand Down
16 changes: 8 additions & 8 deletions src/drt/src/pa/FlexPA_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace drt {

void FlexPA::initViaRawPriority()
{
for (auto layer_num = design_->getTech()->getBottomLayerNum();
for (int layer_num = design_->getTech()->getBottomLayerNum();
layer_num <= design_->getTech()->getTopLayerNum();
++layer_num) {
if (design_->getTech()->getLayer(layer_num)->getType()
Expand All @@ -57,17 +57,17 @@ void FlexPA::initViaRawPriority()
ViaRawPriorityTuple FlexPA::getViaRawPriority(frViaDef* via_def)
{
const bool is_not_default_via = !(via_def->getDefault());
gtl::polygon_90_set_data<frCoord> via_layer_PS1;
gtl::polygon_90_set_data<frCoord> via_layer_ps1;

for (auto& fig : via_def->getLayer1Figs()) {
const Rect bbox = fig->getBBox();
gtl::rectangle_data<frCoord> bbox_rect(
bbox.xMin(), bbox.yMin(), bbox.xMax(), bbox.yMax());
using boost::polygon::operators::operator+=;
via_layer_PS1 += bbox_rect;
via_layer_ps1 += bbox_rect;
}
gtl::rectangle_data<frCoord> layer1_rect;
gtl::extents(layer1_rect, via_layer_PS1);
gtl::extents(layer1_rect, via_layer_ps1);
const bool is_layer1_horz = (gtl::xh(layer1_rect) - gtl::xl(layer1_rect))
> (gtl::yh(layer1_rect) - gtl::yl(layer1_rect));
const frCoord layer1_width
Expand Down Expand Up @@ -104,7 +104,7 @@ ViaRawPriorityTuple FlexPA::getViaRawPriority(frViaDef* via_def)
= (is_layer2_horz && (dir2 == dbTechLayerDir::VERTICAL))
|| (!is_layer2_horz && (dir2 == dbTechLayerDir::HORIZONTAL));

const frCoord layer1_area = gtl::area(via_layer_PS1);
const frCoord layer1_area = gtl::area(via_layer_ps1);
const frCoord layer2_area = gtl::area(via_layer_PS2);

return std::make_tuple(is_not_default_via,
Expand All @@ -130,7 +130,7 @@ void FlexPA::initTrackCoords()
= (design_->getTech()->getLayer(layer_num)->getDir()
== dbTechLayerDir::VERTICAL);
const auto is_vert_track
= track_pattern->isHorizontal(); // yes = vertical track
= track_pattern->isHorizontal(); // true = vertical track
if ((!is_vert_layer && !is_vert_track)
|| (is_vert_layer && is_vert_track)) {
frCoord curr_coord = track_pattern->getStartCoord();
Expand All @@ -157,8 +157,8 @@ void FlexPA::initTrackCoords()
}
prev_full_coord = curr_full_coord;
}
for (auto halfCoord : half_track_coords[i]) {
track_coords_[i][halfCoord] = frAccessPointEnum::HalfGrid;
for (auto half_coord : half_track_coords[i]) {
track_coords_[i][half_coord] = frAccessPointEnum::HalfGrid;
}
}
}
Expand Down
Loading
Loading