From: Florent Kermarrec Date: Fri, 2 Dec 2016 16:23:40 +0000 (+0100) Subject: litex/build: move xcf_template to platform (xcf is specific to platform) X-Git-Tag: 24jan2021_ls180~1923 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=873e50430e873630fca26fbc59fd20cb0ae1d590;p=litex.git litex/build: move xcf_template to platform (xcf is specific to platform) --- diff --git a/litex/boards/platforms/versa.py b/litex/boards/platforms/versa.py index e1a0cf5f..ca9b6bd0 100644 --- a/litex/boards/platforms/versa.py +++ b/litex/boards/platforms/versa.py @@ -92,5 +92,43 @@ class Platform(LatticePlatform): self.add_period_constraint(self.lookup_request("eth_clocks", 1).rx, 8.0) except ConstraintError: pass + def create_programmer(self): - return LatticeProgrammer() + _xcf_template = """ + + + + + + JTAG + + + 1 + Lattice + LatticeECP3 + LFE3-35EA + {bitstream_file} + Fast Program + + + + SEQUENTIAL + ENTIRED CHAIN + No Override + TLR + TLR + + + + USB2 + FTUSB-0 + Dual RS232-HS A Location 0000 Serial A + + TRST ABSENT; + ISPEN ABSENT; + + + +""" + + return LatticeProgrammer(_xcf_template) diff --git a/litex/build/lattice/programmer.py b/litex/build/lattice/programmer.py index 94726d22..a34af86b 100644 --- a/litex/build/lattice/programmer.py +++ b/litex/build/lattice/programmer.py @@ -5,50 +5,14 @@ from litex.build.generic_programmer import GenericProgrammer from litex.build import tools -# XXX Lattice programmer need an .xcf file, will need clean up and support for more parameters -_xcf_template = """ - - - - - - JTAG - - - 1 - Lattice - LatticeECP3 - LFE3-35EA - {bitstream_file} - Fast Program - - - - SEQUENTIAL - ENTIRED CHAIN - No Override - TLR - TLR - - - - USB2 - FTUSB-0 - Dual RS232-HS A Location 0000 Serial A - - TRST ABSENT; - ISPEN ABSENT; - - - -""" - - class LatticeProgrammer(GenericProgrammer): needs_bitreverse = False + def __init__(self, xcf_template): + self.xcf_template = xcf_template + def load_bitstream(self, bitstream_file): xcf_file = bitstream_file.replace(".bit", ".xcf") - xcf_content = _xcf_template.format(bitstream_file=bitstream_file) + xcf_content = self.xcf_template.format(bitstream_file=bitstream_file) tools.write_to_file(xcf_file, xcf_content) subprocess.call(["pgrcmd", "-infile", xcf_file])