OpenCores
URL https://opencores.org/ocsvn/1g_ethernet_dpi/1g_ethernet_dpi/trunk

Subversion Repositories 1g_ethernet_dpi

[/] [1g_ethernet_dpi/] [trunk/] [hw/] [src/] [rtl/] [tri_mode_emac_support/] [tri_mode_ethernet_mac_0_example_design_resets.v] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 kuzmi4
//------------------------------------------------------------------------------
2
// File       : tri_mode_ethernet_mac_0_example_design_resets.v
3
// Author     : Xilinx Inc.
4
// -----------------------------------------------------------------------------
5
// (c) Copyright 2012 Xilinx, Inc. All rights reserved.
6
//
7
// This file contains confidential and proprietary information
8
// of Xilinx, Inc. and is protected under U.S. and
9
// international copyright and other intellectual property
10
// laws.
11
//
12
// DISCLAIMER
13
// This disclaimer is not a license and does not grant any
14
// rights to the materials distributed herewith. Except as
15
// otherwise provided in a valid license issued to you by
16
// Xilinx, and to the maximum extent permitted by applicable
17
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
18
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
19
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
20
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
21
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
22
// (2) Xilinx shall not be liable (whether in contract or tort,
23
// including negligence, or under any other theory of
24
// liability) for any loss or damage of any kind or nature
25
// related to, arising under or in connection with these
26
// materials, including for any direct, or any indirect,
27
// special, incidental, or consequential loss or damage
28
// (including loss of data, profits, goodwill, or any type of
29
// loss or damage suffered as a result of any action brought
30
// by a third party) even if such damage or loss was
31
// reasonably foreseeable or Xilinx had been advised of the
32
// possibility of the same.
33
//
34
// CRITICAL APPLICATIONS
35
// Xilinx products are not designed or intended to be fail-
36
// safe, or for use in any application requiring fail-safe
37
// performance, such as life-support or safety devices or
38
// systems, Class III medical devices, nuclear facilities,
39
// applications related to the deployment of airbags, or any
40
// other applications that could lead to death, personal
41
// injury, or severe property or environmental damage
42
// (individually and collectively, "Critical
43
// Applications"). Customer assumes the sole risk and
44
// liability of any use of Xilinx products in Critical
45
// Applications, subject only to applicable laws and
46
// regulations governing limitations on product liability.
47
//
48
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
49
// PART OF THIS FILE AT ALL TIMES. 
50
// -----------------------------------------------------------------------------
51
// Description:  This block generates fully synchronous resets for each clock domain
52
`timescale 1 ps/1 ps
53
 
54
module tri_mode_ethernet_mac_0_example_design_resets
55
   (
56
   // clocks
57
   input          s_axi_aclk,
58
   input          gtx_clk,
59
 
60
   // asynchronous resets
61
   input          glbl_rst,
62
   input          reset_error,
63
   input          rx_reset,
64
   input          tx_reset,
65
 
66
   input          dcm_locked,
67
 
68
   // synchronous reset outputs
69
 
70
   output         glbl_rst_intn,
71
 
72
   output   reg   gtx_resetn = 0,
73
 
74
   output   reg   s_axi_resetn = 0,
75
   output         phy_resetn,
76
   output   reg   chk_resetn = 0
77
   );
78
 
79
// define internal signals
80
    reg           s_axi_pre_resetn = 0;
81
    wire          s_axi_reset_int;
82
 
83
    reg           gtx_pre_resetn = 0;
84
    wire          gtx_clk_reset_int;
85
 
86
    reg           chk_pre_resetn = 0;
87
    wire          chk_reset_int;
88
    wire          dcm_locked_sync;
89
    reg           phy_resetn_int;
90
    reg  [5:0]    phy_reset_count;
91
 
92
  //----------------------------------------------------------------------------
93
  // Synchronise the async dcm_locked into the gtx_clk clock domain
94
  //----------------------------------------------------------------------------
95
  tri_mode_ethernet_mac_0_sync_block dcm_sync (
96
     .clk              (gtx_clk),
97
     .data_in          (dcm_locked),
98
     .data_out         (dcm_locked_sync)
99
  );
100
 
101
 
102
  //----------------------------------------------------------------------------
103
  // Generate resets required for the fifo side signals etc
104
  //----------------------------------------------------------------------------
105
  // in each case the async reset is first captured and then synchronised
106
 
107
  //---------------
108
  // global reset
109
   tri_mode_ethernet_mac_0_reset_sync glbl_reset_gen (
110
      .clk              (gtx_clk),
111
      .enable           (dcm_locked_sync),
112
      .reset_in         (glbl_rst),
113
      .reset_out        (glbl_rst_int)
114
   );
115
 
116
   assign glbl_rst_intn = !glbl_rst_int;
117
 
118
 
119
 
120
  //---------------
121
  // AXI-Lite reset
122
   tri_mode_ethernet_mac_0_reset_sync axi_lite_reset_gen (
123
      .clk              (s_axi_aclk),
124
      .enable           (phy_resetn_int),
125
      .reset_in         (glbl_rst),
126
      .reset_out        (s_axi_reset_int)
127
   );
128
 
129
   // Create fully synchronous reset in the s_axi clock domain.
130
   always @(posedge s_axi_aclk)
131
   begin
132
     if (s_axi_reset_int) begin
133
       s_axi_pre_resetn <= 0;
134
       s_axi_resetn     <= 0;
135
     end
136
     else begin
137
       s_axi_pre_resetn <= 1;
138
       s_axi_resetn     <= s_axi_pre_resetn;
139
     end
140
   end
141
 
142
  //---------------
143
 
144
  // gtx_clk reset
145
 
146
   tri_mode_ethernet_mac_0_reset_sync gtx_reset_gen (
147
 
148
      .clk              (gtx_clk),
149
 
150
      .enable           (dcm_locked_sync),
151
      .reset_in         (glbl_rst || rx_reset || tx_reset),
152
 
153
      .reset_out        (gtx_clk_reset_int)
154
 
155
   );
156
 
157
 
158
   // Create fully synchronous reset in the gtx_clk domain.
159
   always @(posedge gtx_clk)
160
   begin
161
     if (gtx_clk_reset_int) begin
162
       gtx_pre_resetn  <= 0;
163
       gtx_resetn      <= 0;
164
     end
165
     else begin
166
       gtx_pre_resetn  <= 1;
167
       gtx_resetn      <= gtx_pre_resetn;
168
     end
169
   end
170
 
171
  //---------------
172
  // data check reset
173
   tri_mode_ethernet_mac_0_reset_sync chk_reset_gen (
174
 
175
      .clk              (gtx_clk),
176
 
177
      .enable           (dcm_locked_sync),
178
      .reset_in         (glbl_rst || reset_error),
179
      .reset_out        (chk_reset_int)
180
   );
181
 
182
 
183
   // Create fully synchronous reset in the gtx_clk domain.
184
   always @(posedge gtx_clk)
185
 
186
   begin
187
     if (chk_reset_int) begin
188
       chk_pre_resetn  <= 0;
189
       chk_resetn      <= 0;
190
     end
191
     else begin
192
       chk_pre_resetn  <= 1;
193
       chk_resetn      <= chk_pre_resetn;
194
     end
195
   end
196
 
197
 
198
   //---------------
199
   // PHY reset
200
   // the phy reset output (active low) needs to be held for at least 10x25MHZ cycles
201
   // this is derived using the 125MHz available and a 6 bit counter
202
   always @(posedge gtx_clk)
203
   begin
204
      if (glbl_rst_int) begin
205
         phy_resetn_int <= 0;
206
         phy_reset_count <= 0;
207
      end
208
      else begin
209
         if (!(&phy_reset_count)) begin
210
            phy_reset_count <= phy_reset_count + 1;
211
         end
212
         else begin
213
            phy_resetn_int <= 1;
214
         end
215
      end
216
   end
217
 
218
   assign phy_resetn = phy_resetn_int;
219
 
220
endmodule

powered by: WebSVN 2.1.0

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