Merge pull request #1962 from VOGL-electronic/master

Add support for the Efinix reconfiguration interface
This commit is contained in:
enjoy-digital 2024-05-27 08:36:40 +02:00 committed by GitHub
commit aa9ad61674
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 27 additions and 0 deletions

View File

@ -602,6 +602,31 @@ design.create("{2}", "{3}", "./../gateware", overwrite=True)
return '\n'.join(cmd) + '\n'
def generate_remote_update(self, block, verbose=True):
name = block["name"]
pins = block["pins"]
clock = block["clock"]
invert_clk = block["invert_clock"]
enable = block["enable"]
def get_pin_name(pin):
return pin.backtrace[-1][0]
cmds = []
cmds.append(f"# ---------- REMOTE UPDATE ---------")
cmds.append(f'design.set_device_property("ru", "RECONFIG_EN", "{enable}", "RU")')
if enable:
cmds.append(f'design.set_device_property("ru", "CBSEL_PIN", "{get_pin_name(pins.CBSEL)}", "RU")')
cmds.append(f'design.set_device_property("ru", "CLK_PIN", "{clock}", "RU")')
cmds.append(f'design.set_device_property("ru", "CONFIG_PIN", "{get_pin_name(pins.CONFIG)}", "RU")')
cmds.append(f'design.set_device_property("ru", "ENA_PIN", "{get_pin_name(pins.ENA)}", "RU")')
cmds.append(f'design.set_device_property("ru", "ERROR_PIN", "{get_pin_name(pins.ERROR)}", "RU")')
if hasattr(pins, 'IN_USER'):
cmds.append(f'design.set_device_property("ru", "IN_USER_PIN", "{get_pin_name(pins.IN_USER)}", "RU")')
cmds.append(f'design.set_device_property("ru", "INVERT_CLK_EN", "{invert_clk}", "RU")')
cmds.append(f"# ---------- END REMOTE UPDATE ---------\n")
return "\n".join(cmds)
def generate(self, partnumber):
output = ""
for block in self.blocks:
@ -624,6 +649,8 @@ design.create("{2}", "{3}", "./../gateware", overwrite=True)
output += self.generate_jtag(block)
if block["type"] == "SPI_FLASH":
output += self.generate_spiflash(block)
if block["type"] == "REMOTE_UPDATE":
output += self.generate_remote_update(block)
return output
def footer(self):