mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
adc: double-register asynchronous inputs
This commit is contained in:
parent
0dca526a85
commit
117b3b8ec7
1 changed files with 6 additions and 3 deletions
|
@ -2,6 +2,7 @@ from migen.fhdl.structure import *
|
|||
from migen.fhdl.module import Module
|
||||
from migen.bank.description import *
|
||||
from migen.genlib.misc import optree
|
||||
from migen.genlib.cdc import MultiReg
|
||||
|
||||
class CounterADC(Module, AutoCSR):
|
||||
def __init__(self, charge, sense, width=24):
|
||||
|
@ -49,8 +50,10 @@ class CounterADC(Module, AutoCSR):
|
|||
]
|
||||
|
||||
for i in range(channels):
|
||||
sense_synced = Signal()
|
||||
self.specials += MultiReg(sense[i], sense_synced)
|
||||
self.sync += If(busy[i],
|
||||
If(sense[i] != self._polarity.storage,
|
||||
If(sense_synced != self._polarity.storage,
|
||||
res[i].status.eq(count),
|
||||
busy[i].eq(0)
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue