Skip to content

Commit be2f599

Browse files
author
Sebastien Bourdeauducq
committedNov 27, 2011
standby: auto-on
1 parent 0aeb5c1 commit be2f599

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
 

‎boards/milkymist-one/standby/standby.v

+16
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18+
`define AUTO_ON
19+
1820
module standby(
1921
input clk50,
2022

@@ -84,6 +86,7 @@ BUFG b1(
8486
.O(clk)
8587
);
8688

89+
`ifndef AUTO_ON
8790
reg btn1_r0;
8891
reg btn1_r;
8992
reg btn2_r0;
@@ -111,6 +114,7 @@ end
111114
reg [19:0] debounce_r;
112115
always @(posedge clk) debounce_r <= debounce_r + 20'd1;
113116
assign debounce = &debounce_r;
117+
`endif
114118

115119
reg ce_r;
116120
reg [15:0] d_r;
@@ -179,27 +183,35 @@ always @(posedge clk, negedge locked)
179183
else
180184
state <= next_state;
181185

186+
`ifndef AUTO_ON
182187
reg rescue;
183188
reg next_rescue;
184189
always @(posedge clk, negedge locked)
185190
if(~locked)
186191
rescue <= 1'b0;
187192
else
188193
rescue <= next_rescue;
194+
`endif
189195

190196
always @(*) begin
191197
d = 16'hxxxx;
192198
icap_en_n = 1'b1;
193199

200+
`ifndef AUTO_ON
194201
next_rescue = rescue;
202+
`endif
195203

196204
next_state = state;
197205

198206
case(state)
199207
IDLE: begin
208+
`ifdef AUTO_ON
209+
next_state = DUMMY;
210+
`else
200211
next_rescue = btn1_r;
201212
if(btn2_r & ~btn2_r2)
202213
next_state = DUMMY;
214+
`endif
203215
end
204216
DUMMY: begin
205217
d = 16'hffff;
@@ -229,7 +241,11 @@ always @(*) begin
229241
GENERAL2_C: begin
230242
d = 16'h3281;
231243
icap_en_n = 1'b0;
244+
`ifdef AUTO_ON
245+
if(btn1)
246+
`else
232247
if(rescue)
248+
`endif
233249
next_state = GENERAL2_D_RESCUE;
234250
else
235251
next_state = GENERAL2_D_REGULAR;

0 commit comments

Comments
 (0)
Please sign in to comment.