From 5f9d943d360b71c7f0c90e9cb8aa7f3bc1f1546a Mon Sep 17 00:00:00 2001 From: Franck Jullien Date: Thu, 14 Apr 2022 09:48:26 +0200 Subject: [PATCH 1/3] efinix: get_free_pll_resource needs to call get_pll_resource --- litex/build/efinix/platform.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/litex/build/efinix/platform.py b/litex/build/efinix/platform.py index 2ccad5ef5..35401e30e 100644 --- a/litex/build/efinix/platform.py +++ b/litex/build/efinix/platform.py @@ -160,8 +160,10 @@ class EfinixPlatform(GenericPlatform): def get_pll_resource(self, name): self.pll_used.append(name) self.pll_available.remove(name) - print('Pll used : ' + str(self.pll_used)) - print('Pll pll_available: ' + str(self.pll_available)) + print('PLL used : ' + str(self.pll_used)) + print('PLL available: ' + str(self.pll_available)) def get_free_pll_resource(self): - return self.pll_available[0] + pll = self.pll_available[0] + self.get_pll_resource(pll) + return pll From 25b4eb7b0b1579d6557ba5a1848644fc89268075 Mon Sep 17 00:00:00 2001 From: Franck Jullien Date: Thu, 14 Apr 2022 10:15:51 +0200 Subject: [PATCH 2/3] efinix: dont print info in get_pll_resource --- litex/build/efinix/platform.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/litex/build/efinix/platform.py b/litex/build/efinix/platform.py index 35401e30e..948b0033c 100644 --- a/litex/build/efinix/platform.py +++ b/litex/build/efinix/platform.py @@ -160,8 +160,6 @@ class EfinixPlatform(GenericPlatform): def get_pll_resource(self, name): self.pll_used.append(name) self.pll_available.remove(name) - print('PLL used : ' + str(self.pll_used)) - print('PLL available: ' + str(self.pll_available)) def get_free_pll_resource(self): pll = self.pll_available[0] From e86c06c9ff284008f4bd5a9399670716cffe0232 Mon Sep 17 00:00:00 2001 From: Franck Jullien Date: Thu, 14 Apr 2022 10:17:10 +0200 Subject: [PATCH 3/3] efinix:clock: improve logging informations --- litex/soc/cores/clock/efinix.py | 39 ++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/litex/soc/cores/clock/efinix.py b/litex/soc/cores/clock/efinix.py index 9b45cd6c3..683c746ec 100644 --- a/litex/soc/cores/clock/efinix.py +++ b/litex/soc/cores/clock/efinix.py @@ -15,11 +15,20 @@ class Open(Signal): pass # Efinix / TRIONPLL ---------------------------------------------------------------------------------- -class TRIONPLL(Module): +class EFINIXPLL(Module): nclkouts_max = 3 def __init__(self, platform, n=0, version="V1_V2"): - self.logger = logging.getLogger("TRIONPLL") - self.logger.info("Creating TRIONPLL.".format()) + self.logger = logging.getLogger("EFINIXPLL") + + if version == "V1_V2": + self.type = "TRIONPLL" + elif version == "V3": + self.type = "TITANIUMPLL" + else: + self.logger.error("PLL version {} not supported".format(version)) + quit() + + self.logger.info("Creating {}".format(colorer(self.type, color="green"))) self.platform = platform self.nclkouts = 0 self.reset = Signal() @@ -76,11 +85,14 @@ class TRIONPLL(Module): block["input_signal"] = name self.logger.info("Clock source: {}".format(block["input_clock"])) + self.logger.info("PLL used : " + colorer(str(self.platform.pll_used), "cyan")) + self.logger.info("PLL available: " + colorer(str(self.platform.pll_available), "cyan")) + block["input_freq"] = freq - self.logger.info("Using {}".format(block["resource"])) + self.logger.info("Use {}".format(colorer(block["resource"], "green"))) - def create_clkout(self, cd, freq, phase=0, margin=1e-2, name="", with_reset=True): + def create_clkout(self, cd, freq, phase=0, margin=0, name="", with_reset=True): assert self.nclkouts < self.nclkouts_max clk_out_name = f"{self.name}_clkout{self.nclkouts}" if name == "" else name @@ -92,7 +104,8 @@ class TRIONPLL(Module): if with_reset: self.specials += AsyncResetSynchronizer(cd, ~self.locked) self.platform.toolchain.excluded_ios.append(clk_out_name) - create_clkout_log(self.logger, cd.name, freq, margin, self.nclkouts) + + create_clkout_log(self.logger, clk_out_name, freq, margin, self.nclkouts) self.nclkouts += 1 @@ -112,10 +125,16 @@ class TRIONPLL(Module): def do_finalize(self): pass +# Efinix / TITANIUMPLL ----------------------------------------------------------------------------- -# Efinix / TITANIUMPLL ---------------------------------------------------------------------------------- - -class TITANIUMPLL(TRIONPLL): +class TITANIUMPLL(EFINIXPLL): nclkouts_max = 5 def __init__(self, platform, n=0): - TRIONPLL.__init__(self, platform, n, version="V3") + EFINIXPLL.__init__(self, platform, n, version="V3") + +# Efinix / TRION ---------------------------------------------------------------------------------- + +class TRIONPLL(EFINIXPLL): + nclkouts_max = 3 + def __init__(self, platform, n=0): + EFINIXPLL.__init__(self, platform, n, version="V1_V2")