|
HAL
v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
|


Public Types | |
| enum | State { Failed = -1 , Done = 0 , Running = 1 , Preparing = 2 } |
Public Member Functions | |
| SimulationEngine (const std::string &nam) | |
| virtual | ~SimulationEngine () |
| std::string | name () const |
| State | state () const |
| int | get_state () const |
| std::string | get_working_directory () const |
| void | set_working_directory (const std::string &workDir) |
| bool | clock_events_required () const |
| bool | can_share_memory () const |
| bool | install_saleae_parser (std::string dirname) const |
| virtual bool | setSimulationInput (SimulationInput *simInput)=0 |
| virtual void | setResultFilename (const std::string filename) |
| std::string | get_result_filename () const |
| virtual bool | run (NetlistSimulatorController *controller, SimulationLogReceiver *logReceiver=nullptr)=0 |
| virtual bool | finalize () |
| virtual void | failed () |
| virtual void | set_engine_property (const std::string &key, const std::string &value) |
| virtual std::string | get_engine_property (const std::string &key) |
| virtual const std::unordered_map< std::string, std::string > & | get_engine_properties () const |
| virtual SimulationInput * | get_simulation_input () const |
Protected Attributes | |
| bool | mRequireClockEvents |
| bool | mCanShareMemory |
| std::string | mResultFilename |
| State | mState |
| std::unordered_map< std::string, std::string > | mProperties |
| SimulationInput * | mSimulationInput |
| std::string | mWorkDir |
The base class for all simulation engines, which holds the name, working directory, and properties of an engine.
Definition at line 45 of file simulation_engine.h.
| Enumerator | |
|---|---|
| Failed | |
| Done | |
| Running | |
| Preparing | |
Definition at line 50 of file simulation_engine.h.
| hal::SimulationEngine::SimulationEngine | ( | const std::string & | nam | ) |
Definition at line 16 of file simulation_engine.cpp.
|
inlinevirtual |
Definition at line 69 of file simulation_engine.h.
|
inline |
Tells the caller whether engine can share simulation results directly from memory. If not the caller will most likely ask to have a VCD result file created.
true if results can be read from memory, false otherwise. Definition at line 124 of file simulation_engine.h.
References mCanShareMemory.
|
inline |
Request clock change as regular net input event
true if clock events are required by engine, false otherwise Definition at line 114 of file simulation_engine.h.
References mRequireClockEvents.
Referenced by hal::NetlistSimulatorController::run_simulation().
|
virtual |
Can be overwritten by derived class
Signals the engine that an essential step failed and execution is going to be aborted. Engine might want to do some final clean up.
Definition at line 37 of file simulation_engine.cpp.
References Failed, and mState.
Referenced by hal::SimulationThread::run().
|
virtual |
Can be overwritten by derived class
Signals the engine that it is time for final steps (.e.g. writing VCD file) after simulation is done - that is: SimulationEngineEventDriven: all input events have been processed SimulationEngineScripted: all comands executed successfully
true if successful, false otherwise. Reimplemented in hal::verilator::VerilatorEngine, and hal::DummyEngine.
Definition at line 31 of file simulation_engine.cpp.
Referenced by hal::SimulationThread::run().
|
inlinevirtual |
Get all propertiess
Definition at line 216 of file simulation_engine.h.
References mProperties.
Referenced by hal::NetlistSimulatorController::persist().
|
virtual |
Get property which can be evaluated by engine
| key | property name |
Definition at line 69 of file simulation_engine.cpp.
References mProperties.
Referenced by hal::SimulationProcess::run(), hal::NetlistSimulatorController::run_simulation(), and hal::verilator::VerilatorEngine::setSimulationInput().
|
inline |
Getter for file name of results as VCD
Definition at line 158 of file simulation_engine.h.
References mResultFilename.
|
inlinevirtual |
Get simulation input
Reimplemented in hal::NetlistSimulator.
Definition at line 222 of file simulation_engine.h.
References mSimulationInput.
|
inline |
State of the engine as integer
Definition at line 93 of file simulation_engine.h.
References mState.
Referenced by hal::PYBIND11_PLUGIN().
| std::string hal::SimulationEngine::get_working_directory | ( | ) | const |
The working directory. Directory is temporary and will be removed when controller gets deleted
Definition at line 21 of file simulation_engine.cpp.
References mWorkDir.
Referenced by hal::PYBIND11_PLUGIN(), hal::DummyEngine::setSimulationInput(), hal::verilator::VerilatorEngine::setSimulationInput(), and hal::SimulationProcess::SimulationProcess().
| bool hal::SimulationEngine::install_saleae_parser | ( | std::string | dirname | ) | const |
Copy header and source files so that saleae parser can be compiled into project
| [in] | dirname | - Target directory to copy files into. |
true if files copied successfully, false otherwise Definition at line 42 of file simulation_engine.cpp.
References QDir::absoluteFilePath(), QDir::exists(), hal::ff, QFileInfo::fileName(), QString::fromStdString(), QFile::open(), QIODevice::ReadOnly, QIODevice::write(), and QIODevice::WriteOnly.
|
inline |
Getter for enging name
Definition at line 75 of file simulation_engine.h.
Referenced by hal::NetlistSimulatorController::create_simulation_engine(), hal::NetlistSimulatorController::persist(), and hal::PYBIND11_PLUGIN().
|
pure virtual |
Must be implemented by derived class
Will be called by controller to start simulation.
Derived classes SimulationEngineEventDriven and SimulationEngineScripted will implement their own run handlers to start either a separate process or a thread
true if successful, false otherwise. Referenced by hal::NetlistSimulatorController::run_simulation().
|
virtual |
Set property which can be evaluated by engine
| key | property name |
| value | property value |
Definition at line 64 of file simulation_engine.cpp.
References mProperties.
Referenced by hal::NetlistSimulatorController::NetlistSimulatorController(), hal::PYBIND11_PLUGIN(), and hal::NetlistSimulatorController::run_simulation().
| void hal::SimulationEngine::set_working_directory | ( | const std::string & | workDir | ) |
Set the working directory. Method should be called by controller only after creating engine instance.
| [in] | workDir | The working directory (should be controller tmp directory) |
Definition at line 26 of file simulation_engine.cpp.
References mWorkDir.
Referenced by hal::NetlistSimulatorController::create_simulation_engine().
|
inlinevirtual |
Set the name of VCD result file. If set engine is requested to produce such a file upon finalize
| [in] | filename | - Name of the file to be created. |
Definition at line 149 of file simulation_engine.h.
References mResultFilename.
|
pure virtual |
Must be implemented by derived class
Will be called by controller to pass all relevant information to setup the simulation
| [in] | simInput | the input |
true if engine could be prepared successfully with given input, false otherwise. Implemented in hal::verilator::VerilatorEngine, and hal::DummyEngine.
Referenced by hal::NetlistSimulatorController::run_simulation().
|
inline |
State of the engine
Definition at line 84 of file simulation_engine.h.
References mState.
Referenced by hal::SimulationThread::run().
|
protected |
Definition at line 60 of file simulation_engine.h.
Referenced by can_share_memory(), and hal::SimulationEngineEventDriven::SimulationEngineEventDriven().
|
protected |
Definition at line 63 of file simulation_engine.h.
Referenced by get_engine_properties(), get_engine_property(), and set_engine_property().
|
protected |
Definition at line 59 of file simulation_engine.h.
Referenced by clock_events_required(), and hal::verilator::VerilatorEngine::VerilatorEngine().
|
protected |
Definition at line 61 of file simulation_engine.h.
Referenced by hal::verilator::VerilatorEngine::finalize(), get_result_filename(), and setResultFilename().
|
protected |
Definition at line 64 of file simulation_engine.h.
Referenced by get_simulation_input(), hal::NetlistSimulator::get_simulation_input(), hal::DummyEngine::setSimulationInput(), and hal::verilator::VerilatorEngine::setSimulationInput().
|
protected |
Definition at line 62 of file simulation_engine.h.
Referenced by failed(), hal::DummyEngine::finalize(), finalize(), hal::verilator::VerilatorEngine::finalize(), get_state(), and state().
|
protected |
Definition at line 65 of file simulation_engine.h.
Referenced by get_working_directory(), and set_working_directory().