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: functions changed to have more explicit output #5778

Merged
merged 3 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/drt/src/pa/FlexPA.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class FlexPA
unique_insts_.setDesign(in);
}
void applyPatternsFile(const char* file_path);
void getViaRawPriority(frViaDef* via_def, ViaRawPriorityTuple& priority);
ViaRawPriorityTuple getViaRawPriority(frViaDef* via_def);
bool isSkipInstTermLocal(frInstTerm* in);
bool isSkipInstTerm(frInstTerm* in);
bool isDistributed() const { return !remote_host_.empty(); }
Expand All @@ -143,11 +143,8 @@ class FlexPA
template <typename T>
int prepPoint_pin(T* pin, frInstTerm* inst_term = nullptr);
template <typename T>
void prepPoint_pin_mergePinShapes(
std::vector<gtl::polygon_90_set_data<frCoord>>& pin_shapes,
T* pin,
frInstTerm* inst_term,
bool is_shrink = false);
std::vector<gtl::polygon_90_set_data<frCoord>>
mergePinShapes(T* pin, frInstTerm* inst_term, bool is_shrink = false);
// type 0 -- on-grid; 1 -- half-grid; 2 -- center; 3 -- via-enc-opt
template <typename T>
void prepPoint_pin_genPoints(
Expand Down
19 changes: 9 additions & 10 deletions src/drt/src/pa/FlexPA_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,13 @@ void FlexPA::initViaRawPriority()
for (auto& via_def :
design_->getTech()->getLayer(layer_num)->getViaDefs()) {
const int cutNum = int(via_def->getCutFigs().size());
ViaRawPriorityTuple priority;
getViaRawPriority(via_def, priority);
const ViaRawPriorityTuple priority = getViaRawPriority(via_def);
layer_num_to_via_defs_[layer_num][cutNum][priority] = via_def;
}
}
}

void FlexPA::getViaRawPriority(frViaDef* via_def, ViaRawPriorityTuple& priority)
ViaRawPriorityTuple FlexPA::getViaRawPriority(frViaDef* via_def)
{
const bool is_not_default_via = !(via_def->getDefault());
gtl::polygon_90_set_data<frCoord> via_layer_PS1;
Expand Down Expand Up @@ -108,13 +107,13 @@ void FlexPA::getViaRawPriority(frViaDef* via_def, ViaRawPriorityTuple& priority)
const frCoord layer1_area = gtl::area(via_layer_PS1);
const frCoord layer2_area = gtl::area(via_layer_PS2);

priority = std::make_tuple(is_not_default_via,
layer1_width,
layer2_width,
is_not_upper_align,
layer2_area,
layer1_area,
is_not_lower_align);
return std::make_tuple(is_not_default_via,
layer1_width,
layer2_width,
is_not_upper_align,
layer2_area,
layer1_area,
is_not_lower_align);
}

