Skip to content

Broken Trigger when for TriggerCombination delay/changed expires at the same time #1508

Open
@purdeaandrei

Description

@purdeaandrei

When awaiting a TriggerCombination that waits for both a delay() to expire and a signal to change, if the delay expires at the same time as when the signal changes, BrokenTrigger is thrown.
Here is minimal example code:

from amaranth import *
from amaranth.sim import Simulator

sig = Signal()

class Dut(Elaboratable):
    def elaborate(self, platform):
        m = Module()
        return m

dut = Dut()

async def bench_a(ctx):
    await ctx.delay(1e-6)
    await ctx.delay(0.5e-6).changed(sig)

async def bench_b(ctx):
    await ctx.delay(1e-6)
    await ctx.delay(0.5e-6)
    ctx.set(sig, 1)

sim = Simulator(dut)
sim.add_testbench(bench_b)
sim.add_testbench(bench_a)

with sim.write_vcd("t.vcd"):
    sim.run()

Activity

added this to the 0.6 milestone on Sep 8, 2024
purdeaandrei

purdeaandrei commented on Sep 9, 2024

@purdeaandrei
ContributorAuthor

Looks like BrokenTrigger can also happen with a single .changed() trigger that lists more than one signal.

whitequark

whitequark commented on Sep 9, 2024

@whitequark
Member

That sounds plausible, yeah.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @whitequark@purdeaandrei

        Issue actions

          Broken Trigger when for TriggerCombination delay/changed expires at the same time · Issue #1508 · amaranth-lang/amaranth