@@ -112,41 +112,23 @@ void ClusteringEngine::init()
112112 return ;
113113 }
114114
115- tree_->macro_with_halo_area = computeMacroWithHaloArea (unfixed_macros);
116-
117- const odb::Rect die = block_->getDieArea ();
118- const odb::Rect core_box = block_->getCoreArea ();
119-
120- const float core_lx = block_->dbuToMicrons (core_box.xMin ());
121- const float core_ly = block_->dbuToMicrons (core_box.yMin ());
122- const float core_ux = block_->dbuToMicrons (core_box.xMax ());
123- const float core_uy = block_->dbuToMicrons (core_box.yMax ());
115+ setFloorplanShape ();
116+ searchForFixedInstsInsideFloorplanShape ();
124117
125- const float core_area = (core_ux - core_lx) * (core_uy - core_ly );
118+ tree_-> macro_with_halo_area = computeMacroWithHaloArea (unfixed_macros );
126119 const float inst_area_with_halos
127120 = tree_->macro_with_halo_area + design_metrics_->getStdCellArea ();
128121
129- if (inst_area_with_halos > core_area ) {
122+ if (inst_area_with_halos > tree_-> floorplan_shape . getArea () ) {
130123 logger_->error (MPL,
131124 16 ,
132125 " The instance area considering the macros' halos {} exceeds "
133- " the core area {}" ,
126+ " the floorplan area {}" ,
134127 inst_area_with_halos,
135- core_area );
128+ tree_-> floorplan_shape . getArea () );
136129 }
137130
138- logger_->report (
139- " Floorplan Outline: ({}, {}) ({}, {}), Core Outline: ({}, {}) ({}, {})" ,
140- block_->dbuToMicrons (die.xMin ()),
141- block_->dbuToMicrons (die.yMin ()),
142- block_->dbuToMicrons (die.xMax ()),
143- block_->dbuToMicrons (die.yMax ()),
144- core_lx,
145- core_ly,
146- core_ux,
147- core_uy);
148-
149- reportDesignData (core_area);
131+ reportDesignData ();
150132}
151133
152134float ClusteringEngine::computeMacroWithHaloArea (
@@ -175,6 +157,39 @@ std::vector<odb::dbInst*> ClusteringEngine::getUnfixedMacros()
175157 return unfixed_macros;
176158}
177159
160+ void ClusteringEngine::setFloorplanShape ()
161+ {
162+ const odb::Rect& core_box = block_->getCoreArea ();
163+ const float core_lx = block_->dbuToMicrons (core_box.xMin ());
164+ const float core_ly = block_->dbuToMicrons (core_box.yMin ());
165+ const float core_ux = block_->dbuToMicrons (core_box.xMax ());
166+ const float core_uy = block_->dbuToMicrons (core_box.yMax ());
167+
168+ tree_->floorplan_shape = Rect (std::max (core_lx, tree_->global_fence .xMin ()),
169+ std::max (core_ly, tree_->global_fence .yMin ()),
170+ std::min (core_ux, tree_->global_fence .xMax ()),
171+ std::min (core_uy, tree_->global_fence .yMax ()));
172+ }
173+
174+ void ClusteringEngine::searchForFixedInstsInsideFloorplanShape ()
175+ {
176+ odb::Rect floorplan_shape (
177+ block_->micronsToDbu (tree_->floorplan_shape .xMin ()),
178+ block_->micronsToDbu (tree_->floorplan_shape .yMin ()),
179+ block_->micronsToDbu (tree_->floorplan_shape .xMax ()),
180+ block_->micronsToDbu (tree_->floorplan_shape .yMax ()));
181+
182+ for (odb::dbInst* inst : block_->getInsts ()) {
183+ if (inst->isFixed ()
184+ && inst->getBBox ()->getBox ().overlaps (floorplan_shape)) {
185+ logger_->error (MPL,
186+ 50 ,
187+ " Found fixed instance {} inside the floorplan area." ,
188+ inst->getName ());
189+ }
190+ }
191+ }
192+
178193Metrics* ClusteringEngine::computeModuleMetrics (odb::dbModule* module )
179194{
180195 unsigned int num_std_cell = 0 ;
@@ -218,14 +233,26 @@ Metrics* ClusteringEngine::computeModuleMetrics(odb::dbModule* module)
218233 return tree_->maps .module_to_metrics [module ].get ();
219234}
220235
221- void ClusteringEngine::reportDesignData (const float core_area )
236+ void ClusteringEngine::reportDesignData ()
222237{
238+ const odb::Rect& die = block_->getDieArea ();
239+ logger_->report (
240+ " Die Area: ({}, {}) ({}, {}), Floorplan Area: ({}, {}) ({}, {})" ,
241+ block_->dbuToMicrons (die.xMin ()),
242+ block_->dbuToMicrons (die.yMin ()),
243+ block_->dbuToMicrons (die.xMax ()),
244+ block_->dbuToMicrons (die.yMax ()),
245+ tree_->floorplan_shape .xMin (),
246+ tree_->floorplan_shape .yMin (),
247+ tree_->floorplan_shape .xMax (),
248+ tree_->floorplan_shape .yMax ());
249+
223250 float util
224251 = (design_metrics_->getStdCellArea () + design_metrics_->getMacroArea ())
225- / core_area ;
226- float core_util = design_metrics_-> getStdCellArea ()
227- / (core_area - design_metrics_->getMacroArea ());
228-
252+ / tree_-> floorplan_shape . getArea () ;
253+ float floorplan_util
254+ = design_metrics_->getStdCellArea ()
255+ / (tree_-> floorplan_shape . getArea () - design_metrics_-> getMacroArea ());
229256 logger_->report (
230257 " \t Number of std cell instances: {}\n "
231258 " \t Area of std cell instances: {:.2f}\n "
@@ -235,9 +262,9 @@ void ClusteringEngine::reportDesignData(const float core_area)
235262 " \t Halo height: {:.2f}\n "
236263 " \t Area of macros with halos: {:.2f}\n "
237264 " \t Area of std cell instances + Area of macros: {:.2f}\n "
238- " \t Core area: {:.2f}\n "
265+ " \t Floorplan area: {:.2f}\n "
239266 " \t Design Utilization: {:.2f}\n "
240- " \t Core Utilization: {:.2f}\n "
267+ " \t Floorplan Utilization: {:.2f}\n "
241268 " \t Manufacturing Grid: {}\n " ,
242269 design_metrics_->getNumStdCell (),
243270 design_metrics_->getStdCellArea (),
@@ -247,9 +274,9 @@ void ClusteringEngine::reportDesignData(const float core_area)
247274 tree_->halo_height ,
248275 tree_->macro_with_halo_area ,
249276 design_metrics_->getStdCellArea () + design_metrics_->getMacroArea (),
250- core_area ,
277+ tree_-> floorplan_shape . getArea () ,
251278 util,
252- core_util ,
279+ floorplan_util ,
253280 block_->getTech ()->getManufacturingGrid ());
254281}
255282
0 commit comments