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

Subversion Repositories pcie_ds_dma

[/] [pcie_ds_dma/] [trunk/] [core/] [ds_dma64/] [pcie_src/] [pcie_core64_m1/] [source/] [tx_sync_gtp.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dsmv
 
2
//-----------------------------------------------------------------------------
3
//
4
// (c) Copyright 2009-2010 Xilinx, Inc. All rights reserved.
5
//
6
// This file contains confidential and proprietary information
7
// of Xilinx, Inc. and is protected under U.S. and
8
// international copyright and other intellectual property
9
// laws.
10
//
11
// DISCLAIMER
12
// This disclaimer is not a license and does not grant any
13
// rights to the materials distributed herewith. Except as
14
// otherwise provided in a valid license issued to you by
15
// Xilinx, and to the maximum extent permitted by applicable
16
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
17
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
18
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
19
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
20
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
21
// (2) Xilinx shall not be liable (whether in contract or tort,
22
// including negligence, or under any other theory of
23
// liability) for any loss or damage of any kind or nature
24
// related to, arising under or in connection with these
25
// materials, including for any direct, or any indirect,
26
// special, incidental, or consequential loss or damage
27
// (including loss of data, profits, goodwill, or any type of
28
// loss or damage suffered as a result of any action brought
29
// by a third party) even if such damage or loss was
30
// reasonably foreseeable or Xilinx had been advised of the
31
// possibility of the same.
32
//
33
// CRITICAL APPLICATIONS
34
// Xilinx products are not designed or intended to be fail-
35
// safe, or for use in any application requiring fail-safe
36
// performance, such as life-support or safety devices or
37
// systems, Class III medical devices, nuclear facilities,
38
// applications related to the deployment of airbags, or any
39
// other applications that could lead to death, personal
40
// injury, or severe property or environmental damage
41
// (individually and collectively, "Critical
42
// Applications"). Customer assumes the sole risk and
43
// liability of any use of Xilinx products in Critical
44
// Applications, subject only to applicable laws and
45
// regulations governing limitations on product liability.
46
//
47
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
48
// PART OF THIS FILE AT ALL TIMES.
49
//
50
//-----------------------------------------------------------------------------
51
// Project    : V5-Block Plus for PCI Express
52
// File       : tx_sync_gtp.v
53
//--------------------------------------------------------------------------------
54
//--------------------------------------------------------------------------------
55
//----------------------------------------------------------------------
56
//   ____  ____ 
57
//  /   /\/   / 
58
// /___/  \  /    Vendor: Xilinx 
59
// \   \   \/     Version : 1.4
60
//  \   \         Application : GTP Wizard 
61
//  /   /         Filename : tx_sync.v
62
// /___/   /\     Timestamp : 
63
// \   \  /  \ 
64
//  \___\/\___\ 
65
//
66
//
67
// Module TX_SYNC
68
// Generated by Xilinx GTP Wizard
69
 
70
`timescale 1ns / 1ps
71
`define DLY #1
72
 
73
module TX_SYNC_GTP
74
(
75
    output          TXENPMAPHASEALIGN,
76
    output          TXPMASETPHASE,
77
    output          SYNC_DONE,
78
    input           USER_CLK,
79
    input           RESET
80
 
81
);
82
 
83
//*******************************Register Declarations************************
84
 
85
    reg            begin_r;
86
    reg            phase_align_r;
87
    reg            ready_r;
88
    reg   [14:0]   sync_counter_r;
89
    reg   [9:0]    wait_before_sync_r;
90
    reg            wait_stable_r;
91
 
92
//*******************************Wire Declarations****************************
93
 
94
    wire           count_512_complete_r;
95
    wire           next_phase_align_c;
96
    wire           next_ready_c;
97
    wire           next_wait_stable_c;
98
    wire           sync_count_complete_r;
99
 
100
//*******************************Main Body of Code****************************
101
 
102
    //________________________________ State machine __________________________    
103
    // This state machine manages the phase alingnment procedure of the GTP.
104
    // The module is held in reset till the usrclk source is stable.In the 
105
    // case of buffer bypass where the refclkout is used to clock the usrclks,
106
    // the usrclk stable indication is given the pll_locked signal.
107
    // Once the pll_lock is asserted, state machine goes into the wait_stable_r
108
    // for 512 cycles to allow some time to ensure the pll is stable. After this, 
109
    // it goes into the phase_align_r state where the phase alignment procedure is 
110
    // executed. This involves asserting the TXENPHASEALIGN and TXPMASETPHASE for 
111
    // the recommended number of clock cycles
112
 
113
    // State registers
114
    always @(posedge USER_CLK)
115
        if(RESET)
116
            {begin_r,wait_stable_r,phase_align_r,ready_r}  <=  `DLY    4'b1000;
117
        else
118
        begin
119
            begin_r                <=  `DLY    1'b0;
120
            wait_stable_r          <=  `DLY    next_wait_stable_c;
121
            phase_align_r          <=  `DLY    next_phase_align_c;
122
            ready_r                <=  `DLY    next_ready_c;
123
        end
124
 
125
    // Next state logic
126
    assign  next_wait_stable_c      =   begin_r |
127
                                        (wait_stable_r & !count_512_complete_r);
128
 
129
    assign  next_phase_align_c      =   (wait_stable_r & count_512_complete_r) |
130
                                        (phase_align_r & !sync_count_complete_r);
131
 
132
 
133
    assign  next_ready_c            =   (phase_align_r & sync_count_complete_r) |
134
                                        ready_r;
135
 
136
 
137
 
138
    //_________ Counter for to wait for pll to be stable before sync __________
139
    always @(posedge USER_CLK)
140
    begin
141
        if (!wait_stable_r)
142
            wait_before_sync_r <= `DLY  10'b000000000;
143
        else
144
            wait_before_sync_r <= `DLY  wait_before_sync_r + 1'b1;
145
    end
146
 
147
    assign count_512_complete_r = wait_before_sync_r[9];
148
 
149
    //_______________ Counter for holding SYNC for SYNC_CYCLES ________________
150
    always @(posedge USER_CLK)
151
    begin
152
        if (!phase_align_r)
153
            sync_counter_r <= `DLY  15'b000000000000000;
154
        else
155
            sync_counter_r <= `DLY  sync_counter_r + 1'b1;
156
    end
157
 
158
    assign sync_count_complete_r = sync_counter_r[12];
159
 
160
    //_______________ Assign the phase align ports into the GTP _______________
161
 
162
    assign TXENPMAPHASEALIGN = !begin_r;
163
    assign TXPMASETPHASE     = phase_align_r;
164
 
165
    //_______________________ Assign the sync_done port _______________________
166
 
167
    assign SYNC_DONE = ready_r;
168
 
169
 
170
endmodule

powered by: WebSVN 2.1.0

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