1 |
11 |
barabba |
|
2 |
|
|
//-----------------------------------------------------------------------------
|
3 |
|
|
//
|
4 |
|
|
// (c) Copyright 2009 Xilinx, Inc. All rights reserved.
|
5 |
|
|
//
|
6 |
|
|
// This file contains confidential and proprietary information of Xilinx, Inc.
|
7 |
|
|
// and is protected under U.S. and international copyright and other
|
8 |
|
|
// intellectual property laws.
|
9 |
|
|
//
|
10 |
|
|
// DISCLAIMER
|
11 |
|
|
//
|
12 |
|
|
// This disclaimer is not a license and does not grant any rights to the
|
13 |
|
|
// materials distributed herewith. Except as otherwise provided in a valid
|
14 |
|
|
// license issued to you by Xilinx, and to the maximum extent permitted by
|
15 |
|
|
// applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL
|
16 |
|
|
// FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS,
|
17 |
|
|
// IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
|
18 |
|
|
// MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE;
|
19 |
|
|
// and (2) Xilinx shall not be liable (whether in contract or tort, including
|
20 |
|
|
// negligence, or under any other theory of liability) for any loss or damage
|
21 |
|
|
// of any kind or nature related to, arising under or in connection with these
|
22 |
|
|
// materials, including for any direct, or any indirect, special, incidental,
|
23 |
|
|
// or consequential loss or damage (including loss of data, profits, goodwill,
|
24 |
|
|
// or any type of loss or damage suffered as a result of any action brought by
|
25 |
|
|
// a third party) even if such damage or loss was reasonably foreseeable or
|
26 |
|
|
// Xilinx had been advised of the possibility of the same.
|
27 |
|
|
//
|
28 |
|
|
// CRITICAL APPLICATIONS
|
29 |
|
|
//
|
30 |
|
|
// Xilinx products are not designed or intended to be fail-safe, or for use in
|
31 |
|
|
// any application requiring fail-safe performance, such as life-support or
|
32 |
|
|
// safety devices or systems, Class III medical devices, nuclear facilities,
|
33 |
|
|
// applications related to the deployment of airbags, or any other
|
34 |
|
|
// applications that could lead to death, personal injury, or severe property
|
35 |
|
|
// or environmental damage (individually and collectively, "Critical
|
36 |
|
|
// Applications"). Customer assumes the sole risk and liability of any use of
|
37 |
|
|
// Xilinx products in Critical Applications, subject only to applicable laws
|
38 |
|
|
// and regulations governing limitations on product liability.
|
39 |
|
|
//
|
40 |
|
|
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE
|
41 |
|
|
// AT ALL TIMES.
|
42 |
|
|
//
|
43 |
|
|
//-----------------------------------------------------------------------------
|
44 |
|
|
// Project : Virtex-6 Integrated Block for PCI Express
|
45 |
|
|
// File : pcie_bram_top_v6.v
|
46 |
|
|
//--
|
47 |
|
|
//-- Description: BlockRAM top level module for Virtex6 PCIe Block
|
48 |
|
|
//--
|
49 |
|
|
//--
|
50 |
|
|
//--
|
51 |
|
|
//--------------------------------------------------------------------------------
|
52 |
|
|
|
53 |
|
|
`timescale 1ns/1ns
|
54 |
|
|
|
55 |
|
|
module pcie_bram_top_v6
|
56 |
|
|
#(
|
57 |
|
|
parameter DEV_CAP_MAX_PAYLOAD_SUPPORTED = 0,
|
58 |
|
|
|
59 |
|
|
parameter VC0_TX_LASTPACKET = 31,
|
60 |
|
|
parameter TLM_TX_OVERHEAD = 24,
|
61 |
|
|
parameter TL_TX_RAM_RADDR_LATENCY = 1,
|
62 |
|
|
parameter TL_TX_RAM_RDATA_LATENCY = 2,
|
63 |
|
|
parameter TL_TX_RAM_WRITE_LATENCY = 1,
|
64 |
|
|
|
65 |
|
|
parameter VC0_RX_LIMIT = 'h1FFF,
|
66 |
|
|
parameter TL_RX_RAM_RADDR_LATENCY = 1,
|
67 |
|
|
parameter TL_RX_RAM_RDATA_LATENCY = 2,
|
68 |
|
|
parameter TL_RX_RAM_WRITE_LATENCY = 1
|
69 |
|
|
)
|
70 |
|
|
(
|
71 |
|
|
input user_clk_i,
|
72 |
|
|
input reset_i,
|
73 |
|
|
|
74 |
|
|
input mim_tx_wen,
|
75 |
|
|
input [12:0] mim_tx_waddr,
|
76 |
|
|
input [71:0] mim_tx_wdata,
|
77 |
|
|
input mim_tx_ren,
|
78 |
|
|
input mim_tx_rce,
|
79 |
|
|
input [12:0] mim_tx_raddr,
|
80 |
|
|
output [71:0] mim_tx_rdata,
|
81 |
|
|
|
82 |
|
|
input mim_rx_wen,
|
83 |
|
|
input [12:0] mim_rx_waddr,
|
84 |
|
|
input [71:0] mim_rx_wdata,
|
85 |
|
|
input mim_rx_ren,
|
86 |
|
|
input mim_rx_rce,
|
87 |
|
|
input [12:0] mim_rx_raddr,
|
88 |
|
|
output [71:0] mim_rx_rdata
|
89 |
|
|
);
|
90 |
|
|
|
91 |
|
|
// TX calculations
|
92 |
|
|
localparam MPS_BYTES = ((DEV_CAP_MAX_PAYLOAD_SUPPORTED == 0) ? 128 :
|
93 |
|
|
(DEV_CAP_MAX_PAYLOAD_SUPPORTED == 1) ? 256 :
|
94 |
|
|
(DEV_CAP_MAX_PAYLOAD_SUPPORTED == 2) ? 512 :
|
95 |
|
|
1024 );
|
96 |
|
|
|
97 |
|
|
localparam BYTES_TX = (VC0_TX_LASTPACKET + 1) * (MPS_BYTES + TLM_TX_OVERHEAD);
|
98 |
|
|
|
99 |
|
|
localparam ROWS_TX = 1;
|
100 |
|
|
localparam COLS_TX = ((BYTES_TX <= 4096) ? 1 :
|
101 |
|
|
(BYTES_TX <= 8192) ? 2 :
|
102 |
|
|
(BYTES_TX <= 16384) ? 4 :
|
103 |
|
|
(BYTES_TX <= 32768) ? 8 :
|
104 |
|
|
18
|
105 |
|
|
);
|
106 |
|
|
|
107 |
|
|
// RX calculations
|
108 |
|
|
localparam ROWS_RX = 1;
|
109 |
|
|
|
110 |
|
|
localparam COLS_RX = ((VC0_RX_LIMIT < 'h0200) ? 1 :
|
111 |
|
|
(VC0_RX_LIMIT < 'h0400) ? 2 :
|
112 |
|
|
(VC0_RX_LIMIT < 'h0800) ? 4 :
|
113 |
|
|
(VC0_RX_LIMIT < 'h1000) ? 8 :
|
114 |
|
|
18
|
115 |
|
|
);
|
116 |
|
|
|
117 |
|
|
initial begin
|
118 |
|
|
$display("[%t] %m ROWS_TX %0d COLS_TX %0d", $time, ROWS_TX, COLS_TX);
|
119 |
|
|
$display("[%t] %m ROWS_RX %0d COLS_RX %0d", $time, ROWS_RX, COLS_RX);
|
120 |
|
|
end
|
121 |
|
|
|
122 |
|
|
pcie_brams_v6 #(.NUM_BRAMS (COLS_TX),
|
123 |
|
|
.RAM_RADDR_LATENCY(TL_TX_RAM_RADDR_LATENCY),
|
124 |
|
|
.RAM_RDATA_LATENCY(TL_TX_RAM_RDATA_LATENCY),
|
125 |
|
|
.RAM_WRITE_LATENCY(TL_TX_RAM_WRITE_LATENCY))
|
126 |
|
|
pcie_brams_tx
|
127 |
|
|
(
|
128 |
|
|
.user_clk_i(user_clk_i),
|
129 |
|
|
.reset_i(reset_i),
|
130 |
|
|
|
131 |
|
|
.waddr(mim_tx_waddr),
|
132 |
|
|
.wen(mim_tx_wen),
|
133 |
|
|
.ren(mim_tx_ren),
|
134 |
|
|
.rce(mim_tx_rce),
|
135 |
|
|
.wdata(mim_tx_wdata),
|
136 |
|
|
.raddr(mim_tx_raddr),
|
137 |
|
|
.rdata(mim_tx_rdata)
|
138 |
|
|
);
|
139 |
|
|
|
140 |
|
|
pcie_brams_v6 #(.NUM_BRAMS (COLS_RX),
|
141 |
|
|
.RAM_RADDR_LATENCY(TL_RX_RAM_RADDR_LATENCY),
|
142 |
|
|
.RAM_RDATA_LATENCY(TL_RX_RAM_RDATA_LATENCY),
|
143 |
|
|
.RAM_WRITE_LATENCY(TL_RX_RAM_WRITE_LATENCY))
|
144 |
|
|
pcie_brams_rx
|
145 |
|
|
(
|
146 |
|
|
.user_clk_i(user_clk_i),
|
147 |
|
|
.reset_i(reset_i),
|
148 |
|
|
|
149 |
|
|
.waddr(mim_rx_waddr),
|
150 |
|
|
.wen(mim_rx_wen),
|
151 |
|
|
.ren(mim_rx_ren),
|
152 |
|
|
.rce(mim_rx_rce),
|
153 |
|
|
.wdata(mim_rx_wdata),
|
154 |
|
|
.raddr(mim_rx_raddr),
|
155 |
|
|
.rdata(mim_rx_rdata)
|
156 |
|
|
);
|
157 |
|
|
|
158 |
|
|
endmodule // pcie_bram_top
|