from litex.build.xilinx import common
-def _run_urjtag(cmds):
- with subprocess.Popen("jtag", stdin=subprocess.PIPE) as process:
- process.stdin.write(cmds.encode("ASCII"))
- process.communicate()
-
-
-class UrJTAG(GenericProgrammer):
- needs_bitreverse = True
-
- def __init__(self, cable, flash_proxy_basename=None):
- GenericProgrammer.__init__(self, flash_proxy_basename)
- self.cable = cable
-
- def load_bitstream(self, bitstream_file):
- cmds = """cable {cable}
-detect
-pld load {bitstream}
-quit
-""".format(bitstream=bitstream_file, cable=self.cable)
- _run_urjtag(cmds)
-
- def flash(self, address, data_file):
- flash_proxy = self.find_flash_proxy()
- cmds = """cable {cable}
-detect
-pld load "{flash_proxy}"
-initbus fjmem opcode=000010
-frequency 6000000
-detectflash 0
-endian big
-flashmem "{address}" "{data_file}" noverify
-""".format(flash_proxy=flash_proxy, address=address, data_file=data_file,
- cable=self.cable)
- _run_urjtag(cmds)
-
-
class XC3SProg(GenericProgrammer):
needs_bitreverse = False
quit
""".format(data=data_file, flash_part=self.flash_part)
_run_vivado(self.vivado_path, self.vivado_ver, cmds)
-
-
-class Adept(GenericProgrammer):
- """Using the Adept tool with an onboard Digilent "USB JTAG" cable.
-
- You need to install Adept Utilities V2 from
- http://www.digilentinc.com/Products/Detail.cfm?NavPath=2,66,828&Prod=ADEPT2
- """
-
- needs_bitreverse = False
-
- def __init__(self, board, index, flash_proxy_basename=None):
- GenericProgrammer.__init__(self, flash_proxy_basename)
- self.board = board
- self.index = index
-
- def load_bitstream(self, bitstream_file):
- subprocess.call([
- "djtgcfg",
- "--verbose",
- "prog", "-d", self.board,
- "-i", str(self.index),
- "-f", bitstream_file,
- ])
-
- def flash(self, address, data_file):
- raise ValueError("Flashing unsupported with DigilentAdept tools")