HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
hal::NetlistSimulatorController Class Reference

#include </home/runner/work/hal/hal/plugins/simulator/netlist_simulator_controller/include/netlist_simulator_controller/netlist_simulator_controller.h>

Inheritance diagram for hal::NetlistSimulatorController:
Inheritance graph
Collaboration diagram for hal::NetlistSimulatorController:
Collaboration graph

Classes

struct  InputColumnHeader
 

Public Types

enum  SimulationState {
  NoGatesSelected , ParameterSetup , ParameterReady , SimulationRun ,
  ShowResults , EngineFailed
}
 
enum  FilterInputFlag { GlobalInputs , PartialNetlist , CompleteNetlist , NoFilter }
 

Public Slots

void handleOpenInputFile (const QString &filename)
 
void handleSelectGates ()
 
void handleRunFinished (bool success)
 

Signals

void stateChanged (hal::NetlistSimulatorController::SimulationState state)
 
void engineFinished (bool success)
 
void parseComplete ()
 
void loadProgress (int percent)
 

Public Member Functions

 NetlistSimulatorController (u32 id, const std::string nam, const std::string &workdir, QObject *parent=nullptr)
 
 NetlistSimulatorController (u32 id, Netlist *nl, const std::string &filename, QObject *parent=nullptr)
 
 ~NetlistSimulatorController ()
 
SimulationEnginecreate_simulation_engine (const std::string &name)
 
SimulationEngineget_simulation_engine () const
 
void add_clock_frequency (const Net *clock_net, u64 frequency, bool start_at_zero=true)
 
void add_clock_period (const Net *clock_net, u64 period, bool start_at_zero=true, u64 duration=0)
 
void set_no_clock_used ()
 
bool is_no_clock_used () const
 
u32 add_waveform_group (const std::string &name, const std::vector< Net * > &nets)
 
u32 add_waveform_group (const PinGroup< ModulePin > *pin_group)
 
u32 add_waveform_group (const Gate *gate, const PinGroup< GatePin > *pin_group)
 
u32 add_waveform_group (const std::string &name, const PinGroup< ModulePin > *pin_group)
 
u32 add_boolean_expression_waveform (const std::string &expression)
 
u32 add_boolean_accept_list_waveform (const std::vector< WaveData * > &input_waves, const std::vector< int > &accepted_combination)
 
u32 add_trigger_time (const std::vector< WaveData * > &trigger_waves, const std::vector< int > &trigger_on_values=std::vector< int >())
 
void remove_waveform_group (u32 group_id)
 
void add_gates (const std::vector< Gate * > &gates)
 
void compute_waveform_groups ()
 
void load_waveform_groups (bool inputs)
 
void set_input (const Net *net, BooleanFunction::Value value)
 
void set_input (WaveData *wd, BooleanFunction::Value value)
 
void set_input (const std::vector< Net * > &nets, const std::vector< BooleanFunction::Value > &values)
 
void set_input (const WaveDataGroup *wdg, const std::vector< BooleanFunction::Value > &values)
 
void set_input (const u32 id, const std::vector< BooleanFunction::Value > &values)
 
void set_input (const PinGroup< ModulePin > *pin_group, const std::vector< BooleanFunction::Value > &values)
 
void initialize ()
 
void simulate (u64 picoseconds)
 
void reset ()
 
const std::unordered_set< const Gate * > & get_gates () const
 
const std::unordered_set< const Net * > & get_input_nets () const
 
std::vector< InputColumnHeaderget_input_column_headers () const
 
const std::vector< const Net * > & get_output_nets () const
 
const std::vector< const Net * > & get_partial_netlist_nets () const
 
std::vector< std::string > get_engine_names () const
 
QString name () const
 
std::string get_name () const
 
u32 get_id () const
 
bool get_results ()
 
u64 get_max_simulated_time () const
 
bool run_simulation ()
 
bool import_vcd (const std::string &filename, FilterInputFlag filter)
 
void import_csv (const std::string &filename, FilterInputFlag filter, u64 timescale=1000000000)
 
void import_saleae (const std::string &dirname, std::unordered_map< Net *, int > lookupTable, u64 timescale=1000000000)
 
void import_simulation (const std::string &dirname, FilterInputFlag filter, u64 timescale=1000000000)
 
void set_saleae_timescale (u64 timescale=1000000000)
 
bool generate_vcd (const std::filesystem::path &path, u32 start_time=0, u32 end_time=0, std::set< const Net * > nets={}) const
 
std::string get_working_directory () const
 
bool is_legal_directory_name () const
 
std::filesystem::path get_saleae_directory_filename () const
 
WaveDataListget_waves () const
 
SimulationState get_state () const
 
WaveDataget_waveform_by_net (const Net *n) const
 
