Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / env / ilu_peu / vera / N2fc / N2fcDMAPEUCtx.vr
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: N2fcDMAPEUCtx.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 N2fcDMAPEUCtx extends PEUCtxBase {
36
37
38 public bit [31:0] DWLen;
39 public bit [63:0] SAddr;
40 public bit [63:0] EAddr;
41
42 public string f_mode; // To allow non 'random' noise
43 integer f_index;
44 bit[3:0] f_first;
45 bit[3:0] f_last;
46 local bit[2:0] f_rc;
47 local integer f_len;
48
49 integer f_rdWeight; // Relative # of memory-reads
50 integer f_wrWeight; // Relative # of memory-writes
51 integer f_msgWeight; // Relative # of messages
52 integer f_poisonPct; // % of memory-reads w bad data
53 integer f_maxPayloadPct; // % of memory-writes w max data
54
55
56 task new( string a_name, PEUTestEnv a_env, string a_mode );
57 task Execute();
58 public function CTStrategyBase ProvideStrategy();
59 public function CTStrategyBase FinalizeParms( CTStrategyBase a_strategy );
60
61}
62
63
64task N2fcDMAPEUCtx::new( string a_name, PEUTestEnv a_env, string a_mode ) {
65 super.new(a_name,a_env);
66 f_mode = a_mode;
67 f_index = 0;
68 f_first = 0;
69 f_last = 0;
70 f_len = 0;
71 f_rc = 0;
72 f_rdWeight = 0;
73 f_wrWeight = 0;
74 f_msgWeight = 0;
75 f_poisonPct = 0;
76 f_maxPayloadPct = -1;
77
78 //// printf ("\n UDEBUG : N2fcDMAPEUCtx::new called \n");
79}
80
81
82
83task N2fcDMAPEUCtx::Execute() {
84 super.Execute();
85 printf ("\n UDEBUG : N2fcDMAPEUCtx::Execute called \n");
86}
87
88function CTStrategyBase N2fcDMAPEUCtx::ProvideStrategy() {
89 PEUStrBase nullStr;
90 N2fcDmaWrPEUStr dmaWr;
91 DmaRdPEUStr dmaRd;
92 DmaMsgPEUStr dmaMsg;
93
94 integer dwbe;
95 integer maxLen;
96 integer NumCmds;
97
98
99 // If the "StratStop" (within the base
100 // context class) has been set, then
101 // just return a base context which
102 // does nothing.
103 if ( this.StratStop )
104 {
105 printf ("N2fcDMAPEUCtx::ProvideStrategy StratStop set \n");
106 nullStr = new( f_env );
107 ProvideStrategy = nullStr;
108 }
109
110 // The directed (memory) write test
111 // does every possible DWBE. That's
112 // any "firstDWBE" for 1-DW payloads
113 // (including zero), and any non-zero
114 // DWBE (first and last) for 2-DWs on
115 // a quad-word boundary, and any of the
116 // four contiguous DWBE values for all
117 // other payloads.
118 else if ( f_mode == "write" )
119 {
120 dmaWr = new( f_env );
121
122 dmaWr.SetAddrBndy( 0 );
123 dmaWr.SetLen(DWLen);
124 dmaWr.SetFirstDWBE(4'hf);
125 dmaWr.SetLastDWBE(4'hf);
126
127 dmaWr.N2fcSetAddr (SAddr, EAddr);
128 printf ("UDEBUG : N2fcDMAPEUCtx::write: A = %0h %0h, Len = 'd%0d\n",
129 SAddr, EAddr, DWLen);
130
131 ProvideStrategy = dmaWr;
132
133
134 // If we fell through, then anything will do.
135 }
136
137 // The "bulk write" test makes sure that
138 // the lengths up to the maximum are
139 // supported, and that the ILU can
140 // handle cases where the IDB wraps.
141 else if ( f_mode == "bulk write" )
142 {
143 dmaWr = new( f_env );
144 maxLen = f_env.getMaxPayloadSize();
145 printf ("\n UDEBUG : N2fcDMAPEUCtx::bulk_write called f_index = 'd%0d, maxLen = 'd%0d\n", f_index, maxLen);
146
147 //// f_index = f_index + 1;
148 if ( f_index*4 < maxLen )
149 dmaWr.SetLen( f_index );
150
151// f_index = f_index + 1;
152// if ( f_index*4 < maxLen )
153// dmaWr.SetLen( f_index + 1 );
154
155 ProvideStrategy = dmaWr;
156 }
157
158 // The "bulk read" test makes sure that
159 // the ILU wraps around the DOU.
160 else if ( f_mode == "bulk read" )
161 {
162 printf ("\n UDEBUG : N2fcDMAPEUCtx::bulk_read called \n");
163 dmaRd = new( f_env );
164 maxLen = f_env.getMaxPayloadSize();
165
166 // The first strategy will perform a
167 // 2DW read which crosses the DOU
168 // block boundary (or RCB).
169 f_index = f_index + 1;
170 if ( f_index == 1 )
171 {
172 dmaRd.SetLen( f_index + 1 );
173 /* Oops! Don't know how to force the DOU to wrap! */ /*???*/
174 }
175
176 // Try every request-size up to the max.
177 else if ( f_index == 2 )
178 dmaRd.SetLen( f_env.getMaxRequestSize() / 4 );
179 else if ( f_index < 64 && f_index*4 < maxLen )
180 dmaRd.SetLen( f_index + 1 );
181 else
182 dmaRd.SetLen( maxLen/4 - f_index%8 );
183
184 ProvideStrategy = dmaRd;
185 }
186 else {
187 printf ("\n UDEBUG : N2fcDMAPEUCtx::ProvideStrategy : Unknown command called \n");
188 }
189
190} /* end ProvideStrategy */
191
192
193
194
195function CTStrategyBase N2fcDMAPEUCtx::FinalizeParms( CTStrategyBase a_strategy ) {
196 FinalizeParms = a_strategy;
197}
198
199