HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
waveform_viewer.h
Go to the documentation of this file.
1 // MIT License
2 //
3 // Copyright (c) 2019 Ruhr University Bochum, Chair for Embedded Security. All Rights reserved.
4 // Copyright (c) 2019 Marc Fyrbiak, Sebastian Wallat, Max Hoffmann ("ORIGINAL AUTHORS"). All rights reserved.
5 // Copyright (c) 2021 Max Planck Institute for Security and Privacy. All Rights reserved.
6 // Copyright (c) 2021 Jörn Langheinrich, Julian Speith, Nils Albartus, René Walendy, Simon Klix ("ORIGINAL AUTHORS"). All Rights reserved.
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in all
16 // copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 // SOFTWARE.
25 
26 #pragma once
27 
28 #include "hal_core/defines.h"
29 #include "hal_core/netlist/gate.h"
30 #include "hal_core/netlist/net.h"
37 
38 #include <functional>
39 #include <map>
40 #include <sstream>
41 #include <QString>
42 #include <QMap>
43 #include <QCheckBox>
44 #include <QTabWidget>
45 #include <vector>
46 #include <memory>
47 #include <unordered_set>
48 
49 class QStatusBar;
50 class QProgressBar;
51 class QCloseEvent;
52 
53 namespace hal
54 {
55  /* forward declaration */
56  class Netlist;
57  class WaveWidget;
58  class WaveData;
59  class Toolbar;
60  class SimulationInput;
61 
66  {
67  public:
69  ExternalContentWidget* contentFactory() const;
70  };
71 
78  {
79  Q_OBJECT
80 
81  public:
82 
83  WaveformViewer(QWidget* parent = nullptr);
84  ~WaveformViewer();
85 
91  virtual void setupToolbar(Toolbar* toolbar) override;
92 
93  void setGates(std::vector<Gate*> gates);
97  void restoreFromProject() override;
98 
100  private Q_SLOTS:
101  void handleCreateControl();
102  void handleSimulSettings();
103  void handleOpenInputFile();
104  void handleSaveWaveforms();
105  void handleInvokeWizzard();
106  void handleAddResultWave();
107  void handleToggleMaxZoom();
108  void handleUndoZoomShift();
109 
110  void handleOpenSettingsDialog();
111  void handleShowEngineOutput();
112 
113  void handleSelectionChanged(void* sender);
114  void handleRefreshNetNames();
115  void setVisualizeNetState(bool state);
116  void handleTabClosed(int inx);
117 
118  public Q_SLOTS:
119  void handleControllerAdded(u32 controllerId);
120  void handleControllerRemoved(u32 controllerId);
121  void handleParseComplete();
122  void displayStatusMessage(const QString& msg = QString());
123  void closeEvent(QCloseEvent *event) override;
124  void currentTabChanged(int inx);
125  void currentStateChanged(NetlistSimulatorController::SimulationState state);
126  void showProgress(int percent);
127  void testUndoEnable();
128 
129  private:
130  bool mVisualizeNetState;
131  bool mOwnershipRequired;
132 
133  QAction* mCreateControlAction;
134  QAction* mSimulSettingsAction;
135  QAction* mOpenInputfileAction;
136  QAction* mSaveWaveformsAction;
137  QAction* mInvokeSWizardAction;
138  QAction* mAddResultWaveAction;
139  QAction* mToggleMaxZoomAction;
140  QAction* mUndoZoomShiftAction;
141 
142  QTabWidget* mTabWidget;
143  QStatusBar* mStatusBar;
144  QProgressBar* mProgress;
145 
146 
147  void takeControllerOwnership(std::unique_ptr<NetlistSimulatorController>& ctrlRef, bool create);
148  void showCloseButton();
149  };
150 } // namespace hal
#define NETLIST_API
Definition: arch_linux.h:30
Toolbar for all ContentFrames and ContentWidgets.
Definition: toolbar.h:39
WaveformViewerFactory(const QString &name)
WaveWidget * mCurrentWaveWidget
uint32_t u32
Definition: defines.h:41
Definition: defines.h:45
std::string name