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
Compare Revisions
- This comparison shows the changes necessary to convert path
/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk/mpsoc/src_c/ihex2mif
- from Rev 34 to Rev 45
- ↔ Reverse comparison
Rev 34 → Rev 45
/ihex.c
20,7 → 20,7
/* some ansi prototypes.. maybe ought to make a .h file */ |
|
/* this loads an intel hex file into the memory[] array */ |
void load_file(char *filename); |
int load_file(char *filename); |
|
/* this writes a part of memory[] to an intel hex file */ |
void save_file(char *command); |
77,7 → 77,7
/* loads an intel hex file into the global memory[] array */ |
/* filename is a string of the file to be opened */ |
|
void load_file(filename) |
int load_file(filename) |
char *filename; |
{ |
char line[1000]; |
89,7 → 89,7
if (strlen(filename) == 0) { |
printf(" Can't load a file without the filename."); |
printf(" '?' for help\n"); |
return; |
return 0; |
} |
fin = fopen(filename, "r"); |
if (fin == NULL) { |
116,7 → 116,8
fclose(fin); |
printf(" Loaded %d bytes between:", total); |
printf(" %04X to %04X\n", minaddr, maxaddr); |
return; |
|
return maxaddr; |
} |
if (status == 2) ; /* begin of file */ |
} else { |
124,6 → 125,7
} |
lineno++; |
} |
return maxaddr;//it should not reach here |
} |
|
|
/main.c
5,12 → 5,13
#include <stdlib.h> |
|
#define DEFAULT_OUT_FILE_NAME "out.mif" |
#define DEAFULT_END_SIZE "1FFF" |
|
|
int memory[MAX_MEMORY_SIZE+1]; /* the memory is global */ |
unsigned int end_addr_int; |
FILE * in, * out; |
char *file_name, *end_addr, *out_file_name ; |
void update_out_file(void); |
|
void usage (void) |
{ |
56,19 → 57,22
} |
} |
|
void update_out_file(void); |
|
int main ( int argc, char **argv ){ |
|
int maxaddr; |
processArgs (argc,argv ); |
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; |
//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"); |
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(); |
|
|