1 | #!/bin/sh |
---|
2 | |
---|
3 | #-----[ variable ]------------------------------------------ |
---|
4 | declare DIR_DEFAULT_EXEC="$SOFT/SpecInt2000.or32"; |
---|
5 | #declare DIR_DEFAULT_EXEC="$SOFT/Basic_test.or32"; |
---|
6 | declare DIR_CONFIG="$IPS/processor/M_CPU/Configuration_files/Architecture" |
---|
7 | declare DIR_PLATFORMS="$PLATFORMS/Generic"; |
---|
8 | declare DEFAULT_EXEC="$DIR_DEFAULT_EXEC/bin/soft.x"; |
---|
9 | |
---|
10 | declare CONFIGURATION; |
---|
11 | declare EXECUTE; |
---|
12 | declare NB_CYCLE; |
---|
13 | |
---|
14 | #-----[ usage ]--------------------------------------------- |
---|
15 | function usage () |
---|
16 | { |
---|
17 | echo "usage : $0 [config [nb_cycle [exec]]]"; |
---|
18 | echo " * if config is not indicated, execute the more recent executable"; |
---|
19 | echo " * nb_cycle : number of simulated cycle"; |
---|
20 | echo " * if exec is not indicated, execute \"$DEFAULT_EXEC\""; |
---|
21 | exit 1; |
---|
22 | } |
---|
23 | |
---|
24 | #-----[ test_usage ]---------------------------------------- |
---|
25 | function test_usage () |
---|
26 | { |
---|
27 | if test $# == 0 -o $# -gt 3; |
---|
28 | then |
---|
29 | usage; |
---|
30 | fi |
---|
31 | } |
---|
32 | |
---|
33 | #-----[ make_arg ]------------------------------------------ |
---|
34 | |
---|
35 | function make_arg () |
---|
36 | { |
---|
37 | local CONFIG; |
---|
38 | local EXEC; |
---|
39 | local CYCLE; |
---|
40 | # Construction du nom de la configuration |
---|
41 | if [ $# -ge 1 ]; |
---|
42 | then |
---|
43 | CONFIG="system_"$1"" |
---|
44 | |
---|
45 | # Recompile l'executable |
---|
46 | ( |
---|
47 | cd $DIR_PLATFORMS; |
---|
48 | |
---|
49 | make M_CPU_CONFIGURATION_DIRECTORY="$DIR_CONFIG/m_cpu_configuration_$1" \ |
---|
50 | M_CPU_CONFIGURATION_FILENAME="m_cpu_configuration.h" \ |
---|
51 | ID="$1"; |
---|
52 | ) |
---|
53 | else |
---|
54 | # Test la presence du repertoire contenant les binaires |
---|
55 | if test ! -d $DIR_PLATFORMS/bin; |
---|
56 | then |
---|
57 | echo "Directory don't exist : \"$DIR_PLATFORMS/bin\", you need a configuration" |
---|
58 | usage; |
---|
59 | fi; |
---|
60 | |
---|
61 | CONFIG=(`ls -t $DIR_PLATFORMS/bin/*`); |
---|
62 | CONFIG=`basename ${CONFIG[0]} :`; |
---|
63 | fi |
---|
64 | |
---|
65 | #nombre de cycle |
---|
66 | if [ $# -ge 2 ]; |
---|
67 | then |
---|
68 | CYCLE=$2; |
---|
69 | fi; |
---|
70 | |
---|
71 | #executable |
---|
72 | if [ $# -ge 3 ]; |
---|
73 | then |
---|
74 | if [ -f $2 ]; |
---|
75 | then |
---|
76 | EXEC=$2; |
---|
77 | else |
---|
78 | echo "$2 : file not exist"; |
---|
79 | usage; |
---|
80 | fi |
---|
81 | else |
---|
82 | EXEC=$DEFAULT_EXEC; |
---|
83 | |
---|
84 | (cd $DIR_DEFAULT_EXEC; make;) |
---|
85 | |
---|
86 | if [ $? -ne 0 ] |
---|
87 | then |
---|
88 | echo "Error of compilation" |
---|
89 | exit 1; |
---|
90 | fi |
---|
91 | fi |
---|
92 | |
---|
93 | eval "CONFIGURATION=$CONFIG"; |
---|
94 | eval "EXECUTE=$EXEC"; |
---|
95 | eval "NB_CYCLE=$CYCLE"; |
---|
96 | } |
---|
97 | |
---|
98 | #-----[ main ]---------------------------------------------- |
---|
99 | function main () |
---|
100 | { |
---|
101 | test_usage $*; |
---|
102 | make_arg $*; |
---|
103 | |
---|
104 | # Lancement de l'executable |
---|
105 | |
---|
106 | #OPTION=--c |
---|
107 | OPTION= |
---|
108 | time $DIR_PLATFORMS/bin/$CONFIGURATION $OPTION $EXECUTE $NB_CYCLE; |
---|
109 | killall xtty; |
---|
110 | #valgrind --tool=memcheck |
---|
111 | } |
---|
112 | |
---|
113 | #-----[ Corps ]--------------------------------------------- |
---|
114 | main $*; |
---|