Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / env / ilu_peu / vera / N2str / ilupeuDmaURMsgPEUStr.vr
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: ilupeuDmaURMsgPEUStr.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 ============================================
35class DmaURMsgPEUStr extends DmaURBasePEUStr {
36
37
38 // ******************************************************************
39 // The Test Environment objects need to execute the strategy.
40 // ******************************************************************
41 local PEUTestEnv _env;
42 local integer _errQueue;
43
44 // For coverage's sake...
45 static integer _ctr = 0;
46
47
48 // ******************************************************************
49 // TLP Fields - These fields will be randomized using the parameters
50 // in the following section, and obeying the constraints defined
51 // within this class.
52 // ******************************************************************
53 local bit [1:0] _format;
54 local bit [4:0] _type;
55 local bit [2:0] _tc;
56 local bit _td;
57 local bit _ep;
58 local bit [1:0] _attr;
59 local bit [9:0] _len;
60 local bit [15:0] _req_id;
61 local bit [7:0] _tag;
62 local bit [7:0] _m_code;
63 local bit [63:0] _addr;
64 local integer _data;
65
66
67 // ******************************************************************
68 // Constructor
69 // ******************************************************************
70 public task new(PEUTestEnv a_env, (integer a_errQueue = 'bx));
71
72
73 // ******************************************************************
74 // Execute the strategy.
75 // ******************************************************************
76 public task Execute();
77}
78
79
80
81//-------------------------------------------------------------------
82// Method Name:
83// Description:
84//-------------------------------------------------------------------
85task DmaURMsgPEUStr::new(PEUTestEnv a_env, (integer a_errQueue = 'bx)) {
86
87
88 super.new(a_env);
89 this._env = a_env;
90 this._errQueue = a_errQueue;
91}
92
93
94
95//-------------------------------------------------------------------
96// Method Name:
97// Description:
98//-------------------------------------------------------------------
99task DmaURMsgPEUStr::Execute() {
100
101
102 bit [PEC_PCI__HDR] reqHdr;
103
104
105 this._format = PEC_PCI__FMT_NO_DATA_4DW;
106
107 this._type [4:3] = 2'b_10;
108 this._type [2:0] = urandom_range(3'b_111, 3'b_000);
109
110 this._tc = 3'b_000;
111 this._td = urandom_range(1'b_1, 1'b_0);
112
113 randcase {
114 this._ep_req_prob_false : this._ep = 1'b_0;
115 this._ep_req_prob_true : this._ep = 1'b_1;
116 }
117
118 this._attr = 2'b_00;
119 this._len = 10'b_00_0000_0000;
120 this._req_id = urandom_range(16'h_FFFF, 16'h_0);
121 this._tag = urandom_range(8'h_FF, 8'h_00);
122
123 _ctr = _ctr + 1;
124 case ( _ctr )
125 {
126 1: this._m_code = PEC_PCI__MSG_CODE_VENDOR_TYPE_0;
127 default: this._m_code = urandom_range(8'h_FF, 8'h_00);
128 }
129
130 while ((this._m_code === PEC_PCI__MSG_CODE_ASSERT_INTA) ||
131 (this._m_code === PEC_PCI__MSG_CODE_ASSERT_INTB) ||
132 (this._m_code === PEC_PCI__MSG_CODE_ASSERT_INTC) ||
133 (this._m_code === PEC_PCI__MSG_CODE_ASSERT_INTD) ||
134 (this._m_code === PEC_PCI__MSG_CODE_DEASSERT_INTA) ||
135 (this._m_code === PEC_PCI__MSG_CODE_DEASSERT_INTB) ||
136 (this._m_code === PEC_PCI__MSG_CODE_DEASSERT_INTC) ||
137 (this._m_code === PEC_PCI__MSG_CODE_DEASSERT_INTD) ||
138 (this._m_code === PEC_PCI__MSG_CODE_PM_PME) ||
139 (this._m_code === PEC_PCI__MSG_CODE_PM_TO_ACK) ||
140 (this._m_code === PEC_PCI__MSG_CODE_ERR_COR) ||
141 (this._m_code === PEC_PCI__MSG_CODE_ERR_NONFATAL) ||
142 (this._m_code === PEC_PCI__MSG_CODE_ERR_FATAL) ||
143 (this._m_code === PEC_PCI__MSG_CODE_ATTN) ||
144 (this._m_code === PEC_PCI__MSG_CODE_VENDOR_TYPE_1)
145 ) {
146 this._m_code = urandom_range(8'h_FF, 8'h_00);
147
148 // randcase {
149 // 80 : this._m_code = urandom_range(8'h_FF, 8'h_00);
150 // 20 : this._m_code = PEC_PCI__MSG_CODE_VENDOR_TYPE_0;
151 // }
152 }
153
154 //Denali Can't handle generating Messages with undefined types - review
155 this._m_code = PEC_PCI__MSG_CODE_VENDOR_TYPE_0;
156 printf("Message Code m_code = %x\n", this._m_code);
157
158 this._addr = {urandom(), urandom()};
159 if( this._m_code == PEC_PCI__MSG_CODE_VENDOR_TYPE_0 ){
160 randcase{
161 1: this._type [2:0] = 3'b000;
162 1: this._type [2:0] = 3'b010;
163 1: this._type [2:0] = 3'b011;
164 1: this._type [2:0] = 3'b100;
165 }
166
167 //review - Denali troubles with vendor defined messages
168 this._addr = { this._type [2:0] == 3'b010 ? this._addr[63:48] : 16'h0,
169 random()%2 ? _env.Scenario.denaliVendorDefinedVendorID2 :
170 _env.Scenario.denaliVendorDefinedVendorID1,
171 32'h0};
172 }
173
174 this._data = urandom_range(255, 0);
175
176
177 reqHdr [PEC_PCI__HDR] = {128{1'b_0}};
178 reqHdr [PEC_PCI__FMT] = this._format;
179 reqHdr [PEC_PCI__TYPE] = this._type;
180 reqHdr [PEC_PCI__TC] = this._tc;
181 reqHdr [PEC_PCI__TD] = this._td;
182 reqHdr [PEC_PCI__EP] = this._ep;
183 reqHdr [PEC_PCI__ATTR] = this._attr;
184 reqHdr [PEC_PCI__LEN] = this._len;
185 reqHdr [PEC_PCI__REQ_ID] = this._req_id;
186 reqHdr [PEC_PCI__TLP_TAG] = this._tag;
187 reqHdr [PEC_PCI__MSG_CODE] = this._m_code;
188 reqHdr [PEC_PCI__ADDR] = this._addr;
189
190 if ( super.f_abortErrTlp )
191 {
192 this._env.drivePCIE(reqHdr, this._data, *, *, *, 1);
193 this._env.waitIngressLatency(reqHdr);
194 }
195 else
196 {
197 this._env.reserveIngressCredits(reqHdr);
198 this._env.drivePCIE(reqHdr, this._data);
199 this._env.consumeIngressCredits(reqHdr);
200 this._env.expectILU(reqHdr, this._data);
201
202 mailbox_put(this._errQueue, e_ERR_none);
203 mailbox_put(this._errQueue, 2);
204 mailbox_put(this._errQueue, e_ERR_ue_mfp);
205 mailbox_put(this._errQueue, 128'bx0);
206 mailbox_put(this._errQueue, e_ERR_ue_ur);
207 reqHdr[31:0] = 0;
208 mailbox_put(this._errQueue, reqHdr);
209 }
210}