void rename_waveform (WaveData *wd, std::string name)
 
WaveDataGroupget_waveform_group_by_id (u32 id) const
 
WaveDataBooleanget_waveform_boolean_by_id (u32 id) const
 
WaveDataTriggerget_trigger_time_by_id (u32 id) const
 
void set_timeframe (u64 tmin=0, u64 tmax=0)
 
void emitLoadProgress (int percent)
 
bool can_import_data () const
 
void simulate_only_probes (const std::vector< const Net * > &probes)
 
void simulate_only_probes (const QSet< u32 > &probes)
 
bool persist () const
 
void setLogReceiver (SimulationLogReceiver *logrec)
 
- Public Member Functions inherited from QObject
virtual const QMetaObjectmetaObject () const const
 
 QObject (QObject *parent)
 
virtual ~QObject ()
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
QString objectName () const const
 
void setObjectName (const QString &name)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
bool signalsBlocked () const const
 
bool blockSignals (bool block)
 
QThreadthread () const const
 
void moveToThread (QThread *targetThread)
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
void killTimer (int id)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
const QObjectListchildren () const const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectTree ()
 
void dumpObjectInfo ()
 
void dumpObjectTree () const const
 
void dumpObjectInfo () const const
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const const
 
QList< QByteArraydynamicPropertyNames () const const
 
void destroyed (QObject *obj)
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
bool inherits (const char *className) const const
 
void deleteLater ()
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
 Q_CLASSINFO (Name, Value)
 
 Q_INTERFACES (...)
 
 Q_PROPERTY (...)
 
 Q_ENUMS (...)
 
 Q_FLAGS (...)
 
 Q_ENUM (...)
 
 Q_FLAG (...)
 
 Q_ENUM_NS (...)
 
 Q_FLAG_NS (...)
 
 Q_OBJECT Q_OBJECT
 
 Q_GADGET Q_GADGET
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SLOTS Q_SLOTS
 
 Q_SLOT Q_SLOT
 
 Q_EMIT Q_EMIT
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 

Static Public Attributes

static const char * sPersistFile = "netlist_simulator_controller.json"
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from QObject
QObjectsender () const const
 
int senderSignalIndex () const const
 
int receivers (const char *signal) const const
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
virtual void timerEvent (QTimerEvent *event)
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

Drives a single simulation run from gate selection over input generation to the results. It is the central entry point for simulation, independent of the engine that eventually performs it.

Definition at line 61 of file netlist_simulator_controller.h.

Member Enumeration Documentation

◆ FilterInputFlag

Enumerator
GlobalInputs 
PartialNetlist 
CompleteNetlist 
NoFilter 

Definition at line 73 of file netlist_simulator_controller.h.

◆ SimulationState

Enumerator
NoGatesSelected 
ParameterSetup 
ParameterReady 
SimulationRun 
ShowResults 
EngineFailed 

Definition at line 65 of file netlist_simulator_controller.h.

Constructor & Destructor Documentation

◆ NetlistSimulatorController() [1/2]

◆ NetlistSimulatorController() [2/2]

◆ ~NetlistSimulatorController()

hal::NetlistSimulatorController::~NetlistSimulatorController ( )

Member Function Documentation

◆ add_boolean_accept_list_waveform()

u32 hal::NetlistSimulatorController::add_boolean_accept_list_waveform ( const std::vector< WaveData * > &  input_waves,
const std::vector< int > &  accepted_combination 
)

Add boolean waveform based on list of accepted combinations

Parameters
input_wavesList of input waveforms
accepted_combinationList of accepted combinations. Each combination is coded as binary integer value which is matched bitwise with value of input waveform.
Returns
ID of new boolean waveform

Definition at line 344 of file netlist_simulator_controller.cpp.

References QList::append(), and hal::WaveData::id().

Referenced by hal::PYBIND11_PLUGIN().

◆ add_boolean_expression_waveform()

u32 hal::NetlistSimulatorController::add_boolean_expression_waveform ( const std::string &  expression)

Add waveform based on boolean expression.

Parameters
expressionThe boolean expression based on names of existing waveforms.
Returns
ID of new boolean waveform

Definition at line 330 of file netlist_simulator_controller.cpp.

References QString::fromStdString(), and hal::WaveData::id().

Referenced by hal::PYBIND11_PLUGIN().

◆ add_clock_frequency()

void hal::NetlistSimulatorController::add_clock_frequency ( const Net clock_net,
u64  frequency,
bool  start_at_zero = true 
)

Specify a net that carries the clock signal and set the clock frequency in hertz. This function can only be called before the simulation has been initialized.

Parameters
[in]clock_net- The net that carries the clock signal.
[in]frequency- The clock frequency in hertz.
[in]start_at_zero- Initial clock state is 0 if true, 1 otherwise.

