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

Last change on this file since 105 was 105, checked in by rosiere, 15 years ago

1) Bug fix : Load Miss Speculation (in Commit_unit, Update Prediction Table and Context State)
2) Change address, in rob write address_next.
3) Move Meta_Predictor in save directory

  • Property svn:executable set to *
File size: 10.8 KB
Line 
1#!/bin/bash
2
3#-----------------------------------------------------------
4# $Id$
5#-----------------------------------------------------------
6
7#-----[ variable ]------------------------------------------
8
9declare    test_ko="Test KO";
10declare    test_ok="Test OK";
11declare    tmp="${MORPHEO_HOME}/tmp/SelfTest";
12declare    path="${MORPHEO_TOPLEVEL}/IPs/systemC/processor/Morpheo/";
13
14declare -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 ]---------------------------------------------
114function usage ()
115{
116    echo "Usage            : ${0} action";
117    echo "Arguments        : ";
118    echo " * action";
119    echo "   * systemc     : test all model systemC";
120    echo '                   for each component, create file in ${MORPHEO_HOME}/tmp/';
121    echo "   * systemc_all : same as test, but don't stop at the first error";
122    echo "   * vhdl        : test all model VHDL";
123    echo '                   for each component, create file in ${MORPHEO_HOME}/tmp/';
124    echo "   * vhdl_all    : same as test, but don't stop at the first error";
125    echo "   * result      : list test's resultat";
126    echo "   * list        : list test";
127    echo "   * clean       : erase file in ${MORPHEO_HOME}/tmp/ directory";
128    echo "   * clean_all   : clean all component";
129    echo "   * help        : print this message";
130    echo "";
131    echo "Notes            : ";
132    echo " * Morpheo environment must be positionned";
133    exit;
134}
135
136#-----[ simulation ]----------------------------------------
137# arg1 : cmd (execute / sim)
138# arg2 : all (stop)
139# arg3 : file suffix
140function simulation ()
141{
142    pwd=${PWD};
143
144    nb_cpu=$(cat /proc/cpuinfo |grep -c processor);
145
146    for i in ${directory[@]}; do
147        component=$(basename ${i});
148        dir="${path}/${i}/SelfTest";
149
150        if test -d "${dir}"; then
151            # have previous test ok ?
152            declare -i make_test=1;
153           
154            file="${tmp}/${component}.${3}"
155
156            if test -f ${file}; then
157                res_test=$(cat ${file});
158                if test "${test_ok}" = "${res_test}"; then
159                    make_test=0;
160                fi;
161            fi;
162
163            if test ${make_test} -eq 1; then
164                cd ${dir};
165                make config;
166                make -j${nb_cpu} ${1};
167                case ${?} in
168                    "0")
169                        echo ${test_ok} > ${file};
170                        ;;
171                    *)
172
173                        echo ${test_ko} > ${file};
174                        echo "";
175                        echo "${component} : ${test_ko}";
176                        echo "";
177                        if test ${2} = "1"; then
178                            exit 1;
179                        fi;
180                        ;;
181                esac;
182                make clean;
183            fi;
184        else
185            echo "${component} have not SelfTest directory.";
186        fi;
187
188        cd ${pwd};
189    done;
190}
191
192#-----[ main ]----------------------------------------------
193function main ()
194{
195    # Test operand
196    if test ${#} -ne 1; then
197        usage ${*};
198    fi;
199
200    if test -z "${MORPHEO_TOPLEVEL}"; then
201        usage ${*};
202    fi;
203
204    if test ! -d ${tmp}; then
205        mkdir -p ${tmp};
206    fi;
207
208    case ${1} in
209        "systemc" )
210            simulation "execute" "1" "systemc";
211            ;;
212
213        "systemc_all")
214            simulation "execute" "0" "systemc";
215            ;;
216
217        "vhdl" )
218            simulation "sim"     "1" "vhdl";
219            ;;
220
221        "vhdl_all")
222            simulation "sim"     "0" "vhdl";
223            ;;
224
225        "result")
226            for x in "systemc" "vhdl"; do
227                echo "${x}";
228                for i in ${tmp}/*.${x}; do
229                    if test -f ${i}; then
230                        component=$(basename ${i} .${x});
231                        res_test=$(cat ${i});
232                       
233                        case "${res_test}" in
234                            "${test_ok}") color=32; 
235                                ;;
236                            "${test_ko}") color=31; 
237                                ;;
238                            *)            color=39; 
239                                ;;
240                        esac
241                        echo "[1;${color}m * ${res_test} - ${component}[1;0m";
242                    fi;
243                done;
244            done;
245            ;;
246
247
248        "list")
249            for i in ${directory[@]}; do
250                component=$(basename ${i});
251                echo "${i}";
252            done;
253            ;;
254
255        "clean")
256            rm -r ${tmp};
257            ;;
258           
259        "clean_all")
260            pwd=${PWD};
261
262            for i in ${directory[@]}; do
263                component=$(basename ${i});
264
265                cd ${path}/${i};
266
267                if test -f "Makefile"; then
268                    make clean;
269                    dir="SelfTest";
270                   
271                    if test -d ${dir}; then
272                        cd ${dir};
273                        make clean;
274                    else
275                        echo "${component} have not SelfTest directory.";
276                    fi;
277                    cd ${pwd};
278                fi;
279            done;
280            ;;
281
282        "help")
283            usage ${*};
284            ;;
285        *)
286            usage ${*};
287    esac
288}
289
290#-----[ Body ]----------------------------------------------
291main ${*};
292
Note: See TracBrowser for help on using the repository browser.