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

Subversion Repositories openhmc

[/] [openhmc/] [trunk/] [openHMC/] [sim/] [tb/] [uvc/] [src/] [tb_top.sv] - Blame information for rev 15

Details | Compare with Previous | View Log

Line No. Rev Author Line
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
`include "axi4_stream_pkg.sv"
41
`include "hmc_pkg.sv"
42
`include "hmc_module_pkg.sv"
43
`include "cag_rgm_rfs_if.sv"
44
 
45
 
46
 
47
`timescale 100ps/1ps
48
 
49
module tb_top ();
50
 
51
        import uvm_pkg::*;
52
 
53
        //-- include the UVCs
54
        import axi4_stream_pkg::*;
55
        import hmc_pkg::*;
56
        import hmc_module_pkg::*;
57
        import hmc_base_types_pkg::*;
58
 
59
        `include "cag_rgm.svh"
60
 
61
        `ifdef X16
62
                `include "register_file_model_16x.sv"
63
        `else
64
                `include "register_file_model_8x.sv"
65
        `endif
66
 
67
        `include "hmc_packet.sv"
68
        `include "hmc_req_packet.sv"
69
        `include "hmc_2_axi4_sequencer.sv"
70
        `include "hmc_2_axi4_sequence.sv"
71
        `include "tag_handler.sv"
72
 
73
        `include "hmc_vseqr.sv"
74
 
75
        `include "axi4_stream_hmc_monitor.sv"
76
 
77
        `include "hmc_tb.sv"
78
 
79
        `include "test_lib.sv"
80
 
81
        logic res_n, clk_user, clk_hmc_refclk;
82
 
83
        //-- instantiate the interfaces
84
        axi4_stream_if #(
85
                .DATA_BYTES(`AXI4BYTES),
86
                .TUSER_WIDTH(`AXI4BYTES)
87
                ) axi4_hmc_req_if();
88
 
89
        axi4_stream_if #(
90
                .DATA_BYTES(`AXI4BYTES),
91
                .TUSER_WIDTH(`AXI4BYTES)
92
                ) axi4_hmc_rsp_if();
93
 
94
        cag_rgm_rfs_if #(
95
                .ADDR_WIDTH(`RFS_OPENHMC_RF_AWIDTH),
96
                .READ_DATA_WIDTH(`RFS_OPENHMC_RF_RWIDTH),
97
                .WRITE_DATA_WIDTH(`RFS_OPENHMC_RF_WWIDTH)
98
        ) rfs_hmc_if();
99
 
100
        hmc_sr_if#(.NUM_LANES(2**`LOG_NUM_LANES)) hmc_if();
101
        hmc_sr_if#(.NUM_LANES(2**`LOG_NUM_LANES)) hmc_int_if();
102
        dut dut_I (
103
                .clk_user(clk_user),
104
                .clk_hmc_refclk(clk_hmc_refclk),
105
                .res_n(res_n),
106
                .hmc(hmc_if),
107
                .axi4_req(axi4_hmc_req_if),
108
                .axi4_rsp(axi4_hmc_rsp_if),
109
 
110
                .rfs_hmc(rfs_hmc_if)
111
                );
112
 
113
        assign hmc_int_if.REFCLK_BOOT = hmc_if.REFCLK_BOOT;
114
        assign hmc_int_if.REFCLKN = hmc_if.REFCLKN;
115
        assign hmc_int_if.REFCLKP = hmc_if.REFCLKP;
116
        assign hmc_int_if.P_RST_N = hmc_if.P_RST_N;
117
        assign hmc_int_if.RXPS = hmc_if.RXPS;
118
 
119
        assign hmc_if.TXPS = hmc_int_if.TXPS;
120
        assign hmc_if.FERR_N = hmc_int_if.FERR_N;
121
        initial begin
122
 
123
                uvm_config_db#(virtual axi4_stream_if #(.DATA_BYTES(`AXI4BYTES), .TUSER_WIDTH(`AXI4BYTES)))::set(null, "uvm_test_top.hmc_tb0.axi4_req", "vif", axi4_hmc_req_if);
124
                uvm_config_db#(virtual axi4_stream_if #(.DATA_BYTES(`AXI4BYTES), .TUSER_WIDTH(`AXI4BYTES)))::set(null, "uvm_test_top.hmc_tb0.axi4_rsp", "vif", axi4_hmc_rsp_if);
125
 
126
                //hmc_link interfaces
127
                uvm_config_db#(virtual hmc_sr_if#(.NUM_LANES(2**`LOG_NUM_LANES)))::set(null, "uvm_test_top.hmc_tb0.hmc", "vif", hmc_if);
128
                uvm_config_db#(virtual hmc_sr_if#(.NUM_LANES(2**`LOG_NUM_LANES)))::set(null, "uvm_test_top.hmc_tb0.hmc", "int_vif", hmc_int_if);
129
 
130
                run_test();
131
        end
132
 
133
        initial begin
134
                clk_user                <= 1'b1;
135
                clk_hmc_refclk  <= 1'b1;
136
                res_n                   <= 1'b0;
137
                #500ns;
138
                @(posedge clk_user) res_n       <= 1'b1;
139
        end
140
 
141
        //-- Generate the user clock
142
        always begin
143
                case(`FPW)
144
                2: begin
145
                    if(`LOG_NUM_LANES==3) //8lanes
146
                        #1.6ns clk_user = !clk_user;
147
                    else begin
148
                        #0.8ns clk_user = !clk_user;
149
                    end
150
                end
151
                4: begin
152
                    if(`LOG_NUM_LANES==3) //8lanes
153
                        #3.2ns clk_user = !clk_user;
154
                    else
155
                        #1.6ns clk_user = !clk_user;
156
                end
157
                6: begin
158
                    if(`LOG_NUM_LANES==3) //8lanes
159
                        #4.8ns clk_user = !clk_user;
160
                    else
161
                        #2.4ns clk_user = !clk_user;
162
                end
163
                8: begin
164
                    if(`LOG_NUM_LANES==3) //8lanes
165
                        #6.4ns clk_user = !clk_user;
166
                    else
167
                        #3.2ns clk_user = !clk_user;
168
                end
169
            endcase
170
        end
171
 
172
        //-- 125 MHz HMC/Transceiver refclock
173
        always #4ns clk_hmc_refclk <= ~clk_hmc_refclk;
174
 
175
endmodule : tb_top

powered by: WebSVN 2.1.0

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