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_s6/] [pcie_bram_top_s6.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dsmv
-------------------------------------------------------------------------------
2
--
3
-- (c) Copyright 2008, 2009 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    : Spartan-6 Integrated Block for PCI Express
51
-- File       : pcie_bram_top_s6.vhd
52
-- Description: BlockRAM top level module for Spartan-6 PCIe Block
53
--
54
--              Given the selected core configuration, calculate the number of
55
--              BRAMs and pipeline stages and instantiate the BRAMS.
56
--
57
-------------------------------------------------------------------------------
58
 
59
library ieee;
60
use ieee.std_logic_1164.all;
61
use ieee.std_logic_arith.all;
62
use ieee.std_logic_unsigned.all;
63
 
64
entity pcie_bram_top_s6 is
65
  generic (
66
    DEV_CAP_MAX_PAYLOAD_SUPPORTED : integer    := 0;
67
 
68
    VC0_TX_LASTPACKET             : integer    := 31;
69
    TLM_TX_OVERHEAD               : integer    := 20;
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                  : integer    := 16#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
  port (
80
    user_clk_i         : in  std_logic;
81
    reset_i            : in  std_logic;
82
 
83
    mim_tx_wen         : in  std_logic;
84
    mim_tx_waddr       : in  std_logic_vector(11 downto 0);
85
    mim_tx_wdata       : in  std_logic_vector(35 downto 0);
86
    mim_tx_ren         : in  std_logic;
87
    mim_tx_rce         : in  std_logic;
88
    mim_tx_raddr       : in  std_logic_vector(11 downto 0);
89
    mim_tx_rdata       : out std_logic_vector(35 downto 0);
90
 
91
    mim_rx_wen         : in  std_logic;
92
    mim_rx_waddr       : in  std_logic_vector(11 downto 0);
93
    mim_rx_wdata       : in  std_logic_vector(35 downto 0);
94
    mim_rx_ren         : in  std_logic;
95
    mim_rx_rce         : in  std_logic;
96
    mim_rx_raddr       : in  std_logic_vector(11 downto 0);
97
    mim_rx_rdata       : out std_logic_vector(35 downto 0)
98
  );
99
end pcie_bram_top_s6;
100
 
101
architecture rtl of pcie_bram_top_s6 is
102
 
103
  component pcie_brams_s6
104
    generic (
105
      NUM_BRAMS         : integer;
106
      RAM_RADDR_LATENCY : integer;
107
      RAM_RDATA_LATENCY : integer;
108
      RAM_WRITE_LATENCY : integer
109
    );
110
    port (
111
      user_clk_i  : in std_logic;
112
      reset_i     : in std_logic;
113
      wen         : in std_logic;
114
      waddr       : in std_logic_vector(11 downto 0);
115
      wdata       : in std_logic_vector(35 downto 0);
116
      ren         : in std_logic;
117
      rce         : in std_logic;
118
      raddr       : in std_logic_vector(11 downto 0);
119
      rdata       : out std_logic_vector(35 downto 0)
120
    );
121
  end component;
122
 
123
  function CALC_TX_COLS(constant MPS        : in integer;
124
                        constant LASTPACKET : in integer;
125
                        constant OVERHEAD   : in integer
126
                       ) return integer is
127
    variable MPS_BYTES : integer;
128
    variable BYTES_TX  : integer;
129
    variable COLS_TX   : integer;
130
  begin
131
    -- Decode MPS value
132
    if    (MPS = 0) then MPS_BYTES := 128;
133
    elsif (MPS = 1) then MPS_BYTES := 256;
134
    else                 MPS_BYTES := 512; -- MPS = 2
135
    end if;
136
 
137
    -- Calculate total bytes from MPS, number of packets, and overhead
138
    BYTES_TX := (LASTPACKET + 1) * (MPS_BYTES + OVERHEAD);
139
 
140
    -- Determine number of BRAM columns from total bytes
141
    if    (BYTES_TX <= 2048) then COLS_TX := 1;
142
    elsif (BYTES_TX <= 4096) then COLS_TX := 2;
143
    else                          COLS_TX := 4; -- BYTES_TX <= 8192
144
    end if;
145
    return COLS_TX;
146
  end function CALC_TX_COLS;
147
 
148
  function CALC_RX_COLS(constant LIMIT : in integer) return integer is
149
    variable COLS_RX   : integer;
150
  begin
151
    -- Determine number of BRAM columns from total RAM size
152
    if    (LIMIT <=  512) then COLS_RX := 1;
153
    elsif (LIMIT <= 1024) then COLS_RX := 2;
154
    else                       COLS_RX := 4; -- LIMIT <= 2048
155
    end if;
156
    return COLS_RX;
157
  end function CALC_RX_COLS;
158
 
159
begin
160
 
161
   pcie_brams_tx : pcie_brams_s6
162
   generic map(
163
     NUM_BRAMS         => CALC_TX_COLS(DEV_CAP_MAX_PAYLOAD_SUPPORTED, VC0_TX_LASTPACKET, TLM_TX_OVERHEAD),
164
     RAM_RADDR_LATENCY => TL_TX_RAM_RADDR_LATENCY,
165
     RAM_RDATA_LATENCY => TL_TX_RAM_RDATA_LATENCY,
166
     RAM_WRITE_LATENCY => TL_TX_RAM_WRITE_LATENCY
167
   )
168
   port map (
169
     user_clk_i => user_clk_i,
170
     reset_i    => reset_i,
171
 
172
     waddr      => mim_tx_waddr,
173
     wen        => mim_tx_wen,
174
     ren        => mim_tx_ren,
175
     rce        => mim_tx_rce,
176
     wdata      => mim_tx_wdata,
177
     raddr      => mim_tx_raddr,
178
     rdata      => mim_tx_rdata
179
   );
180
 
181
   pcie_brams_rx : pcie_brams_s6
182
   generic map(
183
     NUM_BRAMS         => CALC_RX_COLS(VC0_RX_LIMIT),
184
     RAM_RADDR_LATENCY => TL_RX_RAM_RADDR_LATENCY,
185
     RAM_RDATA_LATENCY => TL_RX_RAM_RDATA_LATENCY,
186
     RAM_WRITE_LATENCY => TL_RX_RAM_WRITE_LATENCY
187
   )
188
   port map (
189
     user_clk_i => user_clk_i,
190
     reset_i    => reset_i,
191
 
192
     waddr      => mim_rx_waddr,
193
     wen        => mim_rx_wen,
194
     ren        => mim_rx_ren,
195
     rce        => mim_rx_rce,
196
     wdata      => mim_rx_wdata,
197
     raddr      => mim_rx_raddr,
198
     rdata      => mim_rx_rdata
199
   );
200
 
201
end rtl;

powered by: WebSVN 2.1.0

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