-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreloj.v
40 lines (34 loc) · 898 Bytes
/
reloj.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
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:44:57 08/13/2018
// Design Name:
// Module Name: reloj
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module reloj(input clk);
localparam N = 26;
reg [N-1:0] slow_clk = 0;
reg [7:0] countsec = 0;
wire enable;
always @ (posedge clk)
if (slow_clk == 26'd49) slow_clk <= 8'b0;
else slow_clk <= slow_clk + 8'b1;
assign enable = (slow_clk == 26'd49);
always @ (posedge clk)
if (enable == 1'b1)
if (countsec == 8'b00111011) countsec <= 8'b0;
else countsec <= countsec + 8'b1;
endmodule