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 AXI4_STREAM_ENV_SV
|
41 |
|
|
`define AXI4_STREAM_ENV_SV
|
42 |
|
|
|
43 |
|
|
class axi4_stream_env #(parameter DATA_BYTES = 16, parameter TUSER_WIDTH = 16) extends uvm_env;
|
44 |
|
|
|
45 |
|
|
virtual interface axi4_stream_if #(.DATA_BYTES(DATA_BYTES), .TUSER_WIDTH(TUSER_WIDTH)) vif;
|
46 |
|
|
|
47 |
|
|
axi4_stream_master_agent #(.DATA_BYTES(DATA_BYTES), .TUSER_WIDTH(TUSER_WIDTH)) master;
|
48 |
|
|
axi4_stream_slave_agent #(.DATA_BYTES(DATA_BYTES), .TUSER_WIDTH(TUSER_WIDTH)) slave;
|
49 |
|
|
|
50 |
|
|
axi4_stream_monitor #(.DATA_BYTES(DATA_BYTES), .TUSER_WIDTH(TUSER_WIDTH)) monitor;
|
51 |
|
|
|
52 |
|
|
axi4_stream_config axi4_stream_cfg;
|
53 |
|
|
|
54 |
|
|
|
55 |
|
|
|
56 |
|
|
`uvm_component_param_utils_begin(axi4_stream_env #(.DATA_BYTES(DATA_BYTES), .TUSER_WIDTH(TUSER_WIDTH)))
|
57 |
|
|
`uvm_field_object(axi4_stream_cfg, UVM_DEFAULT)
|
58 |
|
|
`uvm_field_object(master, UVM_DEFAULT)
|
59 |
|
|
`uvm_field_object(slave, UVM_DEFAULT)
|
60 |
|
|
`uvm_field_object(monitor, UVM_DEFAULT)
|
61 |
|
|
`uvm_component_utils_end
|
62 |
|
|
|
63 |
|
|
function new(string name="axi4_stream_env", uvm_component parent);
|
64 |
|
|
super.new(name,parent);
|
65 |
|
|
endfunction : new
|
66 |
|
|
|
67 |
|
|
function void build_phase(uvm_phase phase);
|
68 |
|
|
super.build_phase(phase);
|
69 |
|
|
|
70 |
|
|
//-- configure interfaces
|
71 |
|
|
if(uvm_config_db#(virtual interface axi4_stream_if #(.DATA_BYTES(DATA_BYTES), .TUSER_WIDTH(TUSER_WIDTH)))::get(this, "", "vif",vif) ) begin
|
72 |
|
|
uvm_config_db#(virtual interface axi4_stream_if #(.DATA_BYTES(DATA_BYTES), .TUSER_WIDTH(TUSER_WIDTH)))::set(this, "monitor","vif",vif);
|
73 |
|
|
uvm_config_db#(virtual interface axi4_stream_if #(.DATA_BYTES(DATA_BYTES), .TUSER_WIDTH(TUSER_WIDTH)))::set(this, "master" ,"vif",vif);
|
74 |
|
|
uvm_config_db#(virtual interface axi4_stream_if #(.DATA_BYTES(DATA_BYTES), .TUSER_WIDTH(TUSER_WIDTH)))::set(this, "slave" ,"vif",vif);
|
75 |
|
|
end else begin
|
76 |
|
|
`uvm_fatal(get_type_name(),"vif is not set")
|
77 |
|
|
end
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
|
81 |
|
|
if ( uvm_config_db#(axi4_stream_config)::get(this, "" , "axi4_stream_cfg", axi4_stream_cfg)) begin
|
82 |
|
|
uvm_config_db#(axi4_stream_config)::set(this, "master" , "axi4_stream_cfg", axi4_stream_cfg); //distributing axi4_stream_cfg to master agent
|
83 |
|
|
uvm_config_db#(axi4_stream_config)::set(this, "slave" , "axi4_stream_cfg", axi4_stream_cfg); //distributing axi4_stream_cfg to slave agent
|
84 |
|
|
end else begin
|
85 |
|
|
uvm_report_fatal(get_type_name(), $psprintf("axi4_stream_cfg not set via config_db"));
|
86 |
|
|
end
|
87 |
|
|
|
88 |
|
|
//-- create
|
89 |
|
|
monitor = axi4_stream_monitor #(.DATA_BYTES(DATA_BYTES), .TUSER_WIDTH(TUSER_WIDTH))::type_id::create("monitor", this);
|
90 |
|
|
master = axi4_stream_master_agent #(.DATA_BYTES(DATA_BYTES), .TUSER_WIDTH(TUSER_WIDTH))::type_id::create("master", this);
|
91 |
|
|
slave = axi4_stream_slave_agent #(.DATA_BYTES(DATA_BYTES), .TUSER_WIDTH(TUSER_WIDTH))::type_id::create("slave", this);
|
92 |
|
|
endfunction : build_phase
|
93 |
|
|
|
94 |
|
|
function void connect_phase(uvm_phase phase);
|
95 |
|
|
super.connect_phase(phase);
|
96 |
|
|
|
97 |
|
|
endfunction : connect_phase
|
98 |
|
|
|
99 |
|
|
endclass : axi4_stream_env
|
100 |
|
|
|
101 |
|
|
`endif // AXI4_STREAM_ENV_SV
|