| 1 |
2 |
jondawson |
#!/usr/bin/env python
|
| 2 |
|
|
|
| 3 |
|
|
"""compile, build and download the SP605 demo to the SP605 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 = "SP605"
|
| 13 |
|
|
shutil.copyfile("xilinx_input/SP605.ucf", os.path.join(working_directory, "SP605.ucf"))
|
| 14 |
|
|
shutil.copyfile("xilinx_input/SP605.prj", os.path.join(working_directory, "SP605.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 |
|
|
retval = os.system("../chips2/c2verilog no_reuse ../source/user_design_sp605.c")
|
| 23 |
|
|
retval = os.system("../chips2/c2verilog no_reuse ../source/server.c")
|
| 24 |
|
|
if retval != 0:
|
| 25 |
|
|
sys.exit(-1)
|
| 26 |
|
|
|
| 27 |
|
|
if "build" in sys.argv or "all" in sys.argv:
|
| 28 |
|
|
print "Building Demo using Xilinx ise ...."
|
| 29 |
|
|
retval = os.system("%s/xflow -synth xst_mixed.opt -p XC6Slx45t-fgg484 -implement balanced.opt -config bitgen.opt SP605"%xilinx)
|
| 30 |
|
|
if retval != 0:
|
| 31 |
|
|
sys.exit(-1)
|
| 32 |
|
|
|
| 33 |
|
|
if "download" in sys.argv or "all" in sys.argv:
|
| 34 |
|
|
print "Downloading bit file to development kit ...."
|
| 35 |
|
|
command_file = open("download.cmd", 'w')
|
| 36 |
|
|
command_file.write("setmode -bscan\n")
|
| 37 |
|
|
command_file.write("setCable -p auto\n")
|
| 38 |
|
|
command_file.write("identify\n")
|
| 39 |
|
|
command_file.write("assignfile -p 2 -file SP605.bit\n")
|
| 40 |
|
|
command_file.write("program -p 2\n")
|
| 41 |
|
|
command_file.write("quit\n")
|
| 42 |
|
|
command_file.close()
|
| 43 |
|
|
retval = os.system("%s/impact -batch download.cmd"%xilinx)
|
| 44 |
|
|
if retval != 0:
|
| 45 |
|
|
sys.exit(-1)
|
| 46 |
|
|
|
| 47 |
|
|
os.chdir(current_directory)
|