adjust ships to use fill/drain/full/empty macros
[fleet.git] / ships / Debug.ship
index b1f1c17..e33871f 100644 (file)
@@ -6,15 +6,19 @@ data  in:   in
 == Constants ========================================================
 
 == TeX ==============================================================
-\begin{verbatim}
 
-TODO: have some way to log multiple separate streams; use sibling
-      ports to deliver an opcode
+This ship is used for debugging.  It has only one port, {\tt in}.
+Programmers should send debug report values to this port.  How such
+values are reported back to the programmer doing the debugging is left
+unspecified.
 
-TODO: have a way to programmatically read back the output of the debug
-      ship?
+\subsection*{To Do}
 
-\end{verbatim}
+Provide an {\tt inOp} port and use opcode ports \cite{am25} to
+effectively allow multiple independent ``debug streams''
+
+Provide a way to programmatically read back the output of the debug
+ship.
 
 == Fleeterpreter ====================================================
 public void service() {
@@ -25,33 +29,32 @@ public void service() {
 == FleetSim ==============================================================
 
 == FPGA ==============================================================
-`include "macros.v"
-
-module debug (clk, data_debug_data_r, data_debug_data_a, data_debug_data,
-                   data_debug_out_r, data_debug_out_a, data_debug_out );
-  input clk;
-
-  input  data_debug_data_r;
-  output data_debug_data_a;
-  input  [`DATAWIDTH:0] data_debug_data;
-
-  output  data_debug_out_r;
-  input   data_debug_out_a;
-  output  [`DATAWIDTH:0] data_debug_out;
-
-  assign  data_debug_out_r  = data_debug_data_r;
-  assign  data_debug_data_a = data_debug_out_a;
-  assign  data_debug_out    = data_debug_data;
 
-endmodule
+  reg [`DATAWIDTH-1:0] out_d;
+  assign  out_d_ = out_d;
+
+  always @(posedge clk) begin
+    if (!rst) begin
+      `reset
+    end else begin
+      `flush
+      `cleanup
+      if (`in_full && `out_empty) begin
+        `drain_in
+        `fill_out
+        out_d <= in_d;
+      end
+    end
+  end
 
 == Test ================================================================
 #expect 25
 
 #ship debug : Debug
 
-25: sendto debug.in;
-debug.in: take, deliver;
+debug.in:
+  set word= 25;
+  deliver;
 
 == Contributors =========================================================
 Adam Megacz <megacz@cs.berkeley.edu>