case(RESET_MODE)
"RISING": begin
- always @(posedge CLK or posedge RST) begin
+ always @(posedge CLK, posedge RST) begin
count <= count - 1'd1;
if(count == 0)
count <= COUNT_TO;
end
"FALLING": begin
- always @(posedge CLK or negedge RST) begin
+ always @(posedge CLK, negedge RST) begin
count <= count - 1'd1;
if(count == 0)
count <= COUNT_TO;
end
"LEVEL": begin
- always @(posedge CLK or posedge RST) begin
- count <= count - 1'd1;
- if(count == 0)
- count <= COUNT_TO;
-
+ always @(posedge CLK, posedge RST) begin
if(RST)
count <= 0;
+
+ else begin
+ count <= count - 1'd1;
+ if(count == 0)
+ count <= COUNT_TO;
+ end
end
end
case(RESET_MODE)
"RISING": begin
- always @(posedge CLK or posedge RST) begin
+ always @(posedge CLK, posedge RST) begin
//Main counter
if(KEEP) begin
end
"FALLING": begin
- always @(posedge CLK or negedge RST) begin
+ always @(posedge CLK, negedge RST) begin
//Main counter
if(KEEP) begin
end
"LEVEL": begin
- always @(posedge CLK or posedge RST) begin
-
- //Main counter
- if(KEEP) begin
- end
- else if(UP)
- count <= count + 1'd1;
- else
- count <= count - 1'd1;
-
- //Wrapping
- if(count == 0 && !UP)
- count <= COUNT_TO;
- if(count == 14'h3fff && UP)
- count <= COUNT_TO;
+ always @(posedge CLK, posedge RST) begin
//Resets
if(RST) begin
count <= COUNT_TO;
end
+ else begin
+
+ //Main counter
+ if(KEEP) begin
+ end
+ else if(UP)
+ count <= count + 1'd1;
+ else
+ count <= count - 1'd1;
+
+ //Wrapping
+ if(count == 0 && !UP)
+ count <= COUNT_TO;
+ if(count == 14'h3fff && UP)
+ count <= COUNT_TO;
+
+ end
+
end
end
case(RESET_MODE)
"RISING": begin
- always @(posedge CLK or posedge RST) begin
+ always @(posedge CLK, posedge RST) begin
//Main counter
if(KEEP) begin
end
"FALLING": begin
- always @(posedge CLK or negedge RST) begin
+ always @(posedge CLK, negedge RST) begin
//Main counter
if(KEEP) begin
end
"LEVEL": begin
- always @(posedge CLK or posedge RST) begin
-
- //Main counter
- if(KEEP) begin
- end
- else if(UP)
- count <= count + 1'd1;
- else
- count <= count - 1'd1;
-
- //Wrapping
- if(count == 0 && !UP)
- count <= COUNT_TO;
- if(count == 8'hff && UP)
- count <= COUNT_TO;
+ always @(posedge CLK, posedge RST) begin
//Resets
if(RST) begin
count <= COUNT_TO;
end
+ else begin
+
+ //Main counter
+ if(KEEP) begin
+ end
+ else if(UP)
+ count <= count + 1'd1;
+ else
+ count <= count - 1'd1;
+
+ //Wrapping
+ if(count == 0 && !UP)
+ count <= COUNT_TO;
+ if(count == 8'hff && UP)
+ count <= COUNT_TO;
+
+ end
+
end
end
case(RESET_MODE)
"RISING": begin
- always @(posedge CLK or posedge RST) begin
+ always @(posedge CLK, posedge RST) begin
count <= count - 1'd1;
if(count == 0)
count <= COUNT_TO;
end
"FALLING": begin
- always @(posedge CLK or negedge RST) begin
+ always @(posedge CLK, negedge RST) begin
count <= count - 1'd1;
if(count == 0)
count <= COUNT_TO;
end
"LEVEL": begin
- always @(posedge CLK or posedge RST) begin
- count <= count - 1'd1;
- if(count == 0)
- count <= COUNT_TO;
-
+ always @(posedge CLK, posedge RST) begin
if(RST)
count <= 0;
+
+ else begin
+ count <= count - 1'd1;
+ if(count == 0)
+ count <= COUNT_TO;
+ end
end
end