Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / env / fnx / vlib / XactorComponents / src / XactorBinTreeDupExpect.vr
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: XactorBinTreeDupExpect.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#include "XactorBinTree.vrh"
36
37class XactorBinTreeDupExpect extends XactorBinTree {
38
39 // Public method. Deletes a node with the specified values and returns
40 // Success = 1 if the node was found and deleted and Success = 0 otherwise.
41 virtual protected task DeleteDup (XactorBasePacket Key,
42 TreeNode NodePtr,
43 var bit Success
44 );
45
46 // Deletes all nodes that match Key
47 virtual protected task WildCardDeleteDup (XactorBasePacket Key,
48 TreeNode NodePtr,
49 var bit Success
50 );
51
52 // Deletes all nodes that match key using wildcards.
53 virtual task Delete (XactorBasePacket Key,
54 var bit Success
55 );
56
57 // Deletes all nodes that match key using wildcards.
58 virtual task WildCardDelete1 (XactorBasePacket Key,
59 var bit Success
60 );
61
62}
63
64 ////////////////
65 // Definitions
66////////////////
67
68// Public method. Deletes a node with the specified values and returns
69// Success = 1 if the node was found and deleted and Success = 0 otherwise.
70task XactorBinTreeDupExpect::DeleteDup (XactorBasePacket Key,
71 TreeNode NodePtr,
72 var bit Success
73 ) {
74 TreeNode z;
75
76 z = TreeSearch(NodePtr, Key);
77
78 if(z !== null) {
79 Key.SetID(z.Item.GetID());
80 if(Success == 1'b1) // check if this is not the first node deleted.
81 z.Item.PktDisplay(RTYP_XACTOR_FMWORK_DUP_WILDCARD_EXPECT_WARN, "Sampled Transaction satisfies duplicated Expect");
82
83 trigger(ON, z.RemoveEvents[XACT_COMP_EXPECT_REMOVED_EVENT]); // Remove event
84 trigger(ON, z.RemoveEvents[XACT_COMP_EXPECT_REMOVED_BY_XACTOR_EVENT]); // Removed by xactor
85
86 Success = 1'b1;
87 DeleteNode(z);
88
89 if(z.Right != null)
90 DeleteDup (Key, z.Right, Success);
91 }
92}
93
94// Deletes all nodes that match Key
95task XactorBinTreeDupExpect::WildCardDeleteDup (XactorBasePacket Key,
96 TreeNode NodePtr,
97 var bit Success
98 ) {
99 TreeNode z;
100
101 z = WCTreeSearch(NodePtr, Key);
102
103 if(z != null) {
104 Key.SetID(z.Item.GetID());
105 z.Item.PktCopy(Key); // Copy contents of sampled packet to expected packet
106 if(Success == 1'b1) // check if this is not the first node deleted.
107 z.Item.PktDisplay(RTYP_XACTOR_FMWORK_DUP_WILDCARD_EXPECT_WARN, "Sampled Transaction satisfies duplicated Expect");
108
109 trigger(ON, z.RemoveEvents[XACT_COMP_EXPECT_REMOVED_EVENT]); // Remove event
110 trigger(ON, z.RemoveEvents[XACT_COMP_EXPECT_REMOVED_BY_XACTOR_EVENT]); // Removed by xactor
111
112 Success = 1'b1;
113 DeleteNode(z);
114
115
116 if(z.Right != null)
117 WildCardDeleteDup (Key, z.Right, Success);
118 }
119}
120
121// Deletes all nodes that match key using wildcards.
122task XactorBinTreeDupExpect::Delete (XactorBasePacket Key,
123 var bit Success
124 ) {
125 Success = 1'b0;
126 DeleteDup (Key, Head, Success);
127}
128
129// Deletes all nodes that match key using wildcards.
130task XactorBinTreeDupExpect::WildCardDelete1 (XactorBasePacket Key,
131 var bit Success
132 ) {
133 Success = 1'b0;
134 WildCardDeleteDup (Key, Head, Success);
135}
136