X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Ffleet%2Fapi%2FFleetProcess.java;h=2dd7332e070254ef6b0cd9c3aaaa4e06341222c3;hb=c2326dd4649b1b8ba1a71fcb977d871c8e7c9d3e;hp=c5aad72866b691fff524ad6d243bb7c26dc64577;hpb=4247b39858d204b5dcbfcd1de1bc6dbca39c4095;p=fleet.git
diff --git a/src/edu/berkeley/fleet/api/FleetProcess.java b/src/edu/berkeley/fleet/api/FleetProcess.java
index c5aad72..2dd7332 100644
--- a/src/edu/berkeley/fleet/api/FleetProcess.java
+++ b/src/edu/berkeley/fleet/api/FleetProcess.java
@@ -2,33 +2,68 @@ package edu.berkeley.fleet.api;
import java.io.*;
import java.util.*;
-/** represents a running "slave" fleet with a debug connection */
+/**
+ * Represents a running "slave" fleet with debugging
+ * facilities controlled by the "master" JVM.
+ *
+ *
Each Fleet which supports this API must include:
+ *
- The ability to dispatch instructions, words, and tokens
+ * from the master, "on the fly".
+ *
- A "debug.in" dock such that any words delivered there
+ * are sent back to the master.
+ *
+ */
public abstract class FleetProcess {
private boolean terminated = false;
- /** dumps an instruction into the fetch unit */
- public abstract void invokeInstruction(Instruction i);
+ /** dispatch an instruction; may be buffered */
+ public abstract void sendInstruction(Instruction i);
- /** reads a word back from the debug port */
- public abstract long readWord();
+ /** dispatch a word to a given destination; may be buffered */
+ public abstract void sendWord(Destination d, BitVector word);
- /** subclasses may be assured that this will be called exactly once */
+ /** dispatch a word to a given destination; may be buffered */
+ public abstract void sendWord(Destination d, BitVector word, BitVector signal);
+
+ /** convenience method: sends the word to d's data destination */
+ public void sendWord(Dock d, BitVector word) { sendWord(d.getDataDestination(), word); }
+
+ /** dispatch a token to a given destination; may be buffered */
+ public abstract void sendToken(Destination d);
+
+ /** convenience method: sends a token to d's data destination */
+ public void sendToken(Dock d) { sendToken(d.getDataDestination()); }
+
+ /** convenience method: sends a token to d's instruction destination */
+ public void sendTorpedo(Dock d) { sendToken(d.getInstructionDestination()); }
+
+ /** flush all instructions, words, and tokens dispatched so far */
+ public abstract void flush();
+
+ /** the dock used to read back data from the slave */
+ public abstract Dock getDebugInputDock();
+
+ /** returns the next word delivered at the dock specified by getDebugInputDock() */
+ public abstract BitVector recvWord();
+
+ /** Terminate the process; subclasses may be assured that this will be called exactly once. */
protected abstract void _terminate();
- public synchronized void terminate() {
+ public void masterClear() { throw new RuntimeException("not implemented"); }
+
+ /** Terminate the process. */
+ public final synchronized void terminate() {
if (terminated) return;
terminated = true;
_terminate();
}
- public boolean isTerminated() {
- return terminated;
- }
+ /** Returns true if the process is terminated */
+ public final boolean isTerminated() { return terminated; }
- public synchronized void finalize() {
- if (!terminated)
- terminate();
- }
+ public synchronized void finalize() { terminate(); }
+ /** return the Fleet that this FleetProcess controls */
+ public abstract Fleet getFleet();
}