1 | #!/bin/bash |
---|
2 | |
---|
3 | #----------------------------------------------------------- |
---|
4 | # $Id$ |
---|
5 | #----------------------------------------------------------- |
---|
6 | |
---|
7 | #-----[ variable ]------------------------------------------ |
---|
8 | |
---|
9 | declare test_ko="Test KO"; |
---|
10 | declare test_ok="Test OK"; |
---|
11 | declare tmp="${MORPHEO_HOME}/tmp/SelfTest"; |
---|
12 | declare path="${MORPHEO_TOPLEVEL}/IPs/systemC/processor/Morpheo/"; |
---|
13 | |
---|
14 | declare -a directory=( |
---|
15 | "Common" |
---|
16 | |
---|
17 | "Behavioural" |
---|
18 | "Behavioural/Configuration" |
---|
19 | "Behavioural/Custom" |
---|
20 | |
---|
21 | "Behavioural/Generic/Counter" |
---|
22 | "Behavioural/Generic/Priority" |
---|
23 | "Behavioural/Generic/Queue_Control" |
---|
24 | "Behavioural/Generic/Queue" |
---|
25 | "Behavioural/Generic/RegisterFile/RegisterFile_Monolithic" |
---|
26 | "Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked" |
---|
27 | "Behavioural/Generic/RegisterFile" |
---|
28 | "Behavioural/Generic/Select/Select_Priority_Fixed" |
---|
29 | "Behavioural/Generic/Select" |
---|
30 | "Behavioural/Generic/Shifter" |
---|
31 | "Behavioural/Generic/Sort" |
---|
32 | "Behavioural/Generic/Victim/Victim_Pseudo_LRU" |
---|
33 | "Behavioural/Generic/Victim" |
---|
34 | |
---|
35 | "Behavioural/Core/Multi_Execute_loop/Execute_loop/Execute_loop_Glue" |
---|
36 | "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Functionnal_unit/Operation" |
---|
37 | "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Functionnal_unit" |
---|
38 | "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Load_store_unit" |
---|
39 | "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit" |
---|
40 | "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit" |
---|
41 | "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Read_unit/Read_unit/Read_queue" |
---|
42 | "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Read_unit/Read_unit/Reservation_station" |
---|
43 | "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Read_unit/Read_unit" |
---|
44 | "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Read_unit" |
---|
45 | "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Write_unit/Write_unit/Execute_queue" |
---|
46 | "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Write_unit/Write_unit/Write_queue" |
---|
47 | "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Write_unit/Write_unit" |
---|
48 | "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Write_unit" |
---|
49 | "Behavioural/Core/Multi_Execute_loop/Execute_loop/Network/Execution_unit_to_Write_unit" |
---|
50 | "Behavioural/Core/Multi_Execute_loop/Execute_loop/Network/Read_unit_to_Execution_unit" |
---|
51 | "Behavioural/Core/Multi_Execute_loop/Execute_loop/Network" |
---|
52 | "Behavioural/Core/Multi_Execute_loop/Execute_loop/Register_unit/Register_unit_Glue" |
---|
53 | "Behavioural/Core/Multi_Execute_loop/Execute_loop/Register_unit" |
---|
54 | "Behavioural/Core/Multi_Execute_loop/Execute_loop" |
---|
55 | "Behavioural/Core/Multi_Execute_loop" |
---|
56 | |
---|
57 | "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit" |
---|
58 | "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Issue_queue" |
---|
59 | "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/OOO_Engine_Glue" |
---|
60 | "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Reexecute_unit" |
---|
61 | "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Load_Store_pointer_unit" |
---|
62 | "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Register_translation_unit/Dependency_checking_unit" |
---|
63 | "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Register_translation_unit/Free_List_unit" |
---|
64 | "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Register_translation_unit/Register_Address_Translation_unit" |
---|
65 | "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Register_translation_unit/Register_translation_unit_Glue" |
---|
66 | "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Register_translation_unit/Stat_List_unit" |
---|
67 | "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Register_translation_unit" |
---|
68 | "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Rename_unit_Glue" |
---|
69 | "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Rename_select" |
---|
70 | "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit" |
---|
71 | "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Special_Register_unit" |
---|
72 | "Behavioural/Core/Multi_OOO_Engine/OOO_Engine" |
---|
73 | "Behavioural/Core/Multi_OOO_Engine" |
---|
74 | |
---|
75 | "Behavioural/Core/Multi_Front_end/Front_end/Context_State" |
---|
76 | "Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod/Instruction" |
---|
77 | "Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod" |
---|
78 | "Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue" |
---|
79 | "Behavioural/Core/Multi_Front_end/Front_end/Decod_unit" |
---|
80 | "Behavioural/Core/Multi_Front_end/Front_end/Front_end_Glue" |
---|
81 | "Behavioural/Core/Multi_Front_end/Front_end/Ifetch_unit/Address_management" |
---|
82 | "Behavioural/Core/Multi_Front_end/Front_end/Ifetch_unit/Ifetch_queue" |
---|
83 | "Behavioural/Core/Multi_Front_end/Front_end/Ifetch_unit/Ifetch_unit_Glue" |
---|
84 | "Behavioural/Core/Multi_Front_end/Front_end/Ifetch_unit" |
---|
85 | "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Branch_Target_Buffer/Branch_Target_Buffer_Glue" |
---|
86 | "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Branch_Target_Buffer/Branch_Target_Buffer_Register" |
---|
87 | "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Branch_Target_Buffer" |
---|
88 | "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Direction_Glue" |
---|
89 | "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction" |
---|
90 | # "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue" |
---|
91 | # "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/Two_Level_Branch_Predictor_Glue" |
---|
92 | # "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/Branch_History_Table" |
---|
93 | # "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/Pattern_History_Table" |
---|
94 | # "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor" |
---|
95 | # "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor" |
---|
96 | "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Prediction_unit_Glue" |
---|
97 | "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Return_Address_Stack" |
---|
98 | "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table" |
---|
99 | "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit" |
---|
100 | "Behavioural/Core/Multi_Front_end/Front_end" |
---|
101 | "Behavioural/Core/Multi_Front_end" |
---|
102 | |
---|
103 | "Behavioural/Core/Icache_Access" |
---|
104 | "Behavioural/Core/Dcache_Access" |
---|
105 | |
---|
106 | "Behavioural/Core/Core_Glue" |
---|
107 | "Behavioural/Core" |
---|
108 | |
---|
109 | "TopLevel" |
---|
110 | ); |
---|
111 | |
---|
112 | |
---|
113 | #-----[ usage ]--------------------------------------------- |
---|
114 | function usage () |
---|
115 | { |
---|
116 | echo "Usage : ${0} action"; |
---|
117 | echo "Arguments : "; |
---|
118 | echo " * action"; |
---|
119 | echo " * test : test all component"; |
---|
120 | echo ' for each component, create file in ${MORPHEO_HOME}/tmp/'; |
---|
121 | echo " * test_all : same as test, but don't stop at the first error"; |
---|
122 | echo " * res : list test's resultat"; |
---|
123 | echo " * list : list test's resultat"; |
---|
124 | echo " * clean : erase file in ${MORPHEO_HOME}/tmp/ directory"; |
---|
125 | echo " * clean_all : clean all component"; |
---|
126 | echo " * help : print this message"; |
---|
127 | echo ""; |
---|
128 | echo "Notes : "; |
---|
129 | echo " * Morpheo environment must be positionned"; |
---|
130 | exit; |
---|
131 | } |
---|
132 | |
---|
133 | #-----[ main ]---------------------------------------------- |
---|
134 | function main () |
---|
135 | { |
---|
136 | # Test operand |
---|
137 | if test ${#} -ne 1; then |
---|
138 | usage ${*}; |
---|
139 | fi; |
---|
140 | |
---|
141 | if test -z ${MORPHEO_TOPLEVEL}; then |
---|
142 | usage ${*}; |
---|
143 | fi; |
---|
144 | |
---|
145 | if test ! -d ${tmp}; then |
---|
146 | mkdir -p ${tmp}; |
---|
147 | fi; |
---|
148 | |
---|
149 | nb_cpu=$(cat /proc/cpuinfo |grep -c processor); |
---|
150 | pwd=${PWD}; |
---|
151 | case ${1} in |
---|
152 | "test" | "test_all") |
---|
153 | for i in ${directory[@]}; do |
---|
154 | component=$(basename ${i}); |
---|
155 | dir="${path}/${i}/SelfTest"; |
---|
156 | |
---|
157 | if test -d "${dir}"; then |
---|
158 | # have previous test ok ? |
---|
159 | declare -i make_test=1; |
---|
160 | |
---|
161 | if test -f ${tmp}/${component}; then |
---|
162 | res_test=$(cat ${tmp}/${component}); |
---|
163 | if test "${test_ok}" = "${res_test}"; then |
---|
164 | make_test=0; |
---|
165 | fi; |
---|
166 | fi; |
---|
167 | |
---|
168 | if test ${make_test} -eq 1; then |
---|
169 | cd ${dir}; |
---|
170 | make config; |
---|
171 | make -j${nb_cpu} execute; |
---|
172 | case ${?} in |
---|
173 | "0") |
---|
174 | echo ${test_ok} > ${tmp}/"${component}"; |
---|
175 | ;; |
---|
176 | *) |
---|
177 | |
---|
178 | echo ${test_ko} > ${tmp}/"${component}"; |
---|
179 | echo ""; |
---|
180 | echo "${component} : ${test_ko}"; |
---|
181 | echo ""; |
---|
182 | if test ${1} = "test"; then |
---|
183 | exit 1; |
---|
184 | fi; |
---|
185 | ;; |
---|
186 | esac; |
---|
187 | fi; |
---|
188 | else |
---|
189 | echo "${component} have not SelfTest directory."; |
---|
190 | fi; |
---|
191 | |
---|
192 | cd ${pwd}; |
---|
193 | done; |
---|
194 | ;; |
---|
195 | |
---|
196 | "res") |
---|
197 | for i in ${tmp}/*; do |
---|
198 | if test -f ${i}; then |
---|
199 | component=$(basename ${i}); |
---|
200 | res_test=$(cat ${i}); |
---|
201 | |
---|
202 | |
---|
203 | case "${res_test}" in |
---|
204 | "${test_ok}") color=32; |
---|
205 | ;; |
---|
206 | "${test_ko}") color=31; |
---|
207 | ;; |
---|
208 | *) color=39; |
---|
209 | ;; |
---|
210 | esac |
---|
211 | echo "[1;${color}m${res_test} - ${component}[1;0m"; |
---|
212 | fi; |
---|
213 | done; |
---|
214 | ;; |
---|
215 | |
---|
216 | "list") |
---|
217 | for i in ${directory[@]}; do |
---|
218 | component=$(basename ${i}); |
---|
219 | echo "${i}"; |
---|
220 | done; |
---|
221 | ;; |
---|
222 | |
---|
223 | "clean") |
---|
224 | rm -r ${tmp}; |
---|
225 | ;; |
---|
226 | |
---|
227 | "clean_all") |
---|
228 | for i in ${directory[@]}; do |
---|
229 | component=$(basename ${i}); |
---|
230 | |
---|
231 | cd ${path}/${i}; |
---|
232 | |
---|
233 | if test -f "Makefile"; then |
---|
234 | make clean; |
---|
235 | dir="SelfTest"; |
---|
236 | |
---|
237 | if test -d ${dir}; then |
---|
238 | cd ${dir}; |
---|
239 | make clean; |
---|
240 | else |
---|
241 | echo "${component} have not SelfTest directory."; |
---|
242 | fi; |
---|
243 | cd ${pwd}; |
---|
244 | fi; |
---|
245 | done; |
---|
246 | ;; |
---|
247 | |
---|
248 | "help") |
---|
249 | usage ${*}; |
---|
250 | ;; |
---|
251 | *) |
---|
252 | usage ${*}; |
---|
253 | esac |
---|
254 | } |
---|
255 | |
---|
256 | #-----[ Body ]---------------------------------------------- |
---|
257 | main ${*}; |
---|
258 | |
---|