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

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [tools/] [src/] [dump2hex.c] - Blame information for rev 73

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 7 fafa1971
// Convert a dump file (passed on the stdin) into a hex
2
// file to be used to initialize the memory harness.
3
 
4
#include <stdlib.h>
5
#include <stdio.h>
6
#include <string.h>
7
 
8
#define OFFSET 2
9
 
10
int main() {
11
 
12
  // Buffers
13
  char line[200];
14
  char* right;
15
 
16
  // To start from RAM address 0x00000400C0 (see linker.map)
17 73 fafa1971
  //printf("@%X\n", (0xC0>>3));
18 7 fafa1971
 
19
  // Parse the standard input
20
  while(!feof(stdin)) {
21
 
22
    // Read one line
23
    fgets(line, 200, stdin);
24
    right = strchr(line, ':');
25
    if(right!=NULL) {
26
      printf("%c%c%c%c%c%c%c%c",
27
        right[OFFSET], right[OFFSET+1], right[OFFSET+3], right[OFFSET+4],
28
        right[OFFSET+6], right[OFFSET+7], right[OFFSET+9], right[OFFSET+10] );
29
 
30
      // Read another line
31
      fgets(line, 200, stdin);
32
      right = strchr(line, ':');
33
      if(right!=NULL)
34
        printf("%c%c%c%c%c%c%c%c\n",
35
          right[OFFSET], right[OFFSET+1], right[OFFSET+3], right[OFFSET+4],
36
          right[OFFSET+6], right[OFFSET+7], right[OFFSET+9], right[OFFSET+10] );
37
      else
38
        printf("01000000\n");
39
    }
40
  }
41
}
42
 

powered by: WebSVN 2.1.0

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