1 |
2 |
peteralieb |
// Ethernet Platform Top Module
|
2 |
|
|
|
3 |
|
|
//-----------------------------------------------------------------------------
|
4 |
|
|
// Title : Virtex-5 Ethernet MAC Example Design Wrapper
|
5 |
|
|
// Project : Virtex-5 Ethernet MAC Wrappers
|
6 |
|
|
//-----------------------------------------------------------------------------
|
7 |
|
|
// File : v5_emac_v1_6_example_design.v
|
8 |
|
|
//-----------------------------------------------------------------------------
|
9 |
|
|
// Copyright (c) 2004-2008 by Xilinx, Inc. All rights reserved.
|
10 |
|
|
// This text/file contains proprietary, confidential
|
11 |
|
|
// information of Xilinx, Inc., is distributed under license
|
12 |
|
|
// from Xilinx, Inc., and may be used, copied and/or
|
13 |
|
|
// disclosed only pursuant to the terms of a valid license
|
14 |
|
|
// agreement with Xilinx, Inc. Xilinx hereby grants you
|
15 |
|
|
// a license to use this text/file solely for design, simulation,
|
16 |
|
|
// implementation and creation of design files limited
|
17 |
|
|
// to Xilinx devices or technologies. Use with non-Xilinx
|
18 |
|
|
// devices or technologies is expressly prohibited and
|
19 |
|
|
// immediately terminates your license unless covered by
|
20 |
|
|
// a separate agreement.
|
21 |
|
|
//
|
22 |
|
|
// Xilinx is providing this design, code, or information
|
23 |
|
|
// "as is" solely for use in developing programs and
|
24 |
|
|
// solutions for Xilinx devices. By providing this design,
|
25 |
|
|
// code, or information as one possible implementation of
|
26 |
|
|
// this feature, application or standard, Xilinx is making no
|
27 |
|
|
// representation that this implementation is free from any
|
28 |
|
|
// claims of infringement. You are responsible for
|
29 |
|
|
// obtaining any rights you may require for your implementation.
|
30 |
|
|
// Xilinx expressly disclaims any warranty whatsoever with
|
31 |
|
|
// respect to the adequacy of the implementation, including
|
32 |
|
|
// but not limited to any warranties or representations that this
|
33 |
|
|
// implementation is free from claims of infringement, implied
|
34 |
|
|
// warranties of merchantability or fitness for a particular
|
35 |
|
|
// purpose.
|
36 |
|
|
//
|
37 |
|
|
// Xilinx products are not intended for use in life support
|
38 |
|
|
// appliances, devices, or systems. Use in such applications are
|
39 |
|
|
// expressly prohibited.
|
40 |
|
|
//
|
41 |
|
|
// This copyright and support notice must be retained as part
|
42 |
|
|
// of this text at all times. (c) Copyright 2004-2008 Xilinx, Inc.
|
43 |
|
|
// All rights reserved.
|
44 |
|
|
//
|
45 |
|
|
//-----------------------------------------------------------------------------
|
46 |
|
|
// Description: This is the Verilog example design for the Virtex-5
|
47 |
|
|
// Embedded Ethernet MAC. It is intended that
|
48 |
|
|
// this example design can be quickly adapted and downloaded onto
|
49 |
|
|
// an FPGA to provide a real hardware test environment.
|
50 |
|
|
//
|
51 |
|
|
// This level:
|
52 |
|
|
//
|
53 |
|
|
// * instantiates the TEMAC local link file that instantiates
|
54 |
|
|
// the TEMAC top level together with a RX and TX FIFO with a
|
55 |
|
|
// local link interface;
|
56 |
|
|
//
|
57 |
|
|
// * instantiates a simple client I/F side example design,
|
58 |
|
|
// providing an address swap and a simple
|
59 |
|
|
// loopback function;
|
60 |
|
|
//
|
61 |
|
|
// * Instantiates IBUFs on the GTX_CLK, REFCLK and HOSTCLK inputs
|
62 |
|
|
// if required;
|
63 |
|
|
//
|
64 |
|
|
// Please refer to the Datasheet, Getting Started Guide, and
|
65 |
|
|
// the Virtex-5 Embedded Tri-Mode Ethernet MAC User Gude for
|
66 |
|
|
// further information.
|
67 |
|
|
//
|
68 |
|
|
//
|
69 |
|
|
//
|
70 |
|
|
// ---------------------------------------------------------------------
|
71 |
|
|
// | EXAMPLE DESIGN WRAPPER |
|
72 |
|
|
// | --------------------------------------------------------|
|
73 |
|
|
// | |LOCAL LINK WRAPPER |
|
74 |
|
|
// | | -----------------------------------------|
|
75 |
|
|
// | | |BLOCK LEVEL WRAPPER |
|
76 |
|
|
// | | | --------------------- |
|
77 |
|
|
// | -------- | ---------- | | ETHERNET MAC | |
|
78 |
|
|
// | | | | | | | | WRAPPER | --------- |
|
79 |
|
|
// | | |->|->| |--|--->| Tx Tx |--| |--->|
|
80 |
|
|
// | | | | | | | | client PHY | | | |
|
81 |
|
|
// | | ADDR | | | LOCAL | | | I/F I/F | | | |
|
82 |
|
|
// | | SWAP | | | LINK | | | | | PHY | |
|
83 |
|
|
// | | | | | FIFO | | | | | I/F | |
|
84 |
|
|
// | | | | | | | | | | | |
|
85 |
|
|
// | | | | | | | | Rx Rx | | | |
|
86 |
|
|
// | | | | | | | | client PHY | | | |
|
87 |
|
|
// | | |<-|<-| |<-|----| I/F I/F |<-| |<---|
|
88 |
|
|
// | | | | | | | | | --------- |
|
89 |
|
|
// | -------- | ---------- | --------------------- |
|
90 |
|
|
// | | -----------------------------------------|
|
91 |
|
|
// | --------------------------------------------------------|
|
92 |
|
|
// ---------------------------------------------------------------------
|
93 |
|
|
//
|
94 |
|
|
//-----------------------------------------------------------------------------
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
`timescale 1 ps / 1 ps
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
//-----------------------------------------------------------------------------
|
101 |
|
|
// The module declaration for the example design.
|
102 |
|
|
//-----------------------------------------------------------------------------
|
103 |
|
|
module enetplatform
|
104 |
|
|
(
|
105 |
|
|
// SGMII Interface - EMAC0
|
106 |
|
|
TXP_0,
|
107 |
|
|
TXN_0,
|
108 |
|
|
RXP_0,
|
109 |
|
|
RXN_0,
|
110 |
|
|
|
111 |
|
|
// SGMII MGT Clock buffer inputs
|
112 |
|
|
MGTCLK_N,
|
113 |
|
|
MGTCLK_P,
|
114 |
|
|
|
115 |
|
|
// reset for ethernet phy
|
116 |
|
|
PHY_RESET_0,
|
117 |
|
|
|
118 |
|
|
// GTP link status
|
119 |
|
|
GTP_READY,
|
120 |
|
|
|
121 |
|
|
// Asynchronous Reset
|
122 |
|
|
RESET,
|
123 |
|
|
|
124 |
|
|
// CPU RESET
|
125 |
|
|
RESET_CPU,
|
126 |
|
|
|
127 |
|
|
// User Connections
|
128 |
|
|
in_src_rdy_usr,
|
129 |
|
|
out_dst_rdy_usr,
|
130 |
|
|
in_data_usr,
|
131 |
|
|
in_sof_usr,
|
132 |
|
|
in_eof_usr,
|
133 |
|
|
in_dst_rdy_usr,
|
134 |
|
|
out_src_rdy_usr,
|
135 |
|
|
out_data_usr,
|
136 |
|
|
out_sof_usr,
|
137 |
|
|
out_eof_usr,
|
138 |
|
|
outport_usr,
|
139 |
|
|
inport_usr,
|
140 |
|
|
clk_local,
|
141 |
|
|
rst_local
|
142 |
|
|
);
|
143 |
|
|
|
144 |
|
|
|
145 |
|
|
//-----------------------------------------------------------------------------
|
146 |
|
|
// Port Declarations
|
147 |
|
|
//-----------------------------------------------------------------------------
|
148 |
|
|
|
149 |
|
|
// SGMII Interface - EMAC0
|
150 |
|
|
output TXP_0;
|
151 |
|
|
output TXN_0;
|
152 |
|
|
input RXP_0;
|
153 |
|
|
input RXN_0;
|
154 |
|
|
|
155 |
|
|
// SGMII MGT Clock buffer inputs
|
156 |
|
|
input MGTCLK_N;
|
157 |
|
|
input MGTCLK_P;
|
158 |
|
|
|
159 |
|
|
// reset for ethernet phy
|
160 |
|
|
output PHY_RESET_0;
|
161 |
|
|
|
162 |
|
|
// GTP link status
|
163 |
|
|
output GTP_READY;
|
164 |
|
|
|
165 |
|
|
// Asynchronous Reset
|
166 |
|
|
input RESET;
|
167 |
|
|
|
168 |
|
|
// CPU RESET
|
169 |
|
|
input RESET_CPU;
|
170 |
|
|
|
171 |
|
|
// User Connections
|
172 |
|
|
input in_src_rdy_usr;
|
173 |
|
|
input out_dst_rdy_usr;
|
174 |
|
|
input [7:0] in_data_usr;
|
175 |
|
|
input in_sof_usr;
|
176 |
|
|
input in_eof_usr;
|
177 |
|
|
output in_dst_rdy_usr;
|
178 |
|
|
output out_src_rdy_usr;
|
179 |
|
|
output [7:0] out_data_usr;
|
180 |
|
|
output out_sof_usr;
|
181 |
|
|
output out_eof_usr;
|
182 |
|
|
output [3:0] outport_usr;
|
183 |
|
|
output [3:0] inport_usr;
|
184 |
|
|
output clk_local;
|
185 |
|
|
output rst_local;
|
186 |
|
|
|
187 |
|
|
//-----------------------------------------------------------------------------
|
188 |
|
|
// Wire and Reg Declarations
|
189 |
|
|
//-----------------------------------------------------------------------------
|
190 |
|
|
|
191 |
|
|
// Global asynchronous reset
|
192 |
|
|
wire reset_i;
|
193 |
|
|
// Local Link Interface Clocking Signal - EMAC0
|
194 |
|
|
wire ll_clk_0_i;
|
195 |
|
|
|
196 |
|
|
// address swap transmitter connections - EMAC0
|
197 |
|
|
wire [7:0] tx_ll_data_0_i;
|
198 |
|
|
wire tx_ll_sof_n_0_i;
|
199 |
|
|
wire tx_ll_eof_n_0_i;
|
200 |
|
|
wire tx_ll_src_rdy_n_0_i;
|
201 |
|
|
wire tx_ll_dst_rdy_n_0_i;
|
202 |
|
|
|
203 |
|
|
// address swap receiver connections - EMAC0
|
204 |
|
|
wire [7:0] rx_ll_data_0_i;
|
205 |
|
|
wire rx_ll_sof_n_0_i;
|
206 |
|
|
wire rx_ll_eof_n_0_i;
|
207 |
|
|
wire rx_ll_src_rdy_n_0_i;
|
208 |
|
|
wire rx_ll_dst_rdy_n_0_i;
|
209 |
|
|
|
210 |
|
|
// create a synchronous reset in the local link clock domain
|
211 |
|
|
reg [5:0] ll_pre_reset_0_i;
|
212 |
|
|
reg ll_reset_0_i;
|
213 |
|
|
|
214 |
|
|
// synthesis attribute ASYNC_REG of tx_pre_reset_0_i is "TRUE";
|
215 |
|
|
|
216 |
|
|
// Reset signals from the transceiver
|
217 |
|
|
wire resetdone_0_i;
|
218 |
|
|
|
219 |
|
|
// EMAC0 Clocking signals
|
220 |
|
|
|
221 |
|
|
// Transceiver output clock (REFCLKOUT at 125MHz)
|
222 |
|
|
wire clk125_o;
|
223 |
|
|
// 125MHz clock input to wrappers
|
224 |
|
|
(* KEEP = "True" *)
|
225 |
|
|
wire clk125;
|
226 |
|
|
// Input 125MHz differential clock for transceiver
|
227 |
|
|
wire clk_ds;
|
228 |
|
|
|
229 |
|
|
// 1.25/12.5/125MHz clock signals for tri-speed SGMII
|
230 |
|
|
wire client_clk_0_o;
|
231 |
|
|
(* KEEP = "True" *)
|
232 |
|
|
wire client_clk_0;
|
233 |
|
|
|
234 |
|
|
// GT reset signal
|
235 |
|
|
wire gtreset;
|
236 |
|
|
reg [3:0] reset_r;
|
237 |
|
|
// synthesis attribute ASYNC_REG of reset_r is "TRUE";
|
238 |
|
|
|
239 |
|
|
wire sysclk_u;
|
240 |
|
|
wire sysclk_l;
|
241 |
|
|
wire reset_cpu_h, reset_cpu_i;
|
242 |
|
|
|
243 |
|
|
|
244 |
|
|
|
245 |
|
|
//-----------------------------------------------------------------------------
|
246 |
|
|
// Main Body of Code
|
247 |
|
|
//-----------------------------------------------------------------------------
|
248 |
|
|
|
249 |
|
|
// Phy reset
|
250 |
|
|
assign PHY_RESET_0 = ~reset_i;
|
251 |
|
|
|
252 |
|
|
assign GND = 0;
|
253 |
|
|
|
254 |
|
|
reg [4:0] reset_cpu_cnt = {1,1,1,1,1};
|
255 |
|
|
always @(posedge ll_clk_0_i)
|
256 |
|
|
begin
|
257 |
|
|
if (reset_cpu_i | ~sysclk_l)
|
258 |
|
|
begin
|
259 |
|
|
reset_cpu_cnt <= {1,1,1,1,1};
|
260 |
|
|
end
|
261 |
|
|
else
|
262 |
|
|
begin
|
263 |
|
|
reset_cpu_cnt[3:0] <= reset_cpu_cnt[4:1];
|
264 |
|
|
reset_cpu_cnt[4] <= 0;
|
265 |
|
|
end
|
266 |
|
|
end
|
267 |
|
|
|
268 |
|
|
// Reset input buffer
|
269 |
|
|
IBUF reset_ibuf (.I(RESET), .O(reset_i));
|
270 |
|
|
assign reset_cpu_i = RESET_CPU;
|
271 |
|
|
assign reset_cpu_h = reset_cpu_cnt[0];
|
272 |
|
|
assign rst_local = reset_cpu_h;
|
273 |
|
|
|
274 |
|
|
|
275 |
|
|
// EMAC0 Clocking
|
276 |
|
|
|
277 |
|
|
// Generate the clock input to the GTP
|
278 |
|
|
// clk_ds can be shared between multiple MAC instances.
|
279 |
|
|
IBUFDS clkingen (
|
280 |
|
|
.I(MGTCLK_P),
|
281 |
|
|
.IB(MGTCLK_N),
|
282 |
|
|
.O(clk_ds));
|
283 |
|
|
|
284 |
|
|
// 125MHz from transceiver is routed through a BUFG and
|
285 |
|
|
// input to the MAC wrappers.
|
286 |
|
|
// This clock can be shared between multiple MAC instances.
|
287 |
|
|
BUFG bufg_clk125 (.I(clk125_o), .O(clk125));
|
288 |
|
|
|
289 |
|
|
|
290 |
|
|
// Processor Clock Generation
|
291 |
|
|
DCM_BASE #(
|
292 |
|
|
.CLKIN_PERIOD(8),
|
293 |
|
|
.CLK_FEEDBACK("NONE"),
|
294 |
|
|
.CLKFX_DIVIDE(5),
|
295 |
|
|
.CLKFX_MULTIPLY(3)
|
296 |
|
|
) dcm_patlpp (
|
297 |
|
|
.CLKFX(sysclk_u),
|
298 |
|
|
.LOCKED(sysclk_l),
|
299 |
|
|
.CLKIN(clk125),
|
300 |
|
|
.RST(gtreset)
|
301 |
|
|
);
|
302 |
|
|
BUFG bufg_ll_clk (.I(sysclk_u), .O(ll_clk_0_i));
|
303 |
|
|
|
304 |
|
|
//assign ll_clk_0_i = clk125;
|
305 |
|
|
|
306 |
|
|
// 1.25/12.5/125MHz clock from the MAC is routed through a BUFG and
|
307 |
|
|
// input to the MAC wrappers to clock the client interface.
|
308 |
|
|
BUFG bufg_client_0 (.I(client_clk_0_o), .O(client_clk_0));
|
309 |
|
|
//--------------------------------------------------------------------
|
310 |
|
|
//-- RocketIO PMA reset circuitry
|
311 |
|
|
//--------------------------------------------------------------------
|
312 |
|
|
always@(posedge reset_i, posedge clk125)
|
313 |
|
|
begin
|
314 |
|
|
if (reset_i == 1'b1)
|
315 |
|
|
begin
|
316 |
|
|
reset_r <= 4'b1111;
|
317 |
|
|
end
|
318 |
|
|
else
|
319 |
|
|
begin
|
320 |
|
|
reset_r <= {reset_r[2:0], reset_i};
|
321 |
|
|
end
|
322 |
|
|
end
|
323 |
|
|
|
324 |
|
|
assign gtreset = reset_r[3];
|
325 |
|
|
|
326 |
|
|
//------------------------------------------------------------------------
|
327 |
|
|
// Instantiate the EMAC Wrapper with LL FIFO
|
328 |
|
|
// (v5_emac_v1_6_locallink.v)
|
329 |
|
|
//------------------------------------------------------------------------
|
330 |
|
|
v5_emac_v1_6_locallink v5_emac_ll
|
331 |
|
|
(
|
332 |
|
|
// EMAC0 Clocking
|
333 |
|
|
// 125MHz clock output from transceiver
|
334 |
|
|
.CLK125_OUT (clk125_o),
|
335 |
|
|
// 125MHz clock input from BUFG
|
336 |
|
|
.CLK125 (clk125),
|
337 |
|
|
// Tri-speed clock output from EMAC0
|
338 |
|
|
.CLIENT_CLK_OUT_0 (client_clk_0_o),
|
339 |
|
|
// EMAC0 Tri-speed clock input from BUFG
|
340 |
|
|
.CLIENT_CLK_0 (client_clk_0),
|
341 |
|
|
|
342 |
|
|
// Local link Receiver Interface - EMAC0
|
343 |
|
|
.RX_LL_CLOCK_0 (ll_clk_0_i),
|
344 |
|
|
.RX_LL_RESET_0 (ll_reset_0_i),
|
345 |
|
|
.RX_LL_DATA_0 (rx_ll_data_0_i),
|
346 |
|
|
.RX_LL_SOF_N_0 (rx_ll_sof_n_0_i),
|
347 |
|
|
.RX_LL_EOF_N_0 (rx_ll_eof_n_0_i),
|
348 |
|
|
.RX_LL_SRC_RDY_N_0 (rx_ll_src_rdy_n_0_i),
|
349 |
|
|
.RX_LL_DST_RDY_N_0 (rx_ll_dst_rdy_n_0_i),
|
350 |
|
|
.RX_LL_FIFO_STATUS_0 (),
|
351 |
|
|
|
352 |
|
|
// Unused Receiver signals - EMAC0
|
353 |
|
|
.EMAC0CLIENTRXDVLD (),
|
354 |
|
|
.EMAC0CLIENTRXFRAMEDROP (),
|
355 |
|
|
.EMAC0CLIENTRXSTATS (),
|
356 |
|
|
.EMAC0CLIENTRXSTATSVLD (),
|
357 |
|
|
.EMAC0CLIENTRXSTATSBYTEVLD (),
|
358 |
|
|
|
359 |
|
|
// Local link Transmitter Interface - EMAC0
|
360 |
|
|
.TX_LL_CLOCK_0 (ll_clk_0_i),
|
361 |
|
|
.TX_LL_RESET_0 (ll_reset_0_i),
|
362 |
|
|
.TX_LL_DATA_0 (tx_ll_data_0_i),
|
363 |
|
|
.TX_LL_SOF_N_0 (tx_ll_sof_n_0_i),
|
364 |
|
|
.TX_LL_EOF_N_0 (tx_ll_eof_n_0_i),
|
365 |
|
|
.TX_LL_SRC_RDY_N_0 (tx_ll_src_rdy_n_0_i),
|
366 |
|
|
.TX_LL_DST_RDY_N_0 (tx_ll_dst_rdy_n_0_i),
|
367 |
|
|
|
368 |
|
|
// Unused Transmitter signals - EMAC0
|
369 |
|
|
.CLIENTEMAC0TXIFGDELAY (8'h00),
|
370 |
|
|
.EMAC0CLIENTTXSTATS (),
|
371 |
|
|
.EMAC0CLIENTTXSTATSVLD (),
|
372 |
|
|
.EMAC0CLIENTTXSTATSBYTEVLD (),
|
373 |
|
|
|
374 |
|
|
// MAC Control Interface - EMAC0
|
375 |
|
|
.CLIENTEMAC0PAUSEREQ (1'b0),
|
376 |
|
|
.CLIENTEMAC0PAUSEVAL (16'h0000),
|
377 |
|
|
|
378 |
|
|
//EMAC-MGT link status
|
379 |
|
|
.EMAC0CLIENTSYNCACQSTATUS (GTP_READY),
|
380 |
|
|
.EMAC0ANINTERRUPT (),
|
381 |
|
|
|
382 |
|
|
|
383 |
|
|
|
384 |
|
|
// SGMII Interface - EMAC0
|
385 |
|
|
.TXP_0 (TXP_0),
|
386 |
|
|
.TXN_0 (TXN_0),
|
387 |
|
|
.RXP_0 (RXP_0),
|
388 |
|
|
.RXN_0 (RXN_0),
|
389 |
|
|
.PHYAD_0 (5'b00010),
|
390 |
|
|
.RESETDONE_0 (resetdone_0_i),
|
391 |
|
|
|
392 |
|
|
// unused transceiver
|
393 |
|
|
.TXN_1_UNUSED (),
|
394 |
|
|
.TXP_1_UNUSED (),
|
395 |
|
|
.RXN_1_UNUSED (1'b1),
|
396 |
|
|
.RXP_1_UNUSED (1'b0),
|
397 |
|
|
|
398 |
|
|
// SGMII MGT Clock buffer inputs
|
399 |
|
|
.CLK_DS (clk_ds),
|
400 |
|
|
.GTRESET (gtreset),
|
401 |
|
|
|
402 |
|
|
// Asynchronous Reset Input
|
403 |
|
|
.RESET (reset_i)
|
404 |
|
|
);
|
405 |
|
|
|
406 |
|
|
//-------------------------------------------------------------------
|
407 |
|
|
// Instatiate the address swapping module
|
408 |
|
|
//-------------------------------------------------------------------
|
409 |
|
|
/*address_swap_module_8 client_side_asm_emac0
|
410 |
|
|
(.rx_ll_clock(ll_clk_0_i),
|
411 |
|
|
.rx_ll_reset(ll_reset_0_i),
|
412 |
|
|
.rx_ll_data_in(rx_ll_data_0_i),
|
413 |
|
|
.rx_ll_sof_in_n(rx_ll_sof_n_0_i),
|
414 |
|
|
.rx_ll_eof_in_n(rx_ll_eof_n_0_i),
|
415 |
|
|
.rx_ll_src_rdy_in_n(rx_ll_src_rdy_n_0_i),
|
416 |
|
|
.rx_ll_data_out(tx_ll_data_0_i),
|
417 |
|
|
.rx_ll_sof_out_n(tx_ll_sof_n_0_i),
|
418 |
|
|
.rx_ll_eof_out_n(tx_ll_eof_n_0_i),
|
419 |
|
|
.rx_ll_src_rdy_out_n(tx_ll_src_rdy_n_0_i),
|
420 |
|
|
.rx_ll_dst_rdy_in_n(tx_ll_dst_rdy_n_0_i)
|
421 |
|
|
);*/
|
422 |
|
|
|
423 |
|
|
wire out_sof_p, out_eof_p, out_src_rdy_p, out_dst_rdy_p;
|
424 |
|
|
wire in_sof_p, in_eof_p, in_src_rdy_p, in_dst_rdy_p;
|
425 |
|
|
wire pp_enable;
|
426 |
|
|
wire [3:0] port_addr;
|
427 |
|
|
wire [3:0] outport_addr;
|
428 |
|
|
wire [3:0] inport_addr;
|
429 |
|
|
reg [7:0] in_data_p;
|
430 |
|
|
reg [7:0] DIP_r;
|
431 |
|
|
|
432 |
|
|
reg out_sof_pr, out_eof_pr, out_src_rdy_pr, out_dst_rdy_pr;
|
433 |
|
|
reg in_sof_pr, in_eof_pr, in_src_rdy_pr, in_dst_rdy_pr;
|
434 |
|
|
|
435 |
|
|
assign pp_enable = 1;
|
436 |
|
|
|
437 |
|
|
patlpp pp
|
438 |
|
|
(
|
439 |
|
|
.en(pp_enable),
|
440 |
|
|
.clk(ll_clk_0_i),
|
441 |
|
|
.rst(reset_cpu_h),
|
442 |
|
|
.in_sof(in_sof_p),
|
443 |
|
|
.in_eof(in_eof_p),
|
444 |
|
|
.in_src_rdy(in_src_rdy_p),
|
445 |
|
|
.in_dst_rdy(in_dst_rdy_p),
|
446 |
|
|
.out_sof(out_sof_p),
|
447 |
|
|
.out_eof(out_eof_p),
|
448 |
|
|
.out_src_rdy(out_src_rdy_p),
|
449 |
|
|
.out_dst_rdy(out_dst_rdy_p),
|
450 |
|
|
.in_data(in_data_p),
|
451 |
|
|
.out_data(tx_ll_data_0_i),
|
452 |
|
|
.outport_addr(outport_addr),
|
453 |
|
|
.inport_addr(inport_addr)//,
|
454 |
|
|
//.chipscope_data(chipscope_data_pp)
|
455 |
|
|
);
|
456 |
|
|
|
457 |
|
|
assign tx_ll_sof_n_0_i = ~out_sof_p;
|
458 |
|
|
assign tx_ll_eof_n_0_i = ~out_eof_p;
|
459 |
|
|
assign tx_ll_src_rdy_n_0_i = ~out_src_rdy_pr;
|
460 |
|
|
assign rx_ll_dst_rdy_n_0_i = ~in_dst_rdy_pr;
|
461 |
|
|
assign in_sof_p = in_sof_pr;
|
462 |
|
|
assign in_eof_p = in_eof_pr;
|
463 |
|
|
assign in_src_rdy_p = in_src_rdy_pr;
|
464 |
|
|
assign out_dst_rdy_p = out_dst_rdy_pr;
|
465 |
|
|
|
466 |
|
|
assign in_dst_rdy_usr = in_dst_rdy_p;
|
467 |
|
|
assign out_src_rdy_usr = out_src_rdy_p;
|
468 |
|
|
assign outport_usr = outport_addr;
|
469 |
|
|
assign inport_usr = inport_addr;
|
470 |
|
|
assign out_data_usr = tx_ll_data_0_i;
|
471 |
|
|
assign out_sof_usr = out_sof_p;
|
472 |
|
|
assign out_eof_usr = out_eof_p;
|
473 |
|
|
|
474 |
|
|
assign clk_local = ll_clk_0_i;
|
475 |
|
|
|
476 |
|
|
// In Port
|
477 |
|
|
always @(inport_addr or rx_ll_src_rdy_n_0_i or rx_ll_data_0_i or in_dst_rdy_p or rx_ll_sof_n_0_i or rx_ll_eof_n_0_i or in_src_rdy_usr or in_data_usr or in_sof_usr or in_eof_usr)
|
478 |
|
|
begin
|
479 |
|
|
case (inport_addr)
|
480 |
|
|
0:
|
481 |
|
|
begin
|
482 |
|
|
in_src_rdy_pr <= ~rx_ll_src_rdy_n_0_i;
|
483 |
|
|
in_dst_rdy_pr <= in_dst_rdy_p;
|
484 |
|
|
in_data_p <= rx_ll_data_0_i;
|
485 |
|
|
in_sof_pr <= ~rx_ll_sof_n_0_i;
|
486 |
|
|
in_eof_pr <= ~rx_ll_eof_n_0_i;
|
487 |
|
|
end
|
488 |
|
|
default:
|
489 |
|
|
begin
|
490 |
|
|
in_src_rdy_pr <= in_src_rdy_usr;
|
491 |
|
|
in_dst_rdy_pr <= 0;
|
492 |
|
|
in_data_p <= in_data_usr;
|
493 |
|
|
in_sof_pr <= in_sof_usr;
|
494 |
|
|
in_eof_pr <= in_eof_usr;
|
495 |
|
|
end
|
496 |
|
|
endcase
|
497 |
|
|
end
|
498 |
|
|
|
499 |
|
|
// Out Port
|
500 |
|
|
always @(outport_addr or out_src_rdy_p or tx_ll_dst_rdy_n_0_i)
|
501 |
|
|
begin
|
502 |
|
|
case (outport_addr)
|
503 |
|
|
0:
|
504 |
|
|
begin
|
505 |
|
|
out_src_rdy_pr <= out_src_rdy_p;
|
506 |
|
|
out_dst_rdy_pr <= ~tx_ll_dst_rdy_n_0_i;
|
507 |
|
|
end
|
508 |
|
|
default:
|
509 |
|
|
begin
|
510 |
|
|
out_src_rdy_pr <= 0;
|
511 |
|
|
out_dst_rdy_pr <= out_dst_rdy_usr;
|
512 |
|
|
end
|
513 |
|
|
endcase
|
514 |
|
|
end
|
515 |
|
|
|
516 |
|
|
|
517 |
|
|
//assign rx_ll_dst_rdy_n_0_i = tx_ll_dst_rdy_n_0_i;
|
518 |
|
|
|
519 |
|
|
// Create synchronous reset in the transmitter clock domain.
|
520 |
|
|
always @(posedge ll_clk_0_i, posedge reset_i)
|
521 |
|
|
begin
|
522 |
|
|
if (reset_i === 1'b1)
|
523 |
|
|
begin
|
524 |
|
|
ll_pre_reset_0_i <= 6'h3F;
|
525 |
|
|
ll_reset_0_i <= 1'b1;
|
526 |
|
|
end
|
527 |
|
|
else if (resetdone_0_i === 1'b1)
|
528 |
|
|
begin
|
529 |
|
|
ll_pre_reset_0_i[0] <= 1'b0;
|
530 |
|
|
ll_pre_reset_0_i[5:1] <= ll_pre_reset_0_i[4:0];
|
531 |
|
|
ll_reset_0_i <= ll_pre_reset_0_i[5];
|
532 |
|
|
end
|
533 |
|
|
end
|
534 |
|
|
|
535 |
|
|
|
536 |
|
|
endmodule
|