Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e0e68f0

Browse files
committedAug 15, 2017
Fixed more issues with GreenPAK counter sim models
1 parent 3c39135 commit e0e68f0

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed
 

Diff for: ‎techlibs/greenpak4/cells_sim_digital.v

+23-19
Original file line numberDiff line numberDiff line change
@@ -58,23 +58,25 @@ module GP_COUNT14(input CLK, input wire RST, output reg OUT);
5858

5959
"RISING": begin
6060
always @(posedge CLK, posedge RST) begin
61-
count <= count - 1'd1;
62-
if(count == 0)
63-
count <= COUNT_TO;
64-
6561
if(RST)
66-
count <= 0;
62+
count <= 0;
63+
else begin
64+
count <= count - 1'd1;
65+
if(count == 0)
66+
count <= COUNT_TO;
67+
end
6768
end
6869
end
6970

7071
"FALLING": begin
7172
always @(posedge CLK, negedge RST) begin
72-
count <= count - 1'd1;
73-
if(count == 0)
74-
count <= COUNT_TO;
75-
7673
if(!RST)
77-
count <= 0;
74+
count <= 0;
75+
else begin
76+
count <= count - 1'd1;
77+
if(count == 0)
78+
count <= COUNT_TO;
79+
end
7880
end
7981
end
8082

@@ -88,7 +90,7 @@ module GP_COUNT14(input CLK, input wire RST, output reg OUT);
8890
"LEVEL": begin
8991
always @(posedge CLK, posedge RST) begin
9092
if(RST)
91-
count <= 0;
93+
count <= 0;
9294

9395
else begin
9496
count <= count - 1'd1;
@@ -422,23 +424,25 @@ module GP_COUNT8(
422424

423425
"RISING": begin
424426
always @(posedge CLK, posedge RST) begin
425-
count <= count - 1'd1;
426-
if(count == 0)
427-
count <= COUNT_TO;
428-
429427
if(RST)
430428
count <= 0;
429+
else begin
430+
count <= count - 1'd1;
431+
if(count == 0)
432+
count <= COUNT_TO;
433+
end
431434
end
432435
end
433436

434437
"FALLING": begin
435438
always @(posedge CLK, negedge RST) begin
436-
count <= count - 1'd1;
437-
if(count == 0)
438-
count <= COUNT_TO;
439-
440439
if(!RST)
441440
count <= 0;
441+
else begin
442+
count <= count - 1'd1;
443+
if(count == 0)
444+
count <= COUNT_TO;
445+
end
442446
end
443447
end
444448

0 commit comments

Comments
 (0)
Please sign in to comment.