OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

[/] [an-fpga-implementation-of-low-latency-noc-based-mpsoc/] [trunk/] [mpsoc/] [src_c/] [ihex2mif/] [main.c] - Diff between revs 25 and 45

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

Rev 25 Rev 45
Line 3... Line 3...
#include "ihex.c"
#include "ihex.c"
#include <unistd.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdlib.h>
 
 
#define DEFAULT_OUT_FILE_NAME           "out.mif"
#define DEFAULT_OUT_FILE_NAME           "out.mif"
#define DEAFULT_END_SIZE                "1FFF"
 
 
 
int     memory[MAX_MEMORY_SIZE+1];              /* the memory is global */
int     memory[MAX_MEMORY_SIZE+1];              /* the memory is global */
unsigned int    end_addr_int;
unsigned int    end_addr_int;
FILE * in, * out;
FILE * in, * out;
char *file_name, *end_addr, *out_file_name ;
char *file_name, *end_addr, *out_file_name ;
 
void update_out_file(void);
 
 
void usage (void)
void usage (void)
{
{
        printf("Usage: ./ihex2mif  <options>  \n");
        printf("Usage: ./ihex2mif  <options>  \n");
        printf("\nOptions: \n");
        printf("\nOptions: \n");
Line 54... Line 55...
                        exit(1);
                        exit(1);
            }
            }
      }
      }
}
}
 
 
void update_out_file(void);
 
int main ( int argc, char **argv ){
 
 
 
 
int main ( int argc, char **argv ){
 
        int maxaddr;
        processArgs (argc,argv );
        processArgs (argc,argv );
        if (file_name == NULL) {usage();exit(1);}
        if (file_name == NULL) {usage();exit(1);}
        if (end_addr  == NULL) end_addr = DEAFULT_END_SIZE;
 
        if (out_file_name == NULL) out_file_name = DEFAULT_OUT_FILE_NAME;
        if (out_file_name == NULL) out_file_name = DEFAULT_OUT_FILE_NAME;
        //printf("filename=%s & size=%s\n",file_name, end_addr);
 
        sscanf(end_addr, "%x", &end_addr_int);
 
        //printf("%u\n", end_addr_int);
 
        out=fopen(out_file_name,"wb");
        out=fopen(out_file_name,"wb");
        if(out==NULL){printf("Output file cannot be created"); exit(1);}
        if(out==NULL){printf("Output file cannot be created"); exit(1);}
        load_file(file_name);
        maxaddr=load_file(file_name);
 
        if (end_addr  != NULL) sscanf(end_addr, "%x", &end_addr_int);
 
        else end_addr_int = maxaddr;
 
 
 
 
        update_out_file();
        update_out_file();
 
 
 
 
        fclose(out);
        fclose(out);
 
 

powered by: WebSVN 2.1.0

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