1 |
2 |
jondawson |
#!/usr/bin/env python
|
2 |
|
|
|
3 |
|
|
"""compile, build and download the ATLYS demo to the ATLYS development kit"""
|
4 |
|
|
|
5 |
|
|
import sys
|
6 |
|
|
import os
|
7 |
|
|
import shutil
|
8 |
|
|
|
9 |
|
|
from user_settings import xilinx
|
10 |
|
|
|
11 |
|
|
current_directory = os.getcwd()
|
12 |
|
|
working_directory = "ATLYS"
|
13 |
|
|
shutil.copyfile("xilinx_input/ATLYS.ucf", os.path.join(working_directory, "ATLYS.ucf"))
|
14 |
|
|
shutil.copyfile("xilinx_input/ATLYS.prj", os.path.join(working_directory, "ATLYS.prj"))
|
15 |
|
|
shutil.copyfile("xilinx_input/xst_mixed.opt", os.path.join(working_directory, "xst_mixed.opt"))
|
16 |
|
|
shutil.copyfile("xilinx_input/balanced.opt", os.path.join(working_directory, "balanced.opt"))
|
17 |
|
|
shutil.copyfile("xilinx_input/bitgen.opt", os.path.join(working_directory, "bitgen.opt"))
|
18 |
|
|
os.chdir(working_directory)
|
19 |
|
|
|
20 |
|
|
if "compile" in sys.argv or "all" in sys.argv:
|
21 |
|
|
print "Compiling C files using chips ...."
|
22 |
3 |
jondawson |
retval = os.system("../chips2/c2verilog ../source/user_design.c")
|
23 |
2 |
jondawson |
retval = os.system("../chips2/c2verilog ../source/server.c")
|
24 |
|
|
if retval != 0:
|
25 |
|
|
sys.exit(-1)
|
26 |
|
|
|
27 |
3 |
jondawson |
if "synth_estimate" in sys.argv:
|
28 |
|
|
print "Test build to estimate size ...."
|
29 |
|
|
os.mkdir(os.path.join(current_directory, "synth_estimate"))
|
30 |
|
|
os.chdir(os.path.join(current_directory, "synth_estimate"))
|
31 |
|
|
retval = os.system("../chips2/c2verilog ../source/server.c")
|
32 |
|
|
output_file = open("server.prj", "w")
|
33 |
|
|
output_file.write("verilog work server.v")
|
34 |
|
|
output_file.close()
|
35 |
|
|
os.system("%s/xflow -synth xst_mixed.opt -p XC6Slx45-CSG324 -implement balanced.opt -config bitgen.opt server"%xilinx)
|
36 |
|
|
os.chdir(current_directory)
|
37 |
|
|
shutil.rmtree("synth_estimate")
|
38 |
|
|
|
39 |
2 |
jondawson |
if "build" in sys.argv or "all" in sys.argv:
|
40 |
|
|
print "Building Demo using Xilinx ise ...."
|
41 |
|
|
retval = os.system("%s/xflow -synth xst_mixed.opt -p XC6Slx45-CSG324 -implement balanced.opt -config bitgen.opt ATLYS"%xilinx)
|
42 |
|
|
if retval != 0:
|
43 |
|
|
sys.exit(-1)
|
44 |
3 |
jondawson |
shutil.copyfile("server.v", os.path.join(current_directory, "precompiled", "server.v"))
|
45 |
|
|
shutil.copyfile("ATLYS.bit", os.path.join(current_directory, "precompiled", "ATLYS.bit"))
|
46 |
2 |
jondawson |
|
47 |
|
|
if "download" in sys.argv or "all" in sys.argv:
|
48 |
|
|
print "Downloading bit file to development kit ...."
|
49 |
|
|
retval = os.system("sudo djtgcfg prog -d Atlys -i 0 -f ATLYS.bit")
|
50 |
|
|
if retval != 0:
|
51 |
|
|
sys.exit(-1)
|
52 |
|
|
|
53 |
|
|
os.chdir(current_directory)
|