OpenCores
URL https://opencores.org/ocsvn/openhmc/openhmc/trunk

Subversion Repositories openhmc

[/] [openhmc/] [trunk/] [openHMC/] [sim/] [tb/] [bfm/] [src/] [targets/] [dut_openhmc_behavioral_bfm.sv] - Blame information for rev 12

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 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/10ps
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
    //AXI4 interface ports
63
    axi4_stream_if axi4_req,
64
    axi4_stream_if axi4_rsp,
65
 
66
    //Register File interface
67
    cag_rgm_rfs_if rfs_hmc
68
);
69
 
70
//----------------------------- Wiring openHMC controller
71
wire [DWIDTH-1:0]       to_serializers;
72
wire [DWIDTH-1:0]       from_deserializers;
73
wire [NUM_LANES-1:0]    bit_slip;
74
wire [NUM_LANES-1:0]    phy_lane_polarity;
75
bit                     P_RST_N;
76
wire clk_hmc            = clk_user;
77
 
78
// Wire the HMC BFM model
79
wire            LxRXPS; // HMC input
80
wire            LxTXPS; // HMC output
81
wire            FERR_N; // HMC output
82
wire [16-1:0]   LxRXP;
83
wire [16-1:0]   LxRXN;
84
wire [16-1:0]   LxTXP;
85
wire [16-1:0]   LxTXN;
86
 
87
//----------------------------- Signal Routing from SerDes to HMC
88
wire [NUM_LANES-1:0] serial_Rx;
89
wire [NUM_LANES-1:0] serial_Txn;
90
wire [NUM_LANES-1:0] serial_Txp;
91
 
92
assign LxRXP        = serial_Txp;
93
assign LxRXN        = ~LxRXP;
94
assign serial_Rx    = LxTXP[NUM_LANES-1:0];
95
assign serial_Txn = ~serial_Txp;
96
 
97
//----------------------------- Attach the Register File System interface
98
assign rfs_hmc_if.clk = clk_hmc;
99
assign rfs_hmc_if.res_n = res_n;
100
 
101
//----------------------------- Generate Clocks
102
bit clk_10G;
103
generate
104
    begin : clocking_gen
105
        initial clk_10G = 1'b1;
106
        always #0.05ns clk_10G = ~clk_10G;
107
    end
108
endgenerate
109
 
110
//----------------------------- Behavioral SerDes
111
genvar lane;
112
generate
113
    begin : serializers_gen
114
 
115
        for (lane=0; lane
116
            serializer #(
117
                .DWIDTH(LANE_WIDTH)
118
            ) serializer_I (
119
                .clk(clk_hmc),
120
                .fast_clk(clk_10G),
121
                .data_in(to_serializers[lane*LANE_WIDTH+LANE_WIDTH-1:lane*LANE_WIDTH]),
122
                .data_out(serial_Txp[lane])
123
            );
124
            deserializer #(
125
                .DWIDTH(LANE_WIDTH)
126
            ) deserializer_I (
127
                .clk(clk_hmc),
128
                .fast_clk(clk_10G),
129
                .bit_slip(bit_slip[lane]),
130
                .lane_polarity(phy_lane_polarity[lane]),
131
                .data_in(serial_Rx[lane]),
132
                .data_out(from_deserializers[lane*LANE_WIDTH+LANE_WIDTH-1:lane*LANE_WIDTH])
133
            );
134
        end
135
    end
136
endgenerate
137
 
138
//=====================================================================================================
139
//-----------------------------------------------------------------------------------------------------
140
//---------INSTANTIATIONS HERE-------------------------------------------------------------------------
141
//-----------------------------------------------------------------------------------------------------
142
//=====================================================================================================
143
openhmc_top #(
144
    .LOG_FPW(LOG_FPW),
145
    .FPW(FPW),
146
    .LOG_NUM_LANES(LOG_NUM_LANES),
147
    //Configure the Functionality
148
    .LOG_MAX_RTC(10),                //That is max 1023 Tokens
149
    .HMC_RX_AC_COUPLED(1),