Definition at line 1009 of file netlist_simulator_controller.cpp.

References add_clock_period().

Referenced by hal::PYBIND11_PLUGIN().

◆ add_clock_period()

void hal::NetlistSimulatorController::add_clock_period ( const Net clock_net,
u64  period,
bool  start_at_zero = true,
u64  duration = 0 
)

Specify a net that carries the clock signal and set the clock period in picoseconds. This function can only be called before the simulation has been initialized.

Parameters
[in]clock_net- The net that carries the clock signal.
[in]period- The clock period from rising edge to rising edge in picoseconds.
[in]start_at_zero- Initial clock state is 0 if true, 1 otherwise.
[in]duration- Optional max time limit when showing clock in VCD viewer or editor

Definition at line 1029 of file netlist_simulator_controller.cpp.

References hal::SimulationInput::add_clock(), hal::WaveDataList::addOrReplace(), hal::SimulationInput::Clock::clock_net, get_name(), log_warning, hal::SimulationInput::Clock::start_at_zero, and hal::SimulationInput::Clock::switch_time.

Referenced by add_clock_frequency(), NetlistSimulatorController(), hal::PYBIND11_PLUGIN(), and hal::PageClock::validatePage().

◆ add_gates()

void hal::NetlistSimulatorController::add_gates ( const std::vector< Gate * > &  gates)

Add gates to the simulation set that contains all gates that are considered during simulation. This function can only be called before the simulation has been initialized.

Parameters
[in]gates- The gates to add.

Definition at line 1087 of file netlist_simulator_controller.cpp.

References hal::SimulationInput::add_gates(), hal::WaveDataList::addOrReplace(), QSet::contains(), hal::SimulationInput::get_input_nets(), get_name(), hal::SimulationInput::has_gates(), hal::WaveData::InputNet, QSet::insert(), log_warning, NoGatesSelected, ParameterSetup, hal::WaveDataList::remove(), and hal::WaveDataList::toSet().

Referenced by hal::PYBIND11_PLUGIN(), and hal::PageSelectGates::validatePage().

◆ add_trigger_time()

u32 hal::NetlistSimulatorController::add_trigger_time ( const std::vector< WaveData * > &  trigger_waves,
const std::vector< int > &  trigger_on_values = std::vector<int>() 
)

Add trigger time vector based on wave transitions.

Parameters
trigger_wavesList of source waveform to generate trigger time
trigger_on_valuesOptional list of values. Order of values must match order of waveform. Trigger will only be generated upon transition to value.
Returns
ID of new trigger time

Definition at line 306 of file netlist_simulator_controller.cpp.

References QList::append(), and hal::WaveData::id().

Referenced by hal::PYBIND11_PLUGIN().

◆ add_waveform_group() [1/4]

u32 hal::NetlistSimulatorController::add_waveform_group ( const Gate gate,
const PinGroup< GatePin > *  pin_group 
)

Create a waveform group from the nets of a given gate pin group.

Parameters
gateThe gate the pin group belongs to.
pin_groupThe pin_group to create waveform group from.
Returns
ID of new waveform group

Definition at line 411 of file netlist_simulator_controller.cpp.

References add_waveform_group(), hal::Gate::get_fan_in_net(), hal::Gate::get_fan_out_net(), hal::PinGroup< T >::get_name(), get_name(), hal::PinGroup< T >::get_pins(), hal::input, log_warning, and hal::output.

◆ add_waveform_group() [2/4]

u32 hal::NetlistSimulatorController::add_waveform_group ( const PinGroup< ModulePin > *  pin_group)

Create a waveform group from the nets of a given module pin group.

Parameters
pin_groupThe pin_group to create waveform group from.
Returns
ID of new waveform group

Definition at line 395 of file netlist_simulator_controller.cpp.

References add_waveform_group(), hal::PinGroup< T >::get_name(), get_name(), hal::PinGroup< T >::get_pins(), and log_warning.

◆ add_waveform_group() [3/4]

u32 hal::NetlistSimulatorController::add_waveform_group ( const std::string &  name,
const PinGroup< ModulePin > *  pin_group 
)

Create a waveform group from the nets of a given module pin group.

Parameters
pin_groupThe pin_group to create waveform group from.
nameThe name of the newly created waveform group from.
Returns
ID of new waveform group

Definition at line 443 of file netlist_simulator_controller.cpp.

References add_waveform_group(), hal::PinGroup< T >::get_name(), get_name(), hal::PinGroup< T >::get_pins(), log_warning, and name().

◆ add_waveform_group() [4/4]

u32 hal::NetlistSimulatorController::add_waveform_group ( const std::string &  name,
const std::vector< Net * > &  nets 
)

Add waveform group. Netlist must not be empty. First net in list is considered the lowest significant bit.

