8ca1ed32c8f5b4692f3e72ff37954ffe19e13f4c
[gem5.git] / src / mem / protocol / RubySlicc_Exports.sm
1 /*
2 * Copyright (c) 1999-2012 Mark D. Hill and David A. Wood
3 * Copyright (c) 2011 Advanced Micro Devices, Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer;
10 * redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution;
13 * neither the name of the copyright holders nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30 // Declarations of external types that are common to all protocols
31 external_type(int, primitive="yes", default="0");
32 external_type(bool, primitive="yes", default="false");
33 external_type(std::string, primitive="yes");
34 external_type(uint32_t, primitive="yes");
35 external_type(uint64, primitive="yes");
36 external_type(Time, primitive="yes", default="0");
37 external_type(PacketPtr, primitive="yes");
38 external_type(Packet, primitive="yes");
39 external_type(Address);
40 external_type(Cycles, primitive="yes");
41
42 structure(DataBlock, external = "yes", desc="..."){
43 void clear();
44 void copyPartial(DataBlock, int, int);
45 }
46
47 bool testAndRead(Address addr, DataBlock datablk, Packet *pkt);
48 bool testAndWrite(Address addr, DataBlock datablk, Packet *pkt);
49
50 // AccessPermission
51 // The following five states define the access permission of all memory blocks.
52 // These permissions have multiple uses. They coordinate locking and
53 // synchronization primitives, as well as enable functional accesses.
54 // One should not need to add any additional permission values and it is very
55 // risky to do so.
56 enumeration(AccessPermission, desc="...", default="AccessPermission_NotPresent") {
57 // Valid data
58 Read_Only, desc="block is Read Only (modulo functional writes)";
59 Read_Write, desc="block is Read/Write";
60
61 // Possibly Invalid data
62 // The maybe stale permission indicates that accordingly to the protocol,
63 // there is no guarantee the block contains valid data. However, functional
64 // writes should update the block because a dataless PUT request may
65 // revalidate the block's data.
66 Maybe_Stale, desc="block can be stale or revalidated by a dataless PUT";
67 // In Broadcast/Snoop protocols, memory has no idea if it is exclusive owner
68 // or not of a block, making it hard to make the logic of having only one
69 // read_write block in the system impossible. This is to allow the memory to
70 // say, "I have the block" and for the RubyPort logic to know that this is a
71 // last-resort block if there are no writable copies in the caching hierarchy.
72 // This is not supposed to be used in directory or token protocols where
73 // memory/NB has an idea of what is going on in the whole system.
74 Backing_Store, desc="for memory in Broadcast/Snoop protocols";
75
76 // Invalid data
77 Invalid, desc="block is in an Invalid base state";
78 NotPresent, desc="block is NotPresent";
79 Busy, desc="block is in a transient state, currently invalid";
80 }
81
82 // TesterStatus
83 enumeration(TesterStatus, desc="...") {
84 Idle, desc="Idle";
85 Action_Pending, desc="Action Pending";
86 Ready, desc="Ready";
87 Check_Pending, desc="Check Pending";
88 }
89
90 // InvalidateGeneratorStatus
91 enumeration(InvalidateGeneratorStatus, desc="...") {
92 Load_Waiting, desc="Load waiting to be issued";
93 Load_Pending, desc="Load issued";
94 Inv_Waiting, desc="Store (invalidate) waiting to be issued";
95 Inv_Pending, desc="Store (invalidate) issued";
96 }
97
98 // SeriesRequestGeneratorStatus
99 enumeration(SeriesRequestGeneratorStatus, desc="...") {
100 Thinking, desc="Doing work before next action";
101 Request_Pending, desc="Request pending";
102 }
103
104 // LockStatus
105 enumeration(LockStatus, desc="...") {
106 Unlocked, desc="Lock is not held";
107 Locked, desc="Lock is held";
108 }
109
110 // SequencerStatus
111 enumeration(SequencerStatus, desc="...") {
112 Idle, desc="Idle";
113 Pending, desc="Pending";
114 }
115
116 enumeration(TransitionResult, desc="...") {
117 Valid, desc="Valid transition";
118 ResourceStall, desc="Stalled due to insufficient resources";
119 ProtocolStall, desc="Protocol specified stall";
120 }
121
122 // RubyRequestType
123 enumeration(RubyRequestType, desc="...", default="RubyRequestType_NULL") {
124 LD, desc="Load";
125 ST, desc="Store";
126 ATOMIC, desc="Atomic Load/Store";
127 IFETCH, desc="Instruction fetch";
128 IO, desc="I/O";
129 REPLACEMENT, desc="Replacement";
130 Load_Linked, desc="";
131 Store_Conditional, desc="";
132 RMW_Read, desc="";
133 RMW_Write, desc="";
134 Locked_RMW_Read, desc="";
135 Locked_RMW_Write, desc="";
136 COMMIT, desc="Commit version";
137 NULL, desc="Invalid request type";
138 FLUSH, desc="Flush request type";
139 }
140
141 enumeration(SequencerRequestType, desc="...", default="SequencerRequestType_NULL") {
142 Default, desc="Replace this with access_types passed to the DMA Ruby object";
143 LD, desc="Load";
144 ST, desc="Store";
145 NULL, desc="Invalid request type";
146 }
147
148 enumeration(GenericRequestType, desc="...", default="GenericRequestType_NULL") {
149 GETS, desc="gets request";
150 GET_INSTR, desc="get instr request";
151 GETX, desc="getx request";
152 UPGRADE, desc="upgrade request";
153 DOWNGRADE, desc="downgrade request";
154 INV, desc="invalidate request";
155 INV_S, desc="invalidate shared copy request";
156 PUTS, desc="puts request";
157 PUTO, desc="puto request";
158 PUTX, desc="putx request";
159 L2_PF, desc="L2 prefetch";
160 LD, desc="Load";
161 ST, desc="Store";
162 ATOMIC, desc="Atomic Load/Store";
163 IFETCH, desc="Instruction fetch";
164 IO, desc="I/O";
165 NACK, desc="Nack";
166 REPLACEMENT, desc="Replacement";
167 WB_ACK, desc="WriteBack ack";
168 EXE_ACK, desc="Execlusive ack";
169 COMMIT, desc="Commit version";
170 LD_XACT, desc="Transactional Load";
171 LDX_XACT, desc="Transactional Load-Intend-Modify";
172 ST_XACT, desc="Transactional Store";
173 BEGIN_XACT, desc="Begin Transaction";
174 COMMIT_XACT, desc="Commit Transaction";
175 ABORT_XACT, desc="Abort Transaction";
176 DMA_READ, desc="DMA READ";
177 DMA_WRITE, desc="DMA WRITE";
178 NULL, desc="null request type";
179 }
180
181 enumeration(CacheRequestType, desc="...", default="CacheRequestType_NULL") {
182 DataArrayRead, desc="Read access to the cache's data array";
183 DataArrayWrite, desc="Write access to the cache's data array";
184 TagArrayRead, desc="Read access to the cache's tag array";
185 TagArrayWrite, desc="Write access to the cache's tag array";
186 }
187
188 enumeration(CacheResourceType, desc="...", default="CacheResourceType_NULL") {
189 DataArray, desc="Access to the cache's data array";
190 TagArray, desc="Access to the cache's tag array";
191 }
192
193 enumeration(DirectoryRequestType, desc="...", default="DirectoryRequestType_NULL") {
194 Default, desc="Replace this with access_types passed to the Directory Ruby object";
195 }
196
197 enumeration(DMASequencerRequestType, desc="...", default="DMASequencerRequestType_NULL") {
198 Default, desc="Replace this with access_types passed to the DMA Ruby object";
199 }
200
201 enumeration(MemoryControlRequestType, desc="...", default="MemoryControlRequestType_NULL") {
202 Default, desc="Replace this with access_types passed to the DMA Ruby object";
203 }
204
205 enumeration(GenericMachineType, desc="...", default="GenericMachineType_NULL") {
206 L1Cache, desc="L1 Cache Mach";
207 L2Cache, desc="L2 Cache Mach";
208 L3Cache, desc="L3 Cache Mach";
209 Directory, desc="Directory Mach";
210 DMA, desc="DMA Mach";
211 Collector, desc="Collector Mach";
212 L1Cache_wCC, desc="L1 Cache Mach with Cache Coherence (used for miss latency profile)";
213 L2Cache_wCC, desc="L1 Cache Mach with Cache Coherence (used for miss latency profile)";
214 NULL, desc="null mach type";
215 }
216
217 // MessageSizeType
218 enumeration(MessageSizeType, default="MessageSizeType_Undefined", desc="...") {
219 Undefined, desc="Undefined";
220 Control, desc="Control Message";
221 Data, desc="Data Message";
222 Request_Control, desc="Request";
223 Reissue_Control, desc="Reissued request";
224 Response_Data, desc="data response";
225 ResponseL2hit_Data, desc="data response";
226 ResponseLocal_Data, desc="data response";
227 Response_Control, desc="non-data response";
228 Writeback_Data, desc="Writeback data";
229 Writeback_Control, desc="Writeback control";
230 Broadcast_Control, desc="Broadcast control";
231 Multicast_Control, desc="Multicast control";
232 Forwarded_Control, desc="Forwarded control";
233 Invalidate_Control, desc="Invalidate control";
234 Unblock_Control, desc="Unblock control";
235 Persistent_Control, desc="Persistent request activation messages";
236 Completion_Control, desc="Completion messages";
237 }
238
239 // AccessType
240 enumeration(AccessType, desc="...") {
241 Read, desc="Reading from cache";
242 Write, desc="Writing to cache";
243 }
244
245 // RubyAccessMode
246 enumeration(RubyAccessMode, default="RubyAccessMode_User", desc="...") {
247 Supervisor, desc="Supervisor mode";
248 User, desc="User mode";
249 Device, desc="Device mode";
250 }
251
252 enumeration(PrefetchBit, default="PrefetchBit_No", desc="...") {
253 No, desc="No, not a prefetch";
254 Yes, desc="Yes, a prefetch";
255 L1_HW, desc="This is a L1 hardware prefetch";
256 L2_HW, desc="This is a L2 hardware prefetch";
257 }
258
259 // CacheMsg
260 structure(SequencerMsg, desc="...", interface="Message") {
261 Address LineAddress, desc="Line address for this request";
262 Address PhysicalAddress, desc="Physical address for this request";
263 SequencerRequestType Type, desc="Type of request (LD, ST, etc)";
264 Address ProgramCounter, desc="Program counter of the instruction that caused the miss";
265 RubyAccessMode AccessMode, desc="user/supervisor access type";
266 DataBlock DataBlk, desc="Data";
267 int Len, desc="size in bytes of access";
268 PrefetchBit Prefetch, desc="Is this a prefetch request";
269
270 bool functionalRead(Packet *pkt) {
271 return testAndRead(PhysicalAddress, DataBlk, pkt);
272 }
273
274 bool functionalWrite(Packet *pkt) {
275 return testAndWrite(PhysicalAddress, DataBlk, pkt);
276 }
277 }
278
279 // MaskPredictorType
280 enumeration(MaskPredictorType, "MaskPredictorType_Undefined", desc="...") {
281 Undefined, desc="Undefined";
282 AlwaysUnicast, desc="AlwaysUnicast";
283 TokenD, desc="TokenD";
284 AlwaysBroadcast, desc="AlwaysBroadcast";
285 TokenB, desc="TokenB";
286 TokenNull, desc="TokenNull";
287 Random, desc="Random";
288 Pairwise, desc="Pairwise";
289 Owner, desc="Owner";
290 BroadcastIfShared, desc="Broadcast-If-Shared";
291 BroadcastCounter, desc="Broadcast Counter";
292 Group, desc="Group";
293 Counter, desc="Counter";
294 StickySpatial, desc="StickySpatial";
295 OwnerBroadcast, desc="Owner/Broadcast Hybrid";
296 OwnerGroup, desc="Owner/Group Hybrid";
297 OwnerBroadcastMod, desc="Owner/Broadcast Hybrid-Mod";
298 OwnerGroupMod, desc="Owner/Group Hybrid-Mod";
299 LastNMasks, desc="Last N Masks";
300 BandwidthAdaptive, desc="Bandwidth Adaptive";
301 }
302
303 // MaskPredictorIndex
304 enumeration(MaskPredictorIndex, "MaskPredictorIndex_Undefined", desc="...") {
305 Undefined, desc="Undefined";
306 DataBlock, desc="Data Block";
307 PC, desc="Program Counter";
308 }
309
310 // MaskPredictorTraining
311 enumeration(MaskPredictorTraining, "MaskPredictorTraining_Undefined", desc="...") {
312 Undefined, desc="Undefined";
313 None, desc="None";
314 Implicit, desc="Implicit";
315 Explicit, desc="Explicit";
316 Both, desc="Both";
317 }
318
319 // Request Status
320 enumeration(RequestStatus, desc="...", default="RequestStatus_NULL") {
321 Ready, desc="The sequencer is ready and the request does not alias";
322 Issued, desc="The sequencer successfully issued the request";
323 BufferFull, desc="Can not issue because the sequencer is full";
324 Aliased, desc="This request aliased with a currently outstanding request";
325 NULL, desc="";
326 }
327
328 // LinkDirection
329 enumeration(LinkDirection, desc="...") {
330 In, desc="Inward link direction";
331 Out, desc="Outward link direction";
332 }