Skip to content

Commit

Permalink
Adding support for bypassing ops.
Browse files Browse the repository at this point in the history
This means a migen user doesn't need to setup their ~/.jtag/rc file as
described in urjtag/doc/README.pld
  • Loading branch information
mithro committed Jul 5, 2015
1 parent 73ea404 commit e2683e9
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions mibuild/xilinx/programmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,35 @@ def _run_urjtag(cmds):
class UrJTAG(GenericProgrammer):
needs_bitreverse = True

def __init__(self, cable, flash_proxy_basename=None):
def __init__(self, cable, flash_proxy_basename=None, pld="spartan-6"):
GenericProgrammer.__init__(self, flash_proxy_basename)
self.cable = cable

# These commands come from urjtag/doc/README.pld
if pld in ("spartan-3", "spartan-6"):
self.bypass = """
instruction CFG_OUT 000100 BYPASS
instruction CFG_IN 000101 BYPASS
"""
elif pld in ("virtex-4",):
self.bypass = """
instruction CFG_OUT 1111000100 BYPASS
instruction CFG_IN 1111000101 BYPASS
instruction JPROGRAM 1111001011 BYPASS
instruction JSTART 1111001100 BYPASS
"""
else:
print("WARNING: Unknown PLD.")
self.bypass = ""

def load_bitstream(self, bitstream_file):
cmds = """cable {cable}
detect
{bypass}
pld load {bitstream}
quit
""".format(bitstream=bitstream_file, cable=self.cable)
""".format(bitstream=bitstream_file, cable=self.cable,
bypass=self.bypass)
_run_urjtag(cmds)

def flash(self, address, data_file):
Expand Down

0 comments on commit e2683e9

Please sign in to comment.