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

Subversion Repositories or1k

[/] [or1k/] [tags/] [stable_0_2_0_rc2/] [or1ksim/] [testbench/] [mycompress.c] - Diff between revs 997 and 1024

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

Rev 997 Rev 1024
Line 256... Line 256...
    out_count = 0;
    out_count = 0;
    clear_flg = 0;
    clear_flg = 0;
    ratio = 0;
    ratio = 0;
    in_count = 1;
    in_count = 1;
 
 
    PRINTF("main: bytes_out %d... hsize %d\n", (int)bytes_out, (int)hsize);
    printf("main: bytes_out %d... hsize %d\n", (int)bytes_out, (int)hsize);
 
 
    checkpoint = CHECK_GAP;
    checkpoint = CHECK_GAP;
    maxcode = MAXCODE(n_bits = INIT_BITS);
    maxcode = MAXCODE(n_bits = INIT_BITS);
    free_ent = ((block_compress) ? FIRST : 256 );
    free_ent = ((block_compress) ? FIRST : 256 );
 
 
Line 269... Line 269...
 
 
    hshift = 0;
    hshift = 0;
    for ( fcode = (long) hsize;  fcode < 65536L; fcode *= 2L )
    for ( fcode = (long) hsize;  fcode < 65536L; fcode *= 2L )
        hshift++;
        hshift++;
    hshift = 8 - hshift;                /* set hash code range bound */
    hshift = 8 - hshift;                /* set hash code range bound */
    PRINTF("main: hshift %d...\n", hshift);
    printf("main: hshift %d...\n", hshift);
 
 
    hsize_reg = hsize;
    hsize_reg = hsize;
    cl_hash( (count_int) hsize_reg);            /* clear hash table */
    cl_hash( (count_int) hsize_reg);            /* clear hash table */
 
 
/*#ifdef SIGNED_COMPARE_SLOW
/*#ifdef SIGNED_COMPARE_SLOW
    while ( (c = getchar()) != (unsigned) EOF ) {
    while ( (c = getchar()) != (unsigned) EOF ) {
#else
#else
    while ( (c = getchar()) != EOF ) {
    while ( (c = getchar()) != EOF ) {
#endif*/
#endif*/
    PRINTF("main: bytes_out %d...\n", (int)bytes_out);
    printf("main: bytes_out %d...\n", (int)bytes_out);
    PRINTF("main: hsize_reg %d...\n", (int)hsize_reg);
    printf("main: hsize_reg %d...\n", (int)hsize_reg);
    PRINTF("main: before compress %d...\n", (int)in_count);
    printf("main: before compress %d...\n", (int)in_count);
    while (in_count < BYTES_TO_COMPRESS) {
    while (in_count < BYTES_TO_COMPRESS) {
        c = in_count % 255;
        c = in_count % 255;
 
 
        PRINTF("main: compressing %d...\n", (int)in_count);
        printf("main: compressing %d...\n", (int)in_count);
        in_count++;
        in_count++;
        fcode = (long) (((long) c << maxbits) + ent);
        fcode = (long) (((long) c << maxbits) + ent);
        i = (((long)c << hshift) ^ ent);        /* xor hashing */
        i = (((long)c << hshift) ^ ent);        /* xor hashing */
 
 
        if ( htabof (i) == fcode ) {
        if ( htabof (i) == fcode ) {
Line 327... Line 327...
            cl_block ();
            cl_block ();
    }
    }
    /*
    /*
     * Put out the final code.
     * Put out the final code.
     */
     */
    PRINTF("main: output...\n");
    printf("main: output...\n");
    output( (code_int)ent );
    output( (code_int)ent );
    out_count++;
    out_count++;
    output( (code_int)-1 );
    output( (code_int)-1 );
 
 
    if(bytes_out > in_count)    /* exit(2) if no savings */
    if(bytes_out > in_count)    /* exit(2) if no savings */
        exit_stat = 2;
        exit_stat = 2;
    PRINTF("main: end...\n");
    printf("main: end...\n");
    report (0xdeaddead);
    report (0xdeaddead);
    return 0;
    return 0;
}
}
 
 
/*****************************************************************
/*****************************************************************

powered by: WebSVN 2.1.0

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