Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / env / ilu_peu / vera / N2str / ilupeuInErrPEUStr.vr
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: ilupeuInErrPEUStr.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 InErrPEUStr extends PEUStrBase
36 {
37 integer f_errQueue; // A mailbox for bad pkt headers
38 integer f_offs; // The offset for the pty error
39
40 task new( PEUTestEnv a_env )
41 {
42 super.new( a_env );
43 f_errQueue = 0;
44 f_offs = 0;
45 }
46
47 task SetErrQueue( integer a_queue )
48 {
49 f_errQueue = a_queue;
50 } /* end SetErrQueue */
51
52 task SetOffset( integer a_offs )
53 {
54 f_offs = a_offs;
55 } /* end SetErrOffs */
56
57 task Execute()
58 {
59 bit [7:0] tlpTag;
60 bit [127:0] tlpHdr;
61 integer tlpData;
62
63 // Generate a DMA request, big enough
64 // for the given offset.
65 if ( f_offs == 0 ) f_offs = 17 + urandom()%32;
66 f_env.allocDmaTag( tlpTag );
67 if ( f_offs > 15 )
68 f_env.genEgressWrReq( tlpTag, tlpHdr, tlpData, f_offs/4 - 2 );
69 else
70 f_env.genEgressWrReq( tlpTag, tlpHdr, tlpData );
71
72 // Present the bad TLP to the TLU.
73 // Since the TLU presents the TLP to the
74 // ILU (with bad parity), we have to get
75 // some posted credits.
76 f_env.reserveIngressCredits( tlpHdr );
77 f_env.drivePCIE( tlpHdr, tlpData, 0, f_offs );
78 f_env.consumeIngressCredits( tlpHdr );
79
80 // An error in the header means we're
81 // going into the 'drain state'.
82 // Otherwise, expect the TLP (with bad
83 // parity) from the ILU.
84 if ( f_offs <= 16 )
85 {
86 f_env.enterDrainState();
87// f_env.waitIngressLatency( tlpHdr );
88//N2 review while( !IHB.err ) @(posedge IHB.clk);
89 f_env.wait(100);
90 }
91 else
92 {
93 f_env.errorPayload( tlpData );
94 f_env.expectILU( tlpHdr, tlpData );
95 f_env.freeDmaTag( tlpTag );
96 }
97
98 // Tell the error-checker about this
99 // bad-boy.
100 if ( f_errQueue != 0 )
101 {
102 // A parity error within the first 16
103 // bytes will yield an IHB error!
104 if ( f_offs <= 16 )
105 {
106 mailbox_put( f_errQueue, e_ERR_none );
107 mailbox_put( f_errQueue, 2 );
108 mailbox_put( f_errQueue, e_ERR_ilu_ihb );
109 mailbox_put( f_errQueue, 128'bx );
110 }
111 mailbox_put( f_errQueue, e_ERR_oe_iip );
112 mailbox_put( f_errQueue, 128'bx );
113 }
114
115 } /* end Execute */
116 } /* end InErrPEUStr */