diff --git a/litex/build/efinix/dbparser.py b/litex/build/efinix/dbparser.py index 9f0e1d4f7..0b15d56cb 100644 --- a/litex/build/efinix/dbparser.py +++ b/litex/build/efinix/dbparser.py @@ -80,6 +80,21 @@ class EfinixDbParser(): return None + def get_block_instance_names(self, block): + dmap = self.get_device_map(self.device) + die = self.get_die_file_name(dmap) + tree = et.parse(self.efinity_db_path + 'die/' + die) + root = tree.getroot() + + peri = root.findall('efxpt:periphery_instance', namespaces) + names = [] + for p in peri: + if p.get('block') == block: + names.append(p.get('name')) + + print(f"block {block}: names:{names}") + return names + def get_pll_inst_from_gpio_inst(self, dmap, inst): die = self.get_die_file_name(dmap) tree = et.parse(self.efinity_db_path + 'die/' + die) diff --git a/litex/build/efinix/platform.py b/litex/build/efinix/platform.py index 2f337e881..e0ed622dd 100644 --- a/litex/build/efinix/platform.py +++ b/litex/build/efinix/platform.py @@ -22,9 +22,6 @@ class EfinixPlatform(GenericPlatform): self.timing_model = self.device[-2:] self.device = self.device[:-2] - self.pll_available = ['PLL_TL0', 'PLL_TR0', 'PLL_TR1', 'PLL_TR2', 'PLL_TR3', 'PLL_BR0', 'PLL_BR1', 'PLL_BR2', 'PLL_BL0'] - self.pll_used = [] - if os.getenv("LITEX_ENV_EFINITY", False) == False: msg = "Unable to find or source Efinity toolchain, please either:\n" msg += "- Set LITEX_ENV_EFINITY environment variant to Efinity path.\n" @@ -40,6 +37,8 @@ class EfinixPlatform(GenericPlatform): raise ValueError("Unknown toolchain") self.parser = EfinixDbParser(self.efinity_path, self.device) + self.pll_available = self.parser.get_block_instance_names('pll') + self.pll_used = [] def get_verilog(self, *args, special_overrides=dict(), **kwargs): so = dict(common.efinix_special_overrides)