source: trunk/IPs/systemC/processor/Morpheo/Script/instruction_flow_dump.sh @ 117

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

1) Platforms : add new organization for test
2) Load_Store_Unit : add array to count nb_check in store_queue
3) Issue_queue and Core_Glue : rewrite the issue network
4) Special_Register_Unit : add reset value to register CID
5) Softwares : add multicontext test
6) Softwares : add SPECINT
7) Softwares : add MiBench?
7) Read_queue : inhib access for r0
8) Change Core_Glue (network) - dont yet support priority and load balancing scheme

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 3.1 KB
Line 
1#!/bin/bash
2
3#-----------------------------------------------------------
4# $Id: instruction_flow_dump.sh 117 2009-05-16 14:42:39Z rosiere $
5#-----------------------------------------------------------
6
7#-----[ usage ]---------------------------------------------
8function usage ()
9{
10    echo "Usage     : ${0} file1 file2";
11    echo "Arguments : ";
12    echo " * file1 : instruction flow file";
13    echo " * file2 : symbol file";
14    echo "format for file1 : xxx address xxx. address is in hexadecimal without 0x or additionnal 0";
15    exit;
16}
17
18#-----[ test_usage ]----------------------------------------
19function test_usage ()
20{
21    if test ${#} -ne 2; then
22        usage ${*};
23    fi;
24
25    if test ! -f ${1} -o ! -f ${2}; then
26        usage ${*};
27    fi;
28}
29
30#-----[ main ]----------------------------------------------
31function main ()
32{
33    test_usage ${*};
34
35    # Read symbol file and take function address and function name
36    local -ai array_address_begin;
37    local -ai array_address_end;
38    local -a array_name;
39
40    # first slot
41    array_address_begin[0]=0;
42    array_name[0]="???";
43
44    local -i cpt=1;
45    while read line; do
46        local type=$(echo ${line} | cut -d' ' -f2);
47
48        # Test if the symbol is in text section
49        if test "${type}" = "T"; then
50            local address_begin=$(echo ${line} | cut -d' ' -f1);
51            local name=$(   echo ${line} | cut -d' ' -f3);
52
53            # erase additionnal 0
54            declare str=$(expr match "${address_begin}" '.*\(^[0]*\)');
55            address_begin=$(printf %d 0x${address_begin#${str}});
56
57            local address_end=$((${address_begin}-1));
58
59            array_address_begin[${cpt}]=${address_begin};
60            array_address_end[$((${cpt}-1))]=${address_end};
61            array_name[${cpt}]="${name}";
62
63            #echo "${address_begin} ${name}";
64
65            cpt=$((${cpt}+1));
66        fi;
67    done < ${2};
68
69    # last slot
70    array_address_end[$((${cpt}-1))]=$(printf %d 0xffffffff);
71
72#    cpt=0;
73#    while test ${cpt} -ne ${#array_address_begin[*]}; do
74#        address_begin=${array_address_begin[${cpt}]};
75#        address_end=${array_address_end[${cpt}]};
76#        name=${array_name[${cpt}]};
77#
78#        echo "${address_begin} ${address_end} ${name}";
79#
80#        cpt=$((${cpt}+1));
81#    done;
82
83     # Read instruction flow file
84    while read line; do
85         # extract address
86       
87        local name="";
88        local -i address_current=$(printf %d 0x$(echo ${line} | cut -d' ' -f2));
89       
90         # search in address file if match
91        cpt=0;
92        while test ${cpt} -ne ${#array_address_begin[*]}; do
93            local -i address_begin=${array_address_begin[${cpt}]};
94            local -i address_end=${array_address_end[${cpt}]};
95           
96             # test if address_curent match with a address in symbol file
97            if test ${address_current} -ge ${address_begin} -a ${address_current} -lt ${address_end}; then
98                name=${array_name[${cpt}]};
99                break;
100            fi;
101           
102            cpt=$((${cpt}+1));
103        done;
104       
105        echo "${line} ${name}";
106       
107    done < ${1};
108
109}
110
111#-----[ Corps ]---------------------------------------------
112main ${*};
Note: See TracBrowser for help on using the repository browser.