class Value:
    # …

    def get(self):
        return SimAwaitable(self)

    def set(self, value):
        return SimAwaitable(self.eq(value))

    def changed(self, value=None):
        return SimAwaitable(SimTrigger(self, value))

    async def wait(self, value):
        if (await self.get()) != value:
            await self.changed(value)

async def bench_inc_cnt():
    # Increment counter on both edges
    await Passive()

    while True:
        await clk.changed()
        await cnt.set((await cnt.get()) + 1)

async def bench_await_cnt_4():
    await cnt.wait(4)
    print('cnt is 4')

    await cnt.wait(4)
    print('cnt is still 4')

    await cnt_4.set(1)

    await cnt.changed(4)
    print('cnt is 4 again')

    await cnt_4.set(0)