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: pin access split #5945

Draft
wants to merge 27 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
10c31c3
drt: creation of drt_genAPCosted
bnmfw Sep 28, 2024
b46205c
drt: clang-tidy
bnmfw Sep 28, 2024
0384ae2
drt: de morgan and half grid disabled
bnmfw Oct 1, 2024
ff1ef32
drt: getNestedIdx explicit output
bnmfw Oct 2, 2024
04489f3
curr_idx name changes
bnmfw Oct 2, 2024
b22b872
drt: more name changing
bnmfw Oct 4, 2024
4575e52
drt: name fix
bnmfw Oct 4, 2024
f6001ce
drt: init instance access points
bnmfw Oct 7, 2024
ad4a9f3
drt: better pin count info dump
bnmfw Oct 7, 2024
c9df50b
drt: fixed a typo
bnmfw Oct 7, 2024
1bc95be
drt: name fixes
bnmfw Oct 8, 2024
2142bfb
drt: backwards pattern propagation readability
bnmfw Oct 4, 2024
f21978c
drt: used access pattern guard
bnmfw Oct 4, 2024
63dc4f8
drt: extraction of access patterns from nodes separated in its own fu…
bnmfw Oct 4, 2024
60ed9ab
clang-tidy
bnmfw Oct 8, 2024
cf43a48
drt: flexNodes decoupled from node vector structure
bnmfw Oct 8, 2024
22fa597
drt: elimination of getNestedIdx
bnmfw Oct 8, 2024
a3af890
drt: added comments to make offset logic more clear
bnmfw Oct 8, 2024
7b58407
drt: patterns generation uses vec of vec
bnmfw Oct 9, 2024
887ce70
drt: getEdgeCost minor refactoring and some other refactors
bnmfw Oct 9, 2024
49bcd04
drt: nodes structure changed
bnmfw Oct 9, 2024
43fb2d9
Merge remote-tracking branch 'origin/master' into drt_genAPCosted
bnmfw Oct 11, 2024
5b84d06
drt: separation of drc checking in pin access
bnmfw Oct 11, 2024
5f63c43
Merge branch 'drt_genAPCosted' into drt_pa_split
bnmfw Oct 11, 2024
8569fc5
Merge branch 'drt_drc_separation' into drt_pa_split
bnmfw Oct 11, 2024
d2ec360
Merge branch 'drt_initInstAccessPoint' into drt_pa_split
bnmfw Oct 11, 2024
8e7a63a
drt: PA module split in multiple files
bnmfw Oct 14, 2024
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
3 changes: 3 additions & 0 deletions src/drt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ target_sources(drt
src/pa/FlexPA_init.cpp
src/pa/FlexPA.cpp
src/pa/FlexPA_prep.cpp
src/pa/FlexPA_acc_point.cpp
src/pa/FlexPA_acc_pattern.cpp
src/pa/FlexPA_row_pattern.cpp
src/pa/FlexPA_unique.cpp
src/pa/FlexPA_graphics.cpp
src/rp/FlexRP_init.cpp
Expand Down
131 changes: 98 additions & 33 deletions src/drt/src/pa/FlexPA.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ class FlexPA

bool isStdCell(frInst* inst);
bool isMacroCell(frInst* inst);
/**
* @brief initializes all access points of a single unique instance
*
* @param inst the unique instance
*/
void initInstAccessPoints(frInst* inst);

/**
* @brief initializes all access points of all unique instances
*/
Expand Down Expand Up @@ -277,11 +284,34 @@ class FlexPA
* @param rect pin rectangle to which via is bounded
* @param layer_num number of the layer
*/

void genAPEnclosedBoundary(std::map<frCoord, frAccessPointEnum>& coords,
const gtl::rectangle_data<frCoord>& rect,
frLayerNum layer_num,
bool is_curr_layer_horz);

/**
* @brief Calls the other genAP functions according to the informed cost
*
* @param cost access point cost
* @param coords access points cost map (will get at least one new entry)
* @param track_coords coordinates of tracks on the layer
* @param base_layer_num if two layers are being considered this is the lower,
* if only one is being considered this is the layer
* @param layer_num number of the current layer
* @param rect rectangle representing pin shape
* @param is_curr_layer_horz if the current layer is horizontal
* @param offset TODO: not sure, something to do with macro cells
*/
void genAPCosted(frAccessPointEnum cost,
std::map<frCoord, frAccessPointEnum>& coords,
const std::map<frCoord, frAccessPointEnum>& track_coords,
frLayerNum base_layer_num,
frLayerNum layer_num,
const gtl::rectangle_data<frCoord>& rect,
bool is_curr_layer_horz,
int offset = 0);

void gen_initializeAccessPoints(
std::vector<std::unique_ptr<frAccessPoint>>& aps,
std::set<std::pair<Point, frLayerNum>>& apset,
Expand Down Expand Up @@ -373,6 +403,14 @@ class FlexPA
T* pin,
frInstTerm* inst_term);

template <typename T>
bool isPlanarViolationFree(frAccessPoint* ap,
T* pin,
std::unique_ptr<frPathSeg> ps,
frInstTerm* inst_term,
const Point point,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: parameter 'point' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]

Suggested change
const Point point,
Point point,

frLayer* layer);

