@@ -147,7 +147,15 @@ module GP_COUNT14_ADV(input CLK, input RST, output reg OUT,
147
147
"RISING" : begin
148
148
always @(posedge CLK, posedge RST) begin
149
149
150
- if (KEEP) begin
150
+ // Resets
151
+ if (RST) begin
152
+ if (RESET_VALUE == "ZERO" )
153
+ count <= 0 ;
154
+ else
155
+ count <= COUNT_TO;
156
+ end
157
+
158
+ else if (KEEP) begin
151
159
end
152
160
else if (UP) begin
153
161
count <= count + 1'd1 ;
@@ -161,21 +169,21 @@ module GP_COUNT14_ADV(input CLK, input RST, output reg OUT,
161
169
count <= COUNT_TO;
162
170
end
163
171
172
+ end
173
+ end
174
+
175
+ "FALLING" : begin
176
+ always @(posedge CLK, negedge RST) begin
177
+
164
178
// Resets
165
- if (RST) begin
179
+ if (! RST) begin
166
180
if (RESET_VALUE == "ZERO" )
167
181
count <= 0 ;
168
182
else
169
183
count <= COUNT_TO;
170
184
end
171
185
172
- end
173
- end
174
-
175
- "FALLING" : begin
176
- always @(posedge CLK, negedge RST) begin
177
-
178
- if (KEEP) begin
186
+ else if (KEEP) begin
179
187
end
180
188
else if (UP) begin
181
189
count <= count + 1'd1 ;
@@ -189,14 +197,6 @@ module GP_COUNT14_ADV(input CLK, input RST, output reg OUT,
189
197
count <= COUNT_TO;
190
198
end
191
199
192
- // Resets
193
- if (! RST) begin
194
- if (RESET_VALUE == "ZERO" )
195
- count <= 0 ;
196
- else
197
- count <= COUNT_TO;
198
- end
199
-
200
200
end
201
201
end
202
202
@@ -286,8 +286,16 @@ module GP_COUNT8_ADV(input CLK, input RST, output reg OUT,
286
286
"RISING" : begin
287
287
always @(posedge CLK, posedge RST) begin
288
288
289
+ // Resets
290
+ if (RST) begin
291
+ if (RESET_VALUE == "ZERO" )
292
+ count <= 0 ;
293
+ else
294
+ count <= COUNT_TO;
295
+ end
296
+
289
297
// Main counter
290
- if (KEEP) begin
298
+ else if (KEEP) begin
291
299
end
292
300
else if (UP) begin
293
301
count <= count + 1'd1 ;
@@ -301,22 +309,22 @@ module GP_COUNT8_ADV(input CLK, input RST, output reg OUT,
301
309
count <= COUNT_TO;
302
310
end
303
311
312
+ end
313
+ end
314
+
315
+ "FALLING" : begin
316
+ always @(posedge CLK, negedge RST) begin
317
+
304
318
// Resets
305
- if (RST) begin
319
+ if (! RST) begin
306
320
if (RESET_VALUE == "ZERO" )
307
321
count <= 0 ;
308
322
else
309
323
count <= COUNT_TO;
310
324
end
311
325
312
- end
313
- end
314
-
315
- "FALLING" : begin
316
- always @(posedge CLK, negedge RST) begin
317
-
318
326
// Main counter
319
- if (KEEP) begin
327
+ else if (KEEP) begin
320
328
end
321
329
else if (UP) begin
322
330
count <= count + 1'd1 ;
@@ -330,14 +338,6 @@ module GP_COUNT8_ADV(input CLK, input RST, output reg OUT,
330
338
count <= COUNT_TO;
331
339
end
332
340
333
- // Resets
334
- if (! RST) begin
335
- if (RESET_VALUE == "ZERO" )
336
- count <= 0 ;
337
- else
338
- count <= COUNT_TO;
339
- end
340
-
341
341
end
342
342
end
343
343
0 commit comments