Skip to content

Commit

Permalink
Merge pull request The-OpenROAD-Project#5758 from eder-matheus/grt_es…
Browse files Browse the repository at this point in the history
…timate_parasitics

grt: allow estimate parasitics from guides stored in odb
  • Loading branch information
eder-matheus authored Sep 18, 2024
2 parents 97988c4 + 76bacea commit d3dd612
Show file tree
Hide file tree
Showing 31 changed files with 113 additions and 77 deletions.
3 changes: 2 additions & 1 deletion src/drt/src/gr/FlexGR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2524,14 +2524,15 @@ void FlexGR::updateDb()
lNum += 2) {
auto layer = design_->getTech()->getLayer(lNum);
auto dbLayer = dbTech->findLayer(layer->getName().c_str());
odb::dbGuide::create(dbNet, dbLayer, bbox);
odb::dbGuide::create(dbNet, dbLayer, dbLayer, bbox);
}
} else {
auto layer = design_->getTech()->getLayer(bNum);
auto dbLayer = dbTech->findLayer(layer->getName().c_str());
odb::dbGuide::create(
dbNet,
dbLayer,
dbLayer,
{bbox.xMin(), bbox.yMin(), ebox.xMax(), ebox.yMax()});
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/drt/src/io/GuideProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1846,6 +1846,7 @@ void GuideProcessor::saveGuidesUpdates()
odb::dbGuide::create(
dbNet,
dbLayer,
dbLayer,
{bbox.xMin(), bbox.yMin(), ebox.xMax(), ebox.yMax()});
}
} else {
Expand All @@ -1854,6 +1855,7 @@ void GuideProcessor::saveGuidesUpdates()
odb::dbGuide::create(
dbNet,
dbLayer,
dbLayer,
{bbox.xMin(), bbox.yMin(), ebox.xMax(), ebox.yMax()});
}
}
Expand Down
1 change: 1 addition & 0 deletions src/drt/test/ispd18_sample.ok
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
[INFO ODB-0128] Design: ispd18_sample
[INFO ODB-0131] Created 22 components and 146 component-terminals.
[INFO ODB-0133] Created 11 nets and 22 connections.
[WARNING GRT-0008] The read_guides command does not allow parasitics estimation from the guides file.
[WARNING DRT-0160] Warning: Metal5 does not have viaDef aligned with layer direction, generating new viaDef Via5_FR.
[WARNING DRT-0160] Warning: Metal6 does not have viaDef aligned with layer direction, generating new viaDef Via6_FR.
[WARNING DRT-0160] Warning: Metal7 does not have viaDef aligned with layer direction, generating new viaDef Via7_FR.
Expand Down
1 change: 1 addition & 0 deletions src/drt/test/ispd18_sample_incr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
[INFO ODB-0128] Design: ispd18_sample
[INFO ODB-0131] Created 22 components and 146 component-terminals.
[INFO ODB-0133] Created 11 nets and 22 connections.
[WARNING GRT-0008] The read_guides command does not allow parasitics estimation from the guides file.
[WARNING DRT-0160] Warning: Metal5 does not have viaDef aligned with layer direction, generating new viaDef Via5_FR.
[WARNING DRT-0160] Warning: Metal6 does not have viaDef aligned with layer direction, generating new viaDef Via6_FR.
[WARNING DRT-0160] Warning: Metal7 does not have viaDef aligned with layer direction, generating new viaDef Via7_FR.
Expand Down
1 change: 1 addition & 0 deletions src/drt/test/ndr_vias1.ok
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[INFO ODB-0130] Created 1 pins.
[INFO ODB-0131] Created 66 components and 347 component-terminals.
[INFO ODB-0133] Created 8 nets and 54 connections.
[WARNING GRT-0008] The read_guides command does not allow parasitics estimation from the guides file.
[WARNING DRT-0349] LEF58_ENCLOSURE with no CUTCLASS is not supported. Skipping for layer mcon
[WARNING DRT-0349] LEF58_ENCLOSURE with no CUTCLASS is not supported. Skipping for layer mcon
[WARNING DRT-0349] LEF58_ENCLOSURE with no CUTCLASS is not supported. Skipping for layer via
Expand Down
1 change: 1 addition & 0 deletions src/drt/test/ndr_vias2.ok
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[INFO ODB-0130] Created 1 pins.
[INFO ODB-0131] Created 66 components and 347 component-terminals.
[INFO ODB-0133] Created 8 nets and 54 connections.
[WARNING GRT-0008] The read_guides command does not allow parasitics estimation from the guides file.
[WARNING DRT-0349] LEF58_ENCLOSURE with no CUTCLASS is not supported. Skipping for layer mcon
[WARNING DRT-0349] LEF58_ENCLOSURE with no CUTCLASS is not supported. Skipping for layer mcon
[WARNING DRT-0349] LEF58_ENCLOSURE with no CUTCLASS is not supported. Skipping for layer via
Expand Down
1 change: 1 addition & 0 deletions src/drt/test/obstruction.ok
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[INFO ODB-0130] Created 1 pins.
[INFO ODB-0131] Created 4 components and 24 component-terminals.
[INFO ODB-0133] Created 1 nets and 4 connections.
[WARNING GRT-0008] The read_guides command does not allow parasitics estimation from the guides file.
[WARNING DRT-0349] LEF58_ENCLOSURE with no CUTCLASS is not supported. Skipping for layer mcon
[WARNING DRT-0349] LEF58_ENCLOSURE with no CUTCLASS is not supported. Skipping for layer mcon
[WARNING DRT-0349] LEF58_ENCLOSURE with no CUTCLASS is not supported. Skipping for layer via
Expand Down
1 change: 1 addition & 0 deletions src/drt/test/single_step.ok
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
[INFO ODB-0128] Design: ispd18_sample
[INFO ODB-0131] Created 22 components and 146 component-terminals.
[INFO ODB-0133] Created 11 nets and 22 connections.
[WARNING GRT-0008] The read_guides command does not allow parasitics estimation from the guides file.
[WARNING DRT-0160] Warning: Metal5 does not have viaDef aligned with layer direction, generating new viaDef Via5_FR.
[WARNING DRT-0160] Warning: Metal6 does not have viaDef aligned with layer direction, generating new viaDef Via6_FR.
[WARNING DRT-0160] Warning: Metal7 does not have viaDef aligned with layer direction, generating new viaDef Via7_FR.
Expand Down
1 change: 1 addition & 0 deletions src/drt/test/ta_ap_aligned.ok
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[INFO ODB-0128] Design: test
[INFO ODB-0131] Created 4 components and 16 component-terminals.
[INFO ODB-0133] Created 2 nets and 4 connections.
[WARNING GRT-0008] The read_guides command does not allow parasitics estimation from the guides file.
[INFO DRT-0167] List of default vias:
Layer via1
default via: via1_7
Expand Down
1 change: 1 addition & 0 deletions src/drt/test/ta_pin_aligned.ok
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[INFO ODB-0128] Design: test
[INFO ODB-0130] Created 4 pins.
[INFO ODB-0133] Created 2 nets and 0 connections.
[WARNING GRT-0008] The read_guides command does not allow parasitics estimation from the guides file.
[INFO DRT-0167] List of default vias:
Layer via1
default via: via1_7
Expand Down
1 change: 1 addition & 0 deletions src/drt/test/top_level_term.ok
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[INFO ODB-0130] Created 1 pins.
[INFO ODB-0131] Created 4 components and 24 component-terminals.
[INFO ODB-0133] Created 1 nets and 4 connections.
[WARNING GRT-0008] The read_guides command does not allow parasitics estimation from the guides file.
[WARNING DRT-0349] LEF58_ENCLOSURE with no CUTCLASS is not supported. Skipping for layer mcon
[WARNING DRT-0349] LEF58_ENCLOSURE with no CUTCLASS is not supported. Skipping for layer mcon
[WARNING DRT-0349] LEF58_ENCLOSURE with no CUTCLASS is not supported. Skipping for layer via
Expand Down
1 change: 1 addition & 0 deletions src/drt/test/top_level_term2.ok
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[INFO ODB-0130] Created 3 pins.
[INFO ODB-0131] Created 4 components and 24 component-terminals.
[INFO ODB-0133] Created 1 nets and 4 connections.
[WARNING GRT-0008] The read_guides command does not allow parasitics estimation from the guides file.
[WARNING DRT-0349] LEF58_ENCLOSURE with no CUTCLASS is not supported. Skipping for layer mcon
[WARNING DRT-0349] LEF58_ENCLOSURE with no CUTCLASS is not supported. Skipping for layer mcon
[WARNING DRT-0349] LEF58_ENCLOSURE with no CUTCLASS is not supported. Skipping for layer via
Expand Down
7 changes: 4 additions & 3 deletions src/grt/include/grt/GlobalRouter.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,10 @@ class GlobalRouter : public ant::GlobalRouteSource
void reportNetLayerWirelengths(odb::dbNet* db_net, std::ofstream& out);
void reportLayerWireLengths();
odb::Rect globalRoutingToBox(const GSegment& route);
void boxToGlobalRouting(const odb::Rect& route_bds, int layer, GRoute& route);
void boxToGlobalRouting(const odb::Rect& route_bds,
int layer,
int via_layer,
GRoute& route);
void updateVias();

