add convenience constructor MarinaPacket(BitVector,boolean)
authorAdam Megacz <adam.megacz@sun.com>
Tue, 24 Mar 2009 18:29:08 +0000 (18:29 +0000)
committerAdam Megacz <adam.megacz@sun.com>
Tue, 24 Mar 2009 18:29:08 +0000 (18:29 +0000)
testCode/com/sun/vlsi/chips/marina/test/MarinaPacket.java

index ecc531f..217dc7e 100644 (file)
@@ -23,6 +23,11 @@ public class MarinaPacket {
     public final boolean tokenhood;
     public final BitVector path;
 
+    private static final BitVector null_path = new BitVector(PATH_WIDTH, "null_path");
+    static {
+        null_path.set(0, PATH_WIDTH, false);
+    }
+
     /** "parse" a token from the raw bits in the north proper stopper */
     public MarinaPacket(BitVector singleBitVector) {
         MarinaUtils.expectLength(singleBitVector,PACKET_WIDTH);
@@ -42,6 +47,11 @@ public class MarinaPacket {
         this.path = path;
     }
 
+    /** another constructor which uses an all-zeroes path, for convenience */
+    public MarinaPacket(BitVector data, boolean tokenhood) {
+        this(data, tokenhood, null_path);
+    }
+
     /** convert a packet into a single BitVector, suitable for insertion in the north proper stopper */
     public BitVector toSingleBitVector() {
         BitVector bv = new BitVector(PACKET_WIDTH, "marina packet");