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

Subversion Repositories openfire2

[/] [openfire2/] [trunk/] [rtl/] [prom_reader_clock_mgmt.v] - Blame information for rev 3

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 toni32
//      MODULE  : clock_management.v
2
//      AUTHOR  : Stephan Neuhold
3
//      VERSION : v1.00
4
//
5
//      REVISION HISTORY:
6
//      -----------------
7
//      No revisions
8
//
9
//      FUNCTION DESCRIPTION:
10
//      ---------------------
11
//      This module generates an enable signal for
12
//      the shift register and comparator. It also
13
//      generates the clock signal that is connected
14
//      to the PROM.
15
//      The enable and clock signals are generated
16
//      based on the "frequency" generic entered for
17
//      the system clock.
18
//      The clock signal is only generated at the
19
//      appropriate times. All other states the clock
20
//      signal is kept at a logic high. The PROMs
21
//      address counter only increments on a rising
22
//      edge of this clock.
23
 
24
`timescale 1 ns / 1 ns
25
 
26
module clock_management(        clock,
27
                                                                        enable,
28
                                                                        read_enable,
29
                                                                        cclk);
30
 
31
        input                                                   clock;
32
        input                                                   enable;
33
        output          reg                     read_enable;
34
        output                                          cclk;
35
 
36
        parameter                                       length = 5;
37
        parameter                                       frequency = 50;
38
        wire                                    [3:0]    SRL_length = (frequency / 20) - 1;
39
        defparam                                                Divider0.INIT = 16'h0001;
40
 
41
        reg                                                     cclk_int = 1'b1;
42
        wire                                                    enable_cclk;
43
 
44
//***************************************************
45
//*     The length of the SRL16 is based on the system
46
//*     clock frequency entered. This frequency is then
47
//*     "divided" down to approximately 10MHz.
48
//***************************************************   
49
SRL16   Divider0(
50
        .CLK(clock),
51
        .D(enable_cclk),
52
        .A0(SRL_length[0]),
53
        .A1(SRL_length[1]),
54
        .A2(SRL_length[2]),
55
        .A3(SRL_length[3]),
56
        .Q(enable_cclk)
57
        );
58
 
59
//***************************************************
60
//*     This process generates the enable signal for
61
//*     the shift register and the comparator. It also
62
//*     generates the clock signal used to increment
63
//*     the PROMs address counter.
64
//***************************************************   
65
always @ (posedge clock)
66
begin
67
        if (enable)
68
        begin
69
                if (enable_cclk)
70
                        cclk_int <= ~cclk_int;
71
                if (enable_cclk & cclk_int)
72
                        read_enable <= 1'b1;
73
                else
74
                        read_enable <= 1'b0;
75
        end
76
        else
77
                cclk_int <= 1'b1;
78
end
79
 
80
assign cclk = cclk_int;
81
 
82
endmodule

powered by: WebSVN 2.1.0

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