source: trunk/IPs/systemC/processor/Morpheo/Script/SelfTest.sh @ 83

Last change on this file since 83 was 83, checked in by rosiere, 16 years ago

Add component : Context_State (manage miss prediction, exception , decod_enable, synchronisation instruction ...)

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