1 ///////////////////////////////////////////////////////////////////////////////
2 // BSD 3-Clause License
3 //
4 // Copyright (c) 2021, The Regents of the University of California
5 // All rights reserved.
6 //
7 // Redistribution and use in source and binary forms, with or without
8 // modification, are permitted provided that the following conditions are met:
9 //
10 // * Redistributions of source code must retain the above copyright notice, this
11 //   list of conditions and the following disclaimer.
12 //
13 // * Redistributions in binary form must reproduce the above copyright notice,
14 //   this list of conditions and the following disclaimer in the documentation
15 //   and/or other materials provided with the distribution.
16 //
17 // * Neither the name of the copyright holder nor the names of its
18 //   contributors may be used to endorse or promote products derived from
19 //   this software without specific prior written permission.
20 //
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 // POSSIBILITY OF SUCH DAMAGE.
32 
33 #pragma once
34 
35 #include <QDialog>
36 #include <QKeyEvent>
37 #include <QModelIndex>
38 #include <QString>
39 #include <vector>
40 
41 #include "opendb/db.h"
42 #include "staGui.h"
43 #include "timingReportDialog.h"
44 #include "ui_timingDebug.h"
45 
46 namespace ord {
47 class OpenRoad;
48 }
49 
50 namespace gui {
51 class TimingDebugDialog : public QDialog, public Ui::TimingDialog
52 {
53   Q_OBJECT
54  public:
55   TimingDebugDialog(QWidget* parent = nullptr);
56   ~TimingDebugDialog();
57 
getTimingRenderer()58   TimingPathRenderer* getTimingRenderer() { return path_renderer_; }
59 
60  signals:
61   void highlightTimingPath(TimingPath* timing_path);
62 
63  public slots:
64   void accept();
65   void reject();
66   bool populateTimingPaths(odb::dbBlock* block);
67 
68   void keyPressEvent(QKeyEvent* key_event);
69 
70   void showPathDetails(const QModelIndex& index);
71   void highlightPathStage(const QModelIndex& index);
72   void timingPathsViewCustomSort(int col_index);
73   void findNodeInPathDetails();
74 
75   void showPathIndex(int pathId);
76   void showTimingReportDialog();
77   void selectedRowChanged(const QItemSelection& prev_index,
78                           const QItemSelection& curr_index);
79   void selectedDetailRowChanged(const QItemSelection& prev_index,
80                                 const QItemSelection& curr_index);
81 
82   void handleDbChange(QString change_type, std::vector<odb::dbObject*> objects);
83 
84  private:
85   void copy();
86 
87   TimingPathsModel* timing_paths_model_;
88   TimingPathDetailModel* path_details_model_;
89   TimingPathRenderer* path_renderer_;
90   GuiDBChangeListener* dbchange_listener_;
91   TimingReportDialog* timing_report_dlg_;
92   QTableView* focus_view_;
93 };
94 }  // namespace gui
95