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

Subversion Repositories plasma

[/] [plasma/] [trunk/] [tools/] [bintohex.c] - Diff between revs 134 and 336

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

Rev 134 Rev 336
Line 1... Line 1...
/*bintohex by Steve Rhoads 5/29/02*/
/*bintohex by Steve Rhoads 5/29/02*/
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <string.h>
 
#include <stdlib.h>
 
 
#define BUF_SIZE (1024*1024)
#define BUF_SIZE (1024*1024)
 
 
int main(int argc, char *argv[])
int main(int argc, char *argv[])
{
{
Line 40... Line 41...
      filename[4] = '0' + i;
      filename[4] = '0' + i;
      file = fopen(filename, "wb");
      file = fopen(filename, "wb");
      for(j = 0; i + j * 4 * 16 < mem_size; ++j)
      for(j = 0; i + j * 4 * 16 < mem_size; ++j)
      {
      {
         k = j * 16;
         k = j * 16;
         fprintf(file, ":10%4.4x00", k);
         fprintf(file, ":10%4.4x00", (int)k);
         sum = 0x10 + (k >> 8) + (k & 0xff);
         sum = 0x10 + (k >> 8) + (k & 0xff);
         for(k = 0; k < 16; ++k)
         for(k = 0; k < 16; ++k)
         {
         {
            fprintf(file, "%2.2x", buf[i + j * 4 * 16 + k * 4]);
            fprintf(file, "%2.2x", buf[i + j * 4 * 16 + k * 4]);
            sum += buf[i + j * 4 * 16 + k * 4];
            sum += buf[i + j * 4 * 16 + k * 4];
         }
         }
         sum &= 0xff;
         sum &= 0xff;
         sum = 0x100 - sum;
         sum = 0x100 - sum;
         sum &= 0xff;
         sum &= 0xff;
         fprintf(file, "%2.2x\n", sum);
         fprintf(file, "%2.2x\n", (int)sum);
      }
      }
      fprintf(file, ":00000001ff\n");
      fprintf(file, ":00000001ff\n");
      fclose(file);
      fclose(file);
   }
   }
   free(buf);
   free(buf);

powered by: WebSVN 2.1.0

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