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