Parameters
nameThe waveform group name
netsList of nets for group
Returns
ID of new waveform group

Definition at line 368 of file netlist_simulator_controller.cpp.

References hal::WaveDataList::addWavesToGroup(), QVector::append(), QString::fromStdString(), get_name(), get_waveform_by_net(), hal::WaveData::id(), QVector::isEmpty(), log_warning, name(), and QVector::reserve().

Referenced by add_waveform_group(), load_waveform_groups(), and hal::PYBIND11_PLUGIN().

◆ can_import_data()

bool hal::NetlistSimulatorController::can_import_data ( ) const

Controller is in a state that allows import from VCD, CSV, or SALEAE waveform data

Returns
true if import is allowed, false otherwise.

Definition at line 699 of file netlist_simulator_controller.cpp.

References ParameterReady, ParameterSetup, and ShowResults.

Referenced by hal::PageInputData::validatePage().

◆ compute_waveform_groups()

void hal::NetlistSimulatorController::compute_waveform_groups ( )

Create groups of waveform signals. Internally the routine is evaluating whether simulated nets are connected to pins which are grouped either by module pingroups or gate pingroups. Note that this method only identifies the groups. No waveform data gets loaded at this point since the singals might not be available yet (e.g. before simulation has run)

Definition at line 1053 of file netlist_simulator_controller.cpp.

References hal::SimulationInput::compute_net_groups().

Referenced by hal::PageSelectGates::validatePage().

◆ create_simulation_engine()

SimulationEngine * hal::NetlistSimulatorController::create_simulation_engine ( const std::string &  name)

Call to one of the registered engine factories to create a new engine. Controller will take ownership for new engine.

Parameters
[in]namename of engine factory (thus name of the engine)
Returns
Pointer to engine if successfully created, nullptr otherwise

Definition at line 250 of file netlist_simulator_controller.cpp.

References hal::SimulationEngineFactory::createEngine(), hal::SimulationEngineFactories::factoryByName(), get_name(), get_working_directory(), hal::SimulationEngineFactories::instance(), log_info, name(), hal::SimulationEngine::name(), and hal::SimulationEngine::set_working_directory().

Referenced by NetlistSimulatorController(), hal::PYBIND11_PLUGIN(), and hal::PageEngine::validatePage().

◆ emitLoadProgress()

void hal::NetlistSimulatorController::emitLoadProgress ( int  percent)

Emit load progress when importing VCD, CSV, or SALEAE waveform

Parameters
[in]percentload progress, negative values to hide progess bar

Definition at line 709 of file netlist_simulator_controller.cpp.

References loadProgress(), and QObject::Q_EMIT().

◆ engineFinished

void hal::NetlistSimulatorController::engineFinished ( bool  success)
signal

Referenced by handleRunFinished().

◆ generate_vcd()

bool hal::NetlistSimulatorController::generate_vcd ( const std::filesystem::path &  path,
u32  start_time = 0,
u32  end_time = 0,
std::set< const Net * >  nets = {} 
) const

Generates the a partial VCD file for parts the simulated netlist.

Parameters
[in]path- The path to the VCD file.
[in]start_time- Start of the timeframe to write to the file (in picoseconds).
[in]end_time- End of the timeframe to write to the file (in picoseconds).
[in]nets- Nets to include in the VCD file.
Returns
true if the file gerneration was successful, false otherwise.

Definition at line 1291 of file netlist_simulator_controller.cpp.

References QList::append(), hal::VcdSerializer::exportVcd(), QString::fromStdString(), hal::WaveDataTimeframe::sceneMaxTime(), hal::WaveDataTimeframe::sceneMinTime(), hal::WaveDataList::timeFrame(), and hal::WaveDataList::waveDataByNet().

Referenced by hal::PYBIND11_PLUGIN().

◆ get_engine_names()

std::vector< std::string > hal::NetlistSimulatorController::get_engine_names ( ) const

Shortcut to SimulationEngines::instance()->names()

Returns
names of registered simulation engines

Definition at line 273 of file netlist_simulator_controller.cpp.

References hal::SimulationEngineFactories::factoryNames(), and hal::SimulationEngineFactories::instance().

Referenced by hal::PYBIND11_PLUGIN().

◆ get_gates()

const std::unordered_set< const Gate * > & hal::NetlistSimulatorController::get_gates ( ) const

◆ get_id()

u32 hal::NetlistSimulatorController::get_id ( ) const
inline

Getter for controller ID

Returns
the ID

Definition at line 346 of file netlist_simulator_controller.h.

Referenced by hal::NetlistSimulatorControllerMap::addController(), persist(), and hal::PYBIND11_PLUGIN().

◆ get_input_column_headers()

◆ get_input_nets()

