File size: 1,512 Bytes
cb65407 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | ********
Triggers
********
Triggers are used to indicate when the cocotb scheduler should resume coroutine execution.
To use a trigger, a coroutine should :keyword:`await` it.
This will cause execution of the current coroutine to pause.
When the trigger fires, execution of the paused coroutine will resume:
.. code-block:: python3
async def coro():
print("Some time before the edge")
await RisingEdge(clk)
print("Immediately after the edge")
.. _simulator-triggers:
Simulator Triggers
==================
Signals
-------
.. autoclass:: cocotb.triggers.Edge(signal)
.. autoclass:: cocotb.triggers.RisingEdge(signal)
.. autoclass:: cocotb.triggers.FallingEdge(signal)
.. autoclass:: cocotb.triggers.ClockCycles
Timing
------
.. autoclass:: cocotb.triggers.Timer
.. autoclass:: cocotb.triggers.ReadOnly()
.. autoclass:: cocotb.triggers.ReadWrite()
.. autoclass:: cocotb.triggers.NextTimeStep()
Python Triggers
===============
.. autoclass:: cocotb.triggers.Combine
.. autoclass:: cocotb.triggers.First
.. autoclass:: cocotb.triggers.Join(coroutine)
:members: retval
Synchronization
---------------
These are not :class:`Trigger`\ s themselves, but contain methods that can be used as triggers.
These are used to synchronize coroutines with each other.
.. autoclass:: cocotb.triggers.Event
:members:
:member-order: bysource
.. autoclass:: cocotb.triggers.Lock
:members:
:member-order: bysource
.. autofunction:: cocotb.triggers.with_timeout
|