Triggers¶
Triggers are used to indicate when the cocotb scheduler should resume coroutine execution.
Typically a coroutine will yield
a trigger or a list of triggers,
while it is waiting for them to complete.
Simulation Timing¶
Timer(time)
:- Registers a timed callback with the simulator to continue execution of the coroutine after a specified simulation time period has elapsed.
ReadOnly()
:- Registers a callback which will continue execution of the coroutine when the current simulation timestep moves to the
ReadOnly
phase of the RTL simulator. TheReadOnly
phase is entered when the current timestep no longer has any further delta steps. This should be a point where all the signal values are stable as there are no more RTL events scheduled for the timestep. The simulator should not allow scheduling of more events in this timestep. Useful for monitors which need to wait for all processes to execute (both RTL and cocotb) to ensure sampled signal values are final.
Python Triggers¶
Event()
:- Can be used to synchronise between coroutines.
Yielding
Event.wait()
will block the coroutine untilEvent.set()
is called somewhere else. Join(coroutine_2)
:- Will block the coroutine until coroutine_2 has completed.