diff --git a/src/pdn/include/pdn/PdnGen.hh b/src/pdn/include/pdn/PdnGen.hh index 1f8f6fbceee..9771939a5bb 100644 --- a/src/pdn/include/pdn/PdnGen.hh +++ b/src/pdn/include/pdn/PdnGen.hh @@ -18,23 +18,23 @@ namespace pdn { enum ExtensionMode { - CORE, - RINGS, - BOUNDARY, - FIXED + kCore, + kRings, + kBoundary, + kFixed }; enum StartsWith { - GRID, - POWER, - GROUND + kGrid, + kPower, + kGround }; enum PowerSwitchNetworkType { - STAR, - DAISY + kStar, + kDaisy }; class VoltageDomain; @@ -164,7 +164,7 @@ class PdnGen void repairVias(const std::set& nets); void createSrouteWires(const char* net, - const char* outerNet, + const char* outer_net, odb::dbTechLayer* layer0, odb::dbTechLayer* layer1, int cut_pitch_x, @@ -174,7 +174,7 @@ class PdnGen int max_rows, int max_columns, const std::vector& ongrid, - const std::vector& metalWidths, + const std::vector& metal_widths, const std::vector& metalspaces, const std::vector& insts); diff --git a/src/pdn/src/PdnGen.cc b/src/pdn/src/PdnGen.cc index 7fa385172e6..f2610a80242 100644 --- a/src/pdn/src/PdnGen.cc +++ b/src/pdn/src/PdnGen.cc @@ -203,7 +203,7 @@ void PdnGen::trimShapes() std::map> tech_layers; for (auto* grid : grids) { - if (grid->type() == Grid::Existing) { + if (grid->type() == Grid::kExisting) { // fixed shapes, so nothing to do continue; } @@ -458,10 +458,10 @@ void PdnGen::makeCoreGrid( const std::vector& pad_pin_layers) { auto grid = std::make_unique( - domain, name, starts_with == POWER, generate_obstructions); + domain, name, starts_with == kPower, generate_obstructions); grid->setPinLayers(pin_layers); - PowerSwitchNetworkType control_network = PowerSwitchNetworkType::DAISY; + PowerSwitchNetworkType control_network = PowerSwitchNetworkType::kDaisy; if (strlen(powercontrolnetwork) > 0) { control_network = GridSwitchedPower::fromString(powercontrolnetwork, logger_); @@ -549,7 +549,7 @@ void PdnGen::makeInstanceGrid( grid = std::make_unique(domain, name, inst); } else { grid = std::make_unique( - domain, name, starts_with == POWER, inst, generate_obstructions); + domain, name, starts_with == kPower, inst, generate_obstructions); } if (!std::ranges::all_of(halo, [](int v) { return v == 0; })) { grid->addHalo(halo); @@ -599,15 +599,15 @@ void PdnGen::makeRing(Grid* grid, ring->setPadOffset(pad_offset); } ring->setExtendToBoundary(extend); - if (starts_with != GRID) { - ring->setStartWithPower(starts_with == POWER); + if (starts_with != kGrid) { + ring->setStartWithPower(starts_with == kPower); } if (allow_out_of_die) { ring->setAllowOutsideDieArea(); } ring->setNets(nets); grid->addRing(std::move(ring)); - if (!pad_pin_layers.empty() && grid->type() == Grid::Core) { + if (!pad_pin_layers.empty() && grid->type() == Grid::kCore) { auto* core_grid = static_cast(grid); core_grid->setupDirectConnect(pad_pin_layers); for (const auto& comp : core_grid->getStraps()) { @@ -649,8 +649,8 @@ void PdnGen::makeStrap(Grid* grid, strap->setExtend(extend); strap->setOffset(offset); strap->setSnapToGrid(snap); - if (starts_with != GRID) { - strap->setStartWithPower(starts_with == POWER); + if (starts_with != kGrid) { + strap->setStartWithPower(starts_with == kPower); } strap->setNets(nets); strap->setAllowOutsideCoreArea(allow_out_of_core); @@ -736,7 +736,7 @@ void PdnGen::updateRenderer(bool reset) const void PdnGen::createSrouteWires( const char* net, - const char* outerNet, + const char* outer_net, odb::dbTechLayer* layer0, odb::dbTechLayer* layer1, int cut_pitch_x, @@ -751,7 +751,7 @@ void PdnGen::createSrouteWires( const std::vector& insts) { sroute_->createSrouteWires(net, - outerNet, + outer_net, layer0, layer1, cut_pitch_x, diff --git a/src/pdn/src/PdnGen.i b/src/pdn/src/PdnGen.i index 5ca80246760..caa525c1aee 100644 --- a/src/pdn/src/PdnGen.i +++ b/src/pdn/src/PdnGen.i @@ -33,13 +33,13 @@ using utl::PDN; %typemap(in) pdn::ExtensionMode { char *str = Tcl_GetStringFromObj($input, 0); if (strcasecmp(str, "Core") == 0) { - $1 = pdn::ExtensionMode::CORE; + $1 = pdn::ExtensionMode::kCore; } else if (strcasecmp(str, "Rings") == 0) { - $1 = pdn::ExtensionMode::RINGS; + $1 = pdn::ExtensionMode::kRings; } else if (strcasecmp(str, "Boundary") == 0) { - $1 = pdn::ExtensionMode::BOUNDARY; + $1 = pdn::ExtensionMode::kBoundary; } else { - $1 = pdn::ExtensionMode::CORE; + $1 = pdn::ExtensionMode::kCore; } } @@ -88,9 +88,9 @@ void make_core_grid(pdn::VoltageDomain* domain, const std::vector& pad_pin_layers) { PdnGen* pdngen = ord::getPdnGen(); - StartsWith starts_with = POWER; + StartsWith starts_with = kPower; if (!starts_with_power) { - starts_with = GROUND; + starts_with = kGround; } pdngen->makeCoreGrid(domain, name, @@ -117,9 +117,9 @@ void make_instance_grid(pdn::VoltageDomain* domain, bool is_bump) { PdnGen* pdngen = ord::getPdnGen(); - StartsWith starts_with = POWER; + StartsWith starts_with = kPower; if (!starts_with_power) { - starts_with = GROUND; + starts_with = kGround; } std::array halo{x0, y0, x1, y1}; @@ -156,12 +156,12 @@ void make_ring(const char* grid_name, bool allow_outside_of_die) { PdnGen* pdngen = ord::getPdnGen(); - StartsWith starts_with = GRID; + StartsWith starts_with = kGrid; if (!use_grid_power_order) { if (starts_with_power) { - starts_with = POWER; + starts_with = kPower; } else { - starts_with = GROUND; + starts_with = kGround; } } for (auto* grid : pdngen->findGrid(grid_name)) { @@ -238,12 +238,12 @@ void make_strap(const char* grid_name, bool allow_out_of_core) { PdnGen* pdngen = ord::getPdnGen(); - StartsWith starts_with = GRID; + StartsWith starts_with = kGrid; if (!use_grid_power_order) { if (starts_with_power) { - starts_with = POWER; + starts_with = kPower; } else { - starts_with = GROUND; + starts_with = kGround; } } for (auto* grid : pdngen->findGrid(grid_name)) { diff --git a/src/pdn/src/connect.cpp b/src/pdn/src/connect.cpp index 90f7fb79ad3..3ab8f0e1fe7 100644 --- a/src/pdn/src/connect.cpp +++ b/src/pdn/src/connect.cpp @@ -620,7 +620,7 @@ void Connect::makeVia(odb::dbSWire* wire, } if (shapes.bottom.empty() && shapes.top.empty()) { - addFailedVia(failedViaReason::RECHECK, intersection, wire->getNet()); + addFailedVia(FailedViaReason::kRecheck, intersection, wire->getNet()); } } @@ -974,7 +974,7 @@ void Connect::printViaReport() const } } -void Connect::addFailedVia(failedViaReason reason, +void Connect::addFailedVia(FailedViaReason reason, const odb::Rect& rect, odb::dbNet* net) { @@ -999,22 +999,22 @@ void Connect::recordFailedVias() const for (const auto& [reason, shapes] : failed_vias_) { std::string reason_str; switch (reason) { - case failedViaReason::OBSTRUCTED: + case FailedViaReason::kObstructed: reason_str = "Obstructed"; break; - case failedViaReason::OVERLAPPING: + case FailedViaReason::kOverlapping: reason_str = "Overlapping"; break; - case failedViaReason::BUILD: + case FailedViaReason::kBuild: reason_str = "Build"; break; - case failedViaReason::RIPUP: + case FailedViaReason::kRipup: reason_str = "Ripup"; break; - case failedViaReason::RECHECK: + case FailedViaReason::kRecheck: // Do not report recheck vias continue; - case failedViaReason::OTHER: + case FailedViaReason::kOther: reason_str = "Other"; break; } diff --git a/src/pdn/src/connect.h b/src/pdn/src/connect.h index 62496973b13..9b5f68858f2 100644 --- a/src/pdn/src/connect.h +++ b/src/pdn/src/connect.h @@ -90,7 +90,7 @@ class Connect void printViaReport() const; - void addFailedVia(failedViaReason reason, + void addFailedVia(FailedViaReason reason, const odb::Rect& rect, odb::dbNet* net); void recordFailedVias() const; @@ -120,7 +120,7 @@ class Connect std::vector intermediate_layers_; std::vector intermediate_routing_layers_; - std::map>> + std::map>> failed_vias_; DbVia* makeSingleLayerVia( diff --git a/src/pdn/src/grid.cpp b/src/pdn/src/grid.cpp index 0e635d4f27f..f2e53711758 100644 --- a/src/pdn/src/grid.cpp +++ b/src/pdn/src/grid.cpp @@ -63,11 +63,11 @@ std::vector Grid::getNets(bool starts_with_power) const std::string Grid::typeToString(Type type) { switch (type) { - case Core: + case kCore: return "Core"; - case Instance: + case kInstance: return "Instance"; - case Existing: + case kExisting: return "Existing"; } @@ -306,7 +306,7 @@ bool Grid::repairVias(const Shape::ShapeTreeMap& global_shapes, } auto obs_filter = [this](const ShapePtr& other) -> bool { - if (other->shapeType() != Shape::GRID_OBS) { + if (other->shapeType() != Shape::kGridObs) { return true; } const GridObsShape* shape = static_cast(other.get()); @@ -632,7 +632,7 @@ void Grid::checkSetup() const // check if follow pins have connect statements std::set follow_pin_layers; for (const auto& strap : straps_) { - if (strap->type() == Straps::Followpin) { + if (strap->type() == Straps::kFollowpin) { follow_pin_layers.insert(strap->getLayer()); } } @@ -867,7 +867,7 @@ void Grid::makeVias(const Shape::ShapeTreeMap& global_shapes, if (search_obs.qbegin( bgi::intersects(via->getArea()) && bgi::satisfies([this, layer](const ShapePtr& other) -> bool { - if (other->shapeType() != Shape::GRID_OBS) { + if (other->shapeType() != Shape::kGridObs) { return true; } // only consider obstructions on routing layers as blocking @@ -881,7 +881,7 @@ void Grid::makeVias(const Shape::ShapeTreeMap& global_shapes, })) != search_obs.qend()) { remove_vias.insert(via); - via->markFailed(failedViaReason::OBSTRUCTED); + via->markFailed(FailedViaReason::kObstructed); break; } } @@ -928,7 +928,7 @@ void Grid::makeVias(const Shape::ShapeTreeMap& global_shapes, })) != overlapping_via_tree.qend()) { remove_vias.insert(via); - via->markFailed(failedViaReason::OVERLAPPING); + via->markFailed(FailedViaReason::kOverlapping); } } debugPrint(getLogger(), @@ -1143,12 +1143,12 @@ void Grid::makeInitialObstructions(odb::dbBlock* block, if (box->getTechLayer() == nullptr) { for (auto* layer : block->getDb()->getTech()->getLayers()) { - auto shape = std::make_shared(layer, obs_rect, Shape::BLOCK_OBS); + auto shape = std::make_shared(layer, obs_rect, Shape::kBlockObs); obs[layer].push_back(std::move(shape)); } } else { auto shape = std::make_shared( - box->getTechLayer(), obs_rect, Shape::BLOCK_OBS); + box->getTechLayer(), obs_rect, Shape::kBlockObs); obs[box->getTechLayer()].push_back(std::move(shape)); } } @@ -1209,7 +1209,7 @@ void Grid::makeInitialObstructions(odb::dbBlock* block, for (auto* geom : bpin->getBoxes()) { auto* layer = geom->getTechLayer(); auto shape - = std::make_shared(layer, geom->getBox(), Shape::BLOCK_OBS); + = std::make_shared(layer, geom->getBox(), Shape::kBlockObs); shape->generateObstruction(); shape->setRect(shape->getRect()); obs[layer].push_back(std::move(shape)); @@ -1257,7 +1257,7 @@ std::set Grid::getInstances() const std::set insts; for (auto* comp : getGridComponents()) { - if (comp->type() == GridComponent::PadConnect) { + if (comp->type() == GridComponent::kPadConnect) { auto* pad_connect = dynamic_cast(comp); if (pad_connect != nullptr) { insts.insert(pad_connect->getITerm()->getInst()); @@ -1308,7 +1308,7 @@ odb::Rect CoreGrid::getDomainBoundary() const int follow_pin_width = 0; for (const auto& strap : getStraps()) { - if (strap->type() == GridComponent::Followpin) { + if (strap->type() == GridComponent::kFollowpin) { follow_pin_width = std::max(follow_pin_width, strap->getWidth()); } } @@ -1383,7 +1383,7 @@ void CoreGrid::cleanupShapes() for (auto* obs : inst->getMaster()->getObstructions()) { auto shape = std::make_shared( - obs->getTechLayer(), outline, Shape::ShapeType::MACRO_OBS); + obs->getTechLayer(), outline, Shape::ShapeType::kMacroObs); shape->setObstruction(outline); macros[obs->getTechLayer()].insert(shape); } @@ -1391,7 +1391,7 @@ void CoreGrid::cleanupShapes() for (auto* pin : term->getMPins()) { for (auto* geom : pin->getGeometry()) { auto shape = std::make_shared( - geom->getTechLayer(), outline, Shape::ShapeType::MACRO_OBS); + geom->getTechLayer(), outline, Shape::ShapeType::kMacroObs); shape->setObstruction(outline); macros[geom->getTechLayer()].insert(shape); } @@ -1545,7 +1545,7 @@ ShapeVectorMap InstanceGrid::getInstanceObstructions( obs_rect.merge(spacing_rect); transform.apply(obs_rect); - auto shape = std::make_shared(layer, obs_rect, Shape::BLOCK_OBS); + auto shape = std::make_shared(layer, obs_rect, Shape::kBlockObs); obs[layer].push_back(std::move(shape)); } @@ -1557,7 +1557,7 @@ ShapeVectorMap InstanceGrid::getInstanceObstructions( const bool is_vertical = layer->getDirection() == odb::dbTechLayerDir::VERTICAL; for (const auto& pin_shape : pin_shapes) { - pin_shape->setShapeType(Shape::BLOCK_OBS); + pin_shape->setShapeType(Shape::kBlockObs); pin_shape->generateObstruction(); pin_shape->setRect(applyHalo( pin_shape->getObstruction(), halo, true, is_horizontal, is_vertical)); @@ -1619,7 +1619,7 @@ ShapeVectorMap InstanceGrid::getInstancePins(odb::dbInst* inst) transform.apply(box_rect); auto shape = std::make_shared( via_box->getTechLayer(), net, box_rect); - shape->setShapeType(Shape::FIXED); + shape->setShapeType(Shape::kFixed); pins.push_back(std::move(shape)); } } else { @@ -1627,7 +1627,7 @@ ShapeVectorMap InstanceGrid::getInstancePins(odb::dbInst* inst) transform.apply(box_rect); auto shape = std::make_shared(box->getTechLayer(), net, box_rect); - shape->setShapeType(Shape::FIXED); + shape->setShapeType(Shape::kFixed); pins.push_back(std::move(shape)); } } diff --git a/src/pdn/src/grid.h b/src/pdn/src/grid.h index 17a7cd9bcc7..7d5b33bf1c5 100644 --- a/src/pdn/src/grid.h +++ b/src/pdn/src/grid.h @@ -36,9 +36,9 @@ class Grid public: enum Type { - Core, - Instance, - Existing + kCore, + kInstance, + kExisting }; Grid(VoltageDomain* domain, @@ -205,7 +205,7 @@ class CoreGrid : public Grid bool start_with_power, const std::vector& generate_obstructions); - Type type() const override { return Grid::Core; } + Type type() const override { return Grid::kCore; } odb::Rect getDomainBoundary() const override; @@ -231,7 +231,7 @@ class InstanceGrid : public Grid std::string getLongName() const override; void report() const override; - Type type() const override { return Grid::Instance; } + Type type() const override { return Grid::kInstance; } odb::dbInst* getInstance() const { return inst_; } std::set getInstances() const override { return {inst_}; } @@ -304,7 +304,7 @@ class ExistingGrid : public Grid const std::string& name, const std::vector& generate_obstructions); - Type type() const override { return Grid::Existing; } + Type type() const override { return Grid::kExisting; } Shape::ShapeTreeMap getShapes() const override { return shapes_; }; diff --git a/src/pdn/src/grid_component.cpp b/src/pdn/src/grid_component.cpp index d5c3c5744c4..c33374cbedf 100644 --- a/src/pdn/src/grid_component.cpp +++ b/src/pdn/src/grid_component.cpp @@ -47,15 +47,15 @@ VoltageDomain* GridComponent::getDomain() const std::string GridComponent::typeToString(Type type) { switch (type) { - case Ring: + case kRing: return "Ring"; - case Strap: + case kStrap: return "Strap"; - case Followpin: + case kFollowpin: return "Followpin"; - case PadConnect: + case kPadConnect: return "Pad connect"; - case RepairChannel: + case kRepairChannel: return "Repair channel"; } diff --git a/src/pdn/src/grid_component.h b/src/pdn/src/grid_component.h index fc71405d851..578c1d73322 100644 --- a/src/pdn/src/grid_component.h +++ b/src/pdn/src/grid_component.h @@ -29,11 +29,11 @@ class GridComponent public: enum Type { - Ring, - Strap, - Followpin, - PadConnect, - RepairChannel + kRing, + kStrap, + kFollowpin, + kPadConnect, + kRepairChannel }; explicit GridComponent(Grid* grid); diff --git a/src/pdn/src/power_cells.cpp b/src/pdn/src/power_cells.cpp index 4f761407cfc..4bf14f1e17d 100644 --- a/src/pdn/src/power_cells.cpp +++ b/src/pdn/src/power_cells.cpp @@ -101,21 +101,21 @@ GridSwitchedPower::GridSwitchedPower(Grid* grid, PowerSwitchNetworkType network) : grid_(grid), cell_(cell), control_(control), network_(network) { - if (network_ == PowerSwitchNetworkType::DAISY && !cell->hasAcknowledge()) { + if (network_ == PowerSwitchNetworkType::kDaisy && !cell->hasAcknowledge()) { grid->getLogger()->error( utl::PDN, 198, "{} requires the power cell to have an acknowledge pin.", - toString(DAISY)); + toString(kDaisy)); } } std::string GridSwitchedPower::toString(PowerSwitchNetworkType type) { switch (type) { - case STAR: + case kStar: return "STAR"; - case DAISY: + case kDaisy: return "DAISY"; } return "unknown"; @@ -125,14 +125,14 @@ PowerSwitchNetworkType GridSwitchedPower::fromString(const std::string& type, utl::Logger* logger) { if (type == "STAR") { - return STAR; + return kStar; } if (type == "DAISY") { - return DAISY; + return kDaisy; } logger->error(utl::PDN, 197, "Unrecognized network type: {}", type); - return STAR; + return kStar; } void GridSwitchedPower::report() const @@ -246,7 +246,7 @@ void GridSwitchedPower::build() const int site_width = row->getSite()->getWidth(); cell_->populateAlwaysOnPinPositions(site_width); - const std::string inst_prefix = inst_prefix_ + row->getName() + "_"; + const std::string inst_prefix = kInstPrefix + row->getName() + "_"; int idx = 0; debugPrint(grid_->getLogger(), @@ -343,10 +343,10 @@ void GridSwitchedPower::build() void GridSwitchedPower::updateControlNetwork() { switch (network_) { - case STAR: + case kStar: updateControlNetworkSTAR(); break; - case DAISY: + case kDaisy: updateControlNetworkDAISY(true); break; } @@ -566,7 +566,7 @@ Straps* GridSwitchedPower::getLowestStrap() const Straps* target = nullptr; for (const auto& strap : grid_->getStraps()) { - if (strap->type() != GridComponent::Strap) { + if (strap->type() != GridComponent::kStrap) { continue; } diff --git a/src/pdn/src/power_cells.h b/src/pdn/src/power_cells.h index a556e80ab3e..c5defa4732a 100644 --- a/src/pdn/src/power_cells.h +++ b/src/pdn/src/power_cells.h @@ -150,7 +150,7 @@ class GridSwitchedPower void updateControlNetworkSTAR(); void updateControlNetworkDAISY(bool order_by_x); - static constexpr const char* inst_prefix_ = "PSW_"; + static constexpr const char* kInstPrefix = "PSW_"; }; } // namespace pdn diff --git a/src/pdn/src/renderer.cpp b/src/pdn/src/renderer.cpp index 2760d40af0d..7a730a389d1 100644 --- a/src/pdn/src/renderer.cpp +++ b/src/pdn/src/renderer.cpp @@ -20,31 +20,31 @@ namespace pdn { -const gui::Painter::Color PDNRenderer::ring_color_ +const gui::Painter::Color PDNRenderer::kRingColor = gui::Painter::Color(gui::Painter::kRed, 100); -const gui::Painter::Color PDNRenderer::strap_color_ +const gui::Painter::Color PDNRenderer::kStrapColor = gui::Painter::Color(gui::Painter::kCyan, 100); -const gui::Painter::Color PDNRenderer::followpin_color_ +const gui::Painter::Color PDNRenderer::kFollowpinColor = gui::Painter::Color(gui::Painter::kGreen, 100); -const gui::Painter::Color PDNRenderer::via_color_ +const gui::Painter::Color PDNRenderer::kViaColor = gui::Painter::Color(gui::Painter::kBlue, 100); -const gui::Painter::Color PDNRenderer::obstruction_color_ +const gui::Painter::Color PDNRenderer::kObstructionColor = gui::Painter::Color(gui::Painter::kGray, 100); -const gui::Painter::Color PDNRenderer::repair_color_ +const gui::Painter::Color PDNRenderer::kRepairColor = gui::Painter::Color(gui::Painter::kLightGray, 100); -const gui::Painter::Color PDNRenderer::repair_outline_color_ +const gui::Painter::Color PDNRenderer::kRepairOutlineColor = gui::Painter::Color(gui::Painter::kYellow, 100); PDNRenderer::PDNRenderer(PdnGen* pdn) : pdn_(pdn) { - addDisplayControl(grid_obs_text_, false); - addDisplayControl(initial_obs_text_, false); - addDisplayControl(obs_text_, false); - addDisplayControl(vias_text_, true); - addDisplayControl(followpins_text_, true); - addDisplayControl(rings_text_, true); - addDisplayControl(straps_text_, true); - addDisplayControl(repair_text_, true); + addDisplayControl(kGridObsText, false); + addDisplayControl(kInitialObsText, false); + addDisplayControl(kObsText, false); + addDisplayControl(kViasText, true); + addDisplayControl(kFollowpinsText, true); + addDisplayControl(kRingsText, true); + addDisplayControl(kStrapsText, true); + addDisplayControl(kRepairText, true); update(); @@ -116,7 +116,7 @@ void PDNRenderer::drawLayer(odb::dbTechLayer* layer, gui::Painter& painter) const odb::Rect paint_rect = painter.getBounds(); - if (checkDisplayControl(initial_obs_text_)) { + if (checkDisplayControl(kInitialObsText)) { painter.setPen(gui::Painter::kHighlight, true); painter.setBrush(gui::Painter::kTransparent); auto& shapes = initial_obstructions_[layer]; @@ -128,7 +128,7 @@ void PDNRenderer::drawLayer(odb::dbTechLayer* layer, gui::Painter& painter) } } - if (checkDisplayControl(grid_obs_text_)) { + if (checkDisplayControl(kGridObsText)) { painter.setPen(gui::Painter::kHighlight, true); painter.setBrush(gui::Painter::kTransparent); auto& shapes = grid_obstructions_[layer]; @@ -140,10 +140,10 @@ void PDNRenderer::drawLayer(odb::dbTechLayer* layer, gui::Painter& painter) } } - const bool show_rings = checkDisplayControl(rings_text_); - const bool show_followpins = checkDisplayControl(followpins_text_); - const bool show_straps = checkDisplayControl(straps_text_); - const bool show_obs = checkDisplayControl(obs_text_); + const bool show_rings = checkDisplayControl(kRingsText); + const bool show_followpins = checkDisplayControl(kFollowpinsText); + const bool show_straps = checkDisplayControl(kStrapsText); + const bool show_obs = checkDisplayControl(kObsText); auto& shapes = shapes_[layer]; if (show_rings || show_followpins || show_straps) { for (auto it = shapes.qbegin(bgi::intersects(paint_rect)); @@ -160,19 +160,19 @@ void PDNRenderer::drawLayer(odb::dbTechLayer* layer, gui::Painter& painter) if (!show_rings) { continue; } - painter.setPenAndBrush(ring_color_, true); + painter.setPenAndBrush(kRingColor, true); break; case odb::dbWireShapeType::STRIPE: if (!show_straps) { continue; } - painter.setPenAndBrush(strap_color_, true); + painter.setPenAndBrush(kStrapColor, true); break; case odb::dbWireShapeType::FOLLOWPIN: if (!show_followpins) { continue; } - painter.setPenAndBrush(followpin_color_, true); + painter.setPenAndBrush(kFollowpinColor, true); break; default: painter.setPenAndBrush(gui::Painter::kHighlight, true); @@ -225,7 +225,7 @@ void PDNRenderer::drawLayer(odb::dbTechLayer* layer, gui::Painter& painter) } } - if (checkDisplayControl(vias_text_)) { + if (checkDisplayControl(kViasText)) { for (auto it = vias_.qbegin(bgi::intersects(paint_rect)); it != vias_.qend(); it++) { @@ -240,7 +240,7 @@ void PDNRenderer::drawLayer(odb::dbTechLayer* layer, gui::Painter& painter) continue; } - painter.setPenAndBrush(via_color_, true); + painter.setPenAndBrush(kViaColor, true); painter.drawRect(area); const std::string via_name = via->getDisplayText(); @@ -256,13 +256,12 @@ void PDNRenderer::drawLayer(odb::dbTechLayer* layer, gui::Painter& painter) } } - if (checkDisplayControl(repair_text_)) { + if (checkDisplayControl(kRepairText)) { for (const auto& repair : repair_) { if (layer == repair.source || layer == repair.target) { - painter.setPenAndBrush(repair_color_, true); + painter.setPenAndBrush(kRepairColor, true); painter.drawRect(repair.rect); - painter.setPenAndBrush( - repair_outline_color_, true, gui::Painter::kNone); + painter.setPenAndBrush(kRepairOutlineColor, true, gui::Painter::kNone); painter.drawRect(repair.available_rect); const odb::Rect name_box = painter.stringBoundaries( @@ -282,13 +281,13 @@ void PDNRenderer::drawLayer(odb::dbTechLayer* layer, gui::Painter& painter) void PDNRenderer::drawObjects(gui::Painter& painter) { gui::DiscreteLegend legend; - legend.addLegendKey(ring_color_, "Ring"); - legend.addLegendKey(strap_color_, "Strap"); - legend.addLegendKey(followpin_color_, "Followpin"); - legend.addLegendKey(via_color_, "Via"); - legend.addLegendKey(obstruction_color_, "Obstruction"); - legend.addLegendKey(repair_color_, "Repair Area"); - legend.addLegendKey(repair_outline_color_, "Repair Area Outline"); + legend.addLegendKey(kRingColor, "Ring"); + legend.addLegendKey(kStrapColor, "Strap"); + legend.addLegendKey(kFollowpinColor, "Followpin"); + legend.addLegendKey(kViaColor, "Via"); + legend.addLegendKey(kObstructionColor, "Obstruction"); + legend.addLegendKey(kRepairColor, "Repair Area"); + legend.addLegendKey(kRepairOutlineColor, "Repair Area Outline"); legend.draw(painter); } diff --git a/src/pdn/src/renderer.h b/src/pdn/src/renderer.h index 6aadc247d35..5ca363085b0 100644 --- a/src/pdn/src/renderer.h +++ b/src/pdn/src/renderer.h @@ -56,22 +56,22 @@ class PDNRenderer : public gui::Renderer }; std::vector repair_; - static const gui::Painter::Color ring_color_; - static const gui::Painter::Color strap_color_; - static const gui::Painter::Color followpin_color_; - static const gui::Painter::Color via_color_; - static const gui::Painter::Color obstruction_color_; - static const gui::Painter::Color repair_color_; - static const gui::Painter::Color repair_outline_color_; - - static constexpr const char* grid_obs_text_ = "Grid obstructions"; - static constexpr const char* initial_obs_text_ = "Initial obstructions"; - static constexpr const char* obs_text_ = "Obstructions"; - static constexpr const char* rings_text_ = "Rings"; - static constexpr const char* straps_text_ = "Straps"; - static constexpr const char* followpins_text_ = "Followpin"; - static constexpr const char* vias_text_ = "Vias"; - static constexpr const char* repair_text_ = "Repair channels"; + static const gui::Painter::Color kRingColor; + static const gui::Painter::Color kStrapColor; + static const gui::Painter::Color kFollowpinColor; + static const gui::Painter::Color kViaColor; + static const gui::Painter::Color kObstructionColor; + static const gui::Painter::Color kRepairColor; + static const gui::Painter::Color kRepairOutlineColor; + + static constexpr const char* kGridObsText = "Grid obstructions"; + static constexpr const char* kInitialObsText = "Initial obstructions"; + static constexpr const char* kObsText = "Obstructions"; + static constexpr const char* kRingsText = "Rings"; + static constexpr const char* kStrapsText = "Straps"; + static constexpr const char* kFollowpinsText = "Followpin"; + static constexpr const char* kViasText = "Vias"; + static constexpr const char* kRepairText = "Repair channels"; }; } // namespace pdn diff --git a/src/pdn/src/rings.h b/src/pdn/src/rings.h index a728f5c1261..39b634d15c1 100644 --- a/src/pdn/src/rings.h +++ b/src/pdn/src/rings.h @@ -46,7 +46,7 @@ class Rings : public GridComponent void getTotalWidth(int& hor, int& ver) const; void report() const override; - Type type() const override { return GridComponent::Ring; } + Type type() const override { return GridComponent::kRing; } void checkLayerSpecifications() const override; diff --git a/src/pdn/src/shape.cpp b/src/pdn/src/shape.cpp index 4e52d681690..f969f39c659 100644 --- a/src/pdn/src/shape.cpp +++ b/src/pdn/src/shape.cpp @@ -36,7 +36,7 @@ Shape::Shape(odb::dbTechLayer* layer, net_(net), rect_(rect), type_(type), - shape_type_(SHAPE), + shape_type_(kShape), allow_non_preferred_change_(false), is_locked_(false), obs_(rect_), @@ -212,7 +212,7 @@ bool Shape::cut(const ObstructionTree& obstructions, { return cut( obstructions, replacements, [ignore_grid](const ShapePtr& other) -> bool { - if (other->shapeType() != GRID_OBS) { + if (other->shapeType() != kGridObs) { return true; } const GridObsShape* shape = static_cast(other.get()); @@ -247,7 +247,7 @@ bool Shape::cut(const ObstructionTree& obstructions, const auto& other_shape = *it; if (other_shape->net_ != nullptr && net_ == other_shape->net_ - && other_shape->shapeType() != ShapeType::SHAPE) { + && other_shape->shapeType() != ShapeType::kShape) { // obstruction is of the same net, so see if the violation is completely // inside the new strap and therefore is okay if (is_horizontal) { @@ -504,7 +504,7 @@ void Shape::populateMapFromDb(odb::dbNet* net, ShapeVectorMap& map) ShapePtr shape = std::make_shared( layer, net, rect, odb::dbWireShapeType::NONE); - shape->setShapeType(Shape::FIXED); + shape->setShapeType(Shape::kFixed); shape->generateObstruction(); map[layer].push_back(std::move(shape)); } @@ -531,7 +531,7 @@ void Shape::populateMapFromDb(odb::dbNet* net, ShapeVectorMap& map) transform.apply(rect); ShapePtr shape = std::make_shared( layer, net, rect, box->getWireShapeType()); - shape->setShapeType(Shape::FIXED); + shape->setShapeType(Shape::kFixed); shape->generateObstruction(); map[layer].push_back(std::move(shape)); } @@ -542,11 +542,11 @@ void Shape::populateMapFromDb(odb::dbNet* net, ShapeVectorMap& map) ShapePtr shape = std::make_shared( layer, net, rect, box->getWireShapeType()); - shape->setShapeType(Shape::FIXED); + shape->setShapeType(Shape::kFixed); if (box->getDirection() == odb::dbSBox::OCTILINEAR) { // cannot connect this this safely so make it an obstruction shape->setNet(nullptr); - shape->setShapeType(Shape::OBS); + shape->setShapeType(Shape::kObs); } shape->generateObstruction(); map[layer].push_back(std::move(shape)); @@ -650,7 +650,7 @@ bool Shape::isModifiable() const if (is_locked_) { return false; } - return shape_type_ == SHAPE; + return shape_type_ == kShape; } std::string Shape::getReportText() const @@ -853,7 +853,7 @@ bool FollowPinShape::cut( // grid level obstructions represent the other grids defined // followpins should only get cut from real obstructions and // not estimated obstructions - return other->shapeType() != GRID_OBS; + return other->shapeType() != kGridObs; }); } @@ -875,7 +875,7 @@ odb::dbTechLayerDir FollowPinShape::getLayerDirection() const GridObsShape::GridObsShape(odb::dbTechLayer* layer, const odb::Rect& rect, const Grid* grid) - : Shape(layer, rect, Shape::GRID_OBS), grid_(grid) + : Shape(layer, rect, Shape::kGridObs), grid_(grid) { setObstruction(rect); } diff --git a/src/pdn/src/shape.h b/src/pdn/src/shape.h index 95004f2d065..50070137d37 100644 --- a/src/pdn/src/shape.h +++ b/src/pdn/src/shape.h @@ -51,12 +51,12 @@ class Shape }; enum ShapeType { - SHAPE, - GRID_OBS, - BLOCK_OBS, - MACRO_OBS, - OBS, - FIXED + kShape, + kGridObs, + kBlockObs, + kMacroObs, + kObs, + kFixed }; struct RectIndexableGetter { diff --git a/src/pdn/src/sroute.cpp b/src/pdn/src/sroute.cpp index 253b47b2d18..e8d9f46d17d 100644 --- a/src/pdn/src/sroute.cpp +++ b/src/pdn/src/sroute.cpp @@ -29,26 +29,27 @@ SRoute::SRoute(PdnGen* pdngen, odb::dbDatabase* db, utl::Logger* logger) { } -std::vector SRoute::findRingShapes(odb::dbNet* net, uint32_t& Hdy) +std::vector SRoute::findRingShapes(odb::dbNet* net, + uint32_t& h_dy) { // find all 4 strips for the ring - uint32_t Hdx = 0; - uint32_t Vdy = 0; + uint32_t h_dx = 0; + uint32_t v_dy = 0; for (auto* swire : net->getSWires()) { for (auto* wire : swire->getWires()) { - Vdy = std::max(wire->getDY(), Vdy); - Hdx = std::max(wire->getDX(), Hdx); + v_dy = std::max(wire->getDY(), v_dy); + h_dx = std::max(wire->getDX(), h_dx); } } - uint32_t Vdx = 0; + uint32_t v_dx = 0; for (auto* swire : net->getSWires()) { for (auto* wire : swire->getWires()) { - if (wire->getDY() == Vdy) { - Vdx = std::max(wire->getDX(), Vdx); + if (wire->getDY() == v_dy) { + v_dx = std::max(wire->getDX(), v_dx); } - if (wire->getDX() == Hdx) { - Hdy = std::max(wire->getDY(), Hdy); + if (wire->getDX() == h_dx) { + h_dy = std::max(wire->getDY(), h_dy); } } } @@ -56,8 +57,8 @@ std::vector SRoute::findRingShapes(odb::dbNet* net, uint32_t& Hdy) std::vector shapes; for (auto* swire : net->getSWires()) { for (auto* wire : swire->getWires()) { - if (((wire->getDY() == Hdy) && (wire->getDX() == Hdx)) - || ((wire->getDX() == Vdx) && (wire->getDY() == Vdy))) { + if (((wire->getDY() == h_dy) && (wire->getDX() == h_dx)) + || ((wire->getDX() == v_dx) && (wire->getDY() == v_dy))) { shapes.push_back(wire); } } @@ -132,8 +133,8 @@ void SRoute::createSrouteWires( logger_->error(PDN, 116, "Can't find net {}", net_name); } - uint32_t Hdy = 0; - auto ring = findRingShapes(net, Hdy); + uint32_t h_dy = 0; + auto ring = findRingShapes(net, h_dy); sroute_itermss_.clear(); for (auto* inst : insts) { @@ -183,13 +184,14 @@ void SRoute::createSrouteWires( if (first) { if ((direction == odb::horizontal) && (stripe_metal_layer == metal_layer) - && (wire->getDY() != Hdy)) { + && (wire->getDY() != h_dy)) { first = false; pdn_wire = wire; } } else { if ((direction == odb::horizontal) - && (stripe_metal_layer == metal_layer) && (wire->getDY() != Hdy) + && (stripe_metal_layer == metal_layer) + && (wire->getDY() != h_dy) && (std::abs(wire->yMin() - avg_iterm_y) < std::abs(pdn_wire->yMin() - avg_iterm_y))) { pdn_wire = wire; @@ -318,24 +320,24 @@ void SRoute::createSrouteWires( (uint32_t) max_columns, (ring[index]->xMax() - ring[index]->xMin() - cut_pitch_x) / (cut_pitch_x + box->getDX())); - int64_t centerX = cols / 2; - int64_t centerY = rows / 2; + int64_t center_x = cols / 2; + int64_t center_y = rows / 2; int64_t row = 0; int64_t col = 0; if (rows % 2 == 1) { row = (pdn_wire->yMin() + pdn_wire->yMax()) / 2 - - centerY * (via_width + cut_pitch_y) - via_width / 2; + - center_y * (via_width + cut_pitch_y) - via_width / 2; } else { row = (pdn_wire->yMin() + pdn_wire->yMax()) / 2 - - centerY * (via_width) -cut_pitch_y / 2; + - center_y * (via_width) -cut_pitch_y / 2; } for (int r = 0; r < rows; r++) { if (cols % 2 == 1) { col = (ring[index]->xMin() + ring[index]->xMax()) / 2 - - centerX * (via_width + cut_pitch_x) - via_width / 2; + - center_x * (via_width + cut_pitch_x) - via_width / 2; } else { col = (ring[index]->xMin() + ring[index]->xMax()) / 2 - - centerX * (via_width) -std::max(centerX - 1, int64_t(0)) + - center_x * (via_width) -std::max(center_x - 1, int64_t(0)) * cut_pitch_x - cut_pitch_x / 2; } @@ -374,24 +376,24 @@ void SRoute::createSrouteWires( int cols = std::min( (uint32_t) max_columns, (metalwidths[0] - cut_pitch_x) / (cut_pitch_x + box->getDX())); - int64_t centerX = cols / 2; - int64_t centerY = rows / 2; + int64_t center_x = cols / 2; + int64_t center_y = rows / 2; int64_t row = 0; int64_t col = 0; if (rows % 2 == 1) { row = (pdn_wire->yMin() + pdn_wire->yMax()) / 2 - - centerY * (via_width + cut_pitch_y) - via_width / 2; + - center_y * (via_width + cut_pitch_y) - via_width / 2; } else { row = (pdn_wire->yMin() + pdn_wire->yMax()) / 2 - - centerY * (via_width) -cut_pitch_y / 2; + - center_y * (via_width) -cut_pitch_y / 2; } for (int r = 0; r < rows; r++) { if (cols % 2 == 1) { col = avg_iterm_x - metalwidths[0] / 2 - - centerX * (via_width + cut_pitch_x) - via_width / 2; + - center_x * (via_width + cut_pitch_x) - via_width / 2; } else { col = avg_iterm_x - metalwidths[0] / 2 - - centerX * (via_width) -std::max(centerX - 1, int64_t(0)) + - center_x * (via_width) -std::max(center_x - 1, int64_t(0)) * cut_pitch_x - cut_pitch_x / 2; } @@ -445,24 +447,24 @@ void SRoute::createSrouteWires( int cols = std::min( (uint32_t) max_columns, (metalwidths[0] - cut_pitch_x) / (cut_pitch_x + box->getDX())); - int64_t centerX = cols / 2; - int64_t centerY = rows / 2; + int64_t center_x = cols / 2; + int64_t center_y = rows / 2; int64_t row = 0; int64_t col = 0; if (rows % 2 == 1) { row = (bbox.yMax() + bbox.yMin()) / 2 - - centerY * (via_width + cut_pitch_y) - via_width / 2; + - center_y * (via_width + cut_pitch_y) - via_width / 2; } else { row = (bbox.yMax() + bbox.yMin()) / 2 - - centerY * (via_width) -cut_pitch_y / 2; + - center_y * (via_width) -cut_pitch_y / 2; } for (int r = 0; r < rows; r++) { if (cols % 2 == 1) { col = avg_iterm_x - metalwidths[0] / 2 - - centerX * (via_width + cut_pitch_x) - via_width / 2; + - center_x * (via_width + cut_pitch_x) - via_width / 2; } else { col = avg_iterm_x - metalwidths[0] / 2 - - centerX * (via_width) -std::max(centerX - 1, int64_t(0)) + - center_x * (via_width) -std::max(center_x - 1, int64_t(0)) * cut_pitch_x - cut_pitch_x / 2; } @@ -533,24 +535,24 @@ void SRoute::createSrouteWires( int cols = std::min( (uint32_t) max_columns, (metalwidths[0] - cut_pitch_x) / (cut_pitch_x + box->getDX())); - int64_t centerX = cols / 2; - int64_t centerY = rows / 2; + int64_t center_x = cols / 2; + int64_t center_y = rows / 2; int64_t row = 0; int64_t col = 0; if (rows % 2 == 1) { row = (pdn_wire->yMin() + pdn_wire->yMax()) / 2 - - centerY * (via_width + cut_pitch_y) - via_width / 2; + - center_y * (via_width + cut_pitch_y) - via_width / 2; } else { row = (pdn_wire->yMin() + pdn_wire->yMax()) / 2 - - centerY * (via_width) -cut_pitch_y / 2; + - center_y * (via_width) -cut_pitch_y / 2; } for (int r = 0; r < rows; r++) { if (cols % 2 == 1) { col = avg_iterm_x - metalwidths[0] / 2 - - centerX * (via_width + cut_pitch_x) - via_width / 2; + - center_x * (via_width + cut_pitch_x) - via_width / 2; } else { col = avg_iterm_x - metalwidths[0] / 2 - - centerX * (via_width) -std::max(centerX - 1, int64_t(0)) + - center_x * (via_width) -std::max(center_x - 1, int64_t(0)) * cut_pitch_x - cut_pitch_x / 2; } @@ -605,24 +607,24 @@ void SRoute::createSrouteWires( int cols = std::min( (uint32_t) max_columns, (metalwidths[0] - cut_pitch_x) / (cut_pitch_x + box->getDX())); - int64_t centerX = cols / 2; - int64_t centerY = rows / 2; + int64_t center_x = cols / 2; + int64_t center_y = rows / 2; int64_t row = 0; int64_t col = 0; if (rows % 2 == 1) { row = (bbox.yMax() + bbox.yMin()) / 2 - - centerY * (via_width + cut_pitch_y) - via_width / 2; + - center_y * (via_width + cut_pitch_y) - via_width / 2; } else { row = (bbox.yMax() + bbox.yMin()) / 2 - - centerY * (via_width) -cut_pitch_y / 2; + - center_y * (via_width) -cut_pitch_y / 2; } for (int r = 0; r < rows; r++) { if (cols % 2 == 1) { col = avg_iterm_x - metalwidths[0] / 2 - - centerX * (via_width + cut_pitch_x) - via_width / 2; + - center_x * (via_width + cut_pitch_x) - via_width / 2; } else { col = avg_iterm_x - metalwidths[0] / 2 - - centerX * (via_width) -std::max(centerX - 1, int64_t(0)) + - center_x * (via_width) -std::max(center_x - 1, int64_t(0)) * cut_pitch_x - cut_pitch_x / 2; } diff --git a/src/pdn/src/sroute.h b/src/pdn/src/sroute.h index 677fbe3f612..3a59481b681 100644 --- a/src/pdn/src/sroute.h +++ b/src/pdn/src/sroute.h @@ -39,7 +39,7 @@ class SRoute odb::dbInst* inst, const char* iterm_name, const std::vector& ring); - std::vector findRingShapes(odb::dbNet* net, uint32_t& Hdy); + std::vector findRingShapes(odb::dbNet* net, uint32_t& h_dy); std::vector getDomains() const; utl::Logger* logger_; diff --git a/src/pdn/src/straps.cpp b/src/pdn/src/straps.cpp index 3571edb9188..9607c0d43a8 100644 --- a/src/pdn/src/straps.cpp +++ b/src/pdn/src/straps.cpp @@ -160,7 +160,7 @@ void Straps::setExtend(ExtensionMode mode) void Straps::setStrapStartEnd(int start, int end) { - extend_mode_ = FIXED; + extend_mode_ = kFixed; strap_start_ = start; strap_end_ = end; } @@ -181,16 +181,16 @@ void Straps::makeShapes(const Shape::ShapeTreeMap& other_shapes) odb::Rect boundary; const odb::Rect core = grid->getDomainArea(); switch (extend_mode_) { - case CORE: + case kCore: boundary = grid->getDomainBoundary(); break; - case RINGS: + case kRings: boundary = grid->getRingArea(); break; - case BOUNDARY: + case kBoundary: boundary = grid->getGridBoundary(); break; - case FIXED: + case kFixed: boundary = odb::Rect(strap_start_, strap_start_, strap_end_, strap_end_); break; } @@ -460,15 +460,15 @@ void FollowPins::makeShapes(const Shape::ShapeTreeMap& other_shapes) const odb::Rect core = grid->getDomainArea(); odb::Rect boundary; switch (getExtendMode()) { - case CORE: - case FIXED: + case kCore: + case kFixed: // use core area for follow pins boundary = grid->getDomainArea(); break; - case RINGS: + case kRings: boundary = grid->getRingArea(); break; - case BOUNDARY: + case kBoundary: boundary = grid->getGridBoundary(); break; } @@ -591,7 +591,7 @@ PadDirectConnectionStraps::PadDirectConnectionStraps( bool PadDirectConnectionStraps::canConnect() const { return pad_edge_ != odb::dbDirection::NONE && !pins_.empty() - && type_ != ConnectionType::None; + && type_ != ConnectionType::kNone; } void PadDirectConnectionStraps::initialize(ConnectionType type) @@ -635,17 +635,17 @@ void PadDirectConnectionStraps::initialize(ConnectionType type) pad_edge_ == odb::dbDirection::WEST); switch (type) { - case ConnectionType::None: + case ConnectionType::kNone: pins_ = getPinsFacingCore(); if (pins_.empty()) { // check if pins are accessible from above pins_ = getPinsFormingRing(); } break; - case ConnectionType::Edge: + case ConnectionType::kEdge: pins_ = getPinsFacingCore(); break; - case ConnectionType::OverPads: + case ConnectionType::kOverPads: pins_ = getPinsFormingRing(); break; } @@ -786,7 +786,7 @@ std::vector PadDirectConnectionStraps::getPinsFacingCore() } if (!pins.empty()) { - type_ = ConnectionType::Edge; + type_ = ConnectionType::kEdge; } return pins; } @@ -889,7 +889,7 @@ std::vector PadDirectConnectionStraps::getPinsFormingRing() } setLayer(routing_layer); if (!pins.empty()) { - type_ = ConnectionType::OverPads; + type_ = ConnectionType::kOverPads; } return pins; } @@ -902,18 +902,18 @@ void PadDirectConnectionStraps::report() const logger->report(" Pin: {}", getName()); std::string connection_type = "Unknown"; switch (type_) { - case ConnectionType::None: + case ConnectionType::kNone: connection_type = "None"; break; - case ConnectionType::Edge: + case ConnectionType::kEdge: connection_type = "Edge"; break; - case ConnectionType::OverPads: + case ConnectionType::kOverPads: connection_type = "Over pads"; break; } logger->report(" Connection type: {}", connection_type); - if (type_ == ConnectionType::Edge) { + if (type_ == ConnectionType::kEdge) { logger->report(" Edge: {}", pad_edge_.getString()); } logger->report(" Net: {}", iterm_->getNet()->getName()); @@ -942,12 +942,12 @@ void PadDirectConnectionStraps::makeShapes( target_shapes_.clear(); target_pin_shape_.clear(); switch (type_) { - case ConnectionType::None: + case ConnectionType::kNone: break; - case ConnectionType::Edge: + case ConnectionType::kEdge: makeShapesFacingCore(other_shapes); break; - case ConnectionType::OverPads: + case ConnectionType::kOverPads: makeShapesOverPads(other_shapes); break; } @@ -1147,7 +1147,7 @@ PadDirectConnectionStraps::getAssociatedStraps() const const odb::dbInst* inst = iterm_->getInst(); std::vector straps; for (const auto& strap : getGrid()->getStraps()) { - if (strap->type() == GridComponent::PadConnect) { + if (strap->type() == GridComponent::kPadConnect) { PadDirectConnectionStraps* pad_strap = dynamic_cast(strap.get()); if (pad_strap != nullptr && pad_strap->getITerm()->getInst() == inst) { @@ -1310,7 +1310,7 @@ bool PadDirectConnectionStraps::snapRectToClosestShape( void PadDirectConnectionStraps::getConnectableShapes( Shape::ShapeTreeMap& shapes) const { - if (type_ != ConnectionType::OverPads) { + if (type_ != ConnectionType::kOverPads) { return; } @@ -1338,7 +1338,7 @@ void PadDirectConnectionStraps::cutShapes( { Straps::cutShapes(obstructions); - if (type_ != ConnectionType::OverPads) { + if (type_ != ConnectionType::kOverPads) { return; } @@ -1371,18 +1371,18 @@ void PadDirectConnectionStraps::unifyConnectionTypes( { std::set types; for (auto* strap : straps) { - if (strap->getConnectionType() == ConnectionType::None) { + if (strap->getConnectionType() == ConnectionType::kNone) { continue; } types.insert(strap->getConnectionType()); } - ConnectionType global_connection = ConnectionType::None; + ConnectionType global_connection = ConnectionType::kNone; if (types.size() == 1) { global_connection = *types.begin(); } else { // Multiple methods found, pick Edge - global_connection = ConnectionType::Edge; + global_connection = ConnectionType::kEdge; } for (auto* strap : straps) { @@ -1463,7 +1463,7 @@ bool PadDirectConnectionStraps::refineShapes( Shape::ShapeTreeMap& all_shapes, Shape::ObstructionTreeMap& all_obstructions) { - if (type_ != ConnectionType::OverPads) { + if (type_ != ConnectionType::kOverPads) { return GridComponent::refineShapes(all_shapes, all_obstructions); } @@ -1893,7 +1893,7 @@ bool RepairChannelStraps::determineOffset( } check_layers.push_back(getLayer()); - Shape estimated_shape(getLayer(), estimated_straps, Shape::SHAPE); + Shape estimated_shape(getLayer(), estimated_straps, Shape::kShape); estimated_shape.generateObstruction(); bool has_obs = false; @@ -2067,7 +2067,7 @@ Straps* RepairChannelStraps::getTargetStrap(Grid* grid, odb::dbTechLayer* layer) Straps* lowest_target = nullptr; for (const auto& strap : grid->getStraps()) { - if (strap->type() != GridComponent::Strap) { + if (strap->type() != GridComponent::kStrap) { continue; } @@ -2099,7 +2099,7 @@ odb::dbTechLayer* RepairChannelStraps::getHighestStrapLayer(Grid* grid) { odb::dbTechLayer* highest_layer = nullptr; for (const auto& strap : grid->getStraps()) { - if (strap->type() != GridComponent::Strap) { + if (strap->type() != GridComponent::kStrap) { // only look for straps continue; } @@ -2155,13 +2155,13 @@ RepairChannelStraps::findRepairChannels(Grid* grid, continue; } auto* grid_compomponent = shape->getGridComponent(); - if (grid_compomponent->type() != GridComponent::Strap - && grid_compomponent->type() != GridComponent::Followpin) { + if (grid_compomponent->type() != GridComponent::kStrap + && grid_compomponent->type() != GridComponent::kFollowpin) { // only attempt to repair straps and followpins continue; } - if (grid_compomponent->type() == GridComponent::Strap) { + if (grid_compomponent->type() == GridComponent::kStrap) { if (shape->getNumberOfConnections() == 0 || !shape->hasInternalConnections()) { // strap is floating and will be removed @@ -2351,7 +2351,7 @@ void RepairChannelStraps::repairGridChannels( // check for recurring channels for (const auto& channel : channels) { for (const auto& strap : grid->getStraps()) { - if (strap->type() == GridComponent::RepairChannel) { + if (strap->type() == GridComponent::kRepairChannel) { RepairChannelStraps* repair_strap = dynamic_cast(strap.get()); if (repair_strap == nullptr) { diff --git a/src/pdn/src/straps.h b/src/pdn/src/straps.h index e8517348783..400391be9c4 100644 --- a/src/pdn/src/straps.h +++ b/src/pdn/src/straps.h @@ -65,7 +65,7 @@ class Straps : public GridComponent } void report() const override; - Type type() const override { return GridComponent::Strap; } + Type type() const override { return GridComponent::kStrap; } void checkLayerSpecifications() const override; @@ -86,7 +86,7 @@ class Straps : public GridComponent int number_of_straps_; odb::dbTechLayerDir direction_; bool snap_ = false; - ExtensionMode extend_mode_ = ExtensionMode::CORE; + ExtensionMode extend_mode_ = ExtensionMode::kCore; int strap_start_ = 0; int strap_end_ = 0; bool allow_out_of_core_ = false; @@ -109,7 +109,7 @@ class FollowPins : public Straps void makeShapes(const Shape::ShapeTreeMap& other_shapes) override; - Type type() const override { return GridComponent::Followpin; } + Type type() const override { return GridComponent::kFollowpin; } void checkLayerSpecifications() const override; @@ -137,7 +137,7 @@ class PadDirectConnectionStraps : public Straps Shape::ObstructionTreeMap& all_obstructions) override; void report() const override; - Type type() const override { return GridComponent::PadConnect; } + Type type() const override { return GridComponent::kPadConnect; } // disable layer spec checks void checkLayerSpecifications() const override {} @@ -155,9 +155,9 @@ class PadDirectConnectionStraps : public Straps private: enum class ConnectionType { - None, - Edge, - OverPads + kNone, + kEdge, + kOverPads }; odb::dbITerm* iterm_; @@ -165,7 +165,7 @@ class PadDirectConnectionStraps : public Straps std::map target_shapes_; std::map target_pin_shape_; odb::dbDirection pad_edge_; - ConnectionType type_ = ConnectionType::None; + ConnectionType type_ = ConnectionType::kNone; std::vector layers_; std::vector pins_; @@ -221,7 +221,7 @@ class RepairChannelStraps : public Straps const odb::Rect& available_area, const odb::Rect& obs_check_area); - Type type() const override { return GridComponent::RepairChannel; } + Type type() const override { return GridComponent::kRepairChannel; } void report() const override; diff --git a/src/pdn/src/via.cpp b/src/pdn/src/via.cpp index 8e120cd3400..54f195f2164 100644 --- a/src/pdn/src/via.cpp +++ b/src/pdn/src/via.cpp @@ -1146,7 +1146,7 @@ DbVia::ViaLayerShape DbGenerateDummyVia::generate( reason_.empty() ? "" : ": ", reason_); if (add_report_) { - connect_->addFailedVia(failedViaReason::BUILD, via_area, wire->getNet()); + connect_->addFailedVia(FailedViaReason::kBuild, via_area, wire->getNet()); } return {}; @@ -2933,7 +2933,7 @@ void Via::writeToDb(odb::dbSWire* wire, connect_->makeVia(wire, lower_, upper_, type, shapes); if (shapes.bottom.empty() && shapes.middle.empty() && shapes.top.empty()) { - markFailed(failedViaReason::BUILD); + markFailed(FailedViaReason::kBuild); return; } @@ -3112,7 +3112,7 @@ void Via::writeToDb(odb::dbSWire* wire, tech_layer.dbuToMicron(x / ripup_count), tech_layer.dbuToMicron(y / ripup_count), lower_->getNet()->getName()); - markFailed(failedViaReason::RIPUP); + markFailed(FailedViaReason::kRipup); } } @@ -3160,7 +3160,7 @@ utl::Logger* Via::getLogger() const return getGrid()->getLogger(); } -void Via::markFailed(failedViaReason reason) +void Via::markFailed(FailedViaReason reason) { failed_ = true; connect_->addFailedVia(reason, area_, net_); diff --git a/src/pdn/src/via.h b/src/pdn/src/via.h index 73ce602b6ba..0ac9c684a8e 100644 --- a/src/pdn/src/via.h +++ b/src/pdn/src/via.h @@ -40,14 +40,14 @@ using ViaReport = std::map; class Grid; class TechLayer; -enum class failedViaReason +enum class FailedViaReason { - OBSTRUCTED, - OVERLAPPING, - BUILD, - RIPUP, - RECHECK, - OTHER + kObstructed, + kOverlapping, + kBuild, + kRipup, + kRecheck, + kOther }; class Enclosure @@ -757,7 +757,7 @@ class Via Via* copy() const; - void markFailed(failedViaReason reason); + void markFailed(FailedViaReason reason); bool isFailed() const { return failed_; } static ViaTree convertVectorToTree(std::vector& vec); diff --git a/src/pdn/test/pdn_aux.py b/src/pdn/test/pdn_aux.py index 35267fd8dd2..ce90ddacf7d 100644 --- a/src/pdn/test/pdn_aux.py +++ b/src/pdn/test/pdn_aux.py @@ -254,7 +254,7 @@ def define_pdn_grid_real( get_layer(design, l) for l in connect_to_pad_layers ] - starts_with = pdn.POWER if starts_with_power else pdn.GROUND + starts_with = pdn.kPower if starts_with_power else pdn.kGround for domain in domains: pdngen.makeCoreGrid( domain, @@ -342,7 +342,7 @@ def define_pdn_grid_macro( obst_list = get_obstructions(design, obstructions) orient_list = get_orientations(orient) - starts_with = pdn.POWER if starts_with_power else pdn.GROUND + starts_with = pdn.kPower if starts_with_power else pdn.kGround if bool(instances): insts = [] @@ -449,7 +449,7 @@ def add_pdn_stripe( spacing = design.micronToDBU(spacing) offset = design.micronToDBU(offset) - extend = pdn.CORE + extend = pdn.kCore if extend_to_core_ring and extend_to_boundary: utl.error( utl.PDN, @@ -458,9 +458,9 @@ def add_pdn_stripe( + "'extend_to_boundary' are mutually exclusive.", ) elif extend_to_core_ring: - extend = pdn.RINGS + extend = pdn.kRings elif extend_to_boundary: - extend = pdn.BOUNDARY + extend = pdn.kBoundary if followpins: for g in pdngen.findGrid(grid): @@ -468,11 +468,11 @@ def add_pdn_stripe( else: if not bool(starts_with): - starts_with = pdn.GRID + starts_with = pdn.kGrid elif starts_with.upper() == "POWER": - starts_with = pdn.POWER + starts_with = pdn.kPower elif starts_with.upper() == "GROUND": - starts_with = pdn.GROUND + starts_with = pdn.kGround else: utl.error(utl.PDN, 607, "Invalid starts_with. Must be POWER or GROUND") @@ -665,11 +665,11 @@ def add_pdn_ring( pad_offsets = [0, 0, 0, 0] if not bool(starts_with): - starts_with = pdn.GRID + starts_with = pdn.kGrid elif starts_with.upper() == "POWER": - starts_with = pdn.POWER + starts_with = pdn.kPower elif starts_with.upper() == "GROUND": - starts_with = pdn.GROUND + starts_with = pdn.kGround else: utl.error( utl.PDN, 608, "Invalid starts_with. Must be unspecified or POWER or GROUND" diff --git a/src/ram/src/ram.cpp b/src/ram/src/ram.cpp index 969c166977c..62790195647 100644 --- a/src/ram/src/ram.cpp +++ b/src/ram/src/ram.cpp @@ -622,7 +622,7 @@ void RamGen::ramPdngen(const char* power_pin, pdngen_->setCoreDomain(power_net, nullptr, ground_net, {}); pdngen_->makeCoreGrid(pdngen_->findDomain("Core"), grid_name, - pdn::StartsWith::GROUND, + pdn::StartsWith::kGround, {}, {}, nullptr, @@ -639,7 +639,7 @@ void RamGen::ramPdngen(const char* power_pin, pdngen_->makeFollowpin(grid, pdn_tech->findLayer(route_name), route_width, - pdn::ExtensionMode::BOUNDARY); + pdn::ExtensionMode::kBoundary); // add_pdn_stripe pdngen_->makeStrap(grid, @@ -650,8 +650,8 @@ void RamGen::ramPdngen(const char* power_pin, 0, 0, false, - pdn::StartsWith::GRID, - pdn::ExtensionMode::BOUNDARY, + pdn::StartsWith::kGrid, + pdn::ExtensionMode::kBoundary, {}, false); pdngen_->makeStrap(grid, @@ -662,8 +662,8 @@ void RamGen::ramPdngen(const char* power_pin, 0, 0, false, - pdn::StartsWith::GRID, - pdn::ExtensionMode::BOUNDARY, + pdn::StartsWith::kGrid, + pdn::ExtensionMode::kBoundary, {}, false);