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

Grt: Jumper insertion for repair antenna violations #5784

Merged
Merged
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
a098519
ant: calculating the ratio of PAR and PAR required
luis201420 Aug 9, 2024
19f3594
grt: inserting jumpers on the longest segments of the nets that have …
luis201420 Aug 9, 2024
f993227
Merge remote-tracking branch 'origin' into grt_ra_jumper_insertion
luis201420 Aug 12, 2024
788f28c
grt: running jumper insertion before repair antenna iterations
luis201420 Aug 13, 2024
ce54b38
grt: inserting two jumpers for long segments
luis201420 Aug 13, 2024
a3b37a5
grt: adding jumpers near the pins with violation
luis201420 Aug 16, 2024
6558e97
Merge remote-tracking branch 'origin' into grt_ra_jumper_insertion
luis201420 Aug 16, 2024
7f2402c
Merge remote-tracking branch 'origin' into grt_ra_jumper_insertion
luis201420 Aug 20, 2024
5decdd1
grt: inserting jumpers in the segments with violation
luis201420 Aug 20, 2024
8b45f27
Merge remote-tracking branch 'origin' into grt_ra_jumper_insertion
luis201420 Aug 23, 2024
683f8bb
grt: checking resources before adding jumpers
luis201420 Aug 26, 2024
0744c88
Merge remote-tracking branch 'origin' into grt_ra_jumper_insertion
luis201420 Aug 26, 2024
cfe519c
grt: refactoring code
luis201420 Aug 26, 2024
10f0bd3
grt: removing prints
luis201420 Aug 26, 2024
dc379c6
grt: avoiding adding jumper above max routing layer
luis201420 Aug 27, 2024
2a02555
odb: adding flag to check if a net was repaired with jumper insertion
luis201420 Sep 3, 2024
5aada44
grt: setting flag in the net with jumper insertion
luis201420 Sep 3, 2024
a1fec11
drt: using flag to find nets repaired with jumper insertion
luis201420 Sep 3, 2024
234ae8e
drt: increasing the guide cost for nets with jumper insertion
luis201420 Sep 4, 2024
d4f830c
grt: modifying the has_jumpers flag when a net is repaired with diodes
luis201420 Sep 4, 2024
6de9760
odb: moving the has_jumpers flag into the dbNet flags variable
luis201420 Sep 4, 2024
fb64a7b
Merge remote-tracking branch 'origin' into grt_ra_jumper_insertion
luis201420 Sep 4, 2024
b855e6c
Merge remote-tracking branch 'origin' into grt_ra_jumper_insertion
luis201420 Sep 5, 2024
c520f79
drt: avoiding modifying the variable guide and creating a variable to…
luis201420 Sep 6, 2024
a434128
Merge remote-tracking branch 'origin' into grt_ra_jumper_insertion
luis201420 Sep 6, 2024
f0e18e0
Merge remote-tracking branch 'origin' into grt_ra_jumper_insertion
luis201420 Sep 9, 2024
db87779
drt: increasing the cost of following the guides for nets with jumper
luis201420 Sep 11, 2024
5881590
grt: avoiding adding jumper outside guides
luis201420 Sep 11, 2024
dc4822e
Merge remote-tracking branch 'origin' into grt_ra_jumper_insertion
luis201420 Sep 11, 2024
ddc0edd
grt: removing prints, adding comments and clang-format
luis201420 Sep 13, 2024
5d00615
drt: revert files to version from master
luis201420 Sep 13, 2024
059a176
odb: revert files to version from master
luis201420 Sep 13, 2024
3a1d8a2
grt: removing usage of setJumpers function
luis201420 Sep 13, 2024
29af4fb
Merge remote-tracking branch 'origin' into grt_jumper_insertion
luis201420 Sep 13, 2024
9fc4127
grt: via aware to insert the jumpers
luis201420 Sep 16, 2024
8ee5a30
Merge remote-tracking branch 'origin' into grt_jumper_insertion
luis201420 Sep 16, 2024
8f3ea5e
grt: replacing pointers with vector positions to avoid invalid pointers
luis201420 Sep 19, 2024
c0e69ab
grt: convert length function to const function
luis201420 Sep 19, 2024
9176760
Merge remote-tracking branch 'origin' into grt_jumper_insertion
luis201420 Sep 19, 2024
463eb48
grt: fixing some bugs with pointers
luis201420 Sep 20, 2024
dd934bd
Merge remote-tracking branch 'origin' into grt_jumper_insertion
luis201420 Sep 20, 2024
d75a592
grt: clean up, add comments, rename variables and functions
luis201420 Sep 20, 2024
f27f7ae
grt: adding clang-format
luis201420 Sep 20, 2024
30334e4
Merge remote-tracking branch 'origin' into grt_jumper_insertion
luis201420 Sep 20, 2024
ac318c4
grt: adding clang-format
luis201420 Sep 20, 2024
3771fe0
grt: avoiding using jumper insertion in the repairAntennas function
luis201420 Sep 20, 2024
3c5f47a
grt: checking available resources and updating used resources in Fast…
luis201420 Sep 25, 2024
c0358e2
Merge remote-tracking branch 'origin' into grt_jumper_insertion
luis201420 Sep 25, 2024
f96ed78
grt: applying suggested changes
luis201420 Sep 25, 2024
a8107c4
grt: Adding requested changes
luis201420 Sep 30, 2024
7d37b72
ant: Adding requested changes
luis201420 Sep 30, 2024
d2983c9
Merge remote-tracking branch 'origin' into grt_jumper_insertion
luis201420 Sep 30, 2024
71f8f1a
Merge remote-tracking branch 'origin' into grt_jumper_insertion
luis201420 Oct 8, 2024
80d3d5f
grt: decomposing getSegmentsWithViolation function
luis201420 Oct 8, 2024
5fc58ac
Merge remote-tracking branch 'origin' into grt_jumper_insertion
luis201420 Oct 9, 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
13 changes: 10 additions & 3 deletions src/ant/include/ant/AntennaChecker.hh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ struct NodeInfo
double diff_CAR;
double diff_CSR;

