-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathclk50.v
executable file
·57 lines (54 loc) · 1.16 KB
/
clk50.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
51
52
53
54
55
56
57
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 12:46:21 05/18/2015
// Design Name:
// Module Name: clk50
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module clk50(
input clk,
input rst,
input select,
output reg [31:0] OUT1,
output reg [31:0] OUT2,
output clkdivided1hz,
output clkdivided2hz,
output clkselect
);
always @ (posedge clk or posedge rst)
begin
if (rst)
OUT1<=32'd0;
else
if (OUT1 == 32'd4)
OUT1<=32'd0;
else
OUT1 <= OUT1 + 1;
end
always @ (posedge clk or posedge rst)
begin
if (rst)
OUT2<=32'd0;
else
if (OUT2 == 32'd4)
OUT2<=32'd0;
else
OUT2 <= OUT2 + 1;
end
assign clkdivided1hz = (OUT1 == 32'd4);
assign clkdivided2hz = (OUT2 == 32'd4);
assign clkselect = (select) ? clkdivided2hz : clkdivided1hz;
endmodule