// Report wire length
Expand Down Expand Up @@ -372,8 +375,6 @@ class GlobalRouter : public ant::GlobalRouteSource
int min_routing_layer,
int max_routing_layer);
void connectPadPins(NetRouteMap& routes);
void mergeBox(std::vector<odb::Rect>& guide_box,
const std::set<odb::Point>& via_positions);
bool segmentsConnect(const GSegment& seg0,
const GSegment& seg1,
GSegment& new_seg,
Expand Down
91 changes: 29 additions & 62 deletions src/grt/src/GlobalRouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ void GlobalRouter::saveCongestion()

bool GlobalRouter::haveRoutes()
{
loadGuidesFromDB();
if (routes_.empty()) {
logger_->warn(GRT, 97, "No global routing found for nets.");
}
Expand Down Expand Up @@ -1894,6 +1895,10 @@ void GlobalRouter::checkOverflow()

void GlobalRouter::readGuides(const char* file_name)
{
logger_->warn(GRT,
8,
"The read_guides command does not allow parasitics estimation "
"from the guides file.");
if (db_->getChip() == nullptr || db_->getChip()->getBlock() == nullptr
|| db_->getTech() == nullptr) {
logger_->error(GRT, 249, "Load design before reading guides");
Expand Down Expand Up @@ -1958,7 +1963,8 @@ void GlobalRouter::readGuides(const char* file_name)
odb::Rect rect(
stoi(tokens[0]), stoi(tokens[1]), stoi(tokens[2]), stoi(tokens[3]));
guides[net].push_back(std::make_pair(layer->getRoutingLevel(), rect));
boxToGlobalRouting(rect, layer->getRoutingLevel(), routes_[net]);
int layer_idx = layer->getRoutingLevel();
boxToGlobalRouting(rect, layer_idx, layer_idx, routes_[net]);
} else {
logger_->error(GRT, 236, "Error reading guide file {}.", file_name);
}
Expand All @@ -1981,16 +1987,19 @@ void GlobalRouter::readGuides(const char* file_name)

void GlobalRouter::loadGuidesFromDB()
{
if (!routes_.empty()) {
return;
}
initGridAndNets();
for (odb::dbNet* net : block_->getNets()) {
for (odb::dbGuide* guide : net->getGuides()) {
int layer_idx = guide->getLayer()->getRoutingLevel();
int via_layer_idx = guide->getViaLayer()->getRoutingLevel();
boxToGlobalRouting(
guide->getBox(), guide->getLayer()->getRoutingLevel(), routes_[net]);
guide->getBox(), layer_idx, via_layer_idx, routes_[net]);
}
}

updateVias();

for (auto& net_route : routes_) {
std::vector<Pin>& pins = db_net_map_[net_route.first]->getPins();
GRoute& route = net_route.second;
Expand Down Expand Up @@ -2199,7 +2208,8 @@ void GlobalRouter::saveGuidesFromFile(
if (!guide_boxes.empty()) {
for (const auto& guide : guide_boxes) {
ph_layer_final = routing_layers_[guide.first];
odb::dbGuide::create(db_net, ph_layer_final, guide.second);
odb::dbGuide::create(
db_net, ph_layer_final, ph_layer_final, guide.second);
}
}
}
Expand Down Expand Up @@ -2236,12 +2246,15 @@ void GlobalRouter::saveGuides()
int layer_idx2 = segment.final_layer;
odb::dbTechLayer* layer1 = routing_layers_[layer_idx1];
odb::dbTechLayer* layer2 = routing_layers_[layer_idx2];
odb::dbGuide::create(db_net, layer1, box);
odb::dbGuide::create(db_net, layer2, box);
odb::dbGuide::create(db_net, layer1, layer2, box);
odb::dbGuide::create(db_net, layer2, layer1, box);
} else {
int layer_idx = std::min(segment.init_layer, segment.final_layer);
odb::dbTechLayer* layer1 = routing_layers_[layer_idx];
odb::dbGuide::create(db_net, layer1, box);
int via_layer_idx
= std::max(segment.init_layer, segment.final_layer);
odb::dbTechLayer* layer = routing_layers_[layer_idx];
odb::dbTechLayer* via_layer = routing_layers_[via_layer_idx];
odb::dbGuide::create(db_net, layer, via_layer, box);
}
} else if (segment.init_layer == segment.final_layer) {
if (segment.init_layer < min_routing_layer_
Expand All @@ -2254,7 +2267,7 @@ void GlobalRouter::saveGuides()
}

odb::dbTechLayer* layer = routing_layers_[segment.init_layer];
odb::dbGuide::create(db_net, layer, box);
odb::dbGuide::create(db_net, layer, layer, box);
}
}
}
Expand Down Expand Up @@ -2640,63 +2653,15 @@ void GlobalRouter::connectPadPins(NetRouteMap& routes)
}
}