/**
* @brief Generates an end_point given an begin_point in the direction
*
Expand Down Expand Up @@ -452,6 +490,14 @@ class FlexPA
const std::vector<gtl::polygon_90_data<frCoord>>& layer_polys,
frDirEnum dir);

template <typename T>
bool isViaViolationFree(frAccessPoint* ap,
frVia* via,
T* pin,
std::unique_ptr<frPathSeg> ps,
frInstTerm* inst_term,
const Point point);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: parameter 'point' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]

Suggested change
const Point point);
Point point);


template <typename T>
void updatePinStats(
const std::vector<std::unique_ptr<frAccessPoint>>& tmp_aps,
Expand Down Expand Up @@ -514,60 +560,66 @@ class FlexPA
int curr_unique_inst_idx,
int max_access_point_size);

void genPatternsInit(std::vector<FlexDPNode>& nodes,
void genPatternsInit(std::vector<std::vector<FlexDPNode>>& nodes,
const std::vector<std::pair<frMPin*, frInstTerm*>>& pins,
std::set<std::vector<int>>& inst_access_patterns,
std::set<std::pair<int, int>>& used_access_points,
std::set<std::pair<int, int>>& viol_access_points,
int max_access_point_size);
std::set<std::pair<int, int>>& viol_access_points);

void genPatterns_reset(
std::vector<FlexDPNode>& nodes,
const std::vector<std::pair<frMPin*, frInstTerm*>>& pins,
int max_access_point_size);
std::vector<std::vector<FlexDPNode>>& nodes,
const std::vector<std::pair<frMPin*, frInstTerm*>>& pins);

void genPatterns_perform(
std::vector<FlexDPNode>& nodes,
std::vector<std::vector<FlexDPNode>>& nodes,
const std::vector<std::pair<frMPin*, frInstTerm*>>& pins,
std::vector<int>& vio_edges,
const std::set<std::pair<int, int>>& used_access_points,
const std::set<std::pair<int, int>>& viol_access_points,
int curr_unique_inst_idx,
int max_access_point_size);

int getEdgeCost(int prev_node_idx,
int curr_node_idx,
const std::vector<FlexDPNode>& nodes,
int getEdgeCost(FlexDPNode* prev_node_idx,
FlexDPNode* curr_node_idx,
const std::vector<std::pair<frMPin*, frInstTerm*>>& pins,
std::vector<int>& vio_edges,
const std::set<std::pair<int, int>>& used_access_points,
const std::set<std::pair<int, int>>& viol_access_points,
int curr_unique_inst_idx,
int max_access_point_size);

/**
* @brief Extracts the access patterns given the graph nodes composing the
* access points relatioship
*
* @param nodes {pin,access_point} nodes of the access pattern graph
* @param pins vector os pins of the unique instance
* @param used_access_points a set of all used access points
*
* @returns a vector of ints representing the access pattern in the form:
* access_pattern[pin_idx] = access_point_idx of the pin
*/
std::vector<int> extractAccessPatternFromNodes(
const std::vector<std::vector<FlexDPNode>>& nodes,
const std::vector<std::pair<frMPin*, frInstTerm*>>& pins,
std::set<std::pair<int, int>>& used_access_points);