double ratio_PAR;
luis201420 marked this conversation as resolved.
Show resolved Hide resolved
double ratio_PSR;

std::vector<odb::dbITerm*> iterms;

NodeInfo& operator+=(const NodeInfo& a)
Expand Down Expand Up @@ -98,6 +101,9 @@ struct NodeInfo
CSR = 0.0;
diff_CAR = 0.0;
diff_CSR = 0.0;

ratio_PAR = 1.0;
ratio_PSR = 1.0;
}
};

Expand All @@ -123,6 +129,7 @@ struct Violation
int routing_level;
std::vector<odb::dbITerm*> gates;
int diode_count_per_gate;
double ratio;
luis201420 marked this conversation as resolved.
Show resolved Hide resolved
};

using LayerToNodeInfo = std::map<odb::dbTechLayer*, NodeInfo>;
Expand Down Expand Up @@ -186,7 +193,7 @@ class AntennaChecker
void calculateCAR(GateToLayerToNodeInfo& gate_info);
bool checkRatioViolations(odb::dbNet* db_net,
odb::dbTechLayer* layer,
const NodeInfo& node_info,
NodeInfo& node_info,
float ratio_margin,
bool verbose,
bool report);
Expand All @@ -204,13 +211,13 @@ class AntennaChecker
void calculateWirePar(odb::dbTechLayer* tech_layer, NodeInfo& info);
bool checkPAR(odb::dbNet* db_net,
odb::dbTechLayer* tech_layer,
const NodeInfo& info,
NodeInfo& info,
float ratio_margin,
bool verbose,
bool report);
bool checkPSR(odb::dbNet* db_net,
odb::dbTechLayer* tech_layer,
const NodeInfo& info,
NodeInfo& info,
float ratio_margin,
bool verbose,
bool report);
Expand Down
27 changes: 20 additions & 7 deletions src/ant/src/AntennaChecker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ void AntennaChecker::calculateCAR(GateToLayerToNodeInfo& gate_info)

