X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;ds=sidebyside;f=openocd-jtag-boundary-scan.pl;h=3634bbefefc4d49dc495f0a2cc0fd840be169384;hb=765a058664f296289fe3358b3f2ed36e8da97446;hp=4e3632c85d05e687f2f6a7b9e53fb9bb90cb5506;hpb=67bd6d94f1893ab701c40567385832aa81814b1e;p=x300-pci diff --git a/openocd-jtag-boundary-scan.pl b/openocd-jtag-boundary-scan.pl index 4e3632c..3634bbe 100755 --- a/openocd-jtag-boundary-scan.pl +++ b/openocd-jtag-boundary-scan.pl @@ -251,19 +251,22 @@ while (<$sock>) { sub diff_bits { my ($old, $new) = @_; + $old = reverse $old; # extra bits must be on the end + $new = reverse $new; $old =~ s/(...)/$1 /g; $new =~ s/(...)/$1 /g; my @o = split(/ /, $old); my @n = split(/ /, $new); - foreach my $i ( 0 .. $#o ) { + my $bsr_max_bit = $BOUNDARY_LENGTH / 3 - 1; + foreach my $i ( 0 .. $bsr_max_bit ) { if ( $o[$i] eq $n[$i] ) { $o[$i]='.'; } else { - my $pin = $bit2pin->{ $BOUNDARY_LENGTH - ($i * 3) - 3 }->[0]; + my $pin = $bit2pin->{ $i * 3 }->[0]; $o[$i] = " $pin@" . ( $i * 3 ) . ":" . $o[$i] . '>' . $n[$i]; } } - my $diff = join('', @o); + my $diff = join('', @o[ 0 .. $bsr_max_bit ]); print "# diff_bits $diff\n"; }