litex/gen: reintegrate migen with modifications to be able to simulate with vpi until...
[litex.git] / litex / gen / genlib / resetsync.py
1 from litex.gen.fhdl.structure import *
2 from litex.gen.fhdl.specials import Special
3
4
5 class AsyncResetSynchronizer(Special):
6 def __init__(self, cd, async_reset):
7 Special.__init__(self)
8 self.cd = cd
9 self.async_reset = wrap(async_reset)
10
11 def iter_expressions(self):
12 yield self.cd, "clk", SPECIAL_INPUT
13 yield self.cd, "rst", SPECIAL_OUTPUT
14 yield self, "async_reset", SPECIAL_INPUT
15
16 @staticmethod
17 def lower(dr):
18 raise NotImplementedError("Attempted to use a reset synchronizer, but platform does not support them")