add Button.ship
authormegacz <adam@megacz.com>
Mon, 6 Apr 2009 18:51:14 +0000 (11:51 -0700)
committermegacz <adam@megacz.com>
Mon, 6 Apr 2009 18:51:14 +0000 (11:51 -0700)
ships/Button.ship [new file with mode: 0644]

diff --git a/ships/Button.ship b/ships/Button.ship
new file mode 100644 (file)
index 0000000..1a963eb
--- /dev/null
@@ -0,0 +1,61 @@
+ship: Null
+
+== Ports ===========================================================
+data  out:  out
+
+percolate down:  gpio_sw_c    1
+
+
+== Constants ========================================================
+
+== UCF ==============================================================================
+NET  gpio_sw_c            LOC="AJ6" | IOSTANDARD="LVCMOS33";   # Bank 18, Vcco=3.3V, No DCI
+
+== TeX ==============================================================
+== Fleeterpreter ====================================================
+    public void service() {
+    }
+
+== FleetSim ==============================================================
+
+== FPGA ==============================================================
+
+  assign out_d_ = 0;
+  reg [20:0] count;
+  reg last_state;
+
+  always @(posedge clk) begin
+    if (rst) begin
+      `reset
+      last_state <= gpio_sw_c;
+    end else begin
+      `cleanup
+      if (count==0) begin
+        if (`out_empty && gpio_sw_c && !last_state) begin
+          `fill_out
+        end
+        count <= 51200;
+        last_state <= gpio_sw_c;
+      end else begin
+        count <= count-1;
+      end
+    end
+  end
+
+== Test =================================================================
+
+#skip
+#expect 0
+
+#ship button : Button
+#ship debug : Debug
+
+debug.in:
+  set ilc=*;
+  recv, deliver;
+
+button.out:
+  collect, send to debug.in;
+
+== Contributors =========================================================
+Adam Megacz <megacz@cs.berkeley.edu>