lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 1 | // Copyright lowRISC contributors. |
| 2 | // Licensed under the Apache License, Version 2.0, see LICENSE for details. |
| 3 | // SPDX-License-Identifier: Apache-2.0 |
| 4 | |
| 5 | // --------------------------------------------- |
| 6 | // Xbar environment configuration class |
| 7 | // --------------------------------------------- |
Weicai Yang | 9d6334e | 2019-10-11 11:42:41 -0700 | [diff] [blame] | 8 | class xbar_env_cfg extends dv_base_env_cfg; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 9 | |
| 10 | rand tl_agent_cfg host_agent_cfg[]; |
| 11 | rand tl_agent_cfg device_agent_cfg[]; |
Weicai Yang | fb1f1b8 | 2019-10-18 14:49:03 -0700 | [diff] [blame^] | 12 | uint num_hosts; |
| 13 | uint num_devices; |
| 14 | uint num_enabled_hosts; |
| 15 | uint min_host_req_delay = 0; |
| 16 | uint max_host_req_delay = 20; |
| 17 | uint min_host_rsp_delay = 0; |
| 18 | uint max_host_rsp_delay = 20; |
| 19 | uint min_device_req_delay = 0; |
| 20 | uint max_device_req_delay = 20; |
| 21 | uint min_device_rsp_delay = 0; |
| 22 | uint max_device_rsp_delay = 20; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 23 | |
| 24 | `uvm_object_utils_begin(xbar_env_cfg) |
| 25 | `uvm_field_array_object(host_agent_cfg, UVM_DEFAULT) |
| 26 | `uvm_field_array_object(device_agent_cfg, UVM_DEFAULT) |
Weicai Yang | fb1f1b8 | 2019-10-18 14:49:03 -0700 | [diff] [blame^] | 27 | `uvm_field_int(num_hosts, UVM_DEFAULT) |
| 28 | `uvm_field_int(num_devices, UVM_DEFAULT) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 29 | `uvm_object_utils_end |
| 30 | |
Weicai Yang | 9d6334e | 2019-10-11 11:42:41 -0700 | [diff] [blame] | 31 | `uvm_object_new |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 32 | |
Weicai Yang | 9d6334e | 2019-10-11 11:42:41 -0700 | [diff] [blame] | 33 | virtual function void initialize(bit [TL_AW-1:0] csr_base_addr = '1, |
| 34 | bit [TL_AW-1:0] csr_addr_map_size = 2048); |
| 35 | has_ral = 0; // no csr in xbar |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 36 | // Host TL agent cfg |
Weicai Yang | fb1f1b8 | 2019-10-18 14:49:03 -0700 | [diff] [blame^] | 37 | num_hosts = xbar_hosts.size(); |
| 38 | num_enabled_hosts = xbar_hosts.size(); |
| 39 | host_agent_cfg = new[num_hosts]; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 40 | foreach (host_agent_cfg[i]) begin |
| 41 | host_agent_cfg[i] = tl_agent_cfg::type_id:: |
| 42 | create($sformatf("%0s_agent_cfg", xbar_hosts[i].host_name)); |
| 43 | host_agent_cfg[i].is_host = 1; |
| 44 | end |
| 45 | // Device TL agent cfg |
Weicai Yang | fb1f1b8 | 2019-10-18 14:49:03 -0700 | [diff] [blame^] | 46 | num_devices = xbar_devices.size(); |
| 47 | device_agent_cfg = new[num_devices]; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 48 | foreach (device_agent_cfg[i]) begin |
| 49 | device_agent_cfg[i] = tl_agent_cfg::type_id:: |
| 50 | create($sformatf("%0s_agent_cfg", xbar_devices[i].device_name)); |
| 51 | device_agent_cfg[i].is_host = 0; |
| 52 | end |
| 53 | endfunction |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 54 | endclass |