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

Subversion Repositories openhmc

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

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
`include "axi4_stream_pkg.sv"
41
`include "hmc_module_pkg.sv"
42
`include "cag_rgm_rfs_if.sv"
43
 
44
`timescale 100ps/10ps
45
 
46
module tb_top ();
47
 
48
        import uvm_pkg::*;
49
 
50
        //-- include the UVCs
51
        import axi4_stream_pkg::*;
52
        import hmc_module_pkg::*;
53
        import hmc_base_types_pkg::*;
54
 
55
        `include "cag_rgm.svh"
56
 
57
        `ifdef X16
58
                `include "register_file_model_16x.sv"
59
        `else
60
                `include "register_file_model_8x.sv"
61
        `endif
62
 
63
        `include "hmc_packet.sv"
64
        `include "hmc_req_packet.sv"
65
        `include "hmc_2_axi4_sequencer.sv"
66
        `include "hmc_2_axi4_sequence.sv"
67
        `include "tag_handler.sv"
68
 
69
        `include "hmc_link_config.sv"
70 15 juko
        `include "vseqr.sv"
71 12 juko
 
72
        `include "axi4_stream_hmc_monitor.sv"
73
        `include "bfm_2_hmc_monitor.sv"
74
 
75
        `include "hmc_tb.sv"
76
 
77
        `include "test_lib.sv"
78
 
79
        logic res_n, clk_user, clk_hmc_refclk;
80
 
81
        //-- instantiate the interfaces
82
        axi4_stream_if #(
83
                .DATA_BYTES(`AXI4BYTES),
84
                .TUSER_WIDTH(`AXI4BYTES)
85 15 juko
                ) axi4_hmc_req_if();
86 12 juko
 
87
        axi4_stream_if #(
88
                .DATA_BYTES(`AXI4BYTES),
89
                .TUSER_WIDTH(`AXI4BYTES)
90 15 juko
                ) axi4_hmc_rsp_if();
91 12 juko
 
92
        cag_rgm_rfs_if #(
93 15 juko
                .ADDR_WIDTH(`RFS_OPENHMC_RF_AWIDTH),
94
                .READ_DATA_WIDTH(`RFS_OPENHMC_RF_RWIDTH),
95
                .WRITE_DATA_WIDTH(`RFS_OPENHMC_RF_WWIDTH)
96 12 juko
        ) rfs_hmc_if();
97
 
98
        dut dut_I (
99
                .clk_user(clk_user),
100
                .clk_hmc_refclk(clk_hmc_refclk),
101
                .res_n(res_n),
102
 
103
                .axi4_req(axi4_hmc_req_if),
104
                .axi4_rsp(axi4_hmc_rsp_if),
105
 
106
                .rfs_hmc(rfs_hmc_if)
107
        );
108
 
109
        initial begin
110
 
111
                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);
112
                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);
113
 
114
                //-- connect the BFM monitors with the Module UVC BFM to HMC Packet monitors
115
                uvm_config_db#(pkt_analysis_port#())::set(null,"uvm_test_top.hmc_tb0.hmc_module.hmc_req_mon","mb_pkt",dut_I.hmc_bfm0.hmc_flit_top.mb_rsp_pkt[0]);
116
                uvm_config_db#(pkt_analysis_port#())::set(null,"uvm_test_top.hmc_tb0.hmc_module.hmc_rsp_mon","mb_pkt",dut_I.hmc_bfm0.hmc_flit_top.mb_req_pkt[0]);
117
 
118
                run_test();
119
        end
120
 
121
        initial begin
122
                clk_user                <= 1'b1;
123
                clk_hmc_refclk  <= 1'b1;
124
                res_n                   <= 1'b0;
125 15 juko
                #500ns;
126 12 juko
                @(posedge clk_user) res_n       <= 1'b1;
127
        end
128
 
129
        //-- Generate the user clock
130
        always begin
131
                case(`FPW)
132
                2: begin
133
                    if(`LOG_NUM_LANES==3) //8lanes
134
                        #1.6ns clk_user = !clk_user;
135
                    else begin
136
                        #0.8ns clk_user = !clk_user;
137
                    end
138
                end
139
                4: begin
140
                    if(`LOG_NUM_LANES==3) //8lanes
141
                        #3.2ns clk_user = !clk_user;
142
                    else
143
                        #1.6ns clk_user = !clk_user;
144
                end
145
                6: begin
146
                    if(`LOG_NUM_LANES==3) //8lanes
147
                        #4.8ns clk_user = !clk_user;
148
                    else
149
                        #2.4ns clk_user = !clk_user;
150
                end
151
                8: begin
152
                    if(`LOG_NUM_LANES==3) //8lanes
153
                        #6.4ns clk_user = !clk_user;
154
                    else
155
                        #3.2ns clk_user = !clk_user;
156
                end
157
            endcase
158
        end
159
 
160 15 juko
        //-- 125 MHz HMC/Transceiver refclock
161 12 juko
        always #4ns clk_hmc_refclk <= ~clk_hmc_refclk;
162 15 juko
 
163 12 juko
endmodule : tb_top

powered by: WebSVN 2.1.0

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