Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: ilupeuTimeOutPEUStr.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 TimeOutPEUStr extends PEUStrBase | |
36 | { | |
37 | integer f_errQueue; // A mailbox for bad pkt headers | |
38 | integer f_len; // The packet's payload length | |
39 | bit f_lenSpecified; // Was a length specified? | |
40 | bit f_write; | |
41 | bit[4:0] f_type; // The packet's type | |
42 | bit f_typeSpecified; // Was a type specified? | |
43 | ||
44 | task new( PEUTestEnv a_env ) | |
45 | { | |
46 | super.new( a_env ); | |
47 | f_errQueue = 0; | |
48 | f_lenSpecified = 0; | |
49 | f_typeSpecified = 0; | |
50 | } | |
51 | ||
52 | task SetErrQueue( integer a_queue ) | |
53 | { | |
54 | f_errQueue = a_queue; | |
55 | } /* end SetErrQueue */ | |
56 | ||
57 | task SetLength( integer a_len ) | |
58 | { | |
59 | f_len = a_len; | |
60 | f_lenSpecified = 1; | |
61 | } /* end SetLength */ | |
62 | ||
63 | task SetType( integer a_type, (bit is_write=0) ) | |
64 | { | |
65 | f_type = a_type; | |
66 | f_typeSpecified = 1; | |
67 | f_write = is_write; | |
68 | } /* end SetType */ | |
69 | ||
70 | task Execute() | |
71 | { | |
72 | bit[PEC_PCI__HDR] egressHdr; // The egress TLP's header | |
73 | integer egressData; // A payload descriptor | |
74 | bit[7:0] tlpTag; // The tag for the TLP | |
75 | bit[7:0] egressAddr; // The DOU starting address | |
76 | bit[PEC_PCI__HDR] ingressHdr; // The ingress TLP's header | |
77 | integer ingressData; // A payload descriptor | |
78 | bit[63:0] tluCtl; | |
79 | ||
80 | ||
81 | // Build a TLP, using the specified | |
82 | // type and length, if any. | |
83 | if ( !f_typeSpecified ) | |
84 | { | |
85 | if ( urandom()%2 ) | |
86 | { | |
87 | f_write = 0; | |
88 | randcase | |
89 | { | |
90 | 4 : { f_type = PEC_PCI__TYPE_MEM; f_len = urandom()%4 + 1; } | |
91 | 1 : { f_type = PEC_PCI__TYPE_CFG0; f_len = 1; } | |
92 | 1 : { f_type = PEC_PCI__TYPE_CFG1; f_len = 1; } | |
93 | 1 : { f_type = PEC_PCI__TYPE_IO; f_len = 1; } | |
94 | } | |
95 | } | |
96 | else | |
97 | { | |
98 | f_write = 1; | |
99 | randcase | |
100 | { | |
101 | //N2 review 1 : { f_type = PEC_PCI__TYPE_CFG0; f_len = 1; } | |
102 | 1 : { f_type = PEC_PCI__TYPE_CFG1; f_len = 1; } | |
103 | 1 : { f_type = PEC_PCI__TYPE_IO; f_len = 1; } | |
104 | } | |
105 | } | |
106 | } | |
107 | ||
108 | if ( !f_lenSpecified ) | |
109 | { | |
110 | if ( f_type == PEC_PCI__TYPE_MEM ){ | |
111 | if( f_write ) | |
112 | f_len = urandom()%2 + 1; | |
113 | else | |
114 | f_len = urandom()%4 + 1; | |
115 | } | |
116 | else | |
117 | f_len = 1; | |
118 | } | |
119 | ||
120 | // Set the time-out value to "small" | |
121 | // if it isn't already set. | |
122 | f_env.setPioTimeOut(-1); | |
123 | ||
124 | if ( f_write ) | |
125 | { | |
126 | f_env.allocWrTag( tlpTag, egressAddr ); | |
127 | f_env.genEgressWrReq( tlpTag, egressHdr, egressData, f_len, f_type ); | |
128 | } | |
129 | else | |
130 | { | |
131 | f_env.allocRdTag( tlpTag ); | |
132 | f_env.genEgressRdReq( tlpTag, egressHdr, egressData, f_len, f_type ); | |
133 | } | |
134 | ||
135 | ||
136 | ||
137 | f_env.driveILU( egressHdr, egressAddr, egressData ); | |
138 | f_env.expectPCIE( egressHdr, egressData ); | |
139 | f_env.expectTimeoutCpl( egressHdr ); | |
140 | ||
141 | if ( f_errQueue != 0 ) | |
142 | { | |
143 | mailbox_put( f_errQueue, e_ERR_none ); | |
144 | mailbox_put( f_errQueue, 2 ); | |
145 | mailbox_put( f_errQueue, e_ERR_ue_cto ); | |
146 | mailbox_put( f_errQueue, egressHdr ); | |
147 | mailbox_put( f_errQueue, e_ERR_oe_cto ); | |
148 | mailbox_put( f_errQueue, egressHdr ); | |
149 | } | |
150 | ||
151 | f_env.freePioTag( tlpTag ); | |
152 | ||
153 | } /* end Execute */ | |
154 | } /* end TimeOutPEUStr */ |