1 package edu.berkeley.fleet.interpreter;
2 import edu.berkeley.fleet.api.*;
3 import edu.berkeley.fleet.api.BenkoBox;
5 /** anything that has a destination address on the switch fabric */
6 public abstract class InterpreterBenkoBox extends BenkoBox {
8 private final String name;
9 private final InterpreterShip ship;
11 public InterpreterBenkoBox(InterpreterShip ship, String name) {
14 ship.addBenkoBox(name, this);
19 public int instr_bits;
20 public int instr_addr;
21 protected boolean special = false;
22 protected boolean ihorn = false;
23 protected boolean dhorn = false;
25 public boolean special() { return special; }
26 public boolean ihorn() { return ihorn; }
27 public boolean dhorn() { return dhorn; }
29 /** adds one token to the port from the switch fabric side */
30 void addTokenFromFabric() { addDataFromFabric(0); }
32 /** adds the included datum to the port from the switch fabric side */
33 void addDataFromFabric(int datum) { throw new RuntimeException("this should never happen!"); }
35 /** adds one token to the port from the ship side */
36 public void addTokenFromShip() { addDataFromShip(0); }
38 /** adds the included datum to the port from the switch fabric side */
39 public void addDataFromShip(int datum) { throw new RuntimeException("this should never happen!"); }
41 public Ship getShip() { return ship; }
43 public Fleet getFleet() { return getShip().getFleet(); }
45 public String toString() { return ship+"."+name; }
47 abstract void shutdown();
49 public String getName() { return name; }
51 public int getInstructionFifoLength() { return 4; }