add pump-local literals and convert Alu1 test case
[fleet.git] / src / edu / berkeley / fleet / assembler / Parser.java
index c649529..fbca63d 100644 (file)
@@ -277,6 +277,8 @@ public class Parser {
                 boolean dataOut = false;
                 boolean tokenOut = false;
                 boolean dataOutDest = false;
+                boolean localLiteral = false;
+                long literal = 0;
                 Destination dest = null;
                 for(int i=0; i<ttx.size(); i++) {
                     Tree ttt = ttx.child(i);
@@ -292,13 +294,17 @@ public class Parser {
                     else if ("Discard".equals(ttt.head())) { dataIn = true; latch = false; }
                     else if ("Take".equals(ttt.head()))    { dataIn = true; latch = true; }
                     else if ("SendTo".equals(ttt.head()))  { dataOut = true; dest = portReference(ttt.child(0)); }
+                    else if ("LocalLiteral".equals(ttt.head()))  { localLiteral = true; literal = Long.parseLong(string(ttt.child(0))); }
                     else if ("DataOutDest".equals(ttt.head()))  { dataOutDest = true; }
                     else if ("Deliver".equals(ttt.head())) { dataOut = true;  }
                     else if ("Ack".equals(ttt.head()))     { tokenOut = true; dest = portReference(ttt.child(0)); }
                 }
-                cb.add(new Instruction.Executable(pump,
-                                                  dest, count, tokenIn, dataIn,
-                                                  latch, dataOutDest, dataOut, tokenOut, requeue));
+                if (localLiteral)
+                    cb.add(new Instruction.LocalLiteral(pump, literal));
+                else
+                    cb.add(new Instruction.Executable(pump,
+                                                      dest, count, tokenIn, dataIn,
+                                                      latch, dataOutDest, dataOut, tokenOut, requeue));
             }
         }
     }