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