packet.hh (11256:65db40192591) packet.hh (11284:b3926db25371)
1/*
2 * Copyright (c) 2012-2015 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 125 unchanged lines hidden (view full) ---

134 * List of command attributes.
135 */
136 enum Attribute
137 {
138 IsRead, //!< Data flows from responder to requester
139 IsWrite, //!< Data flows from requester to responder
140 IsUpgrade,
141 IsInvalidate,
1/*
2 * Copyright (c) 2012-2015 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 125 unchanged lines hidden (view full) ---

134 * List of command attributes.
135 */
136 enum Attribute
137 {
138 IsRead, //!< Data flows from responder to requester
139 IsWrite, //!< Data flows from requester to responder
140 IsUpgrade,
141 IsInvalidate,
142 NeedsExclusive, //!< Requires exclusive copy to complete in-cache
142 NeedsWritable, //!< Requires writable copy to complete in-cache
143 IsRequest, //!< Issued by requester
144 IsResponse, //!< Issue by responder
145 NeedsResponse, //!< Requester needs response from target
146 IsEviction,
147 IsSWPrefetch,
148 IsHWPrefetch,
149 IsLlsc, //!< Alpha/MIPS LL or SC access
150 HasData, //!< There is an associated payload

--- 33 unchanged lines hidden (view full) ---

184
185 public:
186
187 bool isRead() const { return testCmdAttrib(IsRead); }
188 bool isWrite() const { return testCmdAttrib(IsWrite); }
189 bool isUpgrade() const { return testCmdAttrib(IsUpgrade); }
190 bool isRequest() const { return testCmdAttrib(IsRequest); }
191 bool isResponse() const { return testCmdAttrib(IsResponse); }
143 IsRequest, //!< Issued by requester
144 IsResponse, //!< Issue by responder
145 NeedsResponse, //!< Requester needs response from target
146 IsEviction,
147 IsSWPrefetch,
148 IsHWPrefetch,
149 IsLlsc, //!< Alpha/MIPS LL or SC access
150 HasData, //!< There is an associated payload

--- 33 unchanged lines hidden (view full) ---

184
185 public:
186
187 bool isRead() const { return testCmdAttrib(IsRead); }
188 bool isWrite() const { return testCmdAttrib(IsWrite); }
189 bool isUpgrade() const { return testCmdAttrib(IsUpgrade); }
190 bool isRequest() const { return testCmdAttrib(IsRequest); }
191 bool isResponse() const { return testCmdAttrib(IsResponse); }
192 bool needsExclusive() const { return testCmdAttrib(NeedsExclusive); }
192 bool needsWritable() const { return testCmdAttrib(NeedsWritable); }
193 bool needsResponse() const { return testCmdAttrib(NeedsResponse); }
194 bool isInvalidate() const { return testCmdAttrib(IsInvalidate); }
195 bool isEviction() const { return testCmdAttrib(IsEviction); }
196
197 /**
198 * A writeback is an eviction that carries data.
199 */
200 bool isWriteback() const { return testCmdAttrib(IsEviction) &&

--- 46 unchanged lines hidden (view full) ---

247 typedef ::Flags<FlagsType> Flags;
248
249 private:
250
251 enum : FlagsType {
252 // Flags to transfer across when copying a packet
253 COPY_FLAGS = 0x0000000F,
254
193 bool needsResponse() const { return testCmdAttrib(NeedsResponse); }
194 bool isInvalidate() const { return testCmdAttrib(IsInvalidate); }
195 bool isEviction() const { return testCmdAttrib(IsEviction); }
196
197 /**
198 * A writeback is an eviction that carries data.
199 */
200 bool isWriteback() const { return testCmdAttrib(IsEviction) &&

--- 46 unchanged lines hidden (view full) ---

247 typedef ::Flags<FlagsType> Flags;
248
249 private:
250
251 enum : FlagsType {
252 // Flags to transfer across when copying a packet
253 COPY_FLAGS = 0x0000000F,
254
255 SHARED = 0x00000001,
255 // Does this packet have sharers (which means it should not be
256 // considered writable) or not. See setHasSharers below.
257 HAS_SHARERS = 0x00000001,
258
256 // Special control flags
257 /// Special timing-mode atomic snoop for multi-level coherence.
258 EXPRESS_SNOOP = 0x00000002,
259 // Special control flags
260 /// Special timing-mode atomic snoop for multi-level coherence.
261 EXPRESS_SNOOP = 0x00000002,
259 /// Does supplier have exclusive copy?
260 /// Useful for multi-level coherence.
261 SUPPLY_EXCLUSIVE = 0x00000004,
262 // Snoop response flags
263 MEM_INHIBIT = 0x00000008,
264
262
263 /// Allow a responding cache to inform the cache hierarchy
264 /// that it had a writable copy before responding. See
265 /// setResponderHadWritable below.
266 RESPONDER_HAD_WRITABLE = 0x00000004,
267
268 // Snoop co-ordination flag to indicate that a cache is
269 // responding to a snoop. See setCacheResponding below.
270 CACHE_RESPONDING = 0x00000008,
271
265 /// Are the 'addr' and 'size' fields valid?
266 VALID_ADDR = 0x00000100,
267 VALID_SIZE = 0x00000200,
268
269 /// Is the data pointer set to a value that shouldn't be freed
270 /// when the packet is destroyed?
271 STATIC_DATA = 0x00001000,
272 /// The data pointer points to a value that should be freed when

--- 217 unchanged lines hidden (view full) ---

490 /// Return the index of this command.
491 inline int cmdToIndex() const { return cmd.toInt(); }
492
493 bool isRead() const { return cmd.isRead(); }
494 bool isWrite() const { return cmd.isWrite(); }
495 bool isUpgrade() const { return cmd.isUpgrade(); }
496 bool isRequest() const { return cmd.isRequest(); }
497 bool isResponse() const { return cmd.isResponse(); }
272 /// Are the 'addr' and 'size' fields valid?
273 VALID_ADDR = 0x00000100,
274 VALID_SIZE = 0x00000200,
275
276 /// Is the data pointer set to a value that shouldn't be freed
277 /// when the packet is destroyed?
278 STATIC_DATA = 0x00001000,
279 /// The data pointer points to a value that should be freed when

--- 217 unchanged lines hidden (view full) ---

497 /// Return the index of this command.
498 inline int cmdToIndex() const { return cmd.toInt(); }
499
500 bool isRead() const { return cmd.isRead(); }
501 bool isWrite() const { return cmd.isWrite(); }
502 bool isUpgrade() const { return cmd.isUpgrade(); }
503 bool isRequest() const { return cmd.isRequest(); }
504 bool isResponse() const { return cmd.isResponse(); }
498 bool needsExclusive() const { return cmd.needsExclusive(); }
505 bool needsWritable() const { return cmd.needsWritable(); }
499 bool needsResponse() const { return cmd.needsResponse(); }
500 bool isInvalidate() const { return cmd.isInvalidate(); }
501 bool isEviction() const { return cmd.isEviction(); }
502 bool isWriteback() const { return cmd.isWriteback(); }
503 bool hasData() const { return cmd.hasData(); }
504 bool isLLSC() const { return cmd.isLLSC(); }
505 bool isError() const { return cmd.isError(); }
506 bool isPrint() const { return cmd.isPrint(); }
507 bool isFlush() const { return cmd.isFlush(); }
508
506 bool needsResponse() const { return cmd.needsResponse(); }
507 bool isInvalidate() const { return cmd.isInvalidate(); }
508 bool isEviction() const { return cmd.isEviction(); }
509 bool isWriteback() const { return cmd.isWriteback(); }
510 bool hasData() const { return cmd.hasData(); }
511 bool isLLSC() const { return cmd.isLLSC(); }
512 bool isError() const { return cmd.isError(); }
513 bool isPrint() const { return cmd.isPrint(); }
514 bool isFlush() const { return cmd.isFlush(); }
515
509 // Snoop flags
510 void assertMemInhibit()
516 //@{
517 /// Snoop flags
518 /**
519 * Set the cacheResponding flag. This is used by the caches to
520 * signal another cache that they are responding to a request. A
521 * cache will only respond to snoops if it has the line in either
522 * Modified or Owned state. Note that on snoop hits we always pass
523 * the line as Modified and never Owned. In the case of an Owned
524 * line we proceed to invalidate all other copies.
525 *
526 * On a cache fill (see Cache::handleFill), we check hasSharers
527 * first, ignoring the cacheResponding flag if hasSharers is set.
528 * A line is consequently allocated as:
529 *
530 * hasSharers cacheResponding state
531 * true false Shared
532 * true true Shared
533 * false false Exclusive
534 * false true Modified
535 */
536 void setCacheResponding()
511 {
512 assert(isRequest());
537 {
538 assert(isRequest());
513 assert(!flags.isSet(MEM_INHIBIT));
514 flags.set(MEM_INHIBIT);
539 assert(!flags.isSet(CACHE_RESPONDING));
540 flags.set(CACHE_RESPONDING);
515 }
541 }
516 bool memInhibitAsserted() const { return flags.isSet(MEM_INHIBIT); }
517 void assertShared() { flags.set(SHARED); }
518 bool sharedAsserted() const { return flags.isSet(SHARED); }
542 bool cacheResponding() const { return flags.isSet(CACHE_RESPONDING); }
543 /**
544 * On fills, the hasSharers flag is used by the caches in
545 * combination with the cacheResponding flag, as clarified
546 * above. If the hasSharers flag is not set, the packet is passing
547 * writable. Thus, a response from a memory passes the line as
548 * writable by default.
549 *
550 * The hasSharers flag is also used by upstream caches to inform a
551 * downstream cache that they have the block (by calling
552 * setHasSharers on snoop request packets that hit in upstream
553 * cachs tags or MSHRs). If the snoop packet has sharers, a
554 * downstream cache is prevented from passing a dirty line upwards
555 * if it was not explicitly asked for a writable copy. See
556 * Cache::satisfyCpuSideRequest.
557 *
558 * The hasSharers flag is also used on writebacks, in
559 * combination with the WritbackClean or WritebackDirty commands,
560 * to allocate the block downstream either as:
561 *
562 * command hasSharers state
563 * WritebackDirty false Modified
564 * WritebackDirty true Owned
565 * WritebackClean false Exclusive
566 * WritebackClean true Shared
567 */
568 void setHasSharers() { flags.set(HAS_SHARERS); }
569 bool hasSharers() const { return flags.isSet(HAS_SHARERS); }
570 //@}
519
571
520 // Special control flags
521 void setExpressSnoop() { flags.set(EXPRESS_SNOOP); }
522 bool isExpressSnoop() const { return flags.isSet(EXPRESS_SNOOP); }
523 void setSupplyExclusive() { flags.set(SUPPLY_EXCLUSIVE); }
524 bool isSupplyExclusive() const { return flags.isSet(SUPPLY_EXCLUSIVE); }
572 /**
573 * The express snoop flag is used for two purposes. Firstly, it is
574 * used to bypass flow control for normal (non-snoop) requests
575 * going downstream in the memory system. In cases where a cache
576 * is responding to a snoop from another cache (it had a dirty
577 * line), but the line is not writable (and there are possibly
578 * other copies), the express snoop flag is set by the downstream
579 * cache to invalidate all other copies in zero time. Secondly,
580 * the express snoop flag is also set to be able to distinguish
581 * snoop packets that came from a downstream cache, rather than
582 * snoop packets from neighbouring caches.
583 */
584 void setExpressSnoop() { flags.set(EXPRESS_SNOOP); }
585 bool isExpressSnoop() const { return flags.isSet(EXPRESS_SNOOP); }
586
587 /**
588 * On responding to a snoop request (which only happens for
589 * Modified or Owned lines), make sure that we can transform an
590 * Owned response to a Modified one. If this flag is not set, the
591 * responding cache had the line in the Owned state, and there are
592 * possibly other Shared copies in the memory system. A downstream
593 * cache helps in orchestrating the invalidation of these copies
594 * by sending out the appropriate express snoops.
595 */
596 void setResponderHadWritable()
597 {
598 assert(cacheResponding());
599 flags.set(RESPONDER_HAD_WRITABLE);
600 }
601 bool responderHadWritable() const
602 { return flags.isSet(RESPONDER_HAD_WRITABLE); }
603
525 void setSuppressFuncError() { flags.set(SUPPRESS_FUNC_ERROR); }
526 bool suppressFuncError() const { return flags.isSet(SUPPRESS_FUNC_ERROR); }
527 void setBlockCached() { flags.set(BLOCK_CACHED); }
528 bool isBlockCached() const { return flags.isSet(BLOCK_CACHED); }
529 void clearBlockCached() { flags.clear(BLOCK_CACHED); }
530
531 // Network error conditions... encapsulate them as methods since
532 // their encoding keeps changing (from result field to command

--- 550 unchanged lines hidden ---
604 void setSuppressFuncError() { flags.set(SUPPRESS_FUNC_ERROR); }
605 bool suppressFuncError() const { return flags.isSet(SUPPRESS_FUNC_ERROR); }
606 void setBlockCached() { flags.set(BLOCK_CACHED); }
607 bool isBlockCached() const { return flags.isSet(BLOCK_CACHED); }
608 void clearBlockCached() { flags.clear(BLOCK_CACHED); }
609
610 // Network error conditions... encapsulate them as methods since
611 // their encoding keeps changing (from result field to command

--- 550 unchanged lines hidden ---