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

Subversion Repositories openhmc

[/] [openhmc/] [trunk/] [openHMC/] [sim/] [tb/] [uvc/] [testlib/] [hmc_base_test.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
`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
        //hmc_link_config link_cfg;
51
 
52
        uvm_table_printer printer;
53
 
54
        function new(string name="hmc_base_test", uvm_component parent=null);
55
                super.new(name,parent);
56
        endfunction : new
57
 
58
        virtual function void build_phase(uvm_phase phase);
59
                super.build_phase(phase);
60
 
61
                //-- create config
62
 
63
 
64
                //-- AXI4 request config
65
                axi4_req_config = axi4_stream_config::type_id::create("axi4_req_config", this);
66
                axi4_req_config.master_active = UVM_ACTIVE;
67
                axi4_req_config.slave_active  = UVM_PASSIVE;
68
                axi4_req_config.open_rsp_mode  = UVM_PASSIVE;
69
 
70
                uvm_report_info(get_type_name(), $psprintf("Setting the axi4_req config:\n"), UVM_LOW);
71
                uvm_config_db#(axi4_stream_config)::set(this, "hmc_tb0", "axi4_req_config", axi4_req_config);
72
 
73
                //-- AXI4 response config
74
                axi4_rsp_config = axi4_stream_config::type_id::create("axi4_rsp_config", this);
75
                axi4_rsp_config.master_active = UVM_PASSIVE;
76
                axi4_rsp_config.slave_active = UVM_ACTIVE;
77
                axi4_rsp_config.open_rsp_mode = `OPEN_RSP_MODE==1 ? UVM_ACTIVE : UVM_PASSIVE;
78
 
79
                uvm_report_info(get_type_name(), $psprintf("Setting the axi4_rsp config:\n"), UVM_LOW);
80
                uvm_config_db#(axi4_stream_config)::set(this, "hmc_tb0", "axi4_rsp_config", axi4_rsp_config);
81
 
82
                //-- HMC link config
83
                link_cfg = hmc_link_config::type_id::create("link_config", this);
84
 
85
                link_cfg.cfg_rsp_open_loop = `OPEN_RSP_MODE==1 ? UVM_ACTIVE : UVM_PASSIVE;
86
                link_cfg.fpw = `FPW;
87
 
88
                //-- hmc_uvc_config
89
                link_cfg.requester.width = 2**`LOG_NUM_LANES;
90
                link_cfg.requester.active = UVM_PASSIVE;//`HMC_REQUESTER_IS_ACTIVE;
91
                link_cfg.requester.requester = 1;
92
 
93
                link_cfg.responder.width = 2**`LOG_NUM_LANES;
94
                link_cfg.responder.active = UVM_ACTIVE;//`HMC_RESPONDER_IS_ACTIVE;
95
                link_cfg.responder.requester = 0;
96
 
97
                link_cfg_randomize : assert (link_cfg.randomize());
98
 
99
                uvm_report_info(get_type_name(), $psprintf("Setting the hmc uvc link config:\n"), UVM_LOW);
100
                uvm_config_db#(hmc_link_config)::set(this, "hmc_tb0", "link_cfg", link_cfg);
101
 
102
 
103
                set_config_int("*", "recording_detail", UVM_FULL);
104
 
105
                //-- create the testbench
106
                hmc_tb0 = hmc_tb#()::type_id::create("hmc_tb0", this);
107
 
108
 
109
        endfunction : build_phase
110
 
111
        function void end_of_elaboration_phase(uvm_phase phase);
112
                super.end_of_elaboration_phase(phase);
113
                printer = new();
114
                printer.knobs.depth = 5;
115
 
116
                `uvm_info(get_type_name(), $psprintf("Printing hmc_config: %s",link_cfg.sprint()), UVM_NONE)
117
                `uvm_info(get_type_name(), $psprintf("Printing Requester Link config: %s", link_cfg.requester.sprint()), UVM_NONE)
118
                `uvm_info(get_type_name(), $psprintf("Printing Responder Link config: %s", link_cfg.responder.sprint()), UVM_NONE)
119
                uvm_report_info(get_type_name(), $psprintf("Printing the test topology :\n%s", this.sprint(printer)), UVM_HIGH);
120
 
121
        endfunction : end_of_elaboration_phase
122
 
123
 
124
        virtual task run_phase(uvm_phase phase);
125
                phase.phase_done.set_drain_time(this, 10us);
126
        endtask : run_phase
127
 
128
endclass : hmc_base_test
129
 
130
 
131
class hmc_base_seq extends uvm_sequence;
132
 
133
        function new(string name="hmc_base_seq");
134
                super.new(name);
135
        endfunction : new
136
 
137
        `uvm_object_utils(hmc_base_seq)
138
        `uvm_declare_p_sequencer(vseqr)
139
 
140
        virtual task pre_body();
141
                if(starting_phase != null)
142
                        starting_phase.raise_objection(this);
143
        endtask : pre_body
144
 
145
        virtual task post_body();
146
                if(starting_phase != null)
147
                        starting_phase.drop_objection(this);
148
        endtask : post_body
149
 
150
endclass : hmc_base_seq
151
 
152
`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.