Skip to content

Instantly share code, notes, and snippets.

@gregdavill
Created October 1, 2019 12:25
Show Gist options
  • Save gregdavill/16c92c5f4fc674e16e58bd4aee4de99f to your computer and use it in GitHub Desktop.
Save gregdavill/16c92c5f4fc674e16e58bd4aee4de99f to your computer and use it in GitHub Desktop.
Script for use with prjtrellis to swap the IDCODE of a ECP5 bitstream
#!/usr/bin/env python3
"""
This simple example uses PyTrellis to unpack, change the IDCODE, and pack a bitstream
"""
import pytrellis
pytrellis.load_database("/usr/share/trellis/database")
bs = pytrellis.Bitstream.read_bit("build/gateware/impl/top_impl.bit")
chip = bs.deserialise_chip()
chip.info.idcode = 0x81113043
repack = pytrellis.Bitstream.serialise_chip(chip)
repack.write_bit("repack.bit")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment