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_bram_top_v6.vhd] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 barabba
 
2
-------------------------------------------------------------------------------
3
--
4
-- (c) Copyright 2009-2011 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    : Virtex-6 Integrated Block for PCI Express
52
-- File       : pcie_bram_top_v6.vhd
53
-- Version    : 1.7
54
---- Description: BlockRAM top level module for Virtex6 PCIe Block
55
----
56
----
57
----
58
----------------------------------------------------------------------------------
59
 
60
library ieee;
61
   use ieee.std_logic_1164.all;
62
   use ieee.std_logic_unsigned.all;
63
 
64
entity pcie_bram_top_v6 is
65
   generic (
66
      DEV_CAP_MAX_PAYLOAD_SUPPORTED                : integer := 0;
67
 
68
      VC0_TX_LASTPACKET                            : integer := 31;
69
      TLM_TX_OVERHEAD                              : integer := 24;
70
      TL_TX_RAM_RADDR_LATENCY                      : integer := 1;
71
      TL_TX_RAM_RDATA_LATENCY                      : integer := 2;
72
      TL_TX_RAM_WRITE_LATENCY                      : integer := 1;
73
 
74
      VC0_RX_LIMIT                                 : bit_vector := x"1FFF";
75
      TL_RX_RAM_RADDR_LATENCY                      : integer := 1;
76
      TL_RX_RAM_RDATA_LATENCY                      : integer := 2;
77
      TL_RX_RAM_WRITE_LATENCY                      : integer := 1
78
 
79
   );
80
   port (
81
      user_clk_i                                   : in std_logic;
82
      reset_i                                      : in std_logic;
83
      mim_tx_wen                                   : in std_logic;
84
      mim_tx_waddr                                 : in std_logic_vector(12 downto 0);
85
      mim_tx_wdata                                 : in std_logic_vector(71 downto 0);
86
      mim_tx_ren                                   : in std_logic;
87
      mim_tx_rce                                   : in std_logic;
88
      mim_tx_raddr                                 : in std_logic_vector(12 downto 0);
89
      mim_tx_rdata                                 : out std_logic_vector(71 downto 0);
90
      mim_rx_wen                                   : in std_logic;
91
      mim_rx_waddr                                 : in std_logic_vector(12 downto 0);
92
      mim_rx_wdata                                 : in std_logic_vector(71 downto 0);
93
      mim_rx_ren                                   : in std_logic;
94
      mim_rx_rce                                   : in std_logic;
95
      mim_rx_raddr                                 : in std_logic_vector(12 downto 0);
96
      mim_rx_rdata                                 : out std_logic_vector(71 downto 0)
97
   );
98
end pcie_bram_top_v6;
99
 
100
architecture v6_pcie of pcie_bram_top_v6 is
101
 
102
  component pcie_brams_v6
103
    generic (
104
      NUM_BRAMS         : integer;
105
      RAM_RADDR_LATENCY : integer;
106
      RAM_RDATA_LATENCY : integer;
107
      RAM_WRITE_LATENCY : integer);
108
    port (
109
      user_clk_i : in  std_logic;
110
      reset_i    : in  std_logic;
111
      wen        : in  std_logic;
112
      waddr      : in  std_logic_vector(12 downto 0);
113
      wdata      : in  std_logic_vector(71 downto 0);
114
      ren        : in  std_logic;
115
      rce        : in  std_logic;
116
      raddr      : in  std_logic_vector(12 downto 0);
117
      rdata      : out std_logic_vector(71 downto 0));
118
  end component;
119
 
120
  -- TX calculations
121
  function cols_tx (
122
    constant CMPS                : integer;
123
    constant VC0_TX_LASTPACKET   : integer;
124
    constant TLM_TX_OVERHEAD     : integer)
125
    return integer is
126
     variable MPS_BYTES : integer := 128;
127
     variable BYTES_TX : integer := 0;
128
     variable COLS_TX : integer := 1;
129
  begin  -- cols_tx
130
 
131
    if (cmps = 0) then
132
      MPS_BYTES := 128;
133
    elsif (cmps = 1) then
134
      MPS_BYTES := 256;
135
    elsif (cmps = 2) then
136
      MPS_BYTES := 512;
137
    else
138
      MPS_BYTES := 1024;
139
    end if;
140
    BYTES_TX := ((VC0_TX_LASTPACKET + 1) * (MPS_BYTES + TLM_TX_OVERHEAD));
141
    if (BYTES_TX <= 4096) then
142
      COLS_TX := 1;
143
    elsif (BYTES_TX <= 8192) then
144
      COLS_TX := 2;
145
    elsif (BYTES_TX <= 16384) then
146
      COLS_TX := 4;
147
    elsif (BYTES_TX <= 32768) then
148
      COLS_TX := 8;
149
    else
