Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / env / ilu_peu / vera / N2str / ilupeuIngressnullTlpErr.vr
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: ilupeuIngressnullTlpErr.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 ilupeuIngressnullTlpErr extends PEUStrBase
36 {
37 integer f_errQueue; // A mailbox for bad pkt headers
38
39 integer nmbrnullTlpErrsToInject = 0; //Total number of packets that get error injected
40 //Set the percentage weight of each type of FCP errors
41 integer nullTlpErrWeight = 0;
42
43
44 denaliPcieEiTypeT DenaliErrortype;
45// bit [FNX_PCIE_XTR_DLLP_TYPE_WIDTH-1:0] DLLPtype;
46
47 //Only allow 1 of these strategies to be active at a time
48 static integer FCPErr_semaphore = alloc(SEMAPHORE, 0, 1, 1);
49
50 task new( PEUTestEnv a_env )
51 {
52 super.new( a_env );
53 f_errQueue = 0;
54 }
55
56 task SetErrQueue( integer a_queue )
57 {
58 f_errQueue = a_queue;
59 } /* end SetErrQueue */
60
61 task Execute()
62 {
63 integer nmbrErrs;
64 integer nullTlpErrsInject_freq = 100; // freq of clock cycles to inject this error
65 integer nmbrnullTlpErrsInjected;
66
67 bit[PEC_PCI__HDR] ingressHdr; // The ingress TLP's header
68 integer ingressData; // A payload descriptor
69 bit[7:0] ingressTag; // The tag for the TLP
70
71
72 string dma_type = "";
73 bit null_tlp = 0;
74
75 //Get the semaphore when its your turn
76 semaphore_get( WAIT, FCPErr_semaphore, 1);
77
78
79
80 //Clear all the specific error trackers
81 nmbrnullTlpErrsInjected = 0;
82
83 // create random number to cause Null TLP type error
84 nullTlpErrsInject_freq = (urandom() % 10) + 20;
85
86
87 //inject errors until all the errors are injected
88 while (nmbrnullTlpErrsToInject > nmbrnullTlpErrsInjected) {
89
90
91 // adjust FC credit number between 1 to FFx for header, between 1 to FFFx for data
92// FC_H_random = (urandom() % 254) + 1;
93// FC_H_over128 = (urandom_range(256, 129) );
94
95// //determine the type of errors inject based on the weight specified in the testcase
96// randcase {
97// // for infinite case.
98// nullTlpErrWeight: {f_env.FCP_CPL_inject = 1; dma_type = "CLPD"; HdrFC = f_env.Scenario.denaliInitialCompletionHeaderCredit; DataFC = FC_D_over2048 ;}
99// {
100// PCIETlpTrans.MyPacket.DenaliErr = PCIE_EI_TLP_NULL;
101// // PCIETlpTrans.tempSuppressDenaliErr(PCIE_PL_NONFATAL_FRAME_NULL_TLP );
102// // PCIETlpTrans.tempSuppressDenaliErr_enable_callback(PCIE_PL_NONFATAL_FRAME_NULL_TLP );
103// nullTlpErr = 1;
104// nullTlpErrInjected += 1;
105// at time %d, nullTlpErrWeightselected \n"
106// , get_time(LO));
107//
108// }
109//
110// }
111//
112// at time %0d, FC_type to be sent = %0s \n", get_time(LO), dma_type);
113
114 // allocate the tag
115 f_env.allocDmaTag(ingressTag);
116 // sending the randomized dma xaction
117
118 randcase {
119 10: dma_type = "dmawrite";
120 0: dma_type = "dmaread";
121 // 10: dma_type = "dmacpl";
122 }
123
124 null_tlp = 1;
125
126 printf("AC: dma_type = %s \n", dma_type);
127
128 if (dma_type == "dmawrite" ) {
129 f_env.genIngressWrReq (ingressTag, ingressHdr, ingressData);
130ingressHdr[PEC_PCI__TD] = 0;
131 f_env.drivePCIE(ingressHdr, ingressData, *,*,*,*,*,*,null_tlp);
132 }
133 if (dma_type == "dmaread" ) {
134 f_env.genIngressRdReq (ingressTag, ingressHdr, ingressData);
135ingressHdr[PEC_PCI__TD] = 0;
136 f_env.drivePCIE(ingressHdr, ingressData,*,*,*,*,*,*,null_tlp);
137 }
138 if (dma_type == "dmacpl" ) {
139 // f_env.genIngressCpl (reqHdr, cplHdr, cplData);
140 f_env.genIngressCpl (ingressHdr, ingressHdr, ingressData); // don't care in this test, just sending dummy
141ingressHdr[PEC_PCI__TD] = 0;
142 f_env.drivePCIE(ingressHdr, ingressData,*,*,*,*,*,*,null_tlp);
143 }
144
145 null_tlp = 0;
146 f_env.freeDmaTag(ingressTag);
147
148
149 nmbrnullTlpErrsInjected += 1;
150 printf("AC: ilupeuIngressnullTlpErr injects error: nmbrnullTlpErrsInjected=%0d nmbrnullTlpErrsToInject=%0d \n",nmbrnullTlpErrsInjected, nmbrnullTlpErrsToInject);
151
152 repeat (nullTlpErrsInject_freq) @(posedge CLOCK);
153 }
154
155 //Delay to allow the last error to propogate before checking
156 repeat( 200 ) @(posedge CLOCK);
157
158 //Track possible errors based on the type of errors injected
159 nmbrErrs = 0; // number of error type that got set.
160
161
162 if (nmbrnullTlpErrsInjected >= 1) {
163 nmbrErrs += 2; // dlpl and oe primary error got set, does not cause secondary oe error
164 }
165
166 printf("AC: nmbrErrs = %d \n", nmbrErrs);
167
168
169
170 if( f_errQueue != 0 ){
171
172 // note: bx = no header to check
173 // bx0 = error above is optional. clear it if it's set
174
175 mailbox_put( f_errQueue, e_ERR_none );
176 mailbox_put( f_errQueue, nmbrErrs );
177
178 if (nmbrnullTlpErrsInjected >= 1) {
179 mailbox_put( f_errQueue, e_ERR_dlpl_src_tlp ); // Ingress TLP w/ inverted CRC and EDB error
180 mailbox_put( f_errQueue, 128'bx );
181 mailbox_put( f_errQueue, e_ERR_oe_lin ); // oe error link interrupt event
182 mailbox_put( f_errQueue, 128'bx );
183 }
184
185 } // f_errQueue !=0
186
187 repeat( 10 ) @(posedge CLOCK);
188 semaphore_put( FCPErr_semaphore, 1 );
189
190 } /* end Execute */
191
192 } /* end IngressUnsupportDLLPErr */