1 |
11 |
juko |
/*
|
2 |
|
|
* .--------------. .----------------. .------------.
|
3 |
|
|
* | .------------. | .--------------. | .----------. |
|
4 |
|
|
* | | ____ ____ | | | ____ ____ | | | ______ | |
|
5 |
|
|
* | ||_ || _|| | ||_ \ / _|| | | .' ___ || |
|
6 |
|
|
* ___ _ __ ___ _ __ | | | |__| | | | | | \/ | | | |/ .' \_|| |
|
7 |
|
|
* / _ \| '_ \ / _ \ '_ \ | | | __ | | | | | |\ /| | | | || | | |
|
8 |
|
|
* (_) | |_) | __/ | | || | _| | | |_ | | | _| |_\/_| |_ | | |\ `.___.'\| |
|
9 |
|
|
* \___/| .__/ \___|_| |_|| ||____||____|| | ||_____||_____|| | | `._____.'| |
|
10 |
|
|
* | | | | | | | | | | | |
|
11 |
|
|
* |_| | '------------' | '--------------' | '----------' |
|
12 |
|
|
* '--------------' '----------------' '------------'
|
13 |
|
|
*
|
14 |
|
|
* openHMC - An Open Source Hybrid Memory Cube Controller
|
15 |
|
|
* (C) Copyright 2014 Computer Architecture Group - University of Heidelberg
|
16 |
|
|
* www.ziti.uni-heidelberg.de
|
17 |
|
|
* B6, 26
|
18 |
|
|
* 68159 Mannheim
|
19 |
|
|
* Germany
|
20 |
|
|
*
|
21 |
|
|
* Contact: openhmc@ziti.uni-heidelberg.de
|
22 |
|
|
* http://ra.ziti.uni-heidelberg.de/openhmc
|
23 |
|
|
*
|
24 |
|
|
* This source file is free software: you can redistribute it and/or modify
|
25 |
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
26 |
|
|
* the Free Software Foundation, either version 3 of the License, or
|
27 |
|
|
* (at your option) any later version.
|
28 |
|
|
*
|
29 |
|
|
* This source file is distributed in the hope that it will be useful,
|
30 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
31 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
32 |
|
|
* GNU Lesser General Public License for more details.
|
33 |
|
|
*
|
34 |
|
|
* You should have received a copy of the GNU Lesser General Public License
|
35 |
|
|
* along with this source file. If not, see <http://www.gnu.org/licenses/>.
|
36 |
|
|
*
|
37 |
|
|
*
|
38 |
15 |
juko |
* Module name: openhmc_top
|
39 |
11 |
juko |
*
|
40 |
15 |
juko |
*
|
41 |
|
|
*
|
42 |
|
|
*
|
43 |
|
|
* DESIGN CONTROL: Use the following defines if desired:
|
44 |
|
|
* `define XILINX
|
45 |
|
|
* Uses Xilinx DSP48 as counter in the Register File
|
46 |
|
|
* `define ASYNC_RES
|
47 |
|
|
* Define the active low reset to be asynchronous
|
48 |
|
|
* `define RESET_ALL
|
49 |
|
|
* Use Reset values for all registers
|
50 |
11 |
juko |
*/
|
51 |
|
|
|
52 |
|
|
`default_nettype none
|
53 |
|
|
|
54 |
|
|
module openhmc_top #(
|
55 |
|
|
//Define width of the datapath
|
56 |
|
|
parameter FPW = 4, //Legal Values: 2,4,6,8
|
57 |
15 |
juko |
parameter LOG_FPW = 2, //Legal Values: 1 for FPW=2 ,2 for FPW=4 ,3 for FPW=6/8
|
58 |
11 |
juko |
parameter DWIDTH = FPW*128, //Leave untouched
|
59 |
|
|
//Define HMC interface width
|
60 |
|
|
parameter LOG_NUM_LANES = 3, //Set 3 for half-width, 4 for full-width
|
61 |
|
|
parameter NUM_LANES = 2**LOG_NUM_LANES, //Leave untouched
|
62 |
|
|
parameter NUM_DATA_BYTES = FPW*16, //Leave untouched
|
63 |
|
|
//Define width of the register file
|
64 |
15 |
juko |
parameter HMC_RF_WWIDTH = 64, //Leave untouched
|
65 |
|
|
parameter HMC_RF_RWIDTH = 64, //Leave untouched
|
66 |
|
|
parameter HMC_RF_AWIDTH = 4, //Leave untouched
|
67 |
11 |
juko |
//Configure the Functionality
|
68 |
15 |
juko |
parameter LOG_MAX_RX_TOKENS = 8, //Set the depth of the RX input buffer. Must be >= LOG(rf_rx_buffer_rtc) in the RF. Dont't care if OPEN_RSP_MODE=1
|
69 |
|
|
parameter LOG_MAX_HMC_TOKENS = 10, //Set the depth of the HMC input buffer. Must be >= LOG of the corresponding field in the HMC internal register
|
70 |
|
|
parameter HMC_RX_AC_COUPLED = 1, //Set to 0 to bypass the run length limiter, saves logic and 1 cycle delay
|
71 |
|
|
parameter DETECT_LANE_POLARITY = 1, //Set to 0 if lane polarity is not applicable, saves logic
|
72 |
11 |
juko |
parameter CTRL_LANE_POLARITY = 1, //Set to 0 if lane polarity is not applicable or performed by the transceivers, saves logic and 1 cycle delay
|
73 |
15 |
juko |
//If set to 1: Only valid if DETECT_LANE_POLARITY==1, otherwise tied to zero
|
74 |
11 |
juko |
parameter CTRL_LANE_REVERSAL = 1, //Set to 0 if lane reversal is not applicable or performed by the transceivers, saves logic
|
75 |
15 |
juko |
parameter CTRL_SCRAMBLERS = 1, //Set to 0 to remove the option to disable (de-)scramblers for debugging, saves logic
|
76 |
|
|
parameter OPEN_RSP_MODE = 0, //Set to 1 if running response open loop mode, bypasses the RX input buffer
|
77 |
|
|
parameter RX_RELAX_INIT_TIMING = 1, //Per default, incoming TS1 sequences are only checked for the lane independent h'F0 sequence. Save resources and
|
78 |
|
|
//eases timing closure. !Lane reversal is still detected
|
79 |
|
|
parameter RX_BIT_SLIP_CNT_LOG = 5, //Define the number of cycles between bit slips. Refer to the transceiver user guide
|
80 |
|
|
//Example: RX_BIT_SLIP_CNT_LOG=5 results in 2^5=32 cycles between two bit slips
|
81 |
|
|
parameter SYNC_AXI4_IF = 0, //Set to 1 if AXI IF is synchronous to clk_hmc to use simple fifos
|
82 |
|
|
parameter XIL_CNT_PIPELINED = 1, //If Xilinx counters are used, set to 1 to enabled output register pipelining
|
83 |
11 |
juko |
//Set the direction of bitslip. Set to 1 if bitslip performs a shift right, otherwise set to 0 (see the corresponding transceiver user guide)
|
84 |
|
|
parameter BITSLIP_SHIFT_RIGHT = 1,
|
85 |
|
|
//Debug Params
|
86 |
15 |
juko |
parameter DBG_RX_TOKEN_MON = 1 //Set to 0 to remove the RX Link token monitor, saves logic
|
87 |
11 |
juko |
) (
|
88 |
|
|
//----------------------------------
|
89 |
|
|
//----SYSTEM INTERFACES
|
90 |
|
|
//----------------------------------
|
91 |
15 |
juko |
input wire clk_user, //Connect if SYNC_AXI4_IF==0
|
92 |
|
|
input wire clk_hmc, //Connect!
|
93 |
|
|
input wire res_n_user, //Connect if SYNC_AXI4_IF==0
|
94 |
|
|
input wire res_n_hmc, //Connect!
|
95 |
11 |
juko |
|
96 |
|
|
//----------------------------------
|
97 |
|
|
//----Connect AXI Ports
|
98 |
|
|
//----------------------------------
|
99 |
|
|
//From AXI to HMC Ctrl TX
|
100 |
|
|
input wire s_axis_tx_TVALID,
|
101 |
|
|
output wire s_axis_tx_TREADY,
|
102 |
|
|
input wire [DWIDTH-1:0] s_axis_tx_TDATA,
|
103 |
|
|
input wire [NUM_DATA_BYTES-1:0] s_axis_tx_TUSER,
|
104 |
|
|
//From HMC Ctrl RX to AXI
|
105 |
|
|
output wire m_axis_rx_TVALID,
|
106 |
|
|
input wire m_axis_rx_TREADY,
|
107 |
|
|
output wire [DWIDTH-1:0] m_axis_rx_TDATA,
|
108 |
|
|
output wire [NUM_DATA_BYTES-1:0] m_axis_rx_TUSER,
|
109 |
|
|
|
110 |
|
|
//----------------------------------
|
111 |
|
|
//----Connect Transceiver
|
112 |
|
|
//----------------------------------
|
113 |
15 |
juko |
output wire [DWIDTH-1:0] phy_data_tx_link2phy,//Connect!
|
114 |
|
|
input wire [DWIDTH-1:0] phy_data_rx_phy2link,//Connect!
|
115 |
|
|
output wire [NUM_LANES-1:0] phy_bit_slip, //Must be connected if DETECT_LANE_POLARITY==1 AND CTRL_LANE_POLARITY=0
|
116 |
11 |
juko |
output wire [NUM_LANES-1:0] phy_lane_polarity, //All 0 if CTRL_LANE_POLARITY=1
|
117 |
15 |
juko |
input wire phy_tx_ready, //Optional information to RF
|
118 |
|
|
input wire phy_rx_ready, //Release RX descrambler reset when PHY ready
|
119 |
|
|
output wire phy_init_cont_set, //Can be used to release transceiver reset if used
|
120 |
11 |
juko |
|
121 |
|
|
//----------------------------------
|
122 |
|
|
//----Connect HMC
|
123 |
|
|
//----------------------------------
|
124 |
|
|
output wire P_RST_N,
|
125 |
15 |
juko |
output wire LXRXPS,
|
126 |
|
|
input wire LXTXPS,
|
127 |
|
|
input wire FERR_N,
|
128 |
11 |
juko |
|
129 |
|
|
//----------------------------------
|
130 |
|
|
//----Connect RF
|
131 |
|
|
//----------------------------------
|
132 |
|
|
input wire [HMC_RF_AWIDTH-1:0] rf_address,
|
133 |
|
|
output wire [HMC_RF_RWIDTH-1:0] rf_read_data,
|
134 |
|
|
output wire rf_invalid_address,
|
135 |
|
|
output wire rf_access_complete,
|
136 |
|
|
input wire rf_read_en,
|
137 |
|
|
input wire rf_write_en,
|
138 |
|
|
input wire [HMC_RF_WWIDTH-1:0] rf_write_data
|
139 |
|
|
|
140 |
|
|
);
|
141 |
|
|
|
142 |
|
|
//=====================================================================================================
|
143 |
|
|
//-----------------------------------------------------------------------------------------------------
|
144 |
|
|
//---------WIRING AND SIGNAL STUFF---------------------------------------------------------------------
|
145 |
|
|
//-----------------------------------------------------------------------------------------------------
|
146 |
|
|
//=====================================================================================================
|
147 |
|
|
|
148 |
15 |
juko |
localparam MAX_RTC_RET_LOG = (FPW == 2) ? 6 :
|
149 |
|
|
(FPW == 4) ? 7 :
|
150 |
|
|
8;
|
151 |
|
|
|
152 |
|
|
`ifdef XILINX
|
153 |
|
|
localparam RF_COUNTER_SIZE = 48;
|
154 |
|
|
`else
|
155 |
|
|
localparam RF_COUNTER_SIZE = 64;
|
156 |
|
|
`endif
|
157 |
|
|
|
158 |
11 |
juko |
// ----Assign AXI interface wires
|
159 |
|
|
wire [4*FPW-1:0] m_axis_rx_TUSER_temp;
|
160 |
|
|
assign m_axis_rx_TUSER = {{NUM_DATA_BYTES-(4*FPW){1'b0}}, m_axis_rx_TUSER_temp};
|
161 |
|
|
|
162 |
15 |
juko |
wire s_axis_tx_TREADY_n;
|
163 |
11 |
juko |
assign s_axis_tx_TREADY = ~s_axis_tx_TREADY_n;
|
164 |
15 |
juko |
wire m_axis_rx_TVALID_n;
|
165 |
11 |
juko |
assign m_axis_rx_TVALID = ~m_axis_rx_TVALID_n;
|
166 |
|
|
|
167 |
|
|
// ----TX FIFO Wires
|
168 |
|
|
wire [DWIDTH-1:0] tx_d_in_data;
|
169 |
|
|
wire tx_shift_out;
|
170 |
|
|
wire tx_empty;
|
171 |
|
|
wire tx_a_empty;
|
172 |
|
|
wire [3*FPW-1:0] tx_d_in_ctrl;
|
173 |
|
|
|
174 |
|
|
// ----RX FIFO Wires
|
175 |
|
|
wire [DWIDTH-1:0] rx_d_in_data;
|
176 |
|
|
wire rx_shift_in;
|
177 |
|
|
wire rx_a_full;
|
178 |
|
|
wire [4*FPW-1:0] rx_d_in_ctrl;
|
179 |
|
|
|
180 |
|
|
// ----RX LINK TO TX LINK
|
181 |
|
|
wire rx2tx_link_retry;
|
182 |
|
|
wire rx2tx_error_abort_mode;
|
183 |
|
|
wire rx2tx_error_abort_mode_cleared;
|
184 |
|
|
wire [7:0] rx2tx_hmc_frp;
|
185 |
|
|
wire [7:0] rx2tx_rrp;
|
186 |
15 |
juko |
wire [MAX_RTC_RET_LOG-1:0]rx2tx_returned_tokens;
|
187 |
11 |
juko |
wire [LOG_FPW:0] rx2tx_hmc_tokens_to_return;
|
188 |
|
|
wire [LOG_FPW:0] rx2tx_hmc_poisoned_tokens_to_return;
|
189 |
|
|
|
190 |
|
|
// ----Register File
|
191 |
|
|
//Counter
|
192 |
|
|
wire rf_cnt_retry;
|
193 |
|
|
wire rf_run_length_bit_flip;
|
194 |
|
|
wire rf_error_abort_not_cleared;
|
195 |
15 |
juko |
wire [RF_COUNTER_SIZE-1:0] rf_cnt_poisoned;
|
196 |
|
|
wire [RF_COUNTER_SIZE-1:0] rf_cnt_p;
|
197 |
|
|
wire [RF_COUNTER_SIZE-1:0] rf_cnt_np;
|
198 |
|
|
wire [RF_COUNTER_SIZE-1:0] rf_cnt_r;
|
199 |
|
|
wire [RF_COUNTER_SIZE-1:0] rf_cnt_rsp_rcvd;
|
200 |
11 |
juko |
//Status
|
201 |
15 |
juko |
wire rf_link_up;
|
202 |
|
|
wire [2:0] rf_rx_init_status;
|
203 |
11 |
juko |
wire [1:0] rf_tx_init_status;
|
204 |
15 |
juko |
wire [LOG_MAX_HMC_TOKENS-1:0]rf_hmc_tokens_av;
|
205 |
|
|
wire [LOG_MAX_RX_TOKENS-1:0]rf_rx_tokens_av;
|
206 |
11 |
juko |
//Init Status
|
207 |
|
|
wire rf_all_descramblers_aligned;
|
208 |
|
|
wire [NUM_LANES-1:0] rf_descrambler_aligned;
|
209 |
|
|
wire [NUM_LANES-1:0] rf_descrambler_part_aligned;
|
210 |
|
|
//Control
|
211 |
|
|
wire rf_hmc_init_cont_set;
|
212 |
|
|
wire rf_set_hmc_sleep;
|
213 |
15 |
juko |
wire rf_warm_reset;
|
214 |
11 |
juko |
wire rf_scrambler_disable;
|
215 |
|
|
wire [NUM_LANES-1:0] rf_lane_polarity;
|
216 |
|
|
wire [NUM_LANES-1:0] rf_descramblers_locked;
|
217 |
15 |
juko |
wire [LOG_MAX_RX_TOKENS-1:0]rf_rx_buffer_rtc;
|
218 |
11 |
juko |
wire rf_lane_reversal_detected;
|
219 |
|
|
wire [4:0] rf_irtry_received_threshold;
|
220 |
|
|
wire [4:0] rf_irtry_to_send;
|
221 |
|
|
wire rf_run_length_enable;
|
222 |
|
|
|
223 |
15 |
juko |
assign phy_init_cont_set = rf_hmc_init_cont_set;
|
224 |
|
|
|
225 |
|
|
//Generate
|
226 |
|
|
wire rf_scrambler_disable_temp;
|
227 |
|
|
wire [LOG_MAX_RX_TOKENS-1:0] rf_rx_buffer_rtc_temp;
|
228 |
|
|
generate
|
229 |
|
|
if(CTRL_SCRAMBLERS==1) begin : ctrl_scramblers
|
230 |
|
|
assign rf_scrambler_disable = rf_scrambler_disable_temp;
|
231 |
|
|
end else begin : remove_scrambler_disable_bit
|
232 |
|
|
assign rf_scrambler_disable = 1'b0;
|
233 |
|
|
end
|
234 |
|
|
if(OPEN_RSP_MODE==1) begin : remove_rx_tokens_rsp_open_loop_mode
|
235 |
|
|
assign rf_rx_buffer_rtc = {LOG_MAX_RX_TOKENS{1'b0}};
|
236 |
|
|
end else begin : regular_mode_use_rx_tokens
|
237 |
|
|
assign rf_rx_buffer_rtc = rf_rx_buffer_rtc_temp;
|
238 |
|
|
end
|
239 |
|
|
endgenerate
|
240 |
|
|
|
241 |
11 |
juko |
// ----Assign PHY wires
|
242 |
|
|
assign phy_lane_polarity = (CTRL_LANE_POLARITY==1) ? {NUM_LANES{1'b0}} : rf_lane_polarity;
|
243 |
|
|
|
244 |
|
|
//=====================================================================================================
|
245 |
|
|
//-----------------------------------------------------------------------------------------------------
|
246 |
|
|
//---------INSTANTIATIONS HERE-------------------------------------------------------------------------
|
247 |
|
|
//-----------------------------------------------------------------------------------------------------
|
248 |
|
|
//=====================================================================================================
|
249 |
|
|
//----------------------------------------------------------------------
|
250 |
|
|
//-----TX-----TX-----TX-----TX-----TX-----TX-----TX-----TX-----TX-----TX
|
251 |
|
|
//----------------------------------------------------------------------
|
252 |
15 |
juko |
generate
|
253 |
|
|
if(SYNC_AXI4_IF==0) begin : async_axi4_tx_fifo
|
254 |
|
|
openhmc_async_fifo #(
|
255 |
|
|
.DWIDTH(DWIDTH+(FPW*3)),
|
256 |
|
|
.ENTRIES(16)
|
257 |
|
|
) fifo_tx_data (
|
258 |
|
|
//System
|
259 |
|
|
.si_clk(clk_user),
|
260 |
|
|
.so_clk(clk_hmc),
|
261 |
|
|
.si_res_n(res_n_user),
|
262 |
|
|
.so_res_n(res_n_hmc),
|
263 |
11 |
juko |
|
264 |
15 |
juko |
//From AXI-4 TX IF
|
265 |
|
|
.d_in({s_axis_tx_TUSER[(FPW*3)-1:0],s_axis_tx_TDATA}),
|
266 |
|
|
.shift_in(s_axis_tx_TVALID && s_axis_tx_TREADY),
|
267 |
|
|
.full(s_axis_tx_TREADY_n),
|
268 |
|
|
.almost_full(),
|
269 |
11 |
juko |
|
270 |
15 |
juko |
//To TX Link Logic
|
271 |
|
|
.d_out({tx_d_in_ctrl,tx_d_in_data}),
|
272 |
|
|
.shift_out(tx_shift_out),
|
273 |
|
|
.empty(tx_empty),
|
274 |
|
|
.almost_empty(tx_a_empty)
|
275 |
|
|
);
|
276 |
|
|
end else begin : synchronous_axi4_tx_fifo
|
277 |
|
|
`ifdef XILINX
|
278 |
|
|
openhmc_sync_fifo_xilinx #(
|
279 |
|
|
.DWIDTH(DWIDTH+(FPW*3))
|
280 |
|
|
) fifo_tx_data_sync_xilinx(
|
281 |
|
|
//System
|
282 |
|
|
.clk(clk_hmc),
|
283 |
|
|
.res_n(res_n_hmc),
|
284 |
11 |
juko |
|
285 |
15 |
juko |
//To RX LINK Logic
|
286 |
|
|
.d_in({s_axis_tx_TUSER[(FPW*3)-1:0],s_axis_tx_TDATA}),
|
287 |
|
|
.shift_in(s_axis_tx_TVALID && s_axis_tx_TREADY),
|
288 |
|
|
.full(s_axis_tx_TREADY_n),
|
289 |
|
|
.almost_full(),
|
290 |
11 |
juko |
|
291 |
15 |
juko |
//AXI-4 RX IF
|
292 |
|
|
.d_out({tx_d_in_ctrl,tx_d_in_data}),
|
293 |
|
|
.shift_out(tx_shift_out),
|
294 |
|
|
.empty(tx_empty),
|
295 |
|
|
.almost_empty(tx_a_empty)
|
296 |
|
|
);
|
297 |
|
|
`else
|
298 |
|
|
openhmc_sync_fifo_reg_based #(
|
299 |
|
|
.DWIDTH(DWIDTH+(FPW*3)),
|
300 |
|
|
.ENTRIES(4)
|
301 |
|
|
) fifo_tx_data_sync(
|
302 |
|
|
//System
|
303 |
|
|
.clk(clk_hmc),
|
304 |
|
|
.res_n(res_n_hmc),
|
305 |
|
|
|
306 |
|
|
//To RX LINK Logic
|
307 |
|
|
.d_in({s_axis_tx_TUSER[(FPW*3)-1:0],s_axis_tx_TDATA}),
|
308 |
|
|
.shift_in(s_axis_tx_TVALID && s_axis_tx_TREADY),
|
309 |
|
|
.full(s_axis_tx_TREADY_n),
|
310 |
|
|
.almost_full(),
|
311 |
|
|
|
312 |
|
|
//AXI-4 RX IF
|
313 |
|
|
.d_out({tx_d_in_ctrl,tx_d_in_data}),
|
314 |
|
|
.shift_out(tx_shift_out),
|
315 |
|
|
.empty(tx_empty),
|
316 |
|
|
.almost_empty(tx_a_empty)
|
317 |
|
|
);
|
318 |
|
|
`endif
|
319 |
|
|
end
|
320 |
|
|
endgenerate
|
321 |
|
|
|
322 |
|
|
|
323 |
11 |
juko |
tx_link #(
|
324 |
|
|
.LOG_FPW(LOG_FPW),
|
325 |
|
|
.FPW(FPW),
|
326 |
|
|
.NUM_LANES(NUM_LANES),
|
327 |
15 |
juko |
.RF_COUNTER_SIZE(RF_COUNTER_SIZE),
|
328 |
11 |
juko |
.HMC_RX_AC_COUPLED(HMC_RX_AC_COUPLED),
|
329 |
15 |
juko |
.MAX_RTC_RET_LOG(MAX_RTC_RET_LOG),
|
330 |
|
|
.LOG_MAX_RX_TOKENS(LOG_MAX_RX_TOKENS),
|
331 |
|
|
.LOG_MAX_HMC_TOKENS(LOG_MAX_HMC_TOKENS),
|
332 |
|
|
.XIL_CNT_PIPELINED(XIL_CNT_PIPELINED),
|
333 |
11 |
juko |
//Debug
|
334 |
15 |
juko |
.DBG_RX_TOKEN_MON(DBG_RX_TOKEN_MON),
|
335 |
|
|
.OPEN_RSP_MODE(OPEN_RSP_MODE)
|
336 |
11 |
juko |
) tx_link_I(
|
337 |
|
|
|
338 |
|
|
//----------------------------------
|
339 |
|
|
//----SYSTEM INTERFACE
|
340 |
|
|
//----------------------------------
|
341 |
|
|
.clk(clk_hmc),
|
342 |
|
|
.res_n(res_n_hmc),
|
343 |
|
|
|
344 |
|
|
//----------------------------------
|
345 |
|
|
//----TO HMC PHY
|
346 |
|
|
//----------------------------------
|
347 |
|
|
.phy_scrambled_data_out(phy_data_tx_link2phy),
|
348 |
|
|
|
349 |
|
|
//----------------------------------
|
350 |
|
|
//----HMC IF
|
351 |
|
|
//----------------------------------
|
352 |
15 |
juko |
.LXRXPS(LXRXPS),
|
353 |
|
|
.LXTXPS(LXTXPS),
|
354 |
11 |
juko |
|
355 |
|
|
//----------------------------------
|
356 |
|
|
//----FROM HMC_TX_HTAX_LOGIC
|
357 |
|
|
//----------------------------------
|
358 |
|
|
.d_in_data(tx_d_in_data),
|
359 |
|
|
.d_in_flit_is_valid(tx_d_in_ctrl[FPW-1:0]),
|
360 |
|
|
.d_in_flit_is_hdr(tx_d_in_ctrl[(2*FPW)-1:1*FPW]),
|
361 |
|
|
.d_in_flit_is_tail(tx_d_in_ctrl[(3*FPW)-1:(2*FPW)]),
|
362 |
|
|
.d_in_empty(tx_empty),
|
363 |
|
|
.d_in_a_empty(tx_a_empty),
|
364 |
|
|
.d_in_shift_out(tx_shift_out),
|
365 |
|
|
|
366 |
|
|
//----------------------------------
|
367 |
|
|
//----RX Block
|
368 |
|
|
//----------------------------------
|
369 |
|
|
.rx_force_tx_retry(rx2tx_link_retry),
|
370 |
|
|
.rx_error_abort_mode(rx2tx_error_abort_mode),
|
371 |
|
|
.rx_error_abort_mode_cleared(rx2tx_error_abort_mode_cleared),
|
372 |
|
|
.rx_hmc_frp(rx2tx_hmc_frp),
|
373 |
|
|
.rx_rrp(rx2tx_rrp),
|
374 |
|
|
.rx_returned_tokens(rx2tx_returned_tokens),
|
375 |
|
|
.rx_hmc_tokens_to_return(rx2tx_hmc_tokens_to_return),
|
376 |
|
|
.rx_hmc_poisoned_tokens_to_return(rx2tx_hmc_poisoned_tokens_to_return),
|
377 |
|
|
|
378 |
|
|
//----------------------------------
|
379 |
|
|
//----RF
|
380 |
|
|
//----------------------------------
|
381 |
|
|
//Monitoring 1-cycle set to increment
|
382 |
|
|
.rf_cnt_retry(rf_cnt_retry),
|
383 |
|
|
.rf_sent_p(rf_cnt_p),
|
384 |
|
|
.rf_sent_np(rf_cnt_np),
|
385 |
|
|
.rf_sent_r(rf_cnt_r),
|
386 |
|
|
.rf_run_length_bit_flip(rf_run_length_bit_flip),
|
387 |
|
|
.rf_error_abort_not_cleared(rf_error_abort_not_cleared),
|
388 |
|
|
//Status
|
389 |
15 |
juko |
.rf_hmc_received_init_null(rf_rx_init_status==3'b010),
|
390 |
|
|
.rf_link_is_up(rf_link_up),
|
391 |
11 |
juko |
.rf_descramblers_aligned(rf_all_descramblers_aligned),
|
392 |
|
|
.rf_tx_init_status(rf_tx_init_status),
|
393 |
|
|
.rf_hmc_tokens_av(rf_hmc_tokens_av),
|
394 |
|
|
.rf_rx_tokens_av(rf_rx_tokens_av),
|
395 |
|
|
//Control
|
396 |
|
|
.rf_hmc_sleep_requested(rf_set_hmc_sleep),
|
397 |
15 |
juko |
.rf_warm_reset(rf_warm_reset),
|
398 |
11 |
juko |
.rf_scrambler_disable(rf_scrambler_disable),
|
399 |
|
|
.rf_rx_buffer_rtc(rf_rx_buffer_rtc),
|
400 |
|
|
.rf_irtry_to_send(rf_irtry_to_send),
|
401 |
15 |
juko |
.rf_run_length_enable(rf_run_length_enable)
|
402 |
11 |
juko |
|
403 |
|
|
);
|
404 |
|
|
|
405 |
|
|
//----------------------------------------------------------------------
|
406 |
|
|
//-----RX-----RX-----RX-----RX-----RX-----RX-----RX-----RX-----RX-----RX
|
407 |
|
|
//----------------------------------------------------------------------
|
408 |
|
|
rx_link #(
|
409 |
|
|
.LOG_FPW(LOG_FPW),
|
410 |
|
|
.FPW(FPW),
|
411 |
|
|
.LOG_NUM_LANES(LOG_NUM_LANES),
|
412 |
15 |
juko |
.RF_COUNTER_SIZE(RF_COUNTER_SIZE),
|
413 |
11 |
juko |
//Configure the functionality
|
414 |
15 |
juko |
.XIL_CNT_PIPELINED(XIL_CNT_PIPELINED),
|
415 |
|
|
.LOG_MAX_RX_TOKENS(LOG_MAX_RX_TOKENS),
|
416 |
|
|
.MAX_RTC_RET_LOG(MAX_RTC_RET_LOG),
|
417 |
|
|
.RX_BIT_SLIP_CNT_LOG(RX_BIT_SLIP_CNT_LOG),
|
418 |
11 |
juko |
.CTRL_LANE_POLARITY(CTRL_LANE_POLARITY),
|
419 |
15 |
juko |
.DETECT_LANE_POLARITY(DETECT_LANE_POLARITY),
|
420 |
11 |
juko |
.CTRL_LANE_REVERSAL(CTRL_LANE_REVERSAL),
|
421 |
15 |
juko |
.BITSLIP_SHIFT_RIGHT(BITSLIP_SHIFT_RIGHT),
|
422 |
|
|
.OPEN_RSP_MODE(OPEN_RSP_MODE),
|
423 |
|
|
.RX_RELAX_INIT_TIMING(RX_RELAX_INIT_TIMING)
|
424 |
11 |
juko |
) rx_link_I (
|
425 |
|
|
|
426 |
|
|
//----------------------------------
|
427 |
|
|
//----SYSTEM INTERFACE
|
428 |
|
|
//----------------------------------
|
429 |
|
|
.clk(clk_hmc),
|
430 |
|
|
.res_n(res_n_hmc),
|
431 |
|
|
|
432 |
|
|
//----------------------------------
|
433 |
|
|
//----TO HMC PHY
|
434 |
|
|
//----------------------------------
|
435 |
|
|
.phy_scrambled_data_in(phy_data_rx_phy2link),
|
436 |
15 |
juko |
.phy_bit_slip(phy_bit_slip),
|
437 |
|
|
.run_rx(phy_rx_ready),
|
438 |
11 |
juko |
|
439 |
|
|
//----------------------------------
|
440 |
|
|
//----FROM TO RX HTAX FIFO
|
441 |
|
|
//----------------------------------
|
442 |
|
|
.d_out_fifo_data(rx_d_in_data),
|
443 |
|
|
.d_out_fifo_a_full(rx_a_full),
|
444 |
|
|
.d_out_fifo_shift_in(rx_shift_in),
|
445 |
|
|
.d_out_fifo_ctrl(rx_d_in_ctrl),
|
446 |
|
|
|
447 |
|
|
//----------------------------------
|
448 |
|
|
//----TO TX Block
|
449 |
|
|
//----------------------------------
|
450 |
|
|
.tx_link_retry(rx2tx_link_retry),
|
451 |
|
|
.tx_error_abort_mode(rx2tx_error_abort_mode),
|
452 |
|
|
.tx_error_abort_mode_cleared(rx2tx_error_abort_mode_cleared),
|
453 |
|
|
.tx_hmc_frp(rx2tx_hmc_frp),
|
454 |
|
|
.tx_rrp(rx2tx_rrp),
|
455 |
|
|
.tx_returned_tokens(rx2tx_returned_tokens),
|
456 |
|
|
.tx_hmc_tokens_to_return(rx2tx_hmc_tokens_to_return),
|
457 |
|
|
.tx_hmc_poisoned_tokens_to_return(rx2tx_hmc_poisoned_tokens_to_return),
|
458 |
|
|
|
459 |
|
|
//----------------------------------
|
460 |
|
|
//----RF
|
461 |
|
|
//----------------------------------
|
462 |
|
|
//Monitoring 1-cycle set to increment
|
463 |
|
|
.rf_cnt_poisoned(rf_cnt_poisoned),
|
464 |
|
|
.rf_cnt_rsp(rf_cnt_rsp_rcvd),
|
465 |
|
|
//Status
|
466 |
15 |
juko |
.rf_link_up(rf_link_up),
|
467 |
|
|
.rf_rx_init_status(rf_rx_init_status),
|
468 |
|
|
.rf_hmc_sleep(~LXTXPS),
|
469 |
11 |
juko |
//Init Status
|
470 |
|
|
.rf_all_descramblers_aligned(rf_all_descramblers_aligned),
|
471 |
|
|
.rf_descrambler_aligned(rf_descrambler_aligned),
|
472 |
|
|
.rf_descrambler_part_aligned(rf_descrambler_part_aligned),
|
473 |
|
|
.rf_descramblers_locked(rf_descramblers_locked),
|
474 |
|
|
//Control
|
475 |
|
|
.rf_lane_polarity(rf_lane_polarity),
|
476 |
|
|
.rf_scrambler_disable(rf_scrambler_disable),
|
477 |
|
|
.rf_lane_reversal_detected(rf_lane_reversal_detected),
|
478 |
|
|
.rf_irtry_received_threshold(rf_irtry_received_threshold)
|
479 |
|
|
);
|
480 |
|
|
|
481 |
15 |
juko |
generate
|
482 |
|
|
if(SYNC_AXI4_IF==0) begin : async_axi4_rx_fifo
|
483 |
|
|
openhmc_async_fifo #(
|
484 |
|
|
.DWIDTH(DWIDTH+(FPW*4)),
|
485 |
|
|
.ENTRIES(16)
|
486 |
|
|
) fifo_rx_data(
|
487 |
|
|
//System
|
488 |
|
|
.si_clk(clk_hmc),
|
489 |
|
|
.so_clk(clk_user),
|
490 |
|
|
.si_res_n(res_n_hmc),
|
491 |
|
|
.so_res_n(res_n_user),
|
492 |
11 |
juko |
|
493 |
15 |
juko |
//To RX LINK Logic
|
494 |
|
|
.d_in({rx_d_in_ctrl,rx_d_in_data}),
|
495 |
|
|
.shift_in(rx_shift_in),
|
496 |
|
|
.full(),
|
497 |
|
|
.almost_full(rx_a_full),
|
498 |
11 |
juko |
|
499 |
15 |
juko |
//AXI-4 RX IF
|
500 |
|
|
.d_out({m_axis_rx_TUSER_temp,m_axis_rx_TDATA}),
|
501 |
|
|
.shift_out(m_axis_rx_TVALID && m_axis_rx_TREADY),
|
502 |
|
|
.empty(m_axis_rx_TVALID_n),
|
503 |
|
|
.almost_empty()
|
504 |
11 |
juko |
|
505 |
15 |
juko |
);
|
506 |
|
|
end else begin : synchronous_axi4_rx_fifo
|
507 |
|
|
`ifdef XILINX
|
508 |
|
|
openhmc_sync_fifo_xilinx #(
|
509 |
|
|
.DWIDTH(DWIDTH+(FPW*4))
|
510 |
|
|
) fifo_rx_data_sync_xilinx(
|
511 |
|
|
//System
|
512 |
|
|
.clk(clk_hmc),
|
513 |
11 |
juko |
.res_n(res_n_hmc),
|
514 |
|
|
|
515 |
15 |
juko |
//To RX LINK Logic
|
516 |
|
|
.d_in({rx_d_in_ctrl,rx_d_in_data}),
|
517 |
|
|
.shift_in(rx_shift_in),
|
518 |
|
|
.full(),
|
519 |
|
|
.almost_full(rx_a_full),
|
520 |
11 |
juko |
|
521 |
15 |
juko |
//AXI-4 RX IF
|
522 |
|
|
.d_out({m_axis_rx_TUSER_temp,m_axis_rx_TDATA}),
|
523 |
|
|
.shift_out(m_axis_rx_TVALID && m_axis_rx_TREADY),
|
524 |
|
|
.empty(m_axis_rx_TVALID_n),
|
525 |
|
|
.almost_empty()
|
526 |
|
|
);
|
527 |
|
|
`else
|
528 |
|
|
openhmc_sync_fifo_reg_based #(
|
529 |
|
|
.DWIDTH(DWIDTH+(FPW*4)),
|
530 |
|
|
.ENTRIES(4)
|
531 |
|
|
) fifo_rx_data_sync(
|
532 |
|
|
//System
|
533 |
|
|
.clk(clk_hmc),
|
534 |
|
|
.res_n(res_n_hmc),
|
535 |
11 |
juko |
|
536 |
15 |
juko |
//To RX LINK Logic
|
537 |
|
|
.d_in({rx_d_in_ctrl,rx_d_in_data}),
|
538 |
|
|
.shift_in(rx_shift_in),
|
539 |
|
|
.full(),
|
540 |
|
|
.almost_full(rx_a_full),
|
541 |
11 |
juko |
|
542 |
15 |
juko |
//AXI-4 RX IF
|
543 |
|
|
.d_out({m_axis_rx_TUSER_temp,m_axis_rx_TDATA}),
|
544 |
|
|
.shift_out(m_axis_rx_TVALID && m_axis_rx_TREADY),
|
545 |
|
|
.empty(m_axis_rx_TVALID_n),
|
546 |
|
|
.almost_empty()
|
547 |
|
|
);
|
548 |
|
|
`endif
|
549 |
|
|
end
|
550 |
|
|
endgenerate
|
551 |
11 |
juko |
|
552 |
15 |
juko |
//----------------------------------------------------------------------
|
553 |
|
|
//---Register File---Register File---Register File---Register File---Reg
|
554 |
|
|
//----------------------------------------------------------------------
|
555 |
|
|
openhmc_rf #(
|
556 |
|
|
.NUM_LANES(NUM_LANES),
|
557 |
|
|
.XIL_CNT_PIPELINED(XIL_CNT_PIPELINED),
|
558 |
|
|
.LOG_MAX_RX_TOKENS(LOG_MAX_RX_TOKENS),
|
559 |
|
|
.LOG_MAX_HMC_TOKENS(LOG_MAX_HMC_TOKENS),
|
560 |
|
|
.RF_COUNTER_SIZE(RF_COUNTER_SIZE),
|
561 |
|
|
.HMC_RF_WWIDTH(HMC_RF_WWIDTH),
|
562 |
|
|
.HMC_RF_AWIDTH(HMC_RF_AWIDTH),
|
563 |
|
|
.HMC_RF_RWIDTH(HMC_RF_RWIDTH)
|
564 |
|
|
) openhmc_rf_I (
|
565 |
|
|
//system IF
|
566 |
|
|
.res_n(res_n_hmc),
|
567 |
|
|
.clk(clk_hmc),
|
568 |
11 |
juko |
|
569 |
15 |
juko |
//rf access
|
570 |
|
|
.address(rf_address),
|
571 |
|
|
.read_data(rf_read_data),
|
572 |
|
|
.invalid_address(rf_invalid_address),
|
573 |
|
|
.access_complete(rf_access_complete),
|
574 |
|
|
.read_en(rf_read_en),
|
575 |
|
|
.write_en(rf_write_en),
|
576 |
|
|
.write_data(rf_write_data),
|
577 |
11 |
juko |
|
578 |
15 |
juko |
//status registers
|
579 |
|
|
.status_general_link_up_next(rf_link_up),
|
580 |
|
|
.status_general_link_training_next(~rf_link_up),
|
581 |
|
|
.status_general_sleep_mode_next(~LXTXPS),
|
582 |
|
|
.status_general_FERR_N_next(FERR_N),
|
583 |
|
|
.status_general_phy_tx_ready_next(phy_tx_ready),
|
584 |
|
|
.status_general_phy_rx_ready_next(phy_rx_ready),
|
585 |
|
|
.status_general_lanes_reversed_next(rf_lane_reversal_detected),
|
586 |
|
|
.status_general_hmc_tokens_remaining_next(rf_hmc_tokens_av),
|
587 |
|
|
.status_general_rx_tokens_remaining_next(rf_rx_tokens_av),
|
588 |
|
|
.status_general_lane_polarity_reversed_next(rf_lane_polarity),
|
589 |
11 |
juko |
|
590 |
15 |
juko |
//init status
|
591 |
|
|
.status_init_lane_descramblers_locked_next(rf_descramblers_locked),
|
592 |
|
|
.status_init_descrambler_part_aligned_next(rf_descrambler_part_aligned),
|
593 |
|
|
.status_init_descrambler_aligned_next(rf_descrambler_aligned),
|
594 |
|
|
.status_init_all_descramblers_aligned_next(rf_all_descramblers_aligned),
|
595 |
|
|
.status_init_rx_init_state_next(rf_rx_init_status),
|
596 |
|
|
.status_init_tx_init_state_next(rf_tx_init_status),
|
597 |
11 |
juko |
|
598 |
15 |
juko |
//counters
|
599 |
|
|
.sent_np_cnt_next(rf_cnt_np),
|
600 |
|
|
.sent_p_cnt_next(rf_cnt_p),
|
601 |
|
|
.sent_r_cnt_next(rf_cnt_r),
|
602 |
|
|
.poisoned_packets_cnt_next(rf_cnt_poisoned),
|
603 |
|
|
.rcvd_rsp_cnt_next(rf_cnt_rsp_rcvd),
|
604 |
11 |
juko |
|
605 |
15 |
juko |
//Single bit counter
|
606 |
|
|
.tx_link_retries_count_countup(rf_cnt_retry),
|
607 |
|
|
.errors_on_rx_count_countup(rx2tx_error_abort_mode_cleared),
|
608 |
|
|
.run_length_bit_flip_count_countup(rf_run_length_bit_flip),
|
609 |
|
|
.error_abort_not_cleared_count_countup(rf_error_abort_not_cleared),
|
610 |
11 |
juko |
|
611 |
15 |
juko |
//control
|
612 |
|
|
.control_p_rst_n(P_RST_N),
|
613 |
|
|
.control_hmc_init_cont_set(rf_hmc_init_cont_set),
|
614 |
|
|
.control_set_hmc_sleep(rf_set_hmc_sleep),
|
615 |
|
|
.control_warm_reset(rf_warm_reset),
|
616 |
|
|
.control_scrambler_disable(rf_scrambler_disable_temp),
|
617 |
|
|
.control_run_length_enable(rf_run_length_enable),
|
618 |
|
|
.control_rx_token_count(rf_rx_buffer_rtc_temp),
|
619 |
|
|
.control_irtry_received_threshold(rf_irtry_received_threshold),
|
620 |
|
|
.control_irtry_to_send(rf_irtry_to_send)
|
621 |
|
|
);
|
622 |
11 |
juko |
|
623 |
|
|
endmodule
|
624 |
|
|
|
625 |
15 |
juko |
`default_nettype wire
|