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

Subversion Repositories mcip_open

[/] [mcip_open/] [trunk/] [HEXtoVHDLformat_Converter/] [CONVERT.CPP] - Rev 5

Compare with Previous | Blame | View Log


#include <stdio.h>
#include <conio.h>


void main()
{
  FILE *ROM,*VHDL;
  char c;
  int i,j;

  ROM=fopen("app.hex","r");
  VHDL=fopen("prog.hdl","w");
        fprintf(VHDL,"(");
        while (feof(ROM)==0)
     {
         fprintf(VHDL,"\n");
         for (i=1;i<=9;i++) getc(ROM);
         for (i=1;i<=16;i++)
         {
           fprintf(VHDL,"X\"");
           for (j=0;j<2;j++)
             {c=getc(ROM);
             putc(c,VHDL);
             }
           fprintf(VHDL,"\",");
          }
          for (i=1;i<=3;i++) getc(ROM);
      }
  fprintf(VHDL,"\nothers => X\"FF\" );");
  fclose(ROM);
  fclose(VHDL);
}

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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