Triggers

Triggers are used to indicate when the cocotb scheduler should resume coroutine execution. To use a trigger, a coroutine should await it. This will cause execution of the current coroutine to pause. When the trigger fires, execution of the paused coroutine will resume:

async def coro():
    print("Some time before a clock edge")
    await RisingEdge(clk)
    print("Immediately after the rising clock edge")

See Simulator Triggers and Python Triggers for a list of available triggers.