const std::unordered_set< const Net * > & hal::NetlistSimulatorController::get_input_nets ( ) const

◆ get_max_simulated_time()

u64 hal::NetlistSimulatorController::get_max_simulated_time ( ) const

Convenience method to get the last time covered by simulation. This is the last transition found in waveforms.

Returns
Maximum of simulated time

Definition at line 236 of file netlist_simulator_controller.cpp.

References hal::WaveDataTimeframe::simulateMaxTime(), and hal::WaveDataList::timeFrame().

Referenced by hal::PYBIND11_PLUGIN().

◆ get_name()

std::string hal::NetlistSimulatorController::get_name ( ) const
inline

◆ get_output_nets()

const std::vector< const Net * > & hal::NetlistSimulatorController::get_output_nets ( ) const

◆ get_partial_netlist_nets()

const std::vector< const Net * > & hal::NetlistSimulatorController::get_partial_netlist_nets ( ) const

◆ get_results()

bool hal::NetlistSimulatorController::get_results ( )

Get simulated data from engine, either from shared memory or from VCD file

Returns
true on success, false otherwise

Definition at line 945 of file netlist_simulator_controller.cpp.

References EngineFailed, and ShowResults.

Referenced by hal::PageRunSimulation::handleEngineFinished(), and hal::PYBIND11_PLUGIN().

◆ get_saleae_directory_filename()

std::filesystem::path hal::NetlistSimulatorController::get_saleae_directory_filename ( ) const

Get the filename of SALEAE directory file (JSON format).

Returns
filename as std path

Definition at line 245 of file netlist_simulator_controller.cpp.

References hal::SaleaeDirectory::get_filename(), and hal::WaveDataList::saleaeDirectory().

Referenced by hal::Wizard::Wizard().

◆ get_simulation_engine()

SimulationEngine * hal::NetlistSimulatorController::get_simulation_engine ( ) const

Getter for simulation engine (if any)

Returns
Pointer to engine or nullptr

Definition at line 268 of file netlist_simulator_controller.cpp.

◆ get_state()

SimulationState hal::NetlistSimulatorController::get_state ( ) const
inline

Getter for controller state

Returns
state of type SimulationState

Definition at line 442 of file netlist_simulator_controller.h.

Referenced by hal::PageRunSimulation::handleEngineFinished(), hal::PageRunSimulation::nextId(), and hal::PageRunSimulation::validatePage().

◆ get_trigger_time_by_id()

WaveDataTrigger * hal::NetlistSimulatorController::get_trigger_time_by_id ( u32  id) const

Getter for trigger time set.

Parameters
[in]id- Trigger time id.
Returns
The trigger time object which derives from WaveData.

Definition at line 656 of file netlist_simulator_controller.cpp.

References hal::WaveDataList::mDataTrigger.

Referenced by hal::PYBIND11_PLUGIN().

◆ get_waveform_boolean_by_id()

WaveDataBoolean * hal::NetlistSimulatorController::get_waveform_boolean_by_id ( u32  id) const

Getter for boolean waveform (which is a combination of several other waveform by boolean operation).

Parameters
[in]id- Boolean waveform id.
Returns
The boolean waveform object

Definition at line 651 of file netlist_simulator_controller.cpp.

References hal::WaveDataList::mDataBooleans.

Referenced by hal::PYBIND11_PLUGIN().

◆ get_waveform_by_net()

WaveData * hal::NetlistSimulatorController::get_waveform_by_net ( const Net n) const

Getter for a single waveform

Parameters
[in]n- The net the waveform is associated with.
Returns
The waveform data

Definition at line 640 of file netlist_simulator_controller.cpp.

References hal::Net::get_id(), hal::WaveDataList::triggerAddToView(), and hal::WaveDataList::waveDataByNet().

Referenced by add_waveform_group(), hal::PYBIND11_PLUGIN(), and hal::PageSelectGates::validatePage().

◆ get_waveform_group_by_id()

WaveDataGroup * hal::NetlistSimulatorController::get_waveform_group_by_id ( u32  id) const

Getter for waveform group

Parameters
[in]id- Waveform group id.
Returns
The waveform group object

Definition at line 646 of file netlist_simulator_controller.cpp.

References hal::WaveDataList::mDataGroups.

Referenced by hal::PYBIND11_PLUGIN(), and set_input().

◆ get_waves()

WaveDataList* hal::NetlistSimulatorController::get_waves ( ) const
inline

Getter for wave data list - simulation input as well as output

Returns
const pointer to wave data list

Definition at line 436 of file netlist_simulator_controller.h.

Referenced by hal::PerfTestPlugin::cmp_sim_data(), hal::PageSelectGates::validatePage(), hal::PageInputData::validatePage(), hal::PageLoadResults::validatePage(), and hal::WaveWidget::WaveWidget().

