From 946083410f403c1434fc256718cd983649071658 Mon Sep 17 00:00:00 2001 From: Gabriel Somlo Date: Sun, 24 Sep 2023 23:14:50 -0400 Subject: [PATCH] core: add edge-triggered irq signal for command completion --- litesdcard/core.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/litesdcard/core.py b/litesdcard/core.py index 43a9d65..95b99aa 100644 --- a/litesdcard/core.py +++ b/litesdcard/core.py @@ -24,6 +24,7 @@ class SDCore(LiteXModule): def __init__(self, phy): self.sink = stream.Endpoint([("data", 8)]) self.source = stream.Endpoint([("data", 8)]) + self.irq = Signal() # Cmd Registers. self.cmd_argument = CSRStorage(32, description="SDCard Cmd Argument.") @@ -115,6 +116,11 @@ def __init__(self, phy): crc7_inserter.enable.eq(1), ] + # IRQ / Generate IRQ on CMD done rising edge + done_d = Signal() + self.sync += done_d.eq(cmd_done) + self.sync += self.irq.eq(cmd_done & ~done_d) + # Main FSM --------------------------------------------------------------------------------- self.fsm = fsm = FSM() fsm.act("IDLE",