@@ -55,7 +55,16 @@ Graphics::Graphics(utl::Logger* logger,
5555 logger_(logger),
5656 mode_(Nesterov)
5757{
58- gui::Gui::get ()->registerRenderer (this );
58+ gui::Gui* gui = gui::Gui::get ();
59+ gui->registerRenderer (this );
60+
61+ // Setup the chart
62+ chart_ = gui->addChart (" GPL" );
63+ chart_->setAxisLabel (" Iteration" , odb::horizontal);
64+ chart_->setAxisLabel (" HPWL (μm)" , odb::vertical);
65+ chart_->setAxisFormat (" %d" , odb::horizontal);
66+ chart_->setAxisFormat (" %.2e" , odb::vertical);
67+
5968 initHeatmap ();
6069 if (inst) {
6170 for (size_t idx = 0 ; idx < nbc_->getGCells ().size (); ++idx) {
@@ -226,7 +235,7 @@ void Graphics::drawSingleGCell(const GCell* gCell, gui::Painter& painter)
226235 }
227236
228237 // Highlight selection (highest priority)
229- if (gCell == nbc_->getGCellByIndex (selected_)) {
238+ if (selected_ != kInvalidIndex && gCell == nbc_->getGCellByIndex (selected_)) {
230239 color = gui::Painter::kYellow ;
231240 color.a = 180 ;
232241 }
@@ -293,7 +302,7 @@ void Graphics::drawNesterov(gui::Painter& painter)
293302 }
294303
295304 // Draw lines to neighbors
296- if (nbc_->getGCellByIndex (selected_)) {
305+ if (selected_ != kInvalidIndex && nbc_->getGCellByIndex (selected_)) {
297306 painter.setPen (gui::Painter::kYellow , true );
298307 for (GPin* pin : nbc_->getGCellByIndex (selected_)->gPins ()) {
299308 GNet* net = pin->gNet ();
@@ -385,6 +394,12 @@ void Graphics::reportSelected()
385394 }
386395}
387396
397+ void Graphics::addIter (const int iter)
398+ {
399+ odb::dbBlock* block = pbc_->db ()->getChip ()->getBlock ();
400+ chart_->addPoint (iter, block->dbuToMicrons (nbc_->getHpwl ()));
401+ }
402+
388403void Graphics::cellPlot (bool pause)
389404{
390405 gui::Gui::get ()->redraw ();
0 commit comments