| 1 | // ========== Copyright Header Begin ========================================== |
| 2 | // |
| 3 | // OpenSPARC T2 Processor File: ilupeuDmaURCfgIORdWrPEUStr.vr |
| 4 | // Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved |
| 5 | // 4150 Network Circle, Santa Clara, California 95054, U.S.A. |
| 6 | // |
| 7 | // * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 8 | // |
| 9 | // This program is free software; you can redistribute it and/or modify |
| 10 | // it under the terms of the GNU General Public License as published by |
| 11 | // the Free Software Foundation; version 2 of the License. |
| 12 | // |
| 13 | // This program is distributed in the hope that it will be useful, |
| 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | // GNU General Public License for more details. |
| 17 | // |
| 18 | // You should have received a copy of the GNU General Public License |
| 19 | // along with this program; if not, write to the Free Software |
| 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 21 | // |
| 22 | // For the avoidance of doubt, and except that if any non-GPL license |
| 23 | // choice is available it will apply instead, Sun elects to use only |
| 24 | // the General Public License version 2 (GPLv2) at this time for any |
| 25 | // software where a choice of GPL license versions is made |
| 26 | // available with the language indicating that GPLv2 or any later version |
| 27 | // may be used, or where a choice of which version of the GPL is applied is |
| 28 | // otherwise unspecified. |
| 29 | // |
| 30 | // Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 31 | // CA 95054 USA or visit www.sun.com if you need additional information or |
| 32 | // have any questions. |
| 33 | // |
| 34 | // ========== Copyright Header End ============================================ |
| 35 | class DmaURCfgIORdWrPEUStr extends DmaURBasePEUStr { |
| 36 | |
| 37 | |
| 38 | // ****************************************************************** |
| 39 | // The Test Environment objects need to execute the strategy. |
| 40 | // ****************************************************************** |
| 41 | protected PEUTestEnv _env; |
| 42 | protected integer _errQueue; |
| 43 | |
| 44 | |
| 45 | // ****************************************************************** |
| 46 | // TLP Fields - These fields will be randomized using the parameters |
| 47 | // in the following section, and obeying the constraints defined |
| 48 | // within this class. |
| 49 | // ****************************************************************** |
| 50 | protected bit [1:0] _format_req; |
| 51 | protected bit [1:0] _format_cpl; |
| 52 | protected bit [4:0] _type_req; |
| 53 | protected bit [4:0] _type_cpl; |
| 54 | |
| 55 | protected bit [2:0] _tc; |
| 56 | |
| 57 | protected bit _td_req; |
| 58 | protected bit _td_cpl; |
| 59 | protected bit _ep_req; |
| 60 | protected bit _ep_cpl; |
| 61 | |
| 62 | protected bit [1:0] _attr; |
| 63 | protected bit [9:0] _len_req; |
| 64 | protected bit [9:0] _len_cpl; |
| 65 | protected bit [15:0] _req_id; |
| 66 | protected bit [7:0] _tag; |
| 67 | protected bit [31:0] _addr_lsb; |
| 68 | |
| 69 | protected bit [3:0] _last_dwbe; |
| 70 | protected bit [3:0] _first_dwbe; |
| 71 | |
| 72 | protected bit [15:0] _cpl_id; |
| 73 | protected bit [2:0] _cpl_status; |
| 74 | protected bit _bcm; |
| 75 | protected bit [11:0] _byte_count; |
| 76 | protected bit [6:0] _lower_addr; |
| 77 | protected integer _data; |
| 78 | |
| 79 | bit [PEC_PCI__HDR] reqHdr; |
| 80 | bit [PEC_PCI__HDR] cplHdr; |
| 81 | |
| 82 | // ****************************************************************** |
| 83 | // Constructor |
| 84 | // ****************************************************************** |
| 85 | public task new(PEUTestEnv a_env, (integer a_errQueue = 'bx)); |
| 86 | |
| 87 | // ****************************************************************** |
| 88 | // Break this out as common class fullchip and ios can use |
| 89 | // ****************************************************************** |
| 90 | public task SetPacketParams(); |
| 91 | |
| 92 | |
| 93 | // ****************************************************************** |
| 94 | // Execute the strategy. |
| 95 | // ****************************************************************** |
| 96 | public task Execute(); |
| 97 | } |
| 98 | |
| 99 | |
| 100 | |
| 101 | //------------------------------------------------------------------- |
| 102 | // Method Name: |
| 103 | // Description: |
| 104 | //------------------------------------------------------------------- |
| 105 | task DmaURCfgIORdWrPEUStr::new(PEUTestEnv a_env, (integer a_errQueue = 'bx)) { |
| 106 | |
| 107 | |
| 108 | super.new(a_env); |
| 109 | this._env = a_env; |
| 110 | this._errQueue = a_errQueue; |
| 111 | } |
| 112 | |
| 113 | |
| 114 | |
| 115 | //------------------------------------------------------------------- |
| 116 | // Method Name: |
| 117 | // Description: |
| 118 | //------------------------------------------------------------------- |
| 119 | task DmaURCfgIORdWrPEUStr::SetPacketParams() { |
| 120 | |
| 121 | randcase { |
| 122 | 1 : this._format_req = PEC_PCI__FMT_NO_DATA_3DW; |
| 123 | 1 : this._format_req = PEC_PCI__FMT_DATA_3DW; |
| 124 | } |
| 125 | |
| 126 | this._format_cpl = PEC_PCI__FMT_NO_DATA_3DW; |
| 127 | |
| 128 | randcase { |
| 129 | 1 : this._type_req = PEC_PCI__TYPE_CFG0; |
| 130 | 1 : this._type_req = PEC_PCI__TYPE_CFG1; |
| 131 | 1 : this._type_req = PEC_PCI__TYPE_IO; |
| 132 | } |
| 133 | |
| 134 | this._type_cpl = PEC_PCI__TYPE_CPL; |
| 135 | |
| 136 | this._tc = 3'b_000; |
| 137 | this._td_req = urandom_range(1'b_1, 1'b_0); |
| 138 | this._td_cpl = 1'b_0; |
| 139 | |
| 140 | randcase { |
| 141 | this._ep_req_prob_false : this._ep_req = 1'b_0; |
| 142 | this._ep_req_prob_true : this._ep_req = 1'b_1; |
| 143 | } |
| 144 | |
| 145 | this._ep_cpl = 1'b_0; |
| 146 | |
| 147 | this._attr = 2'b_00; |
| 148 | this._len_req = 10'h_001; |
| 149 | this._len_cpl = 10'h_000; |
| 150 | this._req_id = urandom_range(16'h_FFFF, 16'h_0001); |
| 151 | // this._tag = urandom_range(8'h_FF, 8'h_00); |
| 152 | //Make unique so Denali doesn't hold paket hostage |
| 153 | _env.allocDmaTag( this._tag ); |
| 154 | |
| 155 | this._addr_lsb = urandom(); |
| 156 | if (this._type_req == PEC_PCI__TYPE_CFG0) this._addr_lsb[15:12] = 4'b_0000; |
| 157 | if (this._type_req == PEC_PCI__TYPE_CFG1) this._addr_lsb[15:12] = 4'b_0000; |
| 158 | |
| 159 | this._last_dwbe = 4'b_0000; |
| 160 | this._first_dwbe = urandom_range(4'h_F, 4'h_0); |
| 161 | |
| 162 | this._cpl_id = 16'h_0000; |
| 163 | this._cpl_status = PEC_PCI__CPL_STATUS_UR; |
| 164 | this._bcm = urandom_range(1'h_1, 1'h_0); |
| 165 | this._byte_count = 12'h_004; |
| 166 | this._lower_addr = 7'b_000_0000; |
| 167 | |
| 168 | this._data = urandom_range(255, 0); |
| 169 | |
| 170 | |
| 171 | |
| 172 | reqHdr [PEC_PCI__HDR] = {128{1'b_0}}; |
| 173 | reqHdr [PEC_PCI__FMT] = this._format_req; |
| 174 | reqHdr [PEC_PCI__TYPE] = this._type_req; |
| 175 | reqHdr [PEC_PCI__TC] = this._tc; |
| 176 | reqHdr [PEC_PCI__TD] = this._td_req; |
| 177 | reqHdr [PEC_PCI__EP] = this._ep_req; |
| 178 | reqHdr [PEC_PCI__ATTR] = this._attr; |
| 179 | reqHdr [PEC_PCI__LEN] = this._len_req; |
| 180 | reqHdr [PEC_PCI__REQ_ID] = this._req_id; |
| 181 | reqHdr [PEC_PCI__TLP_TAG] = this._tag; |
| 182 | reqHdr [PEC_PCI__LAST_DWBE] = this._last_dwbe; |
| 183 | reqHdr [PEC_PCI__FIRST_DWBE] = this._first_dwbe; |
| 184 | reqHdr [PEC_PCI__ADDR32] = { this._addr_lsb[31:2], 2'b_00 }; |
| 185 | |
| 186 | cplHdr [PEC_PCI__HDR] = {128{1'b_0}}; |
| 187 | cplHdr [PEC_PCI__FMT] = this._format_cpl; |
| 188 | cplHdr [PEC_PCI__TYPE] = this._type_cpl; |
| 189 | cplHdr [PEC_PCI__TC] = this._tc; |
| 190 | cplHdr [PEC_PCI__TD] = this._td_cpl; |
| 191 | cplHdr [PEC_PCI__EP] = this._ep_cpl; |
| 192 | cplHdr [PEC_PCI__ATTR] = this._attr; |
| 193 | cplHdr [PEC_PCI__LEN] = this._len_cpl; |
| 194 | cplHdr [PEC_PCI__CPL_ID] = this._cpl_id; |
| 195 | cplHdr [PEC_PCI__CPL_STATUS] = this._cpl_status; |
| 196 | cplHdr [PEC_PCI__BCM] = this._bcm; |
| 197 | cplHdr [PEC_PCI__BYTECOUNT] = this._byte_count; |
| 198 | cplHdr [PEC_PCI__CPL_REQ_ID] = this._req_id; |
| 199 | cplHdr [PEC_PCI__CPL_TAG] = this._tag; |
| 200 | cplHdr [PEC_PCI__LOWADDR] = this._lower_addr; |
| 201 | |
| 202 | } |
| 203 | |
| 204 | task DmaURCfgIORdWrPEUStr::Execute() { |
| 205 | |
| 206 | SetPacketParams(); |
| 207 | |
| 208 | if( this._type_req === PEC_PCI__TYPE_IO ){ |
| 209 | this._env.Pod.FNXPCIEEnableTrans.tempSuppressDenaliErr(PCIE_TL_NONFATAL_TLP_MF_vlIOExpEp); |
| 210 | }else{ |
| 211 | this._env.Pod.FNXPCIEEnableTrans.tempSuppressDenaliErr(PCIE_TL_NONFATAL_TLP_MF_vlCfgTx); |
| 212 | this._env.Pod.FNXPCIEEnableTrans.tempSuppressDenaliErr(PCIE_TL_NONFATAL_TLP_MF_vlCfg0); |
| 213 | } |
| 214 | |
| 215 | if( (this._format_req === PEC_PCI__FMT_NO_DATA_3DW) && this._ep_req ){ |
| 216 | this._env.Pod.FNXPCIEEnableTrans.tempSuppressDenaliErr(PCIE_TL_NONFATAL_TLP_MF_vlPoison); |
| 217 | } |
| 218 | |
| 219 | if ( super.f_abortErrTlp ) |
| 220 | { |
| 221 | this._env.drivePCIE(reqHdr, this._data, *, *, *, 1 ); |
| 222 | if( this._type_req === PEC_PCI__TYPE_IO ){ |
| 223 | this._env.Pod.FNXPCIEEnableTrans.unSuppressDenaliErr(PCIE_TL_NONFATAL_TLP_MF_vlIOExpEp); |
| 224 | }else{ |
| 225 | this._env.Pod.FNXPCIEEnableTrans.unSuppressDenaliErr(PCIE_TL_NONFATAL_TLP_MF_vlCfgTx); |
| 226 | } |
| 227 | this._env.waitIngressLatency( reqHdr ); |
| 228 | } |
| 229 | else |
| 230 | { |
| 231 | this._env.reserveIngressCredits(reqHdr); |
| 232 | this._env.drivePCIE(reqHdr, this._data); |
| 233 | if( this._type_req === PEC_PCI__TYPE_IO ){ |
| 234 | this._env.Pod.FNXPCIEEnableTrans.unSuppressDenaliErr(PCIE_TL_NONFATAL_TLP_MF_vlIOExpEp); |
| 235 | }else{ |
| 236 | this._env.Pod.FNXPCIEEnableTrans.unSuppressDenaliErr(PCIE_TL_NONFATAL_TLP_MF_vlCfgTx); |
| 237 | this._env.Pod.FNXPCIEEnableTrans.unSuppressDenaliErr(PCIE_TL_NONFATAL_TLP_MF_vlCfg0); |
| 238 | } |
| 239 | this._env.consumeIngressCredits(reqHdr); |
| 240 | this._env.expectILU(reqHdr, this._data); |
| 241 | |
| 242 | if ( this._errQueue != 0 ) |
| 243 | { |
| 244 | mailbox_put(this._errQueue, e_ERR_ue_ur); |
| 245 | mailbox_put(this._errQueue, reqHdr); |
| 246 | } |
| 247 | |
| 248 | this._env.driveILU(cplHdr, 0, this._data); |
| 249 | this._env.expectPCIE(cplHdr, this._data); |
| 250 | } |
| 251 | |
| 252 | //Free up the Tags |
| 253 | _env.freeDmaTag( this._tag ); |
| 254 | |
| 255 | } |