Timming now correct and also

7-segmet display also working now
This commit is contained in:
Imants Pulkstenis
2020-04-12 22:44:24 +03:00
parent be0c2ab376
commit 9a6c90c0b2
7 changed files with 149 additions and 132 deletions
+12 -5
View File
@@ -20,19 +20,26 @@
module counter (
input clk,
input reset,
output [15:0] counter);
input [3:0] max,
output [15:0] counter);
always@(posedge clk) begin
if (reset == 'b1) begin
r_counter <= 'b0;
r_adder <= 'b0;
end
else begin
r_counter <= r_counter + 1;
if (r_adder >= max )begin
r_counter <= r_counter + 1;
r_adder <= 0;
end
else begin
r_adder <= r_adder + 1;
end
end
end
reg [15:0] r_counter = 'b0;
reg [15:0] r_adder = 'b0;
reg [15:0] r_counter = 'b0;
assign counter = r_counter;