efinix: add io bank voltage configuration

This commit is contained in:
Franck Jullien 2021-12-08 18:04:11 +01:00
parent d3b493d4e8
commit 5efb64b80b
3 changed files with 15 additions and 3 deletions

View File

@ -295,9 +295,10 @@ class EfinityToolchain:
excluded_ios = self.excluded_ios 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 # 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() self.ifacewriter.generate_xml_blocks()
# Run # Run

View File

@ -57,6 +57,9 @@ class InterfaceWriter:
if block["type"] == "DRAM": if block["type"] == "DRAM":
self.add_dram_xml(root, block) 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") xml_string = et.tostring(root, "utf-8")
reparsed = expatbuilder.parseString(xml_string, False) reparsed = expatbuilder.parseString(xml_string, False)
print_string = reparsed.toprettyxml(indent=" ") print_string = reparsed.toprettyxml(indent=" ")
@ -282,3 +285,10 @@ design.save()"""
load = "3" 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)

View File

@ -18,11 +18,12 @@ from litex.build.efinix import EfinixDbParser
class EfinixPlatform(GenericPlatform): class EfinixPlatform(GenericPlatform):
bitstream_ext = ".bit" 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) GenericPlatform.__init__(self, *args, **kwargs)
self.timing_model = self.device[-2:] self.timing_model = self.device[-2:]
self.device = self.device[:-2] self.device = self.device[:-2]
self.iobank_info = iobank_info
if os.getenv("LITEX_ENV_EFINITY", False) == False: if os.getenv("LITEX_ENV_EFINITY", False) == False:
msg = "Unable to find or source Efinity toolchain, please either:\n" msg = "Unable to find or source Efinity toolchain, please either:\n"