◆ get_working_directory()

std::string hal::NetlistSimulatorController::get_working_directory ( ) const

The working directory. Directory is temporary and will be removed when controller gets deleted

Returns
directory path

Definition at line 222 of file netlist_simulator_controller.cpp.

References QString::toStdString().

Referenced by create_simulation_engine(), hal::NetlistSimulatorControllerPlugin::create_simulator_controller(), hal::PYBIND11_PLUGIN(), hal::NetlistSimulatorControllerPlugin::restore_simulator_controller(), and hal::PageInputData::validatePage().

◆ handleOpenInputFile

void hal::NetlistSimulatorController::handleOpenInputFile ( const QString filename)
slot

◆ handleRunFinished

void hal::NetlistSimulatorController::handleRunFinished ( bool  success)
slot

◆ handleSelectGates

void hal::NetlistSimulatorController::handleSelectGates ( )
slot

Definition at line 1283 of file netlist_simulator_controller.cpp.

◆ import_csv()

void hal::NetlistSimulatorController::import_csv ( const std::string &  filename,
FilterInputFlag  filter,
u64  timescale = 1000000000 
)

Import CSV file and convert content into SALEAE format

Parameters
[in]filenamethe filename to read
[in]filterfilter to select waveform data from file
[in]timescalemultiplication factor for time value in first column

Definition at line 741 of file netlist_simulator_controller.cpp.

References QList::append(), QString::fromStdString(), hal::VcdSerializer::importCsv(), NoFilter, parseComplete(), QObject::Q_EMIT(), and hal::WaveDataList::updateFromSaleae().

Referenced by hal::PYBIND11_PLUGIN(), and hal::PageInputData::validatePage().

◆ import_saleae()

void hal::NetlistSimulatorController::import_saleae ( const std::string &  dirname,
std::unordered_map< Net *, int >  lookupTable,
u64  timescale = 1000000000 
)

Import nets given by lookup table from SALEAE directory

Parameters
[in]dirnamethe directory to import files from
[in]lookupTablemapping nets to be imported with saleae file index
[in]timescalemultiplication factor for time value if SALEAE data in float format

Definition at line 762 of file netlist_simulator_controller.cpp.

References QString::fromStdString(), hal::VcdSerializer::importSaleae(), parseComplete(), QObject::Q_EMIT(), and hal::WaveDataList::updateFromSaleae().

Referenced by hal::PYBIND11_PLUGIN(), and hal::PageInputData::validatePage().

◆ import_simulation()

void hal::NetlistSimulatorController::import_simulation ( const std::string &  dirname,
FilterInputFlag  filter,
u64  timescale = 1000000000 
)

Imports nets from simulation working directory. Existing saleae directory required to nets with binary data

Parameters
[in]dirnamethe directory to import files from
[in]filterfilter to select waveform data for import
[in]timescalemultiplication factor for time value if SALEAE data in float format

Definition at line 773 of file netlist_simulator_controller.cpp.

References QDir::absoluteFilePath(), QFile::copy(), QDir::entryInfoList(), QString::fromStdString(), hal::SaleaeDirectory::get_datafile_index(), hal::SaleaeDirectory::get_directory(), get_name(), hal::VcdSerializer::importSaleae(), log_warning, NoFilter, parseComplete(), QObject::Q_EMIT(), QFile::remove(), hal::WaveDataList::saleaeDirectory(), QString::toStdString(), and hal::WaveDataList::updateFromSaleae().

Referenced by hal::PYBIND11_PLUGIN().

◆ import_vcd()

bool hal::NetlistSimulatorController::import_vcd ( const std::string &  filename,
FilterInputFlag  filter 
)

Import VCD file and convert content into SALEAE format

Parameters
[in]filenamethe filename to read
[in]filterfilter to select waveform data from file

Definition at line 714 of file netlist_simulator_controller.cpp.

References QList::append(), QString::fromStdString(), hal::VcdSerializer::importVcd(), NoFilter, parseComplete(), QObject::Q_EMIT(), and hal::WaveDataList::updateFromSaleae().

Referenced by hal::PYBIND11_PLUGIN(), and hal::PageInputData::validatePage().

◆ initialize()

void hal::NetlistSimulatorController::initialize ( )

Initialize the simulation. No additional gates or clocks can be added after this point.

Definition at line 1266 of file netlist_simulator_controller.cpp.

Referenced by hal::PYBIND11_PLUGIN().

◆ is_legal_directory_name()

bool hal::NetlistSimulatorController::is_legal_directory_name ( ) const

Verilator's gmake disallows spaces in directory name. Other tests (e.g. dot) might be added in future.

Returns
true if directory name is legal, false otherwise

Definition at line 227 of file netlist_simulator_controller.cpp.

