-
Notifications
You must be signed in to change notification settings - Fork 20
/
project_setup.sh
executable file
·120 lines (111 loc) · 2.75 KB
/
project_setup.sh
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
if [ "$#" -eq 2 ]
then
input=$1;
dir_name=$2;
else
echo ""
echo "******************************************"
echo "Please Specify the PATH of config file and output file";
echo "An example is:"
echo "./project_setup.sh ./config_files/input.cfg ./fp32_kernel"
echo "******************************************"
echo ""
exit
fi
for ((n=1;n<=22;n++));
do
read -r line
if (( ${n} == 2 ))
then
IFS=':' read -ra Key <<< "$line";
value_temp="${Key[1]}";
unset IFS
IFS=';' read -ra Value <<< "$value_temp";
data_type="${Value[0]}";
elif (( ${n} == 3 ))
then
IFS=':' read -ra Key <<< "$line";
value_temp="${Key[1]}";
unset IFS
IFS=';' read -ra Value <<< "$value_temp";
KernelGen="${Value[0]}";
elif (( ${n} == 6 ))
then
IFS=':' read -ra Key <<< "$line";
value_temp="${Key[1]}";
unset IFS
IFS=';' read -ra Value <<< "$value_temp";
mm_k="${Value[0]}";
elif (( ${n} == 8 ))
then
IFS=':' read -ra Key <<< "$line";
value_temp="${Key[1]}";
unset IFS
IFS=';' read -ra Value <<< "$value_temp";
AIEArrGen="${Value[0]}";
elif (( ${n} == 16 ))
then
IFS=':' read -ra Key <<< "$line";
value_temp="${Key[1]}";
unset IFS
IFS=';' read -ra Value <<< "$value_temp";
SysGen="${Value[0]}";
fi
done < "$input"
if (( ${SysGen} == 1 )) && ( (( ${KernelGen} != 1 )) || (( ${AIEArrGen} != 1 )) )
then
echo ""
echo "******************************************"
echo "Error: When \"SysGen\" is specified to 1, \"KernelGen\" and \"AIEArrGen\" must also be 1."
echo "******************************************"
echo ""
exit
fi
if (( ${AIEArrGen} == 1 )) && (( ${KernelGen} != 1 ))
then
echo ""
echo "******************************************"
echo "Error: When \"AIEArrGen\" is specified to 1, \"KernelGen\" must also be 1."
echo "******************************************"
echo ""
exit
fi
if [ ${data_type} == "fp32" ]
then
src_dir="aie_fp32";
elif [ ${data_type} == "int32" ]
then
src_dir="aie_int32";
elif [ ${data_type} == "int16" ]
then
if [ ${mm_k} == 32 ]
then
src_dir="aie_int16/k_32";
else
src_dir="aie_int16";
fi
elif [ ${data_type} == "int8" ]
then
src_dir="aie_int8";
fi
if (( ${KernelGen} == 1 ))
then
./src_gen/Kernel_Gen/gen_gracpp.sh $1 $2;
./src_gen/Kernel_Gen/gen_grah.sh $1 $2;
./src_gen/Kernel_Gen/gen_para.sh $1 $2;
cp -r src/${src_dir}/* $2/aie;
cp -r src/Makefile* $2;
fi
if (( ${AIEArrGen} == 1 ))
then
mv $2/aie/mm_top.cpp $2/aie/single_graph.cpp
./src_gen/AIE_ArrGen/gen_graph.sh $1 $2;
./src_gen/AIE_ArrGen/gen_topcpp.sh $1 $2;
./src_gen/AIE_ArrGen/gen_toph.sh $1 $2;
fi
if (( ${SysGen} == 1 ))
then
./src_gen/PL_Gen/gen_conn.sh $1 $2;
./src_gen/PL_Gen/gen_dma.sh $1 $2;
./src_gen/Host_Gen/gen_host.sh $1 $2;
fi