1a963eb919f29abb70bbe09459f0c4088c10feeb
[fleet.git] / ships / Button.ship
1 ship: Null
2
3 == Ports ===========================================================
4 data  out:  out
5
6 percolate down:  gpio_sw_c    1
7
8
9 == Constants ========================================================
10
11 == UCF ==============================================================================
12 NET  gpio_sw_c            LOC="AJ6" | IOSTANDARD="LVCMOS33";   # Bank 18, Vcco=3.3V, No DCI
13
14 == TeX ==============================================================
15 == Fleeterpreter ====================================================
16     public void service() {
17     }
18
19 == FleetSim ==============================================================
20
21 == FPGA ==============================================================
22
23   assign out_d_ = 0;
24   reg [20:0] count;
25   reg last_state;
26
27   always @(posedge clk) begin
28     if (rst) begin
29       `reset
30       last_state <= gpio_sw_c;
31     end else begin
32       `cleanup
33       if (count==0) begin
34         if (`out_empty && gpio_sw_c && !last_state) begin
35           `fill_out
36         end
37         count <= 51200;
38         last_state <= gpio_sw_c;
39       end else begin
40         count <= count-1;
41       end
42     end
43   end
44
45 == Test =================================================================
46
47 #skip
48 #expect 0
49
50 #ship button : Button
51 #ship debug : Debug
52
53 debug.in:
54   set ilc=*;
55   recv, deliver;
56
57 button.out:
58   collect, send to debug.in;
59
60 == Contributors =========================================================
61 Adam Megacz <megacz@cs.berkeley.edu>