OpenCores
URL https://opencores.org/ocsvn/bu_pacman/bu_pacman/trunk

Subversion Repositories bu_pacman

[/] [bu_pacman/] [tags/] [arelease/] [clock_divider.v] - Blame information for rev 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 soloist_hu
`timescale 1ns / 1ps
2
//////////////////////////////////////////////////////////////////////////////////
3
// Company: 
4
// Engineer: 
5
// 
6
// Create Date:    01:07:44 11/20/2008 
7
// Design Name: 
8
// Module Name:    clock_divider 
9
// Project Name: 
10
// Target Devices: 
11
// Tool versions: 
12
// Description: 
13
//
14
// Dependencies: 
15
//
16
// Revision: 
17
// Revision 0.01 - File Created
18
// Additional Comments: 
19
//
20
//////////////////////////////////////////////////////////////////////////////////
21
module clk_divider(clk, div_clk);
22
    input clk;
23
    output div_clk;
24
 
25
    parameter NDIV = 2;
26
    parameter NBIT = 2;
27
 
28
    reg [NBIT-1:0] count;
29
    reg div_clk;
30
 
31
    initial begin
32
      div_clk = 0;
33
      count = 0;
34
    end
35
 
36
    always @(posedge clk)
37
    begin
38
      if (count >= (NDIV - 1)) count <= 0;
39
        else count <= count + 1;
40
        div_clk <= count > ((NDIV - 1)/2) ? 1 : 0;
41
    end
42
 
43
endmodule
44
 
45
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.