Skip to content

Commit

Permalink
Merge pull request #31 from gsomlo/gls-cmd-irq
Browse files Browse the repository at this point in the history
core: add edge-triggered irq signal for command completion
  • Loading branch information
enjoy-digital authored Oct 5, 2023
2 parents e018257 + 9460834 commit cf6ab89
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions litesdcard/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit cf6ab89

Please sign in to comment.