150
    .CTRL_LANE_POLARITY(0),
151
    .CTRL_LANE_REVERSAL(1),
152
    .BITSLIP_SHIFT_RIGHT(1),
153
    //Debug Logic
154
    .DBG_RX_TOKEN_MON(1)    //Required by the test check sequence
155
 )
156
openhmc_instance
157
 (
158
 
159
    //----------------------------------
160
    //----SYSTEM INTERFACES
161
    //----------------------------------
162
    .clk_user(clk_user),
163
    .clk_hmc(clk_hmc),
164
    .res_n_user(res_n),
165
    .res_n_hmc(res_n),
166
 
167
    //----------------------------------
168
    //----Connect HMC Controller
169
    //----------------------------------
170
    //to TX
171
    .s_axis_tx_TVALID(axi4_req.TVALID),
172
    .s_axis_tx_TREADY(axi4_req.TREADY),
173
    .s_axis_tx_TDATA(axi4_req.TDATA),
174
    .s_axis_tx_TUSER(axi4_req.TUSER),
175
    //from RX
176
    .m_axis_rx_TVALID(axi4_rsp.TVALID),
177
    .m_axis_rx_TREADY(axi4_rsp.TREADY),
178
    .m_axis_rx_TDATA(axi4_rsp.TDATA),
179
    .m_axis_rx_TUSER(axi4_rsp.TUSER),
180
 
181
    //----------------------------------
182
    //----Connect Physical Link
183
    //----------------------------------
184
    .phy_data_tx_link2phy(to_serializers),
185
    .phy_data_rx_phy2link(from_deserializers),
186
    .phy_bit_slip(bit_slip),
187
    .phy_ready(res_n),
188
    .phy_lane_polarity(phy_lane_polarity),
189
 
190
    //----------------------------------
191
    //----Connect HMC
192
    //----------------------------------
193
    .P_RST_N(P_RST_N),
194
    .hmc_LxRXPS(LxRXPS),
195
    .hmc_LxTXPS(LxTXPS),
196
    .FERR_N(FERR_N),
197
 
198
    //----------------------------------
199
    //----Connect RF
200
    //----------------------------------
201
    .rf_address(rfs_hmc.address),
202
    .rf_read_data(rfs_hmc.read_data),
203
    .rf_invalid_address(rfs_hmc.invalid_address),
204
    .rf_access_complete(rfs_hmc.access_done),
205
    .rf_read_en(rfs_hmc.ren),
206
    .rf_write_en(rfs_hmc.wen),
207
    .rf_write_data(rfs_hmc.write_data)
208
 
209
    );
210
 
211
 
212
    //********************************************************************************
213
    //   From MICRON's hmc_bfm_tb.sv
214
    //******************************************
215
    //BFM
216
    hmc_bfm #(
217
        .num_links_c    (1)
218
    )
219
    hmc_bfm0 (
220
        .LxRXP          (LxRXP),
221
        .LxRXN          (LxRXN),
222
        .LxTXP          (LxTXP),
223
        .LxTXN          (LxTXN),
224
        .LxRXPS         (LxRXPS),
225
        .LxTXPS         (LxTXPS),
226
        .FERR_N         (FERR_N),
227
 
228
        .REFCLKP        (clk_hmc_refclk),
229
        .REFCLKN        (~clk_hmc_refclk),
230
        .REFCLKSEL      (1'b0),
231
        .P_RST_N        (P_RST_N),
232
 
233
        .TRST_N         (1'b0),
234
        .TCK            (1'b0),
235
        .TMS            (1'b0),
236
        .TDI            (1'b0),
237
        .TDO            (),
238
 
239
        .SCL            (1'b0),
240
        .SDA            (),
241
 
242
        .CUB            (3'b0),
243
        .REFCLK_BOOT    (2'b0),
244
 
245
        .EXTRESTP       (),
246
        .EXTRESTN       (),
247
        .EXTRESBP       (),
248
        .EXTRESBN       ()
249
    );
250
 
251
endmodule : dut
252
 
253
`default_nettype wire
254
 

powered by: WebSVN 2.1.0

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