From: adam Date: Mon, 12 Feb 2007 11:55:07 +0000 (+0100) Subject: update everything to naming conventions agreed upon in class last week X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=546aa1df21781684fc2407504d41b58b1e887dd4;p=fleet.git update everything to naming conventions agreed upon in class last week --- diff --git a/contrib/dcache-demo.fleet b/contrib/dcache-demo.fleet deleted file mode 100644 index cdaf598..0000000 --- a/contrib/dcache-demo.fleet +++ /dev/null @@ -1,42 +0,0 @@ - -// ships required in order to run this code -#ship debug : Debug -#ship dscratch : Dscratch -#ship fifo : Fifo - -// dumb configurations -debug.data: [*] take, deliver; -dscratch.write_addr: [*] take, deliver; -dscratch.write_data: [*] take, deliver; -dscratch.read_addr: [*] take, deliver; -fifo.in: [*] take, deliver; - -// addresses and values to initialize the dscratch with -1: sendto dscratch.write_addr; -2: sendto dscratch.write_addr; -3: sendto dscratch.write_addr; -4: sendto dscratch.write_addr; -11: sendto dscratch.write_data; -12: sendto dscratch.write_data; -13: sendto dscratch.write_data; -14: sendto dscratch.write_data; - -// send write-completion tokens to the fifo output -dscratch.write_done: - [*] take, sendto fifo.out; - -// when the write-completion tokens accumulate, unleash -// the read addresses -fifo.out: - [4] wait; - [4] take, sendto dscratch.read_addr; - -// read addresses -4: sendto fifo.in; -3: sendto fifo.in; -2: sendto fifo.in; -1: sendto fifo.in; - -// data read from dscratch goes to the debug ship -dscratch.read_data: - [*] take, sendto debug.data; diff --git a/contrib/demo.fleet b/contrib/demo.fleet index 6c0e50b..8f8c514 100644 --- a/contrib/demo.fleet +++ b/contrib/demo.fleet @@ -1,13 +1,14 @@ -#include "contrib/demo.ships" +#ship debug : Debug +#ship iscratch : Iscratch -BOB: sendto iscratch.cbd; -iscratch.cbd: [*] take, deliver; -debug.data: [*] take, deliver; +BOB: sendto iscratch.inCBD; +iscratch.inCBD: [*] take, deliver; +debug.in: [*] take, deliver; BOB: { - 12: sendto debug.data; - 13: sendto debug.data; - 14: sendto debug.data; - BOB: sendto iscratch.cbd; + 12: sendto debug.in; + 13: sendto debug.in; + 14: sendto debug.in; + BOB: sendto iscratch.inCBD; } diff --git a/contrib/demo.ships b/contrib/demo.ships deleted file mode 100644 index c480842..0000000 --- a/contrib/demo.ships +++ /dev/null @@ -1,34 +0,0 @@ -#ship alu2_bad : Alu2 -#ship alu2 : Alu2 -#ship debug : Debug -#ship execute : Execute -#ship fifo : Fifo -//#ship mem : Mem -#ship icache : Icache - - -// alu1 -// alu2 -// sort2 -// mux -// lut -// dup -// fifo -// shifter -// counter - - -// want: memory, fetch, halt - -//#ship alu1 : Alu1 - - -//#ship alu1 : Alu1 -//#ship dup1 : Dup -//#ship dup2 : Dup -//#ship dup3 : Dup -//#ship dup3 : Dup3 -//#ship demux1 : DeMux -//#ship demux2 : DeMux -//#ship sort : Sort2 - diff --git a/contrib/icache-demo.fleet b/contrib/icache-demo.fleet deleted file mode 100644 index c3f26a3..0000000 --- a/contrib/icache-demo.fleet +++ /dev/null @@ -1,25 +0,0 @@ - -// ships required in order to run this code -#ship debug : Debug -#ship iscratch : Iscratch - -// instructions not in any codebag are part of the "root codebag" -// which is dispatched when the code is loaded - -debug.data: deliver; -BOB: sendto iscratch.cbd; -iscratch.cbd: [*] take, deliver; -debug.data: [*] take, deliver; - - -// This codebag illustrates how to do a loop. Notice that this -// is actually an uncontrolled data emitter -- it could clog the -// switch fabric! - -BOB: { - 12: sendto debug.data; - 13: sendto debug.data; - 14: sendto debug.data; - BOB: sendto iscratch.cbd; -} - diff --git a/contrib/misc.fleet b/contrib/misc.fleet deleted file mode 100644 index 8510634..0000000 --- a/contrib/misc.fleet +++ /dev/null @@ -1,40 +0,0 @@ -//22: sendto debug.data -//22: sendto debug.data -//alu1.out: ack debug.data - - -//22: sendto alu3.b - -// route the "max" output to the demux, and that to either -// the finished-value output (debug.data) or the subtractor -//sort.max: [*] take, sendto demux1.in -// demux1.false: [*] take, sendto debug.data -// demux1.true: [*] take, sendto alu.a -// -//// route the "min" value to the demux selector to decide if we are -//// done; also send copies to the ALU and the secondary sort input -//sort.min: [*] take, sendto dup3.in -// dup3.a: [*] take, sendto demux1.select -// dup3.b: [*] take, sendto alu.b -// dup3.c: [*] take, sendto sort.b -// -//// "plug up" the ALU opcode input with a "1" (subtraction) -//1: sendto alu.op -// alu.op: take [*] accept -// -//// route all data emerging from the ALU back to the primary sort input -//alu.out: [*] take, sendto sort.a -// -//// all other inputs are in default mode -//sort.a: [*] take, accept -//sort.b: [*] take, accept -//alu.a: [*] take, accept -//alu.b: [*] take, accept -//dup3.in: [*] take, accept -//demux1.select: [*] take, accept -//demux1.in: [*] take, accept -// -//// gcd(377,221)=13 (we hope!) -////377: sendto sort.a -////221: sendto sort.b -// diff --git a/ships/Alu2.ship b/ships/Alu2.ship index 607a16e..1c567c9 100644 --- a/ships/Alu2.ship +++ b/ships/Alu2.ship @@ -1,9 +1,9 @@ ship: Alu2 == Ports =========================================================== -data in: a -data in: b -data in: op +data in: in1 +data in: in2 +data in: inOp data out: out @@ -18,13 +18,13 @@ niftycool. == Fleeterpreter ==================================================== public void service() { - if (box_a.dataReadyForShip() && - box_b.dataReadyForShip() && - box_op.dataReadyForShip() && + if (box_in1.dataReadyForShip() && + box_in2.dataReadyForShip() && + box_inOp.dataReadyForShip() && box_out.readyForItemFromShip()) { - int a = box_a.removeDataForShip(); - int b = box_b.removeDataForShip(); - int op = box_op.removeDataForShip(); + int a = box_in1.removeDataForShip(); + int b = box_in2.removeDataForShip(); + int op = box_inOp.removeDataForShip(); switch(op) { case 0: box_out.addDataFromShip(a+b); // ADD break; diff --git a/ships/Debug.ship b/ships/Debug.ship index aaeff49..842059c 100644 --- a/ships/Debug.ship +++ b/ships/Debug.ship @@ -1,7 +1,7 @@ ship: Debug == Ports =========================================================== -data in: data +data in: in == Constants ======================================================== @@ -9,8 +9,8 @@ data in: data == Fleeterpreter ==================================================== public void service() { - if (box_data.dataReadyForShip()) - ((Interpreter)getFleet()).debug(box_data.removeDataForShip()); + if (box_in.dataReadyForShip()) + ((Interpreter)getFleet()).debug(box_in.removeDataForShip()); } == ArchSim ============================================================== diff --git a/ships/Dscratch.ship b/ships/Dscratch.ship index 08c4413..d82de3d 100644 --- a/ships/Dscratch.ship +++ b/ships/Dscratch.ship @@ -1,12 +1,12 @@ ship: Dscratch == Ports =========================================================== -data in: read_addr -data out: read_data +data in: inReadAddr +data out: outReadData -data in: write_addr -data in: write_data -token out: write_done +data in: inWriteAddr +data in: inWriteData +token out: outWriteDone == Fleeterpreter ==================================================== private long[] mem = new long[0]; @@ -21,17 +21,17 @@ token out: write_done } public void service() { - if (box_read_addr.dataReadyForShip() && - box_read_data.readyForItemFromShip()) { - box_read_data.addDataFromShip((int)readMem(box_read_addr.removeDataForShip())); + if (box_inReadAddr.dataReadyForShip() && + box_outReadData.readyForItemFromShip()) { + box_outReadData.addDataFromShip((int)readMem(box_inReadAddr.removeDataForShip())); } - if (box_write_addr.dataReadyForShip() && - box_write_data.dataReadyForShip() && - box_write_done.readyForItemFromShip()) { - writeMem(box_write_addr.removeDataForShip(), - box_write_data.removeDataForShip()); - box_write_done.addTokenFromShip(); + if (box_inWriteAddr.dataReadyForShip() && + box_inWriteData.dataReadyForShip() && + box_outWriteDone.readyForItemFromShip()) { + writeMem(box_inWriteAddr.removeDataForShip(), + box_inWriteData.removeDataForShip()); + box_outWriteDone.addTokenFromShip(); } } diff --git a/ships/Iscratch.ship b/ships/Iscratch.ship index bc502cb..99549ea 100644 --- a/ships/Iscratch.ship +++ b/ships/Iscratch.ship @@ -1,11 +1,11 @@ ship: Iscratch == Ports =========================================================== -data in: write_addr -data in: write_data -token out: write_done +data in: inWriteAddr +data in: inWriteData +token out: outWriteDone -data in: cbd +data in: inCBD == Fleeterpreter ==================================================== @@ -28,26 +28,26 @@ data in: cbd } public void service() { - if (box_cbd.dataReadyForShip()) { - int val = box_cbd.removeDataForShip(); + if (box_inCBD.dataReadyForShip()) { + int val = box_inCBD.removeDataForShip(); int addr = val >> 6; int size = val & 0x3f; dispatch(addr, size); } - if (box_write_addr.dataReadyForShip() && - box_write_data.dataReadyForShip() && - box_write_done.readyForItemFromShip()) { + if (box_inWriteAddr.dataReadyForShip() && + box_inWriteData.dataReadyForShip() && + box_outWriteDone.readyForItemFromShip()) { Interpreter f = (Interpreter)getFleet(); - f.writeMem(box_write_addr.removeDataForShip(), - box_write_data.removeDataForShip()); - box_write_done.addTokenFromShip(); + f.writeMem(box_inWriteAddr.removeDataForShip(), + box_inWriteData.removeDataForShip()); + box_outWriteDone.addTokenFromShip(); } } public void boot(byte[] instructions) { Interpreter fleet = (Interpreter)getFleet(); - // load the iscratch and take note of the 0-address CBD + // load the iscratch and take note of the 0-address INCBD long launch = 0; for(int i=0; i> 6); base = base & ~(0xffffffff << 18); int size = (int)launch; diff --git a/ships/Lut.ship b/ships/Lut.ship index 2f18657..91489d7 100644 --- a/ships/Lut.ship +++ b/ships/Lut.ship @@ -1,9 +1,9 @@ ship: Lut == Ports =========================================================== -data in: a -data in: b -data in: lut +data in: in1 +data in: in2 +data in: inLut data out: out @@ -11,10 +11,10 @@ data out: out == TeX ============================================================== == Fleeterpreter ==================================================== public void service() { - if (box_a.dataReadyForShip() && box_b.dataReadyForShip() && box_lut.dataReadyForShip()) { - int a = box_a.removeDataForShip(); - int b = box_b.removeDataForShip(); - int lut = box_lut.removeDataForShip(); + if (box_in1.dataReadyForShip() && box_in2.dataReadyForShip() && box_inLut.dataReadyForShip()) { + int a = box_in1.removeDataForShip(); + int b = box_in2.removeDataForShip(); + int lut = box_inLut.removeDataForShip(); int ret = 0; if ((lut & 1) != 0) ret |= (~a) & (~b); if ((lut & 2) != 0) ret |= (a) & (~b); diff --git a/ships/Shift.ship b/ships/Shift.ship index dfba5e1..6476ab1 100644 --- a/ships/Shift.ship +++ b/ships/Shift.ship @@ -1,19 +1,19 @@ ship: Shift == Ports =========================================================== -data in: val -data in: shamt +data in: in +data in: inShift data out: out == Constants ======================================================== == TeX ============================================================== == Fleeterpreter ==================================================== public void service() { - if (box_val.dataReadyForShip() && box_shamt.dataReadyForShip()) { - int val = box_val.removeDataForShip(); - int shamt = box_shamt.removeDataForShip(); - if (shamt < 0) val = val >> (-1 * shamt); - else val = val << shamt; + if (box_in.dataReadyForShip() && box_inShift.dataReadyForShip()) { + int val = box_in.removeDataForShip(); + int inShift = box_inShift.removeDataForShip(); + if (inShift < 0) val = val >> (-1 * inShift); + else val = val << inShift; box_out.addDataFromShip(val); } } diff --git a/src/edu/berkeley/fleet/interpreter/Interpreter.java b/src/edu/berkeley/fleet/interpreter/Interpreter.java index 77605ac..7c0c349 100644 --- a/src/edu/berkeley/fleet/interpreter/Interpreter.java +++ b/src/edu/berkeley/fleet/interpreter/Interpreter.java @@ -104,6 +104,7 @@ public class Interpreter extends Fleet { try { go(fp, instructions); } catch (Exception e) { + if (fp.isTerminated()) return; throw new RuntimeException(e); } } diff --git a/tests/dcache/dcache-read.fleet b/tests/dcache/dcache-read.fleet index 7905bcd..d2b5eec 100644 --- a/tests/dcache/dcache-read.fleet +++ b/tests/dcache/dcache-read.fleet @@ -10,31 +10,31 @@ #ship fifo : Fifo // dumb configurations -debug.data: [*] take, deliver; -dscratch.write_addr: [*] take, deliver; -dscratch.write_data: [*] take, deliver; -dscratch.read_addr: [*] take, deliver; +debug.in: [*] take, deliver; +dscratch.inWriteAddr: [*] take, deliver; +dscratch.inWriteData: [*] take, deliver; +dscratch.inReadAddr: [*] take, deliver; fifo.in: [*] take, deliver; // addresses and values to initialize the dscratch with -1: sendto dscratch.write_addr; -2: sendto dscratch.write_addr; -3: sendto dscratch.write_addr; -4: sendto dscratch.write_addr; -11: sendto dscratch.write_data; -12: sendto dscratch.write_data; -13: sendto dscratch.write_data; -14: sendto dscratch.write_data; +1: sendto dscratch.inWriteAddr; +2: sendto dscratch.inWriteAddr; +3: sendto dscratch.inWriteAddr; +4: sendto dscratch.inWriteAddr; +11: sendto dscratch.inWriteData; +12: sendto dscratch.inWriteData; +13: sendto dscratch.inWriteData; +14: sendto dscratch.inWriteData; // send write-completion tokens to the fifo output -dscratch.write_done: +dscratch.outWriteDone: [*] take, sendto fifo.out; // when the write-completion tokens accumulate, unleash // the read addresses fifo.out: [4] wait; - [4] take, sendto dscratch.read_addr; + [4] take, sendto dscratch.inReadAddr; // read addresses 4: sendto fifo.in; @@ -43,6 +43,6 @@ fifo.out: 1: sendto fifo.in; // data read from dscratch goes to the debug ship -dscratch.read_data: - [*] take, sendto debug.data; +dscratch.outReadData: + [*] take, sendto debug.in; diff --git a/tests/fifo/fifo-loop.fleet b/tests/fifo/fifo-loop.fleet index 2269e02..4edac1c 100644 --- a/tests/fifo/fifo-loop.fleet +++ b/tests/fifo/fifo-loop.fleet @@ -1,71 +1,15 @@ // expected output #expect 9 -#expect 9 -#expect 8 -#expect 9 -#expect 9 -#expect 9 -#expect 9 -#expect 9 -#expect 9 -#expect 9 // ships required in order to run this code #ship debug : Debug #ship fifo : Fifo -debug.data: [*] take, deliver; +debug.in: [*] take, deliver; 9: sendto fifo.in; fifo.in: take; [100] deliver; - [100] deliver; - [100] deliver; - [100] deliver; - [100] deliver; - [100] deliver; - [100] deliver; - [100] deliver; - [100] deliver; - [100] deliver; - [100] deliver; - [100] deliver; - [100] deliver; - [100] deliver; - [100] deliver; - [100] deliver; - [100] deliver; - [100] deliver; - [100] deliver; - [100] deliver; fifo.out: - [100r] take, discard; - [100r] take, discard; - [1r] take, sendto debug.data; - [100r] take, discard; - [100r] take, discard; - [1r] take, sendto debug.data; - [100r] take, discard; - [100r] take, discard; - [1r] take, sendto debug.data; - [100r] take, discard; - [100r] take, discard; - [1r] take, sendto debug.data; - [100r] take, discard; - [100r] take, discard; - [1r] take, sendto debug.data; - [100r] take, discard; - [100r] take, discard; - [1r] take, sendto debug.data; - [100r] take, discard; - [100r] take, discard; - [1r] take, sendto debug.data; - [100r] take, discard; - [100r] take, discard; - [1r] take, sendto debug.data; - [100r] take, discard; - [100r] take, discard; - [1r] take, sendto debug.data; - [100r] take, discard; - [100r] take, discard; - [1r] take, sendto debug.data; + [99r] take, sendto fifo.in; + [1r] take, sendto debug.in; diff --git a/tests/icache/icache-test.fleet b/tests/icache/icache-test.fleet index 49b1c7c..ff3d894 100644 --- a/tests/icache/icache-test.fleet +++ b/tests/icache/icache-test.fleet @@ -4,15 +4,15 @@ #expect 14 // ships required in order to run this code -#ship debug : Debug +#ship debug : Debug #ship iscratch : Iscratch // instructions not in any codebag are part of the "root codebag" // which is dispatched when the code is loaded -BOB: sendto iscratch.cbd; -iscratch.cbd: [*] take, deliver; -debug.data: [*] take, deliver; +BOB: sendto iscratch.inCBD; +iscratch.inCBD: [*] take, deliver; +debug.in: [*] take, deliver; // This codebag illustrates how to do a loop. Notice that this @@ -20,8 +20,8 @@ debug.data: [*] take, deliver; // switch fabric! BOB: { - 12: sendto debug.data; - 13: sendto debug.data; - 14: sendto debug.data; + 12: sendto debug.in; + 13: sendto debug.in; + 14: sendto debug.in; }