Skip to content

Commit 1cd463f

Browse files
authored
Merge pull request #9127 from gudeh/gui-tcl-worst-path-image
gui: new tcl command for worst path image
2 parents de622b2 + 54374fb commit 1cd463f

File tree

6 files changed

+95
-0
lines changed

6 files changed

+95
-0
lines changed

src/gui/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,30 @@ Update the paths in the Timing Report widget:
945945
gui::update_timing_report
946946
```
947947

948+
### Show Worst Path
949+
950+
Update the paths in the Timing Report widget and select the path with the worst slack:
951+
952+
```tcl
953+
gui::show_worst_path
954+
[-setup|-hold]
955+
```
956+
957+
#### Options
958+
959+
| Switch Name | Description |
960+
| ---- | ---- |
961+
| `-setup` | Select the path with the worst setup slack (default). |
962+
| `-hold` | Select the path with the worst hold slack. |
963+
964+
### Clear Timing Path
965+
966+
Clear the selected timing path in the Timing Report widget:
967+
968+
```tcl
969+
gui::clear_timing_path
970+
```
971+
948972
## License
949973

950974
BSD 3-Clause License. See [LICENSE](../../LICENSE) file.

src/gui/include/gui/gui.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,9 @@ class Gui
773773
int width_px = 0,
774774
int height_px = 0);
775775

776+
void showWorstTimingPath(bool setup);
777+
void clearTimingPath();
778+
776779
// modify display controls
777780
void setDisplayControlsVisible(const std::string& name, bool value);
778781
void setDisplayControlsSelectable(const std::string& name, bool value);

src/gui/src/gui.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,7 @@ void Gui::saveImage(const std::string& filename,
782782
const double dbu_per_micron = tech->getDbUnitsPerMicron();
783783

784784
std::string save_cmds;
785+
785786
// build display control commands
786787
save_cmds = "set ::gui::display_settings [gui::DisplayControlMap]\n";
787788
for (const auto& [control, value] : display_settings) {
@@ -863,6 +864,22 @@ void Gui::saveHistogramImage(const std::string& filename,
863864
filename, chart_mode, width, height);
864865
}
865866

867+
void Gui::showWorstTimingPath(bool setup)
868+
{
869+
if (!enabled()) {
870+
return;
871+
}
872+
main_window->getTimingWidget()->showWorstTimingPath(setup);
873+
}
874+
875+
void Gui::clearTimingPath()
876+
{
877+
if (!enabled()) {
878+
return;
879+
}
880+
main_window->getTimingWidget()->clearSelection();
881+
}
882+
866883
void Gui::selectClockviewerClock(const std::string& clock_name,
867884
std::optional<int> depth)
868885
{

src/gui/src/gui.i

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,24 @@ void save_histogram_image(const char* filename, const char* mode, int width_px =
332332
gui->saveHistogramImage(filename, mode, width_px, height_px);
333333
}
334334

335+
void show_worst_path(bool setup = true)
336+
{
337+
if (!check_gui("show_worst_path")) {
338+
return;
339+
}
340+
auto gui = gui::Gui::get();
341+
gui->showWorstTimingPath(setup);
342+
}
343+
344+
void clear_timing_path()
345+
{
346+
if (!check_gui("clear_timing_path")) {
347+
return;
348+
}
349+
auto gui = gui::Gui::get();
350+
gui->clearTimingPath();
351+
}
352+
335353
void clear_rulers()
336354
{
337355
if (!check_gui("clear_rulers")) {

src/gui/src/timingWidget.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,37 @@ void TimingWidget::hideEvent(QHideEvent* event)
789789
toggleRenderer(false);
790790
}
791791

792+
void TimingWidget::showWorstTimingPath(bool setup)
793+
{
794+
if (setup_timing_paths_model_ == nullptr
795+
|| hold_timing_paths_model_ == nullptr) {
796+
return;
797+
}
798+
799+
if (setup_timing_paths_model_->rowCount() == 0
800+
&& hold_timing_paths_model_->rowCount() == 0) {
801+
populatePaths();
802+
}
803+
804+
QTableView* table_view
805+
= setup ? setup_timing_table_view_ : hold_timing_table_view_;
806+
QAbstractItemModel* model = table_view->model();
807+
if (model->rowCount() > 0) {
808+
QModelIndex index = model->index(0, 0);
809+
table_view->setCurrentIndex(index);
810+
// Ensure the selection signal is emitted even if the index was already
811+
// selected
812+
selectedRowChanged(table_view->selectionModel()->selection(),
813+
QItemSelection());
814+
}
815+
}
816+
817+
void TimingWidget::clearSelection()
818+
{
819+
setup_timing_table_view_->clearSelection();
820+
hold_timing_table_view_->clearSelection();
821+
}
822+
792823
void TimingWidget::modelWasReset()
793824
{
794825
setup_timing_table_view_->resizeColumnsToContents();

src/gui/src/timingWidget.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ class TimingWidget : public QDockWidget
7171
void updatePaths();
7272
void reportSlackHistogramPaths(const std::set<const sta::Pin*>& report_pins,
7373
const std::string& path_group_name);
74+
void showWorstTimingPath(bool setup);
75+
void clearSelection();
7476

7577
signals:
7678
void highlightTimingPath(TimingPath* timing_path);

0 commit comments

Comments
 (0)