OpenCores
URL https://opencores.org/ocsvn/amber/amber/trunk

Subversion Repositories amber

[/] [amber/] [trunk/] [sw/] [tools/] [amber-func-jumps.c] - Diff between revs 11 and 61

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 11 Rev 61
Line 91... Line 91...
char *line_buffer;
char *line_buffer;
unsigned int addr;
unsigned int addr;
 
 
struct func_name func_names [NAMES_SIZE];
struct func_name func_names [NAMES_SIZE];
char a[12], n[48];
char a[12], n[48];
char s_clk_count[12], s_from_addr[12], s_to_addr[12], s_r0[12];
char s_clk_count[12], s_from_addr[12], s_to_addr[12], s_r0[12], s_r1[12];
unsigned int from_addr, to_addr, clk_count;
unsigned int from_addr, to_addr, clk_count;
unsigned int x;
unsigned int x;
 
char current_func_name [48] = "none";
 
 
unsigned int slen;
unsigned int slen;
 
 
if (argc < 3)
if (argc < 3)
    {
    {
Line 152... Line 153...
 
 
 
 
/* Assign names to jumps */
/* Assign names to jumps */
while ( (bytes_read = getline (&line_buffer, &nbytes, jumps_file)) > 0)
while ( (bytes_read = getline (&line_buffer, &nbytes, jumps_file)) > 0)
    {
    {
    sscanf(line_buffer, "%s %s %s %s", s_clk_count, s_from_addr, s_to_addr, s_r0);
    sscanf(line_buffer, "%s %s %s %s %s", s_clk_count, s_from_addr, s_to_addr, s_r0, s_r1);
 
 
    if ( !conv_hstring(s_from_addr, &from_addr) )
    if ( !conv_hstring(s_from_addr, &from_addr) )
        {
        {
        fprintf(stderr,"ERROR: conv_hstring error in jumps file, from_addr, with i = %d\n", i);
        fprintf(stderr,"ERROR: conv_hstring error in jumps file, from_addr, with i = %d\n", i);
        return 1;
        return 1;
Line 184... Line 185...
    while ( !found && !exhausted )
    while ( !found && !exhausted )
        {
        {
        mid = (start + end) / 2;
        mid = (start + end) / 2;
 
 
        if ( to_addr >= func_names[mid].address &&
        if ( to_addr >= func_names[mid].address &&
             to_addr <  func_names[mid+1].address )
             (to_addr <  func_names[mid+1].address || mid == end) )
            {
            {
            found = 1;
            found = 1;
            to_func_num = mid;
            to_func_num = mid;
            if ( to_addr == func_names[mid].address ) exact = 1;
            if ( to_addr == func_names[mid].address ) exact = 1;
            }
            }
Line 202... Line 203...
            else
            else
                end = mid;
                end = mid;
            }
            }
        }
        }
 
 
 
 
 
    if (!found)
 
        fprintf(stderr,"WARNING: to_addr 0x%08x not found\n", to_addr);
 
 
    /*
    /*
       now assign a function to the from_address
       now assign a function to the from_address
       this just assigns a function within the range
       this just assigns a function within the range
    */
    */
    if (found)
    if (found)
Line 218... Line 223...
        while (!found)
        while (!found)
            {
            {
            mid = (start + end) / 2;
            mid = (start + end) / 2;
 
 
            if ( from_addr >= func_names[mid].address &&
            if ( from_addr >= func_names[mid].address &&
                 from_addr <  func_names[mid+1].address )
                 (from_addr <  func_names[mid+1].address || mid == end) )
                {
                {
                found = 1;
                found = 1;
                if ( strcmp ( func_names[mid].name, func_names[to_func_num].name ) )
                if ( strcmp ( func_names[mid].name, func_names[to_func_num].name ) )
                    {
                    {
 
 
                    if ( exact ) {
                    if ( exact ) {
                        if ( func_names[to_func_num].address < 0x02000000 )
 
                            printf("%9d u %s ->", clk_count, func_names[mid].name);
 
                        else
 
                            printf("%9d   %s ->", clk_count, func_names[mid].name);
                            printf("%9d   %s ->", clk_count, func_names[mid].name);
 
 
                        slen = 35 - strlen ( func_names[mid].name );
                        slen = 35 - strlen ( func_names[mid].name );
                        if ( slen > 0 ) {
                        if ( slen > 0 ) {
                            for (x=0;x<slen;x++) printf(" ");
                            for (x=0;x<slen;x++) printf(" ");
                            }
                            }
 
 
 
                        printf("( r0 %s, r1 %s ) %s\n",
                        if ( func_names[to_func_num].address < 0x02000000 )
 
                            printf("( %s ) %s u\n",
 
                                s_r0,
 
                                func_names[to_func_num].name);
 
                        else
 
                            printf("( %s ) %s\n",
 
                                s_r0,
                                s_r0,
 
                            s_r1,
                                func_names[to_func_num].name);
                                func_names[to_func_num].name);
 
 
 
                        strcpy(current_func_name, func_names[to_func_num].name);
 
 
                        }
                        }
                    else {
                    else if ( strcmp(func_names[to_func_num].name, current_func_name)) {
                        printf("%9d   %s <-",
                        printf("%9d   %s <-",
                                clk_count,
                                clk_count,
                                func_names[to_func_num].name);
                                func_names[to_func_num].name);
 
 
                        slen = 35 - strlen ( func_names[to_func_num].name );
                        slen = 35 - strlen ( func_names[to_func_num].name );
                        if ( slen > 0 ) {
                        if ( slen > 0 ) {
                            for (x=0;x<slen;x++) printf(" ");
                            for (x=0;x<slen;x++) printf(" ");
                            }
                            }
 
 
 
 
                        printf("( %s )\n",
                        printf("( r0 %s, r1 %s )\n",
                                s_r0);
                                s_r0, s_r1);
                        }
                        }
                    }
                    }
                }
                }
            else
            else
                {
                {

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.