bool AntennaChecker::checkPAR(odb::dbNet* db_net,
odb::dbTechLayer* tech_layer,
const NodeInfo& info,
NodeInfo& info,
const float ratio_margin,
bool verbose,
bool report)
Expand All @@ -544,6 +544,7 @@ bool AntennaChecker::checkPAR(odb::dbNet* db_net,
// check PAR or diff_PAR
if (PAR_ratio != 0) {
violation = info.PAR > PAR_ratio;
info.ratio_PAR = std::max(info.ratio_PAR, info.PAR / PAR_ratio);
if (report) {
std::string par_report = fmt::format(
" Partial area ratio: {:7.2f}\n Required ratio: "
Expand All @@ -557,6 +558,8 @@ bool AntennaChecker::checkPAR(odb::dbNet* db_net,
} else {
if (diff_PAR_PWL_ratio != 0) {
violation = info.diff_PAR > diff_PAR_PWL_ratio;
info.ratio_PAR
= std::max(info.ratio_PAR, info.diff_PAR / diff_PAR_PWL_ratio);
}
if (report) {
std::string diff_par_report = fmt::format(
Expand All @@ -574,7 +577,7 @@ bool AntennaChecker::checkPAR(odb::dbNet* db_net,

bool AntennaChecker::checkPSR(odb::dbNet* db_net,
odb::dbTechLayer* tech_layer,
const NodeInfo& info,
NodeInfo& info,
const float ratio_margin,
bool verbose,
bool report)
Expand All @@ -595,6 +598,7 @@ bool AntennaChecker::checkPSR(odb::dbNet* db_net,
// check PSR or diff_PSR
if (PSR_ratio != 0) {
violation = info.PSR > PSR_ratio;
info.ratio_PSR = std::max(info.ratio_PSR, info.PSR / PSR_ratio);
if (report) {
std::string psr_report = fmt::format(
" Partial area ratio: {:7.2f}\n Required ratio: "
Expand All @@ -608,6 +612,8 @@ bool AntennaChecker::checkPSR(odb::dbNet* db_net,
} else {
if (diff_PSR_PWL_ratio != 0) {
violation = info.diff_PSR > diff_PSR_PWL_ratio;
info.ratio_PSR
= std::max(info.ratio_PSR, info.diff_PSR / diff_PSR_PWL_ratio);
}
if (report) {
std::string diff_psr_report = fmt::format(
Expand Down Expand Up @@ -719,7 +725,7 @@ bool AntennaChecker::checkCSR(odb::dbNet* db_net,

bool AntennaChecker::checkRatioViolations(odb::dbNet* db_net,
odb::dbTechLayer* layer,
const NodeInfo& node_info,
NodeInfo& node_info,
const float ratio_margin,
bool verbose,
bool report)
Expand Down Expand Up @@ -771,7 +777,7 @@ int AntennaChecker::checkGates(odb::dbNet* db_net,
std::string net_name = fmt::format("Net: {}", db_net->getConstName());
net_to_report_.at(db_net).report += net_name + "\n";

for (const auto& [node, layer_to_node] : gate_info) {
for (auto& [node, layer_to_node] : gate_info) {
bool pin_has_violation = false;

odb::dbMTerm* mterm = node->getMTerm();
Expand All @@ -781,7 +787,7 @@ int AntennaChecker::checkGates(odb::dbNet* db_net,
mterm->getMaster()->getConstName());
net_to_report_.at(db_net).report += pin_name + "\n";

for (const auto& [layer, node_info] : layer_to_node) {
for (auto& [layer, node_info] : layer_to_node) {
if (layer->hasDefaultAntennaRule()) {
std::string layer_name
= fmt::format(" Layer: {}", layer->getConstName());
Expand Down Expand Up @@ -833,6 +839,11 @@ int AntennaChecker::checkGates(odb::dbNet* db_net,
false,
false);
bool violated = par_violation || psr_violation;
double ratio = 1.0;
if (violated) {
ratio
= std::max(violation_info.ratio_PAR, violation_info.ratio_PSR);
}
// while it has violation, increase iterm_diff_area
if (diode_mterm) {
while (par_violation || psr_violation) {
Expand Down Expand Up @@ -874,7 +885,8 @@ int AntennaChecker::checkGates(odb::dbNet* db_net,
if (violated) {
antenna_violations.push_back({layer->getRoutingLevel(),
gates_for_diode_insertion,
diode_count_per_gate});
diode_count_per_gate,
ratio});
}

bool car_violation
Expand All @@ -897,7 +909,8 @@ int AntennaChecker::checkGates(odb::dbNet* db_net,
}
antenna_violations.push_back({layer->getRoutingLevel(),
std::move(gates_for_diode_insertion),
1});
1,
1.0});
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/grt/include/grt/GRoute.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct GSegment
GSegment() = default;
GSegment(int x0, int y0, int l0, int x1, int y1, int l1);
bool isVia() const { return (init_x == final_x && init_y == final_y); }
int length()
int length() const
{
return std::abs(init_x - final_x) + std::abs(init_y - final_y);
}
Expand Down
4 changes: 4 additions & 0 deletions src/grt/include/grt/GlobalRouter.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ class GlobalRouter : public ant::GlobalRouteSource
int iterations,
float ratio_margin,
int num_threads = 1);
bool hasCapacity(bool is_horizontal,
const int& pos_x,
const int& pos_y,
const int& layer_level);

// Incremental global routing functions.
// See class IncrementalGRoute.
Expand Down
31 changes: 31 additions & 0 deletions src/grt/src/GlobalRouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,19 @@ void GlobalRouter::repairAntennas(odb::dbMTerm* diode_mterm,
nets_to_repair.push_back(db_net);
}

violations = repair_antennas_->checkAntennaViolations(routes_,
nets_to_repair,
max_routing_layer_,
diode_mterm,
ratio_margin,
num_threads);

if (violations) {
repair_antennas_->jumperInsertion(
routes_, grid_->getTileSize(), max_routing_layer_);
repair_antennas_->clearViolations();
}

while (violations && itr < iterations) {
if (verbose_) {
logger_->info(GRT, 6, "Repairing antennas, iteration {}.", itr + 1);
Expand Down Expand Up @@ -1566,6 +1579,24 @@ void GlobalRouter::computeRegionAdjustments(const odb::Rect& region,
}
}

bool GlobalRouter::hasCapacity(bool is_horizontal,
luis201420 marked this conversation as resolved.
Show resolved Hide resolved
const int& pos_x,
const int& pos_y,
const int& layer_level)
{
int grid_x = (int) ((pos_x - grid_->getXMin()) / grid_->getTileSize());
int grid_y = (int) ((pos_y - grid_->getYMin()) / grid_->getTileSize());
int cap = 0;
if (is_horizontal) {
cap = fastroute_->getEdgeCapacity(
grid_x, grid_y, grid_x + 1, grid_y, layer_level);
} else {
cap = fastroute_->getEdgeCapacity(
grid_x, grid_y, grid_x, grid_y + 1, layer_level);
}
return (cap >= 1);
}

void GlobalRouter::applyObstructionAdjustment(const odb::Rect& obstruction,
odb::dbTechLayer* tech_layer)
{
Expand Down
Loading
Loading