void FlexPA::initTrackCoords()
Expand Down
17 changes: 7 additions & 10 deletions src/drt/src/pa/FlexPA_prep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,10 @@ namespace drt {
using utl::ThreadException;

template <typename T>
void FlexPA::prepPoint_pin_mergePinShapes(
std::vector<gtl::polygon_90_set_data<frCoord>>& pin_shapes,
T* pin,
frInstTerm* inst_term,
const bool is_shrink)
std::vector<gtl::polygon_90_set_data<frCoord>>
FlexPA::mergePinShapes(T* pin, frInstTerm* inst_term, const bool is_shrink)
{
std::vector<gtl::polygon_90_set_data<frCoord>> pin_shapes;
frInst* inst = nullptr;
if (inst_term) {
inst = inst_term->getInst();
Expand Down Expand Up @@ -113,11 +111,10 @@ void FlexPA::prepPoint_pin_mergePinShapes(
using boost::polygon::operators::operator+=;
pin_shapes[layer_num] += poly;
} else {
logger_->error(
DRT, 67, "FlexPA prepPoint_pin_mergePinShapes unsupported shape.");
exit(1);
logger_->error(DRT, 67, "FlexPA mergePinShapes unsupported shape.");
}
}
return pin_shapes;
}

void FlexPA::prepPoint_pin_genPoints_rect_genGrid(
Expand Down Expand Up @@ -1488,8 +1485,8 @@ int FlexPA::prepPoint_pin(T* pin, frInstTerm* inst_term)
graphics_->startPin(pin, inst_term, inst_class);
}

std::vector<gtl::polygon_90_set_data<frCoord>> pin_shapes;
prepPoint_pin_mergePinShapes(pin_shapes, pin, inst_term);
std::vector<gtl::polygon_90_set_data<frCoord>> pin_shapes
= mergePinShapes(pin, inst_term);

for (auto upper : {frAccessPointEnum::OnGrid,
frAccessPointEnum::HalfGrid,
Expand Down
16 changes: 8 additions & 8 deletions src/drt/src/pa/FlexPA_unique.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ UniqueInsts::UniqueInsts(frDesign* design,
{
}

void UniqueInsts::getPrefTrackPatterns(
std::vector<frTrackPattern*>& pref_track_patterns)
std::vector<frTrackPattern*> UniqueInsts::getPrefTrackPatterns()
{
std::vector<frTrackPattern*> pref_track_patterns;
for (const auto& track_pattern : design_->getTopBlock()->getTrackPatterns()) {
const bool is_vertical_track = track_pattern->isHorizontal();
const frLayerNum layer_num = track_pattern->getLayerNum();
Expand All @@ -55,11 +55,12 @@ void UniqueInsts::getPrefTrackPatterns(
}
}
}
return pref_track_patterns;
}

void UniqueInsts::initMaster2PinLayerRange(
MasterLayerRange& master_to_pin_layer_range)
UniqueInsts::MasterLayerRange UniqueInsts::initMasterToPinLayerRange()
{
MasterLayerRange master_to_pin_layer_range;
std::set<frString> masters;
for (odb::dbInst* inst : target_insts_) {
masters.insert(inst->getMaster()->getName());
Expand Down Expand Up @@ -105,6 +106,7 @@ void UniqueInsts::initMaster2PinLayerRange(
max_layer_num = std::min(max_layer_num + 2, num_layers);
master_to_pin_layer_range[master] = {min_layer_num, max_layer_num};
}
return master_to_pin_layer_range;
}

bool UniqueInsts::hasTrackPattern(frTrackPattern* tp, const Rect& box) const
Expand Down Expand Up @@ -209,11 +211,9 @@ void UniqueInsts::computeUnique(

void UniqueInsts::initUniqueInstance()
{
std::vector<frTrackPattern*> pref_track_patterns;
getPrefTrackPatterns(pref_track_patterns);
std::vector<frTrackPattern*> pref_track_patterns = getPrefTrackPatterns();

MasterLayerRange master_to_pin_layer_range;
initMaster2PinLayerRange(master_to_pin_layer_range);
MasterLayerRange master_to_pin_layer_range = initMasterToPinLayerRange();

computeUnique(master_to_pin_layer_range, pref_track_patterns);
}
Expand Down
6 changes: 3 additions & 3 deletions src/drt/src/pa/FlexPA_unique.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,21 @@ class UniqueInsts
void setDesign(frDesign* design) { design_ = design; }

private:
using LayerRange = std::tuple<frLayerNum, frLayerNum>;
using LayerRange = std::pair<frLayerNum, frLayerNum>;
using MasterLayerRange = std::map<frMaster*, LayerRange, frBlockObjectComp>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use frBlockObjectMap instead, not necessary in this PR.


frDesign* getDesign() const { return design_; }
frTechObject* getTech() const { return design_->getTech(); }
bool isNDRInst(frInst& inst);
bool hasTrackPattern(frTrackPattern* tp, const Rect& box) const;

void getPrefTrackPatterns(std::vector<frTrackPattern*>& pref_track_patterns);
std::vector<frTrackPattern*> getPrefTrackPatterns();
void applyPatternsFile(const char* file_path);

void initUniqueInstance();
void prepPoint_pin();

void initMaster2PinLayerRange(MasterLayerRange& master_to_pin_layer_range);
MasterLayerRange initMasterToPinLayerRange();

void computeUnique(const MasterLayerRange& master_to_pin_layer_range,
const std::vector<frTrackPattern*>& pref_track_patterns);
Expand Down
Loading