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