@@ -42,7 +42,6 @@ void ClusteringEngine::run()
4242 createRoot ();
4343 setBaseThresholds ();
4444
45- mapIOPinsAndPads ();
4645 createDataFlow ();
4746
4847 createIOClusters ();
@@ -77,7 +76,8 @@ void ClusteringEngine::setTree(PhysicalHierarchy* tree)
7776}
7877
7978// Check if macro placement is both needed and feasible.
80- // Also report some design data relevant for the user.
79+ // Also report some design data relevant for the user and
80+ // initialize the tree with data from the design.
8181void ClusteringEngine::init ()
8282{
8383 const std::vector<odb::dbInst*> unfixed_macros = getUnfixedMacros ();
@@ -103,6 +103,8 @@ void ClusteringEngine::init()
103103 tree_->floorplan_shape .getArea ());
104104 }
105105
106+ tree_->io_pads = getIOPads ();
107+
106108 reportDesignData ();
107109}
108110
@@ -207,6 +209,17 @@ Metrics* ClusteringEngine::computeModuleMetrics(odb::dbModule* module)
207209 return tree_->maps .module_to_metrics [module ].get ();
208210}
209211
212+ std::vector<odb::dbInst*> ClusteringEngine::getIOPads () const
213+ {
214+ std::vector<odb::dbInst*> io_pads;
215+ for (odb::dbInst* inst : block_->getInsts ()) {
216+ if (inst->isPad ()) {
217+ io_pads.push_back (inst);
218+ }
219+ }
220+ return io_pads;
221+ }
222+
210223void ClusteringEngine::reportDesignData ()
211224{
212225 const odb::Rect& die = block_->getDieArea ();
@@ -341,7 +354,7 @@ void ClusteringEngine::setBaseThresholds()
341354// - If an IO pin has no constraints, it is constrained to all boundaries.
342355void ClusteringEngine::createIOClusters ()
343356{
344- if (!tree_->maps . pad_to_bterm .empty ()) {
357+ if (!tree_->io_pads .empty ()) {
345358 createIOPadClusters ();
346359 return ;
347360 }
@@ -493,38 +506,9 @@ void ClusteringEngine::setIOClusterDimensions(const odb::Rect& die,
493506 }
494507}
495508
496- void ClusteringEngine::mapIOPinsAndPads ()
497- {
498- bool design_has_io_pads = false ;
499- for (auto inst : block_->getInsts ()) {
500- if (inst->getMaster ()->isPad ()) {
501- design_has_io_pads = true ;
502- break ;
503- }
504- }
505-
506- if (!design_has_io_pads) {
507- return ;
508- }
509-
510- for (odb::dbNet* net : block_->getNets ()) {
511- if (net->getBTerms ().size () == 0 ) {
512- continue ;
513- }
514-
515- for (odb::dbBTerm* bterm : net->getBTerms ()) {
516- for (odb::dbITerm* iterm : net->getITerms ()) {
517- odb::dbInst* inst = iterm->getInst ();
518- tree_->maps .pad_to_bterm [inst] = bterm;
519- tree_->maps .bterm_to_pad [bterm] = inst;
520- }
521- }
522- }
523- }
524-
525509void ClusteringEngine::createIOPadClusters ()
526510{
527- for (const auto & [bterm, pad] : tree_->maps . bterm_to_pad ) {
511+ for (odb::dbInst* pad : tree_->io_pads ) {
528512 createIOPadCluster (pad);
529513 }
530514}
@@ -611,7 +595,7 @@ VerticesMaps ClusteringEngine::computeVertices()
611595{
612596 VerticesMaps vertices_maps;
613597
614- if (tree_->maps . bterm_to_pad .empty ()) {
598+ if (tree_->io_pads .empty ()) {
615599 computeIOVertices (vertices_maps);
616600 } else {
617601 computePadVertices (vertices_maps);
@@ -642,7 +626,7 @@ void ClusteringEngine::computeIOVertices(VerticesMaps& vertices_maps)
642626
643627void ClusteringEngine::computePadVertices (VerticesMaps& vertices_maps)
644628{
645- for (const auto & [bterm, pad] : tree_->maps . bterm_to_pad ) {
629+ for (odb::dbInst* pad : tree_->io_pads ) {
646630 const int id = static_cast <int >(vertices_maps.stoppers .size ());
647631 odb::dbIntProperty::create (pad, " vertex_id" , id);
648632 vertices_maps.id_to_std_cell [id] = pad;
@@ -1785,7 +1769,7 @@ void ClusteringEngine::updateConnections()
17851769 }
17861770
17871771 bool net_has_io_pin = false ;
1788- if (tree_->maps . bterm_to_pad .empty ()) {
1772+ if (! tree_->io_pads .empty ()) {
17891773 for (odb::dbBTerm* bterm : net->getBTerms ()) {
17901774 const int cluster_id = tree_->maps .bterm_to_cluster_id .at (bterm);
17911775 net_has_io_pin = true ;
0 commit comments