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

Subversion Repositories or1200_soc

[/] [or1200_soc/] [trunk/] [sw/] [perl/] [bin2readmemh.pl] - Diff between revs 2 and 15

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

Rev 2 Rev 15
Line 6... Line 6...
 
 
getopt( 'fsdx' );
getopt( 'fsdx' );
 
 
open( BIN_FILE, $opt_f ) or die "Can't open $opt_f!!!\n";
open( BIN_FILE, $opt_f ) or die "Can't open $opt_f!!!\n";
 
 
 
if( $opt_x ) {
 
  if( $opt_d ) {
 
    print "Creating Xilinx image with memory depth $opt_d.";
 
  } else {
 
    die "Memory depth not inputted. Use -d option!!!\n";
 
  }
 
} else {
 
  print "Creating Altera image.";
 
}
 
 
$memory_address = 0;
$memory_address = 0;
 
 
if( $opt_s == 32 ) {
if( $opt_s == 32 ) {
  while ( read( BIN_FILE, $buf, 4 ) ) {
  while ( read( BIN_FILE, $buf, 4 ) ) {
    $out = unpack( "H8", $buf);
    $out = unpack( "H8", $buf);
Line 59... Line 69...
        }
        }
}
}
 
 
 
 
 
 
# if( $opt_s == 32 ) {
 
#   for ( $memory_depth = $opt_d - 1 ;$memory_depth > $memory_address; $memory_address++ ) {
 
#     
 
#     printf( "\@%08x\n", $memory_address );
 
#     print "0\n\n";
 
#   }
 
# } elsif( $opt_s == 16 ) {
 
#   while ( read( BIN_FILE, $buf, 2 ) ) {
 
#     $out = unpack( "H4", $buf);
 
#     
 
#     printf( "\@%08x\n", $memory_address );
 
#     print "$out\n\n";
 
#     
 
#     $memory_address++;
 
#   }
 
# } elsif( $opt_s == 8 ) {
 
#   while ( read( BIN_FILE, $buf, 1 ) ) {
 
#     $out = unpack( "H2", $buf);
 
#     
 
#     printf( "\@%08x\n", $memory_address );
 
#     print "$out\n\n";
 
#     
 
#     $memory_address++;
 
#   }
 
# } else {
 
#     print "ERROR! $opt_s is invalad option for -s\n";
 
# }
 
 
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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