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; |
Weicai Yang | 7518de8 | 2019-11-04 11:11:44 -0800 | [diff] [blame^] | 23 | // use to disable/enable assert for TL error cases |
| 24 | tlul_assert_ctrl_vif tlul_assert_ctrl_vif; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 25 | |
| 26 | `uvm_object_utils_begin(xbar_env_cfg) |
| 27 | `uvm_field_array_object(host_agent_cfg, UVM_DEFAULT) |
| 28 | `uvm_field_array_object(device_agent_cfg, UVM_DEFAULT) |
Weicai Yang | fb1f1b8 | 2019-10-18 14:49:03 -0700 | [diff] [blame] | 29 | `uvm_field_int(num_hosts, UVM_DEFAULT) |
| 30 | `uvm_field_int(num_devices, UVM_DEFAULT) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 31 | `uvm_object_utils_end |
| 32 | |
Weicai Yang | 9d6334e | 2019-10-11 11:42:41 -0700 | [diff] [blame] | 33 | `uvm_object_new |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 34 | |
Gaurang Chitroda | 47033bd | 2019-10-28 23:35:42 -0700 | [diff] [blame] | 35 | virtual function void initialize(bit [TL_AW-1:0] csr_base_addr = '1); |
Weicai Yang | 9d6334e | 2019-10-11 11:42:41 -0700 | [diff] [blame] | 36 | has_ral = 0; // no csr in xbar |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 37 | // Host TL agent cfg |
Weicai Yang | fb1f1b8 | 2019-10-18 14:49:03 -0700 | [diff] [blame] | 38 | num_hosts = xbar_hosts.size(); |
| 39 | num_enabled_hosts = xbar_hosts.size(); |
| 40 | host_agent_cfg = new[num_hosts]; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 41 | foreach (host_agent_cfg[i]) begin |
| 42 | host_agent_cfg[i] = tl_agent_cfg::type_id:: |
| 43 | create($sformatf("%0s_agent_cfg", xbar_hosts[i].host_name)); |
| 44 | host_agent_cfg[i].is_host = 1; |
Weicai Yang | f9a2a15 | 2019-11-01 11:54:37 -0700 | [diff] [blame] | 45 | host_agent_cfg[i].max_outstanding_req = 1 << VALID_HOST_ID_WIDTH; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 46 | end |
| 47 | // Device TL agent cfg |
Weicai Yang | fb1f1b8 | 2019-10-18 14:49:03 -0700 | [diff] [blame] | 48 | num_devices = xbar_devices.size(); |
| 49 | device_agent_cfg = new[num_devices]; |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 50 | foreach (device_agent_cfg[i]) begin |
| 51 | device_agent_cfg[i] = tl_agent_cfg::type_id:: |
| 52 | create($sformatf("%0s_agent_cfg", xbar_devices[i].device_name)); |
| 53 | device_agent_cfg[i].is_host = 0; |
Weicai Yang | f9a2a15 | 2019-11-01 11:54:37 -0700 | [diff] [blame] | 54 | // the max_outstanding_req depends on how many hosts can access the device |
| 55 | // device.max_outstanding_req = sum(all its hosts max_outstanding_req) |
| 56 | device_agent_cfg[i].max_outstanding_req = 0; // clear default value |
| 57 | foreach (xbar_hosts[j]) begin |
| 58 | if (xbar_devices[i].device_name inside {xbar_hosts[j].valid_devices}) begin |
| 59 | device_agent_cfg[i].max_outstanding_req += host_agent_cfg[j].max_outstanding_req; |
| 60 | end |
| 61 | end // foreach (xbar_hosts[j]) |
| 62 | end // foreach (device_agent_cfg[i]) |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 63 | endfunction |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 64 | endclass |