bool genPatterns_commit(
const std::vector<FlexDPNode>& nodes,
const std::vector<std::vector<FlexDPNode>>& nodes,
const std::vector<std::pair<frMPin*, frInstTerm*>>& pins,
bool& is_valid,
std::set<std::vector<int>>& inst_access_patterns,
std::set<std::pair<int, int>>& used_access_points,
std::set<std::pair<int, int>>& viol_access_points,
int curr_unique_inst_idx,
int max_access_point_size);
int curr_unique_inst_idx);

void genPatternsPrintDebug(
std::vector<FlexDPNode>& nodes,
const std::vector<std::pair<frMPin*, frInstTerm*>>& pins,
int max_access_point_size);
std::vector<std::vector<FlexDPNode>>& nodes,
const std::vector<std::pair<frMPin*, frInstTerm*>>& pins);

void genPatterns_print(
std::vector<FlexDPNode>& nodes,
const std::vector<std::pair<frMPin*, frInstTerm*>>& pins,
int max_access_point_size);

int getFlatIdx(int idx_1, int idx_2, int idx_2_dim);

void getNestedIdx(int flat_idx, int& idx_1, int& idx_2, int idx_2_dim);
std::vector<std::vector<FlexDPNode>>& nodes,
const std::vector<std::pair<frMPin*, frInstTerm*>>& pins);

int getFlatEdgeIdx(int prev_idx_1,
int prev_idx_2,
Expand All @@ -584,21 +636,20 @@ class FlexPA

void genInstRowPattern(std::vector<frInst*>& insts);

void genInstRowPatternInit(std::vector<FlexDPNode>& nodes,
void genInstRowPatternInit(std::vector<std::vector<FlexDPNode>>& nodes,
const std::vector<frInst*>& insts);

void genInstRowPatternPerform(std::vector<FlexDPNode>& nodes,
void genInstRowPatternPerform(std::vector<std::vector<FlexDPNode>>& nodes,
const std::vector<frInst*>& insts);

void genInstRowPattern_commit(std::vector<FlexDPNode>& nodes,
void genInstRowPattern_commit(std::vector<std::vector<FlexDPNode>>& nodes,
const std::vector<frInst*>& insts);

void genInstRowPattern_print(std::vector<FlexDPNode>& nodes,
void genInstRowPattern_print(std::vector<std::vector<FlexDPNode>>& nodes,
const std::vector<frInst*>& insts);

int getEdgeCost(int prev_node_idx,
int curr_node_idx,
const std::vector<FlexDPNode>& nodes,
int getEdgeCost(FlexDPNode* prev_node_idx,
FlexDPNode* curr_node_idx,
const std::vector<frInst*>& insts);

void revertAccessPoints();
Expand Down Expand Up @@ -660,16 +711,30 @@ class FlexDPNode
// getters
int getPathCost() const { return pathCost_; }
int getNodeCost() const { return nodeCost_; }
int getPrevNodeIdx() const { return prev_node_idx_; }
FlexDPNode* getPrevNode() const { return prev_node_; }
std::pair<int, int> getIdx() const { return idx_; }
bool isSource() const { return virtual_source_; }
bool isDrain() const { return virtual_drain_; }
bool isVirtual() const { return (virtual_source_ || virtual_drain_); }

// setters
void setPathCost(int in) { pathCost_ = in; }
void setNodeCost(int in) { nodeCost_ = in; }
void setPrevNodeIdx(int in) { prev_node_idx_ = in; }
void setPrevNode(FlexDPNode* in) { prev_node_ = in; }
void setIdx(std::pair<int, int> in) { idx_ = in; }
void setAsSource() { virtual_source_ = true; }
void setAsDrain() { virtual_drain_ = true; }

bool hasPrevNode() const { return prev_node_ != nullptr; }

private:
bool virtual_source_ = false;
bool virtual_drain_ = false;
int pathCost_ = std::numeric_limits<int>::max();
int nodeCost_ = std::numeric_limits<int>::max();
int prev_node_idx_ = -1;
/*either {pin_idx, acc_point_idx} or {inst_idx, acc_pattern_idx} depending on
* context*/
std::pair<int, int> idx_ = {-1, -1};
FlexDPNode* prev_node_ = nullptr;
};
} // namespace drt
Loading
Loading