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