void GlobalRouter::mergeBox(std::vector<odb::Rect>& guide_box,
const std::set<odb::Point>& via_positions)
{
std::vector<odb::Rect> final_box;
if (guide_box.empty()) {
logger_->error(GRT, 78, "Guides vector is empty.");
}
final_box.push_back(guide_box[0]);
for (size_t i = 1; i < guide_box.size(); i++) {
odb::Rect box = guide_box[i];
odb::Rect& lastBox = final_box.back();

GRoute segs;
boxToGlobalRouting(box, 0, segs);
odb::Point seg_init(segs[0].init_x, segs[0].init_y);
odb::Point seg_final(segs.back().init_x, segs.back().init_y);

if (lastBox.overlaps(box)
&& (via_positions.find(seg_init) == via_positions.end()
|| via_positions.find(seg_final) == via_positions.end())) {
int lowerX = std::min(lastBox.xMin(), box.xMin());
int lowerY = std::min(lastBox.yMin(), box.yMin());
int upperX = std::max(lastBox.xMax(), box.xMax());
int upperY = std::max(lastBox.yMax(), box.yMax());
lastBox = odb::Rect(lowerX, lowerY, upperX, upperY);
} else
final_box.push_back(box);
}
guide_box.clear();
guide_box = std::move(final_box);
}

