4 from litex
.build
.generic_programmer
import GenericProgrammer
5 from litex
.build
import tools
8 # XXX Lattice programmer need an .xcf file, will need clean up and support for more parameters
10 <?xml version='1.0' encoding='utf-8' ?>
11 <!DOCTYPE ispXCF SYSTEM "IspXCF.dtd" >
12 <ispXCF version="3.4.1">
17 <SelectedProg value="TRUE"/>
19 <Vendor>Lattice</Vendor>
20 <Family>LatticeECP3</Family>
21 <Name>LFE3-35EA</Name>
22 <File>{bitstream_file}</File>
23 <Operation>Fast Program</Operation>
27 <Program>SEQUENTIAL</Program>
28 <Process>ENTIRED CHAIN</Process>
29 <OperationOverride>No Override</OperationOverride>
30 <StartTAP>TLR</StartTAP>
32 <VerifyUsercode value="FALSE"/>
35 <CableName>USB2</CableName>
36 <PortAdd>FTUSB-0</PortAdd>
37 <USBID>Dual RS232-HS A Location 0000 Serial A</USBID>
47 class LatticeProgrammer(GenericProgrammer
):
48 needs_bitreverse
= False
50 def load_bitstream(self
, bitstream_file
):
51 xcf_file
= bitstream_file
.replace(".bit", ".xcf")
52 xcf_content
= _xcf_template
.format(bitstream_file
=bitstream_file
)
53 tools
.write_to_file(xcf_file
, xcf_content
)
54 subprocess
.call(["pgrcmd", "-infile", xcf_file
])