use Storable;
my $openocd_remote = shift @ARGV || 'picam:4444';
+my $bsdl_file = $ENV{BSDL} || '_3128at100.bsd';
+my $BOUNDARY_LENGTH = 288;
my $bit2pin;
my $io2bit;
$|=1; # flush stdout
-open(my $bsdl, '<', '_3128at100.bsd');
+open(my $bsdl, '<', $bsdl_file);
while(<$bsdl>) {
if ( m/PIN_MAP_STRING/ ) {
$pin_map .= $_;
} elsif ( m/"(\d+)\s+\(BC_\d+,\s+(\S+),\s+(\S+)/ ) {
$bit2pin->{$1} = [ $2, $3 ];
push @{ $io2bit->{$2} }, $1;
+ } 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";
}
+
}
close($bsdl);
# first sample
print $sock "irscan x300.tap 0x55\n"; # SAMPLE/PRELOAD
-print $sock "drscan x300.tap 288 0\n";
+print $sock "drscan x300.tap $BOUNDARY_LENGTH 0\n";
while(1) {
if ( $o[$i] eq $n[$i] ) {
$o[$i]='.';
} else {
- my $pin = $bit2pin->{ 288 - ($i * 3) - 3 }->[0];
+ my $pin = $bit2pin->{ $BOUNDARY_LENGTH - ($i * 3) - 3 }->[0];
$o[$i] = " $pin:" . $o[$i] . '>' . $n[$i];
}
}
;
- } elsif ( $what eq 'o' && $p < 288 ) {
+ } elsif ( $what eq 'o' && $p < $BOUNDARY_LENGTH ) {
my $o = $p;
#$b = substr($old_bsr,0,$o) . reverse $v . substr($old_bsr,$o+length($v));
$b = ( "0" x $o ) . reverse $v . ( "0" x ( length($old_bsr) - $o - length($v) ) );
diff_bits( $BSR, $b ), $/;
# print $sock "irscan x300.tap 0x55\n"; # SAMPLE/PRELOAD
- print $sock "drscan x300.tap 288 0x", bin2hex($b), "\n";
+ print $sock "drscan x300.tap $BOUNDARY_LENGTH 0x", bin2hex($b), "\n";
print $sock "irscan x300.tap 0x00\n"; # EXTEST
-# print $sock "drscan x300.tap 288 0x", bin2hex($b), "\n";
+# print $sock "drscan x300.tap $BOUNDARY_LENGTH 0x", bin2hex($b), "\n";
} elsif ( $cmd =~ m/\?/ ) {
$last_bits = '';
print $sock "irscan x300.tap 0x55\n"; # SAMPLE/PRELOAD
- print $sock "drscan x300.tap 288 0\n";
+ print $sock "drscan x300.tap $BOUNDARY_LENGTH 0\n";
} else {
print $sock "irscan x300.tap 0x55\n"; # SAMPLE/PRELOAD
- print $sock "drscan x300.tap 288 0\n";
+ print $sock "drscan x300.tap $BOUNDARY_LENGTH 0\n";
}