AsyncSimLoop Class Reference
|
yasimavr
|
Asynchronous simulation loop It is designed when simulation need to interact with code running in another thread. Examples: debugger, GUI, sockets. More...
#include <sim_loop.h>
Public Member Functions | |
| AsyncSimLoop (Device &device) | |
| void | set_fast_mode (bool fast) |
| Set the simulation running mode: false=real-time, true=fast. | |
| void | run () |
| bool | start_transaction () |
| void | end_transaction () |
| void | loop_continue () |
| void | loop_pause () |
| void | loop_step () |
| void | loop_kill () |
Public Member Functions inherited from AbstractSimLoop | |
| AbstractSimLoop (Device &device) | |
| virtual | ~AbstractSimLoop ()=default |
| AbstractSimLoop::State | state () const |
| cycle_count_t | cycle () const |
| CycleManager & | cycle_manager () |
| const Device & | device () const |
| Logger & | logger () |
Additional Inherited Members | |
Public Types inherited from AbstractSimLoop | |
| enum | State { State_Running , State_Step , State_Standby , State_Stopped , State_Done } |
Protected Member Functions inherited from AbstractSimLoop | |
| cycle_count_t | run_device (cycle_count_t final_cycle) |
| void | set_state (AbstractSimLoop::State state) |
Protected Attributes inherited from AbstractSimLoop | |
| Device & | m_device |
| State | m_state |
| CycleManager | m_cycle_manager |
| Logger | m_logger |
Detailed Description
Asynchronous simulation loop It is designed when simulation need to interact with code running in another thread. Examples: debugger, GUI, sockets.
The simulation library in itself is not thread-safe. The synchronization is done by using the methods start_transaction and end_transaction which must surround any call to any interface to the simulated device. The effect is to block the simulation loop between cycles so that the state stays consistent throughout the simulated MCU.
Constructor & Destructor Documentation
◆ AsyncSimLoop()
|
explicit |
Member Function Documentation
◆ end_transaction()
| void AsyncSimLoop::end_transaction | ( | ) |
End a transaction and let the simulation resume.
◆ loop_continue()
| void AsyncSimLoop::loop_continue | ( | ) |
Resumes the loop when it's in the Stopped state. The loop is initialised in the Stopped state so this must be called at the start of a simulation. Must be surrounded by start_transaction() / end_transaction()
◆ loop_kill()
| void AsyncSimLoop::loop_kill | ( | ) |
Stop definitively the simulation. run() will exit. Must be surrounded by start_transaction() / end_transaction()
◆ loop_pause()
| void AsyncSimLoop::loop_pause | ( | ) |
Stop the simulation. Must be surrounded by start_transaction() / end_transaction()
◆ loop_step()
| void AsyncSimLoop::loop_step | ( | ) |
Instruct the device model to execute one instruction and stop. Must be surrounded by start_transaction() / end_transaction()
◆ run()
| void AsyncSimLoop::run | ( | ) |
Runs the simulation loop indefinitely. It returns when the loop is killed using loop_kill() or the device has stopped definitively. The simulation will start in the Stopped state so loop_continue() must be called.
◆ set_fast_mode()
| void AsyncSimLoop::set_fast_mode | ( | bool | fast | ) |
Set the simulation running mode: false=real-time, true=fast.
◆ start_transaction()
| bool AsyncSimLoop::start_transaction | ( | ) |
Start a transaction, which designates any interaction with any interface of the simulated device. This will pause the simulation between cycles, to ensure the consistency of the device model data.
The documentation for this class was generated from the following files:
Generated by
Public Member Functions inherited from