23 die("\n Syntax: ./program_SDRAM input1(memory setup) input2(*\.srec) output\n");
26 open(INFILE1
, "<$ARGV[0]") || die("\ninput1 open fail\n");
27 open(INFILE2
, "<$ARGV[1]") || die("\ninput2 open fail\n");
28 open(OUTFILE
, ">$ARGV[2]") || die("\nOutput file open fail\n");
31 while ($line = <INFILE1
>){
35 printf OUTFILE
("33333333");
39 @array=split(/ +/,$line);
41 while(@array[$j]!~/\w/){
48 printf OUTFILE
("%08x%08x",hex($addr),hex($regval));
52 printf OUTFILE
("\n");
58 while($i lt 8 && $i gt 0){
59 printf OUTFILE
"00"x8
;
64 printf OUTFILE
("\n");
67 while($aline=<INFILE2
>){
70 next if(($aline=~/^S0/) || ($aline=~/^S7/));
71 ($lineid, $length, $address, @bytes) = unpack"A2A2A8"."A2"x300
, $aline;
72 $length = hex($length);
73 $address = hex($address);
79 $addstr = sprintf("%x", $address);
80 $addstr = "0"x
(8-length($addstr)).$addstr;
81 print OUTFILE
$addstr;
84 $currentaddr=$address;
89 $addstr = sprintf("%x", $currentaddr);
90 $addstr = "0"x
(8-length($addstr)).$addstr;
91 print OUTFILE
$addstr;
95 #printf("*** %x != %x\n", $address, $currentaddr) if $address != $currentaddr;
97 if($currentaddr < $address) {
105 $bytes[$i]=~tr/ABCDEF/abcdef/;
106 print OUTFILE
"$bytes[$i]";
107 addchsum
($bytes[$i]);
123 for($i=0;$i<(64-$count);$i++){
132 print OUTFILE
"11"x4
;
134 $chsum=$chsum & 0xffffffff;
135 $chsum = sprintf("%X", $chsum);
136 $chsum = "0"x
(8-length($chsum)).$chsum;
137 $chsum =~tr/ABCDEF/abcdef/;
138 print OUTFILE
$chsum;
139 print OUTFILE
"00"x60
;
143 print OUTFILE
"99"x4
;
144 print OUTFILE
$loadaddr;
145 print OUTFILE
"00"x60
;
158 if(length($holder)==8){
159 $holder = hex($holder);
This page took 0.057913 seconds and 5 git commands to generate.