Skip to content

Commit c314586

Browse files
committedAug 28, 2017
Reformatted GP_COUNTx_ADV resets to avoid Yosys thinking that they're multi-edge-sensitive and getting confused.
1 parent 393b18e commit c314586

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed
 

Diff for: ‎techlibs/greenpak4/cells_sim_digital.v

+34-34
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,15 @@ module GP_COUNT14_ADV(input CLK, input RST, output reg OUT,
147147
"RISING": begin
148148
always @(posedge CLK, posedge RST) begin
149149

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
151159
end
152160
else if(UP) begin
153161
count <= count + 1'd1;
@@ -161,21 +169,21 @@ module GP_COUNT14_ADV(input CLK, input RST, output reg OUT,
161169
count <= COUNT_TO;
162170
end
163171

172+
end
173+
end
174+
175+
"FALLING": begin
176+
always @(posedge CLK, negedge RST) begin
177+
164178
//Resets
165-
if(RST) begin
179+
if(!RST) begin
166180
if(RESET_VALUE == "ZERO")
167181
count <= 0;
168182
else
169183
count <= COUNT_TO;
170184
end
171185

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
179187
end
180188
else if(UP) begin
181189
count <= count + 1'd1;
@@ -189,14 +197,6 @@ module GP_COUNT14_ADV(input CLK, input RST, output reg OUT,
189197
count <= COUNT_TO;
190198
end
191199

192-
//Resets
193-
if(!RST) begin
194-
if(RESET_VALUE == "ZERO")
195-
count <= 0;
196-
else
197-
count <= COUNT_TO;
198-
end
199-
200200
end
201201
end
202202

@@ -286,8 +286,16 @@ module GP_COUNT8_ADV(input CLK, input RST, output reg OUT,
286286
"RISING": begin
287287
always @(posedge CLK, posedge RST) begin
288288

289+
//Resets
290+
if(RST) begin
291+
if(RESET_VALUE == "ZERO")
292+
count <= 0;
293+
else
294+
count <= COUNT_TO;
295+
end
296+
289297
//Main counter
290-
if(KEEP) begin
298+
else if(KEEP) begin
291299
end
292300
else if(UP) begin
293301
count <= count + 1'd1;
@@ -301,22 +309,22 @@ module GP_COUNT8_ADV(input CLK, input RST, output reg OUT,
301309
count <= COUNT_TO;
302310
end
303311

312+
end
313+
end
314+
315+
"FALLING": begin
316+
always @(posedge CLK, negedge RST) begin
317+
304318
//Resets
305-
if(RST) begin
319+
if(!RST) begin
306320
if(RESET_VALUE == "ZERO")
307321
count <= 0;
308322
else
309323
count <= COUNT_TO;
310324
end
311325

312-
end
313-
end
314-
315-
"FALLING": begin
316-
always @(posedge CLK, negedge RST) begin
317-
318326
//Main counter
319-
if(KEEP) begin
327+
else if(KEEP) begin
320328
end
321329
else if(UP) begin
322330
count <= count + 1'd1;
@@ -330,14 +338,6 @@ module GP_COUNT8_ADV(input CLK, input RST, output reg OUT,
330338
count <= COUNT_TO;
331339
end
332340

333-
//Resets
334-
if(!RST) begin
335-
if(RESET_VALUE == "ZERO")
336-
count <= 0;
337-
else
338-
count <= COUNT_TO;
339-
end
340-
341341
end
342342
end
343343

0 commit comments

Comments
 (0)
Please sign in to comment.