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 110

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
  // Parse the standard input
17
  while(!feof(stdin)) {
18
 
19
    // Read one line
20
    fgets(line, 200, stdin);
21
    right = strchr(line, ':');
22
    if(right!=NULL) {
23
      printf("%c%c%c%c%c%c%c%c",
24
        right[OFFSET], right[OFFSET+1], right[OFFSET+3], right[OFFSET+4],
25
        right[OFFSET+6], right[OFFSET+7], right[OFFSET+9], right[OFFSET+10] );
26
 
27
      // Read another line
28
      fgets(line, 200, stdin);
29
      right = strchr(line, ':');
30
      if(right!=NULL)
31
        printf("%c%c%c%c%c%c%c%c\n",
32
          right[OFFSET], right[OFFSET+1], right[OFFSET+3], right[OFFSET+4],
33
          right[OFFSET+6], right[OFFSET+7], right[OFFSET+9], right[OFFSET+10] );
34
      else
35
        printf("01000000\n");
36
    }
37
  }
38
}
39
 

powered by: WebSVN 2.1.0

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