odb::Rect GlobalRouter::globalRoutingToBox(const GSegment& route)
{
odb::Rect die_bounds = grid_->getGridArea();
int init_x, init_y;
int final_x, final_y;

if (route.init_x < route.final_x) {
init_x = route.init_x;
final_x = route.final_x;
} else {
init_x = route.final_x;
final_x = route.init_x;
}

if (route.init_y < route.final_y) {
init_y = route.init_y;
final_y = route.final_y;
} else {
init_y = route.final_y;
final_y = route.init_y;
}
const auto [init_x, final_x] = std::minmax(route.init_x, route.final_x);
const auto [init_y, final_y] = std::minmax(route.init_y, route.final_y);

int llX = init_x - (grid_->getTileSize() / 2);
int llY = init_y - (grid_->getTileSize() / 2);

int urX = final_x + (grid_->getTileSize() / 2);
int urY = final_y + (grid_->getTileSize() / 2);

Expand All @@ -2716,6 +2681,7 @@ odb::Rect GlobalRouter::globalRoutingToBox(const GSegment& route)

void GlobalRouter::boxToGlobalRouting(const odb::Rect& route_bds,
int layer,
int via_layer,
GRoute& route)
{
const int tile_size = grid_->getTileSize();
Expand All @@ -2725,8 +2691,9 @@ void GlobalRouter::boxToGlobalRouting(const odb::Rect& route_bds,
const int x1 = (tile_size * (route_bds.xMax() / tile_size)) - (tile_size / 2);
const int y1 = (tile_size * (route_bds.yMax() / tile_size)) - (tile_size / 2);

if (x0 == x1 && y0 == y1)
route.push_back(GSegment(x0, y0, layer, x1, y1, layer));
if (x0 == x1 && y0 == y1) {
route.push_back(GSegment(x0, y0, layer, x1, y1, via_layer));
}

while (y0 == y1 && (x0 + tile_size) <= x1) {
route.push_back(GSegment(x0, y0, layer, x0 + tile_size, y0, layer));
Expand Down
1 change: 1 addition & 0 deletions src/grt/src/GlobalRouter.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ proc read_guides { args } {
keys {} \
flags {}
set file_name $args

grt::read_guides $file_name
}

Expand Down
1 change: 1 addition & 0 deletions src/grt/test/est_rc3.ok
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[INFO ODB-0130] Created 54 pins.
[INFO ODB-0131] Created 676 components and 2850 component-terminals.
[INFO ODB-0133] Created 579 nets and 1498 connections.
[WARNING GRT-0008] The read_guides command does not allow parasitics estimation from the guides file.
Net clk
Pin capacitance: 29.975-33.238
Wire capacitance: 17.722-17.722
Expand Down
1 change: 1 addition & 0 deletions src/grt/test/est_rc4.ok
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[INFO ODB-0130] Created 54 pins.
[INFO ODB-0131] Created 676 components and 2850 component-terminals.
[INFO ODB-0133] Created 579 nets and 1498 connections.
[WARNING GRT-0008] The read_guides command does not allow parasitics estimation from the guides file.
Net clk
Pin capacitance: 29.975-33.238
Wire capacitance: 330.569
Expand Down
1 change: 1 addition & 0 deletions src/grt/test/report_wire_length1.ok
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[INFO ODB-0130] Created 1 pins.
[INFO ODB-0131] Created 170 components and 1258 component-terminals.
[INFO ODB-0133] Created 15 nets and 72 connections.
[WARNING GRT-0008] The read_guides command does not allow parasitics estimation from the guides file.
[INFO GRT-0237] Net clk global route wire length: 201.60um
[INFO GRT-0240] Net clk detailed route wire length: 184.95um
[INFO GRT-0237] Net net60 global route wire length: 14.40um
Expand Down
1 change: 1 addition & 0 deletions src/grt/test/report_wire_length2.ok
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[INFO ODB-0130] Created 1 pins.
[INFO ODB-0131] Created 170 components and 1258 component-terminals.
[INFO ODB-0133] Created 15 nets and 72 connections.
[WARNING GRT-0008] The read_guides command does not allow parasitics estimation from the guides file.
[INFO GRT-0237] Net clk global route wire length: 201.60um
[INFO GRT-0240] Net clk detailed route wire length: 184.95um
[INFO GRT-0237] Net clknet_0_clk global route wire length: 93.60um
Expand Down
1 change: 1 addition & 0 deletions src/grt/test/report_wire_length3.ok
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[INFO ODB-0130] Created 1 pins.
[INFO ODB-0131] Created 170 components and 1258 component-terminals.
[INFO ODB-0133] Created 15 nets and 72 connections.
[WARNING GRT-0008] The read_guides command does not allow parasitics estimation from the guides file.
[INFO GRT-0237] Net clk global route wire length: 201.60um
Layer met3 : 144.00um
Layer met4 : 57.60um
Expand Down
1 change: 1 addition & 0 deletions src/grt/test/report_wire_length4.ok
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[INFO ODB-0130] Created 1 pins.
[INFO ODB-0131] Created 170 components and 1258 component-terminals.
[INFO ODB-0133] Created 15 nets and 72 connections.
[WARNING GRT-0008] The read_guides command does not allow parasitics estimation from the guides file.
[INFO GRT-0237] Net clk global route wire length: 201.60um
Layer met3 : 144.00um
Layer met4 : 57.60um
Expand Down
1 change: 1 addition & 0 deletions src/grt/test/report_wire_length5.ok
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[INFO ODB-0130] Created 1 pins.
[INFO ODB-0131] Created 170 components and 1258 component-terminals.
[INFO ODB-0133] Created 15 nets and 72 connections.
[WARNING GRT-0008] The read_guides command does not allow parasitics estimation from the guides file.
[INFO GRT-0237] Net clk global route wire length: 201.60um
[INFO GRT-0240] Net clk detailed route wire length: 184.95um
[INFO GRT-0237] Net net60 global route wire length: 14.40um
Expand Down
1 change: 1 addition & 0 deletions src/grt/test/report_wire_length6.ok
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
[INFO ODB-0131] Created 6 components and 29 component-terminals.
[INFO ODB-0133] Created 2 nets and 6 connections.
[INFO ODB-0134] Finished DEF file: report_wire_length6.def
[WARNING GRT-0008] The read_guides command does not allow parasitics estimation from the guides file.
[INFO GRT-0237] Net o[4] global route wire length: 15.12um
[INFO GRT-0237] Net final_adder.$signal$2073 global route wire length: 5.40um
7 changes: 6 additions & 1 deletion src/odb/include/odb/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -7501,7 +7501,12 @@ class dbGuide : public dbObject

dbTechLayer* getLayer() const;

static dbGuide* create(dbNet* net, dbTechLayer* layer, Rect box);
dbTechLayer* getViaLayer() const;

static dbGuide* create(dbNet* net,
dbTechLayer* layer,
dbTechLayer* via_layer,
Rect box);

static dbGuide* getGuide(dbBlock* block, uint dbid);

Expand Down
Loading

0 comments on commit d3dd612

Please sign in to comment.