Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: XactorBaseTransaction.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 <vera_defines.vrh> | |
36 | #include "XactorBasePacket.vrh" | |
37 | #include "XactorBaseSignalInterface.vrh" | |
38 | #include "XactorBaseManager.vrh" | |
39 | #include "XactorDefines.vri" | |
40 | #include "CTTransactionID.vrh" | |
41 | ||
42 | #include "cReport.vrh" | |
43 | ||
44 | virtual class XactorBaseTransaction { | |
45 | ||
46 | // Transactor Name. This should be the same name for all transaction | |
47 | // objects using the same DUT interface. | |
48 | protected string XactorName; | |
49 | ||
50 | // Transactor Data Packet handle. It encapsulates data related to a transaction. | |
51 | protected XactorBasePacket Packet; | |
52 | ||
53 | // Transactor Drive/Expect Manager handle. Process drives and expects. | |
54 | XactorBaseManager Manager; | |
55 | ||
56 | // Transactor Signal-Interface Manager handle. Drives and samples transactions from | |
57 | // the DUT, decodes/builds packets(with the driven/sampled data signals), and | |
58 | // receives/sends packets from/to the transactor manager. | |
59 | XactorBaseSignalInterface SignalInterface; | |
60 | ||
61 | // Report handle. Generates different types of messages. | |
62 | ReportClass MyReport; | |
63 | ||
64 | task new() {} | |
65 | ||
66 | // Pass a CTTransactionID object to the transaction | |
67 | virtual task SetID(CTTransactionID XactionID); | |
68 | ||
69 | // Returns a CTTransactionID | |
70 | virtual function CTTransactionID GetID(); | |
71 | ||
72 | // FieldType is a string that indicates which field (within the Packet member) to set. | |
73 | // FieldValue is the actual value that the packet field will be set to. | |
74 | virtual task SetPacket(string FieldType, | |
75 | bit [XACT_FIELD_WIDTH-1:0] FieldValue | |
76 | ); | |
77 | ||
78 | // FieldType is a string that indicates which field (within the Packet member) to get. | |
79 | // FieldValue is the returned value of the field indicated by FieldType. | |
80 | virtual function bit [XACT_FIELD_WIDTH-1:0] GetPacket(string FieldType); | |
81 | ||
82 | // Resets the Packet member. | |
83 | virtual task ResetPacket(); | |
84 | ||
85 | // FieldType is a string that indicates which field (within the Signal Interface member) | |
86 | // to set. FieldValue is the actual value that the packet field will be set to. | |
87 | virtual task SetSignalInterface(string FieldType, | |
88 | bit [XACT_FIELD_WIDTH-1:0] FieldValue | |
89 | ); | |
90 | ||
91 | // FieldType is a string that indicates which field (within the Signal Interface member) | |
92 | // to get. FieldValue is the returned value of the field indicated by FieldType. | |
93 | virtual function bit [XACT_FIELD_WIDTH-1:0] GetSignalInterface(string FieldType); | |
94 | ||
95 | // This task will use the report utility to print all the information about the | |
96 | // transaction. | |
97 | virtual task Display(string msg = ""); | |
98 | ||
99 | // This function returns the name of the transactor. | |
100 | virtual function string Name(); | |
101 | ||
102 | // This task prints a complete list of all the pending expects of the transactor. | |
103 | virtual task DumpExpectList(); | |
104 | ||
105 | // Returns 1 if an expect (with the same value of the Packet member) is pending and | |
106 | // 0 otherwise. | |
107 | virtual function bit IsExpectPending(); | |
108 | ||
109 | // Returns the number of pending expects of the transactor. | |
110 | virtual function integer ExpectCount(); | |
111 | ||
112 | // This function is similar to the Expect(next one). The only difference is in the case of a | |
113 | // timeout, the expect thread will be silently removed from the expect manager data structures. | |
114 | virtual function bit ExpectExpire(integer Window); | |
115 | ||
116 | // This function will launch an expect thread. The thread will be installed in the data | |
117 | // structures of the expect manager and will stay there waiting for the DUT to drive the | |
118 | // expected value. | |
119 | // If Expect is satisfied by a matched transaction driven by the DUT within the Window period, | |
120 | // then the function returns a 1 indicating success. If the Window period elapses without a | |
121 | // match, then it returns a 0. | |
122 | virtual function bit Expect(integer Window); | |
123 | ||
124 | // This task will launch a thread that will be waiting for the next transaction driven by the | |
125 | // DUT. It will then return a packet object (through the parameter list) with the data fields | |
126 | // of the sampled transaction. | |
127 | virtual task Sample(XactorBasePacket Pkt, | |
128 | integer Window = 50000 | |
129 | ); | |
130 | ||
131 | // This function removes a pending expect for a transaction that matches the values in Packet. If | |
132 | // a pending expect is found the function returns 1, and 0 otherwise. | |
133 | virtual function bit Remove(); | |
134 | ||
135 | // This task initiates a transaction to be driven to the DUT. | |
136 | // D : Number of cycles (delay) before the transaction is sent to the drive manager to be | |
137 | // scheduled. It could be seen as a priority given to the drive transaction, the larger the | |
138 | // delay number, the longer the time the transaction will have to wait before it is scheduled | |
139 | // for driving. The default value is 0, which schedules the drive transaction immediately. | |
140 | virtual task Drive(integer D = 0); | |
141 | ||
142 | // This task enables the transactor. Any scheduled drives or pending expects are resumed. | |
143 | virtual task Enable(); | |
144 | ||
145 | // This task disables the transactor, preventing reporting of unexpected transactions or | |
146 | // incorrect design behavior. Scheduled drives and pending expects are suspended, but not lost. | |
147 | virtual task Disable(); | |
148 | ||
149 | // This task resets the state of the transactor. All scheduled drives and pending expects are lost. | |
150 | virtual task Reset(); | |
151 | ||
152 | } |