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/] [tmp/] [backup_v6_pcie_v1_6/] [v6_pcie_v1_6/] [example_design/] [PIO_TX_ENGINE.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-2010 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       : PIO_TX_ENGINE.vhd
52
-- Version    : 1.6
53
----
54
---- Description: 64 bit Local-Link Transmit Unit.
55
----
56
----------------------------------------------------------------------------------
57
 
58
library ieee;
59
use ieee.std_logic_1164.all;
60
 
61
entity PIO_TX_ENGINE is port (
62
 
63
  clk                      : in std_logic;
64
  rst_n                    : in std_logic;
65
 
66
  trn_td                   : out std_logic_vector( 63 downto 0);
67
  trn_trem_n               : out std_logic_vector(7 downto 0);
68
  trn_tsof_n               : out std_logic;
69
  trn_teof_n               : out std_logic;
70
  trn_tsrc_rdy_n           : out std_logic;
71
  trn_tsrc_dsc_n           : out std_logic;
72
  trn_tdst_rdy_n           : in std_logic;
73
  trn_tdst_dsc_n           : in std_logic;
74
 
75
  req_compl_i              : in std_logic;
76
  compl_done_o             : out std_logic;
77
 
78
  req_tc_i                 : in std_logic_vector(2 downto 0);
79
  req_td_i                 : in std_logic;
80
  req_ep_i                 : in std_logic;
81
  req_attr_i               : in std_logic_vector(1 downto 0);
82
  req_len_i                : in std_logic_vector(9 downto 0);
83
  req_rid_i                : in std_logic_vector(15 downto 0);
84
  req_tag_i                : in std_logic_vector(7 downto 0);
85
  req_be_i                 : in std_logic_vector(7 downto 0);
86
  req_addr_i               : in std_logic_vector(12 downto 0);
87
 
88
  rd_addr_o                : out std_logic_vector(10 downto 0);
89
  rd_be_o                  : out std_logic_vector( 3 downto 0);
90
  rd_data_i                : in std_logic_vector(31 downto 0);
91
 
92
  completer_id_i           : in std_logic_vector(15 downto 0);
93
  cfg_bus_mstr_enable_i    : in std_logic
94
 
95
);
96
 
97
end PIO_TX_ENGINE;
98
 
99
architecture rtl of PIO_TX_ENGINE is
100
 
101
constant TX_CPLD_FMT_TYPE    : std_logic_vector(6 downto 0) := "1001010";
102
 
103
type state_type is (TX_RST_STATE, TX_CPLD_QW1 );
104
 
105
signal state              : state_type;
106
signal byte_count     : std_logic_vector(11 downto 0);
107
signal lower_addr     : std_logic_vector(6 downto 0);
108
signal rd_be_o_int    : std_logic_vector(3 downto 0);
109
signal req_compl_q    : std_logic;
110
 
111
 
112
-- Local wires
113
 
114
begin
115
 
116
  trn_tsrc_dsc_n   <= '1';
117
  rd_be_o <= rd_be_o_int;
118
 
119
  -- Present address and byte enable to memory module
120
 
121
  rd_addr_o <= req_addr_i(12 downto 2);
122
  rd_be_o_int  <=  req_be_i(3 downto 0);
123
 
124
-- Calculate byte count based on byte enable
125
 
126
process(rd_be_o_int)
127
begin
128
 
129
  case  rd_be_o_int(3 downto 0) is
130
 
131
    when X"9" => byte_count <= X"004";
132
    when X"B" => byte_count <= X"004";
133
    when X"D" => byte_count <= X"004";
134
    when X"F" => byte_count <= X"004";
135
    when X"5" => byte_count <= X"003";
136
    when X"7" => byte_count <= X"003";
137
    when X"A" => byte_count <= X"003";
138
    when X"E" => byte_count <= X"003";
139
    when X"3" => byte_count <= X"002";
140
    when X"6" => byte_count <= X"002";
141
    when X"C" => byte_count <= X"002";
142
    when X"1" => byte_count <= X"001";
143
    when X"2" => byte_count <= X"001";
144
    when X"4" => byte_count <= X"001";
145
    when X"8" => byte_count <= X"001";
146
    when X"0" => byte_count <= X"001";
147
    when others => byte_count <= X"001";
148
 
149
  end case;
150
 
151
end process;
152
 
153
-- Calculate lower address based on  byte enable
154
 
155
process(rd_be_o_int, req_addr_i)
156
begin
157
 
158
   if (rd_be_o_int(0) = '1') then
159
 
160
 
161
      -- when "---1"
162
      lower_addr <= req_addr_i(6 downto 2) & "00";
163
 
164
   elsif (rd_be_o_int(1) = '1') then
165
 
166
      -- when "--10"
167
      lower_addr <= req_addr_i(6 downto 2) & "01";
168
 
169
   elsif (rd_be_o_int(2) = '1') then
170
 
171
      -- when "-100"
172
      lower_addr <= req_addr_i(6 downto 2) & "10";
173
 
174
   elsif (rd_be_o_int(3) = '1') then
175
 
176
      -- when "1000"
177
      lower_addr <= req_addr_i(6 downto 2) & "11";
178
 
179
   else
180
 
181
      -- when "0000"
182
      lower_addr <= req_addr_i(6 downto 2) & "00";
183
 
184
   end if;
185
 
186
 
187
end process;
188
 
189
 
190
process (rst_n, clk)
191
begin
192
 
193
  if (rst_n = '0') then
194
 
195
    req_compl_q <= '0';
196
 
197
  else
198
 
199
    if (clk'event and clk = '1') then
200
 
201
      req_compl_q <= req_compl_i;
202
 
203
    end if;
204
 
205
  end if;
206
 
207
end process;
208
 
209
 
210
--  State Machine to generate Completion with 1 DW Payload or Completion without Data
211
 
212
process (rst_n, clk)
213
begin
214
 
215
  if (rst_n = '0' ) then
216
 
217
    trn_tsof_n        <= '1';
218
    trn_teof_n        <= '1';
219
    trn_tsrc_rdy_n    <= '1';
220
    trn_td            <= (others => '0'); -- 64-bits
221
    trn_trem_n    <= (others => '0'); -- 8-bits
222
    compl_done_o      <= '0';
223
    state             <= TX_RST_STATE;
224
 
225
  else
226
 
227
    if (clk'event and clk = '1') then
228
 
229
      compl_done_o      <= '0';
230
 
231
      case ( state ) is
232
 
233
        when TX_RST_STATE =>
234
 
235
          if ((trn_tdst_rdy_n = '0') and (req_compl_q = '1') and (trn_tdst_dsc_n = '1')) then
236
 
237
            trn_tsof_n       <= '0';
238
            trn_teof_n       <= '1';
239
            trn_tsrc_rdy_n   <= '0';
240
            trn_td           <= '0' &
241
                                TX_CPLD_FMT_TYPE &
242
                                '0' &
243
                                req_tc_i &
244
                                "0000" &
245
                                req_td_i &
246
                                req_ep_i &
247
                                req_attr_i &
248
                                "00" &
249
                                req_len_i &
250
                                completer_id_i &
251
                                "000" &
252
                                '0' &
253
                                byte_count;
254
            trn_trem_n       <= (others => '0'); -- 8-bit
255
            state            <= TX_CPLD_QW1;
256
 
257
         else
258
 
259
            trn_tsof_n       <= '1';
260
            trn_teof_n       <= '1';
261
            trn_tsrc_rdy_n   <= '1';
262
            trn_td           <= (others => '0'); -- 64-bit
263
            trn_trem_n       <= (others => '0'); -- 8-bit
264
            compl_done_o     <= '0';
265
            state            <= TX_RST_STATE;
266
 
267
          end if;
268
 
269
 
270
        when TX_CPLD_QW1 =>
271
 
272
          if ((trn_tdst_rdy_n = '0') and (trn_tdst_dsc_n = '1')) then
273
 
274
            trn_tsof_n       <= '1';
275
            trn_teof_n       <= '0';
276
            trn_tsrc_rdy_n   <= '0';
277
            trn_td           <= req_rid_i &
278
                                req_tag_i &
279
                                '0' &
280
                                lower_addr &
281
                                rd_data_i;
282
            trn_trem_n       <= "00000000";
283
            compl_done_o     <= '1';
284
            state            <= TX_RST_STATE;
285
 
286
          elsif (trn_tdst_dsc_n = '0') then
287
 
288
            state            <= TX_RST_STATE;
289
 
290
 
291
          else
292
 
293
            state           <= TX_CPLD_QW1;
294
 
295
          end if;
296
 
297
        when others => NULL;
298
 
299
      end case;
300
 
301
    end if;
302
 
303
  end if;
304
 
305
end process;
306
 
307
end; -- PIO_TX_ENGINE
308
 

powered by: WebSVN 2.1.0

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