Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

standby: auto-on

  • Loading branch information...
commit be2f599eb4afb9f696dbe0d130c59ef90ad24ded 1 parent 0aeb5c1
Sébastien Bourdeauducq authored November 27, 2011

Showing 1 changed file with 16 additions and 0 deletions. Show diff stats Hide diff stats

  1. 16  boards/milkymist-one/standby/standby.v
16  boards/milkymist-one/standby/standby.v
@@ -15,6 +15,8 @@
15 15
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16
  */
17 17
 
  18
+`define AUTO_ON
  19
+ 
18 20
 module standby(
19 21
 	input clk50,
20 22
 
@@ -84,6 +86,7 @@ BUFG b1(
84 86
 	.O(clk)
85 87
 );
86 88
 
  89
+`ifndef AUTO_ON
87 90
 reg btn1_r0;
88 91
 reg btn1_r;
89 92
 reg btn2_r0;
@@ -111,6 +114,7 @@ end
111 114
 reg [19:0] debounce_r;
112 115
 always @(posedge clk) debounce_r <= debounce_r + 20'd1;
113 116
 assign debounce = &debounce_r;
  117
+`endif
114 118
 
115 119
 reg ce_r;
116 120
 reg [15:0] d_r;
@@ -179,6 +183,7 @@ always @(posedge clk, negedge locked)
179 183
 	else
180 184
 		state <= next_state;
181 185
 
  186
+`ifndef AUTO_ON
182 187
 reg rescue;
183 188
 reg next_rescue;
184 189
 always @(posedge clk, negedge locked)
@@ -186,20 +191,27 @@ always @(posedge clk, negedge locked)
186 191
 		rescue <= 1'b0;
187 192
 	else
188 193
 		rescue <= next_rescue;
  194
+`endif
189 195
 
190 196
 always @(*) begin
191 197
 	d = 16'hxxxx;
192 198
 	icap_en_n = 1'b1;
193 199
 
  200
+`ifndef AUTO_ON
194 201
 	next_rescue = rescue;
  202
+`endif
195 203
 
196 204
 	next_state = state;
197 205
 
198 206
 	case(state)
199 207
 		IDLE: begin
  208
+`ifdef AUTO_ON
  209
+			next_state = DUMMY;
  210
+`else
200 211
 			next_rescue = btn1_r;
201 212
 			if(btn2_r & ~btn2_r2)
202 213
 				next_state = DUMMY;
  214
+`endif
203 215
 		end
204 216
 		DUMMY: begin
205 217
 			d = 16'hffff;
@@ -229,7 +241,11 @@ always @(*) begin
229 241
 		GENERAL2_C: begin
230 242
 			d = 16'h3281;
231 243
 			icap_en_n = 1'b0;
  244
+`ifdef AUTO_ON
  245
+			if(btn1)
  246
+`else
232 247
 			if(rescue)
  248
+`endif
233 249
 				next_state = GENERAL2_D_RESCUE;
234 250
 			else
235 251
 				next_state = GENERAL2_D_REGULAR;

0 notes on commit be2f599

Please sign in to comment.
Something went wrong with that request. Please try again.