References QString::contains().

Referenced by hal::NetlistSimulatorControllerPlugin::create_simulator_controller().

◆ is_no_clock_used()

bool hal::NetlistSimulatorController::is_no_clock_used ( ) const

Check wether no clock signal will be automatically generated as simulation input. Either there is no clock present or the clock signal will be passed as normal waveform input.

Definition at line 288 of file netlist_simulator_controller.cpp.

References hal::SimulationInput::is_no_clock_used().

Referenced by hal::PageInputData::initializePage().

◆ load_waveform_groups()

void hal::NetlistSimulatorController::load_waveform_groups ( bool  inputs)

Load waveform signal groups into container either for inputs or for everything except inputs

Parameters
[in]inputs- If true only waveform groups providing simulation input are loaded. Otherwise these groups are omitted.

Definition at line 1058 of file netlist_simulator_controller.cpp.

References add_waveform_group(), and hal::SimulationInput::get_net_groups().

Referenced by hal::PageSelectGates::validatePage(), and hal::PageLoadResults::validatePage().

◆ loadProgress

void hal::NetlistSimulatorController::loadProgress ( int  percent)
signal

◆ name()

QString hal::NetlistSimulatorController::name ( ) const
inline

Getter for controller name

Returns
name as QString

Definition at line 334 of file netlist_simulator_controller.h.

Referenced by add_waveform_group(), create_simulation_engine(), hal::WaveformViewer::handleControllerAdded(), and rename_waveform().

◆ parseComplete

void hal::NetlistSimulatorController::parseComplete ( )
signal

◆ persist()

◆ remove_waveform_group()

void hal::NetlistSimulatorController::remove_waveform_group ( u32  group_id)

Remove waveform group identified by group ID. Waveform for nets will still be shown but they are not bundled.

Parameters
group_idThe ID of waveform group to be removed

Definition at line 459 of file netlist_simulator_controller.cpp.

References hal::WaveDataList::removeGroup().

Referenced by hal::PYBIND11_PLUGIN().

◆ rename_waveform()

void hal::NetlistSimulatorController::rename_waveform ( WaveData wd,
std::string  name 
)

Rename waveform and emit 'renamed' signal

Parameters
[in]wd- Waveform to be renamed.
[in]name- New name for waveform.

Definition at line 661 of file netlist_simulator_controller.cpp.

References hal::WaveDataList::emitGroupUpdated(), QString::fromStdString(), hal::WaveData::id(), name(), hal::WaveData::rename(), hal::WaveDataList::updateWaveName(), and hal::WaveDataList::waveIndexByNetId().

Referenced by hal::PYBIND11_PLUGIN().

◆ reset()

void hal::NetlistSimulatorController::reset ( )

Reset the simulator state, i.e., treat all signals as unknown. Does not remove gates/nets from the simulation set.

Definition at line 1270 of file netlist_simulator_controller.cpp.

References hal::SimulationInput::clear(), hal::WaveDataList::clearAll(), and NoGatesSelected.

Referenced by hal::PYBIND11_PLUGIN(), hal::PageSelectGates::validatePage(), and hal::Wizard::Wizard().

◆ run_simulation()

◆ set_input() [1/6]

void hal::NetlistSimulatorController::set_input ( const Net net,
BooleanFunction::Value  value 
)

Set the signal for a specific wire to control input signals between simulation cycles.

Parameters
[in]net- The net to set a signal value for.
[in]value- The value to set.

Definition at line 1183 of file netlist_simulator_controller.cpp.

References hal::WaveDataList::addOrReplace(), get_name(), hal::WaveDataList::insertBooleanValue(), hal::WaveData::insertBooleanValueWithoutSync(), hal::SimulationInput::is_input_net(), log_warning, net, hal::WaveDataTimeframe::simulateMaxTime(), hal::WaveDataList::timeFrame(), and hal::WaveDataList::waveDataByNet().

Referenced by hal::PYBIND11_PLUGIN(), and set_input().

◆ set_input() [2/6]

void hal::NetlistSimulatorController::set_input ( const PinGroup< ModulePin > *  pin_group,
const std::vector< BooleanFunction::Value > &  values 
)

Set the signals for a specific module pin group to control input signals between simulation cycles.

Parameters
[in]pin_group- The module pin group.
[in]values- The values to set.

Definition at line 1250 of file netlist_simulator_controller.cpp.

References hal::PinGroup< T >::get_pins(), and set_input().

◆ set_input() [3/6]

void hal::NetlistSimulatorController::set_input ( const std::vector< Net * > &  nets,
const std::vector< BooleanFunction::Value > &  values 
)

Set the signal for a group of nets to control input signals between simulation cycles.

Parameters
[in]nets- The vector of nets.
[in]values- The values to set.

