-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtime_elapsed.v
50 lines (44 loc) · 1.01 KB
/
time_elapsed.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10/26/2024 07:35:52 PM
// Design Name:
// Module Name: time_elapsed
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module time_elapsed(mm,ss,clk,rst);
input wire clk,rst;
output reg [5:0] mm,ss;
always @(posedge clk or posedge rst) begin
if(rst) begin
mm<=6'd0;
ss<=6'd0;
end
else begin
if(ss==6'd59) begin
ss<=6'd0;
if(mm==6'd59) begin
mm<=6'd0;
end
else begin
mm<=mm+1'd1;
end
end
else begin
ss<=ss+1'd1;
end
end
end
endmodule