From 67b415f61c651a37668e2d6917a56c1cdd78edd4 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Fri, 3 Jun 2022 12:01:08 +0200 Subject: [PATCH] cores/clock: Add gowin_gw2a (Reusing GW1NPLL with specific vco/pfd_freq_ranges). --- litex/soc/cores/clock/gowin_gw1n.py | 6 +----- litex/soc/cores/clock/gowin_gw2a.py | 32 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 litex/soc/cores/clock/gowin_gw2a.py diff --git a/litex/soc/cores/clock/gowin_gw1n.py b/litex/soc/cores/clock/gowin_gw1n.py index ec5971a14..bedc4f9b5 100644 --- a/litex/soc/cores/clock/gowin_gw1n.py +++ b/litex/soc/cores/clock/gowin_gw1n.py @@ -1,7 +1,7 @@ # # This file is part of LiteX. # -# Copyright (c) 2021 Florent Kermarrec +# Copyright (c) 2021-2022 Florent Kermarrec # SPDX-License-Identifier: BSD-2-Clause from migen import * @@ -79,8 +79,6 @@ class GW1NPLL(Module): vco_freq_range = (400e6, 1200e6) elif device.startswith('GW1N-') or device.startswith('GW1NR-'): vco_freq_range = (400e6, 900e6) - elif device.startswith('GW2A-'): - vco_freq_range = (500e6, 1250e6) # datasheet values if vco_freq_range is None: raise ValueError(f"Unsupported device {device}.") return vco_freq_range @@ -97,8 +95,6 @@ class GW1NPLL(Module): pfd_freq_range = (3e6, 400e6) # not verified: not found in the datasheet elif device.startswith('GW1N-') or device.startswith('GW1NR-'): pfd_freq_range = (3e6, 400e6) # not verified: not found in the datasheet - elif device.startswith('GW2A-'): - pfd_freq_range = (3e6, 500e6) # datasheet values if pfd_freq_range is None: raise ValueError(f"Unsupported device {device}.") return pfd_freq_range diff --git a/litex/soc/cores/clock/gowin_gw2a.py b/litex/soc/cores/clock/gowin_gw2a.py new file mode 100644 index 000000000..4a50a167e --- /dev/null +++ b/litex/soc/cores/clock/gowin_gw2a.py @@ -0,0 +1,32 @@ +# +# This file is part of LiteX. +# +# Copyright (c) 2022 Florent Kermarrec +# SPDX-License-Identifier: BSD-2-Clause + +from migen import * + +from litex.soc.cores.clock.gowin_gw1n import GW1NPLL + +# GoWin / GW2APLL ---------------------------------------------------------------------------------- + +class GW2APLL(GW1NPLL): + # GW2A has the same PLL primitive than GW1N but vco/pfd_freq_range are specific to device. + + @staticmethod + def get_vco_freq_range(device): + vco_freq_range = None + if device.startswith('GW2A-'): + vco_freq_range = (500e6, 1250e6) # datasheet values + if vco_freq_range is None: + raise ValueError(f"Unsupported device {device}.") + return vco_freq_range + + @staticmethod + def get_pfd_freq_range(device): + pfd_freq_range = None + if device.startswith('GW2A-'): + pfd_freq_range = (3e6, 500e6) # datasheet values + if pfd_freq_range is None: + raise ValueError(f"Unsupported device {device}.") + return pfd_freq_range