150
      COLS_TX := 18;
151
    end if;
152
    return COLS_TX;
153
  end cols_tx;
154
 
155
  FUNCTION to_integer (
156
      val_in    : bit_vector) RETURN integer IS
157
 
158
      CONSTANT vctr   : bit_vector(val_in'high-val_in'low DOWNTO 0) := val_in;
159
      VARIABLE ret    : integer := 0;
160
   BEGIN
161
      FOR index IN vctr'RANGE LOOP
162
         IF (vctr(index) = '1') THEN
163
            ret := ret + (2**index);
164
         END IF;
165
      END LOOP;
166
      RETURN(ret);
167
   END to_integer;
168
 
169
  -- RX calculations
170
  function cols_rx (
171
    constant VC0_RX_LIMIT   : integer)
172
    return integer is
173
     variable COLS_RX : integer := 1;
174
  begin  -- cols_rx
175
 
176
    if (VC0_RX_LIMIT < 512) then        -- X"0200"
177
      COLS_RX := 1;
178
    elsif (VC0_RX_LIMIT < 1024) then    -- X"0400"
179
      COLS_RX := 2;
180
    elsif (VC0_RX_LIMIT < 2048) then    -- X"0800"
181
      COLS_RX := 4;
182
    elsif (VC0_RX_LIMIT < 4096) then    -- X"1000"
183
      COLS_RX := 8;
184
    else
185
      COLS_RX := 18;
186
    end if;
187
    return COLS_RX;
188
  end cols_rx;
189
 
190
 
191
   constant ROWS_TX                                : integer := 1;
192
 
193
   constant ROWS_RX                                : integer := 1;
194
 
195
   -- Declare intermediate signals for referenced outputs
196
   signal mim_tx_rdata_v6pcie1                     : std_logic_vector(71 downto 0);
197
   signal mim_rx_rdata_v6pcie0                     : std_logic_vector(71 downto 0);
198
 
199
begin
200
   -- Drive referenced outputs
201
   mim_tx_rdata <= mim_tx_rdata_v6pcie1;
202
   mim_rx_rdata <= mim_rx_rdata_v6pcie0;
203
 
204
--   process 
205
--   begin
206
--      -- $display("[%t] %m ROWS_TX %0d COLS_TX %0d", now, to_stdlogic(ROWS_TX), to_stdlogicvector(COLS_TX, 13));
207
--      -- $display("[%t] %m ROWS_RX %0d COLS_RX %0d", now, to_stdlogic(ROWS_RX), to_stdlogicvector(COLS_RX, 13));
208
--      wait;
209
--   end process;
210
 
211
 
212
   pcie_brams_tx : pcie_brams_v6
213
      generic map (
214
         NUM_BRAMS          => cols_tx(DEV_CAP_MAX_PAYLOAD_SUPPORTED, VC0_TX_LASTPACKET, TLM_TX_OVERHEAD),
215
         RAM_RADDR_LATENCY  => TL_TX_RAM_RADDR_LATENCY,
216
         RAM_RDATA_LATENCY  => TL_TX_RAM_RDATA_LATENCY,
217
         RAM_WRITE_LATENCY  => TL_TX_RAM_WRITE_LATENCY
218
      )
219
      port map (
220
         user_clk_i  => user_clk_i,
221
         reset_i     => reset_i,
222
 
223
         waddr       => mim_tx_waddr,
224
         wen         => mim_tx_wen,
225
         ren         => mim_tx_ren,
226
         rce         => mim_tx_rce,
227
         wdata       => mim_tx_wdata,
228
         raddr       => mim_tx_raddr,
229
         rdata       => mim_tx_rdata_v6pcie1
230
      );
231
 
232
 
233
 
234
   pcie_brams_rx : pcie_brams_v6
235
      generic map (
236
         NUM_BRAMS          => cols_rx(to_integer(VC0_RX_LIMIT)),
237
         RAM_RADDR_LATENCY  => TL_RX_RAM_RADDR_LATENCY,
238
         RAM_RDATA_LATENCY  => TL_RX_RAM_RDATA_LATENCY,
239
         RAM_WRITE_LATENCY  => TL_RX_RAM_WRITE_LATENCY
240
      )
241
      port map (
242
         user_clk_i  => user_clk_i,
243
         reset_i     => reset_i,
244
 
245
         waddr       => mim_rx_waddr,
246
         wen         => mim_rx_wen,
247
         ren         => mim_rx_ren,
248
         rce         => mim_rx_rce,
249
         wdata       => mim_rx_wdata,
250
         raddr       => mim_rx_raddr,
251
         rdata       => mim_rx_rdata_v6pcie0
252
      );
253
 
254
end v6_pcie;
255
 
256
 
257
 
258
-- pcie_bram_top

powered by: WebSVN 2.1.0

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