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

Subversion Repositories or1200_soc

[/] [or1200_soc/] [trunk/] [sw/] [perl/] [bin2mif.pl] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 qaztronic
#!/usr/bin/perl
2
# 
3
 
4
use Getopt::Std;
5
 
6
getopt( 'fwd' );
7
 
8
open( BIN_FILE, $opt_f ) or die "Can't open $opt_f!!!\n";
9
 
10
 
11
if( $opt_w  ) {
12
  print "WIDTH=$opt_w;\n";
13
}
14
else  {
15
  print "WIDTH=32;\n";
16
}
17
 
18
if( $opt_d  ) {
19
  print("DEPTH=$opt_d;\n");
20
}
21
else  {
22
  print("DEPTH=2048;\n");
23
}
24
 
25
print("CONTENT BEGIN\n");
26
 
27
$x = 0;
28
while ( read( BIN_FILE, $buf, 4 ) ) {
29
  $out = unpack( "H8", $buf);
30
#   print "$out\n";
31
  printf("\t%08x", $x);
32
  print " : $out;\n";
33
  $x++;
34
}
35
 
36
print("END;\n");

powered by: WebSVN 2.1.0

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