From 0a1c05e8edb8c821b92d11b8d9f5577ac7f5ce8b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Fran=C3=A7ois=20Nguyen?= Date: Tue, 18 May 2021 19:11:39 +0200 Subject: [PATCH] periph.event: clear pending bits of level-triggered events. --- lambdasoc/periph/event.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lambdasoc/periph/event.py b/lambdasoc/periph/event.py index 53df4aa..87b631f 100644 --- a/lambdasoc/periph/event.py +++ b/lambdasoc/periph/event.py @@ -127,8 +127,11 @@ class InterruptSource(Elaboratable): else: assert False # :nocov: - with m.If(event_trigger): - m.d.sync += self.pending.r_data[i].eq(1) + if event.mode == "level": + m.d.sync += self.pending.r_data[i].eq(event_trigger) + else: + with m.If(event_trigger): + m.d.sync += self.pending.r_data[i].eq(1) m.d.comb += self.irq.eq((self.pending.r_data & self.enable.r_data).any()) -- 2.30.2