HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
wave_data_provider.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 <QMap>
29 #include <QPair>
30 #include "hal_core/defines.h"
36 
37 namespace hal {
38 
39  class WaveDataTimeframe;
40  class WaveData;
41 
46  {
47  WaveData::NetType mWaveType;
48  int mBits;
49  int mValueBase;
50  public:
51  WaveDataProvider() : mWaveType(WaveData::RegularNet), mBits(1), mValueBase(16) {;}
52  virtual ~WaveDataProvider() {;}
53  virtual SaleaeDataTuple startValue(u64 t) = 0;
54  virtual SaleaeDataTuple nextPoint() = 0;
55  bool isGroup() const { return mWaveType == WaveData::NetGroup; }
56  bool isBoolean() const { return mWaveType == WaveData::BooleanNet; }
57  bool isTrigger() const { return mWaveType == WaveData::TriggerTime; }
58  int bits() const { return mBits; }
59  int valueBase() const { return mValueBase; }
60  void setWaveType(WaveData::NetType type, int bts=1, int base=16);
61  };
62 
67  {
68  const QMap<u64,int>& mDataMap;
70  public:
71  WaveDataProviderMap(const QMap<u64,int>& dmap) : mDataMap(dmap) {;}
72  virtual SaleaeDataTuple startValue(u64 t) override;
73  virtual SaleaeDataTuple nextPoint() override;
74  };
75 
80  {
81  public:
89 
90  bool isRecording() const { return mStoreData == Recording; }
91  void storeCurrentDatapoint();
92  public:
94  mTimeframe(tframe), mStoreData(Off) {;}
96  virtual SaleaeDataTuple startValue(u64 t) override;
97  virtual SaleaeDataTuple nextPoint() override;
98 
99  StoreData storeDataState() const { return mStoreData; }
100  const QMap<u64,int>& dataMap() const { return mDataMap; }
101  };
102 
107  {
108  const SimulationInput::Clock& mClock;
109  u64 mTransition;
110  int valueForTransition() const;
111  public:
112  WaveDataProviderClock(const SimulationInput::Clock& clk) : mClock(clk), mTransition(0) {;}
113  virtual SaleaeDataTuple startValue(u64 t) override;
114  virtual SaleaeDataTuple nextPoint() override;
115  };
116 
121  {
122  SaleaeParser mParser;
123  u32* mBitMask;
124  u64 mCurrentTime;
125  u64 mSampleTime;
126  WaveGroupValue mLastValue;
127  WaveGroupValue mNextValue;
128  int mSampleValue;
129  bool mValuePending;
130  bool mEventReady;
131 
132  bool nextEventReady();
133  public:
134  WaveDataProviderGroup(const std::string& saleaeDirectoryPath, const QList<WaveData*>& wdList);
135  virtual ~WaveDataProviderGroup();
136  virtual SaleaeDataTuple startValue(u64 t) override;
137  virtual SaleaeDataTuple nextPoint() override;
138  };
139 
144  {
145  int mInputCount;
146  char* mTruthTable;
147  SaleaeDataTuple convertToBoolean(SaleaeDataTuple sdt);
148  public:
149  WaveDataProviderBoolean(const std::string& saleaeDirectoryPath, const QList<WaveData*>& wdList, const char* ttable);
150  virtual ~WaveDataProviderBoolean();
151  virtual SaleaeDataTuple startValue(u64 t) override;
152  virtual SaleaeDataTuple nextPoint() override;
153  };
154 
159  {
160  SaleaeParser mParser;
161  WaveData* mFilter;
162  int* mTransitionToValue;
163  u64 mCurrentTime;
164  bool mCurrentTrigger;
165  qint64 mReportedTime;
166  public:
167  WaveDataProviderTrigger(const std::string& saleaeDirectoryPath, const QList<WaveData*>& wdList, const QList<int>& toValue, WaveData* filter=nullptr);
168  virtual ~WaveDataProviderTrigger();
169  virtual SaleaeDataTuple startValue(u64 t) override;
170  virtual SaleaeDataTuple nextPoint() override;
171  };
172 }
The SaleaeParser class is an engine which allows to parse any number of SALEAE files into a sequence ...
Definition: saleae_parser.h:74
WaveDataProviderBoolean(const std::string &saleaeDirectoryPath, const QList< WaveData * > &wdList, const char *ttable)
virtual SaleaeDataTuple startValue(u64 t) override
virtual SaleaeDataTuple nextPoint() override
virtual SaleaeDataTuple nextPoint() override
WaveDataProviderClock(const SimulationInput::Clock &clk)
virtual SaleaeDataTuple startValue(u64 t) override
virtual SaleaeDataTuple nextPoint() override
const QMap< u64, int > & dataMap() const
SaleaeDataBuffer * mBuffer
StoreData storeDataState() const
virtual SaleaeDataTuple startValue(u64 t) override
const WaveDataTimeframe & mTimeframe
SaleaeInputFile & mInputFile
WaveDataProviderFile(SaleaeInputFile &sif, const WaveDataTimeframe &tframe)
virtual SaleaeDataTuple nextPoint() override
WaveDataProviderGroup(const std::string &saleaeDirectoryPath, const QList< WaveData * > &wdList)
virtual SaleaeDataTuple startValue(u64 t) override
virtual SaleaeDataTuple nextPoint()=0
virtual SaleaeDataTuple startValue(u64 t)=0
void setWaveType(WaveData::NetType type, int bts=1, int base=16)
WaveDataProviderMap(const QMap< u64, int > &dmap)
virtual SaleaeDataTuple nextPoint() override
virtual SaleaeDataTuple startValue(u64 t) override
WaveDataProviderTrigger(const std::string &saleaeDirectoryPath, const QList< WaveData * > &wdList, const QList< int > &toValue, WaveData *filter=nullptr)
virtual SaleaeDataTuple startValue(u64 t) override
virtual SaleaeDataTuple nextPoint() override
uint64_t u64
Definition: defines.h:42
uint32_t u32
Definition: defines.h:41
Definition: defines.h:45
PinType type