From a026dd89468e0c995bc69b6d7ef1a40b5718e06a Mon Sep 17 00:00:00 2001 From: Franck Jullien Date: Mon, 20 Sep 2021 10:41:59 +0200 Subject: [PATCH] efinix: add AsyncResetSynchronizer --- litex/build/efinix/common.py | 37 +++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/litex/build/efinix/common.py b/litex/build/efinix/common.py index 9c104ab69..9a4ef0c2b 100644 --- a/litex/build/efinix/common.py +++ b/litex/build/efinix/common.py @@ -5,4 +5,39 @@ # Copyright (c) 2015-2018 Florent Kermarrec # SPDX-License-Identifier: BSD-2-Clause -efinix_special_overrides = {} \ No newline at end of file +from migen.fhdl.module import Module +from migen.genlib.resetsync import AsyncResetSynchronizer + +from litex.build.io import * + +# Efinix AsyncResetSynchronizer --------------------------------------------------------------------- + +class EfinixAsyncResetSynchronizerImpl(Module): + def __init__(self, cd, async_reset): + rst1 = Signal() + self.specials += [ + Instance("EFX_FF", + i_D = 0, + i_SR = async_reset, + i_CLK = cd.clk, + i_CE = 1, + o_Q = rst1), + Instance("EFX_FF", + i_D = rst1, + i_SR = async_reset, + i_CLK = cd.clk, + i_CE = 1, + o_Q = cd.rst) + ] + + +class EfinixAsyncResetSynchronizer: + @staticmethod + def lower(dr): + return EfinixAsyncResetSynchronizerImpl(dr.cd, dr.async_reset) + +# Gowin Special Overrides -------------------------------------------------------------------------- + +efinix_special_overrides = { + AsyncResetSynchronizer: EfinixAsyncResetSynchronizer +}