1 |
4 |
sumanta.ch |
GCC=g++
|
2 |
|
|
|
3 |
|
|
SCC=schroot -c centos5-i386 ~/bin/synphonycc_fpga
|
4 |
|
|
SCC_SCRIPTS=./scc_scripts
|
5 |
|
|
SYNTH_SRC=./synth_src
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
all: fpt_connect6 test_golden
|
12 |
|
|
|
13 |
|
|
fpt_connect6: ${SYNTH_SRC}/main.cpp util.o connect6.o connect6_synth.o state.o threats.o
|
14 |
|
|
${GCC} -o connect6 ${SYNTH_SRC}/main.cpp util.o connect6.o connect6_synth.o state.o threats.o -lpthread -lm -g -pg
|
15 |
|
|
|
16 |
|
|
connect6_synth.o: ${SYNTH_SRC}/connect6_synth.cpp ${SYNTH_SRC}/connect6_synth.h
|
17 |
|
|
${GCC} -c -g -pg ${SYNTH_SRC}/connect6_synth.cpp
|
18 |
|
|
connect6.o: ${SYNTH_SRC}/connect6.cpp ${SYNTH_SRC}/connect6.h
|
19 |
|
|
${GCC} -c -g -pg ${SYNTH_SRC}/connect6.cpp
|
20 |
|
|
|
21 |
|
|
util.o: ${SYNTH_SRC}/util.cpp ${SYNTH_SRC}/util.h
|
22 |
|
|
${GCC} -c -g -pg ${SYNTH_SRC}/util.cpp
|
23 |
|
|
state.o:${SYNTH_SRC}/state.cpp ${SYNTH_SRC}/shared.h
|
24 |
|
|
${GCC} -c -g -pg ${SYNTH_SRC}/state.cpp
|
25 |
|
|
|
26 |
|
|
threats.o:${SYNTH_SRC}/threats.cpp ${SYNTH_SRC}/shared.h
|
27 |
|
|
${GCC} -c -g -pg ${SYNTH_SRC}/threats.cpp
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
test_golden:
|
31 |
|
|
./connect6 -player L
|
32 |
|
|
|
33 |
|
|
clean:
|
34 |
|
|
rm -f *.o connect6 gmon.out myboard.txt
|
35 |
|
|
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
#first the c/c++ source should be compiled
|
40 |
|
|
fpga: synth altera_synth test
|
41 |
|
|
cp cp ./rtl_package/synth/altera_fpga/run/DE2.sof ../DEMO
|
42 |
|
|
|
43 |
|
|
synth: all imp_connect
|
44 |
|
|
imp_window:
|
45 |
|
|
#sed -s 's/\\TCAB_NAME/threat_window/g' main.cpp.base >main.cpp
|
46 |
|
|
cp ${SYNTH_SRC}/main.cpp.base ${SYNTH_SRC}/main.cpp
|
47 |
|
|
${SCC} ${SCC_SCRIPTS}/run_imp_window.tcl
|
48 |
|
|
imp_line: imp_window
|
49 |
|
|
#sed -s 's/\\TCAB_NAME/threat_line/g' main.cpp.base >main.cpp
|
50 |
|
|
cp ${SYNTH_SRC}/main.cpp.base ${SYNTH_SRC}/main.cpp
|
51 |
|
|
${SCC} ${SCC_SCRIPTS}/run_imp_line.tcl
|
52 |
|
|
imp_marks:
|
53 |
|
|
#sed -s 's/\\TCAB_NAME/ai_mraks/g' main.cpp.base >main.cpp
|
54 |
|
|
cp ${SYNTH_SRC}/main.cpp.base ${SYNTH_SRC}/main.cpp
|
55 |
|
|
${SCC} ${SCC_SCRIPTS}/run_imp_marks.tcl
|
56 |
|
|
imp_threat: imp_line imp_marks
|
57 |
|
|
#sed -s 's/\\TCAB_NAME/ai_threats/g' main.cpp.base >main.cpp
|
58 |
|
|
cp ${SYNTH_SRC}/main.cpp.base ${SYNTH_SRC}/main.cpp
|
59 |
|
|
${SCC} ${SCC_SCRIPTS}/run_imp_threat.tcl
|
60 |
|
|
imp_adjacent:
|
61 |
|
|
cp ${SYNTH_SRC}/main.cpp.base ${SYNTH_SRC}/main.cpp
|
62 |
|
|
#sed -s 's/\\TCAB_NAME/ai_adjacent/g' main.cpp.base >main.cpp
|
63 |
|
|
${SCC} ${SCC_SCRIPTS}/run_imp_adjacent.tcl
|
64 |
|
|
imp_connect: imp_threat imp_adjacent
|
65 |
|
|
sed -s 's/\\TCAB_NAME/connect6ai_synth/g' ${SYNTH_SRC}/main.cpp.base >${SYNTH_SRC}/main.cpp
|
66 |
|
|
${SCC} ${SCC_SCRIPTS}/run_imp_connect.tcl
|
67 |
|
|
|
68 |
|
|
altera_synth:
|
69 |
|
|
cp -r ./imp_connect/rtl_package/ ./
|
70 |
|
|
cp DE2/do_synth ./rtl_package/synth/altera_fpga/
|
71 |
|
|
cp DE2/quartus.tcl ./rtl_package/synth/altera_fpga/
|
72 |
|
|
cp DE2/constraints.sdc ./rtl_package/synth/altera_fpga/
|
73 |
|
|
echo -e 'all:\n\t./do_synth' > ./rtl_package/synth/altera_fpga/makefile
|
74 |
|
|
make -C ./rtl_package/synth/altera_fpga/
|
75 |
|
|
|
76 |
|
|
test:
|
77 |
|
|
../scripts/serial_port_setup.sh
|
78 |
|
|
rm -f ./test.result
|
79 |
|
|
for i in `seq 1 100` ; do ../connect6 -port /dev/ttyS0 -player L >> test.result 2>&1; done
|
80 |
|
|
#grep "FPGA has won" ./test.result | wc -l
|
81 |
|
|
#grep "AI has won" ./test.result | wc -l
|
82 |
|
|
#grep "TIE" ./test.result | wc -l
|
83 |
|
|
python ../scripts/esult.py
|
84 |
|
|
pgm:
|
85 |
|
|
cp ./rtl_package/synth/altera_fpga/run/DE2.sof ./
|
86 |
|
|
quartus_pgm -c USB-Blaster -m jtag -o "p;DE2.sof"
|
87 |
|
|
|
88 |
|
|
|
89 |
|
|
prof:
|
90 |
|
|
valgrind --tool=callgrind ./connect6 -player L
|
91 |
|
|
kcachegrind
|
92 |
|
|
|
93 |
|
|
altera_clean:
|
94 |
|
|
rm -rf ./rtl_package/
|
95 |
|
|
|
96 |
|
|
ultraclean: altera_clean
|
97 |
|
|
rm -rf imp_line imp_marks imp_threat imp_choose imp_adjacent imp_connect imp_window Logs
|