From e2dcdcf9175656e270fff83834f5d50c97da060c Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Sat, 28 Nov 2020 08:58:57 +0100 Subject: [PATCH] build/lattice/programmer/load_bitstream: convert .bit to .svf with bit_to_svf it bitstream_file provided as .bit. --- litex/build/lattice/programmer.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/litex/build/lattice/programmer.py b/litex/build/lattice/programmer.py index fc2bd0f23..a56add8d7 100644 --- a/litex/build/lattice/programmer.py +++ b/litex/build/lattice/programmer.py @@ -33,8 +33,15 @@ class OpenOCDJTAGProgrammer(GenericProgrammer): def load_bitstream(self, bitstream_file): config = self.find_config() - svf_file = bitstream_file.replace(".bit", ".svf") - self.call(["openocd", "-f", config, "-c", "transport select jtag; init; svf quiet progress \"{}\"; exit".format(svf_file)]) + assert bitstream_file.endswith(".bit") or bitstream_file.endswith(".svf") + if bitstream_file.endswith(".bit"): + from litex.build.lattice.bit_to_svf import bit_to_svf + bit = bitstream_file + svf = bit.replace(".bit", ".svf") + bit_to_svf(bit=bit, svf=svf) + else: + svf = bitstream_file + self.call(["openocd", "-f", config, "-c", "transport select jtag; init; svf quiet progress \"{}\"; exit".format(svf)]) def flash(self, address, data, verify=True): config = self.find_config()