-
Notifications
You must be signed in to change notification settings - Fork 0
/
clk_divider2.v
46 lines (41 loc) · 899 Bytes
/
clk_divider2.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
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:05:13 04/18/2019
// Design Name:
// Module Name: clk_divider2
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module clk_divider2 (
input clock_in,
input reset,
output reg clock_out
);
reg [1:0] count;
always@(posedge clock_in or posedge reset) begin
if(reset) begin
count <= 2'b00;
end else begin
count <= count + 1'b1;
end
end
always@(posedge clock_in or posedge reset) begin
if(reset) begin
clock_out <= 1'b0;
end else begin
clock_out <= count[1];
end
end
endmodule