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

Subversion Repositories openhmc

[/] [openhmc/] [trunk/] [openHMC/] [sim/] [tb/] [bfm/] [testlib/] [hmc_base_test.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
`ifndef hmc_BASE_TEST_SV
41
`define hmc_BASE_TEST_SV
42
 
43
class hmc_base_test extends uvm_test;
44
 
45
        hmc_tb hmc_tb0;
46
        axi4_stream_config axi4_req_config;
47
        axi4_stream_config axi4_rsp_config;
48
 
49
        hmc_link_config link_cfg;
50
 
51
        uvm_table_printer printer;
52
 
53
        function new(string name="hmc_base_test", uvm_component parent=null);
54
                super.new(name,parent);
55
        endfunction : new
56
 
57
        virtual function void build_phase(uvm_phase phase);
58
                super.build_phase(phase);
59
 
60
                //-- create config
61
 
62
                //-- AXI4 request config
63
                axi4_req_config = axi4_stream_config::type_id::create("axi4_req_config", this);
64
                axi4_req_config.master_active = UVM_ACTIVE;
65 15 juko
                axi4_req_config.slave_active  = UVM_PASSIVE;
66
                axi4_req_config.open_rsp_mode  = UVM_PASSIVE;
67 12 juko
 
68
                uvm_report_info(get_type_name(), $psprintf("Setting the axi4_req config:\n"), UVM_LOW);
69
                uvm_config_db#(axi4_stream_config)::set(this, "hmc_tb0", "axi4_req_config", axi4_req_config);
70
 
71
                //-- AXI4 response config
72
                axi4_rsp_config = axi4_stream_config::type_id::create("axi4_rsp_config", this);
73
                axi4_rsp_config.master_active = UVM_PASSIVE;
74
                axi4_rsp_config.slave_active = UVM_ACTIVE;
75 15 juko
                axi4_rsp_config.open_rsp_mode = `OPEN_RSP_MODE==1 ? UVM_ACTIVE : UVM_PASSIVE;
76 12 juko
 
77
                uvm_report_info(get_type_name(), $psprintf("Setting the axi4_rsp config:\n"), UVM_LOW);
78
                uvm_config_db#(axi4_stream_config)::set(this, "hmc_tb0", "axi4_rsp_config", axi4_rsp_config);
79
 
80
                //-- HMC link config
81
                link_cfg = hmc_link_config::type_id::create("link_cfg",this);
82 15 juko
                link_cfg.cfg_rsp_open_loop = `OPEN_RSP_MODE==1 ? UVM_ACTIVE : UVM_PASSIVE;
83 12 juko
                void'(link_cfg.randomize());
84
 
85
                uvm_config_db#(hmc_link_config)::set(this, "hmc_tb0", "link_cfg", link_cfg);
86
 
87
 
88
                set_config_int("*", "recording_detail", UVM_FULL);
89
 
90
                //-- create the testbench
91
                hmc_tb0 = hmc_tb#()::type_id::create("hmc_tb0", this);
92
 
93
                printer = new();
94
                printer.knobs.depth = 5;
95
 
96
        endfunction : build_phase
97
 
98
        function void end_of_elaboration_phase(uvm_phase phase);
99
                super.end_of_elaboration_phase(phase);
100
 
101
                uvm_report_info(get_type_name(), $psprintf("Printing the test topology :\n%s", this.sprint(printer)), UVM_HIGH);
102
 
103
        endfunction : end_of_elaboration_phase
104
 
105
 
106
        virtual task run_phase(uvm_phase phase);
107
                phase.phase_done.set_drain_time(this, 10us);
108
        endtask : run_phase
109
 
110
endclass : hmc_base_test
111
 
112
 
113
class hmc_base_seq extends uvm_sequence;
114
 
115
        function new(string name="hmc_base_seq");
116
                super.new(name);
117
        endfunction : new
118
 
119
        `uvm_object_utils(hmc_base_seq)
120 15 juko
        `uvm_declare_p_sequencer(vseqr)
121 12 juko
 
122
        virtual task pre_body();
123
                if(starting_phase != null)
124
                        starting_phase.raise_objection(this);
125
        endtask : pre_body
126
 
127
        virtual task post_body();
128
                if(starting_phase != null)
129
                        starting_phase.drop_objection(this);
130
        endtask : post_body
131
 
132
endclass : hmc_base_seq
133
 
134
`endif // hmc_BASE_TEST_SV

powered by: WebSVN 2.1.0

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