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/] [ihex.c] - Diff between revs 19 and 25

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

Rev 19 Rev 25
Line 9... Line 9...
 
 
 
 
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <string.h>
#include <stdlib.h>
#include <stdlib.h>
 
#include <ctype.h>
 
 
 
#ifndef MAX_MEMORY_SIZE
 
        #define MAX_MEMORY_SIZE         65535
 
#endif
 
 
/* some ansi prototypes.. maybe ought to make a .h file */
/* some ansi prototypes.. maybe ought to make a .h file */
 
 
/* this loads an intel hex file into the memory[] array */
/* this loads an intel hex file into the memory[] array */
void load_file(char *filename);
void load_file(char *filename);
Line 28... Line 33...
/* to call it with end=1 when finsihed to flush the buffer */
/* to call it with end=1 when finsihed to flush the buffer */
/* and close the file */
/* and close the file */
void hexout(FILE *fhex, int byte, int memory_location, int end);
void hexout(FILE *fhex, int byte, int memory_location, int end);
 
 
 
 
extern int      memory[65536];          /* the memory is global */
extern int      memory[MAX_MEMORY_SIZE+1];              /* the memory is global */
 
 
/* parses a line of intel hex code, stores the data in bytes[] */
/* parses a line of intel hex code, stores the data in bytes[] */
/* and the beginning address in addr, and returns a 1 if the */
/* and the beginning address in addr, and returns a 1 if the */
/* line was valid, or a 0 if an error occured.  The variable */
/* line was valid, or a 0 if an error occured.  The variable */
/* num gets the number of bytes that were stored into bytes[] */
/* num gets the number of bytes that were stored into bytes[] */
Line 143... Line 148...
                printf("   Invalid addresses or filename,\n");
                printf("   Invalid addresses or filename,\n");
                printf("    usage: S begin_addr end_addr filename\n");
                printf("    usage: S begin_addr end_addr filename\n");
                printf("    the addresses must be hexidecimal format\n");
                printf("    the addresses must be hexidecimal format\n");
                return;
                return;
        }
        }
        begin &= 65535;
        begin &= MAX_MEMORY_SIZE;
        end &= 65535;
        end &= MAX_MEMORY_SIZE;
        if (begin > end) {
        if (begin > end) {
                printf("   Begin address must be less than end address.\n");
                printf("   Begin address must be less than end address.\n");
                return;
                return;
        }
        }
        fhex = fopen(filename, "w");
        fhex = fopen(filename, "w");

powered by: WebSVN 2.1.0

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