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

Subversion Repositories pcie_sg_dma

[/] [pcie_sg_dma/] [branches/] [Virtex6/] [ML605_ISE13.3/] [ipcore_dir_ISE13.3/] [v6_pcie_v1_7_x4/] [source/] [pcie_upconfig_fix_3451_v6.vhd] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 barabba
-------------------------------------------------------------------------------
2
--
3
-- (c) Copyright 2009-2011 Xilinx, Inc. All rights reserved.
4
--
5
-- This file contains confidential and proprietary information
6
-- of Xilinx, Inc. and is protected under U.S. and
7
-- international copyright and other intellectual property
8
-- laws.
9
--
10
-- DISCLAIMER
11
-- This disclaimer is not a license and does not grant any
12
-- rights to the materials distributed herewith. Except as
13
-- otherwise provided in a valid license issued to you by
14
-- Xilinx, and to the maximum extent permitted by applicable
15
-- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
16
-- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
17
-- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
18
-- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
19
-- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
20
-- (2) Xilinx shall not be liable (whether in contract or tort,
21
-- including negligence, or under any other theory of
22
-- liability) for any loss or damage of any kind or nature
23
-- related to, arising under or in connection with these
24
-- materials, including for any direct, or any indirect,
25
-- special, incidental, or consequential loss or damage
26
-- (including loss of data, profits, goodwill, or any type of
27
-- loss or damage suffered as a result of any action brought
28
-- by a third party) even if such damage or loss was
29
-- reasonably foreseeable or Xilinx had been advised of the
30
-- possibility of the same.
31
--
32
-- CRITICAL APPLICATIONS
33
-- Xilinx products are not designed or intended to be fail-
34
-- safe, or for use in any application requiring fail-safe
35
-- performance, such as life-support or safety devices or
36
-- systems, Class III medical devices, nuclear facilities,
37
-- applications related to the deployment of airbags, or any
38
-- other applications that could lead to death, personal
39
-- injury, or severe property or environmental damage
40
-- (individually and collectively, "Critical
41
-- Applications"). Customer assumes the sole risk and
42
-- liability of any use of Xilinx products in Critical
43
-- Applications, subject only to applicable laws and
44
-- regulations governing limitations on product liability.
45
--
46
-- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
47
-- PART OF THIS FILE AT ALL TIMES.
48
--
49
-------------------------------------------------------------------------------
50
-- Project    : Virtex-6 Integrated Block for PCI Express
51
-- File       : pcie_upconfig_fix_3451_v6.vhd
52
-- Version    : 1.7
53
---- Description: Virtex6 Workaround for Root Port Upconfigurability Bug
54
----
55
----
56
----------------------------------------------------------------------------------
57
 
58
library ieee;
59
   use ieee.std_logic_1164.all;
60
   use ieee.std_logic_unsigned.all;
61
 
62
entity pcie_upconfig_fix_3451_v6 is
63
   generic (
64
 
65
      UPSTREAM_FACING                              : boolean := TRUE;
66
      PL_FAST_TRAIN                                : boolean := FALSE;
67
      LINK_CAP_MAX_LINK_WIDTH                      : bit_vector := X"08"
68
   );
69
   port (
70
      pipe_clk                                     : in std_logic;
71
      pl_phy_lnkup_n                               : in std_logic;
72
      pl_ltssm_state                               : in std_logic_vector(5 downto 0);
73
      pl_sel_lnk_rate                              : in std_logic;
74
      pl_directed_link_change                      : in std_logic_vector(1 downto 0);
75
      cfg_link_status_negotiated_width             : in std_logic_vector(3 downto 0);
76
      pipe_rx0_data                                : in std_logic_vector(15 downto 0);
77
      pipe_rx0_char_isk                            : in std_logic_vector(1 downto 0);
78
      filter_pipe                                  : out std_logic
79
   );
80
end pcie_upconfig_fix_3451_v6;
81
 
82
architecture v6_pcie of pcie_upconfig_fix_3451_v6 is
83
 
84
  -- purpose: perform bitwise and and check for value 
85
  function slv_check (
86
    val_in1   : std_logic_vector(7 downto 0);
87
    val_in2   : std_logic_vector(7 downto 0);
88
    val_check : std_logic_vector(7 downto 0))
89
    return std_logic is
90
 
91
    variable val_bw : std_logic_vector(7 downto 0) := X"00";
92
  begin  -- slv_check
93
    for i in 7 downto 0 loop
94
      val_bw(i) := val_in1(i) and val_in2(i);
95
    end loop;  -- i
96
    if val_bw = val_check then
97
      return '1';
98
    else
99
      return '0';
100
    end if;
101
  end slv_check;
102
 
103
  FUNCTION to_stdlogic (
104
    in_val      : IN boolean) RETURN std_logic IS
105
  BEGIN
106
    IF (in_val) THEN
107
      RETURN('1');
108
    ELSE
109
      RETURN('0');
110
    END IF;
111
  END to_stdlogic;
112
 
113
 
114
   constant TCQ                                    : integer := 1;
115
   signal reg_filter_pipe                          : std_logic;
116
 
117
   signal reg_tsx_counter                          : std_logic_vector(15 downto 0);
118
   signal tsx_counter                              : std_logic_vector(15 downto 0);
119
 
120
   signal cap_link_width                           : std_logic_vector(5 downto 0);
121
 
122
   signal reg_filter_used                          : std_logic;
123
   signal reg_com_then_pad                         : std_logic;
124
   signal reg_data0_b4                             : std_logic;
125
   signal reg_data0_08                             : std_logic;
126
   signal reg_data0_43                             : std_logic;
127
   signal reg_data1_b4                             : std_logic;
128
   signal reg_data1_08                             : std_logic;
129
   signal reg_data1_43                             : std_logic;
130
   signal reg_data0_com                            : std_logic;
131
   signal reg_data1_com                            : std_logic;
132
   signal reg_data1_pad                            : std_logic;
133
 
134
   signal data0_b4                                 : std_logic;
135
   signal data0_08                                 : std_logic;
136
   signal data0_43                                 : std_logic;
137
 
138
   signal data1_b4                                 : std_logic;
139
   signal data1_08                                 : std_logic;
140
   signal data1_43                                 : std_logic;
141
 
142
   signal data0_com                                : std_logic;
143
   signal data0_pad                                : std_logic;
144
 
145
   signal data1_com                                : std_logic;
146
   signal data1_pad                                : std_logic;
147
 
148
   signal com_then_pad0                            : std_logic;
149
   signal com_then_pad1                            : std_logic;
150
   signal com_then_pad                             : std_logic;
151
   signal filter_used                              : std_logic;
152
   signal com_then_pad_reg                         : std_logic;
153
   signal filter_used_reg                          : std_logic;
154
 
155
   -- X-HDL generated signals
156
 
157
   signal v6pcie1                                  : std_logic_vector(15 downto 0);
158
   signal v6pcie2                                  : std_logic_vector(15 downto 0);
159
 
160
   -- Declare intermediate signals for referenced outputs
161
   signal filter_pipe_v6pcie0                      : std_logic;
162
 
163
begin
164
   -- Drive referenced outputs
165
   filter_pipe <= filter_pipe_v6pcie0;
166
 
167
   -- Corrupting all Tsx on all lanes as soon as we do R.RC->R.RI transition to allow time for
168
   -- the core to see the TS1s on all the lanes being configured at the same time
169
   -- R.RI has a 2ms timeout.Corrupting tsxs for ~1/4 of that time
170
   -- 225 (00E1 Hex) pipe_clk cycles-sim_fast_train
171
   -- 60000 (EA60 Hex) pipe_clk cycles-without sim_fast_train
172
   -- Not taking any action  when PLDIRECTEDLINKCHANGE is set
173
 
174
   -- Detect xx, COM then PAD,xx or COM,PAD then PAD,xx
175
   -- data0 will be the first symbol on lane 0, data1 will be the next symbol.
176
   --  Don't look for PAD on data1 since it's unnecessary.
177
   -- COM=0xbc and PAD=0xf7 (and isk).
178
   -- detect if (data & 0xb4) == 0xb4 and isk, and then
179
   --  if (data & 0x4b) == 0x08 or 0x43.  This distinguishes COM and PAD, using
180
   --  no more than a 6-input LUT, so should be "free".
181
 
182
   data0_b4 <= pipe_rx0_char_isk(0) and slv_check(pipe_rx0_data(7 downto 0), X"b4", X"b4");
183
   data0_08 <= slv_check(pipe_rx0_data(7 downto 0), X"4b", X"08");
184
   data0_43 <= slv_check(pipe_rx0_data(7 downto 0), X"4b", X"43");
185
 
186
   data1_b4 <= pipe_rx0_char_isk(1) and slv_check(pipe_rx0_data(15 downto 8), X"b4", X"b4");
187
   data1_08 <= slv_check(pipe_rx0_data(15 downto 8), X"4b", X"08");
188
   data1_43 <= slv_check(pipe_rx0_data(15 downto 8), X"4b", X"43");
189
 
190
   data0_com <= reg_data0_b4 and reg_data0_08;
191
   data1_com <= reg_data1_b4 and reg_data1_08;
192
   data0_pad <= reg_data0_b4 and reg_data0_43;
193
   data1_pad <= reg_data1_b4 and reg_data1_43;
194
   com_then_pad0 <= reg_data0_com and reg_data1_pad and data0_pad;
195
   com_then_pad1 <= reg_data1_com and data0_pad and data1_pad;
196
   com_then_pad <= (com_then_pad0 or com_then_pad1) and not(reg_filter_used);
197
 
198
   filter_used <= to_stdlogic(pl_ltssm_state = "100000") and (reg_filter_pipe or reg_filter_used);
199
 
200
   com_then_pad_reg <= com_then_pad when ((not(pl_phy_lnkup_n)) = '1') else
201
                       '0';
202
   filter_used_reg <= filter_used when ((not(pl_phy_lnkup_n)) = '1') else
203
                      '0';
204
   process (pipe_clk)
205
   begin
206
      if (pipe_clk'event and pipe_clk = '1') then
207
         reg_data0_b4 <= data0_b4 after (TCQ)*1 ps;
208
         reg_data0_08 <= data0_08 after (TCQ)*1 ps;
209
         reg_data0_43 <= data0_43 after (TCQ)*1 ps;
210
         reg_data1_b4 <= data1_b4 after (TCQ)*1 ps;
211
         reg_data1_08 <= data1_08 after (TCQ)*1 ps;
212
         reg_data1_43 <= data1_43 after (TCQ)*1 ps;
213
         reg_data0_com <= data0_com after (TCQ)*1 ps;
214
         reg_data1_com <= data1_com after (TCQ)*1 ps;
215
         reg_data1_pad <= data1_pad after (TCQ)*1 ps;
216
         reg_com_then_pad <= com_then_pad_reg after (TCQ)*1 ps;
217
 
218
         reg_filter_used <= filter_used_reg after (TCQ)*1 ps;
219
      end if;
220
   end process;
221
 
222
   v6pcie1 <= X"0320" when (pl_sel_lnk_rate = '1') else
223
              X"0190";
224
   v6pcie2 <= X"00E1" when (PL_FAST_TRAIN) else
225
              v6pcie1;
226
 
227
   process (pipe_clk)
228
   begin
229
      if (pipe_clk'event and pipe_clk = '1') then
230
 
231
        if (pl_phy_lnkup_n = '1') then
232
 
233
          reg_tsx_counter <= "0000000000000000" after (TCQ)*1 ps;
234
          reg_filter_pipe <= '0' after (TCQ)*1 ps;
235
 
236
        elsif ((pl_ltssm_state = "100000") and (reg_com_then_pad = '1') and (("00" & cfg_link_status_negotiated_width) /= cap_link_width(5 downto 0)) and (pl_directed_link_change(1 downto 0) = "00")) then
237
 
238
          reg_tsx_counter <= "0000000000000000" after (TCQ)*1 ps;
239
          reg_filter_pipe <= '1' after (TCQ)*1 ps;
240
 
241
        elsif (filter_pipe_v6pcie0 = '1') then
242
 
243
          if (tsx_counter < v6pcie2) then
244
 
245
            reg_tsx_counter <= tsx_counter + "0000000000000001" after (TCQ)*1 ps;
246
            reg_filter_pipe <= '1' after (TCQ)*1 ps;
247
 
248
          else
249
 
250
            reg_tsx_counter <= "0000000000000000" after (TCQ)*1 ps;
251
            reg_filter_pipe <= '0' after (TCQ)*1 ps;
252
 
253
          end if;
254
        end if;
255
      end if;
256
   end process;
257
 
258
 
259
   filter_pipe_v6pcie0 <= '0' when (UPSTREAM_FACING) else
260
                          reg_filter_pipe;
261
   tsx_counter <= reg_tsx_counter;
262
 
263
   cap_link_width <= to_stdlogicvector(LINK_CAP_MAX_LINK_WIDTH);
264
 
265
end v6_pcie;
266
 
267
 

powered by: WebSVN 2.1.0

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