3 == Ports ===========================================================
10 == Fleeterpreter ====================================================
12 private long[] mem = new long[0];
13 public long readMem(int addr) { return mem[addr]; }
14 public void writeMem(int addr, long val) {
15 if (addr >= mem.length) {
16 long[] newmem = new long[addr * 2 + 1];
17 System.arraycopy(mem, 0, newmem, 0, mem.length);
23 public void dispatch(int addr, int size) {
24 for(int i=addr; i<addr+size; i++) {
25 Instruction instr = ((Interpreter)getFleet()).readInstruction(readMem(i));
26 ((Interpreter)getFleet()).dispatch(instr, i);
30 public void service() {
31 if (box_cbd.dataReadyForShip()) {
32 int val = box_cbd.removeDataForShip();
34 int size = val & 0x3f;
38 if (box_write_addr.dataReadyForShip() &&
39 box_write_data.dataReadyForShip() &&
40 box_write_done.readyForItemFromShip()) {
41 Interpreter f = (Interpreter)getFleet();
42 f.writeMem(box_write_addr.removeDataForShip(),
43 box_write_data.removeDataForShip());
44 box_write_done.addTokenFromShip();
48 public void boot(byte[] instructions) {
49 Interpreter fleet = (Interpreter)getFleet();
50 // load the iscratch and take note of the 0-address CBD
52 for(int i=0; i<instructions.length; i+=6) {
54 for(int j=0; j<6; j++)
55 word = (word << 8) | (instructions[i+j] & 0xff);
57 if (i==0) launch = word;
60 // dispatch the 0-address CBD
61 int base = (int)(launch >> 6);
62 base = base & ~(0xffffffff << 18);
63 int size = (int)launch;
64 size = size & ~(0xffffffff << 6);
68 == Constants ========================================================
69 == TeX ==============================================================
70 == ArchSim ==============================================================
71 == FPGA ==============================================================
73 == Contributors =========================================================
74 Adam Megacz <megacz@cs.berkeley.edu>