From 85f76662077603fd811b037d38ebf3bc37fe217f Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Mon, 19 Nov 2018 13:15:34 +0100 Subject: [PATCH] build/microsemi/common: add async reset synchronizer (using DFN1P0) --- litex/build/microsemi/common.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/litex/build/microsemi/common.py b/litex/build/microsemi/common.py index 2b82aed3a..9fcc58f1c 100644 --- a/litex/build/microsemi/common.py +++ b/litex/build/microsemi/common.py @@ -1,2 +1,24 @@ +from migen import * +from migen.genlib.resetsync import AsyncResetSynchronizer + + +class MicrosemiPolarfireAsyncResetSynchronizerImpl(Module): + def __init__(self, cd, async_reset): + rst1 = Signal() + self.specials += [ + Instance("DFN1P0", i_D=0, i_PRE=~async_reset, + i_CLK=cd.clk, o_Q=rst1), + Instance("DFN1P0", i_D=rst1, i_PRE=~async_reset, + i_CLK=cd.clk, o_Q=cd.rst) + ] + + +class MicrosemiPolarfireAsyncResetSynchronizer: + @staticmethod + def lower(dr): + return MicrosemiPolarfireAsyncResetSynchronizerImpl(dr.cd, dr.async_reset) + + microsemi_polarfire_special_overrides = { + AsyncResetSynchronizer: MicrosemiPolarfireAsyncResetSynchronizer, }