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

Subversion Repositories eco32

[/] [eco32/] [trunk/] [fpga/] [mc/] [boards/] [s3e-500/] [src/] [clk_rst/] [clk_rst.v] - Blame information for rev 224

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

Line No. Rev Author Line
1 224 hellwig
//
2
// clk_rst.v -- clock and reset generator
3
//
4
 
5
 
6
module clk_rst(clk_in, reset_in,
7
               ddr_clk_0, ddr_clk_90, ddr_clk_180,
8
               ddr_clk_270, ddr_clk_ok, clk, reset);
9
    input clk_in;
10
    input reset_in;
11
    output ddr_clk_0;
12
    output ddr_clk_90;
13
    output ddr_clk_180;
14
    output ddr_clk_270;
15
    output ddr_clk_ok;
16
    output clk;
17
    output reset;
18
 
19
  wire clk50_in;
20
  wire clk50_out;
21
  wire clk50_ok;
22
  wire clk100_out;
23
  wire clk100_in;
24
  wire clk100_0;
25
  wire clk100_90;
26
  wire clk100_180;
27
  wire clk100_270;
28
  wire clk100_ok;
29
 
30
  reg reset_p;
31
  reg reset_s;
32
  reg [23:0] reset_counter;
33
  wire reset_counting;
34
 
35
  //------------------------------------------------------------
36
 
37
  IBUFG clk_in_buffer(
38
    .I(clk_in),
39
    .O(clk50_in)
40
  );
41
 
42
  DCM_SP dcm50(
43
    .RST(1'b0),
44
    .CLKIN(clk50_in),
45
    .CLKFB(clk),
46
    .CLK0(clk50_out),
47
    .CLK2X(clk100_out),
48
    .LOCKED(clk50_ok),
49
    .PSCLK(1'b0),
50
    .PSEN(1'b0),
51
    .PSINCDEC(1'b0)
52
  );
53
 
54
  defparam dcm50.CLKDV_DIVIDE = 2.0;
55
  defparam dcm50.CLKFX_DIVIDE = 1;
56
  defparam dcm50.CLKFX_MULTIPLY = 4;
57
  defparam dcm50.CLKIN_DIVIDE_BY_2 = "FALSE";
58
  defparam dcm50.CLKIN_PERIOD = 20.0;
59
  defparam dcm50.CLKOUT_PHASE_SHIFT = "NONE";
60
  defparam dcm50.CLK_FEEDBACK = "1X";
61
  defparam dcm50.DESKEW_ADJUST = "SYSTEM_SYNCHRONOUS";
62
  defparam dcm50.DLL_FREQUENCY_MODE = "LOW";
63
  defparam dcm50.DUTY_CYCLE_CORRECTION = "TRUE";
64
  defparam dcm50.PHASE_SHIFT = 0;
65
  defparam dcm50.STARTUP_WAIT = "FALSE";
66
 
67
  BUFG clk50_buffer(
68
    .I(clk50_out),
69
    .O(clk)
70
  );
71
 
72
  BUFG clk100_buffer(
73
    .I(clk100_out),
74
    .O(clk100_in)
75
  );
76
 
77
  //------------------------------------------------------------
78
 
79
  DCM_SP dcm100(
80
    .RST(~clk50_ok),
81
    .CLKIN(clk100_in),
82
    .CLKFB(ddr_clk_0),
83
    .CLK0(clk100_0),
84
    .CLK90(clk100_90),
85
    .CLK180(clk100_180),
86
    .CLK270(clk100_270),
87
    .LOCKED(clk100_ok),
88
    .PSCLK(1'b0),
89
    .PSEN(1'b0),
90
    .PSINCDEC(1'b0)
91
  );
92
 
93
  defparam dcm100.CLKDV_DIVIDE = 2.0;
94
  defparam dcm100.CLKFX_DIVIDE = 1;
95
  defparam dcm100.CLKFX_MULTIPLY = 4;
96
  defparam dcm100.CLKIN_DIVIDE_BY_2 = "FALSE";
97
  defparam dcm100.CLKIN_PERIOD = 10.0;
98
  defparam dcm100.CLKOUT_PHASE_SHIFT = "NONE";
99
  defparam dcm100.CLK_FEEDBACK = "1X";
100
  defparam dcm100.DESKEW_ADJUST = "SYSTEM_SYNCHRONOUS";
101
  defparam dcm100.DLL_FREQUENCY_MODE = "LOW";
102
  defparam dcm100.DUTY_CYCLE_CORRECTION = "TRUE";
103
  defparam dcm100.PHASE_SHIFT = 0;
104
  defparam dcm100.STARTUP_WAIT = "FALSE";
105
 
106
  BUFG clk100_0_buffer(
107
    .I(clk100_0),
108
    .O(ddr_clk_0)
109
  );
110
 
111
  BUFG clk100_90_buffer(
112
    .I(clk100_90),
113
    .O(ddr_clk_90)
114
  );
115
 
116
  BUFG clk100_180_buffer(
117
    .I(clk100_180),
118
    .O(ddr_clk_180)
119
  );
120
 
121
  BUFG clk100_270_buffer(
122
    .I(clk100_270),
123
    .O(ddr_clk_270)
124
  );
125
 
126
  assign ddr_clk_ok = clk100_ok;
127
 
128
  //------------------------------------------------------------
129
 
130
  assign reset_counting = (reset_counter == 24'hFFFFFF) ? 0 : 1;
131
 
132
  always @(posedge clk) begin
133
    reset_p <= reset_in;
134
    reset_s <= reset_p;
135
    if (reset_s | ~clk50_ok | ~clk100_ok) begin
136
      reset_counter <= 24'h000000;
137
    end else begin
138
      if (reset_counting == 1) begin
139
        reset_counter <= reset_counter + 1;
140
      end
141
    end
142
  end
143
 
144
  assign reset = reset_counting;
145
 
146
endmodule

powered by: WebSVN 2.1.0

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