13 #include <QResizeEvent>
14 #include <QWheelEvent>
16 #include <QHeaderView>
18 #include <QApplication>
34 :
QSplitter(parent), mController(ctrl), mControllerOwner(nullptr),
35 mControllerId(ctrl->get_id()), mControllerName(ctrl->get_name()),
36 mOngoingYscroll(false), mVisualizeNetState(false), mAutoAddWaves(true)
40 mTreeView =
new WaveTreeView(mWaveDataList, mWaveItemHash,
this);
42 mTreeModel =
new WaveTreeModel(mWaveDataList, mWaveItemHash, mGraphicsCanvas,
this);
93 log_info(mControllerName,
"Simulation controller id={} name='{}' instantiated", mControllerId, mControllerName);
98 log_info(mControllerName,
"Simulation controller id={} name='{}' disposed", mControllerId, mControllerName);
103 int nWaves = mWaveDataList->
size();
104 for (
int i=0; i<nWaves; i++)
107 if (!wd->
id())
continue;
111 if (netName == wd->
name())
continue;
118 if (!mController)
return 0;
119 return mControllerId;
125 return mController->get_state();
130 return mControllerOwner !=
nullptr;
135 mControllerOwner = std::move(ctrl);
140 return mWaveItemHash->
isEmpty();
156 if (!mControllerOwner)
return false;
164 qApp->processEvents();
170 for (
const ModuleItem* sti : highlight)
180 mController->create_simulation_engine(engineFactoryName.
toStdString());
186 static const char* grpNames[3] = {
"x state",
"0 state",
"1 state"};
187 mVisualizeNetState =
state;
188 if (!activeTab)
return;
189 if (mVisualizeNetState)
191 for (
int i=0; i<3; i++)
199 mGroupIds[i] = grp->
get_id();
207 for (
int i=0; i<3; i++)
222 int n = mWaveDataList->
size();
224 for (
int i=0; i<n; i++)
227 alreadyShownNames.
insert(mWaveDataList->
at(i)->name());
242 if (alreadyShownNames.
contains(netName))
continue;
261 int iwave = it.value();
264 iwave = mWaveDataList->
size();
268 mWaveDataList->
add(wd,
false);
273 wavesToAdd.
append(mWaveDataList->
at(iwave));
276 groupAddedWaves(wavesToAdd);
283 if (!mController || added.
isEmpty())
return;
287 addedNetIds.
insert(wd->id());
290 mController->compute_waveform_groups();
295 bool anyAdded =
false;
296 bool allTopLevel =
true;
297 for (
const Net* n : ng.get_nets())
304 if (addedNetIds.
contains(n->get_id()))
307 if (anyAdded && allTopLevel)
308 mController->add_waveform_group(ng);
331 mController->reset();
332 mController->add_gates(gats);
333 for (
const Net* inpNet : mController->get_input_nets())
334 mController->get_waveform_by_net(inpNet);
337 void WaveWidget::handleNumberWaveformChanged(
int count)
342 if (expectMoreEvents)
return;
351 int w =
event->size().width() - 320;
356 void WaveWidget::visualizeCurrentNetState(
double tCursor,
int xpos)
360 for (
auto it = mWaveItemHash->
begin(); it != mWaveItemHash->
end(); ++it)
369 if (val < -1 || val > 1)
continue;
370 netState[val+1].
insert(n);
373 for (
int i=0; i<3; i++)
377 for (Net* n : grp->get_nets())
379 auto it = netState[i].
find(n);
380 if (it == netState[i].end())
383 netState[i].
erase(it);
385 for (Net* n : netState[i])
386 grp->assign_net(n,
true);
392 if (mOngoingYscroll)
return;
393 mOngoingYscroll =
true;
404 mOngoingYscroll =
false;
SelectionDetailsWidget * getSelectionDetailsWidget()
GroupingManagerWidget * getGroupingManagerWidget()
Table that holds information about all groupings.
Grouping * groupingByName(const QString &name) const
QColor recolorGrouping(u32 id, const QColor &groupingColor)
const std::string & get_name() const
Grouping * create_grouping(const u32 grouping_id, const std::string &name="")
bool delete_grouping(Grouping *grouping)
Net * get_net_by_id(u32 net_id) const
Grouping * get_grouping_by_id(u32 grouping_id) const
void stateChanged(hal::NetlistSimulatorController::SimulationState state)
WaveDataList * get_waves() const
void loadProgress(int percent)
static SimulationSettings * sSimulationSettings
The SaleaeDirectory class provides the API for the SALEAE directory file. The SALEAE directory file w...
int get_next_available_index() const
Getter for next available file index ('digital_XXX.bin' with lowest number XXX not in use)
std::vector< ListEntry > get_net_list() const
Getter for all net entries.
bool loadSaleae(const WaveDataTimeframe &tframe=WaveDataTimeframe())
void updateWaveName(int iwave, const QString &nam)
void waveUpdated(int inx, int grpId)
void booleanAdded(int boolId)
void waveRemovedFromGroup(int iwave, int grpId)
void add(WaveData *wd, bool updateSaleae)
void triggerEndResetModel()
int waveIndexByNetId(u32 id) const
void groupAdded(int grpId)
void waveRemoved(int inx)
void waveRenamed(int iwave)
void timeframeChanged(const hal::WaveDataTimeframe *tframe)
const WaveDataTimeframe & timeFrame() const
void triggerAdded(int trigId)
void groupRenamed(int grpId)
void removeGroup(u32 grpId)
void groupAboutToBeRemoved(hal::WaveDataGroup *grp)
void triggerBeginResetModel()
void groupUpdated(int grpId)
void waveAddedToGroup(const QVector< u32 > &netIds, int grpId)
void handleWaveUpdated(int iwave, int groupId)
void handleTimeframeChanged(const hal::WaveDataTimeframe *tframe)
void cursorMoved(double tCursor, int xpos)
int importedWires() const
const WaveData * wavedata() const
int cursorValue(double tCursor, int xpos)
QMap< WaveSelectionEntry, int > selectedWaves() const
void addWaves(const QVector< WaveData * > &wds)
void handleWaveAddedToGroup(const QVector< u32 > &netIds, int grpId)
void handleWaveRemovedFromGroup(int iwave, int grpId)
void handleWaveAdded(int iwave)
void numberEntriesChanged(int count)
void handleGroupRenamed(int grpId)
bool isTopLevelNet(u32 netId) const
void forwardEndResetModel()
void inserted(QModelIndex index)
int decreaseNumberEntriesChangedEvents()
void handleWaveRemoved(int iwave)
void handleTriggerAdded(int trigId)
void handleGroupAboutToBeRemoved(WaveDataGroup *grp)
void handleCursorMoved(u64 tCursor, int xpos)
void handleWaveRenamed(int iwave)
void handleGroupAdded(int grpId)
QSet< int > waveDataIndexSet() const
void forwardBeginResetModel()
void handleGroupUpdated(int grpId)
void handleBooleanAdded(int boolId)
void handleInserted(const QModelIndex &index)
void setWaveSelection(const QSet< u32 > &netIds)
void triggerUpdateWaveItems()
#define log_info(channel,...)
ContentManager * gContentManager
bool isEmpty() const const
const T & at(int i) const const
QMap::const_iterator constBegin() const const
QMap::const_iterator constEnd() const const
QMap::iterator insert(const Key &key, const T &value)
bool isEmpty() const const
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
QObject * parent() const const
bool contains(const T &value) const const
QSet::iterator erase(QSet::iterator pos)
QSet::iterator find(const T &value)
QSet::iterator insert(const T &value)
virtual bool event(QEvent *e) override
virtual void resizeEvent(QResizeEvent *) override
void setSizes(const QList< int > &list)
QString fromStdString(const std::string &str)
std::string toStdString() const const
void setColumnWidth(int column, int width)
virtual void setModel(QAbstractItemModel *model) override
void append(const T &value)
bool isEmpty() const const