Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
purdeaandrei opened this issue Sep 8, 2024 · 2 comments
Labels
Milestone

Comments

@purdeaandrei
Copy link
Contributor

purdeaandrei commented Sep 8, 2024

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()
@whitequark whitequark added the bug label Sep 8, 2024
@whitequark whitequark added this to the 0.6 milestone Sep 8, 2024
@purdeaandrei
Copy link
Contributor Author

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

@whitequark
Copy link
Member

That sounds plausible, yeah.

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

No branches or pull requests

2 participants