diff --git a/src/drt/src/gr/FlexGR.cpp b/src/drt/src/gr/FlexGR.cpp index ae59df258b9..e81ac292e7a 100644 --- a/src/drt/src/gr/FlexGR.cpp +++ b/src/drt/src/gr/FlexGR.cpp @@ -2524,7 +2524,7 @@ 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); @@ -2532,6 +2532,7 @@ void FlexGR::updateDb() odb::dbGuide::create( dbNet, dbLayer, + dbLayer, {bbox.xMin(), bbox.yMin(), ebox.xMax(), ebox.yMax()}); } } diff --git a/src/drt/src/io/GuideProcessor.cpp b/src/drt/src/io/GuideProcessor.cpp index c616f68dc12..4a9773f2ee0 100644 --- a/src/drt/src/io/GuideProcessor.cpp +++ b/src/drt/src/io/GuideProcessor.cpp @@ -1846,6 +1846,7 @@ void GuideProcessor::saveGuidesUpdates() odb::dbGuide::create( dbNet, dbLayer, + dbLayer, {bbox.xMin(), bbox.yMin(), ebox.xMax(), ebox.yMax()}); } } else { @@ -1854,6 +1855,7 @@ void GuideProcessor::saveGuidesUpdates() odb::dbGuide::create( dbNet, dbLayer, + dbLayer, {bbox.xMin(), bbox.yMin(), ebox.xMax(), ebox.yMax()}); } } diff --git a/src/drt/test/ispd18_sample.ok b/src/drt/test/ispd18_sample.ok index 52cffa839b9..c8d9351b70c 100644 --- a/src/drt/test/ispd18_sample.ok +++ b/src/drt/test/ispd18_sample.ok @@ -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. diff --git a/src/drt/test/ispd18_sample_incr.ok b/src/drt/test/ispd18_sample_incr.ok index 4924dcfbeef..7aa131bc2b1 100644 --- a/src/drt/test/ispd18_sample_incr.ok +++ b/src/drt/test/ispd18_sample_incr.ok @@ -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. diff --git a/src/drt/test/ndr_vias1.ok b/src/drt/test/ndr_vias1.ok index ad8ce8ad5b2..f66ef2baa0f 100644 --- a/src/drt/test/ndr_vias1.ok +++ b/src/drt/test/ndr_vias1.ok @@ -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 diff --git a/src/drt/test/ndr_vias2.ok b/src/drt/test/ndr_vias2.ok index 4336794a5d7..2b97f82f653 100644 --- a/src/drt/test/ndr_vias2.ok +++ b/src/drt/test/ndr_vias2.ok @@ -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 diff --git a/src/drt/test/obstruction.ok b/src/drt/test/obstruction.ok index bb050813f66..8a0bdd09972 100644 --- a/src/drt/test/obstruction.ok +++ b/src/drt/test/obstruction.ok @@ -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 diff --git a/src/drt/test/single_step.ok b/src/drt/test/single_step.ok index 52cffa839b9..c8d9351b70c 100644 --- a/src/drt/test/single_step.ok +++ b/src/drt/test/single_step.ok @@ -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. diff --git a/src/drt/test/ta_ap_aligned.ok b/src/drt/test/ta_ap_aligned.ok index dc4ab005e43..90bcb8927c7 100644 --- a/src/drt/test/ta_ap_aligned.ok +++ b/src/drt/test/ta_ap_aligned.ok @@ -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 diff --git a/src/drt/test/ta_pin_aligned.ok b/src/drt/test/ta_pin_aligned.ok index b0fc2a1e300..3caf0fc9034 100644 --- a/src/drt/test/ta_pin_aligned.ok +++ b/src/drt/test/ta_pin_aligned.ok @@ -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 diff --git a/src/drt/test/top_level_term.ok b/src/drt/test/top_level_term.ok index e247f20f16b..bf6b3240fc5 100644 --- a/src/drt/test/top_level_term.ok +++ b/src/drt/test/top_level_term.ok @@ -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 diff --git a/src/drt/test/top_level_term2.ok b/src/drt/test/top_level_term2.ok index 2bedc1b2d08..6b027348f3a 100644 --- a/src/drt/test/top_level_term2.ok +++ b/src/drt/test/top_level_term2.ok @@ -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 diff --git a/src/grt/include/grt/GlobalRouter.h b/src/grt/include/grt/GlobalRouter.h index 4bf7271fa61..5cff944376c 100644 --- a/src/grt/include/grt/GlobalRouter.h +++ b/src/grt/include/grt/GlobalRouter.h @@ -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 @@ -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& guide_box, - const std::set& via_positions); bool segmentsConnect(const GSegment& seg0, const GSegment& seg1, GSegment& new_seg, diff --git a/src/grt/src/GlobalRouter.cpp b/src/grt/src/GlobalRouter.cpp index c72b592bdfe..12218f7da3d 100644 --- a/src/grt/src/GlobalRouter.cpp +++ b/src/grt/src/GlobalRouter.cpp @@ -229,6 +229,7 @@ void GlobalRouter::saveCongestion() bool GlobalRouter::haveRoutes() { + loadGuidesFromDB(); if (routes_.empty()) { logger_->warn(GRT, 97, "No global routing found for nets."); } @@ -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"); @@ -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); } @@ -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& pins = db_net_map_[net_route.first]->getPins(); GRoute& route = net_route.second; @@ -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); } } } @@ -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_ @@ -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); } } } @@ -2640,63 +2653,15 @@ void GlobalRouter::connectPadPins(NetRouteMap& routes) } } -void GlobalRouter::mergeBox(std::vector& guide_box, - const std::set& via_positions) -{ - std::vector 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); @@ -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(); @@ -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)); diff --git a/src/grt/src/GlobalRouter.tcl b/src/grt/src/GlobalRouter.tcl index 4536cb35fbf..0e9eb0dbfc8 100644 --- a/src/grt/src/GlobalRouter.tcl +++ b/src/grt/src/GlobalRouter.tcl @@ -374,6 +374,7 @@ proc read_guides { args } { keys {} \ flags {} set file_name $args + grt::read_guides $file_name } diff --git a/src/grt/test/est_rc3.ok b/src/grt/test/est_rc3.ok index 848c894c589..7c0c5dedb2c 100644 --- a/src/grt/test/est_rc3.ok +++ b/src/grt/test/est_rc3.ok @@ -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 diff --git a/src/grt/test/est_rc4.ok b/src/grt/test/est_rc4.ok index faec19fb189..2f2eb49acc7 100644 --- a/src/grt/test/est_rc4.ok +++ b/src/grt/test/est_rc4.ok @@ -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 diff --git a/src/grt/test/report_wire_length1.ok b/src/grt/test/report_wire_length1.ok index 2424d57f1c9..49d5b925ca6 100644 --- a/src/grt/test/report_wire_length1.ok +++ b/src/grt/test/report_wire_length1.ok @@ -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 diff --git a/src/grt/test/report_wire_length2.ok b/src/grt/test/report_wire_length2.ok index 6754265ee0e..4702cd7e471 100644 --- a/src/grt/test/report_wire_length2.ok +++ b/src/grt/test/report_wire_length2.ok @@ -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 diff --git a/src/grt/test/report_wire_length3.ok b/src/grt/test/report_wire_length3.ok index e76bb37753f..034dfd6db4b 100644 --- a/src/grt/test/report_wire_length3.ok +++ b/src/grt/test/report_wire_length3.ok @@ -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 diff --git a/src/grt/test/report_wire_length4.ok b/src/grt/test/report_wire_length4.ok index 7ba62bcc58d..e59bd79dbef 100644 --- a/src/grt/test/report_wire_length4.ok +++ b/src/grt/test/report_wire_length4.ok @@ -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 diff --git a/src/grt/test/report_wire_length5.ok b/src/grt/test/report_wire_length5.ok index 211058665fa..fcbfb52b87e 100644 --- a/src/grt/test/report_wire_length5.ok +++ b/src/grt/test/report_wire_length5.ok @@ -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 diff --git a/src/grt/test/report_wire_length6.ok b/src/grt/test/report_wire_length6.ok index 8238a5fe00b..c11fec188ba 100644 --- a/src/grt/test/report_wire_length6.ok +++ b/src/grt/test/report_wire_length6.ok @@ -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 diff --git a/src/odb/include/odb/db.h b/src/odb/include/odb/db.h index 4e85b608410..82325c7d019 100644 --- a/src/odb/include/odb/db.h +++ b/src/odb/include/odb/db.h @@ -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); diff --git a/src/odb/src/codeGenerator/schema/chip/dbGuide.json b/src/odb/src/codeGenerator/schema/chip/dbGuide.json index 4973b9bc827..579f51cca17 100644 --- a/src/odb/src/codeGenerator/schema/chip/dbGuide.json +++ b/src/odb/src/codeGenerator/schema/chip/dbGuide.json @@ -22,6 +22,14 @@ "private" ] }, + { + "name": "via_layer_", + "type": "dbId<_dbTechLayer>", + "schema":"db_schema_db_guide_via_layer", + "flags": [ + "private" + ] + }, { "name":"guide_next_", "type":"dbId<_dbGuide>", diff --git a/src/odb/src/db/dbDatabase.h b/src/odb/src/db/dbDatabase.h index 09dc3190c6c..d9c21a9091e 100644 --- a/src/odb/src/db/dbDatabase.h +++ b/src/odb/src/db/dbDatabase.h @@ -70,7 +70,10 @@ namespace odb { const uint db_schema_major = 0; // Not used... const uint db_schema_initial = 57; -const uint db_schema_minor = 89; // Current revision number +const uint db_schema_minor = 90; // Current revision number + +// Revision where via layer was added to dbGuide +const uint db_schema_db_guide_via_layer = 90; // Revision where blocked regions for IO pins were added to dbBlock const uint db_schema_dbblock_blocked_regions_for_pins = 89; diff --git a/src/odb/src/db/dbGuide.cpp b/src/odb/src/db/dbGuide.cpp index 7ba1d0fdc76..c7068d763c8 100644 --- a/src/odb/src/db/dbGuide.cpp +++ b/src/odb/src/db/dbGuide.cpp @@ -58,6 +58,9 @@ bool _dbGuide::operator==(const _dbGuide& rhs) const if (layer_ != rhs.layer_) { return false; } + if (via_layer_ != rhs.via_layer_) { + return false; + } if (guide_next_ != rhs.guide_next_) { return false; } @@ -78,6 +81,7 @@ void _dbGuide::differences(dbDiff& diff, DIFF_FIELD(net_); DIFF_FIELD(box_); DIFF_FIELD(layer_); + DIFF_FIELD(via_layer_); DIFF_FIELD(guide_next_); DIFF_END } @@ -88,6 +92,7 @@ void _dbGuide::out(dbDiff& diff, char side, const char* field) const DIFF_OUT_FIELD(net_); DIFF_OUT_FIELD(box_); DIFF_OUT_FIELD(layer_); + DIFF_OUT_FIELD(via_layer_); DIFF_OUT_FIELD(guide_next_); DIFF_END @@ -102,6 +107,7 @@ _dbGuide::_dbGuide(_dbDatabase* db, const _dbGuide& r) net_ = r.net_; box_ = r.box_; layer_ = r.layer_; + via_layer_ = r.via_layer_; guide_next_ = r.guide_next_; } @@ -110,6 +116,9 @@ dbIStream& operator>>(dbIStream& stream, _dbGuide& obj) stream >> obj.net_; stream >> obj.box_; stream >> obj.layer_; + if (obj.getDatabase()->isSchema(db_schema_db_guide_via_layer)) { + stream >> obj.via_layer_; + } stream >> obj.guide_next_; return stream; } @@ -119,6 +128,9 @@ dbOStream& operator<<(dbOStream& stream, const _dbGuide& obj) stream << obj.net_; stream << obj.box_; stream << obj.layer_; + if (obj.getDatabase()->isSchema(db_schema_db_guide_via_layer)) { + stream << obj.via_layer_; + } stream << obj.guide_next_; return stream; } @@ -144,6 +156,13 @@ dbTechLayer* dbGuide::getLayer() const return odb::dbTechLayer::getTechLayer(tech, obj->layer_); } +dbTechLayer* dbGuide::getViaLayer() const +{ + _dbGuide* obj = (_dbGuide*) this; + auto tech = getDb()->getTech(); + return odb::dbTechLayer::getTechLayer(tech, obj->via_layer_); +} + dbNet* dbGuide::getNet() const { _dbGuide* obj = (_dbGuide*) this; @@ -151,7 +170,10 @@ dbNet* dbGuide::getNet() const return (dbNet*) block->_net_tbl->getPtr(obj->net_); } -dbGuide* dbGuide::create(dbNet* net, dbTechLayer* layer, Rect box) +dbGuide* dbGuide::create(dbNet* net, + dbTechLayer* layer, + dbTechLayer* via_layer, + Rect box) { _dbNet* owner = (_dbNet*) net; _dbBlock* block = (_dbBlock*) owner->getOwner(); @@ -172,6 +194,7 @@ dbGuide* dbGuide::create(dbNet* net, dbTechLayer* layer, Rect box) } guide->layer_ = layer->getImpl()->getOID(); + guide->via_layer_ = via_layer->getImpl()->getOID(); guide->box_ = box; guide->net_ = owner->getId(); guide->guide_next_ = owner->guides_; @@ -206,6 +229,7 @@ void dbGuide::destroy(dbGuide* guide) block->_journal->pushParam(_guide->box_.xMax()); block->_journal->pushParam(_guide->box_.yMax()); block->_journal->pushParam(_guide->layer_); + block->_journal->pushParam(_guide->via_layer_); block->_journal->endAction(); } diff --git a/src/odb/src/db/dbGuide.h b/src/odb/src/db/dbGuide.h index 2c3b4dfdd52..16bc1dd4558 100644 --- a/src/odb/src/db/dbGuide.h +++ b/src/odb/src/db/dbGuide.h @@ -61,6 +61,7 @@ class _dbGuide : public _dbObject dbId<_dbNet> net_; Rect box_; dbId<_dbTechLayer> layer_; + dbId<_dbTechLayer> via_layer_; dbId<_dbGuide> guide_next_; }; dbIStream& operator>>(dbIStream& stream, _dbGuide& obj); diff --git a/src/odb/src/db/dbJournal.cpp b/src/odb/src/db/dbJournal.cpp index b5260b6c6fa..a38808e8831 100644 --- a/src/odb/src/db/dbJournal.cpp +++ b/src/odb/src/db/dbJournal.cpp @@ -1519,15 +1519,19 @@ void dbJournal::undo_deleteObject() int x_max; int y_max; uint layer_id; + uint via_layer_id; _log.pop(net_id); _log.pop(x_min); _log.pop(y_min); _log.pop(x_max); _log.pop(y_max); _log.pop(layer_id); + _log.pop(via_layer_id); auto net = dbNet::getNet(_block, net_id); auto layer = dbTechLayer::getTechLayer(_block->getTech(), layer_id); - dbGuide::create(net, layer, {x_min, y_min, x_max, y_max}); + auto via_layer + = dbTechLayer::getTechLayer(_block->getTech(), via_layer_id); + dbGuide::create(net, layer, via_layer, {x_min, y_min, x_max, y_max}); break; } case dbInstObj: { diff --git a/src/odb/test/cpp/TestGuide.cpp b/src/odb/test/cpp/TestGuide.cpp index 6f61b11fb70..b5391ba9a61 100644 --- a/src/odb/test/cpp/TestGuide.cpp +++ b/src/odb/test/cpp/TestGuide.cpp @@ -17,8 +17,8 @@ BOOST_AUTO_TEST_CASE(test_default) auto block = db->getChip()->getBlock(); auto layer = tech->findLayer("L1"); auto net = dbNet::create(block, "n1"); - dbGuide::create(net, layer, {0, 0, 100, 100}); - dbGuide::create(net, layer, {0, 100, 100, 200}); + dbGuide::create(net, layer, layer, {0, 0, 100, 100}); + dbGuide::create(net, layer, layer, {0, 100, 100, 200}); net->getGuides().reverse(); BOOST_TEST(net->getGuides().size() == 2); dbGuide* guide = (dbGuide*) *net->getGuides().begin(); @@ -37,9 +37,9 @@ BOOST_AUTO_TEST_CASE(test_clear_guides) auto block = db->getChip()->getBlock(); auto layer = tech->findLayer("L1"); auto net = dbNet::create(block, "n1"); - dbGuide::create(net, layer, {0, 100, 100, 200}); - dbGuide::create(net, layer, {0, 100, 100, 200}); - dbGuide::create(net, layer, {0, 100, 100, 200}); + dbGuide::create(net, layer, layer, {0, 100, 100, 200}); + dbGuide::create(net, layer, layer, {0, 100, 100, 200}); + dbGuide::create(net, layer, layer, {0, 100, 100, 200}); BOOST_TEST(net->getGuides().size() == 3); net->clearGuides(); BOOST_TEST(net->getGuides().size() == 0); diff --git a/src/odb/test/cpp/TestJournal.cpp b/src/odb/test/cpp/TestJournal.cpp index aea5a0c7373..a36f59e93bd 100644 --- a/src/odb/test/cpp/TestJournal.cpp +++ b/src/odb/test/cpp/TestJournal.cpp @@ -90,7 +90,7 @@ BOOST_FIXTURE_TEST_CASE(test_undo_net_destroy_guides, F_DEFAULT) auto net = dbNet::create(block, "n"); auto l1 = db->getTech()->findLayer("L1"); const Rect box{0, 0, 100, 100}; - dbGuide::create(net, l1, box); + dbGuide::create(net, l1, l1, box); in_eco([&]() { dbNet::destroy(net); }); @@ -98,6 +98,7 @@ BOOST_FIXTURE_TEST_CASE(test_undo_net_destroy_guides, F_DEFAULT) const auto guide = *net->getGuides().begin(); BOOST_TEST(guide->getLayer() == l1); BOOST_TEST(guide->getBox() == box); + BOOST_TEST(guide->getViaLayer() == l1); } BOOST_FIXTURE_TEST_CASE(test_undo_guide_create, F_DEFAULT) @@ -106,7 +107,7 @@ BOOST_FIXTURE_TEST_CASE(test_undo_guide_create, F_DEFAULT) auto l1 = db->getTech()->findLayer("L1"); const Rect box{0, 0, 100, 100}; - in_eco([&]() { dbGuide::create(net, l1, box); }); + in_eco([&]() { dbGuide::create(net, l1, l1, box); }); BOOST_TEST(net->getGuides().size() == 0); }