HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
wave_form_painted.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 #include <QList>
28 #include <QMap>
29 #include <QMutex>
31 #include "hal_core/defines.h"
32 
33 class QPainter;
34 
35 namespace hal {
36  class WaveData;
37  class WaveItemHash;
38  class WaveDataList;
39  class WaveFormPrimitive;
40  class WaveFormPrimitiveFilled;
41 
42  class WaveScrollbar;
43  class WaveTransform;
44  class WaveDataProvider;
45 
50  {
51  public:
52  double mCenterTime;
53  double mDuration;
54  TimeInterval(quint64 t0 = 0, quint64 t1 = 0) : mCenterTime(0.5*(t0+t1)), mDuration(t1-t0) {;}
55  bool operator<(const TimeInterval& other) const;
56  };
57 
62  {
63  QList<WaveFormPrimitive*> mPrimitives;
64  WaveZoomShift mValidity;
65  TimeInterval mShortestToggle;
66  u64 mCursorTime;
67  int mCursorXpos;
68  int mCursorValue;
69  QMutex mMutex;
70 
71  void clonePrimitives(const WaveFormPainted& other);
72  public:
74  WaveFormPainted(const WaveFormPainted& other);
76  void clearPrimitives();
77 
78  void paint(int y0, QPainter& painter);
79 
80  void generate(WaveDataProvider* wdp, const WaveTransform* trans, const WaveScrollbar* sbar, bool* loop);
81  void generateTrigger(WaveDataProvider* wdp, const WaveTransform* trans, const WaveScrollbar* sbar, bool* loop);
82  bool generateGroup(const WaveData* wd, const WaveItemHash *hash);
83  bool generateBoolean(const WaveData* wd, const WaveDataList* wdList, const WaveItemHash *hash);
84 
85  int numberPrimitives() const { return mPrimitives.size(); }
86 
87  float x0() const;
88  float x1() const;
89 
90  int valueXpos(int xpos);
91 
92  const WaveZoomShift& validity() const { return mValidity; }
93  bool isEmpty() const { return mPrimitives.isEmpty(); }
95  TimeInterval shortestToggle() const { return mShortestToggle; }
96  void setCursorValue(u64 tCursor, int xpos, int val);
97  int cursorValueStored(u64 tCursor, int xpos) const;
98  int cursorValuePainted(u64 tCursor, int xpos);
99  int cursorValueTrigger(u64 tCursor, int xpos);
101  };
102 }
bool operator<(const TimeInterval &other) const
TimeInterval(quint64 t0=0, quint64 t1=0)
QMap< float, int > primitiveValues()
void setCursorValue(u64 tCursor, int xpos, int val)
const WaveZoomShift & validity() const
void generateTrigger(WaveDataProvider *wdp, const WaveTransform *trans, const WaveScrollbar *sbar, bool *loop)
int numberPrimitives() const
void paint(int y0, QPainter &painter)
int cursorValuePainted(u64 tCursor, int xpos)
bool generateBoolean(const WaveData *wd, const WaveDataList *wdList, const WaveItemHash *hash)
WaveFormPainted & operator=(const WaveFormPainted &other)
int cursorValueTrigger(u64 tCursor, int xpos)
void generate(WaveDataProvider *wdp, const WaveTransform *trans, const WaveScrollbar *sbar, bool *loop)
int cursorValueStored(u64 tCursor, int xpos) const
bool generateGroup(const WaveData *wd, const WaveItemHash *hash)
TimeInterval shortestToggle() const
uint64_t u64
Definition: defines.h:42
Definition: defines.h:45
bool isEmpty() const const
int size() const const