mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
mibuild: Adding error checking around xsvf generation
This commit is contained in:
parent
8daf5e32c1
commit
0df9c16e69
2 changed files with 7 additions and 1 deletions
|
@ -80,6 +80,8 @@ class FPGALink(GenericProgrammer):
|
||||||
xsvf_file = os.path.splitext(bitstream_file)[0]+'.xsvf'
|
xsvf_file = os.path.splitext(bitstream_file)[0]+'.xsvf'
|
||||||
print("\nGenerating xsvf formatted bitstream")
|
print("\nGenerating xsvf formatted bitstream")
|
||||||
print("="*n)
|
print("="*n)
|
||||||
|
if os.path.exists(xsvf_file):
|
||||||
|
os.unlink(xsvf_file)
|
||||||
_create_xsvf(bitstream_file, xsvf_file)
|
_create_xsvf(bitstream_file, xsvf_file)
|
||||||
print("\n"+"="*n+"\n")
|
print("\n"+"="*n+"\n")
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
@ -73,10 +74,13 @@ def _run_impact(cmds):
|
||||||
with subprocess.Popen("impact -batch", stdin=subprocess.PIPE, shell=True) as process:
|
with subprocess.Popen("impact -batch", stdin=subprocess.PIPE, shell=True) as process:
|
||||||
process.stdin.write(cmds.encode("ASCII"))
|
process.stdin.write(cmds.encode("ASCII"))
|
||||||
process.communicate()
|
process.communicate()
|
||||||
|
return process.returncode
|
||||||
|
|
||||||
|
|
||||||
def _create_xsvf(bitstream_file, xsvf_file):
|
def _create_xsvf(bitstream_file, xsvf_file):
|
||||||
_run_impact("""
|
assert os.path.exists(bitstream_file), bitstream_file
|
||||||
|
assert not os.path.exists(xsvf_file), xsvf_file
|
||||||
|
assert 0 == _run_impact("""
|
||||||
setPreference -pref KeepSVF:True
|
setPreference -pref KeepSVF:True
|
||||||
setMode -bs
|
setMode -bs
|
||||||
setCable -port xsvf -file {xsvf}
|
setCable -port xsvf -file {xsvf}
|
||||||
|
|
Loading…
Reference in a new issue