update to 03-Jan-2009 am33: head, abort, and d-flag
[fleet.git] / src / edu / berkeley / fleet / assembler / Parser.java
index 3a1fdbd..6adb24c 100644 (file)
@@ -106,7 +106,7 @@ public class Parser {
                     long lit = 0;
                     lit = ((FleetTwoFleet)fleet).CBD_SIZE.setval(lit, codeBags.get((int)old.immediate).size());
                     lit = ((FleetTwoFleet)fleet).CBD_OFFSET.setval(lit, codeBagMap[(int)old.immediate]);
-                    inst = new Set(old.dock, false, IgnoreOLC, SetDest.DataLatch, lit);
+                    inst = new Set(old.dock, false, IgnoreFlagD, SetDest.DataLatch, lit);
                 }
                 ret.add(inst);
                 count++;
@@ -154,15 +154,15 @@ public class Parser {
         for(int i=0; i<instructions.length; i++) {
             long lit = ((FleetTwoFleet)fpga).writeInstruction(instructions[i], out);
             ret.add(discard(out));
-            ret.add(new Instruction.Shift(inDataWrite, false, IgnoreOLC, new BitVector(fpga.getShiftWidth()).set(getField(36, 19, lit))));
-            ret.add(new Instruction.Shift(inDataWrite, false, IgnoreOLC, new BitVector(fpga.getShiftWidth()).set(getField(18,  0, lit))));
+            ret.add(new Instruction.Shift(inDataWrite, false, IgnoreFlagD, new BitVector(fpga.getShiftWidth()).set(getField(36, 19, lit))));
+            ret.add(new Instruction.Shift(inDataWrite, false, IgnoreFlagD, new BitVector(fpga.getShiftWidth()).set(getField(18,  0, lit))));
             ret.add(deliver(inDataWrite));
-            ret.add(new Instruction.Shift(inAddrWrite, false, IgnoreOLC, new BitVector(fpga.getShiftWidth()).set(getField(36, 19, i))));
-            ret.add(new Instruction.Shift(inAddrWrite, false, IgnoreOLC, new BitVector(fpga.getShiftWidth()).set(getField(18,  0, i))));
+            ret.add(new Instruction.Shift(inAddrWrite, false, IgnoreFlagD, new BitVector(fpga.getShiftWidth()).set(getField(36, 19, i))));
+            ret.add(new Instruction.Shift(inAddrWrite, false, IgnoreFlagD, new BitVector(fpga.getShiftWidth()).set(getField(18,  0, i))));
             ret.add(deliver(inAddrWrite));
         }
-        ret.add(new Instruction.Shift(inCBD, false, IgnoreOLC, new BitVector(fpga.getShiftWidth()).set(getField(36, 19, startcbd))));
-        ret.add(new Instruction.Shift(inCBD, false, IgnoreOLC, new BitVector(fpga.getShiftWidth()).set(getField(18,  0, startcbd))));
+        ret.add(new Instruction.Shift(inCBD, false, IgnoreFlagD, new BitVector(fpga.getShiftWidth()).set(getField(36, 19, startcbd))));
+        ret.add(new Instruction.Shift(inCBD, false, IgnoreFlagD, new BitVector(fpga.getShiftWidth()).set(getField(18,  0, startcbd))));
         ret.add(wait(inCBD));
         ret.add(deliver(inCBD));
         ret.add(sendto(out, out.getPath(inCBD.getDataDestination(),null)));
@@ -175,8 +175,8 @@ public class Parser {
             int num = Math.min(count, MAX_ILC);
             num_instrs+=2;
             count -= num;
-            ret.add(new Instruction.Set(ihorn, false, IgnoreOLC, SetDest.InnerLoopCounter, num));
-            ret.add(new Instruction.Move(ihorn, false, IgnoreOLC, false, null,false,true,true,true,true,false));
+            ret.add(new Instruction.Set(ihorn, false, IgnoreFlagD, SetDest.InnerLoopCounter, num));
+            ret.add(new Instruction.Move(ihorn, false, IgnoreFlagD, false, null,false,true,true,true,true,false));
         }
         if (num_instrs > ihorn.getInstructionFifoSize()) throw new RuntimeException();
 
@@ -363,6 +363,9 @@ public class Parser {
                 if ("tail".equals(tt.head()))    {
                     cb.add(new Tail(dock));
                     continue;
+                } else if ("head".equals(tt.head()))    {
+                    cb.add(new Head(dock));
+                    continue;
                 }
 
                 int count = 1;
@@ -377,15 +380,12 @@ public class Parser {
                     if ("[!a]".equals(ttt.head())) predicate = NotFlagA;
                     if ("[!b]".equals(ttt.head())) predicate = NotFlagB;
                     if ("[!c]".equals(ttt.head())) predicate = NotFlagC;
-                    if ("[*]".equals(ttt.head()))  predicate = IgnoreOLC;
-                    if ("[olc=0]".equals(ttt.head()))  predicate = OLCZero;
+                    if ("[*]".equals(ttt.head()))  predicate = IgnoreFlagD;
+                    if ("[d]".equals(ttt.head()))  predicate = FlagD;
                     if ("[Rq]".equals(ttt.head()))  looping = true;
                 }
                 tt = tt.child(1);
-                if ("tail".equals(tt.head()))    {
-                    cb.add(new Tail(dock));
-                    continue;
-                } else if ("flags".equals(tt.head()))    {
+                if ("flags".equals(tt.head()))    {
                     cb.add(new Set(dock, looping, predicate, parseFlags(tt.child(0)), parseFlags(tt.child(1))));
                     continue;
                 } else if ("olc=word".equals(tt.head()))    {
@@ -416,6 +416,9 @@ public class Parser {
                 } else if ("flush".equals(tt.head())) {
                     cb.add(new Flush(dock, looping, predicate));
                     continue;
+                } else if ("abort".equals(tt.head())) {
+                    cb.add(new Abort(dock, predicate));
+                    continue;
                 } else if ("word".equals(tt.head())) {
                     long literal = 0;
                     if (tt.child(0).head().equals("CodeBagBody")) {
@@ -582,8 +585,8 @@ public class Parser {
         public Ship createShip(String shiptype, String shipname);
     }
 
-    private static Move discard(Dock dock)           { return new Move(dock, false, IgnoreOLC, false, null, false, true,  false, false, false, false); }
-    private static Move deliver(Dock dock)           { return new Move(dock, false, IgnoreOLC, false, null, false, false, false, false, true,  false); }
-    private static Move wait(Dock dock)              { return new Move(dock, false, IgnoreOLC, false, null, true,  false, false, false, false, false); }
-    private static Move sendto(Dock dock, Path path) { return new Move(dock, false, IgnoreOLC, false, path, false, false, false, false, true,  false); }
+    private static Move discard(Dock dock)           { return new Move(dock, false, IgnoreFlagD, false, null, false, true,  false, false, false, false); }
+    private static Move deliver(Dock dock)           { return new Move(dock, false, IgnoreFlagD, false, null, false, false, false, false, true,  false); }
+    private static Move wait(Dock dock)              { return new Move(dock, false, IgnoreFlagD, false, null, true,  false, false, false, false, false); }
+    private static Move sendto(Dock dock, Path path) { return new Move(dock, false, IgnoreFlagD, false, path, false, false, false, false, true,  false); }
 }