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 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
`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
                axi4_req_config.slave_active = UVM_PASSIVE;
66
 
67
                uvm_report_info(get_type_name(), $psprintf("Setting the axi4_req config:\n"), UVM_LOW);
68
                uvm_config_db#(axi4_stream_config)::set(this, "hmc_tb0", "axi4_req_config", axi4_req_config);
69
 
70
                //-- AXI4 response config
71
                axi4_rsp_config = axi4_stream_config::type_id::create("axi4_rsp_config", this);
72
                axi4_rsp_config.master_active = UVM_PASSIVE;
73
                axi4_rsp_config.slave_active = UVM_ACTIVE;
74
 
75
                uvm_report_info(get_type_name(), $psprintf("Setting the axi4_rsp config:\n"), UVM_LOW);
76
                uvm_config_db#(axi4_stream_config)::set(this, "hmc_tb0", "axi4_rsp_config", axi4_rsp_config);
77
 
78
                //-- HMC link config
79
                link_cfg = hmc_link_config::type_id::create("link_cfg",this);
80
                void'(link_cfg.randomize());
81
 
82
                uvm_config_db#(hmc_link_config)::set(this, "hmc_tb0", "link_cfg", link_cfg);
83
 
84
 
85
                set_config_int("*", "recording_detail", UVM_FULL);
86
 
87
                //-- create the testbench
88
                hmc_tb0 = hmc_tb#()::type_id::create("hmc_tb0", this);
89
 
90
                printer = new();
91
                printer.knobs.depth = 5;
92
 
93
        endfunction : build_phase
94
 
95
        function void end_of_elaboration_phase(uvm_phase phase);
96
                super.end_of_elaboration_phase(phase);
97
 
98
                uvm_report_info(get_type_name(), $psprintf("Printing the test topology :\n%s", this.sprint(printer)), UVM_HIGH);
99
 
100
        endfunction : end_of_elaboration_phase
101
 
102
 
103
        virtual task run_phase(uvm_phase phase);
104
                phase.phase_done.set_drain_time(this, 10us);
105
        endtask : run_phase
106
 
107
        //function void report_phase(uvm_phase phase);
108
        //    report_summarize();
109
        //endfunction : report_phase
110
 
111
endclass : hmc_base_test
112
 
113
 
114
class hmc_base_seq extends uvm_sequence;
115
 
116
        function new(string name="hmc_base_seq");
117
                super.new(name);
118
        endfunction : new
119
 
120
        `uvm_object_utils(hmc_base_seq)
121
        `uvm_declare_p_sequencer(hmc_vseqr)
122
 
123
        virtual task pre_body();
124
                if(starting_phase != null)
125
                        starting_phase.raise_objection(this);
126
        endtask : pre_body
127
 
128
        virtual task post_body();
129
                if(starting_phase != null)
130
                        starting_phase.drop_objection(this);
131
        endtask : post_body
132
 
133
endclass : hmc_base_seq
134
 
135
`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.