1 |
15 |
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 .
|
36 |
|
|
*
|
37 |
|
|
*
|
38 |
|
|
*/
|
39 |
|
|
|
40 |
|
|
`default_nettype none
|
41 |
|
|
`timescale 100ps/1ps
|
42 |
|
|
|
43 |
|
|
module dut #(
|
44 |
|
|
//*************************Don't touch! Control the design with arguments when executing run.sh
|
45 |
|
|
parameter LOG_NUM_LANES = `LOG_NUM_LANES,
|
46 |
|
|
parameter NUM_LANES = 2**LOG_NUM_LANES,
|
47 |
|
|
parameter LOG_FPW = `LOG_FPW,
|
48 |
|
|
parameter FPW = `FPW,
|
49 |
|
|
parameter DWIDTH = 128*FPW,
|
50 |
|
|
parameter NUM_DATA_BYTES = 16*FPW,
|
51 |
|
|
parameter LANE_WIDTH = DWIDTH / NUM_LANES
|
52 |
|
|
//*************************
|
53 |
|
|
)
|
54 |
|
|
(
|
55 |
|
|
//AXI4 user clock
|
56 |
|
|
input wire clk_user,
|
57 |
|
|
//125MHz reference clock
|
58 |
|
|
input wire clk_hmc_refclk,
|
59 |
|
|
//Global reset
|
60 |
|
|
input wire res_n,
|
61 |
|
|
|
62 |
|
|
//HMC Link interface
|
63 |
|
|
hmc_sr_if hmc,
|
64 |
|
|
//AXI4 interface ports
|
65 |
|
|
axi4_stream_if axi4_req,
|
66 |
|
|
axi4_stream_if axi4_rsp,
|
67 |
|
|
|
68 |
|
|
//Register File interface
|
69 |
|
|
cag_rgm_rfs_if rfs_hmc
|
70 |
|
|
);
|
71 |
|
|
|
72 |
|
|
//----------------------------- Wiring openHMC controller
|
73 |
|
|
wire [DWIDTH-1:0] to_serializers;
|
74 |
|
|
wire [DWIDTH-1:0] from_deserializers;
|
75 |
|
|
wire [NUM_LANES-1:0] bit_slip;
|
76 |
|
|
wire [NUM_LANES-1:0] phy_lane_polarity;
|
77 |
|
|
bit phy_rx_ready;
|
78 |
|
|
bit P_RST_N;
|
79 |
|
|
//If transceiver models are used, clk_hmc should be sourced from the transceiver outclock and res_n hmc can be set independently
|
80 |
|
|
wire clk_hmc = clk_user;
|
81 |
|
|
wire res_n_hmc = res_n;
|
82 |
|
|
|
83 |
|
|
// Wire the HMC BFM model
|
84 |
|
|
wire LxRXPS; // HMC input
|
85 |
|
|
wire LxTXPS; // HMC output
|
86 |
|
|
wire FERR_N; // HMC output
|
87 |
|
|
wire LxTXPS_pullup;
|
88 |
|
|
assign LxTXPS_pullup = (LxTXPS === 1'bz) ? 1'b1 : LxTXPS;
|
89 |
|
|
wire FERR_N_pullup;
|
90 |
|
|
assign FERR_N_pullup = (FERR_N === 1'bz) ? 1'b1 : FERR_N;
|
91 |
|
|
|
92 |
|
|
//----------------------------- Signal Routing from SerDes to HMC
|
93 |
|
|
wire [NUM_LANES-1:0] serial_Rx;
|
94 |
|
|
wire [NUM_LANES-1:0] serial_Txp;
|
95 |
|
|
|
96 |
|
|
//----------------------------- Attach the Register File System interface
|
97 |
|
|
assign rfs_hmc_if.clk = clk_hmc;
|
98 |
|
|
assign rfs_hmc_if.res_n = res_n;
|
99 |
|
|
|
100 |
|
|
//Assign the AXI4 IF
|
101 |
|
|
assign axi4_req.ACLK = (`OPENHMC_ASYNC_FIFOS==0) ? clk_hmc : clk_user;
|
102 |
|
|
assign axi4_rsp.ACLK = (`OPENHMC_ASYNC_FIFOS==0) ? clk_hmc : clk_user;
|
103 |
|
|
assign axi4_req.ARESET_N = (`OPENHMC_ASYNC_FIFOS==0) ? res_n_hmc : res_n;
|
104 |
|
|
assign axi4_rsp.ARESET_N = (`OPENHMC_ASYNC_FIFOS==0) ? res_n_hmc : res_n;
|
105 |
|
|
|
106 |
|
|
//------------------------------ Attach the HMC Link interface
|
107 |
|
|
assign hmc.REFCLKP = clk_hmc_refclk;
|
108 |
|
|
assign hmc.REFCLKN = ~clk_hmc_refclk;
|
109 |
|
|
assign FERR_N = hmc.FERR_N;
|
110 |
|
|
assign hmc.REFCLK_BOOT = 2'b00; // 00 -> 125 MHz, 01 -> 156.25 MHz, 10 -> 166.67 MHz
|
111 |
|
|
assign hmc.P_RST_N = P_RST_N;
|
112 |
|
|
assign LxTXPS = hmc.TXPS;
|
113 |
|
|
assign hmc.RXPS = LxRXPS;
|
114 |
|
|
|
115 |
|
|
assign hmc.RXP = NUM_LANES==8 ? {8'h0, serial_Txp[NUM_LANES-1:0]} : serial_Txp; // Controller Tx is Cube Rx
|
116 |
|
|
assign hmc.RXN = ~hmc.RXP;//NUM_LANES==8 ? {8'h0, ~serial_Txp[NUM_LANES-1:0]} : ~serial_Txp; // Controller Tx is Cube Rx
|
117 |
|
|
assign serial_Rx = hmc.TXP; // Controller Rx is Cube Tx
|
118 |
|
|
|
119 |
|
|
//----------------------------- Generate Clocks
|
120 |
|
|
bit clk_10G;
|
121 |
|
|
generate
|
122 |
|
|
begin : clocking_gen
|
123 |
|
|
initial clk_10G = 1'b1;
|
124 |
|
|
always #0.05ns clk_10G = ~clk_10G;
|
125 |
|
|
end
|
126 |
|
|
endgenerate
|
127 |
|
|
|
128 |
|
|
//----------------------------- Behavioral SerDes
|
129 |
|
|
bit LxTXPS_synced;
|
130 |
|
|
bit res_n_synced;
|
131 |
|
|
genvar lane;
|
132 |
|
|
generate
|
133 |
|
|
begin : serializers_gen
|
134 |
|
|
|
135 |
|
|
for (lane=0; lane
|
136 |
|
|
serializer #(
|
137 |
|
|
.DWIDTH(LANE_WIDTH)
|
138 |
|
|
) serializer_I (
|
139 |
|
|
.clk(clk_hmc),
|
140 |
|
|
.res_n(res_n),
|
141 |
|
|
.fast_clk(clk_10G),
|
142 |
|
|
.data_in(to_serializers[lane*LANE_WIDTH+LANE_WIDTH-1:lane*LANE_WIDTH]),
|
143 |
|
|
.data_out(serial_Txp[lane])
|
144 |
|
|
);
|
145 |
|
|
deserializer #(
|
146 |
|
|
.DWIDTH(LANE_WIDTH)
|
147 |
|
|
) deserializer_I (
|
148 |
|
|
.clk(clk_hmc),
|
149 |
|
|
.res_n(LxTXPS_synced && res_n),
|
150 |
|
|
.fast_clk(clk_10G),
|
151 |
|
|
.bit_slip(bit_slip[lane]),
|
152 |
|
|
.lane_polarity(phy_lane_polarity[lane]),
|
153 |
|
|
.data_in(serial_Rx[lane]),
|
154 |
|
|
.data_out(from_deserializers[lane*LANE_WIDTH+LANE_WIDTH-1:lane*LANE_WIDTH])
|
155 |
|
|
);
|
156 |
|
|
end
|
157 |
|
|
end
|
158 |
|
|
endgenerate
|
159 |
|
|
|
160 |
|
|
always @(LxTXPS) phy_rx_ready <= #500ns LxTXPS;
|
161 |
|
|
always @(posedge clk_hmc) LxTXPS_synced <= LxTXPS;
|
162 |
|
|
|
163 |
|
|
//=====================================================================================================
|
164 |
|
|
//-----------------------------------------------------------------------------------------------------
|
165 |
|
|
//---------INSTANTIATIONS HERE-------------------------------------------------------------------------
|
166 |
|
|
//-----------------------------------------------------------------------------------------------------
|
167 |
|
|
//=====================================================================================================
|
168 |
|
|
openhmc_top #(
|
169 |
|
|
.LOG_FPW(LOG_FPW),
|
170 |
|
|
.FPW(FPW),
|
171 |
|
|
.LOG_NUM_LANES(LOG_NUM_LANES),
|
172 |
|
|
//Configure the Functionality
|
173 |
|
|
.LOG_MAX_RX_TOKENS(10), //That is max 1023 Tokens
|
174 |
|
|
.LOG_MAX_HMC_TOKENS(10), //That is max 1023 Tokens
|
175 |
|
|
.HMC_RX_AC_COUPLED(1),
|
176 |
|
|
.CTRL_LANE_POLARITY(1),
|
177 |
|
|
.CTRL_LANE_REVERSAL(1),
|
178 |
|
|
.BITSLIP_SHIFT_RIGHT(1),
|
179 |
|
|
.OPEN_RSP_MODE(`OPEN_RSP_MODE),
|
180 |
|
|
.SYNC_AXI4_IF(`OPENHMC_ASYNC_FIFOS==0),
|
181 |
|
|
// Debug Logic
|
182 |
|
|
.DBG_RX_TOKEN_MON(1) //Required by the test check sequence
|
183 |
|
|
)
|
184 |
|
|
openhmc_instance
|
185 |
|
|
(
|
186 |
|
|
|
187 |
|
|
//----------------------------------
|
188 |
|
|
//----SYSTEM INTERFACES
|
189 |
|
|
//----------------------------------
|
190 |
|
|
.clk_user(clk_user),
|
191 |
|
|
.clk_hmc(clk_hmc),
|
192 |
|
|
.res_n_user(res_n),
|
193 |
|
|
.res_n_hmc(res_n),
|
194 |
|
|
|
195 |
|
|
//----------------------------------
|
196 |
|
|
//----Connect HMC Controller
|
197 |
|
|
//----------------------------------
|
198 |
|
|
//to TX
|
199 |
|
|
.s_axis_tx_TVALID(axi4_req.TVALID),
|
200 |
|
|
.s_axis_tx_TREADY(axi4_req.TREADY),
|
201 |
|
|
.s_axis_tx_TDATA(axi4_req.TDATA),
|
202 |
|
|
.s_axis_tx_TUSER(axi4_req.TUSER),
|
203 |
|
|
//from RX
|
204 |
|
|
.m_axis_rx_TVALID(axi4_rsp.TVALID),
|
205 |
|
|
.m_axis_rx_TREADY(axi4_rsp.TREADY),
|
206 |
|
|
.m_axis_rx_TDATA(axi4_rsp.TDATA),
|
207 |
|
|
.m_axis_rx_TUSER(axi4_rsp.TUSER),
|
208 |
|
|
|
209 |
|
|
//----------------------------------
|
210 |
|
|
//----Connect Physical Link
|
211 |
|
|
//----------------------------------
|
212 |
|
|
.phy_data_tx_link2phy(to_serializers),
|
213 |
|
|
.phy_data_rx_phy2link(from_deserializers),
|
214 |
|
|
.phy_bit_slip(bit_slip),
|
215 |
|
|
.phy_tx_ready(res_n),
|
216 |
|
|
.phy_rx_ready(phy_rx_ready && LxTXPS),
|
217 |
|
|
.phy_lane_polarity(phy_lane_polarity),
|
218 |
|
|
.phy_init_cont_set(),
|
219 |
|
|
|
220 |
|
|
//----------------------------------
|
221 |
|
|
//----Connect HMC
|
222 |
|
|
//----------------------------------
|
223 |
|
|
.P_RST_N(P_RST_N),
|
224 |
|
|
.LXRXPS(LxRXPS),
|
225 |
|
|
.LXTXPS(LxTXPS_pullup),
|
226 |
|
|
.FERR_N(FERR_N_pullup),
|
227 |
|
|
|
228 |
|
|
//----------------------------------
|
229 |
|
|
//----Connect RF
|
230 |
|
|
//----------------------------------
|
231 |
|
|
.rf_address(rfs_hmc.address),
|
232 |
|
|
.rf_read_data(rfs_hmc.read_data),
|
233 |
|
|
.rf_invalid_address(rfs_hmc.invalid_address),
|
234 |
|
|
.rf_access_complete(rfs_hmc.access_done),
|
235 |
|
|
.rf_read_en(rfs_hmc.ren),
|
236 |
|
|
.rf_write_en(rfs_hmc.wen),
|
237 |
|
|
.rf_write_data(rfs_hmc.write_data)
|
238 |
|
|
|
239 |
|
|
);
|
240 |
|
|
|
241 |
|
|
endmodule : dut
|
242 |
|
|
|
243 |
|
|
`default_nettype wire
|
244 |
|
|
|