Skip to content

Commit

Permalink
Added feature to dispose simulation results except selected probes
Browse files Browse the repository at this point in the history
  • Loading branch information
joern274 committed Jun 24, 2024
1 parent 1415ab1 commit ee758d6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,18 @@ class NETLIST_API NetlistSimulatorController : public QObject {
*/
bool can_import_data() const;

/**
* Discard all results except listed probes
* @param probes List of nets which will be simulated (aka probes)
*/
void simulate_only_probes(const std::vector<const Net*>& probes);

/**
* Discard all results except listed probes
* @param probes Set of net IDs which will be simulated (aka probes)
*/
void simulate_only_probes(const QSet<u32>& probes);

/**
* Store significant information into working directory
* @return True if JSON file created successfully, false otherwise.
Expand Down Expand Up @@ -490,6 +502,7 @@ public Q_SLOTS:
WaveDataList* mWaveDataList;

SimulationInput* mSimulationInput;
QSet<u32> mSimulateOnlyProbes;

QHash<u32,int> mBadAssignInputWarnings;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,17 @@ namespace hal
checkReadyState();
}

void NetlistSimulatorController::simulate_only_probes(const std::vector<const Net*>& probes)
{
for (const Net* n : probes)
mSimulateOnlyProbes.insert(n->get_id());
}

void NetlistSimulatorController::simulate_only_probes(const QSet<u32>& probes)
{
mSimulateOnlyProbes = probes;
}

u32 NetlistSimulatorController::add_trigger_time(const std::vector<WaveData*>& trigger_waves, const std::vector<int>& trigger_on_values)
{
if (trigger_waves.empty())
Expand Down Expand Up @@ -824,15 +835,21 @@ namespace hal
return false;

QList<const Net*> partialNets;
for (const Net* n : get_partial_netlist_nets())
for (const Net* n : get_partial_netlist_nets()){
if (!mSimulateOnlyProbes.empty() && !mSimulateOnlyProbes.contains(n->get_id()))
continue;
partialNets.append(n);
}

if (reader.importVcd(QString::fromStdString(resultFile), mWorkDir, partialNets))
{
mWaveDataList->updateFromSaleae();
}
else
return false;

if (!mSimulateOnlyProbes.isEmpty())
QFile::remove(QString::fromStdString(resultFile.string()));
}
return true;
}
Expand Down

0 comments on commit ee758d6

Please sign in to comment.