mibuild/xilinx/programmer: add iMPACT programmer (for sb: I need it in Windows for...
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Sat, 21 Mar 2015 19:27:11 +0000 (20:27 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Sat, 21 Mar 2015 19:27:11 +0000 (20:27 +0100)
mibuild/xilinx/programmer.py

index 12c8b6cbd98d5f597e0a13081bf991b0d66eccb4..0a09efa37a5f4378f57adb2166f066ca8ae60131 100644 (file)
@@ -63,6 +63,23 @@ class FpgaProg(GenericProgrammer):
                subprocess.call(["fpgaprog", "-v", "-sa", "-r", "-b", flash_proxy,
                                   "-f", data_file])
 
+def _run_impact(cmds):
+       with subprocess.Popen("impact -batch", stdin=subprocess.PIPE) as process:
+               process.stdin.write(cmds.encode("ASCII"))
+               process.communicate()
+
+class iMPACT(GenericProgrammer):
+       needs_bitreverse = False
+
+       def load_bitstream(self, bitstream_file):
+               cmds = """setMode -bs
+setCable -p auto
+addDevice -p 1 -file {bitstream}
+program -p 1
+quit
+""".format(bitstream=bitstream_file)
+               _run_impact(cmds)
+
 def _run_vivado(path, ver, cmds):
        if sys.platform == "win32" or sys.platform == "cygwin":
                vivado_cmd = "vivado -mode tcl"