Skip to content

Commit

Permalink
Merge pull request enjoy-digital#2128 from VOGL-electronic/efinix-seu
Browse files Browse the repository at this point in the history
Add efinix SEU interface
  • Loading branch information
enjoy-digital authored Dec 4, 2024
2 parents 9551845 + e91d4d1 commit bff25c2
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions litex/build/efinix/ifacewriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,32 @@ def get_pin_name(pin):
cmds.append(f"# ---------- END REMOTE UPDATE ---------\n")
return "\n".join(cmds)

def generate_seu(self, block, verbose=True):
name = block["name"]
pins = block["pins"]
enable = block["enable"]
mode = block["mode"].upper()

def get_pin_name(pin):
return pin.backtrace[-1][0]

cmds = []
cmds.append(f"# ---------- SINGLE-EVENT UPSET ---------")
cmds.append(f'design.set_device_property("seu", "ENA_DETECT", "{enable}", "SEU")')
if enable:
cmds.append(f'design.set_device_property("seu", "CONFIG_PIN", "{get_pin_name(pins.CONFIG)}", "SEU")')
cmds.append(f'design.set_device_property("seu", "DONE_PIN", "{get_pin_name(pins.DONE)}", "SEU")')
cmds.append(f'design.set_device_property("seu", "ERROR_PIN", "{get_pin_name(pins.ERROR)}", "SEU")')
cmds.append(f'design.set_device_property("seu", "INJECT_ERROR_PIN", "{get_pin_name(pins.INJECT_ERROR)}", "SEU")')
cmds.append(f'design.set_device_property("seu", "RST_PIN", "{get_pin_name(pins.RST)}", "SEU")')
if mode == "MANUAL":
cmds.append(f'design.set_device_property("seu", "START_PIN", "{get_pin_name(pins.START)}", "SEU")')
cmds.append(f'design.set_device_property("seu", "MODE", "{mode}", "SEU")')
if mode == "AUTO" and hasattr(block, "wait_interval"):
cmds.append(f'design.set_device_property("seu", "WAIT_INTERVAL", "{block["wait_interval"]}", "SEU")')
cmds.append(f"# ---------- END SINGLE-EVENT UPSET ---------\n")
return "\n".join(cmds)

def generate(self, partnumber):
output = ""
for block in self.blocks:
Expand All @@ -653,6 +679,8 @@ def generate(self, partnumber):
output += self.generate_spiflash(block)
if block["type"] == "REMOTE_UPDATE":
output += self.generate_remote_update(block)
if block["type"] == "SEU":
output += self.generate_seu(block)
return output

def footer(self):
Expand Down

0 comments on commit bff25c2

Please sign in to comment.