From: adam Date: Sat, 25 Aug 2007 09:46:08 +0000 (+0100) Subject: add pump-local literals and convert Alu1 test case X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=31f6096ddd1a69ce1c670ab02f8a35674afcfabc;p=fleet.git add pump-local literals and convert Alu1 test case --- diff --git a/ships/Alu1.ship b/ships/Alu1.ship index 4ef057a..5eb32fd 100644 --- a/ships/Alu1.ship +++ b/ships/Alu1.ship @@ -85,26 +85,22 @@ ABS: #ship alu1 : Alu1 debug.in: [*] take, deliver; -9: sendto alu1.in; -9: sendto alu1.in; -9: sendto alu1.in; -9: sendto alu1.in; +alu1.in: + literal 9; + [4] deliver; + [*] take, deliver; -1: sendto alu1.inOp; -2: sendto alu1.inOp; -3: sendto alu1.inOp; -0: sendto alu1.inOp; -0: sendto alu1.inOp; - -alu1.in: [*] take, deliver; -alu1.inOp: [*] take, deliver; alu1.out: - [3] take, sendto debug.in; - take; - sendto debug.in; + [4] take, sendto debug.in; sendto alu1.in; [*] take, sendto debug.in; +alu1.inOp: + literal 1; deliver; + literal 2; deliver; + literal 3; deliver; + literal 0; [2] deliver; + == Contributors ========================================================= Adam Megacz diff --git a/src/edu/berkeley/fleet/api/Instruction.java b/src/edu/berkeley/fleet/api/Instruction.java index a32b8d0..8ca41b7 100644 --- a/src/edu/berkeley/fleet/api/Instruction.java +++ b/src/edu/berkeley/fleet/api/Instruction.java @@ -98,6 +98,15 @@ public abstract class Instruction { } + public static class LocalLiteral extends Instruction { + public final Pump pump; + public final long literal; + public LocalLiteral(Pump pump, long literal) { + this.pump = pump; + this.literal = literal; + } + } + public static class Literal extends Instruction { public final Destination dest; protected Literal(Destination dest) { this.dest = dest; } diff --git a/src/edu/berkeley/fleet/assembler/Parser.java b/src/edu/berkeley/fleet/assembler/Parser.java index c649529..fbca63d 100644 --- a/src/edu/berkeley/fleet/assembler/Parser.java +++ b/src/edu/berkeley/fleet/assembler/Parser.java @@ -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