forked from timvideos/litex-buildenv
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathload.py
More file actions
executable file
·32 lines (25 loc) · 734 Bytes
/
load.py
File metadata and controls
executable file
·32 lines (25 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python3
import sys
import os
cmd, prog = sys.argv[:2]
if len(sys.argv) == 3:
fname = sys.argv[2]
else:
p = os.environ['PLATFORM']
t = os.environ['TARGET']
c = os.environ['CPU']
fname = "build/{p}_{t}_{c}/gateware/top.bit".format(
p=p, t=t, c=c)
if prog == 'ise':
from litex.build.xilinx import iMPACT
prog = iMPACT()
elif prog == 'vivado':
from litex.build.xilinx import VivadoProgrammer
prog = VivadoProgrammer()
else:
raise SystemError('Unknown programmer {}'.format(prog))
if not os.path.exists(fname):
raise SystemError('File {} not found'.format(fname))
if not fname.endswith('.bit'):
raise SystemError('Use the .bit file')
prog.load_bitstream(fname)