From 6733a3e3e692fa1ae79446170619436d05944844 Mon Sep 17 00:00:00 2001 From: George Hilliard Date: Wed, 15 Sep 2021 00:00:24 -0500 Subject: [PATCH] clock/lattice_ecp5/ECP5PLL: ensure feedback path selected before exiting search --- litex/soc/cores/clock/lattice_ecp5.py | 3 +++ test/test_clock.py | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/litex/soc/cores/clock/lattice_ecp5.py b/litex/soc/cores/clock/lattice_ecp5.py index fd6cdbd4f..44a32ffb1 100644 --- a/litex/soc/cores/clock/lattice_ecp5.py +++ b/litex/soc/cores/clock/lattice_ecp5.py @@ -97,6 +97,9 @@ class ECP5PLL(Module): break if not valid: all_valid = False + if self.nclkouts == self.nclkouts_max and not config["clkfb"]: + # If there is no output suitable for feedback and no spare, not valid + all_valid = False else: all_valid = False if all_valid: diff --git a/test/test_clock.py b/test/test_clock.py index a1795149c..8d5fce8ac 100644 --- a/test/test_clock.py +++ b/test/test_clock.py @@ -121,6 +121,15 @@ class TestClock(unittest.TestCase): pll.expose_dpa() pll.compute_config() + # Test corner cases that have historically had trouble: + pll = ECP5PLL() + pll.register_clkin(Signal(), 100e6) + pll.create_clkout(ClockDomain("clkout1"), 350e6) + pll.create_clkout(ClockDomain("clkout2"), 350e6) + pll.create_clkout(ClockDomain("clkout3"), 175e6) + pll.create_clkout(ClockDomain("clkout4"), 175e6) + pll.compute_config() + # Lattice / NX def test_nxpll(self): pll = NXPLL()