Definition at line 1214 of file netlist_simulator_controller.cpp.

References get_name(), log_error, and set_input().

◆ set_input() [4/6]

void hal::NetlistSimulatorController::set_input ( const u32  id,
const std::vector< BooleanFunction::Value > &  values 
)

Set the signals for a specific WaveDataGroup to control input signals between simulation cycles.

Parameters
[in]id- ID of the WaveDataGroup.
[in]values- The values to set.

Definition at line 1244 of file netlist_simulator_controller.cpp.

References get_waveform_group_by_id(), and set_input().

◆ set_input() [5/6]

void hal::NetlistSimulatorController::set_input ( const WaveDataGroup wdg,
const std::vector< BooleanFunction::Value > &  values 
)

Set the signals for a specific WaveDataGroup to control input signals between simulation cycles.

Parameters
[in]wdg- The WaveDataGroup.
[in]values- The values to set.

Definition at line 1228 of file netlist_simulator_controller.cpp.

References get_name(), hal::WaveDataGroup::get_waveforms(), log_error, and set_input().

◆ set_input() [6/6]

void hal::NetlistSimulatorController::set_input ( WaveData wd,
BooleanFunction::Value  value 
)

Set the signal for a specific wire to control input signals between simulation cycles.

Parameters
[in]wd- WaveData object of the signal.
[in]value- The value to set.

Definition at line 1208 of file netlist_simulator_controller.cpp.

References hal::WaveDataList::insertBooleanValue(), hal::WaveDataTimeframe::simulateMaxTime(), and hal::WaveDataList::timeFrame().

◆ set_no_clock_used()

void hal::NetlistSimulatorController::set_no_clock_used ( )

Prepare simulation where no net is defined as clock input

Definition at line 282 of file netlist_simulator_controller.cpp.

References hal::SimulationInput::set_no_clock_used().

Referenced by hal::PYBIND11_PLUGIN(), and hal::PageClock::validatePage().

◆ set_saleae_timescale()

void hal::NetlistSimulatorController::set_saleae_timescale ( u64  timescale = 1000000000)

Set timescale when parsing SALEAE float values

Parameters
[in]timescalemultiplication factor for time value

Definition at line 917 of file netlist_simulator_controller.cpp.

References hal::SaleaeParser::sTimeScaleFactor.

Referenced by hal::PYBIND11_PLUGIN().

◆ set_timeframe()

void hal::NetlistSimulatorController::set_timeframe ( u64  tmin = 0,
u64  tmax = 0 
)

Set timeframe for viewer

Parameters
[in]tminLower limit for time scale in wave viewer
[in]tmaxUpper limit for time scale in wave viewer

Definition at line 1261 of file netlist_simulator_controller.cpp.

References hal::WaveDataList::setUserTimeframe().

Referenced by hal::PYBIND11_PLUGIN().

◆ setLogReceiver()

void hal::NetlistSimulatorController::setLogReceiver ( SimulationLogReceiver logrec)

Set log receiver instance which gets called whenever new engine output is available

Parameters
logrecLog receiver instance derived from abstract base class SimulationLogReceiver

Definition at line 182 of file netlist_simulator_controller.cpp.

◆ simulate()

void hal::NetlistSimulatorController::simulate ( u64  picoseconds)

Simulate for a specific period, advancing the internal state. Automatically initializes the simulation if 'initialize' has not yet been called. Use 'set_input' to control specific signals.

Parameters
[in]picoseconds- The duration to simulate.

Definition at line 1277 of file netlist_simulator_controller.cpp.

References hal::WaveDataList::incrementSimulTime().

Referenced by hal::PYBIND11_PLUGIN(), and hal::PageInputData::validatePage().

◆ simulate_only_probes() [1/2]

void hal::NetlistSimulatorController::simulate_only_probes ( const QSet< u32 > &  probes)

Discard all results except listed probes

Parameters
probesSet of net IDs which will be simulated (aka probes)

Definition at line 301 of file netlist_simulator_controller.cpp.

◆ simulate_only_probes() [2/2]

void hal::NetlistSimulatorController::simulate_only_probes ( const std::vector< const Net * > &  probes)

Discard all results except listed probes

Parameters
probesList of nets which will be simulated (aka probes)

Definition at line 293 of file netlist_simulator_controller.cpp.

References QSet::insert().

◆ stateChanged

void hal::NetlistSimulatorController::stateChanged ( hal::NetlistSimulatorController::SimulationState  state)
signal

Member Data Documentation

◆ sPersistFile

const char * hal::NetlistSimulatorController::sPersistFile = "netlist_simulator_controller.json"
static

Definition at line 522 of file netlist_simulator_controller.h.

Referenced by persist().


The documentation for this class was generated from the following files: