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

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [bench/] [cpp/] [pdump.cpp] - Diff between revs 69 and 75

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

Rev 69 Rev 75
Line 50... Line 50...
        return a.clks < b.clks;
        return a.clks < b.clks;
}
}
 
 
void    dump_file(const char *fn) {
void    dump_file(const char *fn) {
        const   int     NZIP = 4096;
        const   int     NZIP = 4096;
        char    ln[NZIP];
        char    lna[NZIP], lnb[NZIP];
        ZIPI    ibuf[NZIP];
        ZIPI    ibuf[NZIP];
        FILE    *fp, *pf;
        FILE    *fp, *pf;
        int     nr;
        int     nr;
        unsigned        addr=0x08000, mina = -1, maxa = 0,
        unsigned        addr=0x08000, mina = -1, maxa = 0,
                        *pfcnt = NULL, *pfclk = NULL;
                        *pfcnt = NULL, *pfclk = NULL;
Line 104... Line 104...
        }
        }
 
 
        printf("%s:\n", fn);
        printf("%s:\n", fn);
        while((nr=fread(ibuf, sizeof(ZIPI), NZIP, fp))>0) {
        while((nr=fread(ibuf, sizeof(ZIPI), NZIP, fp))>0) {
                for(int i=0; i<nr; i++) {
                for(int i=0; i<nr; i++) {
                        zipi_to_string(ibuf[i], ln);
                        zipi_to_string(ibuf[i], lna, lnb);
                        // printf("%s\n", ln);
                        // printf("%s\n", ln);
                        printf("%08x: (0x%08x %c%c%c%c) ", addr,
                        printf("%08x: (0x%08x %c%c%c%c) ", addr,
                                ibuf[i],
                                ibuf[i],
                                isgraph((ibuf[i]>>24)&0x0ff)?((ibuf[i]>>24)&0x0ff) : '.',
                                isgraph((ibuf[i]>>24)&0x0ff)?((ibuf[i]>>24)&0x0ff) : '.',
                                isgraph((ibuf[i]>>16)&0x0ff)?((ibuf[i]>>16)&0x0ff) : '.',
                                isgraph((ibuf[i]>>16)&0x0ff)?((ibuf[i]>>16)&0x0ff) : '.',
                                isgraph((ibuf[i]>> 8)&0x0ff)?((ibuf[i]>> 8)&0x0ff) : '.',
                                isgraph((ibuf[i]>> 8)&0x0ff)?((ibuf[i]>> 8)&0x0ff) : '.',
                                isgraph((ibuf[i]    )&0x0ff)?((ibuf[i]    )&0x0ff) : '.'
                                isgraph((ibuf[i]    )&0x0ff)?((ibuf[i]    )&0x0ff) : '.'
                                );
                                );
                        if (pfcnt)
                        if (pfcnt)
                                printf("%8d %8d ", pfcnt[addr-mina], pfclk[addr-mina]);
                                printf("%8d %8d ", pfcnt[addr-mina], pfclk[addr-mina]);
                        printf("%s\n", ln);
                        printf("%s\n", lna);
 
                        if (lnb[0])
 
                                printf("%26s%s\n", "", lnb);
 
 
                        addr++;
                        addr++;
                }
                }
        } fclose(fp);
        } fclose(fp);
}
}
 
 
int main(int argc, char **argv) {
int main(int argc, char **argv) {
 
        if (argc <= 1)
 
                printf("USAGE: pdump <dump-file> | less\n");
        for(int argn=1; argn<argc; argn++) {
        for(int argn=1; argn<argc; argn++) {
                if(access(argv[argn], R_OK)==0)
                if(access(argv[argn], R_OK)==0)
                        dump_file(argv[argn]);
                        dump_file(argv[argn]);
        }
        }
 
 

powered by: WebSVN 2.1.0

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