chiark / gitweb /
invert bit sense of moveable feature bits
authorian <ian>
Fri, 22 Oct 2004 14:40:49 +0000 (14:40 +0000)
committerian <ian>
Fri, 22 Oct 2004 14:40:49 +0000 (14:40 +0000)
layout/segcmapassign

index 1ab90301db815cd5f9bd16a31d1d1a58a6a936b0..ef5712ae64278a2c3dc8b9daf0bad9e894b7f039 100755 (executable)
@@ -34,8 +34,8 @@
 #     6 bits moveable feature and position
 #          each moveable feature has an unambiguous prefix
 #          the remainder of the bits are the position of that feature
-#       the feature all-bits-1 (0b111111) is for fixed track
-#       (so every moveable feature prefix must contain at least one 0)
+#       the feature all-bits-0 (0b000000) is for fixed track
+#       (so every moveable feature prefix must contain at least one 1)
 #     BUT all of the bits are in the reverse order (so the
 #     MSbit of GREEN is the LSbit of the moveable feature position)
 #
@@ -98,17 +98,17 @@ sub cssnmap ($$$$) {
        
 our ($segnum) = 1;
 
-our ($conf,$posbit,$posbiti,$nextfree);
+our ($conf,$posbit,$posbiti,$abovenext);
 
 foreach $seg (sort keys %seg) {
     $si= $seg{$seg};
     $si->{Num}= $segnum++;
     die if $si->{Num} >= 1024;
-    $nextfree= 0;
+    $abovenext= 0x40;
     printf("S %s 0x%x\n",
           $seg, $si->{Num})
        or die $!;
-    cssnmap($seg,'', $si->{Num}, 0x3f);
+    cssnmap($seg,'', $si->{Num}, 0x00);
     foreach $movfeat (sort {
        $si->{Feat}{$b}{Max} <=> $si->{Feat}{$a}{Max};
     } keys %{ $si->{Feat} }) {
@@ -116,10 +116,11 @@ foreach $seg (sort keys %seg) {
        for ($posbit=1,$posbiti=0;
             $posbit<=$fi->{Max};
             $posbit<<=1,$posbiti++) { }
-       $fi->{Prefix}= $nextfree;
+       $abovenext -= $posbit;
+       die "too many $seg" if $abovenext <= 0;
+       $fi->{Prefix}= $abovenext;
        $fi->{ConfigMask}= $posbit-1;
        $fi->{ConfigBits}= $posbiti;
-       $nextfree += $posbit;
         printf("F %s 0x%x %s 0x%x %d 0x%x\n",
               $seg, $si->{Num},
               $movfeat, $fi->{Prefix}, $fi->{ConfigBits}, $fi->{Max});
@@ -127,7 +128,6 @@ foreach $seg (sort keys %seg) {
            cssnmap($seg, $movfeat.$conf, $si->{Num}, $fi->{Prefix}+$conf);
        }
     }
-    die "too many $seg" if $nextfree > 0x03f;
 }
 
 STDIN->error and die $!;