From 5efb64b80b56afd78e9fb0e67d91a762e51f8d9a Mon Sep 17 00:00:00 2001 From: Franck Jullien Date: Wed, 8 Dec 2021 18:04:11 +0100 Subject: [PATCH] efinix: add io bank voltage configuration --- litex/build/efinix/efinity.py | 5 +++-- litex/build/efinix/ifacewriter.py | 10 ++++++++++ litex/build/efinix/platform.py | 3 ++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/litex/build/efinix/efinity.py b/litex/build/efinix/efinity.py index e6a81b49a..2c2986f91 100644 --- a/litex/build/efinix/efinity.py +++ b/litex/build/efinix/efinity.py @@ -295,9 +295,10 @@ class EfinityToolchain: excluded_ios = self.excluded_ios ) - # DDR doesn't have Python API so we need to configure it + # Some IO blocks don't have Python API so we need to configure them # directly in the peri.xml file - if self.ifacewriter.xml_blocks: + # We also need to configure the bank voltage here + if self.ifacewriter.xml_blocks or platform.iobank_info: self.ifacewriter.generate_xml_blocks() # Run diff --git a/litex/build/efinix/ifacewriter.py b/litex/build/efinix/ifacewriter.py index f730e8f89..37fd3f50b 100644 --- a/litex/build/efinix/ifacewriter.py +++ b/litex/build/efinix/ifacewriter.py @@ -57,6 +57,9 @@ class InterfaceWriter: if block["type"] == "DRAM": self.add_dram_xml(root, block) + if self.platform.iobank_info: + self.add_iobank_info_xml(root, self.platform.iobank_info) + xml_string = et.tostring(root, "utf-8") reparsed = expatbuilder.parseString(xml_string, False) print_string = reparsed.toprettyxml(indent=" ") @@ -282,3 +285,10 @@ design.save()""" load = "3" ) + def add_iobank_info_xml(self, root, iobank_info): + dev = root.find("efxpt:device_info", namespaces) + bank_info = dev.find("efxpt:iobank_info", namespaces) + for name, iostd in iobank_info: + for child in bank_info: + if name == child.get("name"): + child.set("iostd", iostd) diff --git a/litex/build/efinix/platform.py b/litex/build/efinix/platform.py index 482e2875f..dc2fd66d7 100644 --- a/litex/build/efinix/platform.py +++ b/litex/build/efinix/platform.py @@ -18,11 +18,12 @@ from litex.build.efinix import EfinixDbParser class EfinixPlatform(GenericPlatform): bitstream_ext = ".bit" - def __init__(self, *args, toolchain="efinity", **kwargs): + def __init__(self, *args, iobank_info=None, toolchain="efinity", **kwargs): GenericPlatform.__init__(self, *args, **kwargs) self.timing_model = self.device[-2:] self.device = self.device[:-2] + self.iobank_info = iobank_info if os.getenv("LITEX_ENV_EFINITY", False) == False: msg = "Unable to find or source Efinity toolchain, please either:\n"