use entity name from bsdl file to name pin dump
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 12 Jun 2016 20:50:00 +0000 (22:50 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 12 Jun 2016 20:50:00 +0000 (22:50 +0200)
openocd-jtag-boundary-scan.pl

index 1e381e7..aa4ea26 100755 (executable)
@@ -10,6 +10,7 @@ use Storable;
 my $openocd_remote = shift @ARGV || 'picam:4444';
 my $bsdl_file = $ENV{BSDL} || '_3128at100.bsd';
 my $BOUNDARY_LENGTH = 288;
+my $entity;
 
 my $bit2pin;
 my $io2bit;
@@ -35,6 +36,9 @@ while(<$bsdl>) {
        } elsif ( m/attribute\s+BOUNDARY_LENGTH\s+of\s+\S+\s*:\s*entity\s+is\s+(\d+);/ ) {
                $BOUNDARY_LENGTH = $1;
                warn "# BSDL $bsdl_file BOUNDARY_LENGTH = $BOUNDARY_LENGTH\n";
+       } elsif ( ! $entity && m/^entity\s(\S+)\s+is/ ) {
+               $entity = $1;
+               warn "# entity = $entity\n";
        }
 
 }
@@ -63,7 +67,8 @@ foreach my $map ( split(/\s*,\s*/, $pin_map) ) {
 }
 
 warn "# pin2io = ",dump( $pin2io );
-store \$pin2io, '/dev/shm/pin2io.storable';
+#store \$pin2io, $bsdl_file . '.pin2io.storable';
+store \$pin2io, $entity . '.pin2io.storable';
 
 my @sort = sort {
        my $aa = $a; $aa =~ s/\D+//g;