Add support for the Efinix reconfiguration interface

This adds low level support for the reconfiguration interface (sometimes also called remote update by Efinix)

Signed-off-by: Matthias Breithaupt <m.breithaupt@vogl-electronic.com>
This commit is contained in:
Matthias Breithaupt 2024-05-23 11:48:48 +00:00
parent 56371c4d9f
commit eed89ba3a3
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' 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): def generate(self, partnumber):
output = "" output = ""
for block in self.blocks: for block in self.blocks:
@ -624,6 +649,8 @@ design.create("{2}", "{3}", "./../gateware", overwrite=True)
output += self.generate_jtag(block) output += self.generate_jtag(block)
if block["type"] == "SPI_FLASH": if block["type"] == "SPI_FLASH":
output += self.generate_spiflash(block) output += self.generate_spiflash(block)
if block["type"] == "REMOTE_UPDATE":
output += self.generate_remote_update(block)
return output return